From 1eed7f41853731cebe89fc85954f444966a0296b Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Wed, 13 Apr 2022 20:14:25 +0200 Subject: [PATCH] added compatibility code for new score screens for "Snake Bite" graphics --- src/init.c | 12 ++++++++++++ src/screens.c | 14 ++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/src/init.c b/src/init.c index b2b93715..23d9b976 100644 --- a/src/init.c +++ b/src/init.c @@ -1952,6 +1952,18 @@ static void InitGraphicCompatibilityInfo(void) } } + // special compatibility handling for "Snake Bite" graphics set + if (strPrefix(leveldir_current->identifier, "snake_bite")) + { + Bitmap *bitmap = graphic_info[IMG_BACKGROUND_SCORES].bitmap; + + BlitBitmap(bitmap, bitmap, 18, 66, 32, 480, 50, 66); + BlitBitmap(bitmap, bitmap, 466, 66, 32, 480, 434, 66); + + ClearRectangle(bitmap, 2, 66, 32, 480); + ClearRectangle(bitmap, 514, 66, 32, 480); + } + InitGraphicCompatibilityInfo_Doors(); } diff --git a/src/screens.c b/src/screens.c index 5ffd3409..2f2352cd 100644 --- a/src/screens.c +++ b/src/screens.c @@ -1458,6 +1458,11 @@ static void clearMenuListArea(void) // clear menu list area, but not title or scrollbar DrawBackground(mSX, mSY + MENU_SCREEN_START_YPOS * 32, scrollbar_xpos - mSX, NUM_MENU_ENTRIES_ON_SCREEN * 32); + + // special compatibility handling for "Snake Bite" graphics set + if (strPrefix(leveldir_current->identifier, "snake_bite")) + ClearRectangle(drawto, mSX, mSY + MENU_SCREEN_START_YPOS * 32, + scrollbar_xpos - mSX, NUM_MENU_ENTRIES_ON_SCREEN * 32); } static void drawCursorExt(int xpos, int ypos, boolean active, int graphic) @@ -5541,6 +5546,11 @@ static void DrawScoreInfo(int entry_nr) SetMainBackgroundImage(IMG_BACKGROUND_SCORES); SetMainBackgroundImageIfDefined(IMG_BACKGROUND_SCOREINFO); + // special compatibility handling for "Snake Bite" graphics set + if (strPrefix(leveldir_current->identifier, "snake_bite")) + ClearRectangle(gfx.background_bitmap, gfx.real_sx, gfx.real_sy + 64, + gfx.full_sxsize, gfx.full_sysize - 64); + DrawScoreInfo_Content(entry_nr); // map gadgets for score info screen @@ -9722,6 +9732,10 @@ static void CreateScreenMenubuttons(void) // if x/y set to -1, dynamically place buttons next to title text int title_width = getTextWidth(INFOTEXT_SCORE_ENTRY, FONT_TITLE_1); + // special compatibility handling for "Snake Bite" graphics set + if (strPrefix(leveldir_current->identifier, "snake_bite")) + title_width = strlen(INFOTEXT_SCORE_ENTRY) * 32; + if (pos->x == -1) x = (id == SCREEN_CTRL_ID_PREV_LEVEL2 ? SX + (SXSIZE - title_width) / 2 - width * 3 / 2 : -- 2.34.1