From 0563c4e6ee7e79695e7d3656729ba0625a208a3d Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Tue, 3 Dec 2024 20:58:21 +0100 Subject: [PATCH] fixed initializing color template images before fading out game screen --- src/game.c | 3 +++ src/game.h | 2 ++ src/init.c | 16 ++++++++++++++-- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/game.c b/src/game.c index 5a58b1c2..b9b8f2f7 100644 --- a/src/game.c +++ b/src/game.c @@ -3723,6 +3723,9 @@ void InitGame(void) FadeOut(fade_mask); + if (game.InitColorTemplateImagesNeeded) + InitColorTemplateImages(); + if (restarting) { // force restarting global animations displayed during game play diff --git a/src/game.h b/src/game.h index 0553d8da..430e3775 100644 --- a/src/game.h +++ b/src/game.h @@ -291,6 +291,8 @@ struct GameInfo boolean RestartGameRequested; boolean InitGameRequested; + + boolean InitColorTemplateImagesNeeded; }; struct PlayerInfo diff --git a/src/init.c b/src/init.c index acb25874..1355af88 100644 --- a/src/init.c +++ b/src/init.c @@ -381,15 +381,27 @@ void InitColorTemplateImages(void) CreateImgesFromColorTemplate(i, GetColoredBitmapFromTemplate_BD); InitImageTextures(); + + game.InitColorTemplateImagesNeeded = FALSE; } void InitColorTemplateImagesIfNeeded(void) { + game.InitColorTemplateImagesNeeded = FALSE; + if (program.headless) return; - if (anyImagehasColorTemplate()) - InitColorTemplateImages(); + if (!anyImagehasColorTemplate()) + return; + + game.InitColorTemplateImagesNeeded = TRUE; + + // if game still playing, init color template images later + if (game_status == GAME_MODE_PLAYING) + return; + + InitColorTemplateImages(); } void InitImageTextures(void) -- 2.34.1