diff --git a/source/exhumed/src/2d.cpp b/source/exhumed/src/2d.cpp index 3df1e5044..98bf17461 100644 --- a/source/exhumed/src/2d.cpp +++ b/source/exhumed/src/2d.cpp @@ -69,6 +69,8 @@ void InitFonts() fontdata.Insert('0' + i, tileGetTexture(3555 + i)); } fontdata.Insert('.', tileGetTexture(3548)); + fontdata.Insert(':', tileGetTexture(3548)); // we have no colon but need something here. + fontdata.Insert('/', tileGetTexture(3552)); // same here fontdata.Insert('!', tileGetTexture(3549)); fontdata.Insert('?', tileGetTexture(3550)); fontdata.Insert(',', tileGetTexture(3551)); diff --git a/source/exhumed/src/anubis.cpp b/source/exhumed/src/anubis.cpp index e9f171b03..57f4fbc05 100644 --- a/source/exhumed/src/anubis.cpp +++ b/source/exhumed/src/anubis.cpp @@ -146,7 +146,7 @@ int BuildAnubis(int nSprite, int x, int y, int z, int nSector, int nAngle, uint8 sprite[nSprite].owner = runlist_AddRunRec(sprite[nSprite].lotag - 1, nAnubis | 0x90000); runlist_AddRunRec(NewRun, nAnubis | 0x90000); - nCreaturesLeft++; + nCreaturesTotal++; return nAnubis | 0x90000; } @@ -480,7 +480,7 @@ void FuncAnubis(int a, int nDamage, int nRun) AnubisList[nAnubis].nHealth = 0; - nCreaturesLeft--; + nCreaturesKilled++; if (nAction < 11) { diff --git a/source/exhumed/src/exhumed.cpp b/source/exhumed/src/exhumed.cpp index f8490e8a2..c207e4840 100644 --- a/source/exhumed/src/exhumed.cpp +++ b/source/exhumed/src/exhumed.cpp @@ -119,7 +119,8 @@ short nFontFirstChar; short nBackgroundPic; short nShadowPic; -short nCreaturesLeft = 0; +short nCreaturesKilled = 0, nCreaturesTotal = 0; +int leveltime; short nFreeze; @@ -552,6 +553,7 @@ void GameTicker() while (!EndLevel && totalclock >= tclocks + 4) { tclocks += 4; + leveltime++; GameMove(); } } @@ -770,6 +772,11 @@ bool GameInterface::CanSave() return !bRecord && !bPlayback && !paused && !bInDemo && nTotalPlayers == 1; } +::GameStats GameInterface::getStats() +{ + return { nCreaturesKilled, nCreaturesTotal, 0, 0, leveltime / 30, 0 }; +} + ::GameInterface* CreateInterface() { return new GameInterface; @@ -779,7 +786,8 @@ bool GameInterface::CanSave() // This is only the static global data. static SavegameHelper sgh("exhumed", SV(besttarget), - SV(nCreaturesLeft), // todo: also maintain a total counter. + SV(nCreaturesTotal), + SV(nCreaturesKilled), SV(nFreeze), SV(nSnakeCam), SV(nLocalSpr), @@ -800,6 +808,7 @@ static SavegameHelper sgh("exhumed", SV(localclock), SV(tclocks), SV(totalclock), + SV(leveltime), nullptr); extern short cPupData[300]; diff --git a/source/exhumed/src/exhumed.h b/source/exhumed/src/exhumed.h index 213830a07..818d1f2fe 100644 --- a/source/exhumed/src/exhumed.h +++ b/source/exhumed/src/exhumed.h @@ -32,6 +32,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "zstring.h" #include "filesystem.h" #include "screenjob.h" +#include "gamestruct.h" BEGIN_PS_NS @@ -180,7 +181,8 @@ extern short nFontFirstChar; extern short nBackgroundPic; extern short nShadowPic; -extern short nCreaturesLeft; +extern short nCreaturesTotal, nCreaturesKilled; +extern int leveltime; extern int lLocalButtons; @@ -321,7 +323,7 @@ struct GameInterface : ::GameInterface ReservedSpace GetReservedScreenSpace(int viewsize) override { return { 0, 24 }; } FString statFPS() override; - //GameStats getStats() override; + ::GameStats getStats() override; }; diff --git a/source/exhumed/src/fish.cpp b/source/exhumed/src/fish.cpp index 967c3910b..b2b328c59 100644 --- a/source/exhumed/src/fish.cpp +++ b/source/exhumed/src/fish.cpp @@ -267,7 +267,7 @@ int BuildFish(int nSprite, int x, int y, int z, int nSector, int nAngle) sprite[nSprite].owner = runlist_AddRunRec(sprite[nSprite].lotag - 1, nFish | 0x120000); FishList[nFish].nRun = runlist_AddRunRec(NewRun, nFish | 0x120000); - nCreaturesLeft++; + nCreaturesTotal++; return nFish | 0x120000; } @@ -361,7 +361,7 @@ void FuncFish(int a, int nDamage, int nRun) if (FishList[nFish].nHealth <= 0) { FishList[nFish].nHealth = 0; - nCreaturesLeft--; + nCreaturesKilled++; sprite[nSprite].cstat &= 0xFEFE; diff --git a/source/exhumed/src/init.cpp b/source/exhumed/src/init.cpp index 6e44d87dd..a7a752f3f 100644 --- a/source/exhumed/src/init.cpp +++ b/source/exhumed/src/init.cpp @@ -85,9 +85,11 @@ uint8_t LoadLevel(int nMap) // init stuff { StopAllSounds(); - nCreaturesLeft = 0; + nCreaturesKilled = 0; + nCreaturesTotal = 0; nFreeze = 0; nSpiritSprite = -1; + leveltime = 0; InitLion(); InitRexs(); diff --git a/source/exhumed/src/lavadude.cpp b/source/exhumed/src/lavadude.cpp index f5ce40a0b..cbc7f8d2e 100644 --- a/source/exhumed/src/lavadude.cpp +++ b/source/exhumed/src/lavadude.cpp @@ -198,7 +198,7 @@ int BuildLava(short nSprite, int x, int y, int UNUSED(z), short nSector, short n sprite[nSprite].owner = runlist_AddRunRec(sprite[nSprite].lotag - 1, nLava | 0x150000); LavaList[nLava].nRun = runlist_AddRunRec(NewRun, nLava | 0x150000); - nCreaturesLeft++; + nCreaturesTotal++; return nLava | 0x150000; } @@ -248,7 +248,7 @@ void FuncLava(int a, int nDamage, int nRun) LavaList[nLava].nAction = 5; LavaList[nLava].nFrame = 0; - nCreaturesLeft--; + nCreaturesKilled++; sprite[nSprite].cstat &= 0xFEFE; } diff --git a/source/exhumed/src/lion.cpp b/source/exhumed/src/lion.cpp index 4a7db7980..554816fbd 100644 --- a/source/exhumed/src/lion.cpp +++ b/source/exhumed/src/lion.cpp @@ -128,7 +128,7 @@ int BuildLion(short nSprite, int x, int y, int z, short nSector, short nAngle) MoveHook[nLion] = runlist_AddRunRec(NewRun, nLion | 0x130000); - nCreaturesLeft++; + nCreaturesTotal++; return nLion | 0x130000; } @@ -180,7 +180,7 @@ void FuncLion(int a, int nDamage, int nRun) LionList[nLion].nHealth = 0; - nCreaturesLeft--; + nCreaturesKilled++; if (nAction < 10) { diff --git a/source/exhumed/src/mummy.cpp b/source/exhumed/src/mummy.cpp index 603cbd1ed..4f9b6aaa3 100644 --- a/source/exhumed/src/mummy.cpp +++ b/source/exhumed/src/mummy.cpp @@ -122,7 +122,7 @@ int BuildMummy(int nSprite, int x, int y, int z, int nSector, int nAngle) MummyList[nMummy].H = runlist_AddRunRec(NewRun, nMummy | 0xE0000); - nCreaturesLeft++; + nCreaturesTotal++; return (nMummy | 0xE0000); } @@ -432,7 +432,7 @@ void FuncMummy(int a, int nDamage, int nRun) MummyList[nMummy].nHealth = 300; MummyList[nMummy].nTarget = -1; - nCreaturesLeft++; + nCreaturesTotal++; } return; } @@ -493,7 +493,7 @@ void FuncMummy(int a, int nDamage, int nRun) { MummyList[nMummy].nHealth = 0; sprite[nSprite].cstat &= 0xFEFE; - nCreaturesLeft--; + nCreaturesKilled++; DropMagic(nSprite); diff --git a/source/exhumed/src/queen.cpp b/source/exhumed/src/queen.cpp index 8e6919519..5f3b72a11 100644 --- a/source/exhumed/src/queen.cpp +++ b/source/exhumed/src/queen.cpp @@ -1157,7 +1157,7 @@ int BuildQueen(int nSprite, int x, int y, int z, int nSector, int nAngle, int nC runlist_AddRunRec(NewRun, nQueen | 0x1A0000); - nCreaturesLeft++; + nCreaturesTotal++; return nQueen | 0x1A0000; } @@ -1491,7 +1491,7 @@ void FuncQueen(int a, int nDamage, int nRun) QueenList[nQueen].nHealth = 0; QueenList[nQueen].field_C = 5; - nCreaturesLeft--; + nCreaturesKilled++; break; } diff --git a/source/exhumed/src/rex.cpp b/source/exhumed/src/rex.cpp index 081051f29..984835e19 100644 --- a/source/exhumed/src/rex.cpp +++ b/source/exhumed/src/rex.cpp @@ -127,7 +127,7 @@ int BuildRex(short nSprite, int x, int y, int z, short nSector, short nAngle, in // this isn't stored anywhere. runlist_AddRunRec(NewRun, nRex | 0x180000); - nCreaturesLeft++; + nCreaturesTotal++; return nRex | 0x180000; } @@ -185,7 +185,7 @@ void FuncRex(int a, int nDamage, int nRun) RexList[nRex].nHealth = 0; - nCreaturesLeft--; + nCreaturesKilled++; if (nAction < 6) { diff --git a/source/exhumed/src/roach.cpp b/source/exhumed/src/roach.cpp index ce91c1cf8..f1210770a 100644 --- a/source/exhumed/src/roach.cpp +++ b/source/exhumed/src/roach.cpp @@ -128,7 +128,7 @@ int BuildRoach(int nType, int nSprite, int x, int y, int z, short nSector, int a sprite[nSprite].owner = runlist_AddRunRec(sprite[nSprite].lotag - 1, RoachCount | 0x1C0000); RoachList[RoachCount].field_A = runlist_AddRunRec(NewRun, RoachCount | 0x1C0000); - nCreaturesLeft++; + nCreaturesTotal++; return RoachCount | 0x1C0000; } @@ -195,7 +195,7 @@ void FuncRoach(int a, int nDamage, int nRun) RoachList[nRoach].field_2 = 0; } - nCreaturesLeft--; // NOTE: This was incrementing in original code. Bug? + nCreaturesKilled++; // NOTE: This was incrementing in original code. Bug? } else { diff --git a/source/exhumed/src/runlist.cpp b/source/exhumed/src/runlist.cpp index 434efb066..d213a9381 100644 --- a/source/exhumed/src/runlist.cpp +++ b/source/exhumed/src/runlist.cpp @@ -1630,12 +1630,12 @@ void runlist_DamageEnemy(int nSprite, int nSprite2, short nDamage) return; } - short nPreCreaturesLeft = nCreaturesLeft; + short nPreCreaturesKilled = nCreaturesKilled; runlist_SendMessageToRunRec(nRun, (nSprite2 & 0xFFFF) | 0x80000, nDamage * 4); // is there now one less creature? (has one died) - if (nPreCreaturesLeft > nCreaturesLeft&& nSprite2 > -1) + if (nPreCreaturesKilled > nCreaturesKilled && nSprite2 > -1) { if (sprite[nSprite2].statnum != 100) { return; diff --git a/source/exhumed/src/scorp.cpp b/source/exhumed/src/scorp.cpp index 6e2485ade..745e9261d 100644 --- a/source/exhumed/src/scorp.cpp +++ b/source/exhumed/src/scorp.cpp @@ -133,7 +133,7 @@ int BuildScorp(short nSprite, int x, int y, int z, short nSector, short nAngle, sprite[nSprite].owner = runlist_AddRunRec(sprite[nSprite].lotag - 1, nScorp | 0x220000); scorpion[nScorp].f = runlist_AddRunRec(NewRun, nScorp | 0x220000); - nCreaturesLeft++; + nCreaturesTotal++; return nScorp | 0x220000; } @@ -196,7 +196,7 @@ void FuncScorp(int a, int nDamage, int nRun) sprite[nSprite].zvel = 0; sprite[nSprite].cstat &= 0xFEFE; - nCreaturesLeft--; + nCreaturesKilled++; return; } else diff --git a/source/exhumed/src/set.cpp b/source/exhumed/src/set.cpp index 70c23e08b..755c0034c 100644 --- a/source/exhumed/src/set.cpp +++ b/source/exhumed/src/set.cpp @@ -133,7 +133,7 @@ int BuildSet(short nSprite, int x, int y, int z, short nSector, short nAngle, in // this isn't stored anywhere. runlist_AddRunRec(NewRun, nSet | 0x190000); - nCreaturesLeft++; + nCreaturesTotal++; return nSet | 0x190000; } @@ -272,7 +272,7 @@ void FuncSet(int a, int nDamage, int nRun) SetList[nSet].nHealth = 0; - nCreaturesLeft--; + nCreaturesKilled++; if (nAction < 10) { diff --git a/source/exhumed/src/sound.cpp b/source/exhumed/src/sound.cpp index b3c3e13a1..1c9154dff 100644 --- a/source/exhumed/src/sound.cpp +++ b/source/exhumed/src/sound.cpp @@ -662,7 +662,7 @@ void UpdateCreepySounds() nCreepyTimer--; if (nCreepyTimer <= 0) { - if (nCreaturesLeft > 0 && !(SectFlag[nPlayerViewSect[nLocalPlayer]] & 0x2000)) + if (nCreaturesKilled < nCreaturesTotal && !(SectFlag[nPlayerViewSect[nLocalPlayer]] & 0x2000)) { int vsi = seq_GetFrameSound(SeqOffsets[kSeqCreepy], totalmoves % SeqSize[SeqOffsets[kSeqCreepy]]); if (vsi >= 0 && (vsi & 0x1ff) < kMaxSounds) diff --git a/source/exhumed/src/spider.cpp b/source/exhumed/src/spider.cpp index 89fa0a0eb..44d38b7f7 100644 --- a/source/exhumed/src/spider.cpp +++ b/source/exhumed/src/spider.cpp @@ -115,7 +115,7 @@ int BuildSpider(int nSprite, int x, int y, int z, short nSector, int nAngle) SpiderList[nSpider].nRun = runlist_AddRunRec(NewRun, nSpider | 0xC0000); - nCreaturesLeft++; + nCreaturesTotal++; return nSpider | 0xC0000; } @@ -431,7 +431,7 @@ void FuncSpider(int a, int nDamage, int nRun) sprite[nSprite].cstat &= 0xFEFE; - nCreaturesLeft--; + nCreaturesKilled++; for (int i = 0; i < 7; i++) { diff --git a/source/exhumed/src/status.cpp b/source/exhumed/src/status.cpp index 5f2caea6c..b1a5b55d3 100644 --- a/source/exhumed/src/status.cpp +++ b/source/exhumed/src/status.cpp @@ -822,6 +822,40 @@ private: } } + //--------------------------------------------------------------------------- + // + // + // + //--------------------------------------------------------------------------- + + void PrintLevelStats(int bottomy) + { + if (hud_stats) + { + FLevelStats stats{}; + + stats.fontscale = 1.; + stats.spacing = SmallFont->GetHeight(); + stats.screenbottomspace = bottomy; + stats.font = SmallFont; + stats.letterColor = CR_RED; + stats.standardColor = CR_UNTRANSLATED; + stats.completeColor = CR_DARKGREEN; + + stats.time = Scale(leveltime, 1000, 30); + stats.kills = nCreaturesKilled; + stats.maxkills = nCreaturesTotal; + stats.frags = -1; + stats.secrets = 0; + stats.maxsecrets = 0; + + DBaseStatusBar::PrintLevelStats(stats); + } + } + + + + public: void Draw() { @@ -829,6 +863,7 @@ public: { DrawStatus(); } + PrintLevelStats(hud_size == Hud_Nothing ? 0 : 40); } }; diff --git a/source/exhumed/src/wasp.cpp b/source/exhumed/src/wasp.cpp index 2db18d862..ab0a1ea66 100644 --- a/source/exhumed/src/wasp.cpp +++ b/source/exhumed/src/wasp.cpp @@ -167,7 +167,7 @@ int BuildWasp(short nSprite, int x, int y, int z, short nSector, short nAngle) WaspList[nWasp].nRun = runlist_AddRunRec(NewRun, nWasp | 0x1E0000); - nCreaturesLeft++; + nCreaturesTotal++; return nSprite; } @@ -242,7 +242,7 @@ void FuncWasp(int a, int nDamage, int nRun) sprite[nSprite].zvel = 512; - nCreaturesLeft--; + nCreaturesKilled++; } } return;