- 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
This commit is contained in:
Christoph Oelckers 2020-09-01 21:27:32 +02:00
parent fda74a47b4
commit 7747fc7fb0
33 changed files with 476 additions and 503 deletions

View file

@ -2362,7 +2362,7 @@ const int nDudeToGibClient2 = seqRegisterClient(DudeToGibCallback2);
int gPostCount = 0; int gPostCount = 0;
struct POSTPONE { struct POSTPONE {
short at0; short TotalKills;
short at2; short at2;
}; };
@ -2527,7 +2527,7 @@ void actInit(bool bSaveLoad) {
unk[pSprite->type - kDudeBase] = 1; unk[pSprite->type - kDudeBase] = 1;
} }
gKillMgr.sub_2641C(); gKillMgr.CountTotalKills();
/////////////// ///////////////
for (int i = 0; i < kDudeMax - kDudeBase; i++) for (int i = 0; i < kDudeMax - kDudeBase; i++)
@ -2935,7 +2935,7 @@ void actKillDude(int nKillerSprite, spritetype *pSprite, DAMAGE_TYPE damageType,
aiGenDudeNewState(pSprite, &genDudeBurnGoto); aiGenDudeNewState(pSprite, &genDudeBurnGoto);
actHealDude(pXSprite, dudeInfo[55].startHealth, dudeInfo[55].startHealth); actHealDude(pXSprite, dudeInfo[55].startHealth, dudeInfo[55].startHealth);
if (pXSprite->burnTime <= 0) pXSprite->burnTime = 1200; if (pXSprite->burnTime <= 0) pXSprite->burnTime = 1200;
gDudeExtra[pSprite->extra].at0 = gFrameClock + 360; gDudeExtra[pSprite->extra].TotalKills = gFrameClock + 360;
return; return;
} }
@ -3325,7 +3325,7 @@ void actKillDude(int nKillerSprite, spritetype *pSprite, DAMAGE_TYPE damageType,
case kDudeSpiderBrown: case kDudeSpiderBrown:
if (pSprite->owner != -1) { if (pSprite->owner != -1) {
spritetype *pOwner = &sprite[actSpriteOwnerToSpriteId(pSprite)]; 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); 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: case kDudeSpiderRed:
if (pSprite->owner != -1) { if (pSprite->owner != -1) {
spritetype *pOwner = &sprite[actSpriteOwnerToSpriteId(pSprite)]; 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); 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: case kDudeSpiderBlack:
if (pSprite->owner != -1) { if (pSprite->owner != -1) {
spritetype *pOwner = &sprite[actSpriteOwnerToSpriteId(pSprite)]; 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); 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) if (sprite[nSprite].flags&32)
{ {
for (n = 0; n < gPostCount; n++) for (n = 0; n < gPostCount; n++)
if (gPost[n].at0 == nSprite) if (gPost[n].TotalKills == nSprite)
break; break;
dassert(n < gPostCount); dassert(n < gPostCount);
} }
@ -6869,7 +6869,7 @@ void actPostSprite(int nSprite, int nStatus)
sprite[nSprite].flags |= 32; sprite[nSprite].flags |= 32;
gPostCount++; gPostCount++;
} }
gPost[n].at0 = nSprite; gPost[n].TotalKills = nSprite;
gPost[n].at2 = nStatus; gPost[n].at2 = nStatus;
} }
@ -6878,7 +6878,7 @@ void actPostProcess(void)
for (int i = 0; i < gPostCount; i++) for (int i = 0; i < gPostCount; i++)
{ {
POSTPONE *pPost = &gPost[i]; POSTPONE *pPost = &gPost[i];
int nSprite = pPost->at0; int nSprite = pPost->TotalKills;
spritetype *pSprite = &sprite[nSprite]; spritetype *pSprite = &sprite[nSprite];
pSprite->flags &= ~32; pSprite->flags &= ~32;
int nStatus = pPost->at2; int nStatus = pPost->at2;

View file

@ -75,12 +75,12 @@ void aiPlay3DSound(spritetype *pSprite, int a2, AI_SFX_PRIORITY a3, int a4)
DUDEEXTRA *pDudeExtra = &gDudeExtra[pSprite->extra]; DUDEEXTRA *pDudeExtra = &gDudeExtra[pSprite->extra];
if (a3 == AI_SFX_PRIORITY_0) if (a3 == AI_SFX_PRIORITY_0)
sfxPlay3DSound(pSprite, a2, a4, 2); 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); sfxKill3DSound(pSprite, -1, -1);
sfxPlay3DSound(pSprite, a2, a4, 0); sfxPlay3DSound(pSprite, a2, a4, 0);
pDudeExtra->at5 = a3; pDudeExtra->at5 = a3;
pDudeExtra->at0 = gFrameClock+120; pDudeExtra->TotalKills = gFrameClock+120;
} }
} }
@ -330,9 +330,9 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite)
case kDudePhantasm: case kDudePhantasm:
{ {
DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1; DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1;
pDudeExtraE->at4 = 0; pDudeExtraE->Kills = 0;
pDudeExtraE->at8 = 1; pDudeExtraE->at8 = 1;
pDudeExtraE->at0 = 0; pDudeExtraE->TotalKills = 0;
if (pXSprite->target == -1) if (pXSprite->target == -1)
aiNewState(pSprite, pXSprite, &ghostSearch); aiNewState(pSprite, pXSprite, &ghostSearch);
else else
@ -350,7 +350,7 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite)
{ {
DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1; DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1;
pDudeExtraE->at8 = 1; pDudeExtraE->at8 = 1;
pDudeExtraE->at0 = 0; pDudeExtraE->TotalKills = 0;
if (pXSprite->target == -1) { if (pXSprite->target == -1) {
switch (pXSprite->medium) { switch (pXSprite->medium) {
case kMediumNormal: case kMediumNormal:
@ -388,7 +388,7 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite)
{ {
DUDEEXTRA_at6_u1* pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1; DUDEEXTRA_at6_u1* pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1;
pDudeExtraE->at8 = 1; pDudeExtraE->at8 = 1;
pDudeExtraE->at0 = 0; pDudeExtraE->TotalKills = 0;
if (pXSprite->target == -1) { if (pXSprite->target == -1) {
if (spriteIsUnderwater(pSprite, false)) aiGenDudeNewState(pSprite, &genDudeSearchW); if (spriteIsUnderwater(pSprite, false)) aiGenDudeNewState(pSprite, &genDudeSearchW);
else aiGenDudeNewState(pSprite, &genDudeSearchL); else aiGenDudeNewState(pSprite, &genDudeSearchL);
@ -406,7 +406,7 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite)
#endif #endif
case kDudeCultistTommyProne: { case kDudeCultistTommyProne: {
DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1; DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1;
pDudeExtraE->at8 = 1; pDudeExtraE->at0 = 0; pDudeExtraE->at8 = 1; pDudeExtraE->TotalKills = 0;
pSprite->type = kDudeCultistTommy; pSprite->type = kDudeCultistTommy;
if (pXSprite->target == -1) { if (pXSprite->target == -1) {
switch (pXSprite->medium) { switch (pXSprite->medium) {
@ -440,7 +440,7 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite)
{ {
DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1; DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1;
pDudeExtraE->at8 = 1; pDudeExtraE->at8 = 1;
pDudeExtraE->at0 = 0; pDudeExtraE->TotalKills = 0;
pSprite->type = kDudeCultistShotgun; pSprite->type = kDudeCultistShotgun;
if (pXSprite->target == -1) if (pXSprite->target == -1)
{ {
@ -483,9 +483,9 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite)
case kDudeBat: case kDudeBat:
{ {
DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1; DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1;
pDudeExtraE->at4 = 0; pDudeExtraE->Kills = 0;
pDudeExtraE->at8 = 1; pDudeExtraE->at8 = 1;
pDudeExtraE->at0 = 0; pDudeExtraE->TotalKills = 0;
if (!pSprite->flags) if (!pSprite->flags)
pSprite->flags = 9; pSprite->flags = 9;
if (pXSprite->target == -1) if (pXSprite->target == -1)
@ -501,9 +501,9 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite)
case kDudeBoneEel: case kDudeBoneEel:
{ {
DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1; DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1;
pDudeExtraE->at4 = 0; pDudeExtraE->Kills = 0;
pDudeExtraE->at8 = 1; pDudeExtraE->at8 = 1;
pDudeExtraE->at0 = 0; pDudeExtraE->TotalKills = 0;
if (pXSprite->target == -1) if (pXSprite->target == -1)
aiNewState(pSprite, pXSprite, &eelSearch); aiNewState(pSprite, pXSprite, &eelSearch);
else else
@ -521,8 +521,8 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite)
XSECTOR *pXSector = NULL; XSECTOR *pXSector = NULL;
if (sector[pSprite->sectnum].extra > 0) if (sector[pSprite->sectnum].extra > 0)
pXSector = &xsector[sector[pSprite->sectnum].extra]; pXSector = &xsector[sector[pSprite->sectnum].extra];
pDudeExtraE->at0 = 0; pDudeExtraE->TotalKills = 0;
pDudeExtraE->at4 = 0; pDudeExtraE->Kills = 0;
pDudeExtraE->at8 = 1; pDudeExtraE->at8 = 1;
if (pXSprite->target == -1) if (pXSprite->target == -1)
{ {
@ -546,8 +546,8 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite)
} }
case kDudeZombieAxeNormal: { case kDudeZombieAxeNormal: {
DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u2; DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u2;
pDudeExtraE->at4 = 1; pDudeExtraE->Kills = 1;
pDudeExtraE->at0 = 0; pDudeExtraE->TotalKills = 0;
if (pXSprite->target == -1) if (pXSprite->target == -1)
aiNewState(pSprite, pXSprite, &zombieASearch); aiNewState(pSprite, pXSprite, &zombieASearch);
else else
@ -576,8 +576,8 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite)
case kDudeZombieAxeBuried: case kDudeZombieAxeBuried:
{ {
DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u2; DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u2;
pDudeExtraE->at4 = 1; pDudeExtraE->Kills = 1;
pDudeExtraE->at0 = 0; pDudeExtraE->TotalKills = 0;
if (pXSprite->aiState == &zombieEIdle) if (pXSprite->aiState == &zombieEIdle)
aiNewState(pSprite, pXSprite, &zombieEUp); aiNewState(pSprite, pXSprite, &zombieEUp);
break; break;
@ -585,16 +585,16 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite)
case kDudeZombieAxeLaying: case kDudeZombieAxeLaying:
{ {
DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u2; DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u2;
pDudeExtraE->at4 = 1; pDudeExtraE->Kills = 1;
pDudeExtraE->at0 = 0; pDudeExtraE->TotalKills = 0;
if (pXSprite->aiState == &zombieSIdle) if (pXSprite->aiState == &zombieSIdle)
aiNewState(pSprite, pXSprite, &zombie13AC2C); aiNewState(pSprite, pXSprite, &zombie13AC2C);
break; break;
} }
case kDudeZombieButcher: { case kDudeZombieButcher: {
DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u2; DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u2;
pDudeExtraE->at4 = 1; pDudeExtraE->Kills = 1;
pDudeExtraE->at0 = 0; pDudeExtraE->TotalKills = 0;
if (pXSprite->target == -1) if (pXSprite->target == -1)
aiNewState(pSprite, pXSprite, &zombieFSearch); aiNewState(pSprite, pXSprite, &zombieFSearch);
else else
@ -621,9 +621,9 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite)
break; break;
case kDudeGargoyleFlesh: { case kDudeGargoyleFlesh: {
DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1; DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1;
pDudeExtraE->at4 = 0; pDudeExtraE->Kills = 0;
pDudeExtraE->at8 = 1; pDudeExtraE->at8 = 1;
pDudeExtraE->at0 = 0; pDudeExtraE->TotalKills = 0;
if (pXSprite->target == -1) if (pXSprite->target == -1)
aiNewState(pSprite, pXSprite, &gargoyleFSearch); aiNewState(pSprite, pXSprite, &gargoyleFSearch);
else else
@ -639,9 +639,9 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite)
case kDudeGargoyleStone: case kDudeGargoyleStone:
{ {
DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1; DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1;
pDudeExtraE->at4 = 0; pDudeExtraE->Kills = 0;
pDudeExtraE->at8 = 1; pDudeExtraE->at8 = 1;
pDudeExtraE->at0 = 0; pDudeExtraE->TotalKills = 0;
if (pXSprite->target == -1) if (pXSprite->target == -1)
aiNewState(pSprite, pXSprite, &gargoyleFSearch); aiNewState(pSprite, pXSprite, &gargoyleFSearch);
else else
@ -757,7 +757,7 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite)
case kDudeSpiderMother: { case kDudeSpiderMother: {
DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1; DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1;
pDudeExtraE->at8 = 1; pDudeExtraE->at8 = 1;
pDudeExtraE->at0 = 0; pDudeExtraE->TotalKills = 0;
pSprite->flags |= 2; pSprite->flags |= 2;
pSprite->cstat &= ~8; pSprite->cstat &= ~8;
if (pXSprite->target == -1) if (pXSprite->target == -1)
@ -772,8 +772,8 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite)
case kDudeTinyCaleb: case kDudeTinyCaleb:
{ {
DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u2; DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u2;
pDudeExtraE->at4 = 1; pDudeExtraE->Kills = 1;
pDudeExtraE->at0 = 0; pDudeExtraE->TotalKills = 0;
if (pXSprite->target == -1) if (pXSprite->target == -1)
{ {
switch (pXSprite->medium) switch (pXSprite->medium)
@ -805,8 +805,8 @@ void aiActivateDude(spritetype *pSprite, XSPRITE *pXSprite)
case kDudeBeast: case kDudeBeast:
{ {
DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u2; DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u2;
pDudeExtraE->at4 = 1; pDudeExtraE->Kills = 1;
pDudeExtraE->at0 = 0; pDudeExtraE->TotalKills = 0;
if (pXSprite->target == -1) if (pXSprite->target == -1)
{ {
switch (pXSprite->medium) switch (pXSprite->medium)
@ -910,7 +910,7 @@ int aiDamageSprite(spritetype *pSprite, XSPRITE *pXSprite, int nSource, DAMAGE_T
if (nDmgType == DAMAGE_TYPE_6) if (nDmgType == DAMAGE_TYPE_6)
{ {
DUDEEXTRA *pDudeExtra = &gDudeExtra[pSprite->extra]; DUDEEXTRA *pDudeExtra = &gDudeExtra[pSprite->extra];
pDudeExtra->at4 = 1; pDudeExtra->Kills = 1;
} }
switch (pSprite->type) switch (pSprite->type)
{ {
@ -933,7 +933,7 @@ int aiDamageSprite(spritetype *pSprite, XSPRITE *pXSprite, int nSource, DAMAGE_T
aiNewState(pSprite, pXSprite, &cultistBurnGoto); aiNewState(pSprite, pXSprite, &cultistBurnGoto);
aiPlay3DSound(pSprite, 361, AI_SFX_PRIORITY_0, -1); aiPlay3DSound(pSprite, 361, AI_SFX_PRIORITY_0, -1);
aiPlay3DSound(pSprite, 1031+Random(2), AI_SFX_PRIORITY_2, -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); actHealDude(pXSprite, dudeInfo[40].startHealth, dudeInfo[40].startHealth);
evKill(nSprite, 3, kCallbackFXFlameLick); evKill(nSprite, 3, kCallbackFXFlameLick);
} }
@ -944,16 +944,16 @@ int aiDamageSprite(spritetype *pSprite, XSPRITE *pXSprite, int nSource, DAMAGE_T
pSprite->type = kDudeBurningInnocent; pSprite->type = kDudeBurningInnocent;
aiNewState(pSprite, pXSprite, &cultistBurnGoto); aiNewState(pSprite, pXSprite, &cultistBurnGoto);
aiPlay3DSound(pSprite, 361, AI_SFX_PRIORITY_0, -1); 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); actHealDude(pXSprite, dudeInfo[39].startHealth, dudeInfo[39].startHealth);
evKill(nSprite, 3, kCallbackFXFlameLick); evKill(nSprite, 3, kCallbackFXFlameLick);
} }
break; break;
case kDudeBurningCultist: 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); 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)) 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; pSprite->type = kDudeBurningInnocent;
aiNewState(pSprite, pXSprite, &cultistBurnGoto); aiNewState(pSprite, pXSprite, &cultistBurnGoto);
aiPlay3DSound(pSprite, 361, AI_SFX_PRIORITY_0, -1); 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); actHealDude(pXSprite, dudeInfo[39].startHealth, dudeInfo[39].startHealth);
evKill(nSprite, 3, kCallbackFXFlameLick); evKill(nSprite, 3, kCallbackFXFlameLick);
} }
break; break;
#ifdef NOONE_EXTENSIONS #ifdef NOONE_EXTENSIONS
case kDudeModernCustomBurning: case kDudeModernCustomBurning:
if (Chance(0x2000) && gDudeExtra[pSprite->extra].at0 < gFrameClock) { if (Chance(0x2000) && gDudeExtra[pSprite->extra].TotalKills < gFrameClock) {
playGenDudeSound(pSprite, kGenDudeSndBurning); playGenDudeSound(pSprite, kGenDudeSndBurning);
gDudeExtra[pSprite->extra].at0 = gFrameClock + 360; gDudeExtra[pSprite->extra].TotalKills = gFrameClock + 360;
} }
if (pXSprite->burnTime == 0) pXSprite->burnTime = 2400; if (pXSprite->burnTime == 0) pXSprite->burnTime = 2400;
if (spriteIsUnderwater(pSprite, false)) { if (spriteIsUnderwater(pSprite, false)) {
@ -1036,7 +1036,7 @@ int aiDamageSprite(spritetype *pSprite, XSPRITE *pXSprite, int nSource, DAMAGE_T
aiGenDudeNewState(pSprite, &genDudeBurnGoto); aiGenDudeNewState(pSprite, &genDudeBurnGoto);
actHealDude(pXSprite, dudeInfo[55].startHealth, dudeInfo[55].startHealth); actHealDude(pXSprite, dudeInfo[55].startHealth, dudeInfo[55].startHealth);
gDudeExtra[pSprite->extra].at0 = gFrameClock + 360; gDudeExtra[pSprite->extra].TotalKills = gFrameClock + 360;
evKill(nSprite, 3, kCallbackFXFlameLick); evKill(nSprite, 3, kCallbackFXFlameLick);
} }
@ -1101,7 +1101,7 @@ void RecoilDude(spritetype *pSprite, XSPRITE *pXSprite)
#ifdef NOONE_EXTENSIONS #ifdef NOONE_EXTENSIONS
case kDudeModernCustom: { case kDudeModernCustom: {
GENDUDEEXTRA* pExtra = genDudeExtra(pSprite); int rChance = getRecoilChance(pSprite); 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); if (Chance(rChance << 3) || (dudeIsMelee(pXSprite) && Chance(rChance << 4))) aiGenDudeNewState(pSprite, &genDudeRecoilTesla);
else if (pExtra->canRecoil && Chance(rChance)) aiGenDudeNewState(pSprite, &genDudeRecoilL); 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; break;
} }
#endif #endif
@ -1155,11 +1155,11 @@ void RecoilDude(spritetype *pSprite, XSPRITE *pXSprite)
else aiPlay3DSound(pSprite, 1013+Random(2), AI_SFX_PRIORITY_2, -1); else aiPlay3DSound(pSprite, 1013+Random(2), AI_SFX_PRIORITY_2, -1);
if (!v4 && pXSprite->medium == kMediumNormal) { 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 aiNewState(pSprite, pXSprite, &cultistRecoil);
} else if (v4 && pXSprite->medium == kMediumNormal) { } 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 if (gGameOptions.nDifficulty > 0) aiNewState(pSprite, pXSprite, &cultistProneRecoil);
else aiNewState(pSprite, pXSprite, &cultistRecoil); else aiNewState(pSprite, pXSprite, &cultistRecoil);
} }
@ -1167,7 +1167,7 @@ void RecoilDude(spritetype *pSprite, XSPRITE *pXSprite)
aiNewState(pSprite, pXSprite, &cultistSwimRecoil); aiNewState(pSprite, pXSprite, &cultistSwimRecoil);
else else
{ {
if (pDudeExtra->at4) if (pDudeExtra->Kills)
aiNewState(pSprite, pXSprite, &cultistTeslaRecoil); aiNewState(pSprite, pXSprite, &cultistTeslaRecoil);
else else
aiNewState(pSprite, pXSprite, &cultistRecoil); aiNewState(pSprite, pXSprite, &cultistRecoil);
@ -1183,7 +1183,7 @@ void RecoilDude(spritetype *pSprite, XSPRITE *pXSprite)
#endif #endif
case kDudeZombieButcher: case kDudeZombieButcher:
aiPlay3DSound(pSprite, 1202, AI_SFX_PRIORITY_2, -1); aiPlay3DSound(pSprite, 1202, AI_SFX_PRIORITY_2, -1);
if (pDudeExtra->at4) if (pDudeExtra->Kills)
aiNewState(pSprite, pXSprite, &zombieFTeslaRecoil); aiNewState(pSprite, pXSprite, &zombieFTeslaRecoil);
else else
aiNewState(pSprite, pXSprite, &zombieFRecoil); aiNewState(pSprite, pXSprite, &zombieFRecoil);
@ -1191,7 +1191,7 @@ void RecoilDude(spritetype *pSprite, XSPRITE *pXSprite)
case kDudeZombieAxeNormal: case kDudeZombieAxeNormal:
case kDudeZombieAxeBuried: case kDudeZombieAxeBuried:
aiPlay3DSound(pSprite, 1106, AI_SFX_PRIORITY_2, -1); 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); aiNewState(pSprite, pXSprite, &zombieATeslaRecoil);
else if (pXSprite->data3 > pDudeInfo->startHealth/3) else if (pXSprite->data3 > pDudeInfo->startHealth/3)
aiNewState(pSprite, pXSprite, &zombieARecoil2); aiNewState(pSprite, pXSprite, &zombieARecoil2);
@ -1213,7 +1213,7 @@ void RecoilDude(spritetype *pSprite, XSPRITE *pXSprite)
break; break;
case kDudeCerberusTwoHead: case kDudeCerberusTwoHead:
aiPlay3DSound(pSprite, 2302+Random(2), AI_SFX_PRIORITY_2, -1); 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); aiNewState(pSprite, pXSprite, &cerberusTeslaRecoil);
else else
aiNewState(pSprite, pXSprite, &cerberusRecoil); aiNewState(pSprite, pXSprite, &cerberusRecoil);
@ -1224,7 +1224,7 @@ void RecoilDude(spritetype *pSprite, XSPRITE *pXSprite)
break; break;
case kDudeHellHound: case kDudeHellHound:
aiPlay3DSound(pSprite, 1302, AI_SFX_PRIORITY_2, -1); aiPlay3DSound(pSprite, 1302, AI_SFX_PRIORITY_2, -1);
if (pDudeExtra->at4) if (pDudeExtra->Kills)
aiNewState(pSprite, pXSprite, &houndTeslaRecoil); aiNewState(pSprite, pXSprite, &houndTeslaRecoil);
else else
aiNewState(pSprite, pXSprite, &houndRecoil); aiNewState(pSprite, pXSprite, &houndRecoil);
@ -1262,7 +1262,7 @@ void RecoilDude(spritetype *pSprite, XSPRITE *pXSprite)
} }
case kDudePhantasm: case kDudePhantasm:
aiPlay3DSound(pSprite, 1602, AI_SFX_PRIORITY_2, -1); aiPlay3DSound(pSprite, 1602, AI_SFX_PRIORITY_2, -1);
if (pDudeExtra->at4) if (pDudeExtra->Kills)
aiNewState(pSprite, pXSprite, &ghostTeslaRecoil); aiNewState(pSprite, pXSprite, &ghostTeslaRecoil);
else else
aiNewState(pSprite, pXSprite, &ghostRecoil); aiNewState(pSprite, pXSprite, &ghostRecoil);
@ -1279,7 +1279,7 @@ void RecoilDude(spritetype *pSprite, XSPRITE *pXSprite)
break; break;
case kDudeInnocent: case kDudeInnocent:
aiPlay3DSound(pSprite, 7007+Random(2), AI_SFX_PRIORITY_2, -1); aiPlay3DSound(pSprite, 7007+Random(2), AI_SFX_PRIORITY_2, -1);
if (pDudeExtra->at4) if (pDudeExtra->Kills)
aiNewState(pSprite, pXSprite, &innocentTeslaRecoil); aiNewState(pSprite, pXSprite, &innocentTeslaRecoil);
else else
aiNewState(pSprite, pXSprite, &innocentRecoil); aiNewState(pSprite, pXSprite, &innocentRecoil);
@ -1287,7 +1287,7 @@ void RecoilDude(spritetype *pSprite, XSPRITE *pXSprite)
case kDudeTinyCaleb: case kDudeTinyCaleb:
if (pXSprite->medium == kMediumNormal) if (pXSprite->medium == kMediumNormal)
{ {
if (pDudeExtra->at4) if (pDudeExtra->Kills)
aiNewState(pSprite, pXSprite, &tinycalebTeslaRecoil); aiNewState(pSprite, pXSprite, &tinycalebTeslaRecoil);
else else
aiNewState(pSprite, pXSprite, &tinycalebRecoil); aiNewState(pSprite, pXSprite, &tinycalebRecoil);
@ -1296,7 +1296,7 @@ void RecoilDude(spritetype *pSprite, XSPRITE *pXSprite)
aiNewState(pSprite, pXSprite, &tinycalebSwimRecoil); aiNewState(pSprite, pXSprite, &tinycalebSwimRecoil);
else else
{ {
if (pDudeExtra->at4) if (pDudeExtra->Kills)
aiNewState(pSprite, pXSprite, &tinycalebTeslaRecoil); aiNewState(pSprite, pXSprite, &tinycalebTeslaRecoil);
else else
aiNewState(pSprite, pXSprite, &tinycalebRecoil); aiNewState(pSprite, pXSprite, &tinycalebRecoil);
@ -1306,7 +1306,7 @@ void RecoilDude(spritetype *pSprite, XSPRITE *pXSprite)
aiPlay3DSound(pSprite, 9004+Random(2), AI_SFX_PRIORITY_2, -1); aiPlay3DSound(pSprite, 9004+Random(2), AI_SFX_PRIORITY_2, -1);
if (pXSprite->medium == kMediumNormal) if (pXSprite->medium == kMediumNormal)
{ {
if (pDudeExtra->at4) if (pDudeExtra->Kills)
aiNewState(pSprite, pXSprite, &beastTeslaRecoil); aiNewState(pSprite, pXSprite, &beastTeslaRecoil);
else else
aiNewState(pSprite, pXSprite, &beastRecoil); aiNewState(pSprite, pXSprite, &beastRecoil);
@ -1315,7 +1315,7 @@ void RecoilDude(spritetype *pSprite, XSPRITE *pXSprite)
aiNewState(pSprite, pXSprite, &beastSwimRecoil); aiNewState(pSprite, pXSprite, &beastSwimRecoil);
else else
{ {
if (pDudeExtra->at4) if (pDudeExtra->Kills)
aiNewState(pSprite, pXSprite, &beastTeslaRecoil); aiNewState(pSprite, pXSprite, &beastTeslaRecoil);
else else
aiNewState(pSprite, pXSprite, &beastRecoil); aiNewState(pSprite, pXSprite, &beastRecoil);
@ -1333,7 +1333,7 @@ void RecoilDude(spritetype *pSprite, XSPRITE *pXSprite)
aiNewState(pSprite, pXSprite, &genRecoil); aiNewState(pSprite, pXSprite, &genRecoil);
break; break;
} }
pDudeExtra->at4 = 0; pDudeExtra->Kills = 0;
} }
} }
@ -1507,8 +1507,8 @@ void aiInitSprite(spritetype *pSprite)
if (nXSector > 0) if (nXSector > 0)
pXSector = &xsector[nXSector]; pXSector = &xsector[nXSector];
DUDEEXTRA *pDudeExtra = &gDudeExtra[pSprite->extra]; DUDEEXTRA *pDudeExtra = &gDudeExtra[pSprite->extra];
pDudeExtra->at4 = 0; pDudeExtra->Kills = 0;
pDudeExtra->at0 = 0; pDudeExtra->TotalKills = 0;
switch (pSprite->type) { switch (pSprite->type) {
#ifdef NOONE_EXTENSIONS #ifdef NOONE_EXTENSIONS
@ -1528,7 +1528,7 @@ void aiInitSprite(spritetype *pSprite)
{ {
DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u1; DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u1;
pDudeExtraE->at8 = 0; pDudeExtraE->at8 = 0;
pDudeExtraE->at0 = 0; pDudeExtraE->TotalKills = 0;
aiNewState(pSprite, pXSprite, &cultistIdle); aiNewState(pSprite, pXSprite, &cultistIdle);
break; break;
} }
@ -1536,7 +1536,7 @@ void aiInitSprite(spritetype *pSprite)
{ {
DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u1; DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u1;
pDudeExtraE->at8 = 0; pDudeExtraE->at8 = 0;
pDudeExtraE->at0 = 0; pDudeExtraE->TotalKills = 0;
aiNewState(pSprite, pXSprite, &fanaticProneIdle); aiNewState(pSprite, pXSprite, &fanaticProneIdle);
break; break;
} }
@ -1544,46 +1544,46 @@ void aiInitSprite(spritetype *pSprite)
{ {
DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u1; DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u1;
pDudeExtraE->at8 = 0; pDudeExtraE->at8 = 0;
pDudeExtraE->at0 = 0; pDudeExtraE->TotalKills = 0;
aiNewState(pSprite, pXSprite, &cultistProneIdle); aiNewState(pSprite, pXSprite, &cultistProneIdle);
break; break;
} }
case kDudeZombieButcher: { case kDudeZombieButcher: {
DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u2; DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u2;
pDudeExtraE->at4 = 0; pDudeExtraE->Kills = 0;
pDudeExtraE->at0 = 0; pDudeExtraE->TotalKills = 0;
aiNewState(pSprite, pXSprite, &zombieFIdle); aiNewState(pSprite, pXSprite, &zombieFIdle);
break; break;
} }
case kDudeZombieAxeNormal: { case kDudeZombieAxeNormal: {
DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u2; DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u2;
pDudeExtraE->at4 = 0; pDudeExtraE->Kills = 0;
pDudeExtraE->at0 = 0; pDudeExtraE->TotalKills = 0;
aiNewState(pSprite, pXSprite, &zombieAIdle); aiNewState(pSprite, pXSprite, &zombieAIdle);
break; break;
} }
case kDudeZombieAxeLaying: case kDudeZombieAxeLaying:
{ {
DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u2; DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u2;
pDudeExtraE->at4 = 0; pDudeExtraE->Kills = 0;
pDudeExtraE->at0 = 0; pDudeExtraE->TotalKills = 0;
aiNewState(pSprite, pXSprite, &zombieSIdle); aiNewState(pSprite, pXSprite, &zombieSIdle);
pSprite->flags &= ~1; pSprite->flags &= ~1;
break; break;
} }
case kDudeZombieAxeBuried: { case kDudeZombieAxeBuried: {
DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u2; DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u2;
pDudeExtraE->at4 = 0; pDudeExtraE->Kills = 0;
pDudeExtraE->at0 = 0; pDudeExtraE->TotalKills = 0;
aiNewState(pSprite, pXSprite, &zombieEIdle); aiNewState(pSprite, pXSprite, &zombieEIdle);
break; break;
} }
case kDudeGargoyleFlesh: case kDudeGargoyleFlesh:
case kDudeGargoyleStone: { case kDudeGargoyleStone: {
DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u1; DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u1;
pDudeExtraE->at4 = 0; pDudeExtraE->Kills = 0;
pDudeExtraE->at8 = 0; pDudeExtraE->at8 = 0;
pDudeExtraE->at0 = 0; pDudeExtraE->TotalKills = 0;
aiNewState(pSprite, pXSprite, &gargoyleFIdle); aiNewState(pSprite, pXSprite, &gargoyleFIdle);
break; break;
} }
@ -1593,8 +1593,8 @@ void aiInitSprite(spritetype *pSprite)
break; break;
case kDudeCerberusTwoHead: { case kDudeCerberusTwoHead: {
DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u2; DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u2;
pDudeExtraE->at4 = 0; pDudeExtraE->Kills = 0;
pDudeExtraE->at0 = 0; pDudeExtraE->TotalKills = 0;
aiNewState(pSprite, pXSprite, &cerberusIdle); aiNewState(pSprite, pXSprite, &cerberusIdle);
break; break;
} }
@ -1607,9 +1607,9 @@ void aiInitSprite(spritetype *pSprite)
case kDudePhantasm: case kDudePhantasm:
{ {
DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u1; DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u1;
pDudeExtraE->at4 = 0; pDudeExtraE->Kills = 0;
pDudeExtraE->at8 = 0; pDudeExtraE->at8 = 0;
pDudeExtraE->at0 = 0; pDudeExtraE->TotalKills = 0;
aiNewState(pSprite, pXSprite, &ghostIdle); aiNewState(pSprite, pXSprite, &ghostIdle);
break; break;
} }
@ -1622,9 +1622,9 @@ void aiInitSprite(spritetype *pSprite)
case kDudeBoneEel: case kDudeBoneEel:
{ {
DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u1; DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u1;
pDudeExtraE->at4 = 0; pDudeExtraE->Kills = 0;
pDudeExtraE->at8 = 0; pDudeExtraE->at8 = 0;
pDudeExtraE->at0 = 0; pDudeExtraE->TotalKills = 0;
aiNewState(pSprite, pXSprite, &eelIdle); aiNewState(pSprite, pXSprite, &eelIdle);
break; break;
} }
@ -1634,9 +1634,9 @@ void aiInitSprite(spritetype *pSprite)
case kDudeBat: case kDudeBat:
{ {
DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u1; DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u1;
pDudeExtraE->at4 = 0; pDudeExtraE->Kills = 0;
pDudeExtraE->at8 = 0; pDudeExtraE->at8 = 0;
pDudeExtraE->at0 = 0; pDudeExtraE->TotalKills = 0;
aiNewState(pSprite, pXSprite, &batIdle); aiNewState(pSprite, pXSprite, &batIdle);
break; break;
} }
@ -1646,8 +1646,8 @@ void aiInitSprite(spritetype *pSprite)
{ {
DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u1; DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u1;
pDudeExtraE->at8 = 0; pDudeExtraE->at8 = 0;
pDudeExtraE->at4 = 0; pDudeExtraE->Kills = 0;
pDudeExtraE->at0 = 0; pDudeExtraE->TotalKills = 0;
aiNewState(pSprite, pXSprite, &spidIdle); aiNewState(pSprite, pXSprite, &spidIdle);
break; break;
} }
@ -1655,16 +1655,16 @@ void aiInitSprite(spritetype *pSprite)
{ {
DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u1; DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u1;
pDudeExtraE->at8 = 0; pDudeExtraE->at8 = 0;
pDudeExtraE->at4 = 0; pDudeExtraE->Kills = 0;
pDudeExtraE->at0 = 0; pDudeExtraE->TotalKills = 0;
aiNewState(pSprite, pXSprite, &spidIdle); aiNewState(pSprite, pXSprite, &spidIdle);
break; break;
} }
case kDudeTchernobog: case kDudeTchernobog:
{ {
DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u2; DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u2;
pDudeExtraE->at4 = 0; pDudeExtraE->Kills = 0;
pDudeExtraE->at0 = 0; pDudeExtraE->TotalKills = 0;
aiNewState(pSprite, pXSprite, &tchernobogIdle); aiNewState(pSprite, pXSprite, &tchernobogIdle);
break; break;
} }

View file

@ -53,21 +53,21 @@ enum AI_SFX_PRIORITY {
struct DUDEEXTRA_at6_u1 struct DUDEEXTRA_at6_u1
{ {
int at0; int TotalKills;
int at4; int Kills;
char at8; char at8;
}; };
struct DUDEEXTRA_at6_u2 struct DUDEEXTRA_at6_u2
{ {
int at0; int TotalKills;
char at4; char Kills;
}; };
struct DUDEEXTRA struct DUDEEXTRA
{ {
int at0; int TotalKills;
char at4; char Kills;
AI_SFX_PRIORITY at5; AI_SFX_PRIORITY at5;
union union
{ {
@ -78,8 +78,8 @@ struct DUDEEXTRA
}; };
struct TARGETTRACK { struct TARGETTRACK {
int at0; int TotalKills;
int at4; int Kills;
int at8; // view angle int at8; // view angle
int atc; int atc;
int at10; // Move predict int at10; // Move predict

View file

@ -94,11 +94,11 @@ static void thinkTarget(spritetype *pSprite, XSPRITE *pXSprite)
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1; DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1;
if (pDudeExtraE->at8 && pDudeExtraE->at4 < 10) if (pDudeExtraE->at8 && pDudeExtraE->Kills < 10)
pDudeExtraE->at4++; pDudeExtraE->Kills++;
else if (pDudeExtraE->at4 >= 10 && pDudeExtraE->at8) else if (pDudeExtraE->Kills >= 10 && pDudeExtraE->at8)
{ {
pDudeExtraE->at4 = 0; pDudeExtraE->Kills = 0;
pXSprite->goalAng += 256; pXSprite->goalAng += 256;
POINT3D *pTarget = &baseSprite[pSprite->index]; POINT3D *pTarget = &baseSprite[pSprite->index];
aiSetTarget(pXSprite, pTarget->x, pTarget->y, pTarget->z); aiSetTarget(pXSprite, pTarget->x, pTarget->y, pTarget->z);

View file

@ -107,11 +107,11 @@ static void thinkTarget(spritetype *pSprite, XSPRITE *pXSprite)
dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); dassert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1; DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1;
if (pDudeExtraE->at8 && pDudeExtraE->at4 < 10) if (pDudeExtraE->at8 && pDudeExtraE->Kills < 10)
pDudeExtraE->at4++; pDudeExtraE->Kills++;
else if (pDudeExtraE->at4 >= 10 && pDudeExtraE->at8) else if (pDudeExtraE->Kills >= 10 && pDudeExtraE->at8)
{ {
pDudeExtraE->at4 = 0; pDudeExtraE->Kills = 0;
pXSprite->goalAng += 256; pXSprite->goalAng += 256;
POINT3D *pTarget = &baseSprite[pSprite->index]; POINT3D *pTarget = &baseSprite[pSprite->index];
aiSetTarget(pXSprite, pTarget->x, pTarget->y, pTarget->z); 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; int nDeltaAngle = ((getangle(dx,dy)+1024-pSprite->ang)&2047)-1024;
if (nDist < pDudeInfo->seeDist && klabs(nDeltaAngle) <= pDudeInfo->periphery) if (nDist < pDudeInfo->seeDist && klabs(nDeltaAngle) <= pDudeInfo->periphery)
{ {
pDudeExtraE->at4 = 0; pDudeExtraE->Kills = 0;
aiSetTarget(pXSprite, pPlayer->nSprite); aiSetTarget(pXSprite, pPlayer->nSprite);
aiActivateDude(pSprite, pXSprite); aiActivateDude(pSprite, pXSprite);
} }
else if (nDist < pDudeInfo->hearDist) else if (nDist < pDudeInfo->hearDist)
{ {
pDudeExtraE->at4 = 0; pDudeExtraE->Kills = 0;
aiSetTarget(pXSprite, x, y, z); aiSetTarget(pXSprite, x, y, z);
aiActivateDude(pSprite, pXSprite); aiActivateDude(pSprite, pXSprite);
} }

View file

@ -279,9 +279,9 @@ static void thinkTarget(spritetype *pSprite, XSPRITE *pXSprite)
} }
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1; DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1;
if (pDudeExtraE->at8 && pDudeExtraE->at4 < 10) if (pDudeExtraE->at8 && pDudeExtraE->Kills < 10)
pDudeExtraE->at4++; pDudeExtraE->Kills++;
else if (pDudeExtraE->at4 >= 10 && pDudeExtraE->at8) else if (pDudeExtraE->Kills >= 10 && pDudeExtraE->at8)
{ {
pXSprite->goalAng += 256; pXSprite->goalAng += 256;
POINT3D *pTarget = &baseSprite[pSprite->index]; 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; int nDeltaAngle = ((getangle(dx,dy)+1024-pSprite->ang)&2047)-1024;
if (nDist < pDudeInfo->seeDist && klabs(nDeltaAngle) <= pDudeInfo->periphery) if (nDist < pDudeInfo->seeDist && klabs(nDeltaAngle) <= pDudeInfo->periphery)
{ {
pDudeExtraE->at0 = 0; pDudeExtraE->TotalKills = 0;
aiSetTarget(pXSprite, pPlayer->nSprite); aiSetTarget(pXSprite, pPlayer->nSprite);
aiActivateDude(pSprite, pXSprite); aiActivateDude(pSprite, pXSprite);
} }
else if (nDist < pDudeInfo->hearDist) else if (nDist < pDudeInfo->hearDist)
{ {
pDudeExtraE->at0 = 0; pDudeExtraE->TotalKills = 0;
aiSetTarget(pXSprite, x, y, z); aiSetTarget(pXSprite, x, y, z);
aiActivateDude(pSprite, pXSprite); aiActivateDude(pSprite, pXSprite);
} }

View file

@ -238,9 +238,9 @@ static void thinkTarget(spritetype *pSprite, XSPRITE *pXSprite)
} }
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1; DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1;
if (pDudeExtraE->at8 && pDudeExtraE->at4 < 10) if (pDudeExtraE->at8 && pDudeExtraE->Kills < 10)
pDudeExtraE->at4++; pDudeExtraE->Kills++;
else if (pDudeExtraE->at4 >= 10 && pDudeExtraE->at8) else if (pDudeExtraE->Kills >= 10 && pDudeExtraE->at8)
{ {
pXSprite->goalAng += 256; pXSprite->goalAng += 256;
POINT3D *pTarget = &baseSprite[pSprite->index]; 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; int nDeltaAngle = ((getangle(dx,dy)+1024-pSprite->ang)&2047)-1024;
if (nDist < pDudeInfo->seeDist && klabs(nDeltaAngle) <= pDudeInfo->periphery) if (nDist < pDudeInfo->seeDist && klabs(nDeltaAngle) <= pDudeInfo->periphery)
{ {
pDudeExtraE->at4 = 0; pDudeExtraE->Kills = 0;
aiSetTarget(pXSprite, pPlayer->nSprite); aiSetTarget(pXSprite, pPlayer->nSprite);
aiActivateDude(pSprite, pXSprite); aiActivateDude(pSprite, pXSprite);
} }
else if (nDist < pDudeInfo->hearDist) else if (nDist < pDudeInfo->hearDist)
{ {
pDudeExtraE->at4 = 0; pDudeExtraE->Kills = 0;
aiSetTarget(pXSprite, x, y, z); aiSetTarget(pXSprite, x, y, z);
aiActivateDude(pSprite, pXSprite); aiActivateDude(pSprite, pXSprite);
} }

View file

@ -212,9 +212,9 @@ static void thinkTarget(spritetype *pSprite, XSPRITE *pXSprite)
} }
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1; DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1;
if (pDudeExtraE->at8 && pDudeExtraE->at4 < 10) if (pDudeExtraE->at8 && pDudeExtraE->Kills < 10)
pDudeExtraE->at4++; pDudeExtraE->Kills++;
else if (pDudeExtraE->at4 >= 10 && pDudeExtraE->at8) else if (pDudeExtraE->Kills >= 10 && pDudeExtraE->at8)
{ {
pXSprite->goalAng += 256; pXSprite->goalAng += 256;
POINT3D *pTarget = &baseSprite[pSprite->index]; 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; int nDeltaAngle = ((getangle(dx,dy)+1024-pSprite->ang)&2047)-1024;
if (nDist < pDudeInfo->seeDist && klabs(nDeltaAngle) <= pDudeInfo->periphery) if (nDist < pDudeInfo->seeDist && klabs(nDeltaAngle) <= pDudeInfo->periphery)
{ {
pDudeExtraE->at4 = 0; pDudeExtraE->Kills = 0;
aiSetTarget(pXSprite, pPlayer->nSprite); aiSetTarget(pXSprite, pPlayer->nSprite);
aiActivateDude(pSprite, pXSprite); aiActivateDude(pSprite, pXSprite);
return; return;
} }
else if (nDist < pDudeInfo->hearDist) else if (nDist < pDudeInfo->hearDist)
{ {
pDudeExtraE->at4 = 0; pDudeExtraE->Kills = 0;
aiSetTarget(pXSprite, x, y, z); aiSetTarget(pXSprite, x, y, z);
aiActivateDude(pSprite, pXSprite); aiActivateDude(pSprite, pXSprite);
return; return;

View file

@ -178,7 +178,7 @@ static void sub_71370(int, int nXSprite)
int nDist = approxDist(dx, dy); int nDist = approxDist(dx, dy);
spritetype *pSpawn = NULL; 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) if (nDist < 0x1a00 && nDist > 0x1400 && klabs(pSprite->ang-nAngle) < pDudeInfo->periphery)
pSpawn = actSpawnDude(pSprite, kDudeSpiderRed, pSprite->clipdist, 0); 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); pSpawn = actSpawnDude(pSprite, kDudeSpiderBrown, pSprite->clipdist, 0);
if (pSpawn) { if (pSpawn) {
pDudeExtraE->at4++; pDudeExtraE->Kills++;
pSpawn->owner = nSprite; pSpawn->owner = nSprite;
gKillMgr.sub_263E0(1); gKillMgr.AddNewKill(1);
} }
} }

View file

@ -248,9 +248,9 @@ static void sub_725A4(spritetype *pSprite, XSPRITE *pXSprite)
} }
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u2; DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u2;
if (pDudeExtraE->at4 && pDudeExtraE->at0 < 10) if (pDudeExtraE->Kills && pDudeExtraE->TotalKills < 10)
pDudeExtraE->at0++; pDudeExtraE->TotalKills++;
else if (pDudeExtraE->at0 >= 10 && pDudeExtraE->at4) else if (pDudeExtraE->TotalKills >= 10 && pDudeExtraE->Kills)
{ {
pXSprite->goalAng += 256; pXSprite->goalAng += 256;
POINT3D *pTarget = &baseSprite[pSprite->index]; 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; int nDeltaAngle = ((getangle(dx,dy)+1024-pSprite->ang)&2047)-1024;
if (nDist < pDudeInfo->seeDist && klabs(nDeltaAngle) <= pDudeInfo->periphery) if (nDist < pDudeInfo->seeDist && klabs(nDeltaAngle) <= pDudeInfo->periphery)
{ {
pDudeExtraE->at0 = 0; pDudeExtraE->TotalKills = 0;
aiSetTarget(pXSprite, pPlayer->nSprite); aiSetTarget(pXSprite, pPlayer->nSprite);
aiActivateDude(pSprite, pXSprite); aiActivateDude(pSprite, pXSprite);
} }
else if (nDist < pDudeInfo->hearDist) else if (nDist < pDudeInfo->hearDist)
{ {
pDudeExtraE->at0 = 0; pDudeExtraE->TotalKills = 0;
aiSetTarget(pXSprite, x, y, z); aiSetTarget(pXSprite, x, y, z);
aiActivateDude(pSprite, pXSprite); aiActivateDude(pSprite, pXSprite);
} }

View file

@ -254,7 +254,7 @@ static void genDudeAttack1(int, int nXIndex) {
aiActivateDude(pSpawned, &xsprite[pSpawned->extra]); aiActivateDude(pSpawned, &xsprite[pSpawned->extra]);
} }
gKillMgr.sub_263E0(1); gKillMgr.AddNewKill(1);
pExtra->slave[pExtra->slaveCount++] = pSpawned->index; pExtra->slave[pExtra->slaveCount++] = pSpawned->index;
if (!playGenDudeSound(pSprite, kGenDudeSndAttackNormal)) if (!playGenDudeSound(pSprite, kGenDudeSndAttackNormal))
sfxPlay3DSoundCP(pSprite, 379, 1, 0, 0x10000 - Random3(0x3000)); sfxPlay3DSoundCP(pSprite, 379, 1, 0, 0x10000 - Random3(0x3000));
@ -2192,7 +2192,7 @@ void aiGenDudeInitSprite(spritetype* pSprite, XSPRITE* pXSprite) {
switch (pSprite->type) { switch (pSprite->type) {
case kDudeModernCustom: { case kDudeModernCustom: {
DUDEEXTRA_at6_u1* pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1; DUDEEXTRA_at6_u1* pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1;
pDudeExtraE->at8 = pDudeExtraE->at0 = 0; pDudeExtraE->at8 = pDudeExtraE->TotalKills = 0;
aiGenDudeNewState(pSprite, &genDudeIdleL); aiGenDudeNewState(pSprite, &genDudeIdleL);
break; break;
} }

View file

@ -288,7 +288,7 @@ void ProcessFrame(void)
} }
viewClearInterpolations(); viewClearInterpolations();
{ {
if (paused || gEndGameMgr.at0 || (gGameOptions.nGameType == 0 && M_Active())) if (paused || (gGameOptions.nGameType == 0 && M_Active()))
return; return;
} }
@ -376,7 +376,7 @@ void ProcessFrame(void)
} }
else else
{ {
gEndGameMgr.Setup(); ShowSummaryScreen();
} }
} }
} }
@ -597,11 +597,6 @@ void GameInterface::RunGameFrame()
case GS_LEVEL: case GS_LEVEL:
gameTicker(); gameTicker();
break; break;
case GS_FINALE:
gEndGameMgr.ProcessKeys();
gEndGameMgr.Draw();
break;
} }
} }

View file

@ -60,6 +60,7 @@ void PreloadCache(void);
void StartLevel(MapRecord *gameOptions); void StartLevel(MapRecord *gameOptions);
void ProcessFrame(void); void ProcessFrame(void);
void ScanINIFiles(void); void ScanINIFiles(void);
void EndLevel();
inline bool DemoRecordStatus(void) inline bool DemoRecordStatus(void)
{ {

View file

@ -37,7 +37,7 @@ BEGIN_BLD_NS
void CChoke::init(int a1, void(*a2)(PLAYER*)) void CChoke::init(int a1, void(*a2)(PLAYER*))
{ {
at0 = NULL; TotalKills = NULL;
at1c = a2; at1c = a2;
if (!at8 && a1 != -1) if (!at8 && a1 != -1)
{ {

View file

@ -33,7 +33,7 @@ class CChoke
public: public:
CChoke() CChoke()
{ {
at0 = NULL; TotalKills = NULL;
at8 = NULL; at8 = NULL;
atc = 0; atc = 0;
at10 = 0; at10 = 0;
@ -44,7 +44,7 @@ public:
void init(int a1, void(*a2)(PLAYER*)); void init(int a1, void(*a2)(PLAYER*));
void animateChoke(int x, int y, int smoothratio); void animateChoke(int x, int y, int smoothratio);
void reset() { at10 = 0; } void reset() { at10 = 0; }
char *at0; char *TotalKills;
QAV *at8; QAV *at8;
int atc; int atc;
int at10; int at10;

View file

@ -644,8 +644,8 @@ int dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, short
byte_1A76C7 = 1; byte_1A76C7 = 1;
} }
mapHeader.at0 = LittleLong(mapHeader.at0); mapHeader.TotalKills = LittleLong(mapHeader.TotalKills);
mapHeader.at4 = LittleLong(mapHeader.at4); mapHeader.Kills = LittleLong(mapHeader.Kills);
mapHeader.at8 = LittleLong(mapHeader.at8); mapHeader.at8 = LittleLong(mapHeader.at8);
mapHeader.atc = LittleShort(mapHeader.atc); mapHeader.atc = LittleShort(mapHeader.atc);
mapHeader.ate = LittleShort(mapHeader.ate); 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.at21 = LittleShort(mapHeader.at21);
mapHeader.at23 = LittleShort(mapHeader.at23); mapHeader.at23 = LittleShort(mapHeader.at23);
*pX = mapHeader.at0; *pX = mapHeader.TotalKills;
*pY = mapHeader.at4; *pY = mapHeader.Kills;
*pZ = mapHeader.at8; *pZ = mapHeader.at8;
*pAngle = mapHeader.atc; *pAngle = mapHeader.atc;
*pSector = mapHeader.ate; *pSector = mapHeader.ate;

View file

@ -246,8 +246,8 @@ struct MAPSIGNATURE {
}; };
struct MAPHEADER { struct MAPHEADER {
int at0; // x int TotalKills; // x
int at4; // y int Kills; // y
int at8; // z int at8; // z
short atc; // ang short atc; // ang
short ate; // sect short ate; // sect
@ -262,7 +262,7 @@ struct MAPHEADER {
}; };
struct MAPHEADER2 { struct MAPHEADER2 {
char at0[64]; char TotalKills[64];
int at40; // xsprite size int at40; // xsprite size
int at44; // xwall size int at44; // xwall size
int at48; // xsector size int at48; // xsector size

View file

@ -43,291 +43,280 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "gamestate.h" #include "gamestate.h"
#include "raze_sound.h" #include "raze_sound.h"
#include "d_net.h" #include "d_net.h"
#include "screenjob.h"
BEGIN_BLD_NS BEGIN_BLD_NS
enum enum
{ {
kLoadScreenCRC = -2051908571, kLoadScreenCRC = -2051908571,
kLoadScreenWideBackWidth = 256, kLoadScreenWideBackWidth = 256,
kLoadScreenWideSideWidth = 128, kLoadScreenWideSideWidth = 128,
}; };
static int bLoadScreenCrcMatch = -1; static int bLoadScreenCrcMatch = -1;
static void drawTextScreenBackground(void) static void drawTextScreenBackground(void)
{ {
if (bLoadScreenCrcMatch == -1) bLoadScreenCrcMatch = tileGetCRC32(kLoadScreen) == kLoadScreenCRC; if (bLoadScreenCrcMatch == -1) bLoadScreenCrcMatch = tileGetCRC32(kLoadScreen) == kLoadScreenCRC;
if (bLoadScreenCrcMatch) if (bLoadScreenCrcMatch)
{ {
if (yxaspect >= 65536) if (ActiveRatio(twod->GetWidth(), twod->GetHeight()) < 1.34f)
{ {
DrawTexture(twod, tileGetTexture(kLoadScreen), 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43, TAG_DONE); DrawTexture(twod, tileGetTexture(kLoadScreen), 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43, TAG_DONE);
} }
else else
{ {
int width = scale(xdim, 240, ydim); int width = scale(xdim, 240, ydim);
int nCount = (width + kLoadScreenWideBackWidth - 1) / kLoadScreenWideBackWidth; int nCount = (width + kLoadScreenWideBackWidth - 1) / kLoadScreenWideBackWidth;
for (int i = 0; i < nCount; i++) for (int i = 0; i < nCount; i++)
{ {
DrawTexture(twod, tileGetTexture(kLoadScreenWideBack), (i * kLoadScreenWideBackWidth), 0, DrawTexture(twod, tileGetTexture(kLoadScreenWideBack), (i * kLoadScreenWideBackWidth), 0,
DTA_VirtualWidth, width, DTA_VirtualHeight, 200, DTA_KeepRatio, true, TAG_DONE); 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(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, DrawTexture(twod, tileGetTexture(kLoadScreenWideRight), width - tileWidth(kLoadScreenWideRight), 0, DTA_TopLeft, true,
DTA_VirtualWidth, width, DTA_VirtualHeight, 200, DTA_KeepRatio, true, TAG_DONE); DTA_VirtualWidth, width, DTA_VirtualHeight, 200, DTA_KeepRatio, true, TAG_DONE);
DrawTexture(twod, tileGetTexture(kLoadScreenWideMiddle), (width - tileWidth(kLoadScreenWideMiddle))/2, 0, DTA_TopLeft, true, DrawTexture(twod, tileGetTexture(kLoadScreenWideMiddle), (width - tileWidth(kLoadScreenWideMiddle)) / 2, 0, DTA_TopLeft, true,
DTA_VirtualWidth, width, DTA_VirtualHeight, 200, DTA_KeepRatio, true, TAG_DONE); DTA_VirtualWidth, width, DTA_VirtualHeight, 200, DTA_KeepRatio, true, TAG_DONE);
} }
} }
else else
{ {
DrawTexture(twod, tileGetTexture(kLoadScreen), 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43, TAG_DONE); 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(); JobDesc job = { Create<DBloodSummaryScreen>() };
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);
}
}
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); STAT_Update(false);
EndLevel(); EndLevel();
Mus_Stop(); Mus_Stop();
sndStartSample(268, 128, -1, false); 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() CKillMgr::CKillMgr()
{ {
Clear(); Clear();
} }
void CKillMgr::SetCount(int nCount) 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) void CKillMgr::AddKill(spritetype* pSprite)
{ {
if (pSprite->statnum == kStatDude && pSprite->type != kDudeBat && pSprite->type != kDudeRat && pSprite->type != kDudeInnocent && pSprite->type != kDudeBurningInnocent) if (pSprite->statnum == kStatDude && pSprite->type != kDudeBat && pSprite->type != kDudeRat && pSprite->type != kDudeInnocent && pSprite->type != kDudeBurningInnocent)
at4++; Kills++;
} }
void CKillMgr::sub_2641C(void) void CKillMgr::CountTotalKills(void)
{ {
at0 = 0; TotalKills = 0;
for (int nSprite = headspritestat[kStatDude]; nSprite >= 0; nSprite = nextspritestat[nSprite]) for (int nSprite = headspritestat[kStatDude]; nSprite >= 0; nSprite = nextspritestat[nSprite])
{ {
spritetype* pSprite = &sprite[nSprite]; spritetype* pSprite = &sprite[nSprite];
if (pSprite->type < kDudeBase || pSprite->type >= kDudeMax) if (pSprite->type < kDudeBase || pSprite->type >= kDudeMax)
ThrowError("Non-enemy sprite (%d) in the enemy sprite list.", nSprite); 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) if (pSprite->statnum == kStatDude && pSprite->type != kDudeBat && pSprite->type != kDudeRat && pSprite->type != kDudeInnocent && pSprite->type != kDudeBurningInnocent)
at0++; TotalKills++;
} }
}
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);
}
}
} }
void CKillMgr::Clear(void) void CKillMgr::Clear(void)
{ {
at0 = at4 = 0; TotalKills = Kills = 0;
} }
CSecretMgr::CSecretMgr(void) CSecretMgr::CSecretMgr(void)
{ {
Clear(); Clear();
} }
void CSecretMgr::SetCount(int nCount) void CSecretMgr::SetCount(int nCount)
{ {
at0 = nCount; Total = nCount;
} }
void CSecretMgr::Found(int nType) void CSecretMgr::Found(int nType)
{ {
if (nType == 0) at4++; if (nType == 0) Founds++;
else if (nType < 0) { else if (nType < 0) {
viewSetSystemMessage("Invalid secret type %d triggered.", nType); viewSetSystemMessage("Invalid secret type %d triggered.", nType);
return; return;
} else at8++; }
else Super++;
if (gGameOptions.nGameType == 0) { if (gGameOptions.nGameType == 0) {
viewSetMessage(GStrings(FStringf("TXTB_SECRET%d", Random(2))), 0, MESSAGE_PRIORITY_SECRET); 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);
} }
void CSecretMgr::Clear(void) void CSecretMgr::Clear(void)
{ {
at0 = at4 = at8 = 0; Total = Founds = Super = 0;
} }
class EndGameLoadSave : public LoadSave { class EndGameLoadSave : public LoadSave {
public: public:
virtual void Load(void); virtual void Load(void);
virtual void Save(void); virtual void Save(void);
}; };
void EndGameLoadSave::Load(void) void EndGameLoadSave::Load(void)
{ {
Read(&gSecretMgr.at0, 4); Read(&gSecretMgr.Total, 4);
Read(&gSecretMgr.at4, 4); Read(&gSecretMgr.Founds, 4);
Read(&gSecretMgr.at8, 4); Read(&gSecretMgr.Super, 4);
Read(&gKillMgr.at0, 4); Read(&gKillMgr.TotalKills, 4);
Read(&gKillMgr.at4, 4); Read(&gKillMgr.Kills, 4);
} }
void EndGameLoadSave::Save(void) void EndGameLoadSave::Save(void)
{ {
Write(&gSecretMgr.at0, 4); Write(&gSecretMgr.Total, 4);
Write(&gSecretMgr.at4, 4); Write(&gSecretMgr.Founds, 4);
Write(&gSecretMgr.at8, 4); Write(&gSecretMgr.Super, 4);
Write(&gKillMgr.at0, 4); Write(&gKillMgr.TotalKills, 4);
Write(&gKillMgr.at4, 4); Write(&gKillMgr.Kills, 4);
} }
CEndGameMgr gEndGameMgr;
CSecretMgr gSecretMgr; CSecretMgr gSecretMgr;
CKillMgr gKillMgr; CKillMgr gKillMgr;
static EndGameLoadSave *myLoadSave; static EndGameLoadSave* myLoadSave;
void EndGameLoadSaveConstruct(void) void EndGameLoadSaveConstruct(void)
{ {
myLoadSave = new EndGameLoadSave(); myLoadSave = new EndGameLoadSave();
} }
class DBloodLoadScreen : public DScreenJob class DBloodLoadScreen : public DScreenJob
{ {
std::function<int(void)> callback; std::function<int(void)> callback;
const char *pzLoadingScreenText1; const char* pzLoadingScreenText1;
MapRecord* rec; MapRecord* rec;
public: public:
DBloodLoadScreen(const char* caption, MapRecord* maprec, std::function<int(void)> callback_) : DScreenJob(fadein | fadeout), callback(callback_), rec(maprec) DBloodLoadScreen(const char* caption, MapRecord* maprec, std::function<int(void)> callback_) : DScreenJob(fadein | fadeout), callback(callback_), rec(maprec)
{ {
if (gGameOptions.nGameType == 0) pzLoadingScreenText1 = GStrings("TXTB_LLEVEL"); if (gGameOptions.nGameType == 0) pzLoadingScreenText1 = GStrings("TXTB_LLEVEL");
else pzLoadingScreenText1 = GStrings(FStringf("TXTB_NETGT%d", gGameOptions.nGameType)); else pzLoadingScreenText1 = GStrings(FStringf("TXTB_NETGT%d", gGameOptions.nGameType));
} }
int Frame(uint64_t clock, bool skiprequest) int Frame(uint64_t clock, bool skiprequest)
{ {
twod->ClearScreen(); twod->ClearScreen();
drawTextScreenBackground(); drawTextScreenBackground();
DrawMenuCaption(pzLoadingScreenText1); DrawMenuCaption(pzLoadingScreenText1);
viewDrawText(1, rec->DisplayName(), 160, 50, -128, 0, 1, 1); viewDrawText(1, rec->DisplayName(), 160, 50, -128, 0, 1, 1);
viewDrawText(3, GStrings("TXTB_PLSWAIT"), 160, 134, -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. // Initiate the level load once the page has been faded in completely.
if (callback && GetFadeState() == visible) if (callback && GetFadeState() == visible)
{ {
callback(); callback();
callback = nullptr; callback = nullptr;
} }
if (clock > 5'000'000'000) return 0; // make sure the screen stays long enough to be seen. if (clock > 5'000'000'000) return 0; // make sure the screen stays long enough to be seen.
return skiprequest ? -1 : 1; return skiprequest ? -1 : 1;
} }
}; };
END_BLD_NS END_BLD_NS

View file

@ -26,41 +26,29 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_BLD_NS 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 { class CKillMgr {
public: public:
int at0, at4; int TotalKills, Kills;
CKillMgr(); CKillMgr();
void SetCount(int); void SetCount(int);
void sub_263E0(int); void AddNewKill(int);
void AddKill(spritetype *pSprite); void AddKill(spritetype *pSprite);
void sub_2641C(void); void CountTotalKills(void);
void Clear(void); void Clear(void);
void Draw(void);
}; };
class CSecretMgr { class CSecretMgr {
public: public:
int at0, at4, at8; int Total, Founds, Super;
CSecretMgr(); CSecretMgr();
void SetCount(int); void SetCount(int);
void Found(int); void Found(int);
void Clear(void); void Clear(void);
void Draw(void);
}; };
extern CEndGameMgr gEndGameMgr;
extern CSecretMgr gSecretMgr; extern CSecretMgr gSecretMgr;
extern CKillMgr gKillMgr; extern CKillMgr gKillMgr;
void ShowSummaryScreen();
END_BLD_NS END_BLD_NS

View file

@ -46,7 +46,7 @@ struct FXDATA {
CALLBACK_ID funcID; // callback CALLBACK_ID funcID; // callback
char at1; // detail char at1; // detail
short at2; // seq short at2; // seq
short at4; // flags short Kills; // flags
int at6; // gravity int at6; // gravity
int ata; // air drag int ata; // air drag
int ate; 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; pSprite->xrepeat = pFX->at14;
if (pFX->at15 > 0) if (pFX->at15 > 0)
pSprite->yrepeat = pFX->at15; pSprite->yrepeat = pFX->at15;
if ((pFX->at4 & 1) && Chance(0x8000)) if ((pFX->Kills & 1) && Chance(0x8000))
pSprite->cstat |= 4; pSprite->cstat |= 4;
if ((pFX->at4 & 2) && Chance(0x8000)) if ((pFX->Kills & 2) && Chance(0x8000))
pSprite->cstat |= 8; pSprite->cstat |= 8;
if (pFX->at2) if (pFX->at2)
{ {

View file

@ -42,7 +42,7 @@ BEGIN_BLD_NS
struct GIBFX struct GIBFX
{ {
FX_ID at0; FX_ID TotalKills;
int at1; int at1;
int chance; int chance;
int at9; int at9;
@ -53,8 +53,8 @@ struct GIBFX
struct GIBTHING struct GIBTHING
{ {
int at0; int TotalKills;
int at4; int Kills;
int chance; int chance;
int atc; int atc;
int at10; int at10;
@ -62,8 +62,8 @@ struct GIBTHING
struct GIBLIST struct GIBLIST
{ {
GIBFX *at0; GIBFX *TotalKills;
int at4; int Kills;
GIBTHING *at8; GIBTHING *at8;
int atc; int atc;
int at10; int at10;
@ -295,7 +295,7 @@ int ChanceToCount(int a1, int a2)
void GibFX(spritetype *pSprite, GIBFX *pGFX, CGibPosition *pPos, CGibVelocity *pVel) void GibFX(spritetype *pSprite, GIBFX *pGFX, CGibPosition *pPos, CGibVelocity *pVel)
{ {
int nSector = pSprite->sectnum; 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; return;
CGibPosition gPos(pSprite->x, pSprite->y, pSprite->z); CGibPosition gPos(pSprite->x, pSprite->y, pSprite->z);
if (pPos) 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.y = pSprite->y+mulscale30(pSprite->clipdist<<2, Sin(nAngle));
gPos.z = bottom-Random(bottom-top); 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 (pFX)
{ {
if (pGFX->at1 < 0) 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) void GibThing(spritetype *pSprite, GIBTHING *pGThing, CGibPosition *pPos, CGibVelocity *pVel)
{ {
if (adult_lockout && gGameOptions.nGameType <= 0) if (adult_lockout && gGameOptions.nGameType <= 0)
switch (pGThing->at0) { switch (pGThing->TotalKills) {
case kThingBloodBits: case kThingBloodBits:
case kThingZombieHead: case kThingZombieHead:
return; return;
@ -391,10 +391,10 @@ void GibThing(spritetype *pSprite, GIBTHING *pGThing, CGibPosition *pPos, CGibVe
getzsofslope(nSector, x, y, &ceilZ, &floorZ); getzsofslope(nSector, x, y, &ceilZ, &floorZ);
int dz1 = floorZ-z; int dz1 = floorZ-z;
int dz2 = z-ceilZ; 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); dassert(pGib != NULL);
if (pGThing->at4 > -1) if (pGThing->Kills > -1)
pGib->picnum = pGThing->at4; pGib->picnum = pGThing->Kills;
if (pVel) if (pVel)
{ {
xvel[pGib->index] = pVel->vx+Random2(pGThing->atc); 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) if (pSprite->sectnum < 0 || pSprite->sectnum >= numsectors)
return; return;
GIBLIST *pGib = &gibList[nGibType]; 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); dassert(pGibFX->chance > 0);
GibFX(pSprite, pGibFX, pPos, pVel); 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 r1 = Random(a6);
int r2 = Random(a5); int r2 = Random(a5);
int r3 = Random(a4); 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 (pGib)
{ {
if (pGFX->at1 < 0) if (pGFX->at1 < 0)
@ -503,9 +503,9 @@ void GibWall(int nWall, GIBTYPE nGibType, CGibVelocity *pVel)
cz = (ceilZ+floorZ)>>1; cz = (ceilZ+floorZ)>>1;
GIBLIST *pGib = &gibList[nGibType]; GIBLIST *pGib = &gibList[nGibType];
sfxPlay3DSound(cx, cy, cz, pGib->at10, nSector); 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); dassert(pGibFX->chance > 0);
GibFX(nWall, pGibFX, ceilZ, wx, wy, wz, pVel); GibFX(nWall, pGibFX, ceilZ, wx, wy, wz, pVel);
} }
@ -520,8 +520,8 @@ void gibPrecache(void)
{ {
for (int j = 0; j < gibList[i].atc; j++) for (int j = 0; j < gibList[i].atc; j++)
{ {
if (pThing[j].at4 >= 0) if (pThing[j].Kills >= 0)
tilePrecacheTile(pThing[j].at4); tilePrecacheTile(pThing[j].Kills);
} }
} }
} }

View file

@ -38,8 +38,8 @@ int mirrorcnt, mirrorsector, mirrorwall[4];
typedef struct typedef struct
{ {
int at0; int TotalKills;
int at4; int Kills;
int at8; int at8;
int atc; int atc;
int at10; int at10;
@ -71,7 +71,7 @@ void InitMirrors(void)
{ {
wall[i].overpicnum = nTile; wall[i].overpicnum = nTile;
mirror[mirrorcnt].at14 = i; mirror[mirrorcnt].at14 = i;
mirror[mirrorcnt].at0 = 0; mirror[mirrorcnt].TotalKills = 0;
wall[i].cstat |= 32; wall[i].cstat |= 32;
int tmp = xwall[wall[i].extra].data; int tmp = xwall[wall[i].extra].data;
int j; int j;
@ -85,7 +85,7 @@ void InitMirrors(void)
continue; continue;
wall[i].hitag = j; wall[i].hitag = j;
wall[j].hitag = i; wall[j].hitag = i;
mirror[mirrorcnt].at4 = j; mirror[mirrorcnt].Kills = j;
break; break;
} }
} }
@ -97,10 +97,10 @@ void InitMirrors(void)
} }
if (wall[i].picnum == 504) if (wall[i].picnum == 504)
{ {
mirror[mirrorcnt].at4 = i; mirror[mirrorcnt].Kills = i;
mirror[mirrorcnt].at14 = i; mirror[mirrorcnt].at14 = i;
wall[i].picnum = nTile; wall[i].picnum = nTile;
mirror[mirrorcnt].at0 = 0; mirror[mirrorcnt].TotalKills = 0;
wall[i].cstat |= 32; wall[i].cstat |= 32;
mirrorcnt++; mirrorcnt++;
continue; continue;
@ -120,20 +120,20 @@ void InitMirrors(void)
int j = sprite[nLink2].sectnum; int j = sprite[nLink2].sectnum;
if (sector[j].ceilingpicnum != 504) if (sector[j].ceilingpicnum != 504)
ThrowError("Lower link sector %d doesn't have mirror picnum\n", j); 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].at8 = sprite[nLink2].x-sprite[nLink].x;
mirror[mirrorcnt].atc = sprite[nLink2].y-sprite[nLink].y; mirror[mirrorcnt].atc = sprite[nLink2].y-sprite[nLink].y;
mirror[mirrorcnt].at10 = sprite[nLink2].z-sprite[nLink].z; mirror[mirrorcnt].at10 = sprite[nLink2].z-sprite[nLink].z;
mirror[mirrorcnt].at14 = i; mirror[mirrorcnt].at14 = i;
mirror[mirrorcnt].at4 = j; mirror[mirrorcnt].Kills = j;
sector[i].floorpicnum = 4080+mirrorcnt; sector[i].floorpicnum = 4080+mirrorcnt;
mirrorcnt++; mirrorcnt++;
mirror[mirrorcnt].at0 = 1; mirror[mirrorcnt].TotalKills = 1;
mirror[mirrorcnt].at8 = sprite[nLink].x-sprite[nLink2].x; mirror[mirrorcnt].at8 = sprite[nLink].x-sprite[nLink2].x;
mirror[mirrorcnt].atc = sprite[nLink].y-sprite[nLink2].y; mirror[mirrorcnt].atc = sprite[nLink].y-sprite[nLink2].y;
mirror[mirrorcnt].at10 = sprite[nLink].z-sprite[nLink2].z; mirror[mirrorcnt].at10 = sprite[nLink].z-sprite[nLink2].z;
mirror[mirrorcnt].at14 = j; mirror[mirrorcnt].at14 = j;
mirror[mirrorcnt].at4 = i; mirror[mirrorcnt].Kills = i;
sector[j].ceilingpicnum = 4080+mirrorcnt; sector[j].ceilingpicnum = 4080+mirrorcnt;
mirrorcnt++; mirrorcnt++;
} }
@ -167,7 +167,7 @@ void sub_5571C(char mode)
int nTile = 4080+i; int nTile = 4080+i;
if (TestBitString(gotpic, nTile)) if (TestBitString(gotpic, nTile))
{ {
switch (mirror[i].at0) switch (mirror[i].TotalKills)
{ {
case 1: case 1:
if (mode) if (mode)
@ -200,9 +200,9 @@ void sub_557C4(int x, int y, int interpolation)
int nTile = 4080+i; int nTile = 4080+i;
if (TestBitString(gotpic, nTile)) 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; int nSector2 = mirror[i].at14;
for (int nSprite = headspritesect[nSector]; nSprite >= 0; nSprite = nextspritesect[nSprite]) 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)) if (pSprite->statnum == kStatDude && (top < zCeil || bottom > zFloor))
{ {
int j = i; int j = i;
if (mirror[i].at0 == 2) if (mirror[i].TotalKills == 2)
j++; j++;
else else
j--; 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)) if (TestBitString(gotpic, nTile))
{ {
ClearBitString(gotpic, nTile); ClearBitString(gotpic, nTile);
switch (mirror[i].at0) switch (mirror[i].TotalKills)
{ {
case 0: case 0:
{ {
int nWall = mirror[i].at4; int nWall = mirror[i].Kills;
int nSector = sectorofwall(nWall); int nSector = sectorofwall(nWall);
walltype *pWall = &wall[nWall]; walltype *pWall = &wall[nWall];
int nNextWall = pWall->nextwall; 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: case 1:
{ {
int nSector = mirror[i].at4; int nSector = mirror[i].Kills;
int bakCstat; int bakCstat;
if (viewPlayer >= 0) 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: case 2:
{ {
int nSector = mirror[i].at4; int nSector = mirror[i].Kills;
int bakCstat; int bakCstat;
if (viewPlayer >= 0) if (viewPlayer >= 0)
{ {

View file

@ -3676,7 +3676,7 @@ bool modernTypeOperateSprite(int nSprite, spritetype* pSprite, XSPRITE* pXSprite
return false; // go normal OperateSprite(); return false; // go normal OperateSprite();
XSPRITE* pXSpawn = &xsprite[pSpawn->extra]; XSPRITE* pXSpawn = &xsprite[pSpawn->extra];
gKillMgr.sub_263E0(1); gKillMgr.AddNewKill(1);
switch (pXSprite->data1) { switch (pXSprite->data1) {
case kDudeBurningInnocent: case kDudeBurningInnocent:
case kDudeBurningCultist: case kDudeBurningCultist:
@ -3739,7 +3739,7 @@ bool modernTypeOperateSprite(int nSprite, spritetype* pSprite, XSPRITE* pXSprite
modernTypeSetSpriteState(nSprite, pXSprite, pXSprite->state ^ 1); modernTypeSetSpriteState(nSprite, pXSprite, pXSprite->state ^ 1);
return true; return true;
case kModernCustomDudeSpawn: 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; return true;
case kModernSeqSpawner: case kModernSeqSpawner:
case kModernEffectSpawner: case kModernEffectSpawner:

View file

@ -167,8 +167,8 @@ AMMOINFO gAmmoInfo[] = {
}; };
struct ARMORDATA { struct ARMORDATA {
int at0; int TotalKills;
int at4; int Kills;
int at8; int at8;
int atc; int atc;
int at10; int at10;
@ -189,8 +189,8 @@ int nPlayerSurviveClient = seqRegisterClient(PlayerSurvive);
int nPlayerKneelClient = seqRegisterClient(PlayerKneelsOver); int nPlayerKneelClient = seqRegisterClient(PlayerKneelsOver);
struct VICTORY { struct VICTORY {
const char *at0; const char *TotalKills;
int at4; int Kills;
}; };
VICTORY gVictory[] = { VICTORY gVictory[] = {
@ -222,8 +222,8 @@ VICTORY gVictory[] = {
}; };
struct SUICIDE { struct SUICIDE {
const char *at0; const char *TotalKills;
int at4; int Kills;
}; };
SUICIDE gSuicide[] = { SUICIDE gSuicide[] = {
@ -235,8 +235,8 @@ SUICIDE gSuicide[] = {
}; };
struct DAMAGEINFO { struct DAMAGEINFO {
int at0; int TotalKills;
int at4[3]; int Kills[3];
int at10[3]; int at10[3];
}; };
@ -1037,8 +1037,8 @@ char PickupItem(PLAYER *pPlayer, spritetype *pItem) {
pickedUp = true; pickedUp = true;
} }
if (pPlayer->armor[0] < pArmorData->at4) { if (pPlayer->armor[0] < pArmorData->Kills) {
pPlayer->armor[0] = ClipHigh(pPlayer->armor[0]+pArmorData->at0, pArmorData->at4); pPlayer->armor[0] = ClipHigh(pPlayer->armor[0]+pArmorData->TotalKills, pArmorData->Kills);
pickedUp = true; pickedUp = true;
} }
@ -1860,7 +1860,7 @@ void playerFrag(PLAYER *pKiller, PLAYER *pVictim)
if (gGameOptions.nGameType == 3) if (gGameOptions.nGameType == 3)
dword_21EFB0[pVictim->teamId]--; dword_21EFB0[pVictim->teamId]--;
int nMessage = Random(5); int nMessage = Random(5);
int nSound = gSuicide[nMessage].at4; int nSound = gSuicide[nMessage].Kills;
if (pVictim == gMe && gMe->handTime <= 0) if (pVictim == gMe && gMe->handTime <= 0)
{ {
strcpy(buffer, GStrings("TXTB_KILLSELF")); strcpy(buffer, GStrings("TXTB_KILLSELF"));
@ -1869,7 +1869,7 @@ void playerFrag(PLAYER *pKiller, PLAYER *pVictim)
} }
else else
{ {
sprintf(buffer, gSuicide[nMessage].at0, gProfile[nVictim].name); sprintf(buffer, gSuicide[nMessage].TotalKills, gProfile[nVictim].name);
} }
} }
else else
@ -1890,8 +1890,8 @@ void playerFrag(PLAYER *pKiller, PLAYER *pVictim)
} }
} }
int nMessage = Random(25); int nMessage = Random(25);
int nSound = gVictory[nMessage].at4; int nSound = gVictory[nMessage].Kills;
const char* pzMessage = gVictory[nMessage].at0; const char* pzMessage = gVictory[nMessage].TotalKills;
sprintf(buffer, pzMessage, gProfile[nKiller].name, gProfile[nVictim].name); sprintf(buffer, pzMessage, gProfile[nKiller].name, gProfile[nVictim].name);
if (gGameOptions.nGameType > 0 && nSound >= 0 && pKiller == gMe) if (gGameOptions.nGameType > 0 && nSound >= 0 && pKiller == gMe)
sndStartSample(nSound, 255, 2, 0); sndStartSample(nSound, 255, 2, 0);
@ -1930,7 +1930,7 @@ void FragPlayer(PLAYER *pPlayer, int nSprite)
int playerDamageArmor(PLAYER *pPlayer, DAMAGE_TYPE nType, int nDamage) int playerDamageArmor(PLAYER *pPlayer, DAMAGE_TYPE nType, int nDamage)
{ {
DAMAGEINFO *pDamageInfo = &damageInfo[nType]; DAMAGEINFO *pDamageInfo = &damageInfo[nType];
int nArmorType = pDamageInfo->at0; int nArmorType = pDamageInfo->TotalKills;
if (nArmorType >= 0 && pPlayer->armor[nArmorType]) if (nArmorType >= 0 && pPlayer->armor[nArmorType])
{ {
#if 0 #if 0
@ -2043,9 +2043,9 @@ int playerDamageSprite(int nSource, PLAYER *pPlayer, DAMAGE_TYPE nDamageType, in
DAMAGEINFO *pDamageInfo = &damageInfo[nDamageType]; DAMAGEINFO *pDamageInfo = &damageInfo[nDamageType];
int nSound; int nSound;
if (nDamage >= (10<<4)) if (nDamage >= (10<<4))
nSound = pDamageInfo->at4[0]; nSound = pDamageInfo->Kills[0];
else else
nSound = pDamageInfo->at4[Random(3)]; nSound = pDamageInfo->Kills[Random(3)];
if (nDamageType == DAMAGE_TYPE_4 && pXSprite->medium == kMediumWater && !pPlayer->hand) if (nDamageType == DAMAGE_TYPE_4 && pXSprite->medium == kMediumWater && !pPlayer->hand)
nSound = 714; nSound = 714;
sfxPlay3DSound(pSprite, nSound, 0, 6); sfxPlay3DSound(pSprite, nSound, 0, 6);

View file

@ -31,31 +31,31 @@ BEGIN_BLD_NS
template <typename T> struct queueItem template <typename T> struct queueItem
{ {
uint32_t at0; // priority uint32_t TotalKills; // priority
T at4; // data T Kills; // data
bool operator>(const queueItem& other) const bool operator>(const queueItem& other) const
{ {
return at0 > other.at0; return TotalKills > other.TotalKills;
} }
bool operator<(const queueItem& other) const bool operator<(const queueItem& other) const
{ {
return at0 < other.at0; return TotalKills < other.TotalKills;
} }
bool operator>=(const queueItem& other) const bool operator>=(const queueItem& other) const
{ {
return at0 >= other.at0; return TotalKills >= other.TotalKills;
} }
bool operator<=(const queueItem& other) const bool operator<=(const queueItem& other) const
{ {
return at0 <= other.at0; return TotalKills <= other.TotalKills;
} }
bool operator!=(const queueItem& other) const bool operator!=(const queueItem& other) const
{ {
return at0 != other.at0; return TotalKills != other.TotalKills;
} }
bool operator==(const queueItem& other) const bool operator==(const queueItem& other) const
{ {
return at0 == other.at0; return TotalKills == other.TotalKills;
} }
}; };
@ -86,7 +86,7 @@ public:
void Upheap(void) void Upheap(void)
{ {
queueItem<T> item = queueItems[fNodeCount]; queueItem<T> item = queueItems[fNodeCount];
queueItems[0].at0 = 0; queueItems[0].TotalKills = 0;
uint32_t x = fNodeCount; uint32_t x = fNodeCount;
while (queueItems[x>>1] > item) while (queueItems[x>>1] > item)
{ {
@ -120,13 +120,13 @@ public:
{ {
dassert(fNodeCount < kPQueueSize); dassert(fNodeCount < kPQueueSize);
fNodeCount++; fNodeCount++;
queueItems[fNodeCount].at0 = a1; queueItems[fNodeCount].TotalKills = a1;
queueItems[fNodeCount].at4 = a2; queueItems[fNodeCount].Kills = a2;
Upheap(); Upheap();
} }
T Remove(void) T Remove(void)
{ {
T data = queueItems[1].at4; T data = queueItems[1].Kills;
queueItems[1] = queueItems[fNodeCount--]; queueItems[1] = queueItems[fNodeCount--];
Downheap(1); Downheap(1);
return data; return data;
@ -134,13 +134,13 @@ public:
uint32_t LowestPriority(void) uint32_t LowestPriority(void)
{ {
dassert(fNodeCount > 0); dassert(fNodeCount > 0);
return queueItems[1].at0; return queueItems[1].TotalKills;
} }
void Kill(std::function<bool(T)> pMatch) void Kill(std::function<bool(T)> pMatch)
{ {
for (unsigned int i = 1; i <= fNodeCount;) for (unsigned int i = 1; i <= fNodeCount;)
{ {
if (pMatch(queueItems[i].at4)) if (pMatch(queueItems[i].Kills))
Delete(i); Delete(i);
else else
i++; i++;
@ -168,19 +168,19 @@ public:
T Remove(void) T Remove(void)
{ {
dassert(stdQueue.size() > 0); dassert(stdQueue.size() > 0);
T data = stdQueue.begin()->at4; T data = stdQueue.begin()->Kills;
stdQueue.erase(stdQueue.begin()); stdQueue.erase(stdQueue.begin());
return data; return data;
} }
uint32_t LowestPriority(void) uint32_t LowestPriority(void)
{ {
return stdQueue.begin()->at0; return stdQueue.begin()->TotalKills;
} }
void Kill(std::function<bool(T)> pMatch) void Kill(std::function<bool(T)> pMatch)
{ {
for (auto i = stdQueue.begin(); i != stdQueue.end();) for (auto i = stdQueue.begin(); i != stdQueue.end();)
{ {
if (pMatch(i->at4)) if (pMatch(i->Kills))
i = stdQueue.erase(i); i = stdQueue.erase(i);
else else
i++; i++;

View file

@ -80,8 +80,8 @@ void viewInitializePrediction(void)
predict.at4c = gMe->spin; predict.at4c = gMe->spin;
predict.at6e = !!(gMe->input.actions & SB_CENTERVIEW); predict.at6e = !!(gMe->input.actions & SB_CENTERVIEW);
memcpy(&predict.at75,&gSpriteHit[gMe->pSprite->extra],sizeof(SPRITEHIT)); memcpy(&predict.at75,&gSpriteHit[gMe->pSprite->extra],sizeof(SPRITEHIT));
predict.at0 = gMe->bobPhase; predict.TotalKills = gMe->bobPhase;
predict.at4 = gMe->bobAmp; predict.Kills = gMe->bobAmp;
predict.at8 = gMe->bobHeight; predict.at8 = gMe->bobHeight;
predict.atc = gMe->bobWidth; predict.atc = gMe->bobWidth;
predict.at10 = gMe->swayPhase; predict.at10 = gMe->swayPhase;
@ -367,39 +367,39 @@ void fakePlayerProcess(PLAYER *pPlayer, InputPacket *pInput)
predict.at34 = predict.at40 - predict.at38 - (12<<8); predict.at34 = predict.at40 - predict.at38 - (12<<8);
predict.at0 = ClipLow(predict.at0-4, 0); predict.TotalKills = ClipLow(predict.TotalKills-4, 0);
nSpeed >>= FRACBITS; nSpeed >>= FRACBITS;
if (predict.at48 == 1) if (predict.at48 == 1)
{ {
predict.at4 = (predict.at4+17)&2047; predict.Kills = (predict.Kills+17)&2047;
predict.at14 = (predict.at14+17)&2047; predict.at14 = (predict.at14+17)&2047;
predict.at8 = mulscale30(10*pPosture->bobV,Sin(predict.at4*2)); predict.at8 = mulscale30(10*pPosture->bobV,Sin(predict.Kills*2));
predict.atc = mulscale30(predict.at0*pPosture->bobH,Sin(predict.at4-256)); predict.atc = mulscale30(predict.TotalKills*pPosture->bobH,Sin(predict.Kills-256));
predict.at18 = mulscale30(predict.at0*pPosture->swayV,Sin(predict.at14*2)); predict.at18 = mulscale30(predict.TotalKills*pPosture->swayV,Sin(predict.at14*2));
predict.at1c = mulscale30(predict.at0*pPosture->swayH,Sin(predict.at14-0x155)); predict.at1c = mulscale30(predict.TotalKills*pPosture->swayH,Sin(predict.at14-0x155));
} }
else else
{ {
if (pXSprite->height < 256) 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; predict.at14 = (predict.at14+(pPosture->pace[predict.at70]*4)/2)&2047;
if (predict.at70) if (predict.at70)
{ {
if (predict.at0 < 60) if (predict.TotalKills < 60)
predict.at0 = ClipHigh(predict.at0 + nSpeed, 60); predict.TotalKills = ClipHigh(predict.TotalKills + nSpeed, 60);
} }
else else
{ {
if (predict.at0 < 30) if (predict.TotalKills < 30)
predict.at0 = ClipHigh(predict.at0 + nSpeed, 30); predict.TotalKills = ClipHigh(predict.TotalKills + nSpeed, 30);
} }
} }
predict.at8 = mulscale30(predict.at0*pPosture->bobV,Sin(predict.at4*2)); predict.at8 = mulscale30(predict.TotalKills*pPosture->bobV,Sin(predict.Kills*2));
predict.atc = mulscale30(predict.at0*pPosture->bobH,Sin(predict.at4-256)); predict.atc = mulscale30(predict.TotalKills*pPosture->bobH,Sin(predict.Kills-256));
predict.at18 = mulscale30(predict.at0*pPosture->swayV,Sin(predict.at14*2)); predict.at18 = mulscale30(predict.TotalKills*pPosture->swayV,Sin(predict.at14*2));
predict.at1c = mulscale30(predict.at0*pPosture->swayH,Sin(predict.at14-0x155)); predict.at1c = mulscale30(predict.TotalKills*pPosture->swayH,Sin(predict.at14-0x155));
} }
if (!pXSprite->health) if (!pXSprite->health)
return; return;

View file

@ -238,11 +238,11 @@ private:
{ {
stats.completeColor = CR_DARKGREEN; stats.completeColor = CR_DARKGREEN;
stats.kills = gKillMgr.at4; stats.kills = gKillMgr.Kills;
stats.maxkills = gKillMgr.at0; stats.maxkills = gKillMgr.TotalKills;
stats.frags = gGameOptions.nGameType == 3? pPlayer->fragCount : -1; stats.frags = gGameOptions.nGameType == 3? pPlayer->fragCount : -1;
stats.secrets = gSecretMgr.at4 + gSecretMgr.at8; stats.secrets = gSecretMgr.Founds + gSecretMgr.Super;
stats.maxsecrets = gSecretMgr.at0; stats.maxsecrets = gSecretMgr.Total;
DBaseStatusBar::PrintLevelStats(stats); DBaseStatusBar::PrintLevelStats(stats);
} }

View file

@ -141,7 +141,7 @@ int sndGetRate(int format)
void SoundCallback(intptr_t val) void SoundCallback(intptr_t val)
{ {
SAMPLE2D *pChannel = (SAMPLE2D*)val; SAMPLE2D *pChannel = (SAMPLE2D*)val;
pChannel->at0 = 0; pChannel->TotalKills = 0;
} }
void sndStartSample(const char *pzSound, int nVolume, int nChannel) void sndStartSample(const char *pzSound, int nVolume, int nChannel)

View file

@ -29,8 +29,8 @@ BEGIN_BLD_NS
struct SAMPLE2D struct SAMPLE2D
{ {
int at0; int TotalKills;
char at4; char Kills;
}; // 9 bytes }; // 9 bytes
struct SFX struct SFX

View file

@ -176,8 +176,8 @@ enum BUSYID {
}; };
struct BUSY { struct BUSY {
int at0; int TotalKills;
int at4; int Kills;
int at8; int at8;
BUSYID atc; BUSYID atc;
}; };
@ -190,19 +190,19 @@ void AddBusy(int a1, BUSYID a2, int nDelta)
int i; int i;
for (i = 0; i < gBusyCount; 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; break;
} }
if (i == gBusyCount) if (i == gBusyCount)
{ {
if (gBusyCount == 128) if (gBusyCount == 128)
return; return;
gBusy[i].at0 = a1; gBusy[i].TotalKills = a1;
gBusy[i].atc = a2; gBusy[i].atc = a2;
gBusy[i].at8 = nDelta > 0 ? 0 : 65536; gBusy[i].at8 = nDelta > 0 ? 0 : 65536;
gBusyCount++; gBusyCount++;
} }
gBusy[i].at4 = nDelta; gBusy[i].Kills = nDelta;
} }
void ReverseBusy(int a1, BUSYID a2) void ReverseBusy(int a1, BUSYID a2)
@ -210,9 +210,9 @@ void ReverseBusy(int a1, BUSYID a2)
int i; int i;
for (i = 0; i < gBusyCount; 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; break;
} }
} }
@ -507,7 +507,7 @@ void OperateSprite(int nSprite, XSPRITE *pXSprite, EVENT event)
spritetype* pSpawn = actSpawnDude(pSprite, pXSprite->data1, -1, 0); spritetype* pSpawn = actSpawnDude(pSprite, pXSprite->data1, -1, 0);
if (pSpawn) { if (pSpawn) {
XSPRITE *pXSpawn = &xsprite[pSpawn->extra]; XSPRITE *pXSpawn = &xsprite[pSpawn->extra];
gKillMgr.sub_263E0(1); gKillMgr.AddNewKill(1);
switch (pXSprite->data1) { switch (pXSprite->data1) {
case kDudeBurningInnocent: case kDudeBurningInnocent:
case kDudeBurningCultist: case kDudeBurningCultist:
@ -1981,15 +1981,15 @@ void trProcessBusy(void)
for (int i = gBusyCount-1; i >= 0; i--) for (int i = gBusyCount-1; i >= 0; i--)
{ {
int oldBusy = gBusy[i].at8; int oldBusy = gBusy[i].at8;
gBusy[i].at8 = ClipRange(oldBusy+gBusy[i].at4*4, 0, 65536); gBusy[i].at8 = ClipRange(oldBusy+gBusy[i].Kills*4, 0, 65536);
int nStatus = gBusyProc[gBusy[i].atc](gBusy[i].at0, gBusy[i].at8); int nStatus = gBusyProc[gBusy[i].atc](gBusy[i].TotalKills, gBusy[i].at8);
switch (nStatus) { switch (nStatus) {
case 1: case 1:
gBusy[i].at8 = oldBusy; gBusy[i].at8 = oldBusy;
break; break;
case 2: case 2:
gBusy[i].at8 = oldBusy; gBusy[i].at8 = oldBusy;
gBusy[i].at4 = -gBusy[i].at4; gBusy[i].Kills = -gBusy[i].Kills;
break; break;
case 3: case 3:
gBusy[i] = gBusy[--gBusyCount]; gBusy[i] = gBusy[--gBusyCount];

View file

@ -224,7 +224,7 @@ void InitStatusBar(void)
} }
GameStats GameInterface::getStats() 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) void viewDrawMapTitle(void)

View file

@ -32,8 +32,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_BLD_NS BEGIN_BLD_NS
struct VIEW { struct VIEW {
int at0; int TotalKills;
int at4; int Kills;
int at8; // bob height int at8; // bob height
int atc; // bob width int atc; // bob width
int at10; int at10;

View file

@ -280,8 +280,8 @@ void StartQAV(PLAYER *pPlayer, int nWeaponQAV, int a3, char a4)
struct WEAPONTRACK struct WEAPONTRACK
{ {
int at0; // x aim speed int TotalKills; // x aim speed
int at4; // y aim speed int Kills; // y aim speed
int at8; // angle range int at8; // angle range
int atc; int atc;
int at10; // predict int at10; // predict
@ -433,9 +433,9 @@ void UpdateAimVector(PLAYER * pPlayer)
aim2 = aim; aim2 = aim;
RotateVector((int*)&aim2.dx, (int*)&aim2.dy, -pPSprite->ang); RotateVector((int*)&aim2.dx, (int*)&aim2.dy, -pPSprite->ang);
aim2.dz -= pPlayer->slope; aim2.dz -= pPlayer->slope;
pPlayer->relAim.dx = interpolate(pPlayer->relAim.dx, aim2.dx, pWeaponTrack->at0); pPlayer->relAim.dx = interpolate(pPlayer->relAim.dx, aim2.dx, pWeaponTrack->TotalKills);
pPlayer->relAim.dy = interpolate(pPlayer->relAim.dy, aim2.dy, pWeaponTrack->at0); pPlayer->relAim.dy = interpolate(pPlayer->relAim.dy, aim2.dy, pWeaponTrack->TotalKills);
pPlayer->relAim.dz = interpolate(pPlayer->relAim.dz, aim2.dz, pWeaponTrack->at4); pPlayer->relAim.dz = interpolate(pPlayer->relAim.dz, aim2.dz, pWeaponTrack->Kills);
pPlayer->aim = pPlayer->relAim; pPlayer->aim = pPlayer->relAim;
RotateVector((int*)&pPlayer->aim.dx, (int*)&pPlayer->aim.dy, pPSprite->ang); RotateVector((int*)&pPlayer->aim.dx, (int*)&pPlayer->aim.dy, pPSprite->ang);
pPlayer->aim.dz += pPlayer->slope; pPlayer->aim.dz += pPlayer->slope;
@ -444,8 +444,8 @@ void UpdateAimVector(PLAYER * pPlayer)
struct t_WeaponModes struct t_WeaponModes
{ {
int at0; int TotalKills;
int at4; int Kills;
}; };
t_WeaponModes weaponModes[] = { t_WeaponModes weaponModes[] = {
@ -471,7 +471,7 @@ void WeaponRaise(PLAYER *pPlayer)
int prevWeapon = pPlayer->curWeapon; int prevWeapon = pPlayer->curWeapon;
pPlayer->curWeapon = pPlayer->newWeapon; pPlayer->curWeapon = pPlayer->newWeapon;
pPlayer->newWeapon = 0; pPlayer->newWeapon = 0;
pPlayer->weaponAmmo = weaponModes[pPlayer->curWeapon].at4; pPlayer->weaponAmmo = weaponModes[pPlayer->curWeapon].Kills;
switch (pPlayer->curWeapon) switch (pPlayer->curWeapon)
{ {
case 1: // pitchfork case 1: // pitchfork
@ -1492,8 +1492,8 @@ void DropVoodoo(int nTrigger, PLAYER *pPlayer)
struct TeslaMissile struct TeslaMissile
{ {
int at0; // offset int TotalKills; // offset
int at4; // id int Kills; // id
int at8; // ammo use int at8; // ammo use
int atc; // sound int atc; // sound
int at10; // light int at10; // light
@ -1527,7 +1527,7 @@ void FireTesla(int nTrigger, PLAYER *pPlayer)
return; 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); UseAmmo(pPlayer, 7, pMissile->at8);
sfxPlay3DSound(pSprite, pMissile->atc, 1, 0); sfxPlay3DSound(pSprite, pMissile->atc, 1, 0);
pPlayer->visibility = pMissile->at10; pPlayer->visibility = pMissile->at10;
@ -1696,23 +1696,23 @@ char WeaponFindNext(PLAYER *pPlayer, int *a2, char bDir)
weapon = OrderNext[weapon]; weapon = OrderNext[weapon];
else else
weapon = OrderPrev[weapon]; weapon = OrderPrev[weapon];
if (weaponModes[weapon].at0 && pPlayer->hasWeapon[weapon]) if (weaponModes[weapon].TotalKills && pPlayer->hasWeapon[weapon])
{ {
if (weapon == 9) if (weapon == 9)
{ {
if (CheckAmmo(pPlayer, weaponModes[weapon].at4, 1)) if (CheckAmmo(pPlayer, weaponModes[weapon].Kills, 1))
break; break;
} }
else else
{ {
if (sub_4B2C8(pPlayer, weaponModes[weapon].at4, 1)) if (sub_4B2C8(pPlayer, weaponModes[weapon].Kills, 1))
break; break;
} }
} }
} while (weapon != pPlayer->curWeapon); } while (weapon != pPlayer->curWeapon);
if (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; weapon = 1;
} }
if (a2) if (a2)
@ -1724,11 +1724,11 @@ char WeaponFindLoaded(PLAYER *pPlayer, int *a2)
{ {
char v4 = 1; char v4 = 1;
int v14 = 0; 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; v14 = i;
v4 = pPlayer->curWeapon; v4 = pPlayer->curWeapon;
@ -1744,9 +1744,9 @@ char WeaponFindLoaded(PLAYER *pPlayer, int *a2)
int weapon = pPlayer->weaponOrder[vc][i]; int weapon = pPlayer->weaponOrder[vc][i];
if (pPlayer->hasWeapon[weapon]) 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) if (a2)
*a2 = j; *a2 = j;
@ -2149,10 +2149,10 @@ void WeaponProcess(PLAYER *pPlayer) {
return; return;
} }
int nWeapon = pPlayer->newWeapon; int nWeapon = pPlayer->newWeapon;
int v4c = weaponModes[nWeapon].at0; int v4c = weaponModes[nWeapon].TotalKills;
if (!pPlayer->curWeapon) if (!pPlayer->curWeapon)
{ {
int nAmmoType = weaponModes[nWeapon].at4; int nAmmoType = weaponModes[nWeapon].Kills;
if (v4c > 1) if (v4c > 1)
{ {
if (CheckAmmo(pPlayer, nAmmoType, 1) || nAmmoType == 11) if (CheckAmmo(pPlayer, nAmmoType, 1) || nAmmoType == 11)
@ -2191,7 +2191,7 @@ void WeaponProcess(PLAYER *pPlayer) {
for (; i <= v4c; i++) for (; i <= v4c; i++)
{ {
int v6c = (pPlayer->weaponMode[nWeapon]+i)%v4c; 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); WeaponLower(pPlayer);
pPlayer->weaponMode[nWeapon] = v6c; pPlayer->weaponMode[nWeapon] = v6c;