The check on the mask color is now done before decomposing
the color to its RGB values. This avoids doing the decomposition
for the transparent pixels.
Blitting on a surface with the same pixel format now also
skips the color decomposition and directly copies the color
values.
The original interpreter only checks the mask color on the source
bitmap when blitting sprites. And I checked that if I remove the
check on the destination bitmap I still get the correct result in
all 10 games I tried.
And this check was not properly implemented as if the destination
color was the mask color it was setting the result to the source
color without doing any blending. This caused the cursor in
Resonance to be missing. The reason for that is:
1. The original cursor sprite has alpha set to 0.
2. It creates a transparent (i.e. filled with the mask color)
intermediate bitmap.
3. The cursor sprite is drawn on this intermediate bitmap with the
opaque alpha blender that sets the result RGB to the source RGB
and the result alpha to 255.
4. Then this intermediate bitmap is drawn to the screen with a
source alpha blender.
The check we had on the destination pixel meant that since it is
the mask color everywhere on the intermediate bitmap, when drawing
the cursor bitmap on it it was simply copying the colors instead of
calling the blender function. As a result the alpha was set to 0
instead of 255. Then in the next step when it was blended using
the source alpha it ended up being completely transparent.
If On A Winter's Night, Four Travelers was such as game that
generated fully transparent screenshots. I am not completely
sure why it happens, and the easiest solution was to reset
the alpha byte to 0xff.
The main changce is that create_bitmap() now uses the current
get_color_depth(), as it is supposed to (according to the Allegro
documentation).
Also it remove cases where the surface could be created without the transparent color.
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.