From e3531b7d28673cf01e439e4a5351f032ffdc721c Mon Sep 17 00:00:00 2001 From: tmyqlfpir <80724828+tmyqlfpir@users.noreply.github.com> Date: Tue, 4 Jun 2024 18:08:22 +1000 Subject: [PATCH] Blood: Update logic used to redraw screen borders --- source/blood/src/loadsave.cpp | 1 + source/blood/src/menu.cpp | 2 ++ source/blood/src/view.cpp | 30 +++++++++++++++++++++++------- 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/source/blood/src/loadsave.cpp b/source/blood/src/loadsave.cpp index 2fc20e54d2..13633402a4 100644 --- a/source/blood/src/loadsave.cpp +++ b/source/blood/src/loadsave.cpp @@ -166,6 +166,7 @@ void LoadSave::LoadGame(char *pzFile) gGameMessageMgr.Clear(); viewSetErrorMessage(""); viewResizeView(gViewSize); + viewUpdatePages(); if (!gGameStarted) { netWaitForEveryone(0); diff --git a/source/blood/src/menu.cpp b/source/blood/src/menu.cpp index 0316dd2132..7930945f38 100644 --- a/source/blood/src/menu.cpp +++ b/source/blood/src/menu.cpp @@ -2699,6 +2699,7 @@ void SaveGame(CGameMenuItemZEditBitmap *pItem, CGameMenuEvent *event) UpdateSaveGameItemText(nSlot); gGameMenuMgr.Deactivate(); viewSetMessage("Game saved"); + viewUpdatePages(); } void QuickSaveGame(void) @@ -2726,6 +2727,7 @@ void QuickSaveGame(void) UpdateSaveGameItemText(gQuickSaveSlot); gGameMenuMgr.Deactivate(); viewSetMessage("Game saved"); + viewUpdatePages(); } void LoadGame(CGameMenuItemZEditBitmap *pItem, CGameMenuEvent *event) diff --git a/source/blood/src/view.cpp b/source/blood/src/view.cpp index 0adf317ed2..0da20b116a 100644 --- a/source/blood/src/view.cpp +++ b/source/blood/src/view.cpp @@ -1290,10 +1290,9 @@ WEAPONICON gWeaponIconVoxel[] = { { -1, 0 }, }; -int dword_14C508; - void viewDrawStats(PLAYER *pPlayer, int x, int y) { + static int gLastPageTimeStats = 0; const int nFont = 3; char buffer[128]; if (!gLevelStats) @@ -1316,6 +1315,9 @@ void viewDrawStats(PLAYER *pPlayer, int x, int y) y += nHeight+1; sprintf(buffer, "S:%d/%d", gSecretMgr.nNormalSecretsFound, max(gSecretMgr.nNormalSecretsFound, gSecretMgr.nAllSecrets)); // if we found more than there are, increase the total - some levels have a bugged counter viewDrawText(3, buffer, x, y, 20, 0, 0, true, 256); + if (gViewMode == 3 && gViewSize > 3 && gLastPageTimeStats != gLevelTime) // redraw borders + viewUpdatePages(); + gLastPageTimeStats = gLevelTime; } #define kPowerUps 11 @@ -1398,6 +1400,15 @@ void viewDrawPowerUps(PLAYER* pPlayer) DrawStatNumber("%d", nTime, kSBarNumberInv, x + 15, y, 0, nTime > nWarning ? 0 : 2, 256, fix16_from_float(0.5f)); y += 20; } + static int gLastPageTimePowerup = 0; + static int gLastPageTimePowerupCount = 0; + if (gViewMode == 3 && gViewSize > 3) // redraw borders + { + if (gLastPageTimePowerup != gLevelTime && nSortCount || gLastPageTimePowerupCount != nSortCount) + viewUpdatePages(); + } + gLastPageTimePowerup = gLevelTime; + gLastPageTimePowerupCount = nSortCount; } void viewDrawMapTitle(void) @@ -1474,11 +1485,10 @@ void viewDrawPack(PLAYER *pPlayer, int x, int y) x += tilesiz[gPackIcons[nPack]].x + 1; } } - if (pPlayer->packItemTime != dword_14C508) - { + static int gLastPageTimePack = 0; + if (pPlayer->packItemTime != gLastPageTimePack) // redraw borders viewUpdatePages(); - } - dword_14C508 = pPlayer->packItemTime; + gLastPageTimePack = pPlayer->packItemTime; } void DrawPackItemInStatusBar(PLAYER *pPlayer, int x, int y, int x2, int y2, int nStat) @@ -1640,6 +1650,11 @@ void viewDrawCtfHud(ClockTicks arg) else if (redFlagTaken) DrawStatMaskedSprite(4097, 307, 111, 0, redFlagCarrierColor ? 2 : 10, 512, 65536); flashTeamScore(arg, 1, true); + + static int gLastPageTimeFlag = 0; + if (gViewMode == 3 && gViewSize > 3 && (gLastPageTimeFlag != gLevelTime)) // redraw borders + viewUpdatePages(); + gLastPageTimeFlag = gLevelTime; } void UpdateStatusBar(ClockTicks arg) @@ -2068,7 +2083,8 @@ void UpdateFrame(void) void viewDrawInterface(ClockTicks arg) { - if (gViewMode == 3/* && gViewSize >= 3*/ && (pcBackground != 0 || videoGetRenderMode() >= REND_POLYMOST)) + const char bDrawFragsBg = (gGameOptions.nGameType != kGameTypeSinglePlayer) && (!VanillaMode() || gGameOptions.nGameType != kGameTypeTeams); + if (gViewMode == 3 && (gViewSize >= 3 || bDrawFragsBg) && (pcBackground != 0 || videoGetRenderMode() >= REND_POLYMOST)) { UpdateFrame(); pcBackground--;