- Blood: replaced the remaining spr.pos with int_pos()

This commit is contained in:
Christoph Oelckers 2022-01-30 18:09:26 +01:00
parent 4a3e9f6df1
commit 6fe27b4fe5
6 changed files with 98 additions and 98 deletions

View file

@ -106,8 +106,8 @@ void BlastSSeqCallback(int, DBloodActor* actor)
if (!actor->ValidateTarget(__FUNCTION__)) return;
auto target = actor->GetTarget();
int height = (actor->spr.yrepeat * getDudeInfo(actor->spr.type)->eyeHeight) << 2;
int x = actor->spr.pos.X;
int y = actor->spr.pos.Y;
int x = actor->int_pos().X;
int y = actor->int_pos().Y;
int z = height;
TARGETTRACK tt = { 0x10000, 0x10000, 0x100, 0x55, 0x1aaaaa };
Aim aim;
@ -120,9 +120,9 @@ void BlastSSeqCallback(int, DBloodActor* actor)
{
if (actor == actor2 || !(actor2->spr.flags & 8))
continue;
int x2 = actor2->spr.pos.X;
int y2 = actor2->spr.pos.Y;
int z2 = actor2->spr.pos.Z;
int x2 = actor2->int_pos().X;
int y2 = actor2->int_pos().Y;
int z2 = actor2->int_pos().Z;
int nDist = approxDist(x2 - x, y2 - y);
if (nDist == 0 || nDist > 0x2800)
continue;
@ -151,7 +151,7 @@ void BlastSSeqCallback(int, DBloodActor* actor)
int nDeltaAngle = ((nAngle - actor->spr.ang + 1024) & 2047) - 1024;
if (abs(nDeltaAngle) <= tt.at8)
{
int tz1 = actor2->spr.pos.Z - actor->spr.pos.Z;
int tz1 = actor2->int_pos().Z - actor->int_pos().Z;
if (cansee(x, y, z, actor->sector(), x2, y2, z2, actor2->sector()))
{
nClosest = nDist2;
@ -219,16 +219,16 @@ static void gargThinkTarget(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)
@ -263,8 +263,8 @@ static void gargThinkGoto(DBloodActor* actor)
return;
}
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);
@ -342,8 +342,8 @@ static void gargThinkChase(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)
{
@ -364,18 +364,18 @@ static void gargThinkChase(DBloodActor* actor)
int height2 = (pDudeInfo->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()))
{
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);
switch (actor->spr.type)
{
case kDudeGargoyleFlesh:
if (nDist < 0x1800 && nDist > 0xc00 && abs(nDeltaAngle) < 85)
{
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:
@ -400,7 +400,7 @@ static void gargThinkChase(DBloodActor* actor)
}
else if (nDist < 0x400 && abs(nDeltaAngle) < 85)
{
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:
@ -434,7 +434,7 @@ static void gargThinkChase(DBloodActor* actor)
case kDudeGargoyleStone:
if (nDist < 0x1800 && nDist > 0xc00 && abs(nDeltaAngle) < 85)
{
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:
@ -459,7 +459,7 @@ static void gargThinkChase(DBloodActor* actor)
}
else if (nDist < 0x400 && abs(nDeltaAngle) < 85)
{
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:
@ -532,8 +532,8 @@ static void gargMoveForward(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 <= 0x400)
return;
@ -567,8 +567,8 @@ static void gargMoveSlow(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 <= 0x400)
return;
@ -608,8 +608,8 @@ static void gargMoveSwoop(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 <= 0x400)
return;
@ -648,8 +648,8 @@ static void gargMoveFly(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 <= 0x400)
return;

View file

@ -92,8 +92,8 @@ void ghostBlastSeqCallback(int, DBloodActor* actor)
if (!actor->ValidateTarget(__FUNCTION__)) return;
auto target = actor->GetTarget();
int height = (actor->spr.yrepeat * getDudeInfo(actor->spr.type)->eyeHeight) << 2;
int x = actor->spr.pos.X;
int y = actor->spr.pos.Y;
int x = actor->int_pos().X;
int y = actor->int_pos().Y;
int z = height;
TARGETTRACK tt = { 0x10000, 0x10000, 0x100, 0x55, 0x1aaaaa };
Aim aim;
@ -106,9 +106,9 @@ void ghostBlastSeqCallback(int, DBloodActor* actor)
{
if (actor == actor2 || !(actor2->spr.flags & 8))
continue;
int x2 = actor2->spr.pos.X;
int y2 = actor2->spr.pos.Y;
int z2 = actor2->spr.pos.Z;
int x2 = actor2->int_pos().X;
int y2 = actor2->int_pos().Y;
int z2 = actor2->int_pos().Z;
int nDist = approxDist(x2 - x, y2 - y);
if (nDist == 0 || nDist > 0x2800)
continue;
@ -137,7 +137,7 @@ void ghostBlastSeqCallback(int, DBloodActor* actor)
int nDeltaAngle = ((nAngle - actor->spr.ang + 1024) & 2047) - 1024;
if (abs(nDeltaAngle) <= tt.at8)
{
int tz1 = actor2->spr.pos.Z - actor->spr.pos.Z;
int tz1 = actor2->int_pos().Z - actor->int_pos().Z;
if (cansee(x, y, z, actor->sector(), x2, y2, z2, actor2->sector()))
{
nClosest = nDist2;
@ -199,16 +199,16 @@ static void ghostThinkTarget(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)
@ -242,8 +242,8 @@ static void ghostThinkGoto(DBloodActor* actor)
return;
}
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);
@ -321,8 +321,8 @@ static void ghostThinkChase(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)
{
@ -343,16 +343,16 @@ static void ghostThinkChase(DBloodActor* actor)
int height2 = (pDudeInfo->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()))
{
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);
switch (actor->spr.type) {
case kDudePhantasm:
if (nDist < 0x2000 && nDist > 0x1000 && abs(nDeltaAngle) < 85) {
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:
@ -372,7 +372,7 @@ static void ghostThinkChase(DBloodActor* actor)
}
else if (nDist < 0x400 && abs(nDeltaAngle) < 85)
{
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:
@ -428,8 +428,8 @@ static void ghostMoveForward(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 <= 0x400)
return;
@ -463,8 +463,8 @@ static void ghostMoveSlow(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 <= 0x400)
return;
@ -501,8 +501,8 @@ static void ghostMoveSwoop(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 <= 0x400)
return;
@ -538,8 +538,8 @@ static void ghostMoveFly(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 <= 0x400)
return;

View file

@ -63,7 +63,7 @@ void GillBiteSeqCallback(int, DBloodActor* actor)
auto target = actor->GetTarget();
int dx = bcos(actor->spr.ang);
int dy = bsin(actor->spr.ang);
int dz = actor->spr.pos.Z - target->spr.pos.Z;
int dz = actor->int_pos().Z - target->int_pos().Z;
dx += Random3(2000);
dy += Random3(2000);
actFireVector(actor, 0, 0, dx, dy, dz, kVectorGillBite);
@ -85,8 +85,8 @@ static void gillThinkGoto(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);
@ -117,8 +117,8 @@ static void gillThinkChase(DBloodActor* actor)
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
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 (actor->xspr.health == 0)
{
@ -141,15 +141,15 @@ static void gillThinkChase(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 < 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:
@ -199,8 +199,8 @@ static void gillThinkSwimGoto(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);
@ -220,8 +220,8 @@ static void gillThinkSwimChase(DBloodActor* actor)
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
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 (actor->xspr.health == 0)
{
@ -237,10 +237,10 @@ static void gillThinkSwimChase(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)
{
@ -274,8 +274,8 @@ static void sub_6CB00(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;
@ -299,8 +299,8 @@ static void sub_6CD74(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;
@ -310,8 +310,8 @@ static void sub_6CD74(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)
@ -334,8 +334,8 @@ static void sub_6D03C(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;
@ -345,8 +345,8 @@ static void sub_6D03C(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)

View file

@ -66,8 +66,8 @@ static void handThinkGoto(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);
@ -88,8 +88,8 @@ static void handThinkChase(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)
{
@ -106,7 +106,7 @@ static void handThinkChase(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)
{

View file

@ -55,7 +55,7 @@ void houndBiteSeqCallback(int, DBloodActor* actor)
auto target = actor->GetTarget();
#ifdef NOONE_EXTENSIONS
if (target->IsPlayerActor() || gModernMap) // allow to hit non-player targets
actFireVector(actor, 0, 0, dx, dy, target->spr.pos.Z - actor->spr.pos.Z, kVectorHoundBite);
actFireVector(actor, 0, 0, dx, dy, target->int_pos().Z - actor->int_pos().Z, kVectorHoundBite);
#else
if (target->IsPlayerActor())
actFireVector(actor, 0, 0, dx, dy, target->spr.z - actor->spr.z, kVectorHoundBite);
@ -81,8 +81,8 @@ static void houndThinkGoto(DBloodActor* actor)
}
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);
@ -105,8 +105,8 @@ static void houndThinkChase(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)
{
@ -123,7 +123,7 @@ static void houndThinkChase(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)
{

View file

@ -50,8 +50,8 @@ static void innocThinkGoto(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);
@ -72,8 +72,8 @@ static void innocThinkChase(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)
{
@ -90,7 +90,7 @@ static void innocThinkChase(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)
{