From 44805e29b3bb6f476431132fe6d85581c5739af0 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 7 Nov 2020 13:46:03 +0100 Subject: [PATCH] - changed parameter of aiNewState to DBloodActor --- source/blood/src/actor.cpp | 34 ++-- source/blood/src/ai.cpp | 336 +++++++++++++++++----------------- source/blood/src/ai.h | 2 +- source/blood/src/aibat.cpp | 44 ++--- source/blood/src/aibeast.cpp | 62 +++---- source/blood/src/aiboneel.cpp | 47 ++--- source/blood/src/aiburn.cpp | 70 +++---- source/blood/src/aicaleb.cpp | 50 ++--- source/blood/src/aicerber.cpp | 44 ++--- source/blood/src/aicult.cpp | 152 +++++++-------- source/blood/src/aigarg.cpp | 42 ++--- source/blood/src/aighost.cpp | 28 +-- source/blood/src/aigilbst.cpp | 52 +++--- source/blood/src/aihand.cpp | 12 +- source/blood/src/aihound.cpp | 14 +- source/blood/src/aiinnoc.cpp | 12 +- source/blood/src/aipod.cpp | 20 +- source/blood/src/airat.cpp | 12 +- source/blood/src/aispid.cpp | 20 +- source/blood/src/aitchern.cpp | 21 ++- source/blood/src/aizomba.cpp | 22 +-- source/blood/src/aizombf.cpp | 34 ++-- source/blood/src/nnexts.cpp | 6 +- 23 files changed, 573 insertions(+), 563 deletions(-) diff --git a/source/blood/src/actor.cpp b/source/blood/src/actor.cpp index 93ef7cfab..a6889f6a8 100644 --- a/source/blood/src/actor.cpp +++ b/source/blood/src/actor.cpp @@ -3009,7 +3009,7 @@ void actKillDude(int nKillerSprite, spritetype *pSprite, DAMAGE_TYPE damageType, if (damageType == DAMAGE_TYPE_1 && pXSprite->medium == kMediumNormal) { pSprite->type = kDudeBurningCultist; - aiNewState(pSprite, pXSprite, &cultistBurnGoto); + aiNewState(&bloodActors[pXSprite->reference], &cultistBurnGoto); actHealDude(pXSprite, dudeInfo[40].startHealth, dudeInfo[40].startHealth); return; } @@ -3019,7 +3019,7 @@ void actKillDude(int nKillerSprite, spritetype *pSprite, DAMAGE_TYPE damageType, if (damageType == DAMAGE_TYPE_1 && pXSprite->medium == kMediumNormal) { pSprite->type = kDudeBurningBeast; - aiNewState(pSprite, pXSprite, &beastBurnGoto); + aiNewState(&bloodActors[pXSprite->reference], &beastBurnGoto); actHealDude(pXSprite, dudeInfo[53].startHealth, dudeInfo[53].startHealth); return; } @@ -3029,7 +3029,7 @@ void actKillDude(int nKillerSprite, spritetype *pSprite, DAMAGE_TYPE damageType, if (damageType == DAMAGE_TYPE_1 && pXSprite->medium == kMediumNormal) { pSprite->type = kDudeBurningInnocent; - aiNewState(pSprite, pXSprite, &innocentBurnGoto); + aiNewState(&bloodActors[pXSprite->reference], &innocentBurnGoto); actHealDude(pXSprite, dudeInfo[39].startHealth, dudeInfo[39].startHealth); return; } @@ -4758,10 +4758,10 @@ void MoveDude(spritetype *pSprite) switch (pSprite->type) { case kDudeCultistTommy: case kDudeCultistShotgun: - aiNewState(pSprite, pXSprite, &cultistGoto); + aiNewState(&bloodActors[pXSprite->reference], &cultistGoto); break; case kDudeGillBeast: - aiNewState(pSprite, pXSprite, &gillBeastGoto); + aiNewState(&bloodActors[pXSprite->reference], &gillBeastGoto); pSprite->flags |= 6; break; case kDudeBoneEel: @@ -4805,7 +4805,7 @@ void MoveDude(spritetype *pSprite) pXSprite->burnTime = 0; evPost(nSprite, 3, 0, kCallbackEnemeyBubble); sfxPlay3DSound(pSprite, 720, -1, 0); - aiNewState(pSprite, pXSprite, &cultistSwimGoto); + aiNewState(&bloodActors[pXSprite->reference], &cultistSwimGoto); break; case kDudeBurningCultist: { @@ -4815,7 +4815,7 @@ void MoveDude(spritetype *pSprite) pXSprite->burnTime = 0; evPost(nSprite, 3, 0, kCallbackEnemeyBubble); sfxPlay3DSound(pSprite, 720, -1, 0); - aiNewState(pSprite, pXSprite, &cultistSwimGoto); + aiNewState(&bloodActors[pXSprite->reference], &cultistSwimGoto); } else { @@ -4823,7 +4823,7 @@ void MoveDude(spritetype *pSprite) pXSprite->burnTime = 0; evPost(nSprite, 3, 0, kCallbackEnemeyBubble); sfxPlay3DSound(pSprite, 720, -1, 0); - aiNewState(pSprite, pXSprite, &cultistSwimGoto); + aiNewState(&bloodActors[pXSprite->reference], &cultistSwimGoto); } break; } @@ -4831,19 +4831,19 @@ void MoveDude(spritetype *pSprite) pXSprite->burnTime = 0; evPost(nSprite, 3, 0, kCallbackEnemeyBubble); sfxPlay3DSound(pSprite, 720, -1, 0); - aiNewState(pSprite, pXSprite, &zombieAGoto); + aiNewState(&bloodActors[pXSprite->reference], &zombieAGoto); break; case kDudeZombieButcher: pXSprite->burnTime = 0; evPost(nSprite, 3, 0, kCallbackEnemeyBubble); sfxPlay3DSound(pSprite, 720, -1, 0); - aiNewState(pSprite, pXSprite, &zombieFGoto); + aiNewState(&bloodActors[pXSprite->reference], &zombieFGoto); break; case kDudeGillBeast: pXSprite->burnTime = 0; evPost(nSprite, 3, 0, kCallbackEnemeyBubble); sfxPlay3DSound(pSprite, 720, -1, 0); - aiNewState(pSprite, pXSprite, &gillBeastSwimGoto); + aiNewState(&bloodActors[pXSprite->reference], &gillBeastSwimGoto); pSprite->flags &= ~6; break; @@ -4887,7 +4887,7 @@ void MoveDude(spritetype *pSprite) pXSprite->burnTime = 0; evPost(nSprite, 3, 0, kCallbackEnemeyBubble); sfxPlay3DSound(pSprite, 720, -1, 0); - aiNewState(pSprite, pXSprite, &cultistSwimGoto); + aiNewState(actor, &cultistSwimGoto); break; case kDudeBurningCultist: if (Chance(0x400)) @@ -4896,7 +4896,7 @@ void MoveDude(spritetype *pSprite) pXSprite->burnTime = 0; evPost(nSprite, 3, 0, kCallbackEnemeyBubble); sfxPlay3DSound(pSprite, 720, -1, 0); - aiNewState(pSprite, pXSprite, &cultistSwimGoto); + aiNewState(actor, &cultistSwimGoto); } else { @@ -4904,26 +4904,26 @@ void MoveDude(spritetype *pSprite) pXSprite->burnTime = 0; evPost(nSprite, 3, 0, kCallbackEnemeyBubble); sfxPlay3DSound(pSprite, 720, -1, 0); - aiNewState(pSprite, pXSprite, &cultistSwimGoto); + aiNewState(actor, &cultistSwimGoto); } break; case kDudeZombieAxeNormal: pXSprite->burnTime = 0; evPost(nSprite, 3, 0, kCallbackEnemeyBubble); sfxPlay3DSound(pSprite, 720, -1, 0); - aiNewState(pSprite, pXSprite, &zombieAGoto); + aiNewState(actor, &zombieAGoto); break; case kDudeZombieButcher: pXSprite->burnTime = 0; evPost(nSprite, 3, 0, kCallbackEnemeyBubble); sfxPlay3DSound(pSprite, 720, -1, 0); - aiNewState(pSprite, pXSprite, &zombieFGoto); + aiNewState(actor, &zombieFGoto); break; case kDudeGillBeast: pXSprite->burnTime = 0; evPost(nSprite, 3, 0, kCallbackEnemeyBubble); sfxPlay3DSound(pSprite, 720, -1, 0); - aiNewState(pSprite, pXSprite, &gillBeastSwimGoto); + aiNewState(actor, &gillBeastSwimGoto); pSprite->flags &= ~6; break; case kDudeGargoyleFlesh: diff --git a/source/blood/src/ai.cpp b/source/blood/src/ai.cpp index ec572f6f8..a61a3357c 100644 --- a/source/blood/src/ai.cpp +++ b/source/blood/src/ai.cpp @@ -85,8 +85,10 @@ void aiPlay3DSound(spritetype *pSprite, int a2, AI_SFX_PRIORITY a3, int a4) } } -void aiNewState(spritetype *pSprite, XSPRITE *pXSprite, AISTATE *pAIState) +void aiNewState(DBloodActor* actor, AISTATE *pAIState) { + auto pXSprite = &actor->x(); + auto pSprite = &actor->s(); DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); pXSprite->stateTimer = pAIState->stateTicks; pXSprite->aiState = pAIState; @@ -341,11 +343,11 @@ void aiActivateDude(DBloodActor* actor) pDudeExtraE->xval3 = 1; pDudeExtraE->xval1 = 0; if (pXSprite->target == -1) - aiNewState(pSprite, pXSprite, &ghostSearch); + aiNewState(actor, &ghostSearch); else { aiPlay3DSound(pSprite, 1600, AI_SFX_PRIORITY_1, -1); - aiNewState(pSprite, pXSprite, &ghostChase); + aiNewState(actor, &ghostChase); } break; } @@ -361,7 +363,7 @@ void aiActivateDude(DBloodActor* actor) if (pXSprite->target == -1) { switch (pXSprite->medium) { case kMediumNormal: - aiNewState(pSprite, pXSprite, &cultistSearch); + aiNewState(actor, &cultistSearch); if (Chance(0x8000)) { if (pSprite->type == kDudeCultistTommy) aiPlay3DSound(pSprite, 4008+Random(5), AI_SFX_PRIORITY_1, -1); else aiPlay3DSound(pSprite, 1008+Random(5), AI_SFX_PRIORITY_1, -1); @@ -369,7 +371,7 @@ void aiActivateDude(DBloodActor* actor) break; case kMediumWater: case kMediumGoo: - aiNewState(pSprite, pXSprite, &cultistSwimSearch); + aiNewState(actor, &cultistSwimSearch); break; } } else { @@ -379,12 +381,12 @@ void aiActivateDude(DBloodActor* actor) } switch (pXSprite->medium) { case kMediumNormal: - if (pSprite->type == kDudeCultistTommy) aiNewState(pSprite, pXSprite, &fanaticChase); - else aiNewState(pSprite, pXSprite, &cultistChase); + if (pSprite->type == kDudeCultistTommy) aiNewState(actor, &fanaticChase); + else aiNewState(actor, &cultistChase); break; case kMediumWater: case kMediumGoo: - aiNewState(pSprite, pXSprite, &cultistSwimChase); + aiNewState(actor, &cultistSwimChase); break; } } @@ -418,13 +420,13 @@ void aiActivateDude(DBloodActor* actor) if (pXSprite->target == -1) { switch (pXSprite->medium) { case 0: - aiNewState(pSprite, pXSprite, &cultistSearch); + aiNewState(actor, &cultistSearch); if (Chance(0x8000)) aiPlay3DSound(pSprite, 4008+Random(5), AI_SFX_PRIORITY_1, -1); break; case kMediumWater: case kMediumGoo: - aiNewState(pSprite, pXSprite, &cultistSwimSearch); + aiNewState(actor, &cultistSwimSearch); break; } } else { @@ -433,11 +435,11 @@ void aiActivateDude(DBloodActor* actor) switch (pXSprite->medium) { case kMediumNormal: - aiNewState(pSprite, pXSprite, &cultistProneChase); + aiNewState(actor, &cultistProneChase); break; case kMediumWater: case kMediumGoo: - aiNewState(pSprite, pXSprite, &cultistSwimChase); + aiNewState(actor, &cultistSwimChase); break; } } @@ -454,13 +456,13 @@ void aiActivateDude(DBloodActor* actor) switch (pXSprite->medium) { case kMediumNormal: - aiNewState(pSprite, pXSprite, &cultistSearch); + aiNewState(actor, &cultistSearch); if (Chance(0x8000)) aiPlay3DSound(pSprite, 1008+Random(5), AI_SFX_PRIORITY_1, -1); break; case kMediumWater: case kMediumGoo: - aiNewState(pSprite, pXSprite, &cultistSwimSearch); + aiNewState(actor, &cultistSwimSearch); break; } } @@ -471,11 +473,11 @@ void aiActivateDude(DBloodActor* actor) switch (pXSprite->medium) { case kMediumNormal: - aiNewState(pSprite, pXSprite, &cultistProneChase); + aiNewState(actor, &cultistProneChase); break; case kMediumWater: case kMediumGoo: - aiNewState(pSprite, pXSprite, &cultistSwimChase); + aiNewState(actor, &cultistSwimChase); break; } } @@ -483,9 +485,9 @@ void aiActivateDude(DBloodActor* actor) } case kDudeBurningCultist: if (pXSprite->target == -1) - aiNewState(pSprite, pXSprite, &cultistBurnSearch); + aiNewState(actor, &cultistBurnSearch); else - aiNewState(pSprite, pXSprite, &cultistBurnChase); + aiNewState(actor, &cultistBurnChase); break; case kDudeBat: { @@ -496,12 +498,12 @@ void aiActivateDude(DBloodActor* actor) if (!pSprite->flags) pSprite->flags = 9; if (pXSprite->target == -1) - aiNewState(pSprite, pXSprite, &batSearch); + aiNewState(actor, &batSearch); else { if (Chance(0xa000)) aiPlay3DSound(pSprite, 2000, AI_SFX_PRIORITY_1, -1); - aiNewState(pSprite, pXSprite, &batChase); + aiNewState(actor, &batChase); } break; } @@ -512,14 +514,14 @@ void aiActivateDude(DBloodActor* actor) pDudeExtraE->xval3 = 1; pDudeExtraE->xval1 = 0; if (pXSprite->target == -1) - aiNewState(pSprite, pXSprite, &eelSearch); + aiNewState(actor, &eelSearch); else { if (Chance(0x8000)) aiPlay3DSound(pSprite, 1501, AI_SFX_PRIORITY_1, -1); else aiPlay3DSound(pSprite, 1500, AI_SFX_PRIORITY_1, -1); - aiNewState(pSprite, pXSprite, &eelChase); + aiNewState(actor, &eelChase); } break; } @@ -534,9 +536,9 @@ void aiActivateDude(DBloodActor* actor) if (pXSprite->target == -1) { if (pXSector && pXSector->Underwater) - aiNewState(pSprite, pXSprite, &gillBeastSwimSearch); + aiNewState(actor, &gillBeastSwimSearch); else - aiNewState(pSprite, pXSprite, &gillBeastSearch); + aiNewState(actor, &gillBeastSearch); } else { @@ -545,9 +547,9 @@ void aiActivateDude(DBloodActor* actor) else aiPlay3DSound(pSprite, 1700, AI_SFX_PRIORITY_1, -1); if (pXSector && pXSector->Underwater) - aiNewState(pSprite, pXSprite, &gillBeastSwimChase); + aiNewState(actor, &gillBeastSwimChase); else - aiNewState(pSprite, pXSprite, &gillBeastChase); + aiNewState(actor, &gillBeastChase); } break; } @@ -556,7 +558,7 @@ void aiActivateDude(DBloodActor* actor) pDudeExtraE->xval2 = 1; pDudeExtraE->xval1 = 0; if (pXSprite->target == -1) - aiNewState(pSprite, pXSprite, &zombieASearch); + aiNewState(actor, &zombieASearch); else { if (Chance(0xa000)) @@ -576,7 +578,7 @@ void aiActivateDude(DBloodActor* actor) break; } } - aiNewState(pSprite, pXSprite, &zombieAChase); + aiNewState(actor, &zombieAChase); } break; } @@ -586,7 +588,7 @@ void aiActivateDude(DBloodActor* actor) pDudeExtraE->xval2 = 1; pDudeExtraE->xval1 = 0; if (pXSprite->aiState == &zombieEIdle) - aiNewState(pSprite, pXSprite, &zombieEUp); + aiNewState(actor, &zombieEUp); break; } case kDudeZombieAxeLaying: @@ -595,7 +597,7 @@ void aiActivateDude(DBloodActor* actor) pDudeExtraE->xval2 = 1; pDudeExtraE->xval1 = 0; if (pXSprite->aiState == &zombieSIdle) - aiNewState(pSprite, pXSprite, &zombie13AC2C); + aiNewState(actor, &zombie13AC2C); break; } case kDudeZombieButcher: { @@ -603,28 +605,28 @@ void aiActivateDude(DBloodActor* actor) pDudeExtraE->xval2 = 1; pDudeExtraE->xval1 = 0; if (pXSprite->target == -1) - aiNewState(pSprite, pXSprite, &zombieFSearch); + aiNewState(actor, &zombieFSearch); else { if (Chance(0x4000)) aiPlay3DSound(pSprite, 1201, AI_SFX_PRIORITY_1, -1); else aiPlay3DSound(pSprite, 1200, AI_SFX_PRIORITY_1, -1); - aiNewState(pSprite, pXSprite, &zombieFChase); + aiNewState(actor, &zombieFChase); } break; } case kDudeBurningZombieAxe: if (pXSprite->target == -1) - aiNewState(pSprite, pXSprite, &zombieABurnSearch); + aiNewState(actor, &zombieABurnSearch); else - aiNewState(pSprite, pXSprite, &zombieABurnChase); + aiNewState(actor, &zombieABurnChase); break; case kDudeBurningZombieButcher: if (pXSprite->target == -1) - aiNewState(pSprite, pXSprite, &zombieFBurnSearch); + aiNewState(actor, &zombieFBurnSearch); else - aiNewState(pSprite, pXSprite, &zombieFBurnChase); + aiNewState(actor, &zombieFBurnChase); break; case kDudeGargoyleFlesh: { DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1; @@ -632,14 +634,14 @@ void aiActivateDude(DBloodActor* actor) pDudeExtraE->xval3 = 1; pDudeExtraE->xval1 = 0; if (pXSprite->target == -1) - aiNewState(pSprite, pXSprite, &gargoyleFSearch); + aiNewState(actor, &gargoyleFSearch); else { if (Chance(0x4000)) aiPlay3DSound(pSprite, 1401, AI_SFX_PRIORITY_1, -1); else aiPlay3DSound(pSprite, 1400, AI_SFX_PRIORITY_1, -1); - aiNewState(pSprite, pXSprite, &gargoyleFChase); + aiNewState(actor, &gargoyleFChase); } break; } @@ -650,14 +652,14 @@ void aiActivateDude(DBloodActor* actor) pDudeExtraE->xval3 = 1; pDudeExtraE->xval1 = 0; if (pXSprite->target == -1) - aiNewState(pSprite, pXSprite, &gargoyleFSearch); + aiNewState(actor, &gargoyleFSearch); else { if (Chance(0x4000)) aiPlay3DSound(pSprite, 1451, AI_SFX_PRIORITY_1, -1); else aiPlay3DSound(pSprite, 1450, AI_SFX_PRIORITY_1, -1); - aiNewState(pSprite, pXSprite, &gargoyleFChase); + aiNewState(actor, &gargoyleFChase); } break; } @@ -667,85 +669,85 @@ void aiActivateDude(DBloodActor* actor) #ifdef NOONE_EXTENSIONS // play gargoyle statue breaking animation if data1 = 1. if (gModernMap && pXSprite->data1 == 1) { - if (pSprite->type == kDudeGargoyleStatueFlesh) aiNewState(pSprite, pXSprite, &statueFBreakSEQ); - else aiNewState(pSprite, pXSprite, &statueSBreakSEQ); + if (pSprite->type == kDudeGargoyleStatueFlesh) aiNewState(actor, &statueFBreakSEQ); + else aiNewState(actor, &statueSBreakSEQ); } else { if (Chance(0x4000)) aiPlay3DSound(pSprite, 1401, AI_SFX_PRIORITY_1, -1); else aiPlay3DSound(pSprite, 1400, AI_SFX_PRIORITY_1, -1); - if (pSprite->type == kDudeGargoyleStatueFlesh) aiNewState(pSprite, pXSprite, &gargoyleFMorph); - else aiNewState(pSprite, pXSprite, &gargoyleSMorph); + if (pSprite->type == kDudeGargoyleStatueFlesh) aiNewState(actor, &gargoyleFMorph); + else aiNewState(actor, &gargoyleSMorph); } #else if (Chance(0x4000)) aiPlay3DSound(pSprite, 1401, AI_SFX_PRIORITY_1, -1); else aiPlay3DSound(pSprite, 1400, AI_SFX_PRIORITY_1, -1); - if (pSprite->type == kDudeGargoyleStatueFlesh) aiNewState(pSprite, pXSprite, &gargoyleFMorph); - else aiNewState(pSprite, pXSprite, &gargoyleSMorph); + if (pSprite->type == kDudeGargoyleStatueFlesh) aiNewState(actor, &gargoyleFMorph); + else aiNewState(actor, &gargoyleSMorph); #endif break; case kDudeCerberusTwoHead: if (pXSprite->target == -1) - aiNewState(pSprite, pXSprite, &cerberusSearch); + aiNewState(actor, &cerberusSearch); else { aiPlay3DSound(pSprite, 2300, AI_SFX_PRIORITY_1, -1); - aiNewState(pSprite, pXSprite, &cerberusChase); + aiNewState(actor, &cerberusChase); } break; case kDudeCerberusOneHead: if (pXSprite->target == -1) - aiNewState(pSprite, pXSprite, &cerberus2Search); + aiNewState(actor, &cerberus2Search); else { aiPlay3DSound(pSprite, 2300, AI_SFX_PRIORITY_1, -1); - aiNewState(pSprite, pXSprite, &cerberus2Chase); + aiNewState(actor, &cerberus2Chase); } break; case kDudeHellHound: if (pXSprite->target == -1) - aiNewState(pSprite, pXSprite, &houndSearch); + aiNewState(actor, &houndSearch); else { aiPlay3DSound(pSprite, 1300, AI_SFX_PRIORITY_1, -1); - aiNewState(pSprite, pXSprite, &houndChase); + aiNewState(actor, &houndChase); } break; case kDudeHand: if (pXSprite->target == -1) - aiNewState(pSprite, pXSprite, &handSearch); + aiNewState(actor, &handSearch); else { aiPlay3DSound(pSprite, 1900, AI_SFX_PRIORITY_1, -1); - aiNewState(pSprite, pXSprite, &handChase); + aiNewState(actor, &handChase); } break; case kDudeRat: if (pXSprite->target == -1) - aiNewState(pSprite, pXSprite, &ratSearch); + aiNewState(actor, &ratSearch); else { aiPlay3DSound(pSprite, 2100, AI_SFX_PRIORITY_1, -1); - aiNewState(pSprite, pXSprite, &ratChase); + aiNewState(actor, &ratChase); } break; case kDudeInnocent: if (pXSprite->target == -1) - aiNewState(pSprite, pXSprite, &innocentSearch); + aiNewState(actor, &innocentSearch); else { if (pXSprite->health > 0) aiPlay3DSound(pSprite, 7000+Random(6), AI_SFX_PRIORITY_1, -1); - aiNewState(pSprite, pXSprite, &innocentChase); + aiNewState(actor, &innocentChase); } break; case kDudeTchernobog: if (pXSprite->target == -1) - aiNewState(pSprite, pXSprite, &tchernobogSearch); + aiNewState(actor, &tchernobogSearch); else { aiPlay3DSound(pSprite, 2350+Random(7), AI_SFX_PRIORITY_1, -1); - aiNewState(pSprite, pXSprite, &tchernobogChase); + aiNewState(actor, &tchernobogChase); } break; case kDudeSpiderBrown: @@ -754,11 +756,11 @@ void aiActivateDude(DBloodActor* actor) pSprite->flags |= 2; pSprite->cstat &= ~8; if (pXSprite->target == -1) - aiNewState(pSprite, pXSprite, &spidSearch); + aiNewState(actor, &spidSearch); else { aiPlay3DSound(pSprite, 1800, AI_SFX_PRIORITY_1, -1); - aiNewState(pSprite, pXSprite, &spidChase); + aiNewState(actor, &spidChase); } break; case kDudeSpiderMother: { @@ -768,11 +770,11 @@ void aiActivateDude(DBloodActor* actor) pSprite->flags |= 2; pSprite->cstat &= ~8; if (pXSprite->target == -1) - aiNewState(pSprite, pXSprite, &spidSearch); + aiNewState(actor, &spidSearch); else { aiPlay3DSound(pSprite, 1853+Random(1), AI_SFX_PRIORITY_1, -1); - aiNewState(pSprite, pXSprite, &spidChase); + aiNewState(actor, &spidChase); } break; } @@ -786,11 +788,11 @@ void aiActivateDude(DBloodActor* actor) switch (pXSprite->medium) { case kMediumNormal: - aiNewState(pSprite, pXSprite, &tinycalebSearch); + aiNewState(actor, &tinycalebSearch); break; case kMediumWater: case kMediumGoo: - aiNewState(pSprite, pXSprite, &tinycalebSwimSearch); + aiNewState(actor, &tinycalebSwimSearch); break; } } @@ -799,11 +801,11 @@ void aiActivateDude(DBloodActor* actor) switch (pXSprite->medium) { case kMediumNormal: - aiNewState(pSprite, pXSprite, &tinycalebChase); + aiNewState(actor, &tinycalebChase); break; case kMediumWater: case kMediumGoo: - aiNewState(pSprite, pXSprite, &tinycalebSwimChase); + aiNewState(actor, &tinycalebSwimChase); break; } } @@ -819,11 +821,11 @@ void aiActivateDude(DBloodActor* actor) switch (pXSprite->medium) { case kMediumNormal: - aiNewState(pSprite, pXSprite, &beastSearch); + aiNewState(actor, &beastSearch); break; case kMediumWater: case kMediumGoo: - aiNewState(pSprite, pXSprite, &beastSwimSearch); + aiNewState(actor, &beastSwimSearch); break; } } @@ -833,11 +835,11 @@ void aiActivateDude(DBloodActor* actor) switch (pXSprite->medium) { case kMediumNormal: - aiNewState(pSprite, pXSprite, &beastChase); + aiNewState(actor, &beastChase); break; case kMediumWater: case kMediumGoo: - aiNewState(pSprite, pXSprite, &beastSwimChase); + aiNewState(actor, &beastSwimChase); break; } } @@ -846,24 +848,24 @@ void aiActivateDude(DBloodActor* actor) case kDudePodGreen: case kDudePodFire: if (pXSprite->target == -1) - aiNewState(pSprite, pXSprite, &podSearch); + aiNewState(actor, &podSearch); else { if (pSprite->type == kDudePodFire) aiPlay3DSound(pSprite, 2453, AI_SFX_PRIORITY_1, -1); else aiPlay3DSound(pSprite, 2473, AI_SFX_PRIORITY_1, -1); - aiNewState(pSprite, pXSprite, &podChase); + aiNewState(actor, &podChase); } break; case kDudeTentacleGreen: case kDudeTentacleFire: if (pXSprite->target == -1) - aiNewState(pSprite, pXSprite, &tentacleSearch); + aiNewState(actor, &tentacleSearch); else { aiPlay3DSound(pSprite, 2503, AI_SFX_PRIORITY_1, -1); - aiNewState(pSprite, pXSprite, &tentacleChase); + aiNewState(actor, &tentacleChase); } break; } @@ -900,6 +902,7 @@ int aiDamageSprite(spritetype *pSprite, XSPRITE *pXSprite, int nSource, DAMAGE_T assert(nSource < kMaxSprites); if (!pXSprite->health) return 0; + auto actor = &bloodActors[pXSprite->reference]; pXSprite->health = ClipLow(pXSprite->health - nDamage, 0); cumulDamage[pSprite->extra] += nDamage; DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); @@ -928,16 +931,16 @@ int aiDamageSprite(spritetype *pSprite, XSPRITE *pXSprite, int nSource, DAMAGE_T if (nDmgType != DAMAGE_TYPE_1) { if (!dudeIsPlayingSeq(pSprite, 14) && !pXSprite->medium) - aiNewState(pSprite, pXSprite, &cultistDodge); + aiNewState(actor, &cultistDodge); else if (dudeIsPlayingSeq(pSprite, 14) && !pXSprite->medium) - aiNewState(pSprite, pXSprite, &cultistProneDodge); + aiNewState(actor, &cultistProneDodge); else if (dudeIsPlayingSeq(pSprite, 13) && (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo)) - aiNewState(pSprite, pXSprite, &cultistSwimDodge); + aiNewState(actor, &cultistSwimDodge); } else if (nDmgType == DAMAGE_TYPE_1 && pXSprite->health <= (unsigned int)pDudeInfo->fleeHealth/* && (pXSprite->at17_6 != 1 || pXSprite->at17_6 != 2)*/) { pSprite->type = kDudeBurningCultist; - aiNewState(pSprite, pXSprite, &cultistBurnGoto); + aiNewState(actor, &cultistBurnGoto); aiPlay3DSound(pSprite, 361, AI_SFX_PRIORITY_0, -1); aiPlay3DSound(pSprite, 1031+Random(2), AI_SFX_PRIORITY_2, -1); gDudeExtra[pSprite->extra].time = gFrameClock+360; @@ -949,7 +952,7 @@ int aiDamageSprite(spritetype *pSprite, XSPRITE *pXSprite, int nSource, DAMAGE_T if (nDmgType == DAMAGE_TYPE_1 && pXSprite->health <= (unsigned int)pDudeInfo->fleeHealth/* && (pXSprite->at17_6 != 1 || pXSprite->at17_6 != 2)*/) { pSprite->type = kDudeBurningInnocent; - aiNewState(pSprite, pXSprite, &cultistBurnGoto); + aiNewState(actor, &cultistBurnGoto); aiPlay3DSound(pSprite, 361, AI_SFX_PRIORITY_0, -1); gDudeExtra[pSprite->extra].time = gFrameClock+360; actHealDude(pXSprite, dudeInfo[39].startHealth, dudeInfo[39].startHealth); @@ -966,24 +969,24 @@ int aiDamageSprite(spritetype *pSprite, XSPRITE *pXSprite, int nSource, DAMAGE_T { pSprite->type = kDudeCultistTommy; pXSprite->burnTime = 0; - aiNewState(pSprite, pXSprite, &cultistSwimGoto); + aiNewState(actor, &cultistSwimGoto); } else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) { pSprite->type = kDudeCultistShotgun; pXSprite->burnTime = 0; - aiNewState(pSprite, pXSprite, &cultistSwimGoto); + aiNewState(actor, &cultistSwimGoto); } break; case kDudeGargoyleFlesh: - aiNewState(pSprite, pXSprite, &gargoyleFChase); + aiNewState(actor, &gargoyleFChase); break; case kDudeZombieButcher: if (nDmgType == DAMAGE_TYPE_1 && pXSprite->health <= (unsigned int)pDudeInfo->fleeHealth) { aiPlay3DSound(pSprite, 361, AI_SFX_PRIORITY_0, -1); aiPlay3DSound(pSprite, 1202, AI_SFX_PRIORITY_2, -1); pSprite->type = kDudeBurningZombieButcher; - aiNewState(pSprite, pXSprite, &zombieFBurnGoto); + aiNewState(actor, &zombieFBurnGoto); actHealDude(pXSprite, dudeInfo[42].startHealth, dudeInfo[42].startHealth); evKill(nSprite, 3, kCallbackFXFlameLick); } @@ -992,7 +995,7 @@ int aiDamageSprite(spritetype *pSprite, XSPRITE *pXSprite, int nSource, DAMAGE_T if (nDmgType == DAMAGE_TYPE_1 && pXSprite->health <= (unsigned int)pDudeInfo->fleeHealth/* && (pXSprite->at17_6 != 1 || pXSprite->at17_6 != 2)*/) { pSprite->type = kDudeBurningInnocent; - aiNewState(pSprite, pXSprite, &cultistBurnGoto); + aiNewState(actor, &cultistBurnGoto); aiPlay3DSound(pSprite, 361, AI_SFX_PRIORITY_0, -1); gDudeExtra[pSprite->extra].time = gFrameClock+360; actHealDude(pXSprite, dudeInfo[39].startHealth, dudeInfo[39].startHealth); @@ -1077,7 +1080,7 @@ int aiDamageSprite(spritetype *pSprite, XSPRITE *pXSprite, int nSource, DAMAGE_T { pSprite->type = kDudeBeast; aiPlay3DSound(pSprite, 9008, AI_SFX_PRIORITY_1, -1); - aiNewState(pSprite, pXSprite, &beastMorphFromCultist); + aiNewState(actor, &beastMorphFromCultist); actHealDude(pXSprite, dudeInfo[51].startHealth, dudeInfo[51].startHealth); } break; @@ -1088,7 +1091,7 @@ int aiDamageSprite(spritetype *pSprite, XSPRITE *pXSprite, int nSource, DAMAGE_T aiPlay3DSound(pSprite, 361, AI_SFX_PRIORITY_0, -1); aiPlay3DSound(pSprite, 1106, AI_SFX_PRIORITY_2, -1); pSprite->type = kDudeBurningZombieAxe; - aiNewState(pSprite, pXSprite, &zombieABurnGoto); + aiNewState(actor, &zombieABurnGoto); actHealDude(pXSprite, dudeInfo[41].startHealth, dudeInfo[41].startHealth); evKill(nSprite, 3, kCallbackFXFlameLick); } @@ -1164,26 +1167,26 @@ void RecoilDude(DBloodActor* actor) else aiPlay3DSound(pSprite, 1013+Random(2), AI_SFX_PRIORITY_2, -1); if (!v4 && pXSprite->medium == kMediumNormal) { - if (pDudeExtra->recoil) aiNewState(pSprite, pXSprite, &cultistTeslaRecoil); - else aiNewState(pSprite, pXSprite, &cultistRecoil); + if (pDudeExtra->recoil) aiNewState(actor, &cultistTeslaRecoil); + else aiNewState(actor, &cultistRecoil); } else if (v4 && pXSprite->medium == kMediumNormal) { - if (pDudeExtra->recoil) aiNewState(pSprite, pXSprite, &cultistTeslaRecoil); - else if (gGameOptions.nDifficulty > 0) aiNewState(pSprite, pXSprite, &cultistProneRecoil); - else aiNewState(pSprite, pXSprite, &cultistRecoil); + if (pDudeExtra->recoil) aiNewState(actor, &cultistTeslaRecoil); + else if (gGameOptions.nDifficulty > 0) aiNewState(actor, &cultistProneRecoil); + else aiNewState(actor, &cultistRecoil); } else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) - aiNewState(pSprite, pXSprite, &cultistSwimRecoil); + aiNewState(actor, &cultistSwimRecoil); else { if (pDudeExtra->recoil) - aiNewState(pSprite, pXSprite, &cultistTeslaRecoil); + aiNewState(actor, &cultistTeslaRecoil); else - aiNewState(pSprite, pXSprite, &cultistRecoil); + aiNewState(actor, &cultistRecoil); } break; case kDudeBurningCultist: - aiNewState(pSprite, pXSprite, &cultistBurnGoto); + aiNewState(actor, &cultistBurnGoto); break; #ifdef NOONE_EXTENSIONS case kDudeModernCustomBurning: @@ -1193,70 +1196,70 @@ void RecoilDude(DBloodActor* actor) case kDudeZombieButcher: aiPlay3DSound(pSprite, 1202, AI_SFX_PRIORITY_2, -1); if (pDudeExtra->recoil) - aiNewState(pSprite, pXSprite, &zombieFTeslaRecoil); + aiNewState(actor, &zombieFTeslaRecoil); else - aiNewState(pSprite, pXSprite, &zombieFRecoil); + aiNewState(actor, &zombieFRecoil); break; case kDudeZombieAxeNormal: case kDudeZombieAxeBuried: aiPlay3DSound(pSprite, 1106, AI_SFX_PRIORITY_2, -1); if (pDudeExtra->recoil && pXSprite->data3 > pDudeInfo->startHealth/3) - aiNewState(pSprite, pXSprite, &zombieATeslaRecoil); + aiNewState(actor, &zombieATeslaRecoil); else if (pXSprite->data3 > pDudeInfo->startHealth/3) - aiNewState(pSprite, pXSprite, &zombieARecoil2); + aiNewState(actor, &zombieARecoil2); else - aiNewState(pSprite, pXSprite, &zombieARecoil); + aiNewState(actor, &zombieARecoil); break; case kDudeBurningZombieAxe: aiPlay3DSound(pSprite, 1106, AI_SFX_PRIORITY_2, -1); - aiNewState(pSprite, pXSprite, &zombieABurnGoto); + aiNewState(actor, &zombieABurnGoto); break; case kDudeBurningZombieButcher: aiPlay3DSound(pSprite, 1202, AI_SFX_PRIORITY_2, -1); - aiNewState(pSprite, pXSprite, &zombieFBurnGoto); + aiNewState(actor, &zombieFBurnGoto); break; case kDudeGargoyleFlesh: case kDudeGargoyleStone: aiPlay3DSound(pSprite, 1402, AI_SFX_PRIORITY_2, -1); - aiNewState(pSprite, pXSprite, &gargoyleFRecoil); + aiNewState(actor, &gargoyleFRecoil); break; case kDudeCerberusTwoHead: aiPlay3DSound(pSprite, 2302+Random(2), AI_SFX_PRIORITY_2, -1); if (pDudeExtra->recoil && pXSprite->data3 > pDudeInfo->startHealth/3) - aiNewState(pSprite, pXSprite, &cerberusTeslaRecoil); + aiNewState(actor, &cerberusTeslaRecoil); else - aiNewState(pSprite, pXSprite, &cerberusRecoil); + aiNewState(actor, &cerberusRecoil); break; case kDudeCerberusOneHead: aiPlay3DSound(pSprite, 2302+Random(2), AI_SFX_PRIORITY_2, -1); - aiNewState(pSprite, pXSprite, &cerberus2Recoil); + aiNewState(actor, &cerberus2Recoil); break; case kDudeHellHound: aiPlay3DSound(pSprite, 1302, AI_SFX_PRIORITY_2, -1); if (pDudeExtra->recoil) - aiNewState(pSprite, pXSprite, &houndTeslaRecoil); + aiNewState(actor, &houndTeslaRecoil); else - aiNewState(pSprite, pXSprite, &houndRecoil); + aiNewState(actor, &houndRecoil); break; case kDudeTchernobog: aiPlay3DSound(pSprite, 2370+Random(2), AI_SFX_PRIORITY_2, -1); - aiNewState(pSprite, pXSprite, &tchernobogRecoil); + aiNewState(actor, &tchernobogRecoil); break; case kDudeHand: aiPlay3DSound(pSprite, 1902, AI_SFX_PRIORITY_2, -1); - aiNewState(pSprite, pXSprite, &handRecoil); + aiNewState(actor, &handRecoil); break; case kDudeRat: aiPlay3DSound(pSprite, 2102, AI_SFX_PRIORITY_2, -1); - aiNewState(pSprite, pXSprite, &ratRecoil); + aiNewState(actor, &ratRecoil); break; case kDudeBat: aiPlay3DSound(pSprite, 2002, AI_SFX_PRIORITY_2, -1); - aiNewState(pSprite, pXSprite, &batRecoil); + aiNewState(actor, &batRecoil); break; case kDudeBoneEel: aiPlay3DSound(pSprite, 1502, AI_SFX_PRIORITY_2, -1); - aiNewState(pSprite, pXSprite, &eelRecoil); + aiNewState(actor, &eelRecoil); break; case kDudeGillBeast: { XSECTOR *pXSector = NULL; @@ -1264,51 +1267,51 @@ void RecoilDude(DBloodActor* actor) pXSector = &xsector[sector[pSprite->sectnum].extra]; aiPlay3DSound(pSprite, 1702, AI_SFX_PRIORITY_2, -1); if (pXSector && pXSector->Underwater) - aiNewState(pSprite, pXSprite, &gillBeastSwimRecoil); + aiNewState(actor, &gillBeastSwimRecoil); else - aiNewState(pSprite, pXSprite, &gillBeastRecoil); + aiNewState(actor, &gillBeastRecoil); break; } case kDudePhantasm: aiPlay3DSound(pSprite, 1602, AI_SFX_PRIORITY_2, -1); if (pDudeExtra->recoil) - aiNewState(pSprite, pXSprite, &ghostTeslaRecoil); + aiNewState(actor, &ghostTeslaRecoil); else - aiNewState(pSprite, pXSprite, &ghostRecoil); + aiNewState(actor, &ghostRecoil); break; case kDudeSpiderBrown: case kDudeSpiderRed: case kDudeSpiderBlack: aiPlay3DSound(pSprite, 1802+Random(1), AI_SFX_PRIORITY_2, -1); - aiNewState(pSprite, pXSprite, &spidDodge); + aiNewState(actor, &spidDodge); break; case kDudeSpiderMother: aiPlay3DSound(pSprite, 1851+Random(1), AI_SFX_PRIORITY_2, -1); - aiNewState(pSprite, pXSprite, &spidDodge); + aiNewState(actor, &spidDodge); break; case kDudeInnocent: aiPlay3DSound(pSprite, 7007+Random(2), AI_SFX_PRIORITY_2, -1); if (pDudeExtra->recoil) - aiNewState(pSprite, pXSprite, &innocentTeslaRecoil); + aiNewState(actor, &innocentTeslaRecoil); else - aiNewState(pSprite, pXSprite, &innocentRecoil); + aiNewState(actor, &innocentRecoil); break; case kDudeTinyCaleb: if (pXSprite->medium == kMediumNormal) { if (pDudeExtra->recoil) - aiNewState(pSprite, pXSprite, &tinycalebTeslaRecoil); + aiNewState(actor, &tinycalebTeslaRecoil); else - aiNewState(pSprite, pXSprite, &tinycalebRecoil); + aiNewState(actor, &tinycalebRecoil); } else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) - aiNewState(pSprite, pXSprite, &tinycalebSwimRecoil); + aiNewState(actor, &tinycalebSwimRecoil); else { if (pDudeExtra->recoil) - aiNewState(pSprite, pXSprite, &tinycalebTeslaRecoil); + aiNewState(actor, &tinycalebTeslaRecoil); else - aiNewState(pSprite, pXSprite, &tinycalebRecoil); + aiNewState(actor, &tinycalebRecoil); } break; case kDudeBeast: @@ -1316,30 +1319,30 @@ void RecoilDude(DBloodActor* actor) if (pXSprite->medium == kMediumNormal) { if (pDudeExtra->recoil) - aiNewState(pSprite, pXSprite, &beastTeslaRecoil); + aiNewState(actor, &beastTeslaRecoil); else - aiNewState(pSprite, pXSprite, &beastRecoil); + aiNewState(actor, &beastRecoil); } else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) - aiNewState(pSprite, pXSprite, &beastSwimRecoil); + aiNewState(actor, &beastSwimRecoil); else { if (pDudeExtra->recoil) - aiNewState(pSprite, pXSprite, &beastTeslaRecoil); + aiNewState(actor, &beastTeslaRecoil); else - aiNewState(pSprite, pXSprite, &beastRecoil); + aiNewState(actor, &beastRecoil); } break; case kDudePodGreen: case kDudePodFire: - aiNewState(pSprite, pXSprite, &podRecoil); + aiNewState(actor, &podRecoil); break; case kDudeTentacleGreen: case kDudeTentacleFire: - aiNewState(pSprite, pXSprite, &tentacleRecoil); + aiNewState(actor, &tentacleRecoil); break; default: - aiNewState(pSprite, pXSprite, &genRecoil); + aiNewState(actor, &genRecoil); break; } pDudeExtra->recoil = 0; @@ -1458,7 +1461,9 @@ void aiProcessDudes(void) { spritetype *pSprite = &sprite[nSprite]; if (pSprite->flags & 32) continue; int nXSprite = pSprite->extra; - XSPRITE *pXSprite = &xsprite[nXSprite]; DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); + XSPRITE *pXSprite = &xsprite[nXSprite]; + DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); + auto actor = &bloodActors[pXSprite->reference]; if (IsPlayerSprite(pSprite) || pXSprite->health == 0) continue; pXSprite->stateTimer = ClipLow(pXSprite->stateTimer-4, 0); @@ -1489,9 +1494,9 @@ void aiProcessDudes(void) { default: if (pXSprite->stateTimer == 0 && pXSprite->aiState->nextState) { if (pXSprite->aiState->stateTicks > 0) - aiNewState(pSprite, pXSprite, pXSprite->aiState->nextState); + aiNewState(actor, pXSprite->aiState->nextState); else if (seqGetStatus(3, nXSprite) < 0) - aiNewState(pSprite, pXSprite, pXSprite->aiState->nextState); + aiNewState(actor, pXSprite->aiState->nextState); } if (pXSprite->health > 0 && ((pDudeInfo->hinderDamage << 4) <= cumulDamage[nXSprite])) { @@ -1518,6 +1523,7 @@ void aiInitSprite(spritetype *pSprite) { int nXSprite = pSprite->extra; XSPRITE *pXSprite = &xsprite[nXSprite]; + auto actor = &bloodActors[pXSprite->reference]; int nSector = pSprite->sectnum; int nXSector = sector[nSector].extra; XSECTOR *pXSector = NULL; @@ -1546,7 +1552,7 @@ void aiInitSprite(spritetype *pSprite) DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u1; pDudeExtraE->xval3 = 0; pDudeExtraE->xval1 = 0; - aiNewState(pSprite, pXSprite, &cultistIdle); + aiNewState(actor, &cultistIdle); break; } case kDudeCultistTommyProne: @@ -1554,7 +1560,7 @@ void aiInitSprite(spritetype *pSprite) DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u1; pDudeExtraE->xval3 = 0; pDudeExtraE->xval1 = 0; - aiNewState(pSprite, pXSprite, &fanaticProneIdle); + aiNewState(actor, &fanaticProneIdle); break; } case kDudeCultistShotgunProne: @@ -1562,21 +1568,21 @@ void aiInitSprite(spritetype *pSprite) DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u1; pDudeExtraE->xval3 = 0; pDudeExtraE->xval1 = 0; - aiNewState(pSprite, pXSprite, &cultistProneIdle); + aiNewState(actor, &cultistProneIdle); break; } case kDudeZombieButcher: { DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u2; pDudeExtraE->xval2 = 0; pDudeExtraE->xval1 = 0; - aiNewState(pSprite, pXSprite, &zombieFIdle); + aiNewState(actor, &zombieFIdle); break; } case kDudeZombieAxeNormal: { DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u2; pDudeExtraE->xval2 = 0; pDudeExtraE->xval1 = 0; - aiNewState(pSprite, pXSprite, &zombieAIdle); + aiNewState(actor, &zombieAIdle); break; } case kDudeZombieAxeLaying: @@ -1584,7 +1590,7 @@ void aiInitSprite(spritetype *pSprite) DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u2; pDudeExtraE->xval2 = 0; pDudeExtraE->xval1 = 0; - aiNewState(pSprite, pXSprite, &zombieSIdle); + aiNewState(actor, &zombieSIdle); pSprite->flags &= ~1; break; } @@ -1592,7 +1598,7 @@ void aiInitSprite(spritetype *pSprite) DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u2; pDudeExtraE->xval2 = 0; pDudeExtraE->xval1 = 0; - aiNewState(pSprite, pXSprite, &zombieEIdle); + aiNewState(actor, &zombieEIdle); break; } case kDudeGargoyleFlesh: @@ -1601,25 +1607,25 @@ void aiInitSprite(spritetype *pSprite) pDudeExtraE->xval2 = 0; pDudeExtraE->xval3 = 0; pDudeExtraE->xval1 = 0; - aiNewState(pSprite, pXSprite, &gargoyleFIdle); + aiNewState(actor, &gargoyleFIdle); break; } case kDudeGargoyleStatueFlesh: case kDudeGargoyleStatueStone: - aiNewState(pSprite, pXSprite, &gargoyleStatueIdle); + aiNewState(actor, &gargoyleStatueIdle); break; case kDudeCerberusTwoHead: { DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u2; pDudeExtraE->xval2 = 0; pDudeExtraE->xval1 = 0; - aiNewState(pSprite, pXSprite, &cerberusIdle); + aiNewState(actor, &cerberusIdle); break; } case kDudeHellHound: - aiNewState(pSprite, pXSprite, &houndIdle); + aiNewState(actor, &houndIdle); break; case kDudeHand: - aiNewState(pSprite, pXSprite, &handIdle); + aiNewState(actor, &handIdle); break; case kDudePhantasm: { @@ -1627,14 +1633,14 @@ void aiInitSprite(spritetype *pSprite) pDudeExtraE->xval2 = 0; pDudeExtraE->xval3 = 0; pDudeExtraE->xval1 = 0; - aiNewState(pSprite, pXSprite, &ghostIdle); + aiNewState(actor, &ghostIdle); break; } case kDudeInnocent: - aiNewState(pSprite, pXSprite, &innocentIdle); + aiNewState(actor, &innocentIdle); break; case kDudeRat: - aiNewState(pSprite, pXSprite, &ratIdle); + aiNewState(actor, &ratIdle); break; case kDudeBoneEel: { @@ -1642,11 +1648,11 @@ void aiInitSprite(spritetype *pSprite) pDudeExtraE->xval2 = 0; pDudeExtraE->xval3 = 0; pDudeExtraE->xval1 = 0; - aiNewState(pSprite, pXSprite, &eelIdle); + aiNewState(actor, &eelIdle); break; } case kDudeGillBeast: - aiNewState(pSprite, pXSprite, &gillBeastIdle); + aiNewState(actor, &gillBeastIdle); break; case kDudeBat: { @@ -1654,7 +1660,7 @@ void aiInitSprite(spritetype *pSprite) pDudeExtraE->xval2 = 0; pDudeExtraE->xval3 = 0; pDudeExtraE->xval1 = 0; - aiNewState(pSprite, pXSprite, &batIdle); + aiNewState(actor, &batIdle); break; } case kDudeSpiderBrown: @@ -1665,7 +1671,7 @@ void aiInitSprite(spritetype *pSprite) pDudeExtraE->xval3 = 0; pDudeExtraE->xval2 = 0; pDudeExtraE->xval1 = 0; - aiNewState(pSprite, pXSprite, &spidIdle); + aiNewState(actor, &spidIdle); break; } case kDudeSpiderMother: @@ -1674,7 +1680,7 @@ void aiInitSprite(spritetype *pSprite) pDudeExtraE->xval3 = 0; pDudeExtraE->xval2 = 0; pDudeExtraE->xval1 = 0; - aiNewState(pSprite, pXSprite, &spidIdle); + aiNewState(actor, &spidIdle); break; } case kDudeTchernobog: @@ -1682,25 +1688,25 @@ void aiInitSprite(spritetype *pSprite) DUDEEXTRA_at6_u2 *pDudeExtraE = &gDudeExtra[nXSprite].at6.u2; pDudeExtraE->xval2 = 0; pDudeExtraE->xval1 = 0; - aiNewState(pSprite, pXSprite, &tchernobogIdle); + aiNewState(actor, &tchernobogIdle); break; } case kDudeTinyCaleb: - aiNewState(pSprite, pXSprite, &tinycalebIdle); + aiNewState(actor, &tinycalebIdle); break; case kDudeBeast: - aiNewState(pSprite, pXSprite, &beastIdle); + aiNewState(actor, &beastIdle); break; case kDudePodGreen: case kDudePodFire: - aiNewState(pSprite, pXSprite, &podIdle); + aiNewState(actor, &podIdle); break; case kDudeTentacleGreen: case kDudeTentacleFire: - aiNewState(pSprite, pXSprite, &tentacleIdle); + aiNewState(actor, &tentacleIdle); break; default: - aiNewState(pSprite, pXSprite, &genIdle); + aiNewState(actor, &genIdle); break; } aiSetTarget(pXSprite, 0, 0, 0); diff --git a/source/blood/src/ai.h b/source/blood/src/ai.h index 1706ad19e..16016a776 100644 --- a/source/blood/src/ai.h +++ b/source/blood/src/ai.h @@ -93,7 +93,7 @@ extern int cumulDamage[]; bool dudeIsPlayingSeq(spritetype *pSprite, int nSeq); void aiPlay3DSound(spritetype *pSprite, int a2, AI_SFX_PRIORITY a3, int a4); -void aiNewState(spritetype *pSprite, XSPRITE *pXSprite, AISTATE *pAIState); +void aiNewState(DBloodActor* actor, AISTATE *pAIState); void aiChooseDirection(spritetype *pSprite, XSPRITE *pXSprite, int a3); void aiMoveForward(DBloodActor*pXSprite); void aiMoveTurn(DBloodActor*pXSprite); diff --git a/source/blood/src/aibat.cpp b/source/blood/src/aibat.cpp index dd79012b1..5aa3b0801 100644 --- a/source/blood/src/aibat.cpp +++ b/source/blood/src/aibat.cpp @@ -103,7 +103,7 @@ static void batThinkTarget(DBloodActor* actor) pXSprite->goalAng += 256; POINT3D *pTarget = &baseSprite[pSprite->index]; aiSetTarget(pXSprite, pTarget->x, pTarget->y, pTarget->z); - aiNewState(pSprite, pXSprite, &batTurn); + aiNewState(actor, &batTurn); return; } if (Chance(pDudeInfo->alertChance)) @@ -162,7 +162,7 @@ static void batThinkGoto(DBloodActor* actor) int nDist = approxDist(dx, dy); aiChooseDirection(pSprite, pXSprite, nAngle); if (nDist < 512 && klabs(pSprite->ang - nAngle) < pDudeInfo->periphery) - aiNewState(pSprite, pXSprite, &batSearch); + aiNewState(actor, &batSearch); batThinkTarget(actor); } @@ -172,7 +172,7 @@ static void batThinkPonder(DBloodActor* actor) auto pSprite = &actor->s(); if (pXSprite->target == -1) { - aiNewState(pSprite, pXSprite, &batSearch); + aiNewState(actor, &batSearch); return; } assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); @@ -185,7 +185,7 @@ static void batThinkPonder(DBloodActor* actor) aiChooseDirection(pSprite, pXSprite, getangle(dx, dy)); if (pXTarget->health == 0) { - aiNewState(pSprite, pXSprite, &batSearch); + aiNewState(actor, &batSearch); return; } int nDist = approxDist(dx, dy); @@ -200,25 +200,25 @@ static void batThinkPonder(DBloodActor* actor) { aiSetTarget(pXSprite, pXSprite->target); if (height2-height < 0x3000 && nDist < 0x1800 && nDist > 0xc00 && klabs(nDeltaAngle) < 85) - aiNewState(pSprite, pXSprite, &batDodgeUp); + aiNewState(actor, &batDodgeUp); else if (height2-height > 0x5000 && nDist < 0x1800 && nDist > 0xc00 && klabs(nDeltaAngle) < 85) - aiNewState(pSprite, pXSprite, &batDodgeDown); + aiNewState(actor, &batDodgeDown); else if (height2-height < 0x2000 && nDist < 0x200 && klabs(nDeltaAngle) < 85) - aiNewState(pSprite, pXSprite, &batDodgeUp); + aiNewState(actor, &batDodgeUp); else if (height2-height > 0x6000 && nDist < 0x1400 && nDist > 0x800 && klabs(nDeltaAngle) < 85) - aiNewState(pSprite, pXSprite, &batDodgeDown); + aiNewState(actor, &batDodgeDown); else if (height2-height < 0x2000 && nDist < 0x1400 && nDist > 0x800 && klabs(nDeltaAngle) < 85) - aiNewState(pSprite, pXSprite, &batDodgeUp); + aiNewState(actor, &batDodgeUp); else if (height2-height < 0x2000 && klabs(nDeltaAngle) < 85 && nDist > 0x1400) - aiNewState(pSprite, pXSprite, &batDodgeUp); + aiNewState(actor, &batDodgeUp); else if (height2-height > 0x4000) - aiNewState(pSprite, pXSprite, &batDodgeDown); + aiNewState(actor, &batDodgeDown); else - aiNewState(pSprite, pXSprite, &batDodgeUp); + aiNewState(actor, &batDodgeUp); return; } } - aiNewState(pSprite, pXSprite, &batGoto); + aiNewState(actor, &batGoto); pXSprite->target = -1; } @@ -280,7 +280,7 @@ static void batThinkChase(DBloodActor* actor) auto pSprite = &actor->s(); if (pXSprite->target == -1) { - aiNewState(pSprite, pXSprite, &batGoto); + aiNewState(actor, &batGoto); return; } assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); @@ -293,12 +293,12 @@ static void batThinkChase(DBloodActor* actor) aiChooseDirection(pSprite, pXSprite, getangle(dx, dy)); if (pXTarget->health == 0) { - aiNewState(pSprite, pXSprite, &batSearch); + aiNewState(actor, &batSearch); return; } if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type - kDudePlayer1], kPwUpShadowCloak) > 0) { - aiNewState(pSprite, pXSprite, &batSearch); + aiNewState(actor, &batSearch); return; } int nDist = approxDist(dx, dy); @@ -317,23 +317,23 @@ static void batThinkChase(DBloodActor* actor) aiSetTarget(pXSprite, pXSprite->target); int floorZ = getflorzofslope(pSprite->sectnum, pSprite->x, pSprite->y); if (height2-height < 0x2000 && nDist < 0x200 && klabs(nDeltaAngle) < 85) - aiNewState(pSprite, pXSprite, &batBite); + aiNewState(actor, &batBite); else if ((height2-height > 0x5000 || floorZ-bottom > 0x5000) && nDist < 0x1400 && nDist > 0x800 && klabs(nDeltaAngle) < 85) - aiNewState(pSprite, pXSprite, &batSwoop); + aiNewState(actor, &batSwoop); else if ((height2-height < 0x3000 || floorZ-bottom < 0x3000) && klabs(nDeltaAngle) < 85) - aiNewState(pSprite, pXSprite, &batFly); + aiNewState(actor, &batFly); return; } } else { - aiNewState(pSprite, pXSprite, &batFly); + aiNewState(actor, &batFly); return; } } pXSprite->target = -1; - aiNewState(pSprite, pXSprite, &batHide); + aiNewState(actor, &batHide); } static void batMoveForward(DBloodActor* actor) @@ -446,7 +446,7 @@ void batMoveToCeil(DBloodActor* actor) DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1; pDudeExtraE->xval3 = 0; pSprite->flags = 0; - aiNewState(pSprite, pXSprite, &batIdle); + aiNewState(actor, &batIdle); } else aiSetTarget(pXSprite, x, y, sector[nSector].ceilingz); diff --git a/source/blood/src/aibeast.cpp b/source/blood/src/aibeast.cpp index 07db943ee..e4ccfa6ba 100644 --- a/source/blood/src/aibeast.cpp +++ b/source/blood/src/aibeast.cpp @@ -223,9 +223,9 @@ static void beastThinkGoto(DBloodActor* actor) if (nDist < 512 && klabs(pSprite->ang - nAngle) < pDudeInfo->periphery) { if (pXSector && pXSector->Underwater) - aiNewState(pSprite, pXSprite, &beastSwimSearch); + aiNewState(actor, &beastSwimSearch); else - aiNewState(pSprite, pXSprite, &beastSearch); + aiNewState(actor, &beastSearch); } aiThinkTarget(actor); } @@ -243,9 +243,9 @@ static void beastThinkChase(DBloodActor* actor) else pXSector = NULL; if (pXSector && pXSector->Underwater) - aiNewState(pSprite, pXSprite, &beastSwimSearch); + aiNewState(actor, &beastSwimSearch); else - aiNewState(pSprite, pXSprite, &beastSearch); + aiNewState(actor, &beastSearch); return; } assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); @@ -265,9 +265,9 @@ static void beastThinkChase(DBloodActor* actor) else pXSector = NULL; if (pXSector && pXSector->Underwater) - aiNewState(pSprite, pXSprite, &beastSwimSearch); + aiNewState(actor, &beastSwimSearch); else - aiNewState(pSprite, pXSprite, &beastSearch); + aiNewState(actor, &beastSearch); return; } if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], kPwUpShadowCloak) > 0) @@ -279,9 +279,9 @@ static void beastThinkChase(DBloodActor* actor) else pXSector = NULL; if (pXSector && pXSector->Underwater) - aiNewState(pSprite, pXSprite, &beastSwimSearch); + aiNewState(actor, &beastSwimSearch); else - aiNewState(pSprite, pXSprite, &beastSearch); + aiNewState(actor, &beastSearch); return; } int nDist = approxDist(dx, dy); @@ -312,25 +312,25 @@ static void beastThinkChase(DBloodActor* actor) { case -1: if (!pXSector || !pXSector->Underwater) - aiNewState(pSprite, pXSprite, &beastStomp); + aiNewState(actor, &beastStomp); break; case 3: if (pSprite->type != sprite[gHitInfo.hitsprite].type) { if (!pXSector || !pXSector->Underwater) - aiNewState(pSprite, pXSprite, &beastStomp); + aiNewState(actor, &beastStomp); } else { if (pXSector && pXSector->Underwater) - aiNewState(pSprite, pXSprite, &beastSwimDodge); + aiNewState(actor, &beastSwimDodge); else - aiNewState(pSprite, pXSprite, &beastDodge); + aiNewState(actor, &beastDodge); } break; default: if (!pXSector || !pXSector->Underwater) - aiNewState(pSprite, pXSprite, &beastStomp); + aiNewState(actor, &beastStomp); break; } } @@ -348,31 +348,31 @@ static void beastThinkChase(DBloodActor* actor) { case -1: if (pXSector && pXSector->Underwater) - aiNewState(pSprite, pXSprite, &beastSwimSlash); + aiNewState(actor, &beastSwimSlash); else - aiNewState(pSprite, pXSprite, &beastSlash); + aiNewState(actor, &beastSlash); break; case 3: if (pSprite->type != sprite[gHitInfo.hitsprite].type) { if (pXSector && pXSector->Underwater) - aiNewState(pSprite, pXSprite, &beastSwimSlash); + aiNewState(actor, &beastSwimSlash); else - aiNewState(pSprite, pXSprite, &beastSlash); + aiNewState(actor, &beastSlash); } else { if (pXSector && pXSector->Underwater) - aiNewState(pSprite, pXSprite, &beastSwimDodge); + aiNewState(actor, &beastSwimDodge); else - aiNewState(pSprite, pXSprite, &beastDodge); + aiNewState(actor, &beastDodge); } break; default: if (pXSector && pXSector->Underwater) - aiNewState(pSprite, pXSprite, &beastSwimSlash); + aiNewState(actor, &beastSwimSlash); else - aiNewState(pSprite, pXSprite, &beastSlash); + aiNewState(actor, &beastSlash); break; } } @@ -388,9 +388,9 @@ static void beastThinkChase(DBloodActor* actor) else pXSector = NULL; if (pXSector && pXSector->Underwater) - aiNewState(pSprite, pXSprite, &beastSwimGoto); + aiNewState(actor, &beastSwimGoto); else - aiNewState(pSprite, pXSprite, &beastGoto); + aiNewState(actor, &beastGoto); pXSprite->target = -1; } @@ -406,7 +406,7 @@ static void beastThinkSwimGoto(DBloodActor* actor) int nDist = approxDist(dx, dy); aiChooseDirection(pSprite, pXSprite, nAngle); if (nDist < 512 && klabs(pSprite->ang - nAngle) < pDudeInfo->periphery) - aiNewState(pSprite, pXSprite, &beastSwimSearch); + aiNewState(actor, &beastSwimSearch); aiThinkTarget(actor); } @@ -416,7 +416,7 @@ static void beastThinkSwimChase(DBloodActor* actor) auto pSprite = &actor->s(); if (pXSprite->target == -1) { - aiNewState(pSprite, pXSprite, &beastSwimGoto); + aiNewState(actor, &beastSwimGoto); return; } assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); @@ -429,12 +429,12 @@ static void beastThinkSwimChase(DBloodActor* actor) aiChooseDirection(pSprite, pXSprite, getangle(dx, dy)); if (pXTarget->health == 0) { - aiNewState(pSprite, pXSprite, &beastSwimSearch); + aiNewState(actor, &beastSwimSearch); return; } if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], kPwUpShadowCloak) > 0) { - aiNewState(pSprite, pXSprite, &beastSwimSearch); + aiNewState(actor, &beastSwimSearch); return; } int nDist = approxDist(dx, dy); @@ -450,19 +450,19 @@ static void beastThinkSwimChase(DBloodActor* actor) { aiSetTarget(pXSprite, pXSprite->target); if (nDist < 0x400 && klabs(nDeltaAngle) < 85) - aiNewState(pSprite, pXSprite, &beastSwimSlash); + aiNewState(actor, &beastSwimSlash); else { aiPlay3DSound(pSprite, 9009+Random(2), AI_SFX_PRIORITY_1, -1); - aiNewState(pSprite, pXSprite, &beast138FD0); + aiNewState(actor, &beast138FD0); } } } else - aiNewState(pSprite, pXSprite, &beast138FD0); + aiNewState(actor, &beast138FD0); return; } - aiNewState(pSprite, pXSprite, &beastSwimGoto); + aiNewState(actor, &beastSwimGoto); pXSprite->target = -1; } diff --git a/source/blood/src/aiboneel.cpp b/source/blood/src/aiboneel.cpp index 508366a00..713e820cb 100644 --- a/source/blood/src/aiboneel.cpp +++ b/source/blood/src/aiboneel.cpp @@ -76,6 +76,7 @@ AISTATE eelDodgeDownLeft = { kAiStateMove, 0, -1, 90, NULL, eelMoveDodgeDown, NU void eelBiteSeqCallback(int, int nXSprite) { XSPRITE *pXSprite = &xsprite[nXSprite]; + auto actor = &bloodActors[pXSprite->reference]; spritetype *pSprite = &sprite[pXSprite->reference]; spritetype *pTarget = &sprite[pXSprite->target]; int dx = CosScale16(pSprite->ang); @@ -94,7 +95,7 @@ void eelBiteSeqCallback(int, int nXSprite) */ if (pXSprite->target == -1) { - aiNewState(pSprite, pXSprite, &eelSearch); + aiNewState(actor, &eelSearch); return; } assert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites); @@ -116,7 +117,7 @@ static void eelThinkTarget(DBloodActor* actor) pXSprite->goalAng += 256; POINT3D *pTarget = &baseSprite[pSprite->index]; aiSetTarget(pXSprite, pTarget->x, pTarget->y, pTarget->z); - aiNewState(pSprite, pXSprite, &eelTurn); + aiNewState(actor, &eelTurn); return; } if (Chance(pDudeInfo->alertChance)) @@ -177,7 +178,7 @@ static void eelThinkGoto(DBloodActor* actor) int nDist = approxDist(dx, dy); aiChooseDirection(pSprite, pXSprite, nAngle); if (nDist < 512 && klabs(pSprite->ang - nAngle) < pDudeInfo->periphery) - aiNewState(pSprite, pXSprite, &eelSearch); + aiNewState(actor, &eelSearch); eelThinkTarget(actor); } @@ -187,7 +188,7 @@ static void eelThinkPonder(DBloodActor* actor) auto pSprite = &actor->s(); if (pXSprite->target == -1) { - aiNewState(pSprite, pXSprite, &eelSearch); + aiNewState(actor, &eelSearch); return; } assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); @@ -200,7 +201,7 @@ static void eelThinkPonder(DBloodActor* actor) aiChooseDirection(pSprite, pXSprite, getangle(dx, dy)); if (pXTarget->health == 0) { - aiNewState(pSprite, pXSprite, &eelSearch); + aiNewState(actor, &eelSearch); return; } int nDist = approxDist(dx, dy); @@ -215,25 +216,25 @@ static void eelThinkPonder(DBloodActor* actor) { aiSetTarget(pXSprite, pXSprite->target); if (height2-height < -0x2000 && nDist < 0x1800 && nDist > 0xc00 && klabs(nDeltaAngle) < 85) - aiNewState(pSprite, pXSprite, &eelDodgeUp); + aiNewState(actor, &eelDodgeUp); else if (height2-height > 0xccc && nDist < 0x1800 && nDist > 0xc00 && klabs(nDeltaAngle) < 85) - aiNewState(pSprite, pXSprite, &eelDodgeDown); + aiNewState(actor, &eelDodgeDown); else if (height2-height < 0xccc && nDist < 0x399 && klabs(nDeltaAngle) < 85) - aiNewState(pSprite, pXSprite, &eelDodgeUp); + aiNewState(actor, &eelDodgeUp); else if (height2-height > 0xccc && nDist < 0x1400 && nDist > 0x800 && klabs(nDeltaAngle) < 85) - aiNewState(pSprite, pXSprite, &eelDodgeDown); + aiNewState(actor, &eelDodgeDown); else if (height2-height < -0x2000 && nDist < 0x1400 && nDist > 0x800 && klabs(nDeltaAngle) < 85) - aiNewState(pSprite, pXSprite, &eelDodgeUp); + aiNewState(actor, &eelDodgeUp); else if (height2-height < -0x2000 && klabs(nDeltaAngle) < 85 && nDist > 0x1400) - aiNewState(pSprite, pXSprite, &eelDodgeUp); + aiNewState(actor, &eelDodgeUp); else if (height2-height > 0xccc) - aiNewState(pSprite, pXSprite, &eelDodgeDown); + aiNewState(actor, &eelDodgeDown); else - aiNewState(pSprite, pXSprite, &eelDodgeUp); + aiNewState(actor, &eelDodgeUp); return; } } - aiNewState(pSprite, pXSprite, &eelGoto); + aiNewState(actor, &eelGoto); pXSprite->target = -1; } @@ -295,7 +296,7 @@ static void eelThinkChase(DBloodActor* actor) auto pSprite = &actor->s(); if (pXSprite->target == -1) { - aiNewState(pSprite, pXSprite, &eelGoto); + aiNewState(actor, &eelGoto); return; } assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); @@ -308,12 +309,12 @@ static void eelThinkChase(DBloodActor* actor) aiChooseDirection(pSprite, pXSprite, getangle(dx, dy)); if (pXTarget->health == 0) { - aiNewState(pSprite, pXSprite, &eelSearch); + aiNewState(actor, &eelSearch); return; } if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], kPwUpShadowCloak) > 0) { - aiNewState(pSprite, pXSprite, &eelSearch); + aiNewState(actor, &eelSearch); return; } int nDist = approxDist(dx, dy); @@ -331,20 +332,20 @@ static void eelThinkChase(DBloodActor* actor) { aiSetTarget(pXSprite, pXSprite->target); if (nDist < 0x399 && top2 > top && klabs(nDeltaAngle) < 85) - aiNewState(pSprite, pXSprite, &eelSwoop); + aiNewState(actor, &eelSwoop); else if (nDist <= 0x399 && klabs(nDeltaAngle) < 85) - aiNewState(pSprite, pXSprite, &eelBite); + aiNewState(actor, &eelBite); else if (bottom2 > top && klabs(nDeltaAngle) < 85) - aiNewState(pSprite, pXSprite, &eelSwoop); + aiNewState(actor, &eelSwoop); else if (top2 < top && klabs(nDeltaAngle) < 85) - aiNewState(pSprite, pXSprite, &eelFly); + aiNewState(actor, &eelFly); } } return; } pXSprite->target = -1; - aiNewState(pSprite, pXSprite, &eelSearch); + aiNewState(actor, &eelSearch); } static void eelMoveForward(DBloodActor* actor) @@ -451,7 +452,7 @@ void eelMoveToCeil(DBloodActor* actor) DUDEEXTRA_at6_u1 *pDudeExtraE = &gDudeExtra[pSprite->extra].at6.u1; pDudeExtraE->xval3 = 0; pSprite->flags = 0; - aiNewState(pSprite, pXSprite, &eelIdle); + aiNewState(actor, &eelIdle); } else aiSetTarget(pXSprite, x, y, sector[nSector].ceilingz); diff --git a/source/blood/src/aiburn.cpp b/source/blood/src/aiburn.cpp index 5f45c9ca4..73830d5a7 100644 --- a/source/blood/src/aiburn.cpp +++ b/source/blood/src/aiburn.cpp @@ -113,26 +113,26 @@ static void burnThinkGoto(DBloodActor* actor) switch (pSprite->type) { case kDudeBurningCultist: - aiNewState(pSprite, pXSprite, &cultistBurnSearch); + aiNewState(actor, &cultistBurnSearch); break; case kDudeBurningZombieAxe: - aiNewState(pSprite, pXSprite, &zombieABurnSearch); + aiNewState(actor, &zombieABurnSearch); break; case kDudeBurningZombieButcher: - aiNewState(pSprite, pXSprite, &zombieFBurnSearch); + aiNewState(actor, &zombieFBurnSearch); break; case kDudeBurningInnocent: - aiNewState(pSprite, pXSprite, &innocentBurnSearch); + aiNewState(actor, &innocentBurnSearch); break; case kDudeBurningBeast: - aiNewState(pSprite, pXSprite, &beastBurnSearch); + aiNewState(actor, &beastBurnSearch); break; case kDudeBurningTinyCaleb: - aiNewState(pSprite, pXSprite, &tinycalebBurnSearch); + aiNewState(actor, &tinycalebBurnSearch); break; #ifdef NOONE_EXTENSIONS case kDudeModernCustomBurning: - aiNewState(pSprite, pXSprite, &genDudeBurnSearch); + aiNewState(actor, &genDudeBurnSearch); break; #endif } @@ -149,26 +149,26 @@ static void burnThinkChase(DBloodActor* actor) switch (pSprite->type) { case kDudeBurningCultist: - aiNewState(pSprite, pXSprite, &cultistBurnGoto); + aiNewState(actor, &cultistBurnGoto); break; case kDudeBurningZombieAxe: - aiNewState(pSprite, pXSprite, &zombieABurnGoto); + aiNewState(actor, &zombieABurnGoto); break; case kDudeBurningZombieButcher: - aiNewState(pSprite, pXSprite, &zombieFBurnGoto); + aiNewState(actor, &zombieFBurnGoto); break; case kDudeBurningInnocent: - aiNewState(pSprite, pXSprite, &innocentBurnGoto); + aiNewState(actor, &innocentBurnGoto); break; case kDudeBurningBeast: - aiNewState(pSprite, pXSprite, &beastBurnGoto); + aiNewState(actor, &beastBurnGoto); break; case kDudeBurningTinyCaleb: - aiNewState(pSprite, pXSprite, &tinycalebBurnGoto); + aiNewState(actor, &tinycalebBurnGoto); break; #ifdef NOONE_EXTENSIONS case kDudeModernCustomBurning: - aiNewState(pSprite, pXSprite, &genDudeBurnGoto); + aiNewState(actor, &genDudeBurnGoto); break; #endif } @@ -187,26 +187,26 @@ static void burnThinkChase(DBloodActor* actor) switch (pSprite->type) { case kDudeBurningCultist: - aiNewState(pSprite, pXSprite, &cultistBurnSearch); + aiNewState(actor, &cultistBurnSearch); break; case kDudeBurningZombieAxe: - aiNewState(pSprite, pXSprite, &zombieABurnSearch); + aiNewState(actor, &zombieABurnSearch); break; case kDudeBurningZombieButcher: - aiNewState(pSprite, pXSprite, &zombieFBurnSearch); + aiNewState(actor, &zombieFBurnSearch); break; case kDudeBurningInnocent: - aiNewState(pSprite, pXSprite, &innocentBurnSearch); + aiNewState(actor, &innocentBurnSearch); break; case kDudeBurningBeast: - aiNewState(pSprite, pXSprite, &beastBurnSearch); + aiNewState(actor, &beastBurnSearch); break; case kDudeBurningTinyCaleb: - aiNewState(pSprite, pXSprite, &tinycalebBurnSearch); + aiNewState(actor, &tinycalebBurnSearch); break; #ifdef NOONE_EXTENSIONS case kDudeModernCustomBurning: - aiNewState(pSprite, pXSprite, &genDudeBurnSearch); + aiNewState(actor, &genDudeBurnSearch); break; #endif } @@ -227,26 +227,26 @@ static void burnThinkChase(DBloodActor* actor) switch (pSprite->type) { case kDudeBurningCultist: - aiNewState(pSprite, pXSprite, &cultistBurnAttack); + aiNewState(actor, &cultistBurnAttack); break; case kDudeBurningZombieAxe: - aiNewState(pSprite, pXSprite, &zombieABurnAttack); + aiNewState(actor, &zombieABurnAttack); break; case kDudeBurningZombieButcher: - aiNewState(pSprite, pXSprite, &zombieFBurnAttack); + aiNewState(actor, &zombieFBurnAttack); break; case kDudeBurningInnocent: - aiNewState(pSprite, pXSprite, &innocentBurnAttack); + aiNewState(actor, &innocentBurnAttack); break; case kDudeBurningBeast: - aiNewState(pSprite, pXSprite, &beastBurnAttack); + aiNewState(actor, &beastBurnAttack); break; case kDudeBurningTinyCaleb: - aiNewState(pSprite, pXSprite, &tinycalebBurnAttack); + aiNewState(actor, &tinycalebBurnAttack); break; #ifdef NOONE_EXTENSIONS case kDudeModernCustomBurning: - aiNewState(pSprite, pXSprite, &genDudeBurnSearch); + aiNewState(actor, &genDudeBurnSearch); break; #endif } @@ -259,26 +259,26 @@ static void burnThinkChase(DBloodActor* actor) switch (pSprite->type) { case kDudeBurningCultist: - aiNewState(pSprite, pXSprite, &cultistBurnGoto); + aiNewState(actor, &cultistBurnGoto); break; case kDudeBurningZombieAxe: - aiNewState(pSprite, pXSprite, &zombieABurnGoto); + aiNewState(actor, &zombieABurnGoto); break; case 242: - aiNewState(pSprite, pXSprite, &zombieFBurnGoto); + aiNewState(actor, &zombieFBurnGoto); break; case kDudeBurningInnocent: - aiNewState(pSprite, pXSprite, &innocentBurnGoto); + aiNewState(actor, &innocentBurnGoto); break; case kDudeBurningBeast: - aiNewState(pSprite, pXSprite, &beastBurnGoto); + aiNewState(actor, &beastBurnGoto); break; case kDudeBurningTinyCaleb: - aiNewState(pSprite, pXSprite, &tinycalebBurnGoto); + aiNewState(actor, &tinycalebBurnGoto); break; #ifdef NOONE_EXTENSIONS case kDudeModernCustomBurning: - aiNewState(pSprite, pXSprite, &genDudeBurnSearch); + aiNewState(actor, &genDudeBurnSearch); break; #endif } diff --git a/source/blood/src/aicaleb.cpp b/source/blood/src/aicaleb.cpp index 619e2a2a8..4aaac27fd 100644 --- a/source/blood/src/aicaleb.cpp +++ b/source/blood/src/aicaleb.cpp @@ -123,9 +123,9 @@ static void calebThinkGoto(DBloodActor* actor) if (nDist < 512 && klabs(pSprite->ang - nAngle) < pDudeInfo->periphery) { if (pXSector && pXSector->Underwater) - aiNewState(pSprite, pXSprite, &tinycalebSwimSearch); + aiNewState(actor, &tinycalebSwimSearch); else - aiNewState(pSprite, pXSprite, &tinycalebSearch); + aiNewState(actor, &tinycalebSearch); } aiThinkTarget(actor); } @@ -143,9 +143,9 @@ static void calebThinkChase(DBloodActor* actor) else pXSector = NULL; if (pXSector && pXSector->Underwater) - aiNewState(pSprite, pXSprite, &tinycalebSwimSearch); + aiNewState(actor, &tinycalebSwimSearch); else - aiNewState(pSprite, pXSprite, &tinycalebSearch); + aiNewState(actor, &tinycalebSearch); return; } assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); @@ -165,11 +165,11 @@ static void calebThinkChase(DBloodActor* actor) else pXSector = NULL; if (pXSector && pXSector->Underwater) - aiNewState(pSprite, pXSprite, &tinycalebSwimSearch); + aiNewState(actor, &tinycalebSwimSearch); else { aiPlay3DSound(pSprite, 11000+Random(4), AI_SFX_PRIORITY_1, -1); - aiNewState(pSprite, pXSprite, &tinycalebSearch); + aiNewState(actor, &tinycalebSearch); } return; } @@ -182,9 +182,9 @@ static void calebThinkChase(DBloodActor* actor) else pXSector = NULL; if (pXSector && pXSector->Underwater) - aiNewState(pSprite, pXSprite, &tinycalebSwimSearch); + aiNewState(actor, &tinycalebSwimSearch); else - aiNewState(pSprite, pXSprite, &tinycalebSearch); + aiNewState(actor, &tinycalebSearch); return; } int nDist = approxDist(dx, dy); @@ -212,31 +212,31 @@ static void calebThinkChase(DBloodActor* actor) { case -1: if (pXSector && pXSector->Underwater) - aiNewState(pSprite, pXSprite, &tinycalebSwimAttack); + aiNewState(actor, &tinycalebSwimAttack); else - aiNewState(pSprite, pXSprite, &tinycalebAttack); + aiNewState(actor, &tinycalebAttack); break; case 3: if (pSprite->type != sprite[gHitInfo.hitsprite].type) { if (pXSector && pXSector->Underwater) - aiNewState(pSprite, pXSprite, &tinycalebSwimAttack); + aiNewState(actor, &tinycalebSwimAttack); else - aiNewState(pSprite, pXSprite, &tinycalebAttack); + aiNewState(actor, &tinycalebAttack); } else { if (pXSector && pXSector->Underwater) - aiNewState(pSprite, pXSprite, &tinycalebSwimDodge); + aiNewState(actor, &tinycalebSwimDodge); else - aiNewState(pSprite, pXSprite, &tinycalebDodge); + aiNewState(actor, &tinycalebDodge); } break; default: if (pXSector && pXSector->Underwater) - aiNewState(pSprite, pXSprite, &tinycalebSwimAttack); + aiNewState(actor, &tinycalebSwimAttack); else - aiNewState(pSprite, pXSprite, &tinycalebAttack); + aiNewState(actor, &tinycalebAttack); break; } } @@ -252,9 +252,9 @@ static void calebThinkChase(DBloodActor* actor) else pXSector = NULL; if (pXSector && pXSector->Underwater) - aiNewState(pSprite, pXSprite, &tinycalebSwimGoto); + aiNewState(actor, &tinycalebSwimGoto); else - aiNewState(pSprite, pXSprite, &tinycalebGoto); + aiNewState(actor, &tinycalebGoto); if (Chance(0x2000)) sfxPlay3DSound(pSprite, 10000 + Random(5), -1, 0); pXSprite->target = -1; @@ -272,7 +272,7 @@ static void calebThinkSwimGoto(DBloodActor* actor) int nDist = approxDist(dx, dy); aiChooseDirection(pSprite, pXSprite, nAngle); if (nDist < 512 && klabs(pSprite->ang - nAngle) < pDudeInfo->periphery) - aiNewState(pSprite, pXSprite, &tinycalebSwimSearch); + aiNewState(actor, &tinycalebSwimSearch); aiThinkTarget(actor); } @@ -282,7 +282,7 @@ static void calebThinkSwimChase(DBloodActor* actor) auto pSprite = &actor->s(); if (pXSprite->target == -1) { - aiNewState(pSprite, pXSprite, &tinycalebSwimGoto); + aiNewState(actor, &tinycalebSwimGoto); return; } assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); @@ -295,12 +295,12 @@ static void calebThinkSwimChase(DBloodActor* actor) aiChooseDirection(pSprite, pXSprite, getangle(dx, dy)); if (pXTarget->health == 0) { - aiNewState(pSprite, pXSprite, &tinycalebSwimSearch); + aiNewState(actor, &tinycalebSwimSearch); return; } if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], kPwUpShadowCloak) > 0) { - aiNewState(pSprite, pXSprite, &tinycalebSwimSearch); + aiNewState(actor, &tinycalebSwimSearch); return; } int nDist = approxDist(dx, dy); @@ -316,14 +316,14 @@ static void calebThinkSwimChase(DBloodActor* actor) { aiSetTarget(pXSprite, pXSprite->target); if (nDist < 0x400 && klabs(nDeltaAngle) < 85) - aiNewState(pSprite, pXSprite, &tinycalebSwimAttack); + aiNewState(actor, &tinycalebSwimAttack); else - aiNewState(pSprite, pXSprite, &tinycaleb13967C); + aiNewState(actor, &tinycaleb13967C); } } return; } - aiNewState(pSprite, pXSprite, &tinycalebSwimGoto); + aiNewState(actor, &tinycalebSwimGoto); pXSprite->target = -1; } diff --git a/source/blood/src/aicerber.cpp b/source/blood/src/aicerber.cpp index 7d91beb73..4c7b0bbf1 100644 --- a/source/blood/src/aicerber.cpp +++ b/source/blood/src/aicerber.cpp @@ -290,9 +290,9 @@ static void cerberusThinkTarget(DBloodActor* actor) POINT3D *pTarget = &baseSprite[pSprite->index]; aiSetTarget(pXSprite, pTarget->x, pTarget->y, pTarget->z); if (pSprite->type == kDudeCerberusTwoHead) - aiNewState(pSprite, pXSprite, &cerberus139890); + aiNewState(actor, &cerberus139890); else - aiNewState(pSprite, pXSprite, &cerberus1398AC); + aiNewState(actor, &cerberus1398AC); return; } if (Chance(pDudeInfo->alertChance)) @@ -352,10 +352,10 @@ static void cerberusThinkGoto(DBloodActor* actor) { switch (pSprite->type) { case kDudeCerberusTwoHead: - aiNewState(pSprite, pXSprite, &cerberusSearch); + aiNewState(actor, &cerberusSearch); break; case kDudeCerberusOneHead: - aiNewState(pSprite, pXSprite, &cerberus2Search); + aiNewState(actor, &cerberus2Search); break; } } @@ -369,10 +369,10 @@ static void cerberusThinkChase(DBloodActor* actor) if (pXSprite->target == -1) { switch (pSprite->type) { case kDudeCerberusTwoHead: - aiNewState(pSprite, pXSprite, &cerberusGoto); + aiNewState(actor, &cerberusGoto); break; case kDudeCerberusOneHead: - aiNewState(pSprite, pXSprite, &cerberus2Goto); + aiNewState(actor, &cerberus2Goto); break; } return; @@ -400,10 +400,10 @@ static void cerberusThinkChase(DBloodActor* actor) if (pXTarget->health == 0) { switch (pSprite->type) { case kDudeCerberusTwoHead: - aiNewState(pSprite, pXSprite, &cerberusSearch); + aiNewState(actor, &cerberusSearch); break; case kDudeCerberusOneHead: - aiNewState(pSprite, pXSprite, &cerberus2Search); + aiNewState(actor, &cerberus2Search); break; } return; @@ -412,10 +412,10 @@ static void cerberusThinkChase(DBloodActor* actor) if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], kPwUpShadowCloak) > 0) { switch (pSprite->type) { case kDudeCerberusTwoHead: - aiNewState(pSprite, pXSprite, &cerberusSearch); + aiNewState(actor, &cerberusSearch); break; case kDudeCerberusOneHead: - aiNewState(pSprite, pXSprite, &cerberus2Search); + aiNewState(actor, &cerberus2Search); break; } return; @@ -434,10 +434,10 @@ static void cerberusThinkChase(DBloodActor* actor) if (nDist < 0x1b00 && nDist > 0xd00 && klabs(nDeltaAngle) < 85) { switch (pSprite->type) { case kDudeCerberusTwoHead: - aiNewState(pSprite, pXSprite, &cerberusBurn); + aiNewState(actor, &cerberusBurn); break; case kDudeCerberusOneHead: - aiNewState(pSprite, pXSprite, &cerberus2Burn); + aiNewState(actor, &cerberus2Burn); break; } } @@ -445,10 +445,10 @@ static void cerberusThinkChase(DBloodActor* actor) else if (nDist < 0xb00 && nDist > 0x500 && klabs(nDeltaAngle) < 85) { switch (pSprite->type) { case kDudeCerberusTwoHead: - aiNewState(pSprite, pXSprite, &cerberus3Burn); + aiNewState(actor, &cerberus3Burn); break; case kDudeCerberusOneHead: - aiNewState(pSprite, pXSprite, &cerberus4Burn); + aiNewState(actor, &cerberus4Burn); break; } } @@ -459,34 +459,34 @@ static void cerberusThinkChase(DBloodActor* actor) case kDudeCerberusTwoHead: switch (hit) { case -1: - aiNewState(pSprite, pXSprite, &cerberusBite); + aiNewState(actor, &cerberusBite); break; case 3: if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeHellHound) - aiNewState(pSprite, pXSprite, &cerberusBite); + aiNewState(actor, &cerberusBite); break; case 0: case 4: break; default: - aiNewState(pSprite, pXSprite, &cerberusBite); + aiNewState(actor, &cerberusBite); break; } break; case kDudeCerberusOneHead: switch (hit) { case -1: - aiNewState(pSprite, pXSprite, &cerberus2Bite); + aiNewState(actor, &cerberus2Bite); break; case 3: if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeHellHound) - aiNewState(pSprite, pXSprite, &cerberus2Bite); + aiNewState(actor, &cerberus2Bite); break; case 0: case 4: break; default: - aiNewState(pSprite, pXSprite, &cerberus2Bite); + aiNewState(actor, &cerberus2Bite); break; } break; @@ -499,10 +499,10 @@ static void cerberusThinkChase(DBloodActor* actor) switch (pSprite->type) { case kDudeCerberusTwoHead: - aiNewState(pSprite, pXSprite, &cerberusGoto); + aiNewState(actor, &cerberusGoto); break; case kDudeCerberusOneHead: - aiNewState(pSprite, pXSprite, &cerberus2Goto); + aiNewState(actor, &cerberus2Goto); break; } pXSprite->target = -1; diff --git a/source/blood/src/aicult.cpp b/source/blood/src/aicult.cpp index 169e1612a..ebf862b3f 100644 --- a/source/blood/src/aicult.cpp +++ b/source/blood/src/aicult.cpp @@ -241,11 +241,11 @@ static void cultThinkGoto(DBloodActor* actor) switch (pXSprite->medium) { case kMediumNormal: - aiNewState(pSprite, pXSprite, &cultistSearch); + aiNewState(actor, &cultistSearch); break; case kMediumWater: case kMediumGoo: - aiNewState(pSprite, pXSprite, &cultistSwimSearch); + aiNewState(actor, &cultistSwimSearch); break; } } @@ -261,11 +261,11 @@ static void cultThinkChase(DBloodActor* actor) switch (pXSprite->medium) { case kMediumNormal: - aiNewState(pSprite, pXSprite, &cultistGoto); + aiNewState(actor, &cultistGoto); break; case kMediumWater: case kMediumGoo: - aiNewState(pSprite, pXSprite, &cultistSwimGoto); + aiNewState(actor, &cultistSwimGoto); break; } return; @@ -283,7 +283,7 @@ static void cultThinkChase(DBloodActor* actor) switch (pXSprite->medium) { case kMediumNormal: - aiNewState(pSprite, pXSprite, &cultistSearch); + aiNewState(actor, &cultistSearch); if (pSprite->type == kDudeCultistTommy) aiPlay3DSound(pSprite, 4021+Random(4), AI_SFX_PRIORITY_1, -1); else @@ -291,7 +291,7 @@ static void cultThinkChase(DBloodActor* actor) break; case kMediumWater: case kMediumGoo: - aiNewState(pSprite, pXSprite, &cultistSwimSearch); + aiNewState(actor, &cultistSwimSearch); break; } return; @@ -301,11 +301,11 @@ static void cultThinkChase(DBloodActor* actor) switch (pXSprite->medium) { case kMediumNormal: - aiNewState(pSprite, pXSprite, &cultistSearch); + aiNewState(actor, &cultistSearch); break; case kMediumWater: case kMediumGoo: - aiNewState(pSprite, pXSprite, &cultistSwimSearch); + aiNewState(actor, &cultistSwimSearch); break; } return; @@ -333,17 +333,17 @@ static void cultThinkChase(DBloodActor* actor) { case -1: if (pXSprite->medium != kMediumWater && pXSprite->medium != kMediumGoo) - aiNewState(pSprite, pXSprite, &cultistTThrow); + aiNewState(actor, &cultistTThrow); break; case 0: case 4: break; case 3: if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeCultistShotgun && pXSprite->medium != kMediumWater && pXSprite->medium != kMediumGoo) - aiNewState(pSprite, pXSprite, &cultistTThrow); + aiNewState(actor, &cultistTThrow); break; default: - aiNewState(pSprite, pXSprite, &cultistTThrow); + aiNewState(actor, &cultistTThrow); break; } } @@ -354,39 +354,39 @@ static void cultThinkChase(DBloodActor* actor) { case -1: if (!dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) - aiNewState(pSprite, pXSprite, &cultistTFire); + aiNewState(actor, &cultistTFire); else if (dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) - aiNewState(pSprite, pXSprite, &cultistTProneFire); + aiNewState(actor, &cultistTProneFire); else if (dudeIsPlayingSeq(pSprite, 13) && (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo)) - aiNewState(pSprite, pXSprite, &cultistTSwimFire); + aiNewState(actor, &cultistTSwimFire); break; case 3: if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeCultistShotgun) { if (!dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) - aiNewState(pSprite, pXSprite, &cultistTFire); + aiNewState(actor, &cultistTFire); else if (dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) - aiNewState(pSprite, pXSprite, &cultistTProneFire); + aiNewState(actor, &cultistTProneFire); else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) - aiNewState(pSprite, pXSprite, &cultistTSwimFire); + aiNewState(actor, &cultistTSwimFire); } else { if (!dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) - aiNewState(pSprite, pXSprite, &cultistDodge); + aiNewState(actor, &cultistDodge); else if (dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) - aiNewState(pSprite, pXSprite, &cultistProneDodge); + aiNewState(actor, &cultistProneDodge); else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) - aiNewState(pSprite, pXSprite, &cultistSwimDodge); + aiNewState(actor, &cultistSwimDodge); } break; default: if (!dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) - aiNewState(pSprite, pXSprite, &cultistTFire); + aiNewState(actor, &cultistTFire); else if (dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) - aiNewState(pSprite, pXSprite, &cultistTProneFire); + aiNewState(actor, &cultistTProneFire); else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) - aiNewState(pSprite, pXSprite, &cultistTSwimFire); + aiNewState(actor, &cultistTSwimFire); break; } } @@ -401,17 +401,17 @@ static void cultThinkChase(DBloodActor* actor) { case -1: if (pXSprite->medium != kMediumWater && pXSprite->medium != kMediumGoo) - aiNewState(pSprite, pXSprite, &cultistSThrow); + aiNewState(actor, &cultistSThrow); break; case 0: case 4: break; case 3: if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeCultistShotgun && pXSprite->medium != kMediumWater && pXSprite->medium != kMediumGoo) - aiNewState(pSprite, pXSprite, &cultistSThrow); + aiNewState(actor, &cultistSThrow); break; default: - aiNewState(pSprite, pXSprite, &cultistSThrow); + aiNewState(actor, &cultistSThrow); break; } } @@ -422,39 +422,39 @@ static void cultThinkChase(DBloodActor* actor) { case -1: if (!dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) - aiNewState(pSprite, pXSprite, &cultistSFire); + aiNewState(actor, &cultistSFire); else if (dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) - aiNewState(pSprite, pXSprite, &cultistSProneFire); + aiNewState(actor, &cultistSProneFire); else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) - aiNewState(pSprite, pXSprite, &cultistSSwimFire); + aiNewState(actor, &cultistSSwimFire); break; case 3: if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeCultistTommy) { if (!dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) - aiNewState(pSprite, pXSprite, &cultistSFire); + aiNewState(actor, &cultistSFire); else if (dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) - aiNewState(pSprite, pXSprite, &cultistSProneFire); + aiNewState(actor, &cultistSProneFire); else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) - aiNewState(pSprite, pXSprite, &cultistSSwimFire); + aiNewState(actor, &cultistSSwimFire); } else { if (!dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) - aiNewState(pSprite, pXSprite, &cultistDodge); + aiNewState(actor, &cultistDodge); else if (dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) - aiNewState(pSprite, pXSprite, &cultistProneDodge); + aiNewState(actor, &cultistProneDodge); else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) - aiNewState(pSprite, pXSprite, &cultistSwimDodge); + aiNewState(actor, &cultistSwimDodge); } break; default: if (!dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) - aiNewState(pSprite, pXSprite, &cultistSFire); + aiNewState(actor, &cultistSFire); else if (dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) - aiNewState(pSprite, pXSprite, &cultistSProneFire); + aiNewState(actor, &cultistSProneFire); else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) - aiNewState(pSprite, pXSprite, &cultistSSwimFire); + aiNewState(actor, &cultistSSwimFire); break; } } @@ -469,17 +469,17 @@ static void cultThinkChase(DBloodActor* actor) { case -1: if (pXSprite->medium != kMediumWater && pXSprite->medium != kMediumGoo) - aiNewState(pSprite, pXSprite, &cultistTsThrow); + aiNewState(actor, &cultistTsThrow); break; case 0: case 4: break; case 3: if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeCultistShotgun && pXSprite->medium != kMediumWater && pXSprite->medium != kMediumGoo) - aiNewState(pSprite, pXSprite, &cultistTsThrow); + aiNewState(actor, &cultistTsThrow); break; default: - aiNewState(pSprite, pXSprite, &cultistTsThrow); + aiNewState(actor, &cultistTsThrow); break; } } @@ -490,39 +490,39 @@ static void cultThinkChase(DBloodActor* actor) { case -1: if (!dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) - aiNewState(pSprite, pXSprite, &cultistTsFire); + aiNewState(actor, &cultistTsFire); else if (dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) - aiNewState(pSprite, pXSprite, &cultistTsProneFire); + aiNewState(actor, &cultistTsProneFire); else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) - aiNewState(pSprite, pXSprite, &cultistTsSwimFire); + aiNewState(actor, &cultistTsSwimFire); break; case 3: if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeCultistTommy) { if (!dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) - aiNewState(pSprite, pXSprite, &cultistTsFire); + aiNewState(actor, &cultistTsFire); else if (dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) - aiNewState(pSprite, pXSprite, &cultistTsProneFire); + aiNewState(actor, &cultistTsProneFire); else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) - aiNewState(pSprite, pXSprite, &cultistTsSwimFire); + aiNewState(actor, &cultistTsSwimFire); } else { if (!dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) - aiNewState(pSprite, pXSprite, &cultistDodge); + aiNewState(actor, &cultistDodge); else if (dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) - aiNewState(pSprite, pXSprite, &cultistProneDodge); + aiNewState(actor, &cultistProneDodge); else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) - aiNewState(pSprite, pXSprite, &cultistSwimDodge); + aiNewState(actor, &cultistSwimDodge); } break; default: if (!dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) - aiNewState(pSprite, pXSprite, &cultistTsFire); + aiNewState(actor, &cultistTsFire); else if (dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) - aiNewState(pSprite, pXSprite, &cultistTsProneFire); + aiNewState(actor, &cultistTsProneFire); else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) - aiNewState(pSprite, pXSprite, &cultistTsSwimFire); + aiNewState(actor, &cultistTsSwimFire); break; } } @@ -536,16 +536,16 @@ static void cultThinkChase(DBloodActor* actor) { case -1: if (pXSprite->medium != kMediumWater && pXSprite->medium != kMediumGoo) - aiNewState(pSprite, pXSprite, &cultistDThrow); + aiNewState(actor, &cultistDThrow); break; case 4: break; case 3: if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeCultistShotgun && pXSprite->medium != kMediumWater && pXSprite->medium != kMediumGoo) - aiNewState(pSprite, pXSprite, &cultistDThrow); + aiNewState(actor, &cultistDThrow); break; default: - aiNewState(pSprite, pXSprite, &cultistDThrow); + aiNewState(actor, &cultistDThrow); break; } } @@ -557,16 +557,16 @@ static void cultThinkChase(DBloodActor* actor) { case -1: if (pXSprite->medium != 1 && pXSprite->medium != kMediumGoo) - aiNewState(pSprite, pXSprite, &cultist139A78); + aiNewState(actor, &cultist139A78); break; case 4: break; case 3: if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeCultistShotgun && pXSprite->medium != kMediumWater && pXSprite->medium != kMediumGoo) - aiNewState(pSprite, pXSprite, &cultist139A78); + aiNewState(actor, &cultist139A78); break; default: - aiNewState(pSprite, pXSprite, &cultist139A78); + aiNewState(actor, &cultist139A78); break; } } @@ -581,17 +581,17 @@ static void cultThinkChase(DBloodActor* actor) { case -1: if (pXSprite->medium != kMediumWater && pXSprite->medium != kMediumGoo) - aiNewState(pSprite, pXSprite, &cultistSThrow); + aiNewState(actor, &cultistSThrow); break; case 0: case 4: break; case 3: if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeCultistShotgun && pXSprite->medium != kMediumWater && pXSprite->medium != kMediumGoo) - aiNewState(pSprite, pXSprite, &cultistSThrow); + aiNewState(actor, &cultistSThrow); break; default: - aiNewState(pSprite, pXSprite, &cultistSThrow); + aiNewState(actor, &cultistSThrow); break; } } @@ -602,39 +602,39 @@ static void cultThinkChase(DBloodActor* actor) { case -1: if (!dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) - aiNewState(pSprite, pXSprite, &cultistSFire); + aiNewState(actor, &cultistSFire); else if (dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) - aiNewState(pSprite, pXSprite, &cultistSProneFire); + aiNewState(actor, &cultistSProneFire); else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) - aiNewState(pSprite, pXSprite, &cultistSSwimFire); + aiNewState(actor, &cultistSSwimFire); break; case 3: if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeCultistTommy) { if (!dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) - aiNewState(pSprite, pXSprite, &cultistSFire); + aiNewState(actor, &cultistSFire); else if (dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) - aiNewState(pSprite, pXSprite, &cultistSProneFire); + aiNewState(actor, &cultistSProneFire); else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) - aiNewState(pSprite, pXSprite, &cultistSSwimFire); + aiNewState(actor, &cultistSSwimFire); } else { if (!dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) - aiNewState(pSprite, pXSprite, &cultistDodge); + aiNewState(actor, &cultistDodge); else if (dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) - aiNewState(pSprite, pXSprite, &cultistProneDodge); + aiNewState(actor, &cultistProneDodge); else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) - aiNewState(pSprite, pXSprite, &cultistSwimDodge); + aiNewState(actor, &cultistSwimDodge); } break; default: if (!dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) - aiNewState(pSprite, pXSprite, &cultistSFire); + aiNewState(actor, &cultistSFire); else if (dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) - aiNewState(pSprite, pXSprite, &cultistSProneFire); + aiNewState(actor, &cultistSProneFire); else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) - aiNewState(pSprite, pXSprite, &cultistSSwimFire); + aiNewState(actor, &cultistSSwimFire); break; } } @@ -647,11 +647,11 @@ static void cultThinkChase(DBloodActor* actor) switch (pXSprite->medium) { case kMediumNormal: - aiNewState(pSprite, pXSprite, &cultistGoto); + aiNewState(actor, &cultistGoto); break; case kMediumWater: case kMediumGoo: - aiNewState(pSprite, pXSprite, &cultistSwimGoto); + aiNewState(actor, &cultistSwimGoto); break; } pXSprite->target = -1; diff --git a/source/blood/src/aigarg.cpp b/source/blood/src/aigarg.cpp index 6ab717a1d..de69f6baf 100644 --- a/source/blood/src/aigarg.cpp +++ b/source/blood/src/aigarg.cpp @@ -242,7 +242,7 @@ static void gargThinkTarget(DBloodActor* actor) pXSprite->goalAng += 256; POINT3D *pTarget = &baseSprite[pSprite->index]; aiSetTarget(pXSprite, pTarget->x, pTarget->y, pTarget->z); - aiNewState(pSprite, pXSprite, &gargoyleTurn); + aiNewState(actor, &gargoyleTurn); return; } if (Chance(pDudeInfo->alertChance)) @@ -307,7 +307,7 @@ static void gargThinkGoto(DBloodActor* actor) int nDist = approxDist(dx, dy); aiChooseDirection(pSprite, pXSprite, nAngle); if (nDist < 512 && klabs(pSprite->ang - nAngle) < pDudeInfo->periphery) - aiNewState(pSprite, pXSprite, &gargoyleFSearch); + aiNewState(actor, &gargoyleFSearch); aiThinkTarget(actor); } @@ -377,7 +377,7 @@ static void gargThinkChase(DBloodActor* actor) auto pSprite = &actor->s(); if (pXSprite->target == -1) { - aiNewState(pSprite, pXSprite, &gargoyleFGoto); + aiNewState(actor, &gargoyleFGoto); return; } ///assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); @@ -398,12 +398,12 @@ static void gargThinkChase(DBloodActor* actor) aiChooseDirection(pSprite, pXSprite, getangle(dx, dy)); if (pXTarget->health == 0) { - aiNewState(pSprite, pXSprite, &gargoyleFSearch); + aiNewState(actor, &gargoyleFSearch); return; } if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], kPwUpShadowCloak) > 0) { - aiNewState(pSprite, pXSprite, &gargoyleFSearch); + aiNewState(actor, &gargoyleFSearch); return; } int nDist = approxDist(dx, dy); @@ -430,7 +430,7 @@ static void gargThinkChase(DBloodActor* actor) { case -1: sfxPlay3DSound(pSprite, 1408, 0, 0); - aiNewState(pSprite, pXSprite, &gargoyleFThrow); + aiNewState(actor, &gargoyleFThrow); break; case 0: case 4: @@ -439,12 +439,12 @@ static void gargThinkChase(DBloodActor* actor) if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeGargoyleStone) { sfxPlay3DSound(pSprite, 1408, 0, 0); - aiNewState(pSprite, pXSprite, &gargoyleFThrow); + aiNewState(actor, &gargoyleFThrow); } break; default: sfxPlay3DSound(pSprite, 1408, 0, 0); - aiNewState(pSprite, pXSprite, &gargoyleFThrow); + aiNewState(actor, &gargoyleFThrow); break; } } @@ -455,7 +455,7 @@ static void gargThinkChase(DBloodActor* actor) { case -1: sfxPlay3DSound(pSprite, 1406, 0, 0); - aiNewState(pSprite, pXSprite, &gargoyleFSlash); + aiNewState(actor, &gargoyleFSlash); break; case 0: case 4: @@ -464,19 +464,19 @@ static void gargThinkChase(DBloodActor* actor) if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeGargoyleStone) { sfxPlay3DSound(pSprite, 1406, 0, 0); - aiNewState(pSprite, pXSprite, &gargoyleFSlash); + aiNewState(actor, &gargoyleFSlash); } break; default: sfxPlay3DSound(pSprite, 1406, 0, 0); - aiNewState(pSprite, pXSprite, &gargoyleFSlash); + aiNewState(actor, &gargoyleFSlash); break; } } else if ((height2-height > 0x2000 || floorZ-bottom > 0x2000) && nDist < 0x1400 && nDist > 0xa00) { aiPlay3DSound(pSprite, 1400, AI_SFX_PRIORITY_1, -1); - aiNewState(pSprite, pXSprite, &gargoyleSwoop); + aiNewState(actor, &gargoyleSwoop); } else if ((height2-height < 0x2000 || floorZ-bottom < 0x2000) && klabs(nDeltaAngle) < 85) aiPlay3DSound(pSprite, 1400, AI_SFX_PRIORITY_1, -1); @@ -489,7 +489,7 @@ static void gargThinkChase(DBloodActor* actor) { case -1: sfxPlay3DSound(pSprite, 1457, 0, 0); - aiNewState(pSprite, pXSprite, &gargoyleSBlast); + aiNewState(actor, &gargoyleSBlast); break; case 0: case 4: @@ -498,12 +498,12 @@ static void gargThinkChase(DBloodActor* actor) if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeGargoyleFlesh) { sfxPlay3DSound(pSprite, 1457, 0, 0); - aiNewState(pSprite, pXSprite, &gargoyleSBlast); + aiNewState(actor, &gargoyleSBlast); } break; default: sfxPlay3DSound(pSprite, 1457, 0, 0); - aiNewState(pSprite, pXSprite, &gargoyleSBlast); + aiNewState(actor, &gargoyleSBlast); break; } } @@ -513,17 +513,17 @@ static void gargThinkChase(DBloodActor* actor) switch (hit) { case -1: - aiNewState(pSprite, pXSprite, &gargoyleFSlash); + aiNewState(actor, &gargoyleFSlash); break; case 0: case 4: break; case 3: if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeGargoyleFlesh) - aiNewState(pSprite, pXSprite, &gargoyleFSlash); + aiNewState(actor, &gargoyleFSlash); break; default: - aiNewState(pSprite, pXSprite, &gargoyleFSlash); + aiNewState(actor, &gargoyleFSlash); break; } } @@ -533,7 +533,7 @@ static void gargThinkChase(DBloodActor* actor) aiPlay3DSound(pSprite, 1400, AI_SFX_PRIORITY_1, -1); else aiPlay3DSound(pSprite, 1450, AI_SFX_PRIORITY_1, -1); - aiNewState(pSprite, pXSprite, &gargoyleSwoop); + aiNewState(actor, &gargoyleSwoop); } else if ((height2-height < 0x2000 || floorZ-bottom < 0x2000) && klabs(nDeltaAngle) < 85) aiPlay3DSound(pSprite, 1450, AI_SFX_PRIORITY_1, -1); @@ -544,12 +544,12 @@ static void gargThinkChase(DBloodActor* actor) } else { - aiNewState(pSprite, pXSprite, &gargoyleFly); + aiNewState(actor, &gargoyleFly); return; } } - aiNewState(pSprite, pXSprite, &gargoyleFGoto); + aiNewState(actor, &gargoyleFGoto); pXSprite->target = -1; } diff --git a/source/blood/src/aighost.cpp b/source/blood/src/aighost.cpp index a7f07e2e8..1e312002b 100644 --- a/source/blood/src/aighost.cpp +++ b/source/blood/src/aighost.cpp @@ -218,7 +218,7 @@ static void ghostThinkTarget(DBloodActor* actor) pXSprite->goalAng += 256; POINT3D *pTarget = &baseSprite[pSprite->index]; aiSetTarget(pXSprite, pTarget->x, pTarget->y, pTarget->z); - aiNewState(pSprite, pXSprite, &ghostTurn); + aiNewState(actor, &ghostTurn); return; } if (Chance(pDudeInfo->alertChance)) @@ -282,7 +282,7 @@ static void ghostThinkGoto(DBloodActor* actor) int nDist = approxDist(dx, dy); aiChooseDirection(pSprite, pXSprite, nAngle); if (nDist < 512 && klabs(pSprite->ang - nAngle) < pDudeInfo->periphery) - aiNewState(pSprite, pXSprite, &ghostSearch); + aiNewState(actor, &ghostSearch); aiThinkTarget(actor); } @@ -354,7 +354,7 @@ static void ghostThinkChase(DBloodActor* actor) auto pSprite = &actor->s(); if (pXSprite->target == -1) { - aiNewState(pSprite, pXSprite, &ghostGoto); + aiNewState(actor, &ghostGoto); return; } ///assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); @@ -375,12 +375,12 @@ static void ghostThinkChase(DBloodActor* actor) aiChooseDirection(pSprite, pXSprite, getangle(dx, dy)); if (pXTarget->health == 0) { - aiNewState(pSprite, pXSprite, &ghostSearch); + aiNewState(actor, &ghostSearch); return; } if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], kPwUpShadowCloak) > 0) { - aiNewState(pSprite, pXSprite, &ghostSearch); + aiNewState(actor, &ghostSearch); return; } int nDist = approxDist(dx, dy); @@ -405,17 +405,17 @@ static void ghostThinkChase(DBloodActor* actor) switch (hit) { case -1: - aiNewState(pSprite, pXSprite, &ghostBlast); + aiNewState(actor, &ghostBlast); break; case 0: case 4: break; case 3: if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudePhantasm) - aiNewState(pSprite, pXSprite, &ghostBlast); + aiNewState(actor, &ghostBlast); break; default: - aiNewState(pSprite, pXSprite, &ghostBlast); + aiNewState(actor, &ghostBlast); break; } } @@ -425,24 +425,24 @@ static void ghostThinkChase(DBloodActor* actor) switch (hit) { case -1: - aiNewState(pSprite, pXSprite, &ghostSlash); + aiNewState(actor, &ghostSlash); break; case 0: case 4: break; case 3: if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudePhantasm) - aiNewState(pSprite, pXSprite, &ghostSlash); + aiNewState(actor, &ghostSlash); break; default: - aiNewState(pSprite, pXSprite, &ghostSlash); + aiNewState(actor, &ghostSlash); break; } } else if ((height2-height > 0x2000 || floorZ-bottom > 0x2000) && nDist < 0x1400 && nDist > 0x800) { aiPlay3DSound(pSprite, 1600, AI_SFX_PRIORITY_1, -1); - aiNewState(pSprite, pXSprite, &ghostSwoop); + aiNewState(actor, &ghostSwoop); } else if ((height2-height < 0x2000 || floorZ-bottom < 0x2000) && klabs(nDeltaAngle) < 85) aiPlay3DSound(pSprite, 1600, AI_SFX_PRIORITY_1, -1); @@ -453,12 +453,12 @@ static void ghostThinkChase(DBloodActor* actor) } else { - aiNewState(pSprite, pXSprite, &ghostFly); + aiNewState(actor, &ghostFly); return; } } - aiNewState(pSprite, pXSprite, &ghostGoto); + aiNewState(actor, &ghostGoto); pXSprite->target = -1; } diff --git a/source/blood/src/aigilbst.cpp b/source/blood/src/aigilbst.cpp index 81c1f8a7b..78b8b966e 100644 --- a/source/blood/src/aigilbst.cpp +++ b/source/blood/src/aigilbst.cpp @@ -115,9 +115,9 @@ static void gillThinkGoto(DBloodActor* actor) if (nDist < 512 && klabs(pSprite->ang - nAngle) < pDudeInfo->periphery) { if (pXSector && pXSector->Underwater) - aiNewState(pSprite, pXSprite, &gillBeastSwimSearch); + aiNewState(actor, &gillBeastSwimSearch); else - aiNewState(pSprite, pXSprite, &gillBeastSearch); + aiNewState(actor, &gillBeastSearch); } aiThinkTarget(actor); } @@ -135,9 +135,9 @@ static void gillThinkChase(DBloodActor* actor) else pXSector = NULL; if (pXSector && pXSector->Underwater) - aiNewState(pSprite, pXSprite, &gillBeastSwimSearch); + aiNewState(actor, &gillBeastSwimSearch); else - aiNewState(pSprite, pXSprite, &gillBeastSearch); + aiNewState(actor, &gillBeastSearch); return; } assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); @@ -157,9 +157,9 @@ static void gillThinkChase(DBloodActor* actor) else pXSector = NULL; if (pXSector && pXSector->Underwater) - aiNewState(pSprite, pXSprite, &gillBeastSwimSearch); + aiNewState(actor, &gillBeastSwimSearch); else - aiNewState(pSprite, pXSprite, &gillBeastSearch); + aiNewState(actor, &gillBeastSearch); return; } if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], kPwUpShadowCloak) > 0) @@ -171,9 +171,9 @@ static void gillThinkChase(DBloodActor* actor) else pXSector = NULL; if (pXSector && pXSector->Underwater) - aiNewState(pSprite, pXSprite, &gillBeastSwimSearch); + aiNewState(actor, &gillBeastSwimSearch); else - aiNewState(pSprite, pXSprite, &gillBeastSearch); + aiNewState(actor, &gillBeastSearch); return; } int nDist = approxDist(dx, dy); @@ -201,31 +201,31 @@ static void gillThinkChase(DBloodActor* actor) { case -1: if (pXSector && pXSector->Underwater) - aiNewState(pSprite, pXSprite, &gillBeastSwimBite); + aiNewState(actor, &gillBeastSwimBite); else - aiNewState(pSprite, pXSprite, &gillBeastBite); + aiNewState(actor, &gillBeastBite); break; case 3: if (pSprite->type != sprite[gHitInfo.hitsprite].type) { if (pXSector && pXSector->Underwater) - aiNewState(pSprite, pXSprite, &gillBeastSwimBite); + aiNewState(actor, &gillBeastSwimBite); else - aiNewState(pSprite, pXSprite, &gillBeastBite); + aiNewState(actor, &gillBeastBite); } else { if (pXSector && pXSector->Underwater) - aiNewState(pSprite, pXSprite, &gillBeastSwimDodge); + aiNewState(actor, &gillBeastSwimDodge); else - aiNewState(pSprite, pXSprite, &gillBeastDodge); + aiNewState(actor, &gillBeastDodge); } break; default: if (pXSector && pXSector->Underwater) - aiNewState(pSprite, pXSprite, &gillBeastSwimBite); + aiNewState(actor, &gillBeastSwimBite); else - aiNewState(pSprite, pXSprite, &gillBeastBite); + aiNewState(actor, &gillBeastBite); break; } } @@ -241,9 +241,9 @@ static void gillThinkChase(DBloodActor* actor) else pXSector = NULL; if (pXSector && pXSector->Underwater) - aiNewState(pSprite, pXSprite, &gillBeastSwimGoto); + aiNewState(actor, &gillBeastSwimGoto); else - aiNewState(pSprite, pXSprite, &gillBeastGoto); + aiNewState(actor, &gillBeastGoto); sfxPlay3DSound(pSprite, 1701, -1, 0); pXSprite->target = -1; } @@ -260,7 +260,7 @@ static void gillThinkSwimGoto(DBloodActor* actor) int nDist = approxDist(dx, dy); aiChooseDirection(pSprite, pXSprite, nAngle); if (nDist < 512 && klabs(pSprite->ang - nAngle) < pDudeInfo->periphery) - aiNewState(pSprite, pXSprite, &gillBeastSwimSearch); + aiNewState(actor, &gillBeastSwimSearch); aiThinkTarget(actor); } @@ -270,7 +270,7 @@ static void gillThinkSwimChase(DBloodActor* actor) auto pSprite = &actor->s(); if (pXSprite->target == -1) { - aiNewState(pSprite, pXSprite, &gillBeastSwimSearch); + aiNewState(actor, &gillBeastSwimSearch); return; } assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); @@ -283,12 +283,12 @@ static void gillThinkSwimChase(DBloodActor* actor) aiChooseDirection(pSprite, pXSprite, getangle(dx, dy)); if (pXTarget->health == 0) { - aiNewState(pSprite, pXSprite, &gillBeastSwimSearch); + aiNewState(actor, &gillBeastSwimSearch); return; } if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], kPwUpShadowCloak) > 0) { - aiNewState(pSprite, pXSprite, &gillBeastSwimSearch); + aiNewState(actor, &gillBeastSwimSearch); return; } int nDist = approxDist(dx, dy); @@ -304,19 +304,19 @@ static void gillThinkSwimChase(DBloodActor* actor) { aiSetTarget(pXSprite, pXSprite->target); if (nDist < 0x400 && klabs(nDeltaAngle) < 85) - aiNewState(pSprite, pXSprite, &gillBeastSwimBite); + aiNewState(actor, &gillBeastSwimBite); else { aiPlay3DSound(pSprite, 1700, AI_SFX_PRIORITY_1, -1); - aiNewState(pSprite, pXSprite, &gillBeast13A154); + aiNewState(actor, &gillBeast13A154); } } } else - aiNewState(pSprite, pXSprite, &gillBeast13A154); + aiNewState(actor, &gillBeast13A154); return; } - aiNewState(pSprite, pXSprite, &gillBeastSwimGoto); + aiNewState(actor, &gillBeastSwimGoto); pXSprite->target = -1; } diff --git a/source/blood/src/aihand.cpp b/source/blood/src/aihand.cpp index 78674a85d..afcd1064c 100644 --- a/source/blood/src/aihand.cpp +++ b/source/blood/src/aihand.cpp @@ -92,7 +92,7 @@ static void handThinkGoto(DBloodActor* actor) int nDist = approxDist(dx, dy); aiChooseDirection(pSprite, pXSprite, nAngle); if (nDist < 512 && klabs(pSprite->ang - nAngle) < pDudeInfo->periphery) - aiNewState(pSprite, pXSprite, &handSearch); + aiNewState(actor, &handSearch); aiThinkTarget(actor); } @@ -102,7 +102,7 @@ static void handThinkChase(DBloodActor* actor) auto pSprite = &actor->s(); if (pXSprite->target == -1) { - aiNewState(pSprite, pXSprite, &handGoto); + aiNewState(actor, &handGoto); return; } assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); @@ -115,12 +115,12 @@ static void handThinkChase(DBloodActor* actor) aiChooseDirection(pSprite, pXSprite, getangle(dx, dy)); if (pXTarget->health == 0) { - aiNewState(pSprite, pXSprite, &handSearch); + aiNewState(actor, &handSearch); return; } if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], kPwUpShadowCloak) > 0) { - aiNewState(pSprite, pXSprite, &handSearch); + aiNewState(actor, &handSearch); return; } int nDist = approxDist(dx, dy); @@ -134,13 +134,13 @@ static void handThinkChase(DBloodActor* actor) { aiSetTarget(pXSprite, pXSprite->target); if (nDist < 0x233 && klabs(nDeltaAngle) < 85 && gGameOptions.nGameType == 0) - aiNewState(pSprite, pXSprite, &handJump); + aiNewState(actor, &handJump); return; } } } - aiNewState(pSprite, pXSprite, &handGoto); + aiNewState(actor, &handGoto); pXSprite->target = -1; } diff --git a/source/blood/src/aihound.cpp b/source/blood/src/aihound.cpp index 7df0740a3..10b7cfaac 100644 --- a/source/blood/src/aihound.cpp +++ b/source/blood/src/aihound.cpp @@ -119,7 +119,7 @@ static void houndThinkGoto(DBloodActor* actor) int nDist = approxDist(dx, dy); aiChooseDirection(pSprite, pXSprite, nAngle); if (nDist < 512 && klabs(pSprite->ang - nAngle) < pDudeInfo->periphery) - aiNewState(pSprite, pXSprite, &houndSearch); + aiNewState(actor, &houndSearch); aiThinkTarget(actor); } @@ -129,7 +129,7 @@ static void houndThinkChase(DBloodActor* actor) auto pSprite = &actor->s(); if (pXSprite->target == -1) { - aiNewState(pSprite, pXSprite, &houndGoto); + aiNewState(actor, &houndGoto); return; } ///assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); @@ -150,12 +150,12 @@ static void houndThinkChase(DBloodActor* actor) aiChooseDirection(pSprite, pXSprite, getangle(dx, dy)); if (pXTarget->health == 0) { - aiNewState(pSprite, pXSprite, &houndSearch); + aiNewState(actor, &houndSearch); return; } if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], kPwUpShadowCloak) > 0) { - aiNewState(pSprite, pXSprite, &houndSearch); + aiNewState(actor, &houndSearch); return; } int nDist = approxDist(dx, dy); @@ -169,15 +169,15 @@ static void houndThinkChase(DBloodActor* actor) { aiSetTarget(pXSprite, pXSprite->target); if (nDist < 0xb00 && nDist > 0x500 && klabs(nDeltaAngle) < 85) - aiNewState(pSprite, pXSprite, &houndBurn); + aiNewState(actor, &houndBurn); else if(nDist < 0x266 && klabs(nDeltaAngle) < 85) - aiNewState(pSprite, pXSprite, &houndBite); + aiNewState(actor, &houndBite); return; } } } - aiNewState(pSprite, pXSprite, &houndGoto); + aiNewState(actor, &houndGoto); pXSprite->target = -1; } diff --git a/source/blood/src/aiinnoc.cpp b/source/blood/src/aiinnoc.cpp index d2238c026..a58c9f265 100644 --- a/source/blood/src/aiinnoc.cpp +++ b/source/blood/src/aiinnoc.cpp @@ -74,7 +74,7 @@ static void innocThinkGoto(DBloodActor* actor) int nDist = approxDist(dx, dy); aiChooseDirection(pSprite, pXSprite, nAngle); if (nDist < 512 && klabs(pSprite->ang - nAngle) < pDudeInfo->periphery) - aiNewState(pSprite, pXSprite, &innocentSearch); + aiNewState(actor, &innocentSearch); aiThinkTarget(actor); } @@ -84,7 +84,7 @@ static void innocThinkChase(DBloodActor* actor) auto pSprite = &actor->s(); if (pXSprite->target == -1) { - aiNewState(pSprite, pXSprite, &innocentGoto); + aiNewState(actor, &innocentGoto); return; } assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); @@ -97,12 +97,12 @@ static void innocThinkChase(DBloodActor* actor) aiChooseDirection(pSprite, pXSprite, getangle(dx, dy)); if (pXTarget->health == 0) { - aiNewState(pSprite, pXSprite, &innocentSearch); + aiNewState(actor, &innocentSearch); return; } if (IsPlayerSprite(pTarget)) { - aiNewState(pSprite, pXSprite, &innocentSearch); + aiNewState(actor, &innocentSearch); return; } int nDist = approxDist(dx, dy); @@ -116,14 +116,14 @@ static void innocThinkChase(DBloodActor* actor) { aiSetTarget(pXSprite, pXSprite->target); if (nDist < 0x666 && klabs(nDeltaAngle) < 85) - aiNewState(pSprite, pXSprite, &innocentIdle); + aiNewState(actor, &innocentIdle); return; } } } aiPlay3DSound(pSprite, 7000+Random(6), AI_SFX_PRIORITY_1, -1); - aiNewState(pSprite, pXSprite, &innocentGoto); + aiNewState(actor, &innocentGoto); pXSprite->target = -1; } diff --git a/source/blood/src/aipod.cpp b/source/blood/src/aipod.cpp index d8dbbb544..072286ae0 100644 --- a/source/blood/src/aipod.cpp +++ b/source/blood/src/aipod.cpp @@ -189,11 +189,11 @@ static void aiPodMove(DBloodActor* actor) switch (pSprite->type) { case kDudePodGreen: case kDudePodFire: - aiNewState(pSprite, pXSprite, &podSearch); + aiNewState(actor, &podSearch); break; case kDudeTentacleGreen: case kDudeTentacleFire: - aiNewState(pSprite, pXSprite, &tentacleSearch); + aiNewState(actor, &tentacleSearch); break; } } @@ -208,11 +208,11 @@ static void aiPodChase(DBloodActor* actor) switch (pSprite->type) { case kDudePodGreen: case kDudePodFire: - aiNewState(pSprite, pXSprite, &podMove); + aiNewState(actor, &podMove); break; case kDudeTentacleGreen: case kDudeTentacleFire: - aiNewState(pSprite, pXSprite, &tentacleMove); + aiNewState(actor, &tentacleMove); break; } return; @@ -238,11 +238,11 @@ static void aiPodChase(DBloodActor* actor) switch (pSprite->type) { case kDudePodGreen: case kDudePodFire: - aiNewState(pSprite, pXSprite, &podSearch); + aiNewState(actor, &podSearch); break; case kDudeTentacleGreen: case kDudeTentacleFire: - aiNewState(pSprite, pXSprite, &tentacleSearch); + aiNewState(actor, &tentacleSearch); break; } return; @@ -261,11 +261,11 @@ static void aiPodChase(DBloodActor* actor) switch (pSprite->type) { case kDudePodGreen: case kDudePodFire: - aiNewState(pSprite, pXSprite, &podStartChase); + aiNewState(actor, &podStartChase); break; case kDudeTentacleGreen: case kDudeTentacleFire: - aiNewState(pSprite, pXSprite, &tentacleStartChase); + aiNewState(actor, &tentacleStartChase); break; } } @@ -277,11 +277,11 @@ static void aiPodChase(DBloodActor* actor) switch (pSprite->type) { case kDudePodGreen: case kDudePodFire: - aiNewState(pSprite, pXSprite, &podMove); + aiNewState(actor, &podMove); break; case kDudeTentacleGreen: case kDudeTentacleFire: - aiNewState(pSprite, pXSprite, &tentacleMove); + aiNewState(actor, &tentacleMove); break; } pXSprite->target = -1; diff --git a/source/blood/src/airat.cpp b/source/blood/src/airat.cpp index ef3d12b78..c73418ae9 100644 --- a/source/blood/src/airat.cpp +++ b/source/blood/src/airat.cpp @@ -89,7 +89,7 @@ static void ratThinkGoto(DBloodActor* actor) int nDist = approxDist(dx, dy); aiChooseDirection(pSprite, pXSprite, nAngle); if (nDist < 512 && klabs(pSprite->ang - nAngle) < pDudeInfo->periphery) - aiNewState(pSprite, pXSprite, &ratSearch); + aiNewState(actor, &ratSearch); aiThinkTarget(actor); } @@ -99,7 +99,7 @@ static void ratThinkChase(DBloodActor* actor) auto pSprite = &actor->s(); if (pXSprite->target == -1) { - aiNewState(pSprite, pXSprite, &ratGoto); + aiNewState(actor, &ratGoto); return; } assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); @@ -112,12 +112,12 @@ static void ratThinkChase(DBloodActor* actor) aiChooseDirection(pSprite, pXSprite, getangle(dx, dy)); if (pXTarget->health == 0) { - aiNewState(pSprite, pXSprite, &ratSearch); + aiNewState(actor, &ratSearch); return; } if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], kPwUpShadowCloak) > 0) { - aiNewState(pSprite, pXSprite, &ratSearch); + aiNewState(actor, &ratSearch); return; } int nDist = approxDist(dx, dy); @@ -131,13 +131,13 @@ static void ratThinkChase(DBloodActor* actor) { aiSetTarget(pXSprite, pXSprite->target); if (nDist < 0x399 && klabs(nDeltaAngle) < 85) - aiNewState(pSprite, pXSprite, &ratBite); + aiNewState(actor, &ratBite); return; } } } - aiNewState(pSprite, pXSprite, &ratGoto); + aiNewState(actor, &ratGoto); pXSprite->target = -1; } diff --git a/source/blood/src/aispid.cpp b/source/blood/src/aispid.cpp index d0e2c5124..fd9eb4671 100644 --- a/source/blood/src/aispid.cpp +++ b/source/blood/src/aispid.cpp @@ -211,7 +211,7 @@ static void spidThinkGoto(DBloodActor* actor) int nDist = approxDist(dx, dy); aiChooseDirection(pSprite, pXSprite, nAngle); if (nDist < 512 && klabs(pSprite->ang - nAngle) < pDudeInfo->periphery) - aiNewState(pSprite, pXSprite, &spidSearch); + aiNewState(actor, &spidSearch); aiThinkTarget(actor); } @@ -221,7 +221,7 @@ static void spidThinkChase(DBloodActor* actor) auto pSprite = &actor->s(); if (pXSprite->target == -1) { - aiNewState(pSprite, pXSprite, &spidGoto); + aiNewState(actor, &spidGoto); return; } assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); @@ -234,12 +234,12 @@ static void spidThinkChase(DBloodActor* actor) aiChooseDirection(pSprite, pXSprite, getangle(dx, dy)); if (pXTarget->health == 0) { - aiNewState(pSprite, pXSprite, &spidSearch); + aiNewState(actor, &spidSearch); return; } if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], kPwUpShadowCloak) > 0) { - aiNewState(pSprite, pXSprite, &spidSearch); + aiNewState(actor, &spidSearch); return; } int nDist = approxDist(dx, dy); @@ -253,20 +253,20 @@ static void spidThinkChase(DBloodActor* actor) switch (pSprite->type) { case kDudeSpiderRed: if (nDist < 0x399 && klabs(nDeltaAngle) < 85) - aiNewState(pSprite, pXSprite, &spidBite); + aiNewState(actor, &spidBite); break; case kDudeSpiderBrown: case kDudeSpiderBlack: if (nDist < 0x733 && nDist > 0x399 && klabs(nDeltaAngle) < 85) - aiNewState(pSprite, pXSprite, &spidJump); + aiNewState(actor, &spidJump); else if (nDist < 0x399 && klabs(nDeltaAngle) < 85) - aiNewState(pSprite, pXSprite, &spidBite); + aiNewState(actor, &spidBite); break; case kDudeSpiderMother: if (nDist < 0x733 && nDist > 0x399 && klabs(nDeltaAngle) < 85) - aiNewState(pSprite, pXSprite, &spidJump); + aiNewState(actor, &spidJump); else if (Chance(0x8000)) - aiNewState(pSprite, pXSprite, &spid13A92C); + aiNewState(actor, &spid13A92C); break; } @@ -275,7 +275,7 @@ static void spidThinkChase(DBloodActor* actor) } } - aiNewState(pSprite, pXSprite, &spidGoto); + aiNewState(actor, &spidGoto); pXSprite->target = -1; } diff --git a/source/blood/src/aitchern.cpp b/source/blood/src/aitchern.cpp index 6e941c762..76e8a5e01 100644 --- a/source/blood/src/aitchern.cpp +++ b/source/blood/src/aitchern.cpp @@ -63,6 +63,7 @@ AISTATE tcherno13AA28 = { kAiStateChase, 8, -1, 60, NULL, aiMoveTurn, NULL, &tch void sub_71A90(int, int nXSprite) { XSPRITE *pXSprite = &xsprite[nXSprite]; + auto actor = &bloodActors[pXSprite->reference]; int nSprite = pXSprite->reference; spritetype *pSprite = &sprite[nSprite]; spritetype *pTarget = &sprite[pXSprite->target]; @@ -73,7 +74,7 @@ void sub_71A90(int, int nXSprite) evPost(nTarget, 3, 0, kCallbackFXFlameLick); actBurnSprite(nOwner, pXTarget, 40); if (Chance(0x6000)) - aiNewState(pSprite, pXSprite, &tcherno13A9D4); + aiNewState(actor, &tcherno13A9D4); } void sub_71BD4(int, int nXSprite) @@ -258,7 +259,7 @@ static void sub_725A4(DBloodActor* actor) pXSprite->goalAng += 256; POINT3D *pTarget = &baseSprite[pSprite->index]; aiSetTarget(pXSprite, pTarget->x, pTarget->y, pTarget->z); - aiNewState(pSprite, pXSprite, &tcherno13AA28); + aiNewState(actor, &tcherno13AA28); return; } if (Chance(pDudeInfo->alertChance)) @@ -315,7 +316,7 @@ static void sub_72850(DBloodActor* actor) int nDist = approxDist(dx, dy); aiChooseDirection(pSprite, pXSprite, nAngle); if (nDist < 512 && klabs(pSprite->ang - nAngle) < pDudeInfo->periphery) - aiNewState(pSprite, pXSprite, &tchernobogSearch); + aiNewState(actor, &tchernobogSearch); aiThinkTarget(actor); } @@ -325,7 +326,7 @@ static void sub_72934(DBloodActor* actor) auto pSprite = &actor->s(); if (pXSprite->target == -1) { - aiNewState(pSprite, pXSprite, &tcherno13A9B8); + aiNewState(actor, &tcherno13A9B8); return; } ///assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); @@ -346,12 +347,12 @@ static void sub_72934(DBloodActor* actor) aiChooseDirection(pSprite, pXSprite, getangle(dx, dy)); if (pXTarget->health == 0) { - aiNewState(pSprite, pXSprite, &tchernobogSearch); + aiNewState(actor, &tchernobogSearch); return; } if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], kPwUpShadowCloak) > 0) { - aiNewState(pSprite, pXSprite, &tchernobogSearch); + aiNewState(actor, &tchernobogSearch); return; } int nDist = approxDist(dx, dy); @@ -365,17 +366,17 @@ static void sub_72934(DBloodActor* actor) { aiSetTarget(pXSprite, pXSprite->target); if (nDist < 0x1f00 && nDist > 0xd00 && klabs(nDeltaAngle) < 85) - aiNewState(pSprite, pXSprite, &tcherno13AA0C); + aiNewState(actor, &tcherno13AA0C); else if (nDist < 0xd00 && nDist > 0xb00 && klabs(nDeltaAngle) < 85) - aiNewState(pSprite, pXSprite, &tcherno13A9D4); + aiNewState(actor, &tcherno13A9D4); else if (nDist < 0xb00 && nDist > 0x500 && klabs(nDeltaAngle) < 85) - aiNewState(pSprite, pXSprite, &tcherno13A9F0); + aiNewState(actor, &tcherno13A9F0); return; } } } - aiNewState(pSprite, pXSprite, &tcherno13A9B8); + aiNewState(actor, &tcherno13A9B8); pXSprite->target = -1; } diff --git a/source/blood/src/aizomba.cpp b/source/blood/src/aizomba.cpp index f50fc443a..43de96751 100644 --- a/source/blood/src/aizomba.cpp +++ b/source/blood/src/aizomba.cpp @@ -120,7 +120,7 @@ static void zombaThinkGoto(DBloodActor* actor) int nDist = approxDist(dx, dy); aiChooseDirection(pSprite, pXSprite, nAngle); if (nDist < 921 && klabs(pSprite->ang - nAngle) < pDudeInfo->periphery) - aiNewState(pSprite, pXSprite, &zombieASearch); + aiNewState(actor, &zombieASearch); aiThinkTarget(actor); } @@ -130,7 +130,7 @@ static void zombaThinkChase(DBloodActor* actor) auto pSprite = &actor->s(); if (pXSprite->target == -1) { - aiNewState(pSprite, pXSprite, &zombieASearch); + aiNewState(actor, &zombieASearch); return; } assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); @@ -143,12 +143,12 @@ static void zombaThinkChase(DBloodActor* actor) aiChooseDirection(pSprite, pXSprite, getangle(dx, dy)); if (pXTarget->health == 0) { - aiNewState(pSprite, pXSprite, &zombieASearch); + aiNewState(actor, &zombieASearch); return; } if (IsPlayerSprite(pTarget) && (powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], kPwUpShadowCloak) > 0 || powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], kPwUpDeathMaskUseless) > 0)) { - aiNewState(pSprite, pXSprite, &zombieAGoto); + aiNewState(actor, &zombieAGoto); return; } // If the zombie gets whacked while rising from the grave it never executes this change and if it isn't done here at the very latest, will just aimlessly run around. @@ -166,13 +166,13 @@ static void zombaThinkChase(DBloodActor* actor) { aiSetTarget(pXSprite, pXSprite->target); if (nDist < 0x400 && klabs(nDeltaAngle) < 85) - aiNewState(pSprite, pXSprite, &zombieAHack); + aiNewState(actor, &zombieAHack); return; } } } - aiNewState(pSprite, pXSprite, &zombieAGoto); + aiNewState(actor, &zombieAGoto); pXSprite->target = -1; } @@ -182,7 +182,7 @@ static void zombaThinkPonder(DBloodActor* actor) auto pSprite = &actor->s(); if (pXSprite->target == -1) { - aiNewState(pSprite, pXSprite, &zombieASearch); + aiNewState(actor, &zombieASearch); return; } assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); @@ -195,12 +195,12 @@ static void zombaThinkPonder(DBloodActor* actor) aiChooseDirection(pSprite, pXSprite, getangle(dx, dy)); if (pXTarget->health == 0) { - aiNewState(pSprite, pXSprite, &zombieASearch); + aiNewState(actor, &zombieASearch); return; } if (IsPlayerSprite(pTarget) && (powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], kPwUpShadowCloak) > 0 || powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], kPwUpDeathMaskUseless) > 0)) { - aiNewState(pSprite, pXSprite, &zombieAGoto); + aiNewState(actor, &zombieAGoto); return; } int nDist = approxDist(dx, dy); @@ -218,7 +218,7 @@ static void zombaThinkPonder(DBloodActor* actor) if (klabs(nDeltaAngle) < 85) { sfxPlay3DSound(pSprite, 1101, 1, 0); - aiNewState(pSprite, pXSprite, &zombieAHack); + aiNewState(actor, &zombieAHack); } return; } @@ -226,7 +226,7 @@ static void zombaThinkPonder(DBloodActor* actor) } } - aiNewState(pSprite, pXSprite, &zombieAChase); + aiNewState(actor, &zombieAChase); } static void myThinkTarget(DBloodActor* actor) diff --git a/source/blood/src/aizombf.cpp b/source/blood/src/aizombf.cpp index 3b91b91f3..d89577bc5 100644 --- a/source/blood/src/aizombf.cpp +++ b/source/blood/src/aizombf.cpp @@ -125,7 +125,7 @@ static void zombfThinkGoto(DBloodActor* actor) int nDist = approxDist(dx, dy); aiChooseDirection(pSprite, pXSprite, nAngle); if (nDist < 512 && klabs(pSprite->ang - nAngle) < pDudeInfo->periphery) - aiNewState(pSprite, pXSprite, &zombieFSearch); + aiNewState(actor, &zombieFSearch); aiThinkTarget(actor); } @@ -135,7 +135,7 @@ static void zombfThinkChase(DBloodActor* actor) auto pSprite = &actor->s(); if (pXSprite->target == -1) { - aiNewState(pSprite, pXSprite, &zombieFGoto); + aiNewState(actor, &zombieFGoto); return; } assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax); @@ -148,12 +148,12 @@ static void zombfThinkChase(DBloodActor* actor) aiChooseDirection(pSprite, pXSprite, getangle(dx, dy)); if (pXTarget->health == 0) { - aiNewState(pSprite, pXSprite, &zombieFSearch); + aiNewState(actor, &zombieFSearch); return; } if (IsPlayerSprite(pTarget) && (powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], kPwUpShadowCloak) > 0 || powerupCheck(&gPlayer[pTarget->type-kDudePlayer1], kPwUpDeathMaskUseless) > 0)) { - aiNewState(pSprite, pXSprite, &zombieFSearch); + aiNewState(actor, &zombieFSearch); return; } int nDist = approxDist(dx, dy); @@ -172,16 +172,16 @@ static void zombfThinkChase(DBloodActor* actor) switch (hit) { case -1: - aiNewState(pSprite, pXSprite, &zombieFThrow); + aiNewState(actor, &zombieFThrow); break; case 3: if (pSprite->type != sprite[gHitInfo.hitsprite].type) - aiNewState(pSprite, pXSprite, &zombieFThrow); + aiNewState(actor, &zombieFThrow); else - aiNewState(pSprite, pXSprite, &zombieFDodge); + aiNewState(actor, &zombieFDodge); break; default: - aiNewState(pSprite, pXSprite, &zombieFThrow); + aiNewState(actor, &zombieFThrow); break; } } @@ -191,16 +191,16 @@ static void zombfThinkChase(DBloodActor* actor) switch (hit) { case -1: - aiNewState(pSprite, pXSprite, &zombieFPuke); + aiNewState(actor, &zombieFPuke); break; case 3: if (pSprite->type != sprite[gHitInfo.hitsprite].type) - aiNewState(pSprite, pXSprite, &zombieFPuke); + aiNewState(actor, &zombieFPuke); else - aiNewState(pSprite, pXSprite, &zombieFDodge); + aiNewState(actor, &zombieFDodge); break; default: - aiNewState(pSprite, pXSprite, &zombieFPuke); + aiNewState(actor, &zombieFPuke); break; } } @@ -210,16 +210,16 @@ static void zombfThinkChase(DBloodActor* actor) switch (hit) { case -1: - aiNewState(pSprite, pXSprite, &zombieFHack); + aiNewState(actor, &zombieFHack); break; case 3: if (pSprite->type != sprite[gHitInfo.hitsprite].type) - aiNewState(pSprite, pXSprite, &zombieFHack); + aiNewState(actor, &zombieFHack); else - aiNewState(pSprite, pXSprite, &zombieFDodge); + aiNewState(actor, &zombieFDodge); break; default: - aiNewState(pSprite, pXSprite, &zombieFHack); + aiNewState(actor, &zombieFHack); break; } } @@ -228,7 +228,7 @@ static void zombfThinkChase(DBloodActor* actor) } } - aiNewState(pSprite, pXSprite, &zombieFSearch); + aiNewState(actor, &zombieFSearch); pXSprite->target = -1; } diff --git a/source/blood/src/nnexts.cpp b/source/blood/src/nnexts.cpp index c25c254a3..79d1e4cd2 100644 --- a/source/blood/src/nnexts.cpp +++ b/source/blood/src/nnexts.cpp @@ -1268,14 +1268,16 @@ bool ceilIsTooLow(spritetype* pSprite) { return false; } -void aiSetGenIdleState(spritetype* pSprite, XSPRITE* pXSprite) { +void aiSetGenIdleState(spritetype* pSprite, XSPRITE* pXSprite) +{ + auto actor = &bloodActors[pXSprite->reference]; switch (pSprite->type) { case kDudeModernCustom: case kDudeModernCustomBurning: aiGenDudeNewState(pSprite, &genIdle); break; default: - aiNewState(pSprite, pXSprite, &genIdle); + aiNewState(actor, &genIdle); break; } }