- removed the dudeIsPlayingSeq variant taking a sprite parameter.

This commit is contained in:
Christoph Oelckers 2021-09-16 20:40:24 +02:00
parent 890cc4947b
commit fe92188b0c
5 changed files with 36 additions and 42 deletions

View file

@ -7414,11 +7414,6 @@ void actPostSprite(int nSprite, int nStatus)
actPostSprite(&bloodActors[nSprite], nStatus); actPostSprite(&bloodActors[nSprite], nStatus);
} }
bool dudeIsPlayingSeq(spritetype* pSprite, int nSeq)
{
return dudeIsPlayingSeq(&bloodActors[pSprite->index], nSeq);
}
void aiSetTarget_(XSPRITE* pXSprite, int nTarget) void aiSetTarget_(XSPRITE* pXSprite, int nTarget)
{ {
aiSetTarget(&bloodActors[pXSprite->reference], &bloodActors[nTarget]); aiSetTarget(&bloodActors[pXSprite->reference], &bloodActors[nTarget]);

View file

@ -1103,7 +1103,7 @@ int aiDamageSprite(DBloodActor* source, DBloodActor* actor, DAMAGE_TYPE nDmgType
{ {
if (!spriteIsUnderwater(pSprite)) 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); else aiGenDudeNewState(pSprite, &genDudeDodgeShortD);
if (Chance(0x0200)) if (Chance(0x0200))

View file

@ -96,7 +96,6 @@ void aiInit(void);
void aiInitSprite(spritetype *pSprite); void aiInitSprite(spritetype *pSprite);
bool CanMove(DBloodActor* pSprite, int a2, int nAngle, int nRange); 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 x, int y, int z);
void aiSetTarget_(XSPRITE* pXSprite, int nTarget); void aiSetTarget_(XSPRITE* pXSprite, int nTarget);

View file

@ -331,37 +331,37 @@ static void cultThinkChase(DBloodActor* actor)
switch (hit) switch (hit)
{ {
case -1: case -1:
if (!dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) if (!dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal)
aiNewState(actor, &cultistTFire); aiNewState(actor, &cultistTFire);
else if (dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) else if (dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal)
aiNewState(actor, &cultistTProneFire); 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); aiNewState(actor, &cultistTSwimFire);
break; break;
case 3: case 3:
if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeCultistShotgun) 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); aiNewState(actor, &cultistTFire);
else if (dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) else if (dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal)
aiNewState(actor, &cultistTProneFire); aiNewState(actor, &cultistTProneFire);
else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo)
aiNewState(actor, &cultistTSwimFire); aiNewState(actor, &cultistTSwimFire);
} }
else else
{ {
if (!dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) if (!dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal)
aiNewState(actor, &cultistDodge); aiNewState(actor, &cultistDodge);
else if (dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) else if (dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal)
aiNewState(actor, &cultistProneDodge); aiNewState(actor, &cultistProneDodge);
else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo)
aiNewState(actor, &cultistSwimDodge); aiNewState(actor, &cultistSwimDodge);
} }
break; break;
default: default:
if (!dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) if (!dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal)
aiNewState(actor, &cultistTFire); aiNewState(actor, &cultistTFire);
else if (dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) else if (dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal)
aiNewState(actor, &cultistTProneFire); aiNewState(actor, &cultistTProneFire);
else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo)
aiNewState(actor, &cultistTSwimFire); aiNewState(actor, &cultistTSwimFire);
@ -399,9 +399,9 @@ static void cultThinkChase(DBloodActor* actor)
switch (hit) switch (hit)
{ {
case -1: case -1:
if (!dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) if (!dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal)
aiNewState(actor, &cultistSFire); aiNewState(actor, &cultistSFire);
else if (dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) else if (dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal)
aiNewState(actor, &cultistSProneFire); aiNewState(actor, &cultistSProneFire);
else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo)
aiNewState(actor, &cultistSSwimFire); aiNewState(actor, &cultistSSwimFire);
@ -409,27 +409,27 @@ static void cultThinkChase(DBloodActor* actor)
case 3: case 3:
if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeCultistTommy) 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); aiNewState(actor, &cultistSFire);
else if (dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) else if (dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal)
aiNewState(actor, &cultistSProneFire); aiNewState(actor, &cultistSProneFire);
else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo)
aiNewState(actor, &cultistSSwimFire); aiNewState(actor, &cultistSSwimFire);
} }
else else
{ {
if (!dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) if (!dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal)
aiNewState(actor, &cultistDodge); aiNewState(actor, &cultistDodge);
else if (dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) else if (dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal)
aiNewState(actor, &cultistProneDodge); aiNewState(actor, &cultistProneDodge);
else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo)
aiNewState(actor, &cultistSwimDodge); aiNewState(actor, &cultistSwimDodge);
} }
break; break;
default: default:
if (!dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) if (!dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal)
aiNewState(actor, &cultistSFire); aiNewState(actor, &cultistSFire);
else if (dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) else if (dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal)
aiNewState(actor, &cultistSProneFire); aiNewState(actor, &cultistSProneFire);
else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo)
aiNewState(actor, &cultistSSwimFire); aiNewState(actor, &cultistSSwimFire);
@ -467,9 +467,9 @@ static void cultThinkChase(DBloodActor* actor)
switch (hit) switch (hit)
{ {
case -1: case -1:
if (!dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) if (!dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal)
aiNewState(actor, &cultistTsFire); aiNewState(actor, &cultistTsFire);
else if (dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) else if (dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal)
aiNewState(actor, &cultistTsProneFire); aiNewState(actor, &cultistTsProneFire);
else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo)
aiNewState(actor, &cultistTsSwimFire); aiNewState(actor, &cultistTsSwimFire);
@ -477,27 +477,27 @@ static void cultThinkChase(DBloodActor* actor)
case 3: case 3:
if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeCultistTommy) 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); aiNewState(actor, &cultistTsFire);
else if (dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) else if (dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal)
aiNewState(actor, &cultistTsProneFire); aiNewState(actor, &cultistTsProneFire);
else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo)
aiNewState(actor, &cultistTsSwimFire); aiNewState(actor, &cultistTsSwimFire);
} }
else else
{ {
if (!dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) if (!dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal)
aiNewState(actor, &cultistDodge); aiNewState(actor, &cultistDodge);
else if (dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) else if (dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal)
aiNewState(actor, &cultistProneDodge); aiNewState(actor, &cultistProneDodge);
else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo)
aiNewState(actor, &cultistSwimDodge); aiNewState(actor, &cultistSwimDodge);
} }
break; break;
default: default:
if (!dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) if (!dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal)
aiNewState(actor, &cultistTsFire); aiNewState(actor, &cultistTsFire);
else if (dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) else if (dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal)
aiNewState(actor, &cultistTsProneFire); aiNewState(actor, &cultistTsProneFire);
else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo)
aiNewState(actor, &cultistTsSwimFire); aiNewState(actor, &cultistTsSwimFire);
@ -579,9 +579,9 @@ static void cultThinkChase(DBloodActor* actor)
switch (hit) switch (hit)
{ {
case -1: case -1:
if (!dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) if (!dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal)
aiNewState(actor, &cultistSFire); aiNewState(actor, &cultistSFire);
else if (dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) else if (dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal)
aiNewState(actor, &cultistSProneFire); aiNewState(actor, &cultistSProneFire);
else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo)
aiNewState(actor, &cultistSSwimFire); aiNewState(actor, &cultistSSwimFire);
@ -589,27 +589,27 @@ static void cultThinkChase(DBloodActor* actor)
case 3: case 3:
if (pSprite->type != sprite[gHitInfo.hitsprite].type && sprite[gHitInfo.hitsprite].type != kDudeCultistTommy) 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); aiNewState(actor, &cultistSFire);
else if (dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) else if (dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal)
aiNewState(actor, &cultistSProneFire); aiNewState(actor, &cultistSProneFire);
else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo)
aiNewState(actor, &cultistSSwimFire); aiNewState(actor, &cultistSSwimFire);
} }
else else
{ {
if (!dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) if (!dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal)
aiNewState(actor, &cultistDodge); aiNewState(actor, &cultistDodge);
else if (dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) else if (dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal)
aiNewState(actor, &cultistProneDodge); aiNewState(actor, &cultistProneDodge);
else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo)
aiNewState(actor, &cultistSwimDodge); aiNewState(actor, &cultistSwimDodge);
} }
break; break;
default: default:
if (!dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) if (!dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal)
aiNewState(actor, &cultistSFire); aiNewState(actor, &cultistSFire);
else if (dudeIsPlayingSeq(pSprite, 14) && pXSprite->medium == kMediumNormal) else if (dudeIsPlayingSeq(actor, 14) && pXSprite->medium == kMediumNormal)
aiNewState(actor, &cultistSProneFire); aiNewState(actor, &cultistSProneFire);
else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo) else if (pXSprite->medium == kMediumWater || pXSprite->medium == kMediumGoo)
aiNewState(actor, &cultistSSwimFire); aiNewState(actor, &cultistSSwimFire);

View file

@ -928,9 +928,9 @@ int checkAttackState(DBloodActor* actor)
{ {
auto pXSprite = &actor->x(); auto pXSprite = &actor->x();
auto pSprite = &actor->s(); 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)) if (spriteIsUnderwater(pSprite,false))
{ {