The alfont code seems to have some inconsistency between the real from
height and the maximum height used when drawing in alfont_textout_ex.
This can cause trying to write out of bounds, and then random crashes.
This fixes bug #13601
In allegro the mask color has alpha set to 0. We were setting it
to 0xff and that caused comparaison of colors with mask to fail
in some places in the engine, for example causing the check of
whether a given position is on a sprite to fail (it was returning
true for any position inside the sprite bitmap, even if on a
transparent pixel).
See my_getpixel(Bitmap *, int x, int y) in character.cpp that
strips the alpha from the color just for that purpose (it is
called from is_pos_in_sprite()) where the pixel is compared to
the mask color..
This fixes missing actors in some games, such as Blackwell
Deception (on the boat deck where the actors are scaled to
90% or their original size).
The issue was that Allegro has defines to indicate which color
depth are available, and we removed those. But they are used
in the antialiasing code.
Allegro API to set or get the clipping rect include both the
top-left and bottom-right corners. But internally in the
BITMAP the bottom-right corner is excluded, and is thus one
more that the one in the API functions.
Also ensure that the clipping rect is used by setting the clip
flag to true. The Allegro documentation indicates that it can
be set to false to get better performances, but will result in
your program dying a horrible death if you try to draw beyond
the edges of the bitmap. And by default clip is on. AGS never
turns it off, so just ensure it is set to on in the constructor.
In allegro both the top-left and bottom-right corners are
included in the rect, but in Common::Rect the bottom-righ
corner is excluded. So we need to add one when creating the
Common::Rect.
The allegro documentation indicates it is used to tint a sprite by
blending pixels from the given sprite with the color passed to the
last call to set_trans_blender.
Only the true color version is implemented. For 256 color sprites
it should use the global color_map table created using either
create_trans_table or create_light_table.
The allegro implementation returns -1 when called with a pixel
that lies outside the bitmap. Doing the same in the implementation
in ScummVM fixes a crash in some games.
The 32-bit bitmap resources encoded by AGS had ARGB rather
than RGBA (or is it the other way around?). Anyway, this
was what was causing the KQ2 title screen to be all red.