mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-16 01:11:28 +00:00
- Blood: replaced the remaining spr.pos with int_pos()
This commit is contained in:
parent
2642018bac
commit
458fc219ed
4 changed files with 104 additions and 104 deletions
|
@ -131,9 +131,9 @@ bool CanMove(DBloodActor* actor, DBloodActor* target, int nAngle, int nRange)
|
|||
{
|
||||
int top, bottom;
|
||||
GetActorExtents(actor, &top, &bottom);
|
||||
int x = actor->spr.pos.X;
|
||||
int y = actor->spr.pos.Y;
|
||||
int z = actor->spr.pos.Z;
|
||||
int x = actor->int_pos().X;
|
||||
int y = actor->int_pos().Y;
|
||||
int z = actor->int_pos().Z;
|
||||
HitScan(actor, z, bcos(nAngle), bsin(nAngle), 0, CLIPMASK0, nRange);
|
||||
int nDist = approxDist(x - gHitInfo.hitpos.X, y - gHitInfo.hitpos.Y);
|
||||
if (nDist - (actor->spr.clipdist << 2) < nRange)
|
||||
|
@ -364,7 +364,7 @@ void aiActivateDude(DBloodActor* actor)
|
|||
assert(actor->spr.type >= kDudeBase && actor->spr.type < kDudeMax);
|
||||
if (!actor->xspr.state)
|
||||
{
|
||||
aiChooseDirection(actor, getangle(actor->xspr.TargetPos.X - actor->spr.pos.X, actor->xspr.TargetPos.Y - actor->spr.pos.Y));
|
||||
aiChooseDirection(actor, getangle(actor->xspr.TargetPos.X - actor->int_pos().X, actor->xspr.TargetPos.Y - actor->int_pos().Y));
|
||||
actor->xspr.state = 1;
|
||||
}
|
||||
switch (actor->spr.type)
|
||||
|
@ -934,9 +934,9 @@ void aiSetTarget(DBloodActor* actor, DBloodActor* target)
|
|||
{
|
||||
actor->SetTarget(target);
|
||||
DUDEINFO* pDudeInfo = getDudeInfo(target->spr.type);
|
||||
actor->xspr.TargetPos.X = target->spr.pos.X;
|
||||
actor->xspr.TargetPos.Y = target->spr.pos.Y;
|
||||
actor->xspr.TargetPos.Z = target->spr.pos.Z - ((pDudeInfo->eyeHeight * target->spr.yrepeat) << 2);
|
||||
actor->xspr.TargetPos.X = target->int_pos().X;
|
||||
actor->xspr.TargetPos.Y = target->int_pos().Y;
|
||||
actor->xspr.TargetPos.Z = target->int_pos().Z - ((pDudeInfo->eyeHeight * target->spr.yrepeat) << 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1508,16 +1508,16 @@ void aiThinkTarget(DBloodActor* actor)
|
|||
PLAYER* pPlayer = &gPlayer[p];
|
||||
if (actor->GetOwner() == pPlayer->actor || pPlayer->actor->xspr.health == 0 || powerupCheck(pPlayer, kPwUpShadowCloak) > 0)
|
||||
continue;
|
||||
int x = pPlayer->actor->spr.pos.X;
|
||||
int y = pPlayer->actor->spr.pos.Y;
|
||||
int z = pPlayer->actor->spr.pos.Z;
|
||||
int x = pPlayer->actor->int_pos().X;
|
||||
int y = pPlayer->actor->int_pos().Y;
|
||||
int z = pPlayer->actor->int_pos().Z;
|
||||
auto pSector = pPlayer->actor->sector();
|
||||
int dx = x - actor->spr.pos.X;
|
||||
int dy = y - actor->spr.pos.Y;
|
||||
int dx = x - actor->int_pos().X;
|
||||
int dy = y - actor->int_pos().Y;
|
||||
int nDist = approxDist(dx, dy);
|
||||
if (nDist > pDudeInfo->seeDist && nDist > pDudeInfo->hearDist)
|
||||
continue;
|
||||
if (!cansee(x, y, z, pSector, actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - ((pDudeInfo->eyeHeight * actor->spr.yrepeat) << 2), actor->sector()))
|
||||
if (!cansee(x, y, z, pSector, actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z - ((pDudeInfo->eyeHeight * actor->spr.yrepeat) << 2), actor->sector()))
|
||||
continue;
|
||||
|
||||
int nDeltaAngle = ((getangle(dx, dy) + 1024 - actor->spr.ang) & 2047) - 1024;
|
||||
|
@ -1554,16 +1554,16 @@ void aiLookForTarget(DBloodActor* actor)
|
|||
PLAYER* pPlayer = &gPlayer[p];
|
||||
if (actor->GetOwner() == pPlayer->actor || pPlayer->actor->xspr.health == 0 || powerupCheck(pPlayer, kPwUpShadowCloak) > 0)
|
||||
continue;
|
||||
int x = pPlayer->actor->spr.pos.X;
|
||||
int y = pPlayer->actor->spr.pos.Y;
|
||||
int z = pPlayer->actor->spr.pos.Z;
|
||||
int x = pPlayer->actor->int_pos().X;
|
||||
int y = pPlayer->actor->int_pos().Y;
|
||||
int z = pPlayer->actor->int_pos().Z;
|
||||
auto pSector = pPlayer->actor->sector();
|
||||
int dx = x - actor->spr.pos.X;
|
||||
int dy = y - actor->spr.pos.Y;
|
||||
int dx = x - actor->int_pos().X;
|
||||
int dy = y - actor->int_pos().Y;
|
||||
int nDist = approxDist(dx, dy);
|
||||
if (nDist > pDudeInfo->seeDist && nDist > pDudeInfo->hearDist)
|
||||
continue;
|
||||
if (!cansee(x, y, z, pSector, actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - ((pDudeInfo->eyeHeight * actor->spr.yrepeat) << 2), actor->sector()))
|
||||
if (!cansee(x, y, z, pSector, actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z - ((pDudeInfo->eyeHeight * actor->spr.yrepeat) << 2), actor->sector()))
|
||||
continue;
|
||||
int nDeltaAngle = ((getangle(dx, dy) + 1024 - actor->spr.ang) & 2047) - 1024;
|
||||
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
|
||||
|
@ -1582,13 +1582,13 @@ void aiLookForTarget(DBloodActor* actor)
|
|||
if (actor->xspr.state)
|
||||
{
|
||||
const bool newSectCheckMethod = !cl_bloodvanillaenemies && !VanillaMode(); // use new sector checking logic
|
||||
GetClosestSpriteSectors(actor->sector(), actor->spr.pos.X, actor->spr.pos.Y, 400, nullptr, newSectCheckMethod);
|
||||
GetClosestSpriteSectors(actor->sector(), actor->int_pos().X, actor->int_pos().Y, 400, nullptr, newSectCheckMethod);
|
||||
|
||||
BloodStatIterator it(kStatDude);
|
||||
while (DBloodActor* actor2 = it.Next())
|
||||
{
|
||||
int dx = actor2->spr.pos.X - actor->spr.pos.X;
|
||||
int dy = actor2->spr.pos.Y - actor->spr.pos.Y;
|
||||
int dx = actor2->int_pos().X - actor->int_pos().X;
|
||||
int dy = actor2->int_pos().Y - actor->int_pos().Y;
|
||||
int nDist = approxDist(dx, dy);
|
||||
if (actor2->spr.type == kDudeInnocent)
|
||||
{
|
||||
|
|
|
@ -98,16 +98,16 @@ static void batThinkTarget(DBloodActor* actor)
|
|||
PLAYER* pPlayer = &gPlayer[p];
|
||||
if (pPlayer->actor->xspr.health == 0 || powerupCheck(pPlayer, kPwUpShadowCloak) > 0)
|
||||
continue;
|
||||
int x = pPlayer->actor->spr.pos.X;
|
||||
int y = pPlayer->actor->spr.pos.Y;
|
||||
int z = pPlayer->actor->spr.pos.Z;
|
||||
int x = pPlayer->actor->int_pos().X;
|
||||
int y = pPlayer->actor->int_pos().Y;
|
||||
int z = pPlayer->actor->int_pos().Z;
|
||||
auto pSector = pPlayer->actor->sector();
|
||||
int dx = x - actor->spr.pos.X;
|
||||
int dy = y - actor->spr.pos.Y;
|
||||
int dx = x - actor->int_pos().X;
|
||||
int dy = y - actor->int_pos().Y;
|
||||
int nDist = approxDist(dx, dy);
|
||||
if (nDist > pDudeInfo->seeDist && nDist > pDudeInfo->hearDist)
|
||||
continue;
|
||||
if (!cansee(x, y, z, pSector, actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - ((pDudeInfo->eyeHeight * actor->spr.yrepeat) << 2), actor->sector()))
|
||||
if (!cansee(x, y, z, pSector, actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z - ((pDudeInfo->eyeHeight * actor->spr.yrepeat) << 2), actor->sector()))
|
||||
continue;
|
||||
int nDeltaAngle = ((getangle(dx, dy) + 1024 - actor->spr.ang) & 2047) - 1024;
|
||||
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
|
||||
|
@ -137,8 +137,8 @@ static void batThinkGoto(DBloodActor* actor)
|
|||
{
|
||||
assert(actor->spr.type >= kDudeBase && actor->spr.type < kDudeMax);
|
||||
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
|
||||
int dx = actor->xspr.TargetPos.X - actor->spr.pos.X;
|
||||
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
|
||||
int dx = actor->xspr.TargetPos.X - actor->int_pos().X;
|
||||
int dy = actor->xspr.TargetPos.Y - actor->int_pos().Y;
|
||||
int nAngle = getangle(dx, dy);
|
||||
int nDist = approxDist(dx, dy);
|
||||
aiChooseDirection(actor, nAngle);
|
||||
|
@ -158,8 +158,8 @@ static void batThinkPonder(DBloodActor* actor)
|
|||
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
|
||||
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
||||
auto pTarget = actor->GetTarget();
|
||||
int dx = pTarget->spr.pos.X - actor->spr.pos.X;
|
||||
int dy = pTarget->spr.pos.Y - actor->spr.pos.Y;
|
||||
int dx = pTarget->int_pos().X - actor->int_pos().X;
|
||||
int dy = pTarget->int_pos().Y - actor->int_pos().Y;
|
||||
aiChooseDirection(actor, getangle(dx, dy));
|
||||
if (pTarget->xspr.health == 0)
|
||||
{
|
||||
|
@ -174,7 +174,7 @@ static void batThinkPonder(DBloodActor* actor)
|
|||
int height2 = (getDudeInfo(pTarget->spr.type)->eyeHeight * pTarget->spr.yrepeat) << 2;
|
||||
int top, bottom;
|
||||
GetActorExtents(actor, &top, &bottom);
|
||||
if (cansee(pTarget->spr.pos.X, pTarget->spr.pos.Y, pTarget->spr.pos.Z, pTarget->sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - height, actor->sector()))
|
||||
if (cansee(pTarget->int_pos().X, pTarget->int_pos().Y, pTarget->int_pos().Z, pTarget->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z - height, actor->sector()))
|
||||
{
|
||||
aiSetTarget(actor, actor->GetTarget());
|
||||
if (height2 - height < 0x3000 && nDist < 0x1800 && nDist > 0xc00 && abs(nDeltaAngle) < 85)
|
||||
|
@ -259,8 +259,8 @@ static void batThinkChase(DBloodActor* actor)
|
|||
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
|
||||
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
||||
auto pTarget = actor->GetTarget();
|
||||
int dx = pTarget->spr.pos.X - actor->spr.pos.X;
|
||||
int dy = pTarget->spr.pos.Y - actor->spr.pos.Y;
|
||||
int dx = pTarget->int_pos().X - actor->int_pos().X;
|
||||
int dy = pTarget->int_pos().Y - actor->int_pos().Y;
|
||||
aiChooseDirection(actor, getangle(dx, dy));
|
||||
if (pTarget->xspr.health == 0)
|
||||
{
|
||||
|
@ -281,12 +281,12 @@ static void batThinkChase(DBloodActor* actor)
|
|||
int height2 = (pDudeInfo->eyeHeight * pTarget->spr.yrepeat) << 2;
|
||||
int top, bottom;
|
||||
GetActorExtents(actor, &top, &bottom);
|
||||
if (cansee(pTarget->spr.pos.X, pTarget->spr.pos.Y, pTarget->spr.pos.Z, pTarget->sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - height, actor->sector()))
|
||||
if (cansee(pTarget->int_pos().X, pTarget->int_pos().Y, pTarget->int_pos().Z, pTarget->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z - height, actor->sector()))
|
||||
{
|
||||
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
|
||||
{
|
||||
aiSetTarget(actor, actor->GetTarget());
|
||||
int floorZ = getflorzofslopeptr(actor->sector(), actor->spr.pos.X, actor->spr.pos.Y);
|
||||
int floorZ = getflorzofslopeptr(actor->sector(), actor->int_pos().X, actor->int_pos().Y);
|
||||
if (height2 - height < 0x2000 && nDist < 0x200 && abs(nDeltaAngle) < 85)
|
||||
aiNewState(actor, &batBite);
|
||||
else if ((height2 - height > 0x5000 || floorZ - bottom > 0x5000) && nDist < 0x1400 && nDist > 0x800 && abs(nDeltaAngle) < 85)
|
||||
|
@ -319,8 +319,8 @@ static void batMoveForward(DBloodActor* actor)
|
|||
return;
|
||||
if (actor->GetTarget() == nullptr)
|
||||
actor->spr.ang = (actor->spr.ang + 256) & 2047;
|
||||
int dx = actor->xspr.TargetPos.X - actor->spr.pos.X;
|
||||
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
|
||||
int dx = actor->xspr.TargetPos.X - actor->int_pos().X;
|
||||
int dy = actor->xspr.TargetPos.Y - actor->int_pos().Y;
|
||||
int nDist = approxDist(dx, dy);
|
||||
if ((unsigned int)Random(64) < 32 && nDist <= 0x200)
|
||||
return;
|
||||
|
@ -351,8 +351,8 @@ static void batMoveSwoop(DBloodActor* actor)
|
|||
actor->xspr.goalAng = (actor->spr.ang + 512) & 2047;
|
||||
return;
|
||||
}
|
||||
int dx = actor->xspr.TargetPos.X - actor->spr.pos.X;
|
||||
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
|
||||
int dx = actor->xspr.TargetPos.X - actor->int_pos().X;
|
||||
int dy = actor->xspr.TargetPos.Y - actor->int_pos().Y;
|
||||
int nDist = approxDist(dx, dy);
|
||||
if (Chance(0x600) && nDist <= 0x200)
|
||||
return;
|
||||
|
@ -381,8 +381,8 @@ static void batMoveFly(DBloodActor* actor)
|
|||
actor->spr.ang = (actor->spr.ang + 512) & 2047;
|
||||
return;
|
||||
}
|
||||
int dx = actor->xspr.TargetPos.X - actor->spr.pos.X;
|
||||
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
|
||||
int dx = actor->xspr.TargetPos.X - actor->int_pos().X;
|
||||
int dy = actor->xspr.TargetPos.Y - actor->int_pos().Y;
|
||||
int nDist = approxDist(dx, dy);
|
||||
if (Chance(0x4000) && nDist <= 0x200)
|
||||
return;
|
||||
|
@ -400,9 +400,9 @@ static void batMoveFly(DBloodActor* actor)
|
|||
|
||||
void batMoveToCeil(DBloodActor* actor)
|
||||
{
|
||||
int x = actor->spr.pos.X;
|
||||
int y = actor->spr.pos.Y;
|
||||
int z = actor->spr.pos.Z;
|
||||
int x = actor->int_pos().X;
|
||||
int y = actor->int_pos().Y;
|
||||
int z = actor->int_pos().Z;
|
||||
if (z - actor->xspr.TargetPos.Z < 0x1000)
|
||||
{
|
||||
DUDEEXTRA_STATS* pDudeExtraE = &actor->dudeExtra.stats;
|
||||
|
|
|
@ -69,7 +69,7 @@ void SlashSeqCallback(int, DBloodActor* actor)
|
|||
int dx = bcos(actor->spr.ang);
|
||||
int dy = bsin(actor->spr.ang);
|
||||
// Correct ?
|
||||
int dz = actor->spr.pos.Z - target->spr.pos.Z;
|
||||
int dz = actor->int_pos().Z - target->int_pos().Z;
|
||||
dx += Random3(4000 - 700 * gGameOptions.nDifficulty);
|
||||
dy += Random3(4000 - 700 * gGameOptions.nDifficulty);
|
||||
actFireVector(actor, 0, 0, dx, dy, dz, kVectorGargSlash);
|
||||
|
@ -82,16 +82,16 @@ void StompSeqCallback(int, DBloodActor* actor)
|
|||
{
|
||||
int angx = bcos(actor->spr.ang);
|
||||
int angy = bsin(actor->spr.ang);
|
||||
int x = actor->spr.pos.X;
|
||||
int y = actor->spr.pos.Y;
|
||||
int z = actor->spr.pos.Z;
|
||||
int x = actor->int_pos().X;
|
||||
int y = actor->int_pos().Y;
|
||||
int z = actor->int_pos().Z;
|
||||
int vc = 400;
|
||||
auto pSector = actor->sector();
|
||||
int v1c = 5 + 2 * gGameOptions.nDifficulty;
|
||||
int v10 = 25 + 30 * gGameOptions.nDifficulty;
|
||||
const bool newSectCheckMethod = !cl_bloodvanillaenemies && !VanillaMode(); // use new sector checking logic
|
||||
auto sectorMap = GetClosestSpriteSectors(pSector, x, y, vc, nullptr, newSectCheckMethod);
|
||||
int hit = HitScan(actor, actor->spr.pos.Z, angx, angy, 0, CLIPMASK1, 0);
|
||||
int hit = HitScan(actor, actor->int_pos().Z, angx, angy, 0, CLIPMASK1, 0);
|
||||
DBloodActor* actorh = nullptr;
|
||||
actHitcodeToData(hit, &gHitInfo, &actorh);
|
||||
|
||||
|
@ -113,8 +113,8 @@ void StompSeqCallback(int, DBloodActor* actor)
|
|||
GetActorExtents(actor, &top, &bottom);
|
||||
if (abs(bottom - pSector->floorz) == 0)
|
||||
{
|
||||
int dx = abs(actor->spr.pos.X - actor2->spr.pos.X);
|
||||
int dy = abs(actor->spr.pos.Y - actor2->spr.pos.Y);
|
||||
int dx = abs(actor->int_pos().X - actor2->int_pos().X);
|
||||
int dy = abs(actor->int_pos().Y - actor2->int_pos().Y);
|
||||
int nDist2 = ksqrt(dx * dx + dy * dy);
|
||||
if (nDist2 <= vc)
|
||||
{
|
||||
|
@ -141,8 +141,8 @@ void StompSeqCallback(int, DBloodActor* actor)
|
|||
{
|
||||
if (actor2->xspr.locked)
|
||||
continue;
|
||||
int dx = abs(actor->spr.pos.X - actor2->spr.pos.X);
|
||||
int dy = abs(actor->spr.pos.Y - actor2->spr.pos.Y);
|
||||
int dx = abs(actor->int_pos().X - actor2->int_pos().X);
|
||||
int dy = abs(actor->int_pos().Y - actor2->int_pos().Y);
|
||||
int nDist2 = ksqrt(dx * dx + dy * dy);
|
||||
if (nDist2 <= vc)
|
||||
{
|
||||
|
@ -179,8 +179,8 @@ static void beastThinkGoto(DBloodActor* actor)
|
|||
auto pSector = actor->sector();
|
||||
auto pXSector = pSector->hasX() ? &pSector->xs() : nullptr;
|
||||
|
||||
int dx = actor->xspr.TargetPos.X - actor->spr.pos.X;
|
||||
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
|
||||
int dx = actor->xspr.TargetPos.X - actor->int_pos().X;
|
||||
int dy = actor->xspr.TargetPos.Y - actor->int_pos().Y;
|
||||
int nAngle = getangle(dx, dy);
|
||||
int nDist = approxDist(dx, dy);
|
||||
aiChooseDirection(actor, nAngle);
|
||||
|
@ -212,8 +212,8 @@ static void beastThinkChase(DBloodActor* actor)
|
|||
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
||||
auto target = actor->GetTarget();
|
||||
|
||||
int dx = target->spr.pos.X - actor->spr.pos.X;
|
||||
int dy = target->spr.pos.Y - actor->spr.pos.Y;
|
||||
int dx = target->int_pos().X - actor->int_pos().X;
|
||||
int dy = target->int_pos().Y - actor->int_pos().Y;
|
||||
aiChooseDirection(actor, getangle(dx, dy));
|
||||
|
||||
auto pSector = actor->sector();
|
||||
|
@ -240,16 +240,16 @@ static void beastThinkChase(DBloodActor* actor)
|
|||
{
|
||||
int nDeltaAngle = ((getangle(dx, dy) + 1024 - actor->spr.ang) & 2047) - 1024;
|
||||
int height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) << 2;
|
||||
if (cansee(target->spr.pos.X, target->spr.pos.Y, target->spr.pos.Z, target->sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - height, actor->sector()))
|
||||
if (cansee(target->int_pos().X, target->int_pos().Y, target->int_pos().Z, target->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z - height, actor->sector()))
|
||||
{
|
||||
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
|
||||
{
|
||||
aiSetTarget(actor, actor->GetTarget());
|
||||
actor->dudeSlope = nDist == 0 ? 0 : DivScale(target->spr.pos.Z - actor->spr.pos.Z, nDist, 10);
|
||||
actor->dudeSlope = nDist == 0 ? 0 : DivScale(target->int_pos().Z - actor->int_pos().Z, nDist, 10);
|
||||
if (nDist < 0x1400 && nDist > 0xa00 && abs(nDeltaAngle) < 85 && (target->spr.flags & 2)
|
||||
&& target->IsPlayerActor() && Chance(0x8000))
|
||||
{
|
||||
int hit = HitScan(actor, actor->spr.pos.Z, dx, dy, 0, CLIPMASK1, 0);
|
||||
int hit = HitScan(actor, actor->int_pos().Z, dx, dy, 0, CLIPMASK1, 0);
|
||||
if (target->xspr.health > (unsigned)gPlayerTemplate[0].startHealth / 2)
|
||||
{
|
||||
switch (hit)
|
||||
|
@ -281,7 +281,7 @@ static void beastThinkChase(DBloodActor* actor)
|
|||
}
|
||||
if (nDist < 921 && abs(nDeltaAngle) < 28)
|
||||
{
|
||||
int hit = HitScan(actor, actor->spr.pos.Z, dx, dy, 0, CLIPMASK1, 0);
|
||||
int hit = HitScan(actor, actor->int_pos().Z, dx, dy, 0, CLIPMASK1, 0);
|
||||
switch (hit)
|
||||
{
|
||||
case -1:
|
||||
|
@ -330,8 +330,8 @@ static void beastThinkSwimGoto(DBloodActor* actor)
|
|||
{
|
||||
assert(actor->spr.type >= kDudeBase && actor->spr.type < kDudeMax);
|
||||
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
|
||||
int dx = actor->xspr.TargetPos.X - actor->spr.pos.X;
|
||||
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
|
||||
int dx = actor->xspr.TargetPos.X - actor->int_pos().X;
|
||||
int dy = actor->xspr.TargetPos.Y - actor->int_pos().Y;
|
||||
int nAngle = getangle(dx, dy);
|
||||
int nDist = approxDist(dx, dy);
|
||||
aiChooseDirection(actor, nAngle);
|
||||
|
@ -352,8 +352,8 @@ static void beastThinkSwimChase(DBloodActor* actor)
|
|||
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
||||
auto target = actor->GetTarget();
|
||||
|
||||
int dx = target->spr.pos.X - actor->spr.pos.X;
|
||||
int dy = target->spr.pos.Y - actor->spr.pos.Y;
|
||||
int dx = target->int_pos().X - actor->int_pos().X;
|
||||
int dy = target->int_pos().Y - actor->int_pos().Y;
|
||||
aiChooseDirection(actor, getangle(dx, dy));
|
||||
if (target->xspr.health == 0)
|
||||
{
|
||||
|
@ -369,10 +369,10 @@ static void beastThinkSwimChase(DBloodActor* actor)
|
|||
if (nDist <= pDudeInfo->seeDist)
|
||||
{
|
||||
int nDeltaAngle = ((getangle(dx, dy) + 1024 - actor->spr.ang) & 2047) - 1024;
|
||||
int height = pDudeInfo->eyeHeight + actor->spr.pos.Z;
|
||||
int height = pDudeInfo->eyeHeight + actor->int_pos().Z;
|
||||
int top, bottom;
|
||||
GetActorExtents(actor, &top, &bottom);
|
||||
if (cansee(target->spr.pos.X, target->spr.pos.Y, target->spr.pos.Z, target->sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - height, actor->sector()))
|
||||
if (cansee(target->int_pos().X, target->int_pos().Y, target->int_pos().Z, target->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z - height, actor->sector()))
|
||||
{
|
||||
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
|
||||
{
|
||||
|
@ -403,8 +403,8 @@ static void beastMoveForward(DBloodActor* actor)
|
|||
actor->spr.ang = (actor->spr.ang + ClipRange(nAng, -nTurnRange, nTurnRange)) & 2047;
|
||||
if (abs(nAng) > 341)
|
||||
return;
|
||||
int dx = actor->xspr.TargetPos.X - actor->spr.pos.X;
|
||||
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
|
||||
int dx = actor->xspr.TargetPos.X - actor->int_pos().X;
|
||||
int dy = actor->xspr.TargetPos.Y - actor->int_pos().Y;
|
||||
int nDist = approxDist(dx, dy);
|
||||
if (nDist <= 0x400 && Random(64) < 32)
|
||||
return;
|
||||
|
@ -424,8 +424,8 @@ static void sub_628A0(DBloodActor* actor)
|
|||
return;
|
||||
if (actor->GetTarget() == nullptr)
|
||||
actor->spr.ang = (actor->spr.ang + 256) & 2047;
|
||||
int dx = actor->xspr.TargetPos.X - actor->spr.pos.X;
|
||||
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
|
||||
int dx = actor->xspr.TargetPos.X - actor->int_pos().X;
|
||||
int dy = actor->xspr.TargetPos.Y - actor->int_pos().Y;
|
||||
int nDist = approxDist(dx, dy);
|
||||
if (Random(64) < 32 && nDist <= 0x400)
|
||||
return;
|
||||
|
@ -449,8 +449,8 @@ static void sub_62AE0(DBloodActor* actor)
|
|||
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
|
||||
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
||||
auto target = actor->GetTarget();
|
||||
int z = actor->spr.pos.Z + getDudeInfo(actor->spr.type)->eyeHeight;
|
||||
int z2 = target->spr.pos.Z + getDudeInfo(target->spr.type)->eyeHeight;
|
||||
int z = actor->int_pos().Z + getDudeInfo(actor->spr.type)->eyeHeight;
|
||||
int z2 = target->int_pos().Z + getDudeInfo(target->spr.type)->eyeHeight;
|
||||
int nAng = ((actor->xspr.goalAng + 1024 - actor->spr.ang) & 2047) - 1024;
|
||||
int nTurnRange = (pDudeInfo->angSpeed << 2) >> 4;
|
||||
actor->spr.ang = (actor->spr.ang + ClipRange(nAng, -nTurnRange, nTurnRange)) & 2047;
|
||||
|
@ -460,8 +460,8 @@ static void sub_62AE0(DBloodActor* actor)
|
|||
actor->xspr.goalAng = (actor->spr.ang + 512) & 2047;
|
||||
return;
|
||||
}
|
||||
int dx = actor->xspr.TargetPos.X - actor->spr.pos.X;
|
||||
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
|
||||
int dx = actor->xspr.TargetPos.X - actor->int_pos().X;
|
||||
int dy = actor->xspr.TargetPos.Y - actor->int_pos().Y;
|
||||
int dz = z2 - z;
|
||||
int nDist = approxDist(dx, dy);
|
||||
if (Chance(0x600) && nDist <= 0x400)
|
||||
|
@ -484,8 +484,8 @@ static void sub_62D7C(DBloodActor* actor)
|
|||
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
|
||||
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
||||
auto target = actor->GetTarget();
|
||||
int z = actor->spr.pos.Z + getDudeInfo(actor->spr.type)->eyeHeight;
|
||||
int z2 = target->spr.pos.Z + getDudeInfo(target->spr.type)->eyeHeight;
|
||||
int z = actor->int_pos().Z + getDudeInfo(actor->spr.type)->eyeHeight;
|
||||
int z2 = target->int_pos().Z + getDudeInfo(target->spr.type)->eyeHeight;
|
||||
int nAng = ((actor->xspr.goalAng + 1024 - actor->spr.ang) & 2047) - 1024;
|
||||
int nTurnRange = (pDudeInfo->angSpeed << 2) >> 4;
|
||||
actor->spr.ang = (actor->spr.ang + ClipRange(nAng, -nTurnRange, nTurnRange)) & 2047;
|
||||
|
@ -495,8 +495,8 @@ static void sub_62D7C(DBloodActor* actor)
|
|||
actor->spr.ang = (actor->spr.ang + 512) & 2047;
|
||||
return;
|
||||
}
|
||||
int dx = actor->xspr.TargetPos.X - actor->spr.pos.X;
|
||||
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
|
||||
int dx = actor->xspr.TargetPos.X - actor->int_pos().X;
|
||||
int dy = actor->xspr.TargetPos.Y - actor->int_pos().Y;
|
||||
int dz = (z2 - z) << 3;
|
||||
int nDist = approxDist(dx, dy);
|
||||
if (Chance(0x4000) && nDist <= 0x400)
|
||||
|
|
|
@ -110,16 +110,16 @@ static void eelThinkTarget(DBloodActor* actor)
|
|||
PLAYER* pPlayer = &gPlayer[p];
|
||||
if (pPlayer->actor->xspr.health == 0 || powerupCheck(pPlayer, kPwUpShadowCloak) > 0)
|
||||
continue;
|
||||
int x = pPlayer->actor->spr.pos.X;
|
||||
int y = pPlayer->actor->spr.pos.Y;
|
||||
int z = pPlayer->actor->spr.pos.Z;
|
||||
int x = pPlayer->actor->int_pos().X;
|
||||
int y = pPlayer->actor->int_pos().Y;
|
||||
int z = pPlayer->actor->int_pos().Z;
|
||||
auto pSector = pPlayer->actor->sector();
|
||||
int dx = x - actor->spr.pos.X;
|
||||
int dy = y - actor->spr.pos.Y;
|
||||
int dx = x - actor->int_pos().X;
|
||||
int dy = y - actor->int_pos().Y;
|
||||
int nDist = approxDist(dx, dy);
|
||||
if (nDist > pDudeInfo->seeDist && nDist > pDudeInfo->hearDist)
|
||||
continue;
|
||||
if (!cansee(x, y, z, pSector, actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - ((pDudeInfo->eyeHeight * actor->spr.yrepeat) << 2), actor->sector()))
|
||||
if (!cansee(x, y, z, pSector, actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z - ((pDudeInfo->eyeHeight * actor->spr.yrepeat) << 2), actor->sector()))
|
||||
continue;
|
||||
int nDeltaAngle = ((getangle(dx, dy) + 1024 - actor->spr.ang) & 2047) - 1024;
|
||||
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
|
||||
|
@ -151,8 +151,8 @@ static void eelThinkGoto(DBloodActor* actor)
|
|||
{
|
||||
assert(actor->spr.type >= kDudeBase && actor->spr.type < kDudeMax);
|
||||
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
|
||||
int dx = actor->xspr.TargetPos.X - actor->spr.pos.X;
|
||||
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
|
||||
int dx = actor->xspr.TargetPos.X - actor->int_pos().X;
|
||||
int dy = actor->xspr.TargetPos.Y - actor->int_pos().Y;
|
||||
int nAngle = getangle(dx, dy);
|
||||
int nDist = approxDist(dx, dy);
|
||||
aiChooseDirection(actor, nAngle);
|
||||
|
@ -172,8 +172,8 @@ static void eelThinkPonder(DBloodActor* actor)
|
|||
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
|
||||
auto target = actor->GetTarget();
|
||||
|
||||
int dx = target->spr.pos.X - actor->spr.pos.X;
|
||||
int dy = target->spr.pos.Y - actor->spr.pos.Y;
|
||||
int dx = target->int_pos().X - actor->int_pos().X;
|
||||
int dy = target->int_pos().Y - actor->int_pos().Y;
|
||||
aiChooseDirection(actor, getangle(dx, dy));
|
||||
if (target->xspr.health == 0)
|
||||
{
|
||||
|
@ -188,7 +188,7 @@ static void eelThinkPonder(DBloodActor* actor)
|
|||
int height2 = (getDudeInfo(target->spr.type)->eyeHeight * target->spr.yrepeat) << 2;
|
||||
int top, bottom;
|
||||
GetActorExtents(actor, &top, &bottom);
|
||||
if (cansee(target->spr.pos.X, target->spr.pos.Y, target->spr.pos.Z, target->sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - height, actor->sector()))
|
||||
if (cansee(target->int_pos().X, target->int_pos().Y, target->int_pos().Z, target->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z - height, actor->sector()))
|
||||
{
|
||||
aiSetTarget(actor, actor->GetTarget());
|
||||
if (height2 - height < -0x2000 && nDist < 0x1800 && nDist > 0xc00 && abs(nDeltaAngle) < 85)
|
||||
|
@ -273,8 +273,8 @@ static void eelThinkChase(DBloodActor* actor)
|
|||
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
|
||||
auto target = actor->GetTarget();
|
||||
|
||||
int dx = target->spr.pos.X - actor->spr.pos.X;
|
||||
int dy = target->spr.pos.Y - actor->spr.pos.Y;
|
||||
int dx = target->int_pos().X - actor->int_pos().X;
|
||||
int dy = target->int_pos().Y - actor->int_pos().Y;
|
||||
aiChooseDirection(actor, getangle(dx, dy));
|
||||
if (target->xspr.health == 0)
|
||||
{
|
||||
|
@ -295,7 +295,7 @@ static void eelThinkChase(DBloodActor* actor)
|
|||
GetActorExtents(actor, &top, &bottom);
|
||||
int top2, bottom2;
|
||||
GetActorExtents(target, &top2, &bottom2);
|
||||
if (cansee(target->spr.pos.X, target->spr.pos.Y, target->spr.pos.Z, target->sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z - height, actor->sector()))
|
||||
if (cansee(target->int_pos().X, target->int_pos().Y, target->int_pos().Z, target->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z - height, actor->sector()))
|
||||
{
|
||||
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
|
||||
{
|
||||
|
@ -329,8 +329,8 @@ static void eelMoveForward(DBloodActor* actor)
|
|||
return;
|
||||
if (actor->GetTarget() == nullptr)
|
||||
actor->spr.ang = (actor->spr.ang + 256) & 2047;
|
||||
int dx = actor->xspr.TargetPos.X - actor->spr.pos.X;
|
||||
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
|
||||
int dx = actor->xspr.TargetPos.X - actor->int_pos().X;
|
||||
int dy = actor->xspr.TargetPos.Y - actor->int_pos().Y;
|
||||
int nDist = approxDist(dx, dy);
|
||||
if (nDist <= 0x399)
|
||||
return;
|
||||
|
@ -358,8 +358,8 @@ static void eelMoveSwoop(DBloodActor* actor)
|
|||
int nAccel = (pDudeInfo->frontSpeed - (((4 - gGameOptions.nDifficulty) << 26) / 120) / 120) << 2;
|
||||
if (abs(nAng) > 341)
|
||||
return;
|
||||
int dx = actor->xspr.TargetPos.X - actor->spr.pos.X;
|
||||
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
|
||||
int dx = actor->xspr.TargetPos.X - actor->int_pos().X;
|
||||
int dy = actor->xspr.TargetPos.Y - actor->int_pos().Y;
|
||||
int nDist = approxDist(dx, dy);
|
||||
if (Chance(0x8000) && nDist <= 0x399)
|
||||
return;
|
||||
|
@ -385,8 +385,8 @@ static void eelMoveAscend(DBloodActor* actor)
|
|||
int nAccel = (pDudeInfo->frontSpeed - (((4 - gGameOptions.nDifficulty) << 26) / 120) / 120) << 2;
|
||||
if (abs(nAng) > 341)
|
||||
return;
|
||||
int dx = actor->xspr.TargetPos.X - actor->spr.pos.X;
|
||||
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
|
||||
int dx = actor->xspr.TargetPos.X - actor->int_pos().X;
|
||||
int dy = actor->xspr.TargetPos.Y - actor->int_pos().Y;
|
||||
int nDist = approxDist(dx, dy);
|
||||
if (Chance(0x4000) && nDist <= 0x399)
|
||||
return;
|
||||
|
@ -404,9 +404,9 @@ static void eelMoveAscend(DBloodActor* actor)
|
|||
|
||||
void eelMoveToCeil(DBloodActor* actor)
|
||||
{
|
||||
int x = actor->spr.pos.X;
|
||||
int y = actor->spr.pos.Y;
|
||||
int z = actor->spr.pos.Z;
|
||||
int x = actor->int_pos().X;
|
||||
int y = actor->int_pos().Y;
|
||||
int z = actor->int_pos().Z;
|
||||
if (z - actor->xspr.TargetPos.Z < 0x1000)
|
||||
{
|
||||
DUDEEXTRA_STATS* pDudeExtraE = &actor->dudeExtra.stats;
|
||||
|
|
Loading…
Reference in a new issue