libsdl-org / sdl12-compat

An SDL-1.2 compatibility layer that uses SDL 2.0 behind the scenes.
Other
193 stars 40 forks source link

edgar: player character sprite transparency missing #250

Closed smcv closed 1 year ago

smcv commented 1 year ago

Prerequisites:

To reproduce:

Start a new game, and look at the player character (human near the right side of the screen) during the opening conversation.

Expected result: all work

Actual result: with sdl12-compat (either X11 or Wayland), the player character's sprite is in a lime green non-transparent rectangle. With real SDL 1.2, those parts of the sprite are transparent.

icculus commented 1 year ago

This looks like a colorkey issue:

image

icculus commented 1 year ago

Actually, it seems to be a flipping-horizontally problem:

image

When sprites face right (unflipped) ...

image

(I drew a little "X" on edgar's idle stance png with Gimp, so I knew I had the right one.)

icculus commented 1 year ago

In the flipImage function, we hit this code:

if (image->flags & SDL_SRCCOLORKEY)
    SDL_SetColorKey(flipped, SDL_RLEACCEL|SDL_SRCCOLORKEY, image->format->colorkey);

In classic 1.2, this calls SDL_SetColorKey, in sdl12-compat, it doesn't. So somewhere we lost or failed to set SDL_SRCCOLORKEY. Digging further.

smcv commented 1 year ago

Confirmed fixed as of https://github.com/libsdl-org/sdl12-compat/commit/67f8b3a85b782eefb4db90f34d5b0742ef2cb5fc (1.2.58 + 29 commits)