aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlec Murphy <alec@checksum.fail>2021-07-05 16:37:33 -0400
committerAlec Murphy <alec@checksum.fail>2021-07-05 16:37:33 -0400
commit6d35d42972edbbcc4fc32066017e2145f81780bf (patch)
treed8d9a10577a0d448009c297fadfaa04d00e9dbe3
parent03469a83f0e33ae20c802680ce8bfcee09e14443 (diff)
Update palette directly after TG_Start
-rw-r--r--Lib/SDL2.HC4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/SDL2.HC b/Lib/SDL2.HC
index c8bbc0b..81a6f57 100644
--- a/Lib/SDL2.HC
+++ b/Lib/SDL2.HC
@@ -11,6 +11,7 @@
U8 sdl_key_state[256];
MemSet(&sdl_key_state, NULL, 256);
+Bool sdl_initial_palette_set = FALSE;
U32 sdl_game_colors[256];
CFifoI64 *sdl_event_fifo = FifoI64New(1024);
@@ -144,6 +145,7 @@ U0 SDL_EnableUNICODE() {
GET_SYSV_ARGS
debug_print("called: SDL_EnableUNICODE(%d)\n", p0);
game_start_set_colors;
+ sdl_initial_palette_set = TRUE;
TG_Start;
@SDL_EnableUNICODE(p0);
POP_SYSV_REGS
@@ -381,6 +383,8 @@ I64 @SDL_SetColors(SDL_Surface *surface, SDL_Color *colors, I64 firstcolor,
I64 i;
SDL_Color *dst_colors = surface->format->palette->colors;
for (i = firstcolor; i < ncolors; i++) {
+ if (sdl_initial_palette_set)
+ TG_ColorSet(i, colors->r, colors->g, colors->b);
sdl_game_colors[i].u8[0] = colors->r;
sdl_game_colors[i].u8[1] = colors->g;
sdl_game_colors[i].u8[2] = colors->b;