Skip to content

Commit

Permalink
Blood: Update logic used to redraw screen boarder
Browse files Browse the repository at this point in the history
  • Loading branch information
tmyqlfpir committed May 31, 2024
1 parent c830015 commit 80ef5b0
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
1 change: 1 addition & 0 deletions source/blood/src/loadsave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ void LoadSave::LoadGame(char *pzFile)
gGameMessageMgr.Clear();
viewSetErrorMessage("");
viewResizeView(gViewSize);
viewUpdatePages();
if (!gGameStarted)
{
netWaitForEveryone(0);
Expand Down
2 changes: 2 additions & 0 deletions source/blood/src/menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2699,6 +2699,7 @@ void SaveGame(CGameMenuItemZEditBitmap *pItem, CGameMenuEvent *event)
UpdateSaveGameItemText(nSlot);
gGameMenuMgr.Deactivate();
viewSetMessage("Game saved");
viewUpdatePages();
}

void QuickSaveGame(void)
Expand Down Expand Up @@ -2726,6 +2727,7 @@ void QuickSaveGame(void)
UpdateSaveGameItemText(gQuickSaveSlot);
gGameMenuMgr.Deactivate();
viewSetMessage("Game saved");
viewUpdatePages();
}

void LoadGame(CGameMenuItemZEditBitmap *pItem, CGameMenuEvent *event)
Expand Down
27 changes: 21 additions & 6 deletions source/blood/src/view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1290,7 +1290,10 @@ WEAPONICON gWeaponIconVoxel[] = {
{ -1, 0 },
};

int dword_14C508;
int gLastPageTimePack = 0;
int gLastPageTimePowerup = 0;
int gLastPageTimeFlag = 0;
int gLastPageTimeStats = 0;

void viewDrawStats(PLAYER *pPlayer, int x, int y)
{
Expand All @@ -1316,6 +1319,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 boarders
viewUpdatePages();
gLastPageTimeStats = gLevelTime;
}

#define kPowerUps 11
Expand Down Expand Up @@ -1398,6 +1404,12 @@ void viewDrawPowerUps(PLAYER* pPlayer)
DrawStatNumber("%d", nTime, kSBarNumberInv, x + 15, y, 0, nTime > nWarning ? 0 : 2, 256, fix16_from_float(0.5f));
y += 20;
}
if (nSortCount && (gViewMode == 3 && gViewSize > 3))
{
if (nSortPower[nSortCount - 1] != gLastPageTimePowerup)
viewUpdatePages();
gLastPageTimePowerup = nSortPower[nSortCount - 1];
}
}

void viewDrawMapTitle(void)
Expand Down Expand Up @@ -1474,11 +1486,9 @@ void viewDrawPack(PLAYER *pPlayer, int x, int y)
x += tilesiz[gPackIcons[nPack]].x + 1;
}
}
if (pPlayer->packItemTime != dword_14C508)
{
if (pPlayer->packItemTime != gLastPageTimePack)
viewUpdatePages();
}
dword_14C508 = pPlayer->packItemTime;
gLastPageTimePack = pPlayer->packItemTime;
}

void DrawPackItemInStatusBar(PLAYER *pPlayer, int x, int y, int x2, int y2, int nStat)
Expand Down Expand Up @@ -1640,6 +1650,10 @@ void viewDrawCtfHud(ClockTicks arg)
else if (redFlagTaken)
DrawStatMaskedSprite(4097, 307, 111, 0, redFlagCarrierColor ? 2 : 10, 512, 65536);
flashTeamScore(arg, 1, true);

if ((gViewMode == 3 && gViewSize > 3) && (gLastPageTimeFlag != gLevelTime) && (blueFlagTaken || redFlagTaken || gPlayerScoreTicks[0] > 0 || gPlayerScoreTicks[1] > 0))
viewUpdatePages();
gLastPageTimeFlag = gLevelTime;
}

void UpdateStatusBar(ClockTicks arg)
Expand Down Expand Up @@ -2068,7 +2082,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--;
Expand Down

0 comments on commit 80ef5b0

Please sign in to comment.