From fe92188b0ca4d525d7d1bf13b50e94da91b1fbcb Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 16 Sep 2021 20:40:24 +0200 Subject: [PATCH] - removed the dudeIsPlayingSeq variant taking a sprite parameter. --- source/games/blood/src/actor.cpp | 5 --- source/games/blood/src/ai.cpp | 2 +- source/games/blood/src/ai.h | 1 - source/games/blood/src/aicult.cpp | 66 ++++++++++++++-------------- source/games/blood/src/aiunicult.cpp | 4 +- 5 files changed, 36 insertions(+), 42 deletions(-) diff --git a/source/games/blood/src/actor.cpp b/source/games/blood/src/actor.cpp index 1aa5cbe7c..c5b6cf8c9 100644 --- a/source/games/blood/src/actor.cpp +++ b/source/games/blood/src/actor.cpp @@ -7414,11 +7414,6 @@ void actPostSprite(int nSprite, int nStatus) actPostSprite(&bloodActors[nSprite], nStatus); } -bool dudeIsPlayingSeq(spritetype* pSprite, int nSeq) -{ - return dudeIsPlayingSeq(&bloodActors[pSprite->index], nSeq); -} - void aiSetTarget_(XSPRITE* pXSprite, int nTarget) { aiSetTarget(&bloodActors[pXSprite->reference], &bloodActors[nTarget]); diff --git a/source/games/blood/src/ai.cpp b/source/games/blood/src/ai.cpp index 68782e60a..119b9cc1a 100644 --- a/source/games/blood/src/ai.cpp +++ b/source/games/blood/src/ai.cpp @@ -1103,7 +1103,7 @@ int aiDamageSprite(DBloodActor* source, DBloodActor* actor, DAMAGE_TYPE nDmgType { if (!spriteIsUnderwater(pSprite)) { - if (!canDuck(pSprite) || !dudeIsPlayingSeq(pSprite, 14)) aiGenDudeNewState(pSprite, &genDudeDodgeShortL); + if (!canDuck(pSprite) || !dudeIsPlayingSeq(actor, 14)) aiGenDudeNewState(pSprite, &genDudeDodgeShortL); else aiGenDudeNewState(pSprite, &genDudeDodgeShortD); if (Chance(0x0200)) diff --git a/source/games/blood/src/ai.h b/source/games/blood/src/ai.h index 89af3b708..5b8c370d4 100644 --- a/source/games/blood/src/ai.h +++ b/source/games/blood/src/ai.h @@ -96,7 +96,6 @@ void aiInit(void); void aiInitSprite(spritetype *pSprite); bool CanMove(DBloodActor* pSprite, int a2, int nAngle, int nRange); -bool dudeIsPlayingSeq(spritetype* pSprite, int nSeq); // deprecated void aiSetTarget_(XSPRITE* pXSprite, int x, int y, int z); void aiSetTarget_(XSPRITE* pXSprite, int nTarget); diff --git a/source/games/blood/src/aicult.cpp b/source/games/blood/src/aicult.cpp index 22ed5f6bf..ef2b35f81 100644 --- a/source/games/blood/src/aicult.cpp +++ b/source/games/blood/src/aicult.cpp @@ -331,37 +331,37 @@ static void cultThinkChase(DBloodActor* actor) switch (hit) { case -1: - if (!dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) + if (!dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal) aiNewState(actor, &cultistTFire); - else if (dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) + else if (dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal) aiNewState(actor, &cultistTProneFire); - else if (dudeIsPlayingSeq(pSprite, 13) && (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo)) + else if (dudeIsPlayingSeq(actor, 13) && (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo)) 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) + if (!dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal) aiNewState(actor, &cultistTFire); - else if (dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) + else if (dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal) aiNewState(actor, &cultistTProneFire); else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) aiNewState(actor, &cultistTSwimFire); } else { - if (!dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) + if (!dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal) aiNewState(actor, &cultistDodge); - else if (dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) + else if (dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal) aiNewState(actor, &cultistProneDodge); else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) aiNewState(actor, &cultistSwimDodge); } break; default: - if (!dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) + if (!dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal) aiNewState(actor, &cultistTFire); - else if (dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) + else if (dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal) aiNewState(actor, &cultistTProneFire); else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) aiNewState(actor, &cultistTSwimFire); @@ -399,9 +399,9 @@ static void cultThinkChase(DBloodActor* actor) switch (hit) { case -1: - if (!dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) + if (!dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal) aiNewState(actor, &cultistSFire); - else if (dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) + else if (dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal) aiNewState(actor, &cultistSProneFire); else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) aiNewState(actor, &cultistSSwimFire); @@ -409,27 +409,27 @@ static void cultThinkChase(DBloodActor* actor) case 3: if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeCultistTommy) { - if (!dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) + if (!dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal) aiNewState(actor, &cultistSFire); - else if (dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) + else if (dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal) aiNewState(actor, &cultistSProneFire); else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) aiNewState(actor, &cultistSSwimFire); } else { - if (!dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) + if (!dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal) aiNewState(actor, &cultistDodge); - else if (dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) + else if (dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal) aiNewState(actor, &cultistProneDodge); else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) aiNewState(actor, &cultistSwimDodge); } break; default: - if (!dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) + if (!dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal) aiNewState(actor, &cultistSFire); - else if (dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) + else if (dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal) aiNewState(actor, &cultistSProneFire); else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) aiNewState(actor, &cultistSSwimFire); @@ -467,9 +467,9 @@ static void cultThinkChase(DBloodActor* actor) switch (hit) { case -1: - if (!dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) + if (!dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal) aiNewState(actor, &cultistTsFire); - else if (dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) + else if (dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal) aiNewState(actor, &cultistTsProneFire); else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) aiNewState(actor, &cultistTsSwimFire); @@ -477,27 +477,27 @@ static void cultThinkChase(DBloodActor* actor) case 3: if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeCultistTommy) { - if (!dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) + if (!dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal) aiNewState(actor, &cultistTsFire); - else if (dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) + else if (dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal) aiNewState(actor, &cultistTsProneFire); else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) aiNewState(actor, &cultistTsSwimFire); } else { - if (!dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) + if (!dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal) aiNewState(actor, &cultistDodge); - else if (dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) + else if (dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal) aiNewState(actor, &cultistProneDodge); else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) aiNewState(actor, &cultistSwimDodge); } break; default: - if (!dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) + if (!dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal) aiNewState(actor, &cultistTsFire); - else if (dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) + else if (dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal) aiNewState(actor, &cultistTsProneFire); else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) aiNewState(actor, &cultistTsSwimFire); @@ -579,9 +579,9 @@ static void cultThinkChase(DBloodActor* actor) switch (hit) { case -1: - if (!dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) + if (!dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal) aiNewState(actor, &cultistSFire); - else if (dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) + else if (dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal) aiNewState(actor, &cultistSProneFire); else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) aiNewState(actor, &cultistSSwimFire); @@ -589,27 +589,27 @@ static void cultThinkChase(DBloodActor* actor) case 3: if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeCultistTommy) { - if (!dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) + if (!dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal) aiNewState(actor, &cultistSFire); - else if (dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) + else if (dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal) aiNewState(actor, &cultistSProneFire); else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) aiNewState(actor, &cultistSSwimFire); } else { - if (!dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) + if (!dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal) aiNewState(actor, &cultistDodge); - else if (dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) + else if (dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal) aiNewState(actor, &cultistProneDodge); else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) aiNewState(actor, &cultistSwimDodge); } break; default: - if (!dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) + if (!dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal) aiNewState(actor, &cultistSFire); - else if (dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) + else if (dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal) aiNewState(actor, &cultistSProneFire); else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) aiNewState(actor, &cultistSSwimFire); diff --git a/source/games/blood/src/aiunicult.cpp b/source/games/blood/src/aiunicult.cpp index 422dd6eb2..3f26e38cb 100644 --- a/source/games/blood/src/aiunicult.cpp +++ b/source/games/blood/src/aiunicult.cpp @@ -928,9 +928,9 @@ int checkAttackState(DBloodActor* actor) { auto pXSprite = &actor->x(); auto pSprite = &actor->s(); - if (dudeIsPlayingSeq(pSprite, 14) || spriteIsUnderwater(pSprite,false)) + if (dudeIsPlayingSeq(actor, 14) || spriteIsUnderwater(pSprite,false)) { - if ( !dudeIsPlayingSeq(pSprite, 14) || spriteIsUnderwater(pSprite,false)) + if ( !dudeIsPlayingSeq(actor, 14) || spriteIsUnderwater(pSprite,false)) { if (spriteIsUnderwater(pSprite,false)) {