I left the last blogpost with an image of a video from J.U.L.I.A. being played inside ScummVM, but that image still didn’t have the clearing of the screen included, so to start of this post, here is how it currently looks:
TTF-Rendering looks better
Notice that the text is impossible to read, as well as being quite small. There was also an issue with the size of each line making the “descending” parts of characters cut off on the lowest lines. Thanks to a bit of help from LordHoto, I managed to find out that I had been stupid, and used the wrong variables for creating the drawing-surface for the fonts, I had used the font height that the scripts ask for, while in reality I should have used the font height that the TTF-loader in ScummVM returns (which is the height from the lowest point to the highest point, instead of the height from the baseline to the highest point).
While looking through the code to find out why this happened, I took this screenshot, which shows red lines at the points I was asking the TTF-font to render each line:
The fonts were also drawn about too small, as WME used a dpi that was 4/3 of what ScummVM uses in it’s TTF-code (96 vs 72), simply multiplying the font-size specified by the scripts made the font a lot better, although, there were still some issues relating to the “layering” that WME does to get the shadowed-fonts it has. As it turns out, this was done by drawing the same line multiple times with different colour-values, at differing offsets. The current draw-code did something rather silly when it got offsets (well, it simply changed the left and top parts of the rect that specifies the draw-area, without making sure the width stayed the same, making it an odd skew-and-scale-operation). Fixing that as well provided the following result:
Making sure we even bother to use the text alignment the scripts ask for, as well as mostly the right colours, provides quite an improvement for Dirty Split too, compare last posts font-rendering:
To this weeks version of the exact same scene:
String-concatenation works again:
… and I didn’t even know I broke it, well, turns out I must have replaced some variable-names in the II_ADD-script-function, and forgot to make sure everything was changed correctly, which made concatenation of strings always return NULL instead of what it was supposed to return, thus making things like SetImage completely broken, putting that right again, provided one of the biggest leaps of functionality I’ve seen in a while:
Notice that the images on the buttons are in place now in the above picture.
Entity-videos now work too
I forgot that I had to add a few bits and pieces to AdEntity too, to get the videos working for non-fullscreen scenes like this one:
Those little videos also use alpha-masks to allow for non-rectangular videos, in this case, the face in the upper right corner has such a mask to hide the parts that would otherwise fit in the rectangular box it’s being played in:
Note though that the current solution for applying alpha-masks is both ugly, and non-endian safe, and was mostly put in to make sure things looked right, I will be cleaning this up in the coming weeks.
As a final comparison: Look at this picture from last week:
Now compare that to: