- replaced some GetSpriteExtents calls with GetActorExtents.

This commit is contained in:
Christoph Oelckers 2021-05-05 13:39:16 +02:00
parent 44b0e59127
commit bbe3f333fa
8 changed files with 15 additions and 14 deletions

View file

@ -134,7 +134,7 @@ bool CanMove(DBloodActor *actor, DBloodActor* target, int nAngle, int nRange)
{ {
auto pSprite = &actor->s(); auto pSprite = &actor->s();
int top, bottom; int top, bottom;
GetSpriteExtents(pSprite, &top, &bottom); GetActorExtents(actor, &top, &bottom);
int x = pSprite->x; int x = pSprite->x;
int y = pSprite->y; int y = pSprite->y;
int z = pSprite->z; int z = pSprite->z;

View file

@ -185,7 +185,7 @@ static void batThinkPonder(DBloodActor* actor)
int height = (pDudeInfo->eyeHeight*pSprite->yrepeat)<<2; int height = (pDudeInfo->eyeHeight*pSprite->yrepeat)<<2;
int height2 = (getDudeInfo(pTarget->type)->eyeHeight*pTarget->yrepeat)<<2; int height2 = (getDudeInfo(pTarget->type)->eyeHeight*pTarget->yrepeat)<<2;
int top, bottom; int top, bottom;
GetSpriteExtents(pSprite, &top, &bottom); GetActorExtents(actor, &top, &bottom);
if (cansee(pTarget->x, pTarget->y, pTarget->z, pTarget->sectnum, pSprite->x, pSprite->y, pSprite->z - height, pSprite->sectnum)) if (cansee(pTarget->x, pTarget->y, pTarget->z, pTarget->sectnum, pSprite->x, pSprite->y, pSprite->z - height, pSprite->sectnum))
{ {
aiSetTarget(actor, actor->GetTarget()); aiSetTarget(actor, actor->GetTarget());
@ -299,7 +299,7 @@ static void batThinkChase(DBloodActor* actor)
// Should be dudeInfo[pTarget->type-kDudeBase] // Should be dudeInfo[pTarget->type-kDudeBase]
int height2 = (pDudeInfo->eyeHeight*pTarget->yrepeat)<<2; int height2 = (pDudeInfo->eyeHeight*pTarget->yrepeat)<<2;
int top, bottom; int top, bottom;
GetSpriteExtents(pSprite, &top, &bottom); GetActorExtents(actor, &top, &bottom);
if (cansee(pTarget->x, pTarget->y, pTarget->z, pTarget->sectnum, pSprite->x, pSprite->y, pSprite->z - height, pSprite->sectnum)) if (cansee(pTarget->x, pTarget->y, pTarget->z, pTarget->sectnum, pSprite->x, pSprite->y, pSprite->z - height, pSprite->sectnum))
{ {
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)

View file

@ -124,7 +124,7 @@ void StompSeqCallback(int, DBloodActor* actor1)
if (TestBitString(sectmap, pSprite2->sectnum) && CheckProximity(pSprite2, x, y, z, nSector, vc)) if (TestBitString(sectmap, pSprite2->sectnum) && CheckProximity(pSprite2, x, y, z, nSector, vc))
{ {
int top, bottom; int top, bottom;
GetSpriteExtents(pSprite, &top, &bottom); GetActorExtents(actor1, &top, &bottom);
if (abs(bottom-sector[nSector].floorz) == 0) if (abs(bottom-sector[nSector].floorz) == 0)
{ {
int dx = abs(pSprite->x-pSprite2->x); int dx = abs(pSprite->x-pSprite2->x);
@ -431,7 +431,7 @@ static void beastThinkSwimChase(DBloodActor* actor)
int nDeltaAngle = ((getangle(dx,dy)+1024-pSprite->ang)&2047)-1024; int nDeltaAngle = ((getangle(dx,dy)+1024-pSprite->ang)&2047)-1024;
int height = pDudeInfo->eyeHeight+pSprite->z; int height = pDudeInfo->eyeHeight+pSprite->z;
int top, bottom; int top, bottom;
GetSpriteExtents(pSprite, &top, &bottom); GetActorExtents(actor, &top, &bottom);
if (cansee(pTarget->x, pTarget->y, pTarget->z, pTarget->sectnum, pSprite->x, pSprite->y, pSprite->z - height, pSprite->sectnum)) if (cansee(pTarget->x, pTarget->y, pTarget->z, pTarget->sectnum, pSprite->x, pSprite->y, pSprite->z - height, pSprite->sectnum))
{ {
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)

View file

@ -198,7 +198,7 @@ static void eelThinkPonder(DBloodActor* actor)
int height = (pDudeInfo->eyeHeight*pSprite->yrepeat)<<2; int height = (pDudeInfo->eyeHeight*pSprite->yrepeat)<<2;
int height2 = (getDudeInfo(pTarget->type)->eyeHeight*pTarget->yrepeat)<<2; int height2 = (getDudeInfo(pTarget->type)->eyeHeight*pTarget->yrepeat)<<2;
int top, bottom; int top, bottom;
GetSpriteExtents(pSprite, &top, &bottom); GetActorExtents(actor, &top, &bottom);
if (cansee(pTarget->x, pTarget->y, pTarget->z, pTarget->sectnum, pSprite->x, pSprite->y, pSprite->z - height, pSprite->sectnum)) if (cansee(pTarget->x, pTarget->y, pTarget->z, pTarget->sectnum, pSprite->x, pSprite->y, pSprite->z - height, pSprite->sectnum))
{ {
aiSetTarget(actor, actor->GetTarget()); aiSetTarget(actor, actor->GetTarget());
@ -309,7 +309,7 @@ static void eelThinkChase(DBloodActor* actor)
int nDeltaAngle = ((getangle(dx,dy)+1024-pSprite->ang)&2047)-1024; int nDeltaAngle = ((getangle(dx,dy)+1024-pSprite->ang)&2047)-1024;
int height = (pDudeInfo->eyeHeight*pSprite->yrepeat)<<2; int height = (pDudeInfo->eyeHeight*pSprite->yrepeat)<<2;
int top, bottom; int top, bottom;
GetSpriteExtents(pSprite, &top, &bottom); GetActorExtents(actor, &top, &bottom);
int top2, bottom2; int top2, bottom2;
GetSpriteExtents(pTarget, &top2, &bottom2); GetSpriteExtents(pTarget, &top2, &bottom2);
if (cansee(pTarget->x, pTarget->y, pTarget->z, pTarget->sectnum, pSprite->x, pSprite->y, pSprite->z - height, pSprite->sectnum)) if (cansee(pTarget->x, pTarget->y, pTarget->z, pTarget->sectnum, pSprite->x, pSprite->y, pSprite->z - height, pSprite->sectnum))

View file

@ -293,7 +293,7 @@ static void calebThinkSwimChase(DBloodActor* actor)
int nDeltaAngle = ((getangle(dx,dy)+1024-pSprite->ang)&2047)-1024; int nDeltaAngle = ((getangle(dx,dy)+1024-pSprite->ang)&2047)-1024;
int height = pDudeInfo->eyeHeight+pSprite->z; int height = pDudeInfo->eyeHeight+pSprite->z;
int top, bottom; int top, bottom;
GetSpriteExtents(pSprite, &top, &bottom); GetActorExtents(actor, &top, &bottom);
if (cansee(pTarget->x, pTarget->y, pTarget->z, pTarget->sectnum, pSprite->x, pSprite->y, pSprite->z - height, pSprite->sectnum)) if (cansee(pTarget->x, pTarget->y, pTarget->z, pTarget->sectnum, pSprite->x, pSprite->y, pSprite->z - height, pSprite->sectnum))
{ {
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)

View file

@ -129,6 +129,7 @@ void BlastSSeqCallback(int, DBloodActor* actor)
StatIterator it(kStatDude); StatIterator it(kStatDude);
while ((nSprite2 = it.NextIndex()) >= 0) while ((nSprite2 = it.NextIndex()) >= 0)
{ {
auto actor2 = &bloodActors[nSprite2];
spritetype *pSprite2 = &sprite[nSprite2]; spritetype *pSprite2 = &sprite[nSprite2];
if (pSprite == pSprite2 || !(pSprite2->flags&8)) if (pSprite == pSprite2 || !(pSprite2->flags&8))
continue; continue;
@ -150,7 +151,7 @@ void BlastSSeqCallback(int, DBloodActor* actor)
int tz = z+MulScale(actor->dudeSlope, nDist, 10); int tz = z+MulScale(actor->dudeSlope, nDist, 10);
int tsr = MulScale(9460, nDist, 10); int tsr = MulScale(9460, nDist, 10);
int top, bottom; int top, bottom;
GetSpriteExtents(pSprite2, &top, &bottom); GetActorExtents(actor2, &top, &bottom);
if (tz-tsr > bottom || tz+tsr < top) if (tz-tsr > bottom || tz+tsr < top)
continue; continue;
int dx = (tx-x2)>>4; int dx = (tx-x2)>>4;
@ -390,14 +391,15 @@ static void gargThinkChase(DBloodActor* actor)
// Should be dudeInfo[pTarget->type-kDudeBase] // Should be dudeInfo[pTarget->type-kDudeBase]
int height2 = (pDudeInfo->eyeHeight*pTarget->yrepeat)<<2; int height2 = (pDudeInfo->eyeHeight*pTarget->yrepeat)<<2;
int top, bottom; int top, bottom;
GetSpriteExtents(pSprite, &top, &bottom); GetActorExtents(actor, &top, &bottom);
if (cansee(pTarget->x, pTarget->y, pTarget->z, pTarget->sectnum, pSprite->x, pSprite->y, pSprite->z - height, pSprite->sectnum)) if (cansee(pTarget->x, pTarget->y, pTarget->z, pTarget->sectnum, pSprite->x, pSprite->y, pSprite->z - height, pSprite->sectnum))
{ {
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
{ {
aiSetTarget(actor, actor->GetTarget()); aiSetTarget(actor, actor->GetTarget());
int floorZ = getflorzofslope(pSprite->sectnum, pSprite->x, pSprite->y); int floorZ = getflorzofslope(pSprite->sectnum, pSprite->x, pSprite->y);
switch (pSprite->type) { switch (pSprite->type)
{
case kDudeGargoyleFlesh: case kDudeGargoyleFlesh:
if (nDist < 0x1800 && nDist > 0xc00 && abs(nDeltaAngle) < 85) if (nDist < 0x1800 && nDist > 0xc00 && abs(nDeltaAngle) < 85)
{ {
@ -710,7 +712,6 @@ static void gargMoveFly(DBloodActor* actor)
actor->zvel() = -t1; actor->zvel() = -t1;
break; break;
} }
abs(actor->zvel());
} }
END_BLD_NS END_BLD_NS

View file

@ -369,7 +369,7 @@ static void ghostThinkChase(DBloodActor* actor)
// Should be dudeInfo[pTarget->type-kDudeBase] // Should be dudeInfo[pTarget->type-kDudeBase]
int height2 = (pDudeInfo->eyeHeight*pTarget->yrepeat)<<2; int height2 = (pDudeInfo->eyeHeight*pTarget->yrepeat)<<2;
int top, bottom; int top, bottom;
GetSpriteExtents(pSprite, &top, &bottom); GetActorExtents(actor, &top, &bottom);
if (cansee(pTarget->x, pTarget->y, pTarget->z, pTarget->sectnum, pSprite->x, pSprite->y, pSprite->z - height, pSprite->sectnum)) if (cansee(pTarget->x, pTarget->y, pTarget->z, pTarget->sectnum, pSprite->x, pSprite->y, pSprite->z - height, pSprite->sectnum))
{ {
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)

View file

@ -283,7 +283,7 @@ static void gillThinkSwimChase(DBloodActor* actor)
int nDeltaAngle = ((getangle(dx,dy)+1024-pSprite->ang)&2047)-1024; int nDeltaAngle = ((getangle(dx,dy)+1024-pSprite->ang)&2047)-1024;
int height = pDudeInfo->eyeHeight+pSprite->z; int height = pDudeInfo->eyeHeight+pSprite->z;
int top, bottom; int top, bottom;
GetSpriteExtents(pSprite, &top, &bottom); GetActorExtents(actor, &top, &bottom);
if (cansee(pTarget->x, pTarget->y, pTarget->z, pTarget->sectnum, pSprite->x, pSprite->y, pSprite->z - height, pSprite->sectnum)) if (cansee(pTarget->x, pTarget->y, pTarget->z, pTarget->sectnum, pSprite->x, pSprite->y, pSprite->z - height, pSprite->sectnum))
{ {
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)