- added a few more ValidateTarget calls.

This commit is contained in:
Christoph Oelckers 2021-09-16 19:28:42 +02:00
parent a3a5e7e90b
commit 595893a9a0
2 changed files with 7 additions and 25 deletions

View file

@ -81,11 +81,8 @@ void cerberusBurnSeqCallback(int, DBloodActor* actor)
spritetype* pSprite = &actor->s(); spritetype* pSprite = &actor->s();
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int height = pDudeInfo->eyeHeight*pSprite->yrepeat; int height = pDudeInfo->eyeHeight*pSprite->yrepeat;
///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;
}
int x = pSprite->x; int x = pSprite->x;
int y = pSprite->y; int y = pSprite->y;
int z = height; // ??? int z = height; // ???
@ -161,11 +158,7 @@ void cerberusBurnSeqCallback2(int, DBloodActor* actor)
{ {
XSPRITE* pXSprite = &actor->x(); XSPRITE* pXSprite = &actor->x();
spritetype* pSprite = &actor->s(); spritetype* pSprite = &actor->s();
///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;
}
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int height = pDudeInfo->eyeHeight*pSprite->yrepeat; int height = pDudeInfo->eyeHeight*pSprite->yrepeat;
@ -367,11 +360,7 @@ static void cerberusThinkChase(DBloodActor* actor)
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
///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 = &actor->GetTarget()->s(); spritetype *pTarget = &actor->GetTarget()->s();
XSPRITE* pXTarget = &actor->GetTarget()->x(); XSPRITE* pXTarget = &actor->GetTarget()->x();
int dx = pTarget->x-pSprite->x; int dx = pTarget->x-pSprite->x;

View file

@ -68,11 +68,7 @@ void sub_71BD4(int, DBloodActor* actor)
spritetype* pSprite = &actor->s(); spritetype* pSprite = &actor->s();
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int height = pSprite->yrepeat*pDudeInfo->eyeHeight; int height = pSprite->yrepeat*pDudeInfo->eyeHeight;
///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;
}
int x = pSprite->x; int x = pSprite->x;
int y = pSprite->y; int y = pSprite->y;
int z = height; int z = height;
@ -141,11 +137,8 @@ void sub_720AC(int, DBloodActor* actor)
{ {
XSPRITE* pXSprite = &actor->x(); XSPRITE* pXSprite = &actor->x();
spritetype* pSprite = &actor->s(); spritetype* pSprite = &actor->s();
///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;
}
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type); DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
int height = pSprite->yrepeat*pDudeInfo->eyeHeight; int height = pSprite->yrepeat*pDudeInfo->eyeHeight;
int ax, ay, az; int ax, ay, az;