diff --git a/source/games/blood/src/ai.cpp b/source/games/blood/src/ai.cpp index 4cd7e4b28..4b9dd6b1f 100644 --- a/source/games/blood/src/ai.cpp +++ b/source/games/blood/src/ai.cpp @@ -1097,7 +1097,7 @@ int aiDamageSprite(DBloodActor* source, DBloodActor* actor, DAMAGE_TYPE nDmgType { if (!dudeIsMelee(actor)) { - if (inIdle(pXSprite->aiState) || Chance(getDodgeChance(pSprite))) + if (inIdle(pXSprite->aiState) || Chance(getDodgeChance(actor))) { if (!spriteIsUnderwater(actor)) { @@ -1274,7 +1274,7 @@ void RecoilDude(DBloodActor* actor) case kDudeModernCustom: { GENDUDEEXTRA* pExtra = &actor->genDudeExtra(); - int rChance = getRecoilChance(pSprite); + int rChance = getRecoilChance(actor); if (pExtra->canElectrocute && pDudeExtra->teslaHit && !spriteIsUnderwater(actor, false)) { if (Chance(rChance << 3) || (dudeIsMelee(actor) && Chance(rChance << 4))) aiGenDudeNewState(actor, &genDudeRecoilTesla); diff --git a/source/games/blood/src/aiunicult.cpp b/source/games/blood/src/aiunicult.cpp index 162beb99a..15c2bb010 100644 --- a/source/games/blood/src/aiunicult.cpp +++ b/source/games/blood/src/aiunicult.cpp @@ -1808,9 +1808,10 @@ int getBaseChanceModifier(int baseChance) return ((gGameOptions.nDifficulty > 0) ? baseChance - (0x0500 * gGameOptions.nDifficulty) : baseChance); } -int getRecoilChance(spritetype* pSprite) { - auto actor = &bloodActors[pSprite->index]; - XSPRITE* pXSprite = &xsprite[pSprite->extra]; +int getRecoilChance(DBloodActor* actor) +{ + auto const pSprite = &actor->s(); + auto const pXSprite = &actor->x(); int mass = getSpriteMassBySize(pSprite); int baseChance = (!dudeIsMelee(actor) ? 0x8000 : 0x4000); baseChance = getBaseChanceModifier(baseChance) + pXSprite->data3; @@ -1819,9 +1820,10 @@ int getRecoilChance(spritetype* pSprite) { return chance; } -int getDodgeChance(spritetype* pSprite) { - auto actor = &bloodActors[pSprite->index]; - XSPRITE* pXSprite = &xsprite[pSprite->extra]; +int getDodgeChance(DBloodActor* actor) +{ + auto const pSprite = &actor->s(); + auto const pXSprite = &actor->x(); int mass = getSpriteMassBySize(pSprite); int baseChance = (!dudeIsMelee(actor) ? 0x6000 : 0x1000); baseChance = getBaseChanceModifier(baseChance) + pXSprite->data3; diff --git a/source/games/blood/src/aiunicult.h b/source/games/blood/src/aiunicult.h index d0f74c4e0..a54167a1b 100644 --- a/source/games/blood/src/aiunicult.h +++ b/source/games/blood/src/aiunicult.h @@ -210,8 +210,8 @@ bool doExplosion(spritetype* pSprite, int nType); spritetype* genDudeSpawn(XSPRITE* pXSource, spritetype* pSprite, int nDist); void genDudeTransform(spritetype* pSprite); void dudeLeechOperate(spritetype* pSprite, XSPRITE* pXSprite, EVENT a3); -int getDodgeChance(spritetype* pSprite); -int getRecoilChance(spritetype* pSprite); +int getDodgeChance(DBloodActor* pSprite); +int getRecoilChance(DBloodActor* pSprite); bool dudeIsMelee(DBloodActor* pXSprite); void updateTargetOfSlaves(spritetype* pSprite); void updateTargetOfLeech(spritetype* pSprite);