From 6d671b6576a3552cf673ca62d29995dde0df5306 Mon Sep 17 00:00:00 2001 From: Alug Date: Sat, 25 Jan 2025 22:13:39 +0100 Subject: [PATCH] draw non widescreen anim vote bg before falling back to vanilla bg how it was before, the game just fallback to the vanila widescreen patch if there was no animated widescreen bg provided, just fall back to the non widescreen anim patch instead if it exists --- src/y_inter.c | 48 ++++++++++++++++++++++-------------------------- 1 file changed, 22 insertions(+), 26 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index 8f849f1cb..f361faf1f 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -300,7 +300,7 @@ static void Y_AnimatedVoteScreenCheck(void) strncpy(tmpPrefix, luaVoteScreen, 4); else { - if(G_BattleGametype()) + if (G_BattleGametype()) strcpy(tmpPrefix, "BTLS"); } @@ -919,20 +919,12 @@ static void Y_UnloadData(void) static inline void Y_DrawAnimatedVoteScreenPatch(boolean widePatch) { char tempAnimPrefix[7]; - (widePatch) ? strcpy(tempAnimPrefix, animWidePrefix) : strcpy(tempAnimPrefix, animPrefix); - INT32 tempFoundAnimVoteFrames = (widePatch) ? foundAnimVoteWideFrames : foundAnimVoteFrames; + widePatch ? strcpy(tempAnimPrefix, animWidePrefix) : strcpy(tempAnimPrefix, animPrefix); + const INT32 tempFoundAnimVoteFrames = widePatch ? foundAnimVoteWideFrames : foundAnimVoteFrames; // Just in case someone provides LESS widescreen frames than normal frames or vice versa, reset the frame counter to 0 - if (widePatch) - { - if (currentAnimFrame > foundAnimVoteWideFrames-1) - currentAnimFrame = 0; - } - else - { - if (currentAnimFrame > foundAnimVoteFrames-1) - currentAnimFrame = 0; - } + if (currentAnimFrame > tempFoundAnimVoteFrames - 1) + currentAnimFrame = 0; patch_t *background = W_CachePatchName(va("%s%d", tempAnimPrefix, currentAnimFrame + 1), PU_CACHE); V_DrawScaledPatch(((vid.width/2) / vid.dupx) - (SHORT(background->width)/2), // Keep the width/height adjustments, for screens that are less wide than 320(?) @@ -969,23 +961,27 @@ void Y_VoteDrawer(void) V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); - if (widebgpatch && vid.width / vid.dupx > 320) + const boolean widescreen = (vid.width / vid.dupx > 320); + + if (foundAnimVoteWideFrames && widescreen) { - if (foundAnimVoteWideFrames == 0) - V_DrawScaledPatch(((vid.width/2) / vid.dupx) - (SHORT(widebgpatch->width)/2), - (vid.height / vid.dupy) - SHORT(widebgpatch->height), - V_SNAPTOTOP|V_SNAPTOLEFT, widebgpatch); - else - Y_DrawAnimatedVoteScreenPatch(true); + Y_DrawAnimatedVoteScreenPatch(true); + } + else if (foundAnimVoteFrames) + { + Y_DrawAnimatedVoteScreenPatch(false); + } + else if (widebgpatch && widescreen) + { + V_DrawScaledPatch(((vid.width/2) / vid.dupx) - (SHORT(widebgpatch->width)/2), + (vid.height / vid.dupy) - SHORT(widebgpatch->height), + V_SNAPTOTOP|V_SNAPTOLEFT, widebgpatch); } else { - if (foundAnimVoteFrames == 0) - V_DrawScaledPatch(((vid.width/2) / vid.dupx) - (SHORT(bgpatch->width)/2), // Keep the width/height adjustments, for screens that are less wide than 320(?) - (vid.height / vid.dupy) - SHORT(bgpatch->height), - V_SNAPTOTOP|V_SNAPTOLEFT, bgpatch); - else - Y_DrawAnimatedVoteScreenPatch(false); + V_DrawScaledPatch(((vid.width/2) / vid.dupx) - (SHORT(bgpatch->width)/2), // Keep the width/height adjustments, for screens that are less wide than 320(?) + (vid.height / vid.dupy) - SHORT(bgpatch->height), + V_SNAPTOTOP|V_SNAPTOLEFT, bgpatch); } for (i = 0; i < 4; i++) // First, we need to figure out the height of this thing...