From 6fe27b4fe56213f2ec4d4001d517587b296589d7 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 30 Jan 2022 18:09:26 +0100 Subject: [PATCH] - Blood: replaced the remaining spr.pos with int_pos() --- source/games/blood/src/aigarg.cpp | 60 ++++++++++++++--------------- source/games/blood/src/aighost.cpp | 56 +++++++++++++-------------- source/games/blood/src/aigilbst.cpp | 48 +++++++++++------------ source/games/blood/src/aihand.cpp | 10 ++--- source/games/blood/src/aihound.cpp | 12 +++--- source/games/blood/src/aiinnoc.cpp | 10 ++--- 6 files changed, 98 insertions(+), 98 deletions(-) diff --git a/source/games/blood/src/aigarg.cpp b/source/games/blood/src/aigarg.cpp index 42e7c2107..8d7199869 100644 --- a/source/games/blood/src/aigarg.cpp +++ b/source/games/blood/src/aigarg.cpp @@ -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; diff --git a/source/games/blood/src/aighost.cpp b/source/games/blood/src/aighost.cpp index d2a6ff80a..e1a5f7972 100644 --- a/source/games/blood/src/aighost.cpp +++ b/source/games/blood/src/aighost.cpp @@ -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; diff --git a/source/games/blood/src/aigilbst.cpp b/source/games/blood/src/aigilbst.cpp index e0afac7e8..18311cb9b 100644 --- a/source/games/blood/src/aigilbst.cpp +++ b/source/games/blood/src/aigilbst.cpp @@ -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) diff --git a/source/games/blood/src/aihand.cpp b/source/games/blood/src/aihand.cpp index 35a8913e8..5da4f996a 100644 --- a/source/games/blood/src/aihand.cpp +++ b/source/games/blood/src/aihand.cpp @@ -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) { diff --git a/source/games/blood/src/aihound.cpp b/source/games/blood/src/aihound.cpp index 96eb2ef29..75d073699 100644 --- a/source/games/blood/src/aihound.cpp +++ b/source/games/blood/src/aihound.cpp @@ -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) { diff --git a/source/games/blood/src/aiinnoc.cpp b/source/games/blood/src/aiinnoc.cpp index 6237f1816..e9d480f4a 100644 --- a/source/games/blood/src/aiinnoc.cpp +++ b/source/games/blood/src/aiinnoc.cpp @@ -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) {