mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-31 04:20:42 +00:00
- lots of boilerplate sections to get a pXSector pointer replaced.
Looks like this was originally an inline function, judging from how this was repeated all over again.
This commit is contained in:
parent
2e8e5544c5
commit
adaa132515
3 changed files with 27 additions and 117 deletions
|
@ -185,12 +185,9 @@ static void beastThinkGoto(DBloodActor* actor)
|
|||
auto pSprite = &actor->s();
|
||||
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
||||
DUDEINFO* pDudeInfo = getDudeInfo(pSprite->type);
|
||||
XSECTOR* pXSector;
|
||||
int nXSector = sector[pSprite->sectnum].extra;
|
||||
if (nXSector > 0)
|
||||
pXSector = &xsector[nXSector];
|
||||
else
|
||||
pXSector = NULL;
|
||||
auto pSector = pSprite->sector();
|
||||
auto pXSector = pSector->hasX() ? &pSector->xs() : nullptr;
|
||||
|
||||
int dx = pXSprite->targetX - pSprite->x;
|
||||
int dy = pXSprite->targetY - pSprite->y;
|
||||
int nAngle = getangle(dx, dy);
|
||||
|
@ -208,15 +205,12 @@ static void beastThinkGoto(DBloodActor* actor)
|
|||
|
||||
static void beastThinkChase(DBloodActor* actor)
|
||||
{
|
||||
auto pSprite = &actor->s();
|
||||
auto const pSprite = &actor->s();
|
||||
if (actor->GetTarget() == nullptr)
|
||||
{
|
||||
XSECTOR* pXSector;
|
||||
int nXSector = sector[pSprite->sectnum].extra;
|
||||
if (nXSector > 0)
|
||||
pXSector = &xsector[nXSector];
|
||||
else
|
||||
pXSector = NULL;
|
||||
auto pSector = pSprite->sector();
|
||||
auto pXSector = pSector->hasX() ? &pSector->xs() : nullptr;
|
||||
|
||||
if (pXSector && pXSector->Underwater)
|
||||
aiNewState(actor, &beastSwimSearch);
|
||||
else
|
||||
|
@ -231,14 +225,12 @@ static void beastThinkChase(DBloodActor* actor)
|
|||
int dx = pTarget->x - pSprite->x;
|
||||
int dy = pTarget->y - pSprite->y;
|
||||
aiChooseDirection(actor, getangle(dx, dy));
|
||||
|
||||
auto pSector = pSprite->sector();
|
||||
auto pXSector = pSector->hasX() ? &pSector->xs() : nullptr;
|
||||
|
||||
if (pXTarget->health == 0)
|
||||
{
|
||||
XSECTOR* pXSector;
|
||||
int nXSector = sector[pSprite->sectnum].extra;
|
||||
if (nXSector > 0)
|
||||
pXSector = &xsector[nXSector];
|
||||
else
|
||||
pXSector = NULL;
|
||||
if (pXSector && pXSector->Underwater)
|
||||
aiNewState(actor, &beastSwimSearch);
|
||||
else
|
||||
|
@ -247,12 +239,6 @@ static void beastThinkChase(DBloodActor* actor)
|
|||
}
|
||||
if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type - kDudePlayer1], kPwUpShadowCloak) > 0)
|
||||
{
|
||||
XSECTOR* pXSector;
|
||||
int nXSector = sector[pSprite->sectnum].extra;
|
||||
if (nXSector > 0)
|
||||
pXSector = &xsector[nXSector];
|
||||
else
|
||||
pXSector = NULL;
|
||||
if (pXSector && pXSector->Underwater)
|
||||
aiNewState(actor, &beastSwimSearch);
|
||||
else
|
||||
|
@ -273,12 +259,6 @@ static void beastThinkChase(DBloodActor* actor)
|
|||
if (nDist < 0x1400 && nDist > 0xa00 && abs(nDeltaAngle) < 85 && (pTarget->flags & 2)
|
||||
&& IsPlayerSprite(pTarget) && Chance(0x8000))
|
||||
{
|
||||
XSECTOR* pXSector;
|
||||
int nXSector = sector[pSprite->sectnum].extra;
|
||||
if (nXSector > 0)
|
||||
pXSector = &xsector[nXSector];
|
||||
else
|
||||
pXSector = NULL;
|
||||
int hit = HitScan(actor, pSprite->z, dx, dy, 0, CLIPMASK1, 0);
|
||||
if (pXTarget->health > (unsigned)gPlayerTemplate[0].startHealth / 2)
|
||||
{
|
||||
|
@ -311,12 +291,6 @@ static void beastThinkChase(DBloodActor* actor)
|
|||
}
|
||||
if (nDist < 921 && abs(nDeltaAngle) < 28)
|
||||
{
|
||||
XSECTOR* pXSector;
|
||||
int nXSector = sector[pSprite->sectnum].extra;
|
||||
if (nXSector > 0)
|
||||
pXSector = &xsector[nXSector];
|
||||
else
|
||||
pXSector = NULL;
|
||||
int hit = HitScan(actor, pSprite->z, dx, dy, 0, CLIPMASK1, 0);
|
||||
switch (hit)
|
||||
{
|
||||
|
@ -355,12 +329,6 @@ static void beastThinkChase(DBloodActor* actor)
|
|||
}
|
||||
}
|
||||
|
||||
XSECTOR* pXSector;
|
||||
int nXSector = sector[pSprite->sectnum].extra;
|
||||
if (nXSector > 0)
|
||||
pXSector = &xsector[nXSector];
|
||||
else
|
||||
pXSector = NULL;
|
||||
if (pXSector && pXSector->Underwater)
|
||||
aiNewState(actor, &beastSwimGoto);
|
||||
else
|
||||
|
|
|
@ -94,12 +94,10 @@ static void calebThinkGoto(DBloodActor* actor)
|
|||
auto pSprite = &actor->s();
|
||||
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
||||
DUDEINFO* pDudeInfo = getDudeInfo(pSprite->type);
|
||||
XSECTOR* pXSector;
|
||||
int nXSector = sector[pSprite->sectnum].extra;
|
||||
if (nXSector > 0)
|
||||
pXSector = &xsector[nXSector];
|
||||
else
|
||||
pXSector = NULL;
|
||||
|
||||
auto pSector = pSprite->sector();
|
||||
auto pXSector = pSector->hasX() ? &pSector->xs() : nullptr;
|
||||
|
||||
int dx = pXSprite->targetX - pSprite->x;
|
||||
int dy = pXSprite->targetY - pSprite->y;
|
||||
int nAngle = getangle(dx, dy);
|
||||
|
@ -117,15 +115,12 @@ static void calebThinkGoto(DBloodActor* actor)
|
|||
|
||||
static void calebThinkChase(DBloodActor* actor)
|
||||
{
|
||||
auto pSprite = &actor->s();
|
||||
auto const pSprite = &actor->s();
|
||||
auto pSector = pSprite->sector();
|
||||
auto pXSector = pSector->hasX() ? &pSector->xs() : nullptr;
|
||||
|
||||
if (actor->GetTarget() == nullptr)
|
||||
{
|
||||
XSECTOR* pXSector;
|
||||
int nXSector = sector[pSprite->sectnum].extra;
|
||||
if (nXSector > 0)
|
||||
pXSector = &xsector[nXSector];
|
||||
else
|
||||
pXSector = NULL;
|
||||
if (pXSector && pXSector->Underwater)
|
||||
aiNewState(actor, &tinycalebSwimSearch);
|
||||
else
|
||||
|
@ -141,12 +136,6 @@ static void calebThinkChase(DBloodActor* actor)
|
|||
aiChooseDirection(actor, getangle(dx, dy));
|
||||
if (pXTarget->health == 0)
|
||||
{
|
||||
XSECTOR* pXSector;
|
||||
int nXSector = sector[pSprite->sectnum].extra;
|
||||
if (nXSector > 0)
|
||||
pXSector = &xsector[nXSector];
|
||||
else
|
||||
pXSector = NULL;
|
||||
if (pXSector && pXSector->Underwater)
|
||||
aiNewState(actor, &tinycalebSwimSearch);
|
||||
else
|
||||
|
@ -158,12 +147,6 @@ static void calebThinkChase(DBloodActor* actor)
|
|||
}
|
||||
if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type - kDudePlayer1], kPwUpShadowCloak) > 0)
|
||||
{
|
||||
XSECTOR* pXSector;
|
||||
int nXSector = sector[pSprite->sectnum].extra;
|
||||
if (nXSector > 0)
|
||||
pXSector = &xsector[nXSector];
|
||||
else
|
||||
pXSector = NULL;
|
||||
if (pXSector && pXSector->Underwater)
|
||||
aiNewState(actor, &tinycalebSwimSearch);
|
||||
else
|
||||
|
@ -183,12 +166,6 @@ static void calebThinkChase(DBloodActor* actor)
|
|||
actor->dudeSlope = nDist == 0 ? 0 : DivScale(pTarget->z-pSprite->z, nDist, 10);
|
||||
if (nDist < 0x599 && abs(nDeltaAngle) < 28)
|
||||
{
|
||||
XSECTOR* pXSector;
|
||||
int nXSector = sector[pSprite->sectnum].extra;
|
||||
if (nXSector > 0)
|
||||
pXSector = &xsector[nXSector];
|
||||
else
|
||||
pXSector = NULL;
|
||||
int hit = HitScan(actor, pSprite->z, dx, dy, 0, CLIPMASK1, 0);
|
||||
switch (hit)
|
||||
{
|
||||
|
@ -227,12 +204,6 @@ static void calebThinkChase(DBloodActor* actor)
|
|||
}
|
||||
}
|
||||
|
||||
XSECTOR* pXSector;
|
||||
int nXSector = sector[pSprite->sectnum].extra;
|
||||
if (nXSector > 0)
|
||||
pXSector = &xsector[nXSector];
|
||||
else
|
||||
pXSector = NULL;
|
||||
if (pXSector && pXSector->Underwater)
|
||||
aiNewState(actor, &tinycalebSwimGoto);
|
||||
else
|
||||
|
|
|
@ -85,12 +85,10 @@ static void gillThinkGoto(DBloodActor* actor)
|
|||
auto pSprite = &actor->s();
|
||||
assert(pSprite->type >= kDudeBase && pSprite->type < kDudeMax);
|
||||
DUDEINFO* pDudeInfo = getDudeInfo(pSprite->type);
|
||||
XSECTOR* pXSector;
|
||||
int nXSector = sector[pSprite->sectnum].extra;
|
||||
if (nXSector > 0)
|
||||
pXSector = &xsector[nXSector];
|
||||
else
|
||||
pXSector = NULL;
|
||||
|
||||
auto pSector = pSprite->sector();
|
||||
auto pXSector = pSector->hasX() ? &pSector->xs() : nullptr;
|
||||
|
||||
int dx = pXSprite->targetX - pSprite->x;
|
||||
int dy = pXSprite->targetY - pSprite->y;
|
||||
int nAngle = getangle(dx, dy);
|
||||
|
@ -108,15 +106,12 @@ static void gillThinkGoto(DBloodActor* actor)
|
|||
|
||||
static void gillThinkChase(DBloodActor* actor)
|
||||
{
|
||||
auto pSprite = &actor->s();
|
||||
auto const pSprite = &actor->s();
|
||||
auto pSector = pSprite->sector();
|
||||
auto pXSector = pSector->hasX() ? &pSector->xs() : nullptr;
|
||||
|
||||
if (actor->GetTarget() == nullptr)
|
||||
{
|
||||
XSECTOR* pXSector;
|
||||
int nXSector = sector[pSprite->sectnum].extra;
|
||||
if (nXSector > 0)
|
||||
pXSector = &xsector[nXSector];
|
||||
else
|
||||
pXSector = NULL;
|
||||
if (pXSector && pXSector->Underwater)
|
||||
aiNewState(actor, &gillBeastSwimSearch);
|
||||
else
|
||||
|
@ -133,12 +128,6 @@ static void gillThinkChase(DBloodActor* actor)
|
|||
aiChooseDirection(actor, getangle(dx, dy));
|
||||
if (pXTarget->health == 0)
|
||||
{
|
||||
XSECTOR* pXSector;
|
||||
int nXSector = sector[pSprite->sectnum].extra;
|
||||
if (nXSector > 0)
|
||||
pXSector = &xsector[nXSector];
|
||||
else
|
||||
pXSector = NULL;
|
||||
if (pXSector && pXSector->Underwater)
|
||||
aiNewState(actor, &gillBeastSwimSearch);
|
||||
else
|
||||
|
@ -147,12 +136,6 @@ static void gillThinkChase(DBloodActor* actor)
|
|||
}
|
||||
if (IsPlayerSprite(pTarget) && powerupCheck(&gPlayer[pTarget->type - kDudePlayer1], kPwUpShadowCloak) > 0)
|
||||
{
|
||||
XSECTOR* pXSector;
|
||||
int nXSector = sector[pSprite->sectnum].extra;
|
||||
if (nXSector > 0)
|
||||
pXSector = &xsector[nXSector];
|
||||
else
|
||||
pXSector = NULL;
|
||||
if (pXSector && pXSector->Underwater)
|
||||
aiNewState(actor, &gillBeastSwimSearch);
|
||||
else
|
||||
|
@ -172,12 +155,6 @@ static void gillThinkChase(DBloodActor* actor)
|
|||
actor->dudeSlope = nDist == 0 ? 0 : DivScale(pTarget->z - pSprite->z, nDist, 10);
|
||||
if (nDist < 921 && abs(nDeltaAngle) < 28)
|
||||
{
|
||||
XSECTOR* pXSector;
|
||||
int nXSector = sector[pSprite->sectnum].extra;
|
||||
if (nXSector > 0)
|
||||
pXSector = &xsector[nXSector];
|
||||
else
|
||||
pXSector = NULL;
|
||||
int hit = HitScan(actor, pSprite->z, dx, dy, 0, CLIPMASK1, 0);
|
||||
switch (hit)
|
||||
{
|
||||
|
@ -216,12 +193,6 @@ static void gillThinkChase(DBloodActor* actor)
|
|||
}
|
||||
}
|
||||
|
||||
XSECTOR* pXSector;
|
||||
int nXSector = sector[pSprite->sectnum].extra;
|
||||
if (nXSector > 0)
|
||||
pXSector = &xsector[nXSector];
|
||||
else
|
||||
pXSector = NULL;
|
||||
if (pXSector && pXSector->Underwater)
|
||||
aiNewState(actor, &gillBeastSwimGoto);
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue