1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-23 01:59:43 +01:00

Whiten texture only after loading surface

This fixes a regression where the red channel 0 glitch didn't work,
because the surface was always whitened, because LoadSprites would
whiten the image before converting it to surface.

This regression happened because of #923.

Fixes #962.
This commit is contained in:
Misa 2023-03-30 19:54:46 -07:00
parent 78128222e9
commit 8f23261134

View file

@ -237,15 +237,15 @@ static void LoadSprites(const char* filename, SDL_Texture** texture, SDL_Surface
unsigned char* data; unsigned char* data;
SDL_Surface* loadedImage = LoadImageRaw(filename, &data); SDL_Surface* loadedImage = LoadImageRaw(filename, &data);
*texture = LoadTextureFromRaw(filename, loadedImage, TEX_WHITE); *surface = LoadSurfaceFromRaw(loadedImage);
if (*texture == NULL) if (*surface == NULL)
{ {
vlog_error("Image not found: %s", filename); vlog_error("Image not found: %s", filename);
SDL_assert(0 && "Image not found! See stderr."); SDL_assert(0 && "Image not found! See stderr.");
} }
*surface = LoadSurfaceFromRaw(loadedImage); *texture = LoadTextureFromRaw(filename, loadedImage, TEX_WHITE);
if (*surface == NULL) if (*texture == NULL)
{ {
vlog_error("Image not found: %s", filename); vlog_error("Image not found: %s", filename);
SDL_assert(0 && "Image not found! See stderr."); SDL_assert(0 && "Image not found! See stderr.");