mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 06:41:59 +00:00
- handle target validations in AI functions properly.
Now they will all print the function name along with the message and not rely on assert abuse.
This commit is contained in:
parent
261301bdea
commit
b9f6120380
20 changed files with 80 additions and 96 deletions
|
@ -66,6 +66,7 @@ void batBiteSeqCallback(int, DBloodActor* actor)
|
||||||
{
|
{
|
||||||
XSPRITE* pXSprite = &actor->x();
|
XSPRITE* pXSprite = &actor->x();
|
||||||
spritetype *pSprite = &actor->s();
|
spritetype *pSprite = &actor->s();
|
||||||
|
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
||||||
spritetype *pTarget = &sprite[pXSprite->target_i];
|
spritetype *pTarget = &sprite[pXSprite->target_i];
|
||||||
int dx = CosScale16(pSprite->ang);
|
int dx = CosScale16(pSprite->ang);
|
||||||
int dy = SinScale16(pSprite->ang);
|
int dy = SinScale16(pSprite->ang);
|
||||||
|
@ -74,7 +75,6 @@ void batBiteSeqCallback(int, DBloodActor* actor)
|
||||||
DUDEINFO *pDudeInfoT = getDudeInfo(pTarget->type);
|
DUDEINFO *pDudeInfoT = getDudeInfo(pTarget->type);
|
||||||
int height = (pSprite->yrepeat*pDudeInfo->eyeHeight)<<2;
|
int height = (pSprite->yrepeat*pDudeInfo->eyeHeight)<<2;
|
||||||
int height2 = (pTarget->yrepeat*pDudeInfoT->eyeHeight)<<2;
|
int height2 = (pTarget->yrepeat*pDudeInfoT->eyeHeight)<<2;
|
||||||
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
|
|
||||||
actFireVector(actor, 0, 0, dx, dy, height2-height, kVectorBatBite);
|
actFireVector(actor, 0, 0, dx, dy, height2-height, kVectorBatBite);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ static void batThinkPonder(DBloodActor* actor)
|
||||||
}
|
}
|
||||||
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
||||||
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
||||||
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
|
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
||||||
spritetype *pTarget = &sprite[pXSprite->target_i];
|
spritetype *pTarget = &sprite[pXSprite->target_i];
|
||||||
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
||||||
int dx = pTarget->x-pSprite->x;
|
int dx = pTarget->x-pSprite->x;
|
||||||
|
@ -275,7 +275,7 @@ static void batThinkChase(DBloodActor* actor)
|
||||||
}
|
}
|
||||||
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
||||||
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
||||||
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
|
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
||||||
spritetype *pTarget = &sprite[pXSprite->target_i];
|
spritetype *pTarget = &sprite[pXSprite->target_i];
|
||||||
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
||||||
int dx = pTarget->x-pSprite->x;
|
int dx = pTarget->x-pSprite->x;
|
||||||
|
|
|
@ -67,6 +67,7 @@ void SlashSeqCallback(int, DBloodActor* actor)
|
||||||
{
|
{
|
||||||
XSPRITE* pXSprite = &actor->x();
|
XSPRITE* pXSprite = &actor->x();
|
||||||
spritetype *pSprite = &actor->s();
|
spritetype *pSprite = &actor->s();
|
||||||
|
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
||||||
spritetype *pTarget = &sprite[pXSprite->target_i];
|
spritetype *pTarget = &sprite[pXSprite->target_i];
|
||||||
int dx = CosScale16(pSprite->ang);
|
int dx = CosScale16(pSprite->ang);
|
||||||
int dy = SinScale16(pSprite->ang);
|
int dy = SinScale16(pSprite->ang);
|
||||||
|
@ -238,7 +239,7 @@ static void beastThinkChase(DBloodActor* actor)
|
||||||
}
|
}
|
||||||
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
||||||
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
||||||
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
|
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
||||||
spritetype *pTarget = &sprite[pXSprite->target_i];
|
spritetype *pTarget = &sprite[pXSprite->target_i];
|
||||||
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
||||||
int dx = pTarget->x-pSprite->x;
|
int dx = pTarget->x-pSprite->x;
|
||||||
|
@ -408,7 +409,7 @@ static void beastThinkSwimChase(DBloodActor* actor)
|
||||||
}
|
}
|
||||||
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
||||||
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
||||||
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
|
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
||||||
spritetype *pTarget = &sprite[pXSprite->target_i];
|
spritetype *pTarget = &sprite[pXSprite->target_i];
|
||||||
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
||||||
int dx = pTarget->x-pSprite->x;
|
int dx = pTarget->x-pSprite->x;
|
||||||
|
@ -512,6 +513,7 @@ static void sub_62AE0(DBloodActor* actor)
|
||||||
auto pSprite = &actor->s();
|
auto pSprite = &actor->s();
|
||||||
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
||||||
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
||||||
|
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
||||||
spritetype *pTarget = &sprite[pXSprite->target_i];
|
spritetype *pTarget = &sprite[pXSprite->target_i];
|
||||||
int z = pSprite->z + getDudeInfo(pSprite->type)->eyeHeight;
|
int z = pSprite->z + getDudeInfo(pSprite->type)->eyeHeight;
|
||||||
int z2 = pTarget->z + getDudeInfo(pTarget->type)->eyeHeight;
|
int z2 = pTarget->z + getDudeInfo(pTarget->type)->eyeHeight;
|
||||||
|
@ -549,6 +551,7 @@ static void sub_62D7C(DBloodActor* actor)
|
||||||
int nSprite = pSprite->index;
|
int nSprite = pSprite->index;
|
||||||
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
||||||
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
||||||
|
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
||||||
spritetype *pTarget = &sprite[pXSprite->target_i];
|
spritetype *pTarget = &sprite[pXSprite->target_i];
|
||||||
int z = pSprite->z + getDudeInfo(pSprite->type)->eyeHeight;
|
int z = pSprite->z + getDudeInfo(pSprite->type)->eyeHeight;
|
||||||
int z2 = pTarget->z + getDudeInfo(pTarget->type)->eyeHeight;
|
int z2 = pTarget->z + getDudeInfo(pTarget->type)->eyeHeight;
|
||||||
|
|
|
@ -65,6 +65,20 @@ void eelBiteSeqCallback(int, DBloodActor* actor)
|
||||||
{
|
{
|
||||||
XSPRITE* pXSprite = &actor->x();
|
XSPRITE* pXSprite = &actor->x();
|
||||||
spritetype *pSprite = &actor->s();
|
spritetype *pSprite = &actor->s();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* workaround for
|
||||||
|
* pXSprite->target >= 0 && pXSprite->target < kMaxSprites in file NBlood/source/blood/src/aiboneel.cpp at line 86
|
||||||
|
* The value of pXSprite->target is -1.
|
||||||
|
* copied from lines 177:181
|
||||||
|
* resolves this case, but may cause other issues?
|
||||||
|
*/
|
||||||
|
if (actor->GetTarget() == nullptr)
|
||||||
|
{
|
||||||
|
aiNewState(actor, &eelSearch);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
spritetype *pTarget = &sprite[pXSprite->target_i];
|
spritetype *pTarget = &sprite[pXSprite->target_i];
|
||||||
int dx = CosScale16(pSprite->ang);
|
int dx = CosScale16(pSprite->ang);
|
||||||
int dy = SinScale16(pSprite->ang);
|
int dy = SinScale16(pSprite->ang);
|
||||||
|
@ -73,19 +87,6 @@ void eelBiteSeqCallback(int, DBloodActor* actor)
|
||||||
DUDEINFO *pDudeInfoT = getDudeInfo(pTarget->type);
|
DUDEINFO *pDudeInfoT = getDudeInfo(pTarget->type);
|
||||||
int height = (pSprite->yrepeat*pDudeInfo->eyeHeight)<<2;
|
int height = (pSprite->yrepeat*pDudeInfo->eyeHeight)<<2;
|
||||||
int height2 = (pTarget->yrepeat*pDudeInfoT->eyeHeight)<<2;
|
int height2 = (pTarget->yrepeat*pDudeInfoT->eyeHeight)<<2;
|
||||||
/*
|
|
||||||
* workaround for
|
|
||||||
* pXSprite->target >= 0 && pXSprite->target < kMaxSprites in file NBlood/source/blood/src/aiboneel.cpp at line 86
|
|
||||||
* The value of pXSprite->target is -1.
|
|
||||||
* copied from lines 177:181
|
|
||||||
* resolves this case, but may cause other issues?
|
|
||||||
*/
|
|
||||||
if (actor->GetTarget() == nullptr)
|
|
||||||
{
|
|
||||||
aiNewState(actor, &eelSearch);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
|
|
||||||
actFireVector(actor, 0, 0, dx, dy, height2-height, kVectorBoneelBite);
|
actFireVector(actor, 0, 0, dx, dy, height2-height, kVectorBoneelBite);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,7 +181,6 @@ static void eelThinkPonder(DBloodActor* actor)
|
||||||
}
|
}
|
||||||
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
||||||
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
||||||
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
|
|
||||||
spritetype *pTarget = &sprite[pXSprite->target_i];
|
spritetype *pTarget = &sprite[pXSprite->target_i];
|
||||||
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
||||||
int dx = pTarget->x-pSprite->x;
|
int dx = pTarget->x-pSprite->x;
|
||||||
|
@ -288,7 +288,6 @@ static void eelThinkChase(DBloodActor* actor)
|
||||||
}
|
}
|
||||||
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
||||||
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
||||||
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
|
|
||||||
spritetype *pTarget = &sprite[pXSprite->target_i];
|
spritetype *pTarget = &sprite[pXSprite->target_i];
|
||||||
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
||||||
int dx = pTarget->x-pSprite->x;
|
int dx = pTarget->x-pSprite->x;
|
||||||
|
|
|
@ -162,7 +162,6 @@ static void burnThinkChase(DBloodActor* actor)
|
||||||
}
|
}
|
||||||
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
||||||
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
||||||
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
|
|
||||||
spritetype *pTarget = &sprite[pXSprite->target_i];
|
spritetype *pTarget = &sprite[pXSprite->target_i];
|
||||||
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
||||||
int dx = pTarget->x-pSprite->x;
|
int dx = pTarget->x-pSprite->x;
|
||||||
|
|
|
@ -137,7 +137,6 @@ static void calebThinkChase(DBloodActor* actor)
|
||||||
}
|
}
|
||||||
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
||||||
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
||||||
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
|
|
||||||
spritetype *pTarget = &sprite[pXSprite->target_i];
|
spritetype *pTarget = &sprite[pXSprite->target_i];
|
||||||
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
||||||
int dx = pTarget->x-pSprite->x;
|
int dx = pTarget->x-pSprite->x;
|
||||||
|
@ -273,7 +272,6 @@ static void calebThinkSwimChase(DBloodActor* actor)
|
||||||
}
|
}
|
||||||
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
||||||
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
||||||
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
|
|
||||||
spritetype *pTarget = &sprite[pXSprite->target_i];
|
spritetype *pTarget = &sprite[pXSprite->target_i];
|
||||||
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
||||||
int dx = pTarget->x-pSprite->x;
|
int dx = pTarget->x-pSprite->x;
|
||||||
|
@ -354,6 +352,7 @@ static void sub_65F44(DBloodActor* actor)
|
||||||
int nSprite = pSprite->index;
|
int nSprite = pSprite->index;
|
||||||
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
||||||
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
||||||
|
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
||||||
spritetype *pTarget = &sprite[pXSprite->target_i];
|
spritetype *pTarget = &sprite[pXSprite->target_i];
|
||||||
int z = pSprite->z + getDudeInfo(pSprite->type)->eyeHeight;
|
int z = pSprite->z + getDudeInfo(pSprite->type)->eyeHeight;
|
||||||
int z2 = pTarget->z + getDudeInfo(pTarget->type)->eyeHeight;
|
int z2 = pTarget->z + getDudeInfo(pTarget->type)->eyeHeight;
|
||||||
|
@ -391,6 +390,7 @@ static void sub_661E0(DBloodActor* actor)
|
||||||
int nSprite = pSprite->index;
|
int nSprite = pSprite->index;
|
||||||
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
||||||
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
||||||
|
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
||||||
spritetype *pTarget = &sprite[pXSprite->target_i];
|
spritetype *pTarget = &sprite[pXSprite->target_i];
|
||||||
int z = pSprite->z + getDudeInfo(pSprite->type)->eyeHeight;
|
int z = pSprite->z + getDudeInfo(pSprite->type)->eyeHeight;
|
||||||
int z2 = pTarget->z + getDudeInfo(pTarget->type)->eyeHeight;
|
int z2 = pTarget->z + getDudeInfo(pTarget->type)->eyeHeight;
|
||||||
|
|
|
@ -67,11 +67,7 @@ void cerberusBiteSeqCallback(int, DBloodActor* actor)
|
||||||
Printf(PRINT_HIGH, "pSprite->type >= kDudeBase && pSprite->type < kDudeMax");
|
Printf(PRINT_HIGH, "pSprite->type >= kDudeBase && pSprite->type < kDudeMax");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
///assert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
|
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
||||||
if (!(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites)) {
|
|
||||||
Printf(PRINT_HIGH, "pXSprite->target >= 0 && pXSprite->target < kMaxSprites");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
spritetype *pTarget = &sprite[pXSprite->target_i];
|
spritetype *pTarget = &sprite[pXSprite->target_i];
|
||||||
int dz = pTarget->z-pSprite->z;
|
int dz = pTarget->z-pSprite->z;
|
||||||
actFireVector(actor, 350, -100, dx, dy, dz, kVectorCerberusHack);
|
actFireVector(actor, 350, -100, dx, dy, dz, kVectorCerberusHack);
|
||||||
|
|
|
@ -136,7 +136,7 @@ void cultThrowSeqCallback(int, DBloodActor* actor)
|
||||||
nMissile = kThingArmedTNTBundle;
|
nMissile = kThingArmedTNTBundle;
|
||||||
char v4 = Chance(0x6000);
|
char v4 = Chance(0x6000);
|
||||||
sfxPlay3DSound(pSprite, 455, -1, 0);
|
sfxPlay3DSound(pSprite, 455, -1, 0);
|
||||||
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
|
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
||||||
spritetype *pTarget = &sprite[pXSprite->target_i];
|
spritetype *pTarget = &sprite[pXSprite->target_i];
|
||||||
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
||||||
int dx = pTarget->x - pSprite->x;
|
int dx = pTarget->x - pSprite->x;
|
||||||
|
@ -173,7 +173,7 @@ void sub_68230(int, DBloodActor* actor)
|
||||||
if (gGameOptions.nDifficulty > 2)
|
if (gGameOptions.nDifficulty > 2)
|
||||||
nMissile = kThingArmedTNTBundle;
|
nMissile = kThingArmedTNTBundle;
|
||||||
sfxPlay3DSound(pSprite, 455, -1, 0);
|
sfxPlay3DSound(pSprite, 455, -1, 0);
|
||||||
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
|
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
||||||
spritetype *pTarget = &sprite[pXSprite->target_i];
|
spritetype *pTarget = &sprite[pXSprite->target_i];
|
||||||
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
||||||
int dx = pTarget->x - pSprite->x;
|
int dx = pTarget->x - pSprite->x;
|
||||||
|
@ -252,7 +252,6 @@ static void cultThinkChase(DBloodActor* actor)
|
||||||
}
|
}
|
||||||
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
||||||
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
||||||
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
|
|
||||||
spritetype *pTarget = &sprite[pXSprite->target_i];
|
spritetype *pTarget = &sprite[pXSprite->target_i];
|
||||||
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
||||||
int dx = pTarget->x-pSprite->x;
|
int dx = pTarget->x-pSprite->x;
|
||||||
|
|
|
@ -81,6 +81,7 @@ void SlashFSeqCallback(int, DBloodActor* actor)
|
||||||
{
|
{
|
||||||
XSPRITE* pXSprite = &actor->x();
|
XSPRITE* pXSprite = &actor->x();
|
||||||
spritetype* pSprite = &actor->s();
|
spritetype* pSprite = &actor->s();
|
||||||
|
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
||||||
spritetype *pTarget = &sprite[pXSprite->target_i];
|
spritetype *pTarget = &sprite[pXSprite->target_i];
|
||||||
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
||||||
DUDEINFO *pDudeInfoT = getDudeInfo(pTarget->type);
|
DUDEINFO *pDudeInfoT = getDudeInfo(pTarget->type);
|
||||||
|
@ -110,6 +111,7 @@ void BlastSSeqCallback(int, DBloodActor* actor)
|
||||||
XSPRITE* pXSprite = &actor->x();
|
XSPRITE* pXSprite = &actor->x();
|
||||||
spritetype* pSprite = &actor->s();
|
spritetype* pSprite = &actor->s();
|
||||||
wrand(); // ???
|
wrand(); // ???
|
||||||
|
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
||||||
spritetype *pTarget = &sprite[pXSprite->target_i];
|
spritetype *pTarget = &sprite[pXSprite->target_i];
|
||||||
int height = (pSprite->yrepeat*getDudeInfo(pSprite->type)->eyeHeight) << 2;
|
int height = (pSprite->yrepeat*getDudeInfo(pSprite->type)->eyeHeight) << 2;
|
||||||
int dx = pXSprite->targetX-pSprite->x;
|
int dx = pXSprite->targetX-pSprite->x;
|
||||||
|
@ -366,11 +368,6 @@ static void gargThinkChase(DBloodActor* actor)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
||||||
///assert(pXSprite->target >= 0 && pXSprite->target < kMaxSprites);
|
|
||||||
if (!(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites)) {
|
|
||||||
Printf(PRINT_HIGH, "pXSprite->target >= 0 && pXSprite->target < kMaxSprites");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
spritetype *pTarget = &sprite[pXSprite->target_i];
|
spritetype *pTarget = &sprite[pXSprite->target_i];
|
||||||
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
||||||
int dx = pTarget->x-pSprite->x;
|
int dx = pTarget->x-pSprite->x;
|
||||||
|
|
|
@ -65,6 +65,7 @@ void ghostSlashSeqCallback(int, DBloodActor* actor)
|
||||||
{
|
{
|
||||||
XSPRITE* pXSprite = &actor->x();
|
XSPRITE* pXSprite = &actor->x();
|
||||||
spritetype* pSprite = &actor->s();
|
spritetype* pSprite = &actor->s();
|
||||||
|
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
||||||
spritetype *pTarget = &sprite[pXSprite->target_i];
|
spritetype *pTarget = &sprite[pXSprite->target_i];
|
||||||
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
||||||
DUDEINFO *pDudeInfoT = getDudeInfo(pTarget->type);
|
DUDEINFO *pDudeInfoT = getDudeInfo(pTarget->type);
|
||||||
|
@ -93,6 +94,7 @@ void ghostBlastSeqCallback(int, DBloodActor* actor)
|
||||||
XSPRITE* pXSprite = &actor->x();
|
XSPRITE* pXSprite = &actor->x();
|
||||||
spritetype* pSprite = &actor->s();
|
spritetype* pSprite = &actor->s();
|
||||||
wrand(); // ???
|
wrand(); // ???
|
||||||
|
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
||||||
spritetype *pTarget = &sprite[pXSprite->target_i];
|
spritetype *pTarget = &sprite[pXSprite->target_i];
|
||||||
int height = (pSprite->yrepeat*getDudeInfo(pSprite->type)->eyeHeight) << 2;
|
int height = (pSprite->yrepeat*getDudeInfo(pSprite->type)->eyeHeight) << 2;
|
||||||
int dx = pXSprite->targetX-pSprite->x;
|
int dx = pXSprite->targetX-pSprite->x;
|
||||||
|
@ -344,11 +346,6 @@ static void ghostThinkChase(DBloodActor* actor)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
||||||
///assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
|
|
||||||
if (!(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites)) {
|
|
||||||
Printf(PRINT_HIGH, "pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
spritetype *pTarget = &sprite[pXSprite->target_i];
|
spritetype *pTarget = &sprite[pXSprite->target_i];
|
||||||
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
||||||
int dx = pTarget->x-pSprite->x;
|
int dx = pTarget->x-pSprite->x;
|
||||||
|
|
|
@ -62,6 +62,7 @@ void GillBiteSeqCallback(int, DBloodActor* actor)
|
||||||
{
|
{
|
||||||
XSPRITE* pXSprite = &actor->x();
|
XSPRITE* pXSprite = &actor->x();
|
||||||
spritetype* pSprite = &actor->s();
|
spritetype* pSprite = &actor->s();
|
||||||
|
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
||||||
spritetype *pTarget = &sprite[pXSprite->target_i];
|
spritetype *pTarget = &sprite[pXSprite->target_i];
|
||||||
int dx = CosScale16(pSprite->ang);
|
int dx = CosScale16(pSprite->ang);
|
||||||
int dy = SinScale16(pSprite->ang);
|
int dy = SinScale16(pSprite->ang);
|
||||||
|
@ -128,7 +129,7 @@ static void gillThinkChase(DBloodActor* actor)
|
||||||
}
|
}
|
||||||
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
||||||
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
||||||
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
|
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
||||||
spritetype *pTarget = &sprite[pXSprite->target_i];
|
spritetype *pTarget = &sprite[pXSprite->target_i];
|
||||||
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
||||||
int dx = pTarget->x-pSprite->x;
|
int dx = pTarget->x-pSprite->x;
|
||||||
|
@ -260,7 +261,7 @@ static void gillThinkSwimChase(DBloodActor* actor)
|
||||||
}
|
}
|
||||||
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
||||||
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
||||||
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
|
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
||||||
spritetype *pTarget = &sprite[pXSprite->target_i];
|
spritetype *pTarget = &sprite[pXSprite->target_i];
|
||||||
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
||||||
int dx = pTarget->x-pSprite->x;
|
int dx = pTarget->x-pSprite->x;
|
||||||
|
@ -345,6 +346,7 @@ static void sub_6CD74(DBloodActor* actor)
|
||||||
auto pSprite = &actor->s();
|
auto pSprite = &actor->s();
|
||||||
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
||||||
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
||||||
|
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
||||||
spritetype *pTarget = &sprite[pXSprite->target_i];
|
spritetype *pTarget = &sprite[pXSprite->target_i];
|
||||||
int z = pSprite->z + getDudeInfo(pSprite->type)->eyeHeight;
|
int z = pSprite->z + getDudeInfo(pSprite->type)->eyeHeight;
|
||||||
int z2 = pTarget->z + getDudeInfo(pTarget->type)->eyeHeight;
|
int z2 = pTarget->z + getDudeInfo(pTarget->type)->eyeHeight;
|
||||||
|
@ -381,6 +383,7 @@ static void sub_6D03C(DBloodActor* actor)
|
||||||
auto pSprite = &actor->s();
|
auto pSprite = &actor->s();
|
||||||
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
||||||
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
||||||
|
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
||||||
spritetype *pTarget = &sprite[pXSprite->target_i];
|
spritetype *pTarget = &sprite[pXSprite->target_i];
|
||||||
int z = pSprite->z + getDudeInfo(pSprite->type)->eyeHeight;
|
int z = pSprite->z + getDudeInfo(pSprite->type)->eyeHeight;
|
||||||
int z2 = pTarget->z + getDudeInfo(pTarget->type)->eyeHeight;
|
int z2 = pTarget->z + getDudeInfo(pTarget->type)->eyeHeight;
|
||||||
|
|
|
@ -46,6 +46,7 @@ void HandJumpSeqCallback(int, DBloodActor* actor)
|
||||||
{
|
{
|
||||||
XSPRITE* pXSprite = &actor->x();
|
XSPRITE* pXSprite = &actor->x();
|
||||||
spritetype* pSprite = &actor->s();
|
spritetype* pSprite = &actor->s();
|
||||||
|
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
||||||
spritetype *pTarget = &sprite[pXSprite->target_i];
|
spritetype *pTarget = &sprite[pXSprite->target_i];
|
||||||
if (IsPlayerSprite(pTarget))
|
if (IsPlayerSprite(pTarget))
|
||||||
{
|
{
|
||||||
|
@ -93,7 +94,7 @@ static void handThinkChase(DBloodActor* actor)
|
||||||
}
|
}
|
||||||
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
||||||
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
||||||
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
|
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
||||||
spritetype *pTarget = &sprite[pXSprite->target_i];
|
spritetype *pTarget = &sprite[pXSprite->target_i];
|
||||||
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
||||||
int dx = pTarget->x-pSprite->x;
|
int dx = pTarget->x-pSprite->x;
|
||||||
|
|
|
@ -55,11 +55,7 @@ void houndBiteSeqCallback(int, DBloodActor* actor)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
///assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
|
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
||||||
if (!(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites)) {
|
|
||||||
Printf(PRINT_HIGH, "pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
spritetype *pTarget = &sprite[pXSprite->target_i];
|
spritetype *pTarget = &sprite[pXSprite->target_i];
|
||||||
#ifdef NOONE_EXTENSIONS
|
#ifdef NOONE_EXTENSIONS
|
||||||
if (IsPlayerSprite(pTarget) || gModernMap) // allow to hit non-player targets
|
if (IsPlayerSprite(pTarget) || gModernMap) // allow to hit non-player targets
|
||||||
|
@ -120,11 +116,6 @@ static void houndThinkChase(DBloodActor* actor)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
||||||
///assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
|
|
||||||
if (!(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites)) {
|
|
||||||
Printf(PRINT_HIGH, "pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
spritetype *pTarget = &sprite[pXSprite->target_i];
|
spritetype *pTarget = &sprite[pXSprite->target_i];
|
||||||
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
||||||
int dx = pTarget->x-pSprite->x;
|
int dx = pTarget->x-pSprite->x;
|
||||||
|
|
|
@ -76,7 +76,7 @@ static void innocThinkChase(DBloodActor* actor)
|
||||||
}
|
}
|
||||||
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
||||||
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
||||||
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
|
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
||||||
spritetype *pTarget = &sprite[pXSprite->target_i];
|
spritetype *pTarget = &sprite[pXSprite->target_i];
|
||||||
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
||||||
int dx = pTarget->x-pSprite->x;
|
int dx = pTarget->x-pSprite->x;
|
||||||
|
|
|
@ -73,11 +73,7 @@ void podAttack(int, DBloodActor* actor)
|
||||||
|
|
||||||
spritetype *pTarget = &sprite[pXSprite->target_i];
|
spritetype *pTarget = &sprite[pXSprite->target_i];
|
||||||
|
|
||||||
///assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
||||||
if (!(pSprite->type >= kDudeBase && pSprite->type < kDudeMax)) {
|
|
||||||
Printf(PRINT_HIGH, "pSprite->type >= kDudeBase && pSprite->type < kDudeMax");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
||||||
int x = pTarget->x-pSprite->x;
|
int x = pTarget->x-pSprite->x;
|
||||||
int y = pTarget->y-pSprite->y;
|
int y = pTarget->y-pSprite->y;
|
||||||
|
@ -201,11 +197,6 @@ static void aiPodChase(DBloodActor* actor)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
||||||
///assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
|
|
||||||
if (!(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites)) {
|
|
||||||
Printf(PRINT_HIGH, "pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
spritetype *pTarget = &sprite[pXSprite->target_i];
|
spritetype *pTarget = &sprite[pXSprite->target_i];
|
||||||
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
||||||
int dx = pTarget->x-pSprite->x;
|
int dx = pTarget->x-pSprite->x;
|
||||||
|
|
|
@ -49,7 +49,7 @@ void ratBiteSeqCallback(int, DBloodActor* actor)
|
||||||
int dx = CosScale16(pSprite->ang);
|
int dx = CosScale16(pSprite->ang);
|
||||||
int dy = SinScale16(pSprite->ang);
|
int dy = SinScale16(pSprite->ang);
|
||||||
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
||||||
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
|
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
||||||
spritetype *pTarget = &sprite[pXSprite->target_i];
|
spritetype *pTarget = &sprite[pXSprite->target_i];
|
||||||
if (IsPlayerSprite(pTarget))
|
if (IsPlayerSprite(pTarget))
|
||||||
actFireVector(actor, 0, 0, dx, dy, pTarget->z-pSprite->z, kVectorRatBite);
|
actFireVector(actor, 0, 0, dx, dy, pTarget->z-pSprite->z, kVectorRatBite);
|
||||||
|
@ -90,7 +90,6 @@ static void ratThinkChase(DBloodActor* actor)
|
||||||
}
|
}
|
||||||
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
||||||
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
||||||
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
|
|
||||||
spritetype *pTarget = &sprite[pXSprite->target_i];
|
spritetype *pTarget = &sprite[pXSprite->target_i];
|
||||||
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
||||||
int dx = pTarget->x-pSprite->x;
|
int dx = pTarget->x-pSprite->x;
|
||||||
|
|
|
@ -73,7 +73,7 @@ void SpidBiteSeqCallback(int, DBloodActor* actor)
|
||||||
dy += Random2(2000);
|
dy += Random2(2000);
|
||||||
int dz = Random2(2000);
|
int dz = Random2(2000);
|
||||||
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
||||||
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
|
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
||||||
spritetype *pTarget = &sprite[pXSprite->target_i];
|
spritetype *pTarget = &sprite[pXSprite->target_i];
|
||||||
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
||||||
if (IsPlayerSprite(pTarget)) {
|
if (IsPlayerSprite(pTarget)) {
|
||||||
|
@ -122,7 +122,7 @@ void SpidJumpSeqCallback(int, DBloodActor* actor)
|
||||||
dy += Random2(200);
|
dy += Random2(200);
|
||||||
int dz = Random2(200);
|
int dz = Random2(200);
|
||||||
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
||||||
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
|
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
||||||
spritetype *pTarget = &sprite[pXSprite->target_i];
|
spritetype *pTarget = &sprite[pXSprite->target_i];
|
||||||
if (IsPlayerSprite(pTarget)) {
|
if (IsPlayerSprite(pTarget)) {
|
||||||
dz += pTarget->z-pSprite->z;
|
dz += pTarget->z-pSprite->z;
|
||||||
|
@ -144,7 +144,7 @@ void SpidBirthSeqCallback(int, DBloodActor* actor)
|
||||||
spritetype* pSprite = &actor->s();
|
spritetype* pSprite = &actor->s();
|
||||||
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
||||||
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
||||||
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
|
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
||||||
spritetype *pTarget = &sprite[pXSprite->target_i];
|
spritetype *pTarget = &sprite[pXSprite->target_i];
|
||||||
DUDEEXTRA_at6_u1 *pDudeExtraE = &actor->dudeExtra.at6.u1;
|
DUDEEXTRA_at6_u1 *pDudeExtraE = &actor->dudeExtra.at6.u1;
|
||||||
int dx = pXSprite->targetX-pSprite->x;
|
int dx = pXSprite->targetX-pSprite->x;
|
||||||
|
@ -207,7 +207,6 @@ static void spidThinkChase(DBloodActor* actor)
|
||||||
}
|
}
|
||||||
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
||||||
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
||||||
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
|
|
||||||
spritetype *pTarget = &sprite[pXSprite->target_i];
|
spritetype *pTarget = &sprite[pXSprite->target_i];
|
||||||
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
||||||
int dx = pTarget->x-pSprite->x;
|
int dx = pTarget->x-pSprite->x;
|
||||||
|
|
|
@ -50,6 +50,7 @@ void sub_71A90(int, DBloodActor* actor)
|
||||||
{
|
{
|
||||||
XSPRITE* pXSprite = &actor->x();
|
XSPRITE* pXSprite = &actor->x();
|
||||||
spritetype* pSprite = &actor->s();
|
spritetype* pSprite = &actor->s();
|
||||||
|
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
||||||
spritetype *pTarget = &sprite[pXSprite->target_i];
|
spritetype *pTarget = &sprite[pXSprite->target_i];
|
||||||
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
||||||
int nTarget = pTarget->index;
|
int nTarget = pTarget->index;
|
||||||
|
@ -317,11 +318,7 @@ static void sub_72934(DBloodActor* actor)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
||||||
///assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
|
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
||||||
if (!(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites)) {
|
|
||||||
Printf(PRINT_HIGH, "pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
spritetype *pTarget = &sprite[pXSprite->target_i];
|
spritetype *pTarget = &sprite[pXSprite->target_i];
|
||||||
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
||||||
int dx = pTarget->x-pSprite->x;
|
int dx = pTarget->x-pSprite->x;
|
||||||
|
|
|
@ -63,6 +63,7 @@ void HackSeqCallback(int, DBloodActor* actor)
|
||||||
{
|
{
|
||||||
XSPRITE* pXSprite = &actor->x();
|
XSPRITE* pXSprite = &actor->x();
|
||||||
spritetype* pSprite = &actor->s();
|
spritetype* pSprite = &actor->s();
|
||||||
|
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
||||||
spritetype *pTarget = &sprite[pXSprite->target_i];
|
spritetype *pTarget = &sprite[pXSprite->target_i];
|
||||||
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
||||||
DUDEINFO *pDudeInfoT = getDudeInfo(pTarget->type);
|
DUDEINFO *pDudeInfoT = getDudeInfo(pTarget->type);
|
||||||
|
@ -118,7 +119,7 @@ static void zombaThinkChase(DBloodActor* actor)
|
||||||
}
|
}
|
||||||
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
||||||
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
||||||
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
|
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
||||||
spritetype *pTarget = &sprite[pXSprite->target_i];
|
spritetype *pTarget = &sprite[pXSprite->target_i];
|
||||||
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
||||||
int dx = pTarget->x-pSprite->x;
|
int dx = pTarget->x-pSprite->x;
|
||||||
|
@ -170,7 +171,7 @@ static void zombaThinkPonder(DBloodActor* actor)
|
||||||
}
|
}
|
||||||
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
||||||
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
||||||
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
|
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
||||||
spritetype *pTarget = &sprite[pXSprite->target_i];
|
spritetype *pTarget = &sprite[pXSprite->target_i];
|
||||||
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
||||||
int dx = pTarget->x-pSprite->x;
|
int dx = pTarget->x-pSprite->x;
|
||||||
|
|
|
@ -52,6 +52,7 @@ void zombfHackSeqCallback(int, DBloodActor* actor)
|
||||||
spritetype* pSprite = &actor->s();
|
spritetype* pSprite = &actor->s();
|
||||||
if (pSprite->type != kDudeZombieButcher)
|
if (pSprite->type != kDudeZombieButcher)
|
||||||
return;
|
return;
|
||||||
|
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
||||||
spritetype *pTarget = &sprite[pXSprite->target_i];
|
spritetype *pTarget = &sprite[pXSprite->target_i];
|
||||||
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
||||||
int height = (pDudeInfo->eyeHeight*pSprite->yrepeat);
|
int height = (pDudeInfo->eyeHeight*pSprite->yrepeat);
|
||||||
|
@ -64,6 +65,7 @@ void PukeSeqCallback(int, DBloodActor* actor)
|
||||||
{
|
{
|
||||||
XSPRITE* pXSprite = &actor->x();
|
XSPRITE* pXSprite = &actor->x();
|
||||||
spritetype* pSprite = &actor->s();
|
spritetype* pSprite = &actor->s();
|
||||||
|
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
||||||
spritetype *pTarget = &sprite[pXSprite->target_i];
|
spritetype *pTarget = &sprite[pXSprite->target_i];
|
||||||
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
||||||
DUDEINFO *pDudeInfoT = getDudeInfo(pTarget->type);
|
DUDEINFO *pDudeInfoT = getDudeInfo(pTarget->type);
|
||||||
|
@ -119,7 +121,7 @@ static void zombfThinkChase(DBloodActor* actor)
|
||||||
}
|
}
|
||||||
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
||||||
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
||||||
assert(pXSprite->target_i >= 0 && pXSprite->target_i < kMaxSprites);
|
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
||||||
spritetype *pTarget = &sprite[pXSprite->target_i];
|
spritetype *pTarget = &sprite[pXSprite->target_i];
|
||||||
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
XSPRITE *pXTarget = &xsprite[pTarget->extra];
|
||||||
int dx = pTarget->x-pSprite->x;
|
int dx = pTarget->x-pSprite->x;
|
||||||
|
|
|
@ -11,45 +11,45 @@ extern int cumulDamage[kMaxXSprites];
|
||||||
class DBloodActor
|
class DBloodActor
|
||||||
{
|
{
|
||||||
int index;
|
int index;
|
||||||
DBloodActor* base();
|
DBloodActor* base();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int dudeSlope;
|
int dudeSlope;
|
||||||
DUDEEXTRA dudeExtra;
|
DUDEEXTRA dudeExtra;
|
||||||
|
|
||||||
DBloodActor() :index(int(this - base())) { /*assert(index >= 0 && index < kMaxSprites);*/ }
|
DBloodActor() :index(int(this - base())) { /*assert(index >= 0 && index < kMaxSprites);*/ }
|
||||||
DBloodActor& operator=(const DBloodActor& other) = default;
|
DBloodActor& operator=(const DBloodActor& other) = default;
|
||||||
|
|
||||||
void Clear()
|
void Clear()
|
||||||
{
|
{
|
||||||
dudeSlope = 0;
|
dudeSlope = 0;
|
||||||
dudeExtra = {};
|
dudeExtra = {};
|
||||||
}
|
}
|
||||||
bool hasX() { return sprite[index].extra > 0; }
|
bool hasX() { return sprite[index].extra > 0; }
|
||||||
void addX()
|
void addX()
|
||||||
{
|
{
|
||||||
if (s().extra == -1) dbInsertXSprite(s().index);
|
if (s().extra == -1) dbInsertXSprite(s().index);
|
||||||
}
|
}
|
||||||
spritetype& s() { return sprite[index]; }
|
spritetype& s() { return sprite[index]; }
|
||||||
XSPRITE& x() { return xsprite[sprite[index].extra]; } // calling this does not validate the xsprite!
|
XSPRITE& x() { return xsprite[sprite[index].extra]; } // calling this does not validate the xsprite!
|
||||||
SPRITEHIT& hit() { return gSpriteHit[sprite[index].extra]; }
|
SPRITEHIT& hit() { return gSpriteHit[sprite[index].extra]; }
|
||||||
int& xvel() { return Blood::xvel[index]; }
|
int& xvel() { return Blood::xvel[index]; }
|
||||||
int& yvel() { return Blood::yvel[index]; }
|
int& yvel() { return Blood::yvel[index]; }
|
||||||
int& zvel() { return Blood::zvel[index]; }
|
int& zvel() { return Blood::zvel[index]; }
|
||||||
|
|
||||||
int& cumulDamage() { return Blood::cumulDamage[sprite[index].extra]; }
|
int& cumulDamage() { return Blood::cumulDamage[sprite[index].extra]; }
|
||||||
SPRITEMASS& spriteMass() { return gSpriteMass[sprite[index].extra]; }
|
SPRITEMASS& spriteMass() { return gSpriteMass[sprite[index].extra]; }
|
||||||
GENDUDEEXTRA& genDudeExtra() { return Blood::gGenDudeExtra[index]; }
|
GENDUDEEXTRA& genDudeExtra() { return Blood::gGenDudeExtra[index]; }
|
||||||
POINT3D& basePoint() { return Blood::baseSprite[index]; }
|
POINT3D& basePoint() { return Blood::baseSprite[index]; }
|
||||||
|
|
||||||
void SetOwner(DBloodActor* own)
|
void SetOwner(DBloodActor* own)
|
||||||
{
|
{
|
||||||
s().owner = own? own->s().index : -1;
|
s().owner = own ? own->s().index : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
DBloodActor* GetOwner()
|
DBloodActor* GetOwner()
|
||||||
{
|
{
|
||||||
if (s().owner == -1 || s().owner == kMaxSprites-1) return nullptr;
|
if (s().owner == -1 || s().owner == kMaxSprites - 1) return nullptr;
|
||||||
return base() + s().owner;
|
return base() + s().owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,10 +60,20 @@ public:
|
||||||
|
|
||||||
DBloodActor* GetTarget()
|
DBloodActor* GetTarget()
|
||||||
{
|
{
|
||||||
if (x().target_i == -1 || x().target_i == kMaxSprites - 1) return nullptr;
|
if (x().target_i <= -1 || x().target_i == kMaxSprites - 1) return nullptr;
|
||||||
return base() + x().target_i;
|
return base() + x().target_i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ValidateTarget(const char* func)
|
||||||
|
{
|
||||||
|
if (GetTarget() == nullptr)
|
||||||
|
{
|
||||||
|
Printf(PRINT_HIGH | PRINT_NOTIFY, "%s: invalid target in calling actor\n", func);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void SetBurnSource(DBloodActor* own)
|
void SetBurnSource(DBloodActor* own)
|
||||||
{
|
{
|
||||||
x().burnSource = own ? own->s().index : -1;
|
x().burnSource = own ? own->s().index : -1;
|
||||||
|
|
Loading…
Reference in a new issue