From 7747fc7fb083c30adf67751c386ca457771113d2 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 1 Sep 2020 21:27:32 +0200 Subject: [PATCH] - rewrote the EndMgr in Blood to work as a screen job. This removes the special handling for it in the main loop. Some functions and variables in the kill and secret managers were also given more meaningful names. Fixes #313 --- source/blood/src/actor.cpp | 18 +- source/blood/src/ai.cpp | 170 +++++++------- source/blood/src/ai.h | 16 +- source/blood/src/aibat.cpp | 8 +- source/blood/src/aiboneel.cpp | 12 +- source/blood/src/aicerber.cpp | 10 +- source/blood/src/aigarg.cpp | 10 +- source/blood/src/aighost.cpp | 10 +- source/blood/src/aispid.cpp | 6 +- source/blood/src/aitchern.cpp | 10 +- source/blood/src/aiunicult.cpp | 4 +- source/blood/src/blood.cpp | 9 +- source/blood/src/blood.h | 1 + source/blood/src/choke.cpp | 2 +- source/blood/src/choke.h | 4 +- source/blood/src/db.cpp | 8 +- source/blood/src/db.h | 6 +- source/blood/src/endgame.cpp | 379 ++++++++++++++++---------------- source/blood/src/endgame.h | 24 +- source/blood/src/fx.cpp | 6 +- source/blood/src/gib.cpp | 36 +-- source/blood/src/mirrors.cpp | 36 +-- source/blood/src/nnexts.cpp | 4 +- source/blood/src/player.cpp | 34 +-- source/blood/src/pqueue.h | 34 +-- source/blood/src/prediction.cpp | 34 +-- source/blood/src/sbar.cpp | 8 +- source/blood/src/sound.cpp | 2 +- source/blood/src/sound.h | 4 +- source/blood/src/triggers.cpp | 22 +- source/blood/src/view.cpp | 2 +- source/blood/src/view.h | 4 +- source/blood/src/weapon.cpp | 46 ++-- 33 files changed, 476 insertions(+), 503 deletions(-) diff --git a/source/blood/src/actor.cpp b/source/blood/src/actor.cpp index 8ce525a69..69319a7b7 100644 --- a/source/blood/src/actor.cpp +++ b/source/blood/src/actor.cpp @@ -2362,7 +2362,7 @@ const int nDudeToGibClient2 = seqRegisterClient(DudeToGibCallback2); int gPostCount = 0; struct POSTPONE { - short at0; + short TotalKills; short at2; }; @@ -2527,7 +2527,7 @@ void actInit(bool bSaveLoad) { unk[pSprite->type - kDudeBase] = 1; } - gKillMgr.sub_2641C(); + gKillMgr.CountTotalKills(); /////////////// for (int i = 0; i < kDudeMax - kDudeBase; i++) @@ -2935,7 +2935,7 @@ void actKillDude(int nKillerSprite, spritetype *pSprite, DAMAGE_TYPE damageType, aiGenDudeNewState(pSprite, &genDudeBurnGoto); actHealDude(pXSprite, dudeInfo[55].startHealth, dudeInfo[55].startHealth); if (pXSprite->burnTime <= 0) pXSprite->burnTime = 1200; - gDudeExtra[pSprite->extra].at0 = gFrameClock + 360; + gDudeExtra[pSprite->extra].TotalKills = gFrameClock + 360; return; } @@ -3325,7 +3325,7 @@ void actKillDude(int nKillerSprite, spritetype *pSprite, DAMAGE_TYPE damageType, case kDudeSpiderBrown: if (pSprite->owner != -1) { spritetype *pOwner = &sprite[actSpriteOwnerToSpriteId(pSprite)]; - gDudeExtra[pOwner->extra].at6.u1.at4--; + gDudeExtra[pOwner->extra].at6.u1.Kills--; } if (Chance(0x4000) && nSeq == 3) sfxPlay3DSound(pSprite, 1805, -1, 0); @@ -3335,7 +3335,7 @@ void actKillDude(int nKillerSprite, spritetype *pSprite, DAMAGE_TYPE damageType, case kDudeSpiderRed: if (pSprite->owner != -1) { spritetype *pOwner = &sprite[actSpriteOwnerToSpriteId(pSprite)]; - gDudeExtra[pOwner->extra].at6.u1.at4--; + gDudeExtra[pOwner->extra].at6.u1.Kills--; } if (Chance(0x4000) && nSeq == 3) sfxPlay3DSound(pSprite, 1805, -1, 0); @@ -3345,7 +3345,7 @@ void actKillDude(int nKillerSprite, spritetype *pSprite, DAMAGE_TYPE damageType, case kDudeSpiderBlack: if (pSprite->owner != -1) { spritetype *pOwner = &sprite[actSpriteOwnerToSpriteId(pSprite)]; - gDudeExtra[pOwner->extra].at6.u1.at4--; + gDudeExtra[pOwner->extra].at6.u1.Kills--; } if (Chance(0x4000) && nSeq == 3) sfxPlay3DSound(pSprite, 1805, -1, 0); @@ -6859,7 +6859,7 @@ void actPostSprite(int nSprite, int nStatus) if (sprite[nSprite].flags&32) { for (n = 0; n < gPostCount; n++) - if (gPost[n].at0 == nSprite) + if (gPost[n].TotalKills == nSprite) break; dassert(n < gPostCount); } @@ -6869,7 +6869,7 @@ void actPostSprite(int nSprite, int nStatus) sprite[nSprite].flags |= 32; gPostCount++; } - gPost[n].at0 = nSprite; + gPost[n].TotalKills = nSprite; gPost[n].at2 = nStatus; } @@ -6878,7 +6878,7 @@ void actPostProcess(void) for (int i = 0; i < gPostCount; i++) { POSTPONE *pPost = &gPost[i]; - int nSprite = pPost->at0; + int nSprite = pPost->TotalKills; spritetype *pSprite = &sprite[nSprite]; pSprite->flags &= ~32; int nStatus = pPost->at2; diff --git a/source/blood/src/ai.cpp b/source/blood/src/ai.cpp index e9190ff81..871f5cbdc 100644 --- a/source/blood/src/ai.cpp +++ b/source/blood/src/ai.cpp @@ -75,12 +75,12 @@ void aiPlay3DSound(spritetype *pSprite, int a2, AI_SFX_PRIORITY a3, int a4) DUDEEXTRA *pDudeExtra = &gDudeExtra[pSprite->extra]; if (a3 == AI_SFX_PRIORITY_0) sfxPlay3DSound(pSprite, a2, a4, 2); - else if (a3 > pDudeExtra->at5 || pDudeExtra->at0 <= gFrameClock) + else if (a3 > pDudeExtra->at5 || pDudeExtra->TotalKills <= gFrameClock) { sfxKill3DSound(pSprite, -1, -1); sfxPlay3DSound(pSprite, a2, a4, 0); pDudeExtra->at5 = a3; - pDudeExtra->at0 = gFrameClock+120; + pDudeExtra->TotalKills = gFrameClock+120; } } @@ -330,9 +330,9 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite) case kDudePhantasm: { DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1; - pDudeExtraE->at4 = 0; + pDudeExtraE->Kills = 0; pDudeExtraE->at8 = 1; - pDudeExtraE->at0 = 0; + pDudeExtraE->TotalKills = 0; if (pXSprite->target == -1) aiNewState(pSprite, pXSprite, &ghostSearch); else @@ -350,7 +350,7 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite) { DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1; pDudeExtraE->at8 = 1; - pDudeExtraE->at0 = 0; + pDudeExtraE->TotalKills = 0; if (pXSprite->target == -1) { switch (pXSprite->medium) { case kMediumNormal: @@ -388,7 +388,7 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite) { DUDEEXTRA_at6_u1* pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1; pDudeExtraE->at8 = 1; - pDudeExtraE->at0 = 0; + pDudeExtraE->TotalKills = 0; if (pXSprite->target == -1) { if (spriteIsUnderwater(pSprite, false)) aiGenDudeNewState(pSprite, &genDudeSearchW); else aiGenDudeNewState(pSprite, &genDudeSearchL); @@ -406,7 +406,7 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite) #endif case kDudeCultistTommyProne: { DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1; - pDudeExtraE->at8 = 1; pDudeExtraE->at0 = 0; + pDudeExtraE->at8 = 1; pDudeExtraE->TotalKills = 0; pSprite->type = kDudeCultistTommy; if (pXSprite->target == -1) { switch (pXSprite->medium) { @@ -440,7 +440,7 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite) { DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1; pDudeExtraE->at8 = 1; - pDudeExtraE->at0 = 0; + pDudeExtraE->TotalKills = 0; pSprite->type = kDudeCultistShotgun; if (pXSprite->target == -1) { @@ -483,9 +483,9 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite) case kDudeBat: { DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1; - pDudeExtraE->at4 = 0; + pDudeExtraE->Kills = 0; pDudeExtraE->at8 = 1; - pDudeExtraE->at0 = 0; + pDudeExtraE->TotalKills = 0; if (!pSprite->flags) pSprite->flags = 9; if (pXSprite->target == -1) @@ -501,9 +501,9 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite) case kDudeBoneEel: { DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1; - pDudeExtraE->at4 = 0; + pDudeExtraE->Kills = 0; pDudeExtraE->at8 = 1; - pDudeExtraE->at0 = 0; + pDudeExtraE->TotalKills = 0; if (pXSprite->target == -1) aiNewState(pSprite, pXSprite, &eelSearch); else @@ -521,8 +521,8 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite) XSECTOR *pXSector = NULL; if (sector[pSprite->sectnum].extra > 0) pXSector = &xsector[sector[pSprite->sectnum].extra]; - pDudeExtraE->at0 = 0; - pDudeExtraE->at4 = 0; + pDudeExtraE->TotalKills = 0; + pDudeExtraE->Kills = 0; pDudeExtraE->at8 = 1; if (pXSprite->target == -1) { @@ -546,8 +546,8 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite) } case kDudeZombieAxeNormal: { DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u2; - pDudeExtraE->at4 = 1; - pDudeExtraE->at0 = 0; + pDudeExtraE->Kills = 1; + pDudeExtraE->TotalKills = 0; if (pXSprite->target == -1) aiNewState(pSprite, pXSprite, &zombieASearch); else @@ -576,8 +576,8 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite) case kDudeZombieAxeBuried: { DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u2; - pDudeExtraE->at4 = 1; - pDudeExtraE->at0 = 0; + pDudeExtraE->Kills = 1; + pDudeExtraE->TotalKills = 0; if (pXSprite->aiState == &zombieEIdle) aiNewState(pSprite, pXSprite, &zombieEUp); break; @@ -585,16 +585,16 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite) case kDudeZombieAxeLaying: { DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u2; - pDudeExtraE->at4 = 1; - pDudeExtraE->at0 = 0; + pDudeExtraE->Kills = 1; + pDudeExtraE->TotalKills = 0; if (pXSprite->aiState == &zombieSIdle) aiNewState(pSprite, pXSprite, &zombie13AC2C); break; } case kDudeZombieButcher: { DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u2; - pDudeExtraE->at4 = 1; - pDudeExtraE->at0 = 0; + pDudeExtraE->Kills = 1; + pDudeExtraE->TotalKills = 0; if (pXSprite->target == -1) aiNewState(pSprite, pXSprite, &zombieFSearch); else @@ -621,9 +621,9 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite) break; case kDudeGargoyleFlesh: { DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1; - pDudeExtraE->at4 = 0; + pDudeExtraE->Kills = 0; pDudeExtraE->at8 = 1; - pDudeExtraE->at0 = 0; + pDudeExtraE->TotalKills = 0; if (pXSprite->target == -1) aiNewState(pSprite, pXSprite, &gargoyleFSearch); else @@ -639,9 +639,9 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite) case kDudeGargoyleStone: { DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1; - pDudeExtraE->at4 = 0; + pDudeExtraE->Kills = 0; pDudeExtraE->at8 = 1; - pDudeExtraE->at0 = 0; + pDudeExtraE->TotalKills = 0; if (pXSprite->target == -1) aiNewState(pSprite, pXSprite, &gargoyleFSearch); else @@ -757,7 +757,7 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite) case kDudeSpiderMother: { DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1; pDudeExtraE->at8 = 1; - pDudeExtraE->at0 = 0; + pDudeExtraE->TotalKills = 0; pSprite->flags |= 2; pSprite->cstat &= ~8; if (pXSprite->target == -1) @@ -772,8 +772,8 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite) case kDudeTinyCaleb: { DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u2; - pDudeExtraE->at4 = 1; - pDudeExtraE->at0 = 0; + pDudeExtraE->Kills = 1; + pDudeExtraE->TotalKills = 0; if (pXSprite->target == -1) { switch (pXSprite->medium) @@ -805,8 +805,8 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite) case kDudeBeast: { DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u2; - pDudeExtraE->at4 = 1; - pDudeExtraE->at0 = 0; + pDudeExtraE->Kills = 1; + pDudeExtraE->TotalKills = 0; if (pXSprite->target == -1) { switch (pXSprite->medium) @@ -910,7 +910,7 @@ int aiDamageSprite(spritetype *pSprite, XSPRITE *pXSprite, int nSource, DAMAGE_T if (nDmgType == DAMAGE_TYPE_6) { DUDEEXTRA *pDudeExtra = &gDudeExtra[pSprite->extra]; - pDudeExtra->at4 = 1; + pDudeExtra->Kills = 1; } switch (pSprite->type) { @@ -933,7 +933,7 @@ int aiDamageSprite(spritetype *pSprite, XSPRITE *pXSprite, int nSource, DAMAGE_T aiNewState(pSprite, pXSprite, &cultistBurnGoto); aiPlay3DSound(pSprite, 361, AI_SFX_PRIORITY_0, -1); aiPlay3DSound(pSprite, 1031+Random(2), AI_SFX_PRIORITY_2, -1); - gDudeExtra[pSprite->extra].at0 = gFrameClock+360; + gDudeExtra[pSprite->extra].TotalKills = gFrameClock+360; actHealDude(pXSprite, dudeInfo[40].startHealth, dudeInfo[40].startHealth); evKill(nSprite, 3, kCallbackFXFlameLick); } @@ -944,16 +944,16 @@ int aiDamageSprite(spritetype *pSprite, XSPRITE *pXSprite, int nSource, DAMAGE_T pSprite->type = kDudeBurningInnocent; aiNewState(pSprite, pXSprite, &cultistBurnGoto); aiPlay3DSound(pSprite, 361, AI_SFX_PRIORITY_0, -1); - gDudeExtra[pSprite->extra].at0 = gFrameClock+360; + gDudeExtra[pSprite->extra].TotalKills = gFrameClock+360; actHealDude(pXSprite, dudeInfo[39].startHealth, dudeInfo[39].startHealth); evKill(nSprite, 3, kCallbackFXFlameLick); } break; case kDudeBurningCultist: - if (Chance(0x4000) && gDudeExtra[pSprite->extra].at0 < gFrameClock) + if (Chance(0x4000) && gDudeExtra[pSprite->extra].TotalKills < gFrameClock) { aiPlay3DSound(pSprite, 1031+Random(2), AI_SFX_PRIORITY_2, -1); - gDudeExtra[pSprite->extra].at0 = gFrameClock+360; + gDudeExtra[pSprite->extra].TotalKills = gFrameClock+360; } if (Chance(0x600) && (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo)) { @@ -987,16 +987,16 @@ int aiDamageSprite(spritetype *pSprite, XSPRITE *pXSprite, int nSource, DAMAGE_T pSprite->type = kDudeBurningInnocent; aiNewState(pSprite, pXSprite, &cultistBurnGoto); aiPlay3DSound(pSprite, 361, AI_SFX_PRIORITY_0, -1); - gDudeExtra[pSprite->extra].at0 = gFrameClock+360; + gDudeExtra[pSprite->extra].TotalKills = gFrameClock+360; actHealDude(pXSprite, dudeInfo[39].startHealth, dudeInfo[39].startHealth); evKill(nSprite, 3, kCallbackFXFlameLick); } break; #ifdef NOONE_EXTENSIONS case kDudeModernCustomBurning: - if (Chance(0x2000) && gDudeExtra[pSprite->extra].at0 < gFrameClock) { + if (Chance(0x2000) && gDudeExtra[pSprite->extra].TotalKills < gFrameClock) { playGenDudeSound(pSprite, kGenDudeSndBurning); - gDudeExtra[pSprite->extra].at0 = gFrameClock + 360; + gDudeExtra[pSprite->extra].TotalKills = gFrameClock + 360; } if (pXSprite->burnTime == 0) pXSprite->burnTime = 2400; if (spriteIsUnderwater(pSprite, false)) { @@ -1036,7 +1036,7 @@ int aiDamageSprite(spritetype *pSprite, XSPRITE *pXSprite, int nSource, DAMAGE_T aiGenDudeNewState(pSprite, &genDudeBurnGoto); actHealDude(pXSprite, dudeInfo[55].startHealth, dudeInfo[55].startHealth); - gDudeExtra[pSprite->extra].at0 = gFrameClock + 360; + gDudeExtra[pSprite->extra].TotalKills = gFrameClock + 360; evKill(nSprite, 3, kCallbackFXFlameLick); } @@ -1101,7 +1101,7 @@ void RecoilDude(spritetype *pSprite, XSPRITE *pXSprite) #ifdef NOONE_EXTENSIONS case kDudeModernCustom: { GENDUDEEXTRA* pExtra = genDudeExtra(pSprite); int rChance = getRecoilChance(pSprite); - if (pExtra->canElectrocute && pDudeExtra->at4 && !spriteIsUnderwater(pSprite, false)) { + if (pExtra->canElectrocute && pDudeExtra->Kills && !spriteIsUnderwater(pSprite, false)) { if (Chance(rChance << 3) || (dudeIsMelee(pXSprite) && Chance(rChance << 4))) aiGenDudeNewState(pSprite, &genDudeRecoilTesla); else if (pExtra->canRecoil && Chance(rChance)) aiGenDudeNewState(pSprite, &genDudeRecoilL); @@ -1142,7 +1142,7 @@ void RecoilDude(spritetype *pSprite, XSPRITE *pXSprite) } - pDudeExtra->at4 = 0; + pDudeExtra->Kills = 0; break; } #endif @@ -1155,11 +1155,11 @@ void RecoilDude(spritetype *pSprite, XSPRITE *pXSprite) else aiPlay3DSound(pSprite, 1013+Random(2), AI_SFX_PRIORITY_2, -1); if (!v4 && pXSprite->medium == kMediumNormal) { - if (pDudeExtra->at4) aiNewState(pSprite, pXSprite, &cultistTeslaRecoil); + if (pDudeExtra->Kills) aiNewState(pSprite, pXSprite, &cultistTeslaRecoil); else aiNewState(pSprite, pXSprite, &cultistRecoil); } else if (v4 && pXSprite->medium == kMediumNormal) { - if (pDudeExtra->at4) aiNewState(pSprite, pXSprite, &cultistTeslaRecoil); + if (pDudeExtra->Kills) aiNewState(pSprite, pXSprite, &cultistTeslaRecoil); else if (gGameOptions.nDifficulty > 0) aiNewState(pSprite, pXSprite, &cultistProneRecoil); else aiNewState(pSprite, pXSprite, &cultistRecoil); } @@ -1167,7 +1167,7 @@ void RecoilDude(spritetype *pSprite, XSPRITE *pXSprite) aiNewState(pSprite, pXSprite, &cultistSwimRecoil); else { - if (pDudeExtra->at4) + if (pDudeExtra->Kills) aiNewState(pSprite, pXSprite, &cultistTeslaRecoil); else aiNewState(pSprite, pXSprite, &cultistRecoil); @@ -1183,7 +1183,7 @@ void RecoilDude(spritetype *pSprite, XSPRITE *pXSprite) #endif case kDudeZombieButcher: aiPlay3DSound(pSprite, 1202, AI_SFX_PRIORITY_2, -1); - if (pDudeExtra->at4) + if (pDudeExtra->Kills) aiNewState(pSprite, pXSprite, &zombieFTeslaRecoil); else aiNewState(pSprite, pXSprite, &zombieFRecoil); @@ -1191,7 +1191,7 @@ void RecoilDude(spritetype *pSprite, XSPRITE *pXSprite) case kDudeZombieAxeNormal: case kDudeZombieAxeBuried: aiPlay3DSound(pSprite, 1106, AI_SFX_PRIORITY_2, -1); - if (pDudeExtra->at4 && pXSprite->data3 > pDudeInfo->startHealth/3) + if (pDudeExtra->Kills && pXSprite->data3 > pDudeInfo->startHealth/3) aiNewState(pSprite, pXSprite, &zombieATeslaRecoil); else if (pXSprite->data3 > pDudeInfo->startHealth/3) aiNewState(pSprite, pXSprite, &zombieARecoil2); @@ -1213,7 +1213,7 @@ void RecoilDude(spritetype *pSprite, XSPRITE *pXSprite) break; case kDudeCerberusTwoHead: aiPlay3DSound(pSprite, 2302+Random(2), AI_SFX_PRIORITY_2, -1); - if (pDudeExtra->at4 && pXSprite->data3 > pDudeInfo->startHealth/3) + if (pDudeExtra->Kills && pXSprite->data3 > pDudeInfo->startHealth/3) aiNewState(pSprite, pXSprite, &cerberusTeslaRecoil); else aiNewState(pSprite, pXSprite, &cerberusRecoil); @@ -1224,7 +1224,7 @@ void RecoilDude(spritetype *pSprite, XSPRITE *pXSprite) break; case kDudeHellHound: aiPlay3DSound(pSprite, 1302, AI_SFX_PRIORITY_2, -1); - if (pDudeExtra->at4) + if (pDudeExtra->Kills) aiNewState(pSprite, pXSprite, &houndTeslaRecoil); else aiNewState(pSprite, pXSprite, &houndRecoil); @@ -1262,7 +1262,7 @@ void RecoilDude(spritetype *pSprite, XSPRITE *pXSprite) } case kDudePhantasm: aiPlay3DSound(pSprite, 1602, AI_SFX_PRIORITY_2, -1); - if (pDudeExtra->at4) + if (pDudeExtra->Kills) aiNewState(pSprite, pXSprite, &ghostTeslaRecoil); else aiNewState(pSprite, pXSprite, &ghostRecoil); @@ -1279,7 +1279,7 @@ void RecoilDude(spritetype *pSprite, XSPRITE *pXSprite) break; case kDudeInnocent: aiPlay3DSound(pSprite, 7007+Random(2), AI_SFX_PRIORITY_2, -1); - if (pDudeExtra->at4) + if (pDudeExtra->Kills) aiNewState(pSprite, pXSprite, &innocentTeslaRecoil); else aiNewState(pSprite, pXSprite, &innocentRecoil); @@ -1287,7 +1287,7 @@ void RecoilDude(spritetype *pSprite, XSPRITE *pXSprite) case kDudeTinyCaleb: if (pXSprite->medium == kMediumNormal) { - if (pDudeExtra->at4) + if (pDudeExtra->Kills) aiNewState(pSprite, pXSprite, &tinycalebTeslaRecoil); else aiNewState(pSprite, pXSprite, &tinycalebRecoil); @@ -1296,7 +1296,7 @@ void RecoilDude(spritetype *pSprite, XSPRITE *pXSprite) aiNewState(pSprite, pXSprite, &tinycalebSwimRecoil); else { - if (pDudeExtra->at4) + if (pDudeExtra->Kills) aiNewState(pSprite, pXSprite, &tinycalebTeslaRecoil); else aiNewState(pSprite, pXSprite, &tinycalebRecoil); @@ -1306,7 +1306,7 @@ void RecoilDude(spritetype *pSprite, XSPRITE *pXSprite) aiPlay3DSound(pSprite, 9004+Random(2), AI_SFX_PRIORITY_2, -1); if (pXSprite->medium == kMediumNormal) { - if (pDudeExtra->at4) + if (pDudeExtra->Kills) aiNewState(pSprite, pXSprite, &beastTeslaRecoil); else aiNewState(pSprite, pXSprite, &beastRecoil); @@ -1315,7 +1315,7 @@ void RecoilDude(spritetype *pSprite, XSPRITE *pXSprite) aiNewState(pSprite, pXSprite, &beastSwimRecoil); else { - if (pDudeExtra->at4) + if (pDudeExtra->Kills) aiNewState(pSprite, pXSprite, &beastTeslaRecoil); else aiNewState(pSprite, pXSprite, &beastRecoil); @@ -1333,7 +1333,7 @@ void RecoilDude(spritetype *pSprite, XSPRITE *pXSprite) aiNewState(pSprite, pXSprite, &genRecoil); break; } - pDudeExtra->at4 = 0; + pDudeExtra->Kills = 0; } } @@ -1507,8 +1507,8 @@ void aiInitSprite(spritetype *pSprite) if (nXSector > 0) pXSector = &xsector[nXSector]; DUDEEXTRA *pDudeExtra = &gDudeExtra[pSprite->extra]; - pDudeExtra->at4 = 0; - pDudeExtra->at0 = 0; + pDudeExtra->Kills = 0; + pDudeExtra->TotalKills = 0; switch (pSprite->type) { #ifdef NOONE_EXTENSIONS @@ -1528,7 +1528,7 @@ void aiInitSprite(spritetype *pSprite) { DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u1; pDudeExtraE->at8 = 0; - pDudeExtraE->at0 = 0; + pDudeExtraE->TotalKills = 0; aiNewState(pSprite, pXSprite, &cultistIdle); break; } @@ -1536,7 +1536,7 @@ void aiInitSprite(spritetype *pSprite) { DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u1; pDudeExtraE->at8 = 0; - pDudeExtraE->at0 = 0; + pDudeExtraE->TotalKills = 0; aiNewState(pSprite, pXSprite, &fanaticProneIdle); break; } @@ -1544,46 +1544,46 @@ void aiInitSprite(spritetype *pSprite) { DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u1; pDudeExtraE->at8 = 0; - pDudeExtraE->at0 = 0; + pDudeExtraE->TotalKills = 0; aiNewState(pSprite, pXSprite, &cultistProneIdle); break; } case kDudeZombieButcher: { DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u2; - pDudeExtraE->at4 = 0; - pDudeExtraE->at0 = 0; + pDudeExtraE->Kills = 0; + pDudeExtraE->TotalKills = 0; aiNewState(pSprite, pXSprite, &zombieFIdle); break; } case kDudeZombieAxeNormal: { DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u2; - pDudeExtraE->at4 = 0; - pDudeExtraE->at0 = 0; + pDudeExtraE->Kills = 0; + pDudeExtraE->TotalKills = 0; aiNewState(pSprite, pXSprite, &zombieAIdle); break; } case kDudeZombieAxeLaying: { DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u2; - pDudeExtraE->at4 = 0; - pDudeExtraE->at0 = 0; + pDudeExtraE->Kills = 0; + pDudeExtraE->TotalKills = 0; aiNewState(pSprite, pXSprite, &zombieSIdle); pSprite->flags &= ~1; break; } case kDudeZombieAxeBuried: { DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u2; - pDudeExtraE->at4 = 0; - pDudeExtraE->at0 = 0; + pDudeExtraE->Kills = 0; + pDudeExtraE->TotalKills = 0; aiNewState(pSprite, pXSprite, &zombieEIdle); break; } case kDudeGargoyleFlesh: case kDudeGargoyleStone: { DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u1; - pDudeExtraE->at4 = 0; + pDudeExtraE->Kills = 0; pDudeExtraE->at8 = 0; - pDudeExtraE->at0 = 0; + pDudeExtraE->TotalKills = 0; aiNewState(pSprite, pXSprite, &gargoyleFIdle); break; } @@ -1593,8 +1593,8 @@ void aiInitSprite(spritetype *pSprite) break; case kDudeCerberusTwoHead: { DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u2; - pDudeExtraE->at4 = 0; - pDudeExtraE->at0 = 0; + pDudeExtraE->Kills = 0; + pDudeExtraE->TotalKills = 0; aiNewState(pSprite, pXSprite, &cerberusIdle); break; } @@ -1607,9 +1607,9 @@ void aiInitSprite(spritetype *pSprite) case kDudePhantasm: { DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u1; - pDudeExtraE->at4 = 0; + pDudeExtraE->Kills = 0; pDudeExtraE->at8 = 0; - pDudeExtraE->at0 = 0; + pDudeExtraE->TotalKills = 0; aiNewState(pSprite, pXSprite, &ghostIdle); break; } @@ -1622,9 +1622,9 @@ void aiInitSprite(spritetype *pSprite) case kDudeBoneEel: { DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u1; - pDudeExtraE->at4 = 0; + pDudeExtraE->Kills = 0; pDudeExtraE->at8 = 0; - pDudeExtraE->at0 = 0; + pDudeExtraE->TotalKills = 0; aiNewState(pSprite, pXSprite, &eelIdle); break; } @@ -1634,9 +1634,9 @@ void aiInitSprite(spritetype *pSprite) case kDudeBat: { DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u1; - pDudeExtraE->at4 = 0; + pDudeExtraE->Kills = 0; pDudeExtraE->at8 = 0; - pDudeExtraE->at0 = 0; + pDudeExtraE->TotalKills = 0; aiNewState(pSprite, pXSprite, &batIdle); break; } @@ -1646,8 +1646,8 @@ void aiInitSprite(spritetype *pSprite) { DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u1; pDudeExtraE->at8 = 0; - pDudeExtraE->at4 = 0; - pDudeExtraE->at0 = 0; + pDudeExtraE->Kills = 0; + pDudeExtraE->TotalKills = 0; aiNewState(pSprite, pXSprite, &spidIdle); break; } @@ -1655,16 +1655,16 @@ void aiInitSprite(spritetype *pSprite) { DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u1; pDudeExtraE->at8 = 0; - pDudeExtraE->at4 = 0; - pDudeExtraE->at0 = 0; + pDudeExtraE->Kills = 0; + pDudeExtraE->TotalKills = 0; aiNewState(pSprite, pXSprite, &spidIdle); break; } case kDudeTchernobog: { DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u2; - pDudeExtraE->at4 = 0; - pDudeExtraE->at0 = 0; + pDudeExtraE->Kills = 0; + pDudeExtraE->TotalKills = 0; aiNewState(pSprite, pXSprite, &tchernobogIdle); break; } diff --git a/source/blood/src/ai.h b/source/blood/src/ai.h index b6e2ac9e8..2ed8f4102 100644 --- a/source/blood/src/ai.h +++ b/source/blood/src/ai.h @@ -53,21 +53,21 @@ enum AI_SFX_PRIORITY { struct DUDEEXTRA_at6_u1 { - int at0; - int at4; + int TotalKills; + int Kills; char at8; }; struct DUDEEXTRA_at6_u2 { - int at0; - char at4; + int TotalKills; + char Kills; }; struct DUDEEXTRA { - int at0; - char at4; + int TotalKills; + char Kills; AI_SFX_PRIORITY at5; union { @@ -78,8 +78,8 @@ struct DUDEEXTRA }; struct TARGETTRACK { - int at0; - int at4; + int TotalKills; + int Kills; int at8; // view angle int atc; int at10; // Move predict diff --git a/source/blood/src/aibat.cpp b/source/blood/src/aibat.cpp index e8c2863d2..d21c6241e 100644 --- a/source/blood/src/aibat.cpp +++ b/source/blood/src/aibat.cpp @@ -94,11 +94,11 @@ static void thinkTarget(spritetype *pSprite, XSPRITE *pXSprite) dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1; - if (pDudeExtraE->at8 && pDudeExtraE->at4 < 10) - pDudeExtraE->at4++; - else if (pDudeExtraE->at4 >= 10 && pDudeExtraE->at8) + if (pDudeExtraE->at8 && pDudeExtraE->Kills < 10) + pDudeExtraE->Kills++; + else if (pDudeExtraE->Kills >= 10 && pDudeExtraE->at8) { - pDudeExtraE->at4 = 0; + pDudeExtraE->Kills = 0; pXSprite->goalAng += 256; POINT3D *pTarget = &baseSprite[pSprite->index]; aiSetTarget(pXSprite, pTarget->x, pTarget->y, pTarget->z); diff --git a/source/blood/src/aiboneel.cpp b/source/blood/src/aiboneel.cpp index 01ee55c55..a67bfec24 100644 --- a/source/blood/src/aiboneel.cpp +++ b/source/blood/src/aiboneel.cpp @@ -107,11 +107,11 @@ static void thinkTarget(spritetype *pSprite, XSPRITE *pXSprite) dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1; - if (pDudeExtraE->at8 && pDudeExtraE->at4 < 10) - pDudeExtraE->at4++; - else if (pDudeExtraE->at4 >= 10 && pDudeExtraE->at8) + if (pDudeExtraE->at8 && pDudeExtraE->Kills < 10) + pDudeExtraE->Kills++; + else if (pDudeExtraE->Kills >= 10 && pDudeExtraE->at8) { - pDudeExtraE->at4 = 0; + pDudeExtraE->Kills = 0; pXSprite->goalAng += 256; POINT3D *pTarget = &baseSprite[pSprite->index]; aiSetTarget(pXSprite, pTarget->x, pTarget->y, pTarget->z); @@ -139,13 +139,13 @@ static void thinkTarget(spritetype *pSprite, XSPRITE *pXSprite) int nDeltaAngle = ((getangle(dx,dy)+1024-pSprite->ang)&2047)-1024; if (nDist < pDudeInfo->seeDist && klabs(nDeltaAngle) <= pDudeInfo->periphery) { - pDudeExtraE->at4 = 0; + pDudeExtraE->Kills = 0; aiSetTarget(pXSprite, pPlayer->nSprite); aiActivateDude(pSprite, pXSprite); } else if (nDist < pDudeInfo->hearDist) { - pDudeExtraE->at4 = 0; + pDudeExtraE->Kills = 0; aiSetTarget(pXSprite, x, y, z); aiActivateDude(pSprite, pXSprite); } diff --git a/source/blood/src/aicerber.cpp b/source/blood/src/aicerber.cpp index 55e69e1bf..a76cc2fc6 100644 --- a/source/blood/src/aicerber.cpp +++ b/source/blood/src/aicerber.cpp @@ -279,9 +279,9 @@ static void thinkTarget(spritetype *pSprite, XSPRITE *pXSprite) } DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1; - if (pDudeExtraE->at8 && pDudeExtraE->at4 < 10) - pDudeExtraE->at4++; - else if (pDudeExtraE->at4 >= 10 && pDudeExtraE->at8) + if (pDudeExtraE->at8 && pDudeExtraE->Kills < 10) + pDudeExtraE->Kills++; + else if (pDudeExtraE->Kills >= 10 && pDudeExtraE->at8) { pXSprite->goalAng += 256; POINT3D *pTarget = &baseSprite[pSprite->index]; @@ -313,13 +313,13 @@ static void thinkTarget(spritetype *pSprite, XSPRITE *pXSprite) int nDeltaAngle = ((getangle(dx,dy)+1024-pSprite->ang)&2047)-1024; if (nDist < pDudeInfo->seeDist && klabs(nDeltaAngle) <= pDudeInfo->periphery) { - pDudeExtraE->at0 = 0; + pDudeExtraE->TotalKills = 0; aiSetTarget(pXSprite, pPlayer->nSprite); aiActivateDude(pSprite, pXSprite); } else if (nDist < pDudeInfo->hearDist) { - pDudeExtraE->at0 = 0; + pDudeExtraE->TotalKills = 0; aiSetTarget(pXSprite, x, y, z); aiActivateDude(pSprite, pXSprite); } diff --git a/source/blood/src/aigarg.cpp b/source/blood/src/aigarg.cpp index fc9b618d6..618f7bbef 100644 --- a/source/blood/src/aigarg.cpp +++ b/source/blood/src/aigarg.cpp @@ -238,9 +238,9 @@ static void thinkTarget(spritetype *pSprite, XSPRITE *pXSprite) } DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1; - if (pDudeExtraE->at8 && pDudeExtraE->at4 < 10) - pDudeExtraE->at4++; - else if (pDudeExtraE->at4 >= 10 && pDudeExtraE->at8) + if (pDudeExtraE->at8 && pDudeExtraE->Kills < 10) + pDudeExtraE->Kills++; + else if (pDudeExtraE->Kills >= 10 && pDudeExtraE->at8) { pXSprite->goalAng += 256; POINT3D *pTarget = &baseSprite[pSprite->index]; @@ -269,13 +269,13 @@ static void thinkTarget(spritetype *pSprite, XSPRITE *pXSprite) int nDeltaAngle = ((getangle(dx,dy)+1024-pSprite->ang)&2047)-1024; if (nDist < pDudeInfo->seeDist && klabs(nDeltaAngle) <= pDudeInfo->periphery) { - pDudeExtraE->at4 = 0; + pDudeExtraE->Kills = 0; aiSetTarget(pXSprite, pPlayer->nSprite); aiActivateDude(pSprite, pXSprite); } else if (nDist < pDudeInfo->hearDist) { - pDudeExtraE->at4 = 0; + pDudeExtraE->Kills = 0; aiSetTarget(pXSprite, x, y, z); aiActivateDude(pSprite, pXSprite); } diff --git a/source/blood/src/aighost.cpp b/source/blood/src/aighost.cpp index 87e105a3b..c928925d7 100644 --- a/source/blood/src/aighost.cpp +++ b/source/blood/src/aighost.cpp @@ -212,9 +212,9 @@ static void thinkTarget(spritetype *pSprite, XSPRITE *pXSprite) } DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1; - if (pDudeExtraE->at8 && pDudeExtraE->at4 < 10) - pDudeExtraE->at4++; - else if (pDudeExtraE->at4 >= 10 && pDudeExtraE->at8) + if (pDudeExtraE->at8 && pDudeExtraE->Kills < 10) + pDudeExtraE->Kills++; + else if (pDudeExtraE->Kills >= 10 && pDudeExtraE->at8) { pXSprite->goalAng += 256; POINT3D *pTarget = &baseSprite[pSprite->index]; @@ -243,14 +243,14 @@ static void thinkTarget(spritetype *pSprite, XSPRITE *pXSprite) int nDeltaAngle = ((getangle(dx,dy)+1024-pSprite->ang)&2047)-1024; if (nDist < pDudeInfo->seeDist && klabs(nDeltaAngle) <= pDudeInfo->periphery) { - pDudeExtraE->at4 = 0; + pDudeExtraE->Kills = 0; aiSetTarget(pXSprite, pPlayer->nSprite); aiActivateDude(pSprite, pXSprite); return; } else if (nDist < pDudeInfo->hearDist) { - pDudeExtraE->at4 = 0; + pDudeExtraE->Kills = 0; aiSetTarget(pXSprite, x, y, z); aiActivateDude(pSprite, pXSprite); return; diff --git a/source/blood/src/aispid.cpp b/source/blood/src/aispid.cpp index 7b4194cf2..30c60905f 100644 --- a/source/blood/src/aispid.cpp +++ b/source/blood/src/aispid.cpp @@ -178,7 +178,7 @@ static void sub_71370(int, int nXSprite) int nDist = approxDist(dx, dy); spritetype *pSpawn = NULL; - if (IsPlayerSprite(pTarget) && pDudeExtraE->at4 < 10) { + if (IsPlayerSprite(pTarget) && pDudeExtraE->Kills < 10) { if (nDist < 0x1a00 && nDist > 0x1400 && klabs(pSprite->ang-nAngle) < pDudeInfo->periphery) pSpawn = actSpawnDude(pSprite, kDudeSpiderRed, pSprite->clipdist, 0); @@ -188,9 +188,9 @@ static void sub_71370(int, int nXSprite) pSpawn = actSpawnDude(pSprite, kDudeSpiderBrown, pSprite->clipdist, 0); if (pSpawn) { - pDudeExtraE->at4++; + pDudeExtraE->Kills++; pSpawn->owner = nSprite; - gKillMgr.sub_263E0(1); + gKillMgr.AddNewKill(1); } } diff --git a/source/blood/src/aitchern.cpp b/source/blood/src/aitchern.cpp index 565f816bb..4fe35aeaa 100644 --- a/source/blood/src/aitchern.cpp +++ b/source/blood/src/aitchern.cpp @@ -248,9 +248,9 @@ static void sub_725A4(spritetype *pSprite, XSPRITE *pXSprite) } DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u2; - if (pDudeExtraE->at4 && pDudeExtraE->at0 < 10) - pDudeExtraE->at0++; - else if (pDudeExtraE->at0 >= 10 && pDudeExtraE->at4) + if (pDudeExtraE->Kills && pDudeExtraE->TotalKills < 10) + pDudeExtraE->TotalKills++; + else if (pDudeExtraE->TotalKills >= 10 && pDudeExtraE->Kills) { pXSprite->goalAng += 256; POINT3D *pTarget = &baseSprite[pSprite->index]; @@ -279,13 +279,13 @@ static void sub_725A4(spritetype *pSprite, XSPRITE *pXSprite) int nDeltaAngle = ((getangle(dx,dy)+1024-pSprite->ang)&2047)-1024; if (nDist < pDudeInfo->seeDist && klabs(nDeltaAngle) <= pDudeInfo->periphery) { - pDudeExtraE->at0 = 0; + pDudeExtraE->TotalKills = 0; aiSetTarget(pXSprite, pPlayer->nSprite); aiActivateDude(pSprite, pXSprite); } else if (nDist < pDudeInfo->hearDist) { - pDudeExtraE->at0 = 0; + pDudeExtraE->TotalKills = 0; aiSetTarget(pXSprite, x, y, z); aiActivateDude(pSprite, pXSprite); } diff --git a/source/blood/src/aiunicult.cpp b/source/blood/src/aiunicult.cpp index 0c595cd48..0db75d4b7 100644 --- a/source/blood/src/aiunicult.cpp +++ b/source/blood/src/aiunicult.cpp @@ -254,7 +254,7 @@ static void genDudeAttack1(int, int nXIndex) { aiActivateDude(pSpawned, &xsprite[pSpawned->extra]); } - gKillMgr.sub_263E0(1); + gKillMgr.AddNewKill(1); pExtra->slave[pExtra->slaveCount++] = pSpawned->index; if (!playGenDudeSound(pSprite, kGenDudeSndAttackNormal)) sfxPlay3DSoundCP(pSprite, 379, 1, 0, 0x10000 - Random3(0x3000)); @@ -2192,7 +2192,7 @@ void aiGenDudeInitSprite(spritetype* pSprite, XSPRITE* pXSprite) { switch (pSprite->type) { case kDudeModernCustom: { DUDEEXTRA_at6_u1* pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1; - pDudeExtraE->at8 = pDudeExtraE->at0 = 0; + pDudeExtraE->at8 = pDudeExtraE->TotalKills = 0; aiGenDudeNewState(pSprite, &genDudeIdleL); break; } diff --git a/source/blood/src/blood.cpp b/source/blood/src/blood.cpp index b03cf0ada..2c2da35da 100644 --- a/source/blood/src/blood.cpp +++ b/source/blood/src/blood.cpp @@ -288,7 +288,7 @@ void ProcessFrame(void) } viewClearInterpolations(); { - if (paused || gEndGameMgr.at0 || (gGameOptions.nGameType == 0 && M_Active())) + if (paused || (gGameOptions.nGameType == 0 && M_Active())) return; } @@ -376,7 +376,7 @@ void ProcessFrame(void) } else { - gEndGameMgr.Setup(); + ShowSummaryScreen(); } } } @@ -597,11 +597,6 @@ void GameInterface::RunGameFrame() case GS_LEVEL: gameTicker(); break; - - case GS_FINALE: - gEndGameMgr.ProcessKeys(); - gEndGameMgr.Draw(); - break; } } diff --git a/source/blood/src/blood.h b/source/blood/src/blood.h index 5f86b70a8..581063585 100644 --- a/source/blood/src/blood.h +++ b/source/blood/src/blood.h @@ -60,6 +60,7 @@ void PreloadCache(void); void StartLevel(MapRecord *gameOptions); void ProcessFrame(void); void ScanINIFiles(void); +void EndLevel(); inline bool DemoRecordStatus(void) { diff --git a/source/blood/src/choke.cpp b/source/blood/src/choke.cpp index d9fa7a7db..c69f1f733 100644 --- a/source/blood/src/choke.cpp +++ b/source/blood/src/choke.cpp @@ -37,7 +37,7 @@ BEGIN_BLD_NS void CChoke::init(int a1, void(*a2)(PLAYER*)) { - at0 = NULL; + TotalKills = NULL; at1c = a2; if (!at8 && a1 != -1) { diff --git a/source/blood/src/choke.h b/source/blood/src/choke.h index 1af6aaf64..f874a7063 100644 --- a/source/blood/src/choke.h +++ b/source/blood/src/choke.h @@ -33,7 +33,7 @@ class CChoke public: CChoke() { - at0 = NULL; + TotalKills = NULL; at8 = NULL; atc = 0; at10 = 0; @@ -44,7 +44,7 @@ public: void init(int a1, void(*a2)(PLAYER*)); void animateChoke(int x, int y, int smoothratio); void reset() { at10 = 0; } - char *at0; + char *TotalKills; QAV *at8; int atc; int at10; diff --git a/source/blood/src/db.cpp b/source/blood/src/db.cpp index 1756865ee..6e803b9c8 100644 --- a/source/blood/src/db.cpp +++ b/source/blood/src/db.cpp @@ -644,8 +644,8 @@ int dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, short byte_1A76C7 = 1; } - mapHeader.at0 = LittleLong(mapHeader.at0); - mapHeader.at4 = LittleLong(mapHeader.at4); + mapHeader.TotalKills = LittleLong(mapHeader.TotalKills); + mapHeader.Kills = LittleLong(mapHeader.Kills); mapHeader.at8 = LittleLong(mapHeader.at8); mapHeader.atc = LittleShort(mapHeader.atc); mapHeader.ate = LittleShort(mapHeader.ate); @@ -657,8 +657,8 @@ int dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, short mapHeader.at21 = LittleShort(mapHeader.at21); mapHeader.at23 = LittleShort(mapHeader.at23); - *pX = mapHeader.at0; - *pY = mapHeader.at4; + *pX = mapHeader.TotalKills; + *pY = mapHeader.Kills; *pZ = mapHeader.at8; *pAngle = mapHeader.atc; *pSector = mapHeader.ate; diff --git a/source/blood/src/db.h b/source/blood/src/db.h index 5fc24af2a..47a084e31 100644 --- a/source/blood/src/db.h +++ b/source/blood/src/db.h @@ -246,8 +246,8 @@ struct MAPSIGNATURE { }; struct MAPHEADER { - int at0; // x - int at4; // y + int TotalKills; // x + int Kills; // y int at8; // z short atc; // ang short ate; // sect @@ -262,7 +262,7 @@ struct MAPHEADER { }; struct MAPHEADER2 { - char at0[64]; + char TotalKills[64]; int at40; // xsprite size int at44; // xwall size int at48; // xsector size diff --git a/source/blood/src/endgame.cpp b/source/blood/src/endgame.cpp index b6419bbcb..d8f25ca59 100644 --- a/source/blood/src/endgame.cpp +++ b/source/blood/src/endgame.cpp @@ -43,291 +43,280 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "gamestate.h" #include "raze_sound.h" #include "d_net.h" +#include "screenjob.h" BEGIN_BLD_NS enum { - kLoadScreenCRC = -2051908571, - kLoadScreenWideBackWidth = 256, - kLoadScreenWideSideWidth = 128, + kLoadScreenCRC = -2051908571, + kLoadScreenWideBackWidth = 256, + kLoadScreenWideSideWidth = 128, }; - static int bLoadScreenCrcMatch = -1; static void drawTextScreenBackground(void) { - if (bLoadScreenCrcMatch == -1) bLoadScreenCrcMatch = tileGetCRC32(kLoadScreen) == kLoadScreenCRC; + if (bLoadScreenCrcMatch == -1) bLoadScreenCrcMatch = tileGetCRC32(kLoadScreen) == kLoadScreenCRC; - if (bLoadScreenCrcMatch) - { - if (yxaspect >= 65536) - { - DrawTexture(twod, tileGetTexture(kLoadScreen), 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43, TAG_DONE); - } - else - { - int width = scale(xdim, 240, ydim); - int nCount = (width + kLoadScreenWideBackWidth - 1) / kLoadScreenWideBackWidth; - for (int i = 0; i < nCount; i++) - { - DrawTexture(twod, tileGetTexture(kLoadScreenWideBack), (i * kLoadScreenWideBackWidth), 0, - DTA_VirtualWidth, width, DTA_VirtualHeight, 200, DTA_KeepRatio, true, TAG_DONE); - } - DrawTexture(twod, tileGetTexture(kLoadScreenWideLeft), 0, 0, DTA_VirtualWidth, width, DTA_VirtualHeight, 200, DTA_KeepRatio, true, DTA_TopLeft, true, TAG_DONE); - DrawTexture(twod, tileGetTexture(kLoadScreenWideRight), width - tileWidth(kLoadScreenWideRight), 0, DTA_TopLeft, true, - DTA_VirtualWidth, width, DTA_VirtualHeight, 200, DTA_KeepRatio, true, TAG_DONE); - DrawTexture(twod, tileGetTexture(kLoadScreenWideMiddle), (width - tileWidth(kLoadScreenWideMiddle))/2, 0, DTA_TopLeft, true, - DTA_VirtualWidth, width, DTA_VirtualHeight, 200, DTA_KeepRatio, true, TAG_DONE); - } - } - else - { - DrawTexture(twod, tileGetTexture(kLoadScreen), 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43, TAG_DONE); - } + if (bLoadScreenCrcMatch) + { + if (ActiveRatio(twod->GetWidth(), twod->GetHeight()) < 1.34f) + { + DrawTexture(twod, tileGetTexture(kLoadScreen), 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43, TAG_DONE); + } + else + { + int width = scale(xdim, 240, ydim); + int nCount = (width + kLoadScreenWideBackWidth - 1) / kLoadScreenWideBackWidth; + for (int i = 0; i < nCount; i++) + { + DrawTexture(twod, tileGetTexture(kLoadScreenWideBack), (i * kLoadScreenWideBackWidth), 0, + DTA_VirtualWidth, width, DTA_VirtualHeight, 200, DTA_KeepRatio, true, TAG_DONE); + } + DrawTexture(twod, tileGetTexture(kLoadScreenWideLeft), 0, 0, DTA_VirtualWidth, width, DTA_VirtualHeight, 200, DTA_KeepRatio, true, DTA_TopLeft, true, TAG_DONE); + DrawTexture(twod, tileGetTexture(kLoadScreenWideRight), width - tileWidth(kLoadScreenWideRight), 0, DTA_TopLeft, true, + DTA_VirtualWidth, width, DTA_VirtualHeight, 200, DTA_KeepRatio, true, TAG_DONE); + DrawTexture(twod, tileGetTexture(kLoadScreenWideMiddle), (width - tileWidth(kLoadScreenWideMiddle)) / 2, 0, DTA_TopLeft, true, + DTA_VirtualWidth, width, DTA_VirtualHeight, 200, DTA_KeepRatio, true, TAG_DONE); + } + } + else + { + DrawTexture(twod, tileGetTexture(kLoadScreen), 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43, TAG_DONE); + } } -CEndGameMgr::CEndGameMgr() +class DBloodSummaryScreen : public DScreenJob { - at0 = 0; -} + void DrawKills(void) + { + char pBuffer[40]; + if (gGameOptions.nGameType == 0) + { + viewDrawText(1, FStringf("%s:", GStrings("KILLS")), 75, 50, -128, 0, 0, 1); + mysnprintf(pBuffer, 40,"%2d", gKillMgr.Kills); + viewDrawText(1, pBuffer, 160, 50, -128, 0, 0, 1); + viewDrawText(1, GStrings("OF"), 190, 50, -128, 0, 0, 1); + mysnprintf(pBuffer, 40, "%2d", gKillMgr.TotalKills); + viewDrawText(1, pBuffer, 220, 50, -128, 0, 0, 1); + } + else + { + viewDrawText(3, "#", 85, 35, -128, 0, 0, 1); + viewDrawText(3, GStrings("NAME"), 100, 35, -128, 0, 0, 1); + viewDrawText(3, GStrings("FRAGS"), 210, 35, -128, 0, 0, 1); + int nStart = 0; + int nEnd = kMaxPlayers; -void CEndGameMgr::Draw(void) + for (int i = nStart; i < nEnd; i++) if (playeringame[i]) + { + mysnprintf(pBuffer, 40, "%-2d", i); + viewDrawText(3, pBuffer, 85, 50 + 8 * i, -128, 0, 0, 1); + mysnprintf(pBuffer, 40, "%s", gProfile[i].name); + viewDrawText(3, pBuffer, 100, 50 + 8 * i, -128, 0, 0, 1); + mysnprintf(pBuffer, 40, "%d", gPlayer[i].fragCount); + viewDrawText(3, pBuffer, 210, 50 + 8 * i, -128, 0, 0, 1); + } + } + } + + void DrawSecrets(void) + { + char pBuffer[40]; + viewDrawText(1, FStringf("%s:", GStrings("TXT_SECRETS")), 75, 70, -128, 0, 0, 1); + mysnprintf(pBuffer, 40, "%2d", gSecretMgr.Founds); + viewDrawText(1, pBuffer, 160, 70, -128, 0, 0, 1); + viewDrawText(1, GStrings("OF"), 190, 70, -128, 0, 0, 1); + mysnprintf(pBuffer, 40, "%2d", gSecretMgr.Total); + viewDrawText(1, pBuffer, 220, 70, -128, 0, 0, 1); + if (gSecretMgr.Super > 0) + viewDrawText(1, GStrings("TXT_SUPERSECRET"), 160, 100, -128, 2, 1, 1); + } + + + int Frame(uint64_t clock, bool skiprequest) + { + drawTextScreenBackground(); + if (gGameOptions.nGameType == 0) + { + DrawMenuCaption(GStrings("TXTB_LEVELSTATS")); + if (bPlayerCheated) + { + viewDrawText(3, GStrings("TXTB_CHEATED"), 160, 32, -128, 0, 1, 1); + } + DrawKills(); + DrawSecrets(); + } + else + { + DrawMenuCaption(GStrings("TXTB_FRAGSTATS")); + DrawKills(); + } + int myclock = int(clock * 120 / 1'000'000'000); + if ((myclock & 32)) + { + viewDrawText(3, GStrings("PRESSKEY"), 160, 134, -128, 0, 1, 1); + } + return skiprequest ? -1 : 1; + } +}; + + +void ShowSummaryScreen() { - drawTextScreenBackground(); - if (gGameOptions.nGameType == 0) - { - DrawMenuCaption(GStrings("TXTB_LEVELSTATS")); - if (bPlayerCheated) - { - viewDrawText(3, GStrings("TXTB_CHEATED"), 160, 32, -128, 0, 1, 1); - } - gKillMgr.Draw(); - gSecretMgr.Draw(); - } - else - { - DrawMenuCaption(GStrings("TXTB_FRAGSTATS")); - gKillMgr.Draw(); - } - if (/*dword_28E3D4 != 1 && */(gameclock&32)) - { - viewDrawText(3, GStrings("PRESSKEY"), 160, 134, -128, 0, 1, 1); - } -} + JobDesc job = { Create() }; -void CEndGameMgr::ProcessKeys(void) -{ - if (!inputState.CheckAllInput()) - return; - Finish(); -} - -extern void EndLevel(void); - -void CEndGameMgr::Setup(void) -{ - gamestate = GS_FINALE; - at0 = 1; STAT_Update(false); - EndLevel(); - Mus_Stop(); - sndStartSample(268, 128, -1, false); + EndLevel(); + Mus_Stop(); + sndStartSample(268, 128, -1, false); + RunScreenJob(&job, 1, [](bool) + { + int ep = volfromlevelnum(currentLevel->levelNumber); + gStartNewGame = FindMapByLevelNum(levelnum(ep, gNextLevel)); + gamestate = GS_LEVEL; + soundEngine->StopAllChannels(); + }); } -void CEndGameMgr::Finish(void) -{ - int ep = volfromlevelnum(currentLevel->levelNumber); - gStartNewGame = FindMapByLevelNum(levelnum(ep, gNextLevel)); - soundEngine->StopAllChannels(); - at0 = 0; -} CKillMgr::CKillMgr() { - Clear(); + Clear(); } void CKillMgr::SetCount(int nCount) { - at0 = nCount; + TotalKills = nCount; } -void CKillMgr::sub_263E0(int nCount) +void CKillMgr::AddNewKill(int nCount) { - at0 += nCount; + TotalKills += nCount; } void CKillMgr::AddKill(spritetype* pSprite) { - if (pSprite->statnum == kStatDude && pSprite->type != kDudeBat && pSprite->type != kDudeRat && pSprite->type != kDudeInnocent && pSprite->type != kDudeBurningInnocent) - at4++; + if (pSprite->statnum == kStatDude && pSprite->type != kDudeBat && pSprite->type != kDudeRat && pSprite->type != kDudeInnocent && pSprite->type != kDudeBurningInnocent) + Kills++; } -void CKillMgr::sub_2641C(void) +void CKillMgr::CountTotalKills(void) { - at0 = 0; - for (int nSprite = headspritestat[kStatDude]; nSprite >= 0; nSprite = nextspritestat[nSprite]) - { - spritetype* pSprite = &sprite[nSprite]; - if (pSprite->type < kDudeBase || pSprite->type >= kDudeMax) - ThrowError("Non-enemy sprite (%d) in the enemy sprite list.", nSprite); - if (pSprite->statnum == kStatDude && pSprite->type != kDudeBat && pSprite->type != kDudeRat && pSprite->type != kDudeInnocent && pSprite->type != kDudeBurningInnocent) - at0++; - } -} - -void CKillMgr::Draw(void) -{ - char pBuffer[40]; - if (gGameOptions.nGameType == 0) - { - viewDrawText(1, FStringf("%s:", GStrings("KILLS")), 75, 50, -128, 0, 0, 1); - sprintf(pBuffer, "%2d", at4); - viewDrawText(1, pBuffer, 160, 50, -128, 0, 0, 1); - viewDrawText(1, GStrings("OF"), 190, 50, -128, 0, 0, 1); - sprintf(pBuffer, "%2d", at0); - viewDrawText(1, pBuffer, 220, 50, -128, 0, 0, 1); - } - else - { - viewDrawText(3, "#", 85, 35, -128, 0, 0, 1); - viewDrawText(3, GStrings("NAME"), 100, 35, -128, 0, 0, 1); - viewDrawText(3, GStrings("FRAGS"), 210, 35, -128, 0, 0, 1); - int nStart = 0; - int nEnd = kMaxPlayers; - //if (dword_28E3D4 == 1) - //{ - // nStart++; - // nEnd++; - //} - for (int i = nStart; i < nEnd; i++) if (playeringame[i]) - { - sprintf(pBuffer, "%-2d", i); - viewDrawText(3, pBuffer, 85, 50+8*i, -128, 0, 0, 1); - sprintf(pBuffer, "%s", gProfile[i].name); - viewDrawText(3, pBuffer, 100, 50+8*i, -128, 0, 0, 1); - sprintf(pBuffer, "%d", gPlayer[i].fragCount); - viewDrawText(3, pBuffer, 210, 50+8*i, -128, 0, 0, 1); - } - } + TotalKills = 0; + for (int nSprite = headspritestat[kStatDude]; nSprite >= 0; nSprite = nextspritestat[nSprite]) + { + spritetype* pSprite = &sprite[nSprite]; + if (pSprite->type < kDudeBase || pSprite->type >= kDudeMax) + ThrowError("Non-enemy sprite (%d) in the enemy sprite list.", nSprite); + if (pSprite->statnum == kStatDude && pSprite->type != kDudeBat && pSprite->type != kDudeRat && pSprite->type != kDudeInnocent && pSprite->type != kDudeBurningInnocent) + TotalKills++; + } } void CKillMgr::Clear(void) { - at0 = at4 = 0; + TotalKills = Kills = 0; } CSecretMgr::CSecretMgr(void) { - Clear(); + Clear(); } void CSecretMgr::SetCount(int nCount) { - at0 = nCount; + Total = nCount; } void CSecretMgr::Found(int nType) { - if (nType == 0) at4++; - else if (nType < 0) { - viewSetSystemMessage("Invalid secret type %d triggered.", nType); - return; - } else at8++; + if (nType == 0) Founds++; + else if (nType < 0) { + viewSetSystemMessage("Invalid secret type %d triggered.", nType); + return; + } + else Super++; - if (gGameOptions.nGameType == 0) { - viewSetMessage(GStrings(FStringf("TXTB_SECRET%d", Random(2))), 0, MESSAGE_PRIORITY_SECRET); - } -} - -void CSecretMgr::Draw(void) -{ - char pBuffer[40]; - viewDrawText(1, FStringf("%s:", GStrings("TXT_SECRETS")), 75, 70, -128, 0, 0, 1); - sprintf(pBuffer, "%2d", at4); - viewDrawText(1, pBuffer, 160, 70, -128, 0, 0, 1); - viewDrawText(1, GStrings("OF"), 190, 70, -128, 0, 0, 1); - sprintf(pBuffer, "%2d", at0); - viewDrawText(1, pBuffer, 220, 70, -128, 0, 0, 1); - if (at8 > 0) - viewDrawText(1, GStrings("TXT_SUPERSECRET"), 160, 100, -128, 2, 1, 1); + if (gGameOptions.nGameType == 0) { + viewSetMessage(GStrings(FStringf("TXTB_SECRET%d", Random(2))), 0, MESSAGE_PRIORITY_SECRET); + } } void CSecretMgr::Clear(void) { - at0 = at4 = at8 = 0; + Total = Founds = Super = 0; } class EndGameLoadSave : public LoadSave { public: - virtual void Load(void); - virtual void Save(void); + virtual void Load(void); + virtual void Save(void); }; void EndGameLoadSave::Load(void) { - Read(&gSecretMgr.at0, 4); - Read(&gSecretMgr.at4, 4); - Read(&gSecretMgr.at8, 4); - Read(&gKillMgr.at0, 4); - Read(&gKillMgr.at4, 4); + Read(&gSecretMgr.Total, 4); + Read(&gSecretMgr.Founds, 4); + Read(&gSecretMgr.Super, 4); + Read(&gKillMgr.TotalKills, 4); + Read(&gKillMgr.Kills, 4); } void EndGameLoadSave::Save(void) { - Write(&gSecretMgr.at0, 4); - Write(&gSecretMgr.at4, 4); - Write(&gSecretMgr.at8, 4); - Write(&gKillMgr.at0, 4); - Write(&gKillMgr.at4, 4); + Write(&gSecretMgr.Total, 4); + Write(&gSecretMgr.Founds, 4); + Write(&gSecretMgr.Super, 4); + Write(&gKillMgr.TotalKills, 4); + Write(&gKillMgr.Kills, 4); } -CEndGameMgr gEndGameMgr; CSecretMgr gSecretMgr; CKillMgr gKillMgr; -static EndGameLoadSave *myLoadSave; +static EndGameLoadSave* myLoadSave; void EndGameLoadSaveConstruct(void) { - myLoadSave = new EndGameLoadSave(); + myLoadSave = new EndGameLoadSave(); } class DBloodLoadScreen : public DScreenJob { - std::function callback; - const char *pzLoadingScreenText1; - MapRecord* rec; + std::function callback; + const char* pzLoadingScreenText1; + MapRecord* rec; public: - DBloodLoadScreen(const char* caption, MapRecord* maprec, std::function callback_) : DScreenJob(fadein | fadeout), callback(callback_), rec(maprec) - { - if (gGameOptions.nGameType == 0) pzLoadingScreenText1 = GStrings("TXTB_LLEVEL"); - else pzLoadingScreenText1 = GStrings(FStringf("TXTB_NETGT%d", gGameOptions.nGameType)); - } + DBloodLoadScreen(const char* caption, MapRecord* maprec, std::function callback_) : DScreenJob(fadein | fadeout), callback(callback_), rec(maprec) + { + if (gGameOptions.nGameType == 0) pzLoadingScreenText1 = GStrings("TXTB_LLEVEL"); + else pzLoadingScreenText1 = GStrings(FStringf("TXTB_NETGT%d", gGameOptions.nGameType)); + } - int Frame(uint64_t clock, bool skiprequest) - { - twod->ClearScreen(); - drawTextScreenBackground(); - DrawMenuCaption(pzLoadingScreenText1); - viewDrawText(1, rec->DisplayName(), 160, 50, -128, 0, 1, 1); - viewDrawText(3, GStrings("TXTB_PLSWAIT"), 160, 134, -128, 0, 1, 1); + int Frame(uint64_t clock, bool skiprequest) + { + twod->ClearScreen(); + drawTextScreenBackground(); + DrawMenuCaption(pzLoadingScreenText1); + viewDrawText(1, rec->DisplayName(), 160, 50, -128, 0, 1, 1); + viewDrawText(3, GStrings("TXTB_PLSWAIT"), 160, 134, -128, 0, 1, 1); - // Initiate the level load once the page has been faded in completely. - if (callback && GetFadeState() == visible) - { - callback(); - callback = nullptr; - } - if (clock > 5'000'000'000) return 0; // make sure the screen stays long enough to be seen. - return skiprequest ? -1 : 1; - } + // Initiate the level load once the page has been faded in completely. + if (callback && GetFadeState() == visible) + { + callback(); + callback = nullptr; + } + if (clock > 5'000'000'000) return 0; // make sure the screen stays long enough to be seen. + return skiprequest ? -1 : 1; + } }; END_BLD_NS diff --git a/source/blood/src/endgame.h b/source/blood/src/endgame.h index 423fa3c4b..afbea6ce3 100644 --- a/source/blood/src/endgame.h +++ b/source/blood/src/endgame.h @@ -26,41 +26,29 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_BLD_NS -class CEndGameMgr { -public: - char at0; - char at1; - CEndGameMgr(); - void Setup(void); - void ProcessKeys(void); - void Draw(void); - void Finish(void); -}; - class CKillMgr { public: - int at0, at4; + int TotalKills, Kills; CKillMgr(); void SetCount(int); - void sub_263E0(int); + void AddNewKill(int); void AddKill(spritetype *pSprite); - void sub_2641C(void); + void CountTotalKills(void); void Clear(void); - void Draw(void); }; class CSecretMgr { public: - int at0, at4, at8; + int Total, Founds, Super; CSecretMgr(); void SetCount(int); void Found(int); void Clear(void); - void Draw(void); }; -extern CEndGameMgr gEndGameMgr; extern CSecretMgr gSecretMgr; extern CKillMgr gKillMgr; +void ShowSummaryScreen(); + END_BLD_NS diff --git a/source/blood/src/fx.cpp b/source/blood/src/fx.cpp index b890d9fbf..813b6d41e 100644 --- a/source/blood/src/fx.cpp +++ b/source/blood/src/fx.cpp @@ -46,7 +46,7 @@ struct FXDATA { CALLBACK_ID funcID; // callback char at1; // detail short at2; // seq - short at4; // flags + short Kills; // flags int at6; // gravity int ata; // air drag int ate; @@ -186,9 +186,9 @@ spritetype * CFX::fxSpawn(FX_ID nFx, int nSector, int x, int y, int z, unsigned pSprite->xrepeat = pFX->at14; if (pFX->at15 > 0) pSprite->yrepeat = pFX->at15; - if ((pFX->at4 & 1) && Chance(0x8000)) + if ((pFX->Kills & 1) && Chance(0x8000)) pSprite->cstat |= 4; - if ((pFX->at4 & 2) && Chance(0x8000)) + if ((pFX->Kills & 2) && Chance(0x8000)) pSprite->cstat |= 8; if (pFX->at2) { diff --git a/source/blood/src/gib.cpp b/source/blood/src/gib.cpp index 38ba0f0f6..2455f9336 100644 --- a/source/blood/src/gib.cpp +++ b/source/blood/src/gib.cpp @@ -42,7 +42,7 @@ BEGIN_BLD_NS struct GIBFX { - FX_ID at0; + FX_ID TotalKills; int at1; int chance; int at9; @@ -53,8 +53,8 @@ struct GIBFX struct GIBTHING { - int at0; - int at4; + int TotalKills; + int Kills; int chance; int atc; int at10; @@ -62,8 +62,8 @@ struct GIBTHING struct GIBLIST { - GIBFX *at0; - int at4; + GIBFX *TotalKills; + int Kills; GIBTHING *at8; int atc; int at10; @@ -295,7 +295,7 @@ int ChanceToCount(int a1, int a2) void GibFX(spritetype *pSprite, GIBFX *pGFX, CGibPosition *pPos, CGibVelocity *pVel) { int nSector = pSprite->sectnum; - if (adult_lockout && gGameOptions.nGameType == 0 && pGFX->at0 == FX_13) + if (adult_lockout && gGameOptions.nGameType == 0 && pGFX->TotalKills == FX_13) return; CGibPosition gPos(pSprite->x, pSprite->y, pSprite->z); if (pPos) @@ -316,7 +316,7 @@ void GibFX(spritetype *pSprite, GIBFX *pGFX, CGibPosition *pPos, CGibVelocity *p gPos.y = pSprite->y+mulscale30(pSprite->clipdist<<2, Sin(nAngle)); gPos.z = bottom-Random(bottom-top); } - spritetype *pFX = gFX.fxSpawn(pGFX->at0, nSector, gPos.x, gPos.y, gPos.z, 0); + spritetype *pFX = gFX.fxSpawn(pGFX->TotalKills, nSector, gPos.x, gPos.y, gPos.z, 0); if (pFX) { if (pGFX->at1 < 0) @@ -362,7 +362,7 @@ void GibFX(spritetype *pSprite, GIBFX *pGFX, CGibPosition *pPos, CGibVelocity *p void GibThing(spritetype *pSprite, GIBTHING *pGThing, CGibPosition *pPos, CGibVelocity *pVel) { if (adult_lockout && gGameOptions.nGameType <= 0) - switch (pGThing->at0) { + switch (pGThing->TotalKills) { case kThingBloodBits: case kThingZombieHead: return; @@ -391,10 +391,10 @@ void GibThing(spritetype *pSprite, GIBTHING *pGThing, CGibPosition *pPos, CGibVe getzsofslope(nSector, x, y, &ceilZ, &floorZ); int dz1 = floorZ-z; int dz2 = z-ceilZ; - spritetype *pGib = actSpawnThing(nSector, x, y, z, pGThing->at0); + spritetype *pGib = actSpawnThing(nSector, x, y, z, pGThing->TotalKills); dassert(pGib != NULL); - if (pGThing->at4 > -1) - pGib->picnum = pGThing->at4; + if (pGThing->Kills > -1) + pGib->picnum = pGThing->Kills; if (pVel) { xvel[pGib->index] = pVel->vx+Random2(pGThing->atc); @@ -436,9 +436,9 @@ void GibSprite(spritetype *pSprite, GIBTYPE nGibType, CGibPosition *pPos, CGibVe if (pSprite->sectnum < 0 || pSprite->sectnum >= numsectors) return; GIBLIST *pGib = &gibList[nGibType]; - for (int i = 0; i < pGib->at4; i++) + for (int i = 0; i < pGib->Kills; i++) { - GIBFX *pGibFX = &pGib->at0[i]; + GIBFX *pGibFX = &pGib->TotalKills[i]; dassert(pGibFX->chance > 0); GibFX(pSprite, pGibFX, pPos, pVel); } @@ -461,7 +461,7 @@ void GibFX(int nWall, GIBFX * pGFX, int a3, int a4, int a5, int a6, CGibVelocity int r1 = Random(a6); int r2 = Random(a5); int r3 = Random(a4); - spritetype *pGib = gFX.fxSpawn(pGFX->at0, nSector, pWall->x+r3, pWall->y+r2, a3+r1, 0); + spritetype *pGib = gFX.fxSpawn(pGFX->TotalKills, nSector, pWall->x+r3, pWall->y+r2, a3+r1, 0); if (pGib) { if (pGFX->at1 < 0) @@ -503,9 +503,9 @@ void GibWall(int nWall, GIBTYPE nGibType, CGibVelocity *pVel) cz = (ceilZ+floorZ)>>1; GIBLIST *pGib = &gibList[nGibType]; sfxPlay3DSound(cx, cy, cz, pGib->at10, nSector); - for (int i = 0; i < pGib->at4; i++) + for (int i = 0; i < pGib->Kills; i++) { - GIBFX *pGibFX = &pGib->at0[i]; + GIBFX *pGibFX = &pGib->TotalKills[i]; dassert(pGibFX->chance > 0); GibFX(nWall, pGibFX, ceilZ, wx, wy, wz, pVel); } @@ -520,8 +520,8 @@ void gibPrecache(void) { for (int j = 0; j < gibList[i].atc; j++) { - if (pThing[j].at4 >= 0) - tilePrecacheTile(pThing[j].at4); + if (pThing[j].Kills >= 0) + tilePrecacheTile(pThing[j].Kills); } } } diff --git a/source/blood/src/mirrors.cpp b/source/blood/src/mirrors.cpp index 4b3128d32..47c2a5e4a 100644 --- a/source/blood/src/mirrors.cpp +++ b/source/blood/src/mirrors.cpp @@ -38,8 +38,8 @@ int mirrorcnt, mirrorsector, mirrorwall[4]; typedef struct { - int at0; - int at4; + int TotalKills; + int Kills; int at8; int atc; int at10; @@ -71,7 +71,7 @@ void InitMirrors(void) { wall[i].overpicnum = nTile; mirror[mirrorcnt].at14 = i; - mirror[mirrorcnt].at0 = 0; + mirror[mirrorcnt].TotalKills = 0; wall[i].cstat |= 32; int tmp = xwall[wall[i].extra].data; int j; @@ -85,7 +85,7 @@ void InitMirrors(void) continue; wall[i].hitag = j; wall[j].hitag = i; - mirror[mirrorcnt].at4 = j; + mirror[mirrorcnt].Kills = j; break; } } @@ -97,10 +97,10 @@ void InitMirrors(void) } if (wall[i].picnum == 504) { - mirror[mirrorcnt].at4 = i; + mirror[mirrorcnt].Kills = i; mirror[mirrorcnt].at14 = i; wall[i].picnum = nTile; - mirror[mirrorcnt].at0 = 0; + mirror[mirrorcnt].TotalKills = 0; wall[i].cstat |= 32; mirrorcnt++; continue; @@ -120,20 +120,20 @@ void InitMirrors(void) int j = sprite[nLink2].sectnum; if (sector[j].ceilingpicnum != 504) ThrowError("Lower link sector %d doesn't have mirror picnum\n", j); - mirror[mirrorcnt].at0 = 2; + mirror[mirrorcnt].TotalKills = 2; mirror[mirrorcnt].at8 = sprite[nLink2].x-sprite[nLink].x; mirror[mirrorcnt].atc = sprite[nLink2].y-sprite[nLink].y; mirror[mirrorcnt].at10 = sprite[nLink2].z-sprite[nLink].z; mirror[mirrorcnt].at14 = i; - mirror[mirrorcnt].at4 = j; + mirror[mirrorcnt].Kills = j; sector[i].floorpicnum = 4080+mirrorcnt; mirrorcnt++; - mirror[mirrorcnt].at0 = 1; + mirror[mirrorcnt].TotalKills = 1; mirror[mirrorcnt].at8 = sprite[nLink].x-sprite[nLink2].x; mirror[mirrorcnt].atc = sprite[nLink].y-sprite[nLink2].y; mirror[mirrorcnt].at10 = sprite[nLink].z-sprite[nLink2].z; mirror[mirrorcnt].at14 = j; - mirror[mirrorcnt].at4 = i; + mirror[mirrorcnt].Kills = i; sector[j].ceilingpicnum = 4080+mirrorcnt; mirrorcnt++; } @@ -167,7 +167,7 @@ void sub_5571C(char mode) int nTile = 4080+i; if (TestBitString(gotpic, nTile)) { - switch (mirror[i].at0) + switch (mirror[i].TotalKills) { case 1: if (mode) @@ -200,9 +200,9 @@ void sub_557C4(int x, int y, int interpolation) int nTile = 4080+i; if (TestBitString(gotpic, nTile)) { - if (mirror[i].at0 == 1 || mirror[i].at0 == 2) + if (mirror[i].TotalKills == 1 || mirror[i].TotalKills == 2) { - int nSector = mirror[i].at4; + int nSector = mirror[i].Kills; int nSector2 = mirror[i].at14; for (int nSprite = headspritesect[nSector]; nSprite >= 0; nSprite = nextspritesect[nSprite]) { @@ -216,7 +216,7 @@ void sub_557C4(int x, int y, int interpolation) if (pSprite->statnum == kStatDude && (top < zCeil || bottom > zFloor)) { int j = i; - if (mirror[i].at0 == 2) + if (mirror[i].TotalKills == 2) j++; else j--; @@ -305,11 +305,11 @@ void DrawMirrors(int x, int y, int z, fixed_t a, fixed_t horiz, int smooth, int if (TestBitString(gotpic, nTile)) { ClearBitString(gotpic, nTile); - switch (mirror[i].at0) + switch (mirror[i].TotalKills) { case 0: { - int nWall = mirror[i].at4; + int nWall = mirror[i].Kills; int nSector = sectorofwall(nWall); walltype *pWall = &wall[nWall]; int nNextWall = pWall->nextwall; @@ -352,7 +352,7 @@ void DrawMirrors(int x, int y, int z, fixed_t a, fixed_t horiz, int smooth, int } case 1: { - int nSector = mirror[i].at4; + int nSector = mirror[i].Kills; int bakCstat; if (viewPlayer >= 0) { @@ -382,7 +382,7 @@ void DrawMirrors(int x, int y, int z, fixed_t a, fixed_t horiz, int smooth, int } case 2: { - int nSector = mirror[i].at4; + int nSector = mirror[i].Kills; int bakCstat; if (viewPlayer >= 0) { diff --git a/source/blood/src/nnexts.cpp b/source/blood/src/nnexts.cpp index 38f8853bb..cd3021563 100644 --- a/source/blood/src/nnexts.cpp +++ b/source/blood/src/nnexts.cpp @@ -3676,7 +3676,7 @@ bool modernTypeOperateSprite(int nSprite, spritetype* pSprite, XSPRITE* pXSprite return false; // go normal OperateSprite(); XSPRITE* pXSpawn = &xsprite[pSpawn->extra]; - gKillMgr.sub_263E0(1); + gKillMgr.AddNewKill(1); switch (pXSprite->data1) { case kDudeBurningInnocent: case kDudeBurningCultist: @@ -3739,7 +3739,7 @@ bool modernTypeOperateSprite(int nSprite, spritetype* pSprite, XSPRITE* pXSprite modernTypeSetSpriteState(nSprite, pXSprite, pXSprite->state ^ 1); return true; case kModernCustomDudeSpawn: - if (gGameOptions.nMonsterSettings && genDudeSpawn(pSprite, -1) != NULL) gKillMgr.sub_263E0(1); + if (gGameOptions.nMonsterSettings && genDudeSpawn(pSprite, -1) != NULL) gKillMgr.AddNewKill(1); return true; case kModernSeqSpawner: case kModernEffectSpawner: diff --git a/source/blood/src/player.cpp b/source/blood/src/player.cpp index 381f9a149..55b9ecfb7 100644 --- a/source/blood/src/player.cpp +++ b/source/blood/src/player.cpp @@ -167,8 +167,8 @@ AMMOINFO gAmmoInfo[] = { }; struct ARMORDATA { - int at0; - int at4; + int TotalKills; + int Kills; int at8; int atc; int at10; @@ -189,8 +189,8 @@ int nPlayerSurviveClient = seqRegisterClient(PlayerSurvive); int nPlayerKneelClient = seqRegisterClient(PlayerKneelsOver); struct VICTORY { - const char *at0; - int at4; + const char *TotalKills; + int Kills; }; VICTORY gVictory[] = { @@ -222,8 +222,8 @@ VICTORY gVictory[] = { }; struct SUICIDE { - const char *at0; - int at4; + const char *TotalKills; + int Kills; }; SUICIDE gSuicide[] = { @@ -235,8 +235,8 @@ SUICIDE gSuicide[] = { }; struct DAMAGEINFO { - int at0; - int at4[3]; + int TotalKills; + int Kills[3]; int at10[3]; }; @@ -1037,8 +1037,8 @@ char PickupItem(PLAYER *pPlayer, spritetype *pItem) { pickedUp = true; } - if (pPlayer->armor[0] < pArmorData->at4) { - pPlayer->armor[0] = ClipHigh(pPlayer->armor[0]+pArmorData->at0, pArmorData->at4); + if (pPlayer->armor[0] < pArmorData->Kills) { + pPlayer->armor[0] = ClipHigh(pPlayer->armor[0]+pArmorData->TotalKills, pArmorData->Kills); pickedUp = true; } @@ -1860,7 +1860,7 @@ void playerFrag(PLAYER *pKiller, PLAYER *pVictim) if (gGameOptions.nGameType == 3) dword_21EFB0[pVictim->teamId]--; int nMessage = Random(5); - int nSound = gSuicide[nMessage].at4; + int nSound = gSuicide[nMessage].Kills; if (pVictim == gMe && gMe->handTime <= 0) { strcpy(buffer, GStrings("TXTB_KILLSELF")); @@ -1869,7 +1869,7 @@ void playerFrag(PLAYER *pKiller, PLAYER *pVictim) } else { - sprintf(buffer, gSuicide[nMessage].at0, gProfile[nVictim].name); + sprintf(buffer, gSuicide[nMessage].TotalKills, gProfile[nVictim].name); } } else @@ -1890,8 +1890,8 @@ void playerFrag(PLAYER *pKiller, PLAYER *pVictim) } } int nMessage = Random(25); - int nSound = gVictory[nMessage].at4; - const char* pzMessage = gVictory[nMessage].at0; + int nSound = gVictory[nMessage].Kills; + const char* pzMessage = gVictory[nMessage].TotalKills; sprintf(buffer, pzMessage, gProfile[nKiller].name, gProfile[nVictim].name); if (gGameOptions.nGameType > 0 && nSound >= 0 && pKiller == gMe) sndStartSample(nSound, 255, 2, 0); @@ -1930,7 +1930,7 @@ void FragPlayer(PLAYER *pPlayer, int nSprite) int playerDamageArmor(PLAYER *pPlayer, DAMAGE_TYPE nType, int nDamage) { DAMAGEINFO *pDamageInfo = &damageInfo[nType]; - int nArmorType = pDamageInfo->at0; + int nArmorType = pDamageInfo->TotalKills; if (nArmorType >= 0 && pPlayer->armor[nArmorType]) { #if 0 @@ -2043,9 +2043,9 @@ int playerDamageSprite(int nSource, PLAYER *pPlayer, DAMAGE_TYPE nDamageType, in DAMAGEINFO *pDamageInfo = &damageInfo[nDamageType]; int nSound; if (nDamage >= (10<<4)) - nSound = pDamageInfo->at4[0]; + nSound = pDamageInfo->Kills[0]; else - nSound = pDamageInfo->at4[Random(3)]; + nSound = pDamageInfo->Kills[Random(3)]; if (nDamageType == DAMAGE_TYPE_4 && pXSprite->medium == kMediumWater && !pPlayer->hand) nSound = 714; sfxPlay3DSound(pSprite, nSound, 0, 6); diff --git a/source/blood/src/pqueue.h b/source/blood/src/pqueue.h index 93abe5be2..642d0f4ca 100644 --- a/source/blood/src/pqueue.h +++ b/source/blood/src/pqueue.h @@ -31,31 +31,31 @@ BEGIN_BLD_NS template struct queueItem { - uint32_t at0; // priority - T at4; // data + uint32_t TotalKills; // priority + T Kills; // data bool operator>(const queueItem& other) const { - return at0 > other.at0; + return TotalKills > other.TotalKills; } bool operator<(const queueItem& other) const { - return at0 < other.at0; + return TotalKills < other.TotalKills; } bool operator>=(const queueItem& other) const { - return at0 >= other.at0; + return TotalKills >= other.TotalKills; } bool operator<=(const queueItem& other) const { - return at0 <= other.at0; + return TotalKills <= other.TotalKills; } bool operator!=(const queueItem& other) const { - return at0 != other.at0; + return TotalKills != other.TotalKills; } bool operator==(const queueItem& other) const { - return at0 == other.at0; + return TotalKills == other.TotalKills; } }; @@ -86,7 +86,7 @@ public: void Upheap(void) { queueItem item = queueItems[fNodeCount]; - queueItems[0].at0 = 0; + queueItems[0].TotalKills = 0; uint32_t x = fNodeCount; while (queueItems[x>>1] > item) { @@ -120,13 +120,13 @@ public: { dassert(fNodeCount < kPQueueSize); fNodeCount++; - queueItems[fNodeCount].at0 = a1; - queueItems[fNodeCount].at4 = a2; + queueItems[fNodeCount].TotalKills = a1; + queueItems[fNodeCount].Kills = a2; Upheap(); } T Remove(void) { - T data = queueItems[1].at4; + T data = queueItems[1].Kills; queueItems[1] = queueItems[fNodeCount--]; Downheap(1); return data; @@ -134,13 +134,13 @@ public: uint32_t LowestPriority(void) { dassert(fNodeCount > 0); - return queueItems[1].at0; + return queueItems[1].TotalKills; } void Kill(std::function pMatch) { for (unsigned int i = 1; i <= fNodeCount;) { - if (pMatch(queueItems[i].at4)) + if (pMatch(queueItems[i].Kills)) Delete(i); else i++; @@ -168,19 +168,19 @@ public: T Remove(void) { dassert(stdQueue.size() > 0); - T data = stdQueue.begin()->at4; + T data = stdQueue.begin()->Kills; stdQueue.erase(stdQueue.begin()); return data; } uint32_t LowestPriority(void) { - return stdQueue.begin()->at0; + return stdQueue.begin()->TotalKills; } void Kill(std::function pMatch) { for (auto i = stdQueue.begin(); i != stdQueue.end();) { - if (pMatch(i->at4)) + if (pMatch(i->Kills)) i = stdQueue.erase(i); else i++; diff --git a/source/blood/src/prediction.cpp b/source/blood/src/prediction.cpp index 8fba02b84..3c5e8238d 100644 --- a/source/blood/src/prediction.cpp +++ b/source/blood/src/prediction.cpp @@ -80,8 +80,8 @@ void viewInitializePrediction(void) predict.at4c = gMe->spin; predict.at6e = !!(gMe->input.actions & SB_CENTERVIEW); memcpy(&predict.at75,&gSpriteHit[gMe->pSprite->extra],sizeof(SPRITEHIT)); - predict.at0 = gMe->bobPhase; - predict.at4 = gMe->bobAmp; + predict.TotalKills = gMe->bobPhase; + predict.Kills = gMe->bobAmp; predict.at8 = gMe->bobHeight; predict.atc = gMe->bobWidth; predict.at10 = gMe->swayPhase; @@ -367,39 +367,39 @@ void fakePlayerProcess(PLAYER *pPlayer, InputPacket *pInput) predict.at34 = predict.at40 - predict.at38 - (12<<8); - predict.at0 = ClipLow(predict.at0-4, 0); + predict.TotalKills = ClipLow(predict.TotalKills-4, 0); nSpeed >>= FRACBITS; if (predict.at48 == 1) { - predict.at4 = (predict.at4+17)&2047; + predict.Kills = (predict.Kills+17)&2047; predict.at14 = (predict.at14+17)&2047; - predict.at8 = mulscale30(10*pPosture->bobV,Sin(predict.at4*2)); - predict.atc = mulscale30(predict.at0*pPosture->bobH,Sin(predict.at4-256)); - predict.at18 = mulscale30(predict.at0*pPosture->swayV,Sin(predict.at14*2)); - predict.at1c = mulscale30(predict.at0*pPosture->swayH,Sin(predict.at14-0x155)); + predict.at8 = mulscale30(10*pPosture->bobV,Sin(predict.Kills*2)); + predict.atc = mulscale30(predict.TotalKills*pPosture->bobH,Sin(predict.Kills-256)); + predict.at18 = mulscale30(predict.TotalKills*pPosture->swayV,Sin(predict.at14*2)); + predict.at1c = mulscale30(predict.TotalKills*pPosture->swayH,Sin(predict.at14-0x155)); } else { if (pXSprite->height < 256) { - predict.at4 = (predict.at4+(pPosture->pace[predict.at70]*4))&2047; + predict.Kills = (predict.Kills+(pPosture->pace[predict.at70]*4))&2047; predict.at14 = (predict.at14+(pPosture->pace[predict.at70]*4)/2)&2047; if (predict.at70) { - if (predict.at0 < 60) - predict.at0 = ClipHigh(predict.at0 + nSpeed, 60); + if (predict.TotalKills < 60) + predict.TotalKills = ClipHigh(predict.TotalKills + nSpeed, 60); } else { - if (predict.at0 < 30) - predict.at0 = ClipHigh(predict.at0 + nSpeed, 30); + if (predict.TotalKills < 30) + predict.TotalKills = ClipHigh(predict.TotalKills + nSpeed, 30); } } - predict.at8 = mulscale30(predict.at0*pPosture->bobV,Sin(predict.at4*2)); - predict.atc = mulscale30(predict.at0*pPosture->bobH,Sin(predict.at4-256)); - predict.at18 = mulscale30(predict.at0*pPosture->swayV,Sin(predict.at14*2)); - predict.at1c = mulscale30(predict.at0*pPosture->swayH,Sin(predict.at14-0x155)); + predict.at8 = mulscale30(predict.TotalKills*pPosture->bobV,Sin(predict.Kills*2)); + predict.atc = mulscale30(predict.TotalKills*pPosture->bobH,Sin(predict.Kills-256)); + predict.at18 = mulscale30(predict.TotalKills*pPosture->swayV,Sin(predict.at14*2)); + predict.at1c = mulscale30(predict.TotalKills*pPosture->swayH,Sin(predict.at14-0x155)); } if (!pXSprite->health) return; diff --git a/source/blood/src/sbar.cpp b/source/blood/src/sbar.cpp index a9a3fb470..edec8d90e 100644 --- a/source/blood/src/sbar.cpp +++ b/source/blood/src/sbar.cpp @@ -238,11 +238,11 @@ private: { stats.completeColor = CR_DARKGREEN; - stats.kills = gKillMgr.at4; - stats.maxkills = gKillMgr.at0; + stats.kills = gKillMgr.Kills; + stats.maxkills = gKillMgr.TotalKills; stats.frags = gGameOptions.nGameType == 3? pPlayer->fragCount : -1; - stats.secrets = gSecretMgr.at4 + gSecretMgr.at8; - stats.maxsecrets = gSecretMgr.at0; + stats.secrets = gSecretMgr.Founds + gSecretMgr.Super; + stats.maxsecrets = gSecretMgr.Total; DBaseStatusBar::PrintLevelStats(stats); } diff --git a/source/blood/src/sound.cpp b/source/blood/src/sound.cpp index e7fdb1037..9a686e363 100644 --- a/source/blood/src/sound.cpp +++ b/source/blood/src/sound.cpp @@ -141,7 +141,7 @@ int sndGetRate(int format) void SoundCallback(intptr_t val) { SAMPLE2D *pChannel = (SAMPLE2D*)val; - pChannel->at0 = 0; + pChannel->TotalKills = 0; } void sndStartSample(const char *pzSound, int nVolume, int nChannel) diff --git a/source/blood/src/sound.h b/source/blood/src/sound.h index c512ccd16..e82632207 100644 --- a/source/blood/src/sound.h +++ b/source/blood/src/sound.h @@ -29,8 +29,8 @@ BEGIN_BLD_NS struct SAMPLE2D { - int at0; - char at4; + int TotalKills; + char Kills; }; // 9 bytes struct SFX diff --git a/source/blood/src/triggers.cpp b/source/blood/src/triggers.cpp index 59dc6cb74..734e7ef47 100644 --- a/source/blood/src/triggers.cpp +++ b/source/blood/src/triggers.cpp @@ -176,8 +176,8 @@ enum BUSYID { }; struct BUSY { - int at0; - int at4; + int TotalKills; + int Kills; int at8; BUSYID atc; }; @@ -190,19 +190,19 @@ void AddBusy(int a1, BUSYID a2, int nDelta) int i; for (i = 0; i < gBusyCount; i++) { - if (gBusy[i].at0 == a1 && gBusy[i].atc == a2) + if (gBusy[i].TotalKills == a1 && gBusy[i].atc == a2) break; } if (i == gBusyCount) { if (gBusyCount == 128) return; - gBusy[i].at0 = a1; + gBusy[i].TotalKills = a1; gBusy[i].atc = a2; gBusy[i].at8 = nDelta > 0 ? 0 : 65536; gBusyCount++; } - gBusy[i].at4 = nDelta; + gBusy[i].Kills = nDelta; } void ReverseBusy(int a1, BUSYID a2) @@ -210,9 +210,9 @@ void ReverseBusy(int a1, BUSYID a2) int i; for (i = 0; i < gBusyCount; i++) { - if (gBusy[i].at0 == a1 && gBusy[i].atc == a2) + if (gBusy[i].TotalKills == a1 && gBusy[i].atc == a2) { - gBusy[i].at4 = -gBusy[i].at4; + gBusy[i].Kills = -gBusy[i].Kills; break; } } @@ -507,7 +507,7 @@ void OperateSprite(int nSprite, XSPRITE *pXSprite, EVENT event) spritetype* pSpawn = actSpawnDude(pSprite, pXSprite->data1, -1, 0); if (pSpawn) { XSPRITE *pXSpawn = &xsprite[pSpawn->extra]; - gKillMgr.sub_263E0(1); + gKillMgr.AddNewKill(1); switch (pXSprite->data1) { case kDudeBurningInnocent: case kDudeBurningCultist: @@ -1981,15 +1981,15 @@ void trProcessBusy(void) for (int i = gBusyCount-1; i >= 0; i--) { int oldBusy = gBusy[i].at8; - gBusy[i].at8 = ClipRange(oldBusy+gBusy[i].at4*4, 0, 65536); - int nStatus = gBusyProc[gBusy[i].atc](gBusy[i].at0, gBusy[i].at8); + gBusy[i].at8 = ClipRange(oldBusy+gBusy[i].Kills*4, 0, 65536); + int nStatus = gBusyProc[gBusy[i].atc](gBusy[i].TotalKills, gBusy[i].at8); switch (nStatus) { case 1: gBusy[i].at8 = oldBusy; break; case 2: gBusy[i].at8 = oldBusy; - gBusy[i].at4 = -gBusy[i].at4; + gBusy[i].Kills = -gBusy[i].Kills; break; case 3: gBusy[i] = gBusy[--gBusyCount]; diff --git a/source/blood/src/view.cpp b/source/blood/src/view.cpp index db902fd59..b88ade352 100644 --- a/source/blood/src/view.cpp +++ b/source/blood/src/view.cpp @@ -224,7 +224,7 @@ void InitStatusBar(void) } GameStats GameInterface::getStats() { - return { gKillMgr.at4, gKillMgr.at0, gSecretMgr.at4, gSecretMgr.at0, gLevelTime / kTicsPerSec, gPlayer[myconnectindex].fragCount }; + return { gKillMgr.Kills, gKillMgr.TotalKills, gSecretMgr.Founds, gSecretMgr.Total, gLevelTime / kTicsPerSec, gPlayer[myconnectindex].fragCount }; } void viewDrawMapTitle(void) diff --git a/source/blood/src/view.h b/source/blood/src/view.h index b6e042c13..416cc88fa 100644 --- a/source/blood/src/view.h +++ b/source/blood/src/view.h @@ -32,8 +32,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_BLD_NS struct VIEW { - int at0; - int at4; + int TotalKills; + int Kills; int at8; // bob height int atc; // bob width int at10; diff --git a/source/blood/src/weapon.cpp b/source/blood/src/weapon.cpp index 02f79793f..5966ce435 100644 --- a/source/blood/src/weapon.cpp +++ b/source/blood/src/weapon.cpp @@ -280,8 +280,8 @@ void StartQAV(PLAYER *pPlayer, int nWeaponQAV, int a3, char a4) struct WEAPONTRACK { - int at0; // x aim speed - int at4; // y aim speed + int TotalKills; // x aim speed + int Kills; // y aim speed int at8; // angle range int atc; int at10; // predict @@ -433,9 +433,9 @@ void UpdateAimVector(PLAYER * pPlayer) aim2 = aim; RotateVector((int*)&aim2.dx, (int*)&aim2.dy, -pPSprite->ang); aim2.dz -= pPlayer->slope; - pPlayer->relAim.dx = interpolate(pPlayer->relAim.dx, aim2.dx, pWeaponTrack->at0); - pPlayer->relAim.dy = interpolate(pPlayer->relAim.dy, aim2.dy, pWeaponTrack->at0); - pPlayer->relAim.dz = interpolate(pPlayer->relAim.dz, aim2.dz, pWeaponTrack->at4); + pPlayer->relAim.dx = interpolate(pPlayer->relAim.dx, aim2.dx, pWeaponTrack->TotalKills); + pPlayer->relAim.dy = interpolate(pPlayer->relAim.dy, aim2.dy, pWeaponTrack->TotalKills); + pPlayer->relAim.dz = interpolate(pPlayer->relAim.dz, aim2.dz, pWeaponTrack->Kills); pPlayer->aim = pPlayer->relAim; RotateVector((int*)&pPlayer->aim.dx, (int*)&pPlayer->aim.dy, pPSprite->ang); pPlayer->aim.dz += pPlayer->slope; @@ -444,8 +444,8 @@ void UpdateAimVector(PLAYER * pPlayer) struct t_WeaponModes { - int at0; - int at4; + int TotalKills; + int Kills; }; t_WeaponModes weaponModes[] = { @@ -471,7 +471,7 @@ void WeaponRaise(PLAYER *pPlayer) int prevWeapon = pPlayer->curWeapon; pPlayer->curWeapon = pPlayer->newWeapon; pPlayer->newWeapon = 0; - pPlayer->weaponAmmo = weaponModes[pPlayer->curWeapon].at4; + pPlayer->weaponAmmo = weaponModes[pPlayer->curWeapon].Kills; switch (pPlayer->curWeapon) { case 1: // pitchfork @@ -1492,8 +1492,8 @@ void DropVoodoo(int nTrigger, PLAYER *pPlayer) struct TeslaMissile { - int at0; // offset - int at4; // id + int TotalKills; // offset + int Kills; // id int at8; // ammo use int atc; // sound int at10; // light @@ -1527,7 +1527,7 @@ void FireTesla(int nTrigger, PLAYER *pPlayer) return; } } - playerFireMissile(pPlayer, pMissile->at0, pPlayer->aim.dx, pPlayer->aim.dy, pPlayer->aim.dz, pMissile->at4); + playerFireMissile(pPlayer, pMissile->TotalKills, pPlayer->aim.dx, pPlayer->aim.dy, pPlayer->aim.dz, pMissile->Kills); UseAmmo(pPlayer, 7, pMissile->at8); sfxPlay3DSound(pSprite, pMissile->atc, 1, 0); pPlayer->visibility = pMissile->at10; @@ -1696,23 +1696,23 @@ char WeaponFindNext(PLAYER *pPlayer, int *a2, char bDir) weapon = OrderNext[weapon]; else weapon = OrderPrev[weapon]; - if (weaponModes[weapon].at0 && pPlayer->hasWeapon[weapon]) + if (weaponModes[weapon].TotalKills && pPlayer->hasWeapon[weapon]) { if (weapon == 9) { - if (CheckAmmo(pPlayer, weaponModes[weapon].at4, 1)) + if (CheckAmmo(pPlayer, weaponModes[weapon].Kills, 1)) break; } else { - if (sub_4B2C8(pPlayer, weaponModes[weapon].at4, 1)) + if (sub_4B2C8(pPlayer, weaponModes[weapon].Kills, 1)) break; } } } while (weapon != pPlayer->curWeapon); if (weapon == pPlayer->curWeapon) { - if (!weaponModes[weapon].at0 || !CheckAmmo(pPlayer, weaponModes[weapon].at4, 1)) + if (!weaponModes[weapon].TotalKills || !CheckAmmo(pPlayer, weaponModes[weapon].Kills, 1)) weapon = 1; } if (a2) @@ -1724,11 +1724,11 @@ char WeaponFindLoaded(PLAYER *pPlayer, int *a2) { char v4 = 1; int v14 = 0; - if (weaponModes[pPlayer->curWeapon].at0 > 1) + if (weaponModes[pPlayer->curWeapon].TotalKills > 1) { - for (int i = 0; i < weaponModes[pPlayer->curWeapon].at0; i++) + for (int i = 0; i < weaponModes[pPlayer->curWeapon].TotalKills; i++) { - if (CheckAmmo(pPlayer, weaponModes[pPlayer->curWeapon].at4, 1)) + if (CheckAmmo(pPlayer, weaponModes[pPlayer->curWeapon].Kills, 1)) { v14 = i; v4 = pPlayer->curWeapon; @@ -1744,9 +1744,9 @@ char WeaponFindLoaded(PLAYER *pPlayer, int *a2) int weapon = pPlayer->weaponOrder[vc][i]; if (pPlayer->hasWeapon[weapon]) { - for (int j = 0; j < weaponModes[weapon].at0; j++) + for (int j = 0; j < weaponModes[weapon].TotalKills; j++) { - if (sub_4B1FC(pPlayer, weapon, weaponModes[weapon].at4, 1)) + if (sub_4B1FC(pPlayer, weapon, weaponModes[weapon].Kills, 1)) { if (a2) *a2 = j; @@ -2149,10 +2149,10 @@ void WeaponProcess(PLAYER *pPlayer) { return; } int nWeapon = pPlayer->newWeapon; - int v4c = weaponModes[nWeapon].at0; + int v4c = weaponModes[nWeapon].TotalKills; if (!pPlayer->curWeapon) { - int nAmmoType = weaponModes[nWeapon].at4; + int nAmmoType = weaponModes[nWeapon].Kills; if (v4c > 1) { if (CheckAmmo(pPlayer, nAmmoType, 1) || nAmmoType == 11) @@ -2191,7 +2191,7 @@ void WeaponProcess(PLAYER *pPlayer) { for (; i <= v4c; i++) { int v6c = (pPlayer->weaponMode[nWeapon]+i)%v4c; - if (sub_4B1FC(pPlayer, nWeapon, weaponModes[nWeapon].at4, 1)) + if (sub_4B1FC(pPlayer, nWeapon, weaponModes[nWeapon].Kills, 1)) { WeaponLower(pPlayer); pPlayer->weaponMode[nWeapon] = v6c;