- Blood: Replace XSPRITE targety with TargetPos.Y calls.

This commit is contained in:
Mitchell Richters 2021-12-30 21:23:31 +11:00
parent 1d29716e6b
commit 431749cf6e
25 changed files with 64 additions and 65 deletions

View file

@ -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.targetY - actor->spr.pos.Y));
aiChooseDirection(actor, getangle(actor->xspr.TargetPos.X - actor->spr.pos.X, actor->xspr.TargetPos.Y - actor->spr.pos.Y));
actor->xspr.state = 1;
}
switch (actor->spr.type)
@ -917,7 +917,7 @@ void aiSetTarget(DBloodActor* actor, int x, int y, int z)
{
actor->SetTarget(nullptr);
actor->xspr.TargetPos.X = x;
actor->xspr.targetY = y;
actor->xspr.TargetPos.Y = y;
actor->xspr.targetZ = z;
}
@ -935,7 +935,7 @@ 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.targetY = target->spr.pos.Y;
actor->xspr.TargetPos.Y = target->spr.pos.Y;
actor->xspr.targetZ = target->spr.pos.Z - ((pDudeInfo->eyeHeight * target->spr.yrepeat) << 2);
}
}
@ -1707,7 +1707,7 @@ void aiInitSprite(DBloodActor* actor)
stateTimer = actor->xspr.stateTimer;
pTargetMarker = actor->GetTarget();
targetX = actor->xspr.TargetPos.X;
targetY = actor->xspr.targetY;
targetY = actor->xspr.TargetPos.Y;
targetZ = actor->xspr.targetZ;
}
}
@ -1927,7 +1927,7 @@ void aiInitSprite(DBloodActor* actor)
{
actor->SetTarget(pTargetMarker);
actor->xspr.TargetPos.X = targetX;
actor->xspr.targetY = targetY;
actor->xspr.TargetPos.Y = targetY;
actor->xspr.targetZ = targetZ;
}

View file

@ -138,7 +138,7 @@ 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.targetY - actor->spr.pos.Y;
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int nAngle = getangle(dx, dy);
int nDist = approxDist(dx, dy);
aiChooseDirection(actor, nAngle);
@ -320,7 +320,7 @@ static void batMoveForward(DBloodActor* actor)
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.targetY - actor->spr.pos.Y;
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int nDist = approxDist(dx, dy);
if ((unsigned int)Random(64) < 32 && nDist <= 0x200)
return;
@ -352,7 +352,7 @@ static void batMoveSwoop(DBloodActor* actor)
return;
}
int dx = actor->xspr.TargetPos.X - actor->spr.pos.X;
int dy = actor->xspr.targetY - actor->spr.pos.Y;
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int nDist = approxDist(dx, dy);
if (Chance(0x600) && nDist <= 0x200)
return;
@ -382,7 +382,7 @@ static void batMoveFly(DBloodActor* actor)
return;
}
int dx = actor->xspr.TargetPos.X - actor->spr.pos.X;
int dy = actor->xspr.targetY - actor->spr.pos.Y;
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int nDist = approxDist(dx, dy);
if (Chance(0x4000) && nDist <= 0x200)
return;

View file

@ -180,7 +180,7 @@ static void beastThinkGoto(DBloodActor* actor)
auto pXSector = pSector->hasX() ? &pSector->xs() : nullptr;
int dx = actor->xspr.TargetPos.X - actor->spr.pos.X;
int dy = actor->xspr.targetY - actor->spr.pos.Y;
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int nAngle = getangle(dx, dy);
int nDist = approxDist(dx, dy);
aiChooseDirection(actor, nAngle);
@ -331,7 +331,7 @@ 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.targetY - actor->spr.pos.Y;
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int nAngle = getangle(dx, dy);
int nDist = approxDist(dx, dy);
aiChooseDirection(actor, nAngle);
@ -404,7 +404,7 @@ static void beastMoveForward(DBloodActor* actor)
if (abs(nAng) > 341)
return;
int dx = actor->xspr.TargetPos.X - actor->spr.pos.X;
int dy = actor->xspr.targetY - actor->spr.pos.Y;
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int nDist = approxDist(dx, dy);
if (nDist <= 0x400 && Random(64) < 32)
return;
@ -425,7 +425,7 @@ static void sub_628A0(DBloodActor* actor)
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.targetY - actor->spr.pos.Y;
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int nDist = approxDist(dx, dy);
if (Random(64) < 32 && nDist <= 0x400)
return;
@ -461,7 +461,7 @@ static void sub_62AE0(DBloodActor* actor)
return;
}
int dx = actor->xspr.TargetPos.X - actor->spr.pos.X;
int dy = actor->xspr.targetY - actor->spr.pos.Y;
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int dz = z2 - z;
int nDist = approxDist(dx, dy);
if (Chance(0x600) && nDist <= 0x400)
@ -496,7 +496,7 @@ static void sub_62D7C(DBloodActor* actor)
return;
}
int dx = actor->xspr.TargetPos.X - actor->spr.pos.X;
int dy = actor->xspr.targetY - actor->spr.pos.Y;
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int dz = (z2 - z) << 3;
int nDist = approxDist(dx, dy);
if (Chance(0x4000) && nDist <= 0x400)

View file

@ -152,7 +152,7 @@ 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.targetY - actor->spr.pos.Y;
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int nAngle = getangle(dx, dy);
int nDist = approxDist(dx, dy);
aiChooseDirection(actor, nAngle);
@ -330,7 +330,7 @@ static void eelMoveForward(DBloodActor* actor)
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.targetY - actor->spr.pos.Y;
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int nDist = approxDist(dx, dy);
if (nDist <= 0x399)
return;
@ -359,7 +359,7 @@ static void eelMoveSwoop(DBloodActor* actor)
if (abs(nAng) > 341)
return;
int dx = actor->xspr.TargetPos.X - actor->spr.pos.X;
int dy = actor->xspr.targetY - actor->spr.pos.Y;
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int nDist = approxDist(dx, dy);
if (Chance(0x8000) && nDist <= 0x399)
return;
@ -386,7 +386,7 @@ static void eelMoveAscend(DBloodActor* actor)
if (abs(nAng) > 341)
return;
int dx = actor->xspr.TargetPos.X - actor->spr.pos.X;
int dy = actor->xspr.targetY - actor->spr.pos.Y;
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int nDist = approxDist(dx, dy);
if (Chance(0x4000) && nDist <= 0x399)
return;

View file

@ -85,7 +85,7 @@ static void burnThinkGoto(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.targetY - actor->spr.pos.Y;
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int nAngle = getangle(dx, dy);
int nDist = approxDist(dx, dy);
aiChooseDirection(actor, nAngle);

View file

@ -95,7 +95,7 @@ static void calebThinkGoto(DBloodActor* actor)
auto pXSector = pSector->hasX() ? &pSector->xs() : nullptr;
int dx = actor->xspr.TargetPos.X - actor->spr.pos.X;
int dy = actor->xspr.targetY - actor->spr.pos.Y;
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int nAngle = getangle(dx, dy);
int nDist = approxDist(dx, dy);
aiChooseDirection(actor, nAngle);
@ -213,7 +213,7 @@ static void calebThinkSwimGoto(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.targetY - actor->spr.pos.Y;
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int nAngle = getangle(dx, dy);
int nDist = approxDist(dx, dy);
aiChooseDirection(actor, nAngle);
@ -283,7 +283,7 @@ static void sub_65D04(DBloodActor* actor)
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.targetY - actor->spr.pos.Y;
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int nDist = approxDist(dx, dy);
if (Random(64) < 32 && nDist <= 0x400)
return;
@ -320,7 +320,7 @@ static void sub_65F44(DBloodActor* actor)
return;
}
int dx = actor->xspr.TargetPos.X - actor->spr.pos.X;
int dy = actor->xspr.targetY - actor->spr.pos.Y;
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int dz = z2 - z;
int nDist = approxDist(dx, dy);
if (Chance(0x600) && nDist <= 0x400)
@ -356,7 +356,7 @@ static void sub_661E0(DBloodActor* actor)
return;
}
int dx = actor->xspr.TargetPos.X - actor->spr.pos.X;
int dy = actor->xspr.targetY - actor->spr.pos.Y;
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int dz = (z2 - z) << 3;
int nDist = approxDist(dx, dy);
if (Chance(0x4000) && nDist <= 0x400)

View file

@ -298,7 +298,7 @@ static void cerberusThinkGoto(DBloodActor* actor)
}
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
int dx = actor->xspr.TargetPos.X - actor->spr.pos.X;
int dy = actor->xspr.targetY - actor->spr.pos.Y;
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int nAngle = getangle(dx, dy);
int nDist = approxDist(dx, dy);
aiChooseDirection(actor, nAngle);

View file

@ -194,7 +194,7 @@ static void cultThinkGoto(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.targetY - actor->spr.pos.Y;
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int nAngle = getangle(dx, dy);
int nDist = approxDist(dx, dy);
aiChooseDirection(actor, nAngle);

View file

@ -264,7 +264,7 @@ static void gargThinkGoto(DBloodActor* actor)
}
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
int dx = actor->xspr.TargetPos.X - actor->spr.pos.X;
int dy = actor->xspr.targetY - actor->spr.pos.Y;
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int nAngle = getangle(dx, dy);
int nDist = approxDist(dx, dy);
aiChooseDirection(actor, nAngle);
@ -533,7 +533,7 @@ static void gargMoveForward(DBloodActor* actor)
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.targetY - actor->spr.pos.Y;
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int nDist = approxDist(dx, dy);
if ((unsigned int)Random(64) < 32 && nDist <= 0x400)
return;
@ -568,7 +568,7 @@ static void gargMoveSlow(DBloodActor* actor)
return;
}
int dx = actor->xspr.TargetPos.X - actor->spr.pos.X;
int dy = actor->xspr.targetY - actor->spr.pos.Y;
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int nDist = approxDist(dx, dy);
if (Chance(0x600) && nDist <= 0x400)
return;
@ -609,7 +609,7 @@ static void gargMoveSwoop(DBloodActor* actor)
return;
}
int dx = actor->xspr.TargetPos.X - actor->spr.pos.X;
int dy = actor->xspr.targetY - actor->spr.pos.Y;
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int nDist = approxDist(dx, dy);
if (Chance(0x600) && nDist <= 0x400)
return;
@ -649,7 +649,7 @@ static void gargMoveFly(DBloodActor* actor)
return;
}
int dx = actor->xspr.TargetPos.X - actor->spr.pos.X;
int dy = actor->xspr.targetY - actor->spr.pos.Y;
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int nDist = approxDist(dx, dy);
if (Chance(0x4000) && nDist <= 0x400)
return;

View file

@ -243,7 +243,7 @@ static void ghostThinkGoto(DBloodActor* actor)
}
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
int dx = actor->xspr.TargetPos.X - actor->spr.pos.X;
int dy = actor->xspr.targetY - actor->spr.pos.Y;
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int nAngle = getangle(dx, dy);
int nDist = approxDist(dx, dy);
aiChooseDirection(actor, nAngle);
@ -429,7 +429,7 @@ static void ghostMoveForward(DBloodActor* actor)
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.targetY - actor->spr.pos.Y;
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int nDist = approxDist(dx, dy);
if ((unsigned int)Random(64) < 32 && nDist <= 0x400)
return;
@ -464,7 +464,7 @@ static void ghostMoveSlow(DBloodActor* actor)
return;
}
int dx = actor->xspr.TargetPos.X - actor->spr.pos.X;
int dy = actor->xspr.targetY - actor->spr.pos.Y;
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int nDist = approxDist(dx, dy);
if (Chance(0x600) && nDist <= 0x400)
return;
@ -502,7 +502,7 @@ static void ghostMoveSwoop(DBloodActor* actor)
return;
}
int dx = actor->xspr.TargetPos.X - actor->spr.pos.X;
int dy = actor->xspr.targetY - actor->spr.pos.Y;
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int nDist = approxDist(dx, dy);
if (Chance(0x600) && nDist <= 0x400)
return;
@ -539,7 +539,7 @@ static void ghostMoveFly(DBloodActor* actor)
return;
}
int dx = actor->xspr.TargetPos.X - actor->spr.pos.X;
int dy = actor->xspr.targetY - actor->spr.pos.Y;
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int nDist = approxDist(dx, dy);
if (Chance(0x4000) && nDist <= 0x400)
return;

View file

@ -86,7 +86,7 @@ static void gillThinkGoto(DBloodActor* actor)
auto pXSector = pSector->hasX() ? &pSector->xs() : nullptr;
int dx = actor->xspr.TargetPos.X - actor->spr.pos.X;
int dy = actor->xspr.targetY - actor->spr.pos.Y;
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int nAngle = getangle(dx, dy);
int nDist = approxDist(dx, dy);
aiChooseDirection(actor, nAngle);
@ -200,7 +200,7 @@ 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.targetY - actor->spr.pos.Y;
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int nAngle = getangle(dx, dy);
int nDist = approxDist(dx, dy);
aiChooseDirection(actor, nAngle);
@ -275,7 +275,7 @@ static void sub_6CB00(DBloodActor* actor)
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.targetY - actor->spr.pos.Y;
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int nDist = approxDist(dx, dy);
if (Random(64) < 32 && nDist <= 0x400)
return;
@ -311,7 +311,7 @@ static void sub_6CD74(DBloodActor* actor)
return;
}
int dx = actor->xspr.TargetPos.X - actor->spr.pos.X;
int dy = actor->xspr.targetY - actor->spr.pos.Y;
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int dz = z2 - z;
int nDist = approxDist(dx, dy);
if (Chance(0x600) && nDist <= 0x400)
@ -346,7 +346,7 @@ static void sub_6D03C(DBloodActor* actor)
return;
}
int dx = actor->xspr.TargetPos.X - actor->spr.pos.X;
int dy = actor->xspr.targetY - actor->spr.pos.Y;
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int dz = (z2 - z) << 3;
int nDist = approxDist(dx, dy);
if (Chance(0x4000) && nDist <= 0x400)

View file

@ -67,7 +67,7 @@ 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.targetY - actor->spr.pos.Y;
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int nAngle = getangle(dx, dy);
int nDist = approxDist(dx, dy);
aiChooseDirection(actor, nAngle);

View file

@ -82,7 +82,7 @@ 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.targetY - actor->spr.pos.Y;
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int nAngle = getangle(dx, dy);
int nDist = approxDist(dx, dy);
aiChooseDirection(actor, nAngle);

View file

@ -51,7 +51,7 @@ 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.targetY - actor->spr.pos.Y;
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int nAngle = getangle(dx, dy);
int nDist = approxDist(dx, dy);
aiChooseDirection(actor, nAngle);

View file

@ -140,7 +140,7 @@ static void aiPodMove(DBloodActor* actor)
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
int dx = actor->xspr.TargetPos.X - actor->spr.pos.X;
int dy = actor->xspr.targetY - actor->spr.pos.Y;
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int nAngle = getangle(dx, dy);
int nDist = approxDist(dx, dy);
aiChooseDirection(actor, nAngle);

View file

@ -63,7 +63,7 @@ static void ratThinkGoto(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.targetY - actor->spr.pos.Y;
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int nAngle = getangle(dx, dy);
int nDist = approxDist(dx, dy);
aiChooseDirection(actor, nAngle);

View file

@ -137,7 +137,7 @@ void SpidBirthSeqCallback(int, DBloodActor* actor)
auto target = actor->GetTarget();
DUDEEXTRA_STATS* pDudeExtraE = &actor->dudeExtra.stats;
int dx = actor->xspr.TargetPos.X - actor->spr.pos.X;
int dy = actor->xspr.targetY - actor->spr.pos.Y;
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int nAngle = getangle(dx, dy);
int nDist = approxDist(dx, dy);
@ -172,7 +172,7 @@ static void spidThinkGoto(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.targetY - actor->spr.pos.Y;
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int nAngle = getangle(dx, dy);
int nDist = approxDist(dx, dy);
aiChooseDirection(actor, nAngle);

View file

@ -265,7 +265,7 @@ static void sub_72850(DBloodActor* actor)
}
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
int dx = actor->xspr.TargetPos.X - actor->spr.pos.X;
int dy = actor->xspr.targetY - actor->spr.pos.Y;
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int nAngle = getangle(dx, dy);
int nDist = approxDist(dx, dy);
aiChooseDirection(actor, nAngle);

View file

@ -420,7 +420,7 @@ static void unicultThinkGoto(DBloodActor* actor)
}
int dx = actor->xspr.TargetPos.X - actor->spr.pos.X;
int dy = actor->xspr.targetY - actor->spr.pos.Y;
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int nAngle = getangle(dx, dy);
aiChooseDirection(actor, nAngle);
@ -1123,7 +1123,7 @@ void aiGenDudeMoveForward(DBloodActor* actor)
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.targetY - actor->spr.pos.Y;
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int nDist = approxDist(dx, dy);
if ((unsigned int)Random(64) < 32 && nDist <= 0x400)
return;

View file

@ -65,7 +65,7 @@ void HackSeqCallback(int, DBloodActor* actor)
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
DUDEINFO* pDudeInfoT = getDudeInfo(target->spr.type);
int tx = actor->xspr.TargetPos.X - actor->spr.pos.X;
int ty = actor->xspr.targetY - actor->spr.pos.Y;
int ty = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int nAngle = getangle(tx, ty);
int height = (actor->spr.yrepeat * pDudeInfo->eyeHeight) << 2;
int height2 = (target->spr.yrepeat * pDudeInfoT->eyeHeight) << 2;
@ -92,7 +92,7 @@ static void zombaThinkGoto(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.targetY - actor->spr.pos.Y;
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int nAngle = getangle(dx, dy);
int nDist = approxDist(dx, dy);
aiChooseDirection(actor, nAngle);
@ -266,7 +266,7 @@ static void entryAIdle(DBloodActor* actor)
static void entryEStand(DBloodActor* actor)
{
sfxPlay3DSound(actor, 1100, -1, 0);
actor->spr.ang = getangle(actor->xspr.TargetPos.X - actor->spr.pos.X, actor->xspr.targetY - actor->spr.pos.Y);
actor->spr.ang = getangle(actor->xspr.TargetPos.X - actor->spr.pos.X, actor->xspr.TargetPos.Y - actor->spr.pos.Y);
}
END_BLD_NS

View file

@ -67,7 +67,7 @@ void PukeSeqCallback(int, DBloodActor* actor)
int height = (pDudeInfo->eyeHeight * actor->spr.yrepeat);
int height2 = (pDudeInfoT->eyeHeight * target->spr.yrepeat);
int tx = actor->xspr.TargetPos.X - actor->spr.pos.X;
int ty = actor->xspr.targetY - actor->spr.pos.Y;
int ty = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int nAngle = getangle(tx, ty);
int dx = bcos(nAngle);
int dy = bsin(nAngle);
@ -91,7 +91,7 @@ static void zombfThinkGoto(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.targetY - actor->spr.pos.Y;
int dy = actor->xspr.TargetPos.Y - actor->spr.pos.Y;
int nAngle = getangle(dx, dy);
int nDist = approxDist(dx, dy);
aiChooseDirection(actor, nAngle);

View file

@ -574,7 +574,7 @@ void dbLoadMap(const char* pPath, int* pX, int* pY, int* pZ, short* pAngle, sect
pXSprite->dudeFlag4 = bitReader.readUnsigned(1);
/*pXSprite->target_i = */ bitReader.readSigned(16);
pXSprite->TargetPos.X = bitReader.readSigned(32);
pXSprite->targetY = bitReader.readSigned(32);
pXSprite->TargetPos.Y = bitReader.readSigned(32);
pXSprite->targetZ = bitReader.readSigned(32);
pXSprite->burnTime = bitReader.readUnsigned(16);
/*pXSprite->burnSource =*/ bitReader.readSigned(16);

View file

@ -624,7 +624,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, XSPRITE& w, XSPRIT
("data3", w.data3, def->data3)
("data4", w.data4, def->data4)
("targetX", w.TargetPos.X, def->TargetPos.X)
("targetY", w.targetY, def->targetY)
("targetY", w.TargetPos.Y, def->TargetPos.Y)
("targetZ", w.targetZ, def->targetZ)
("target", w.target, def->target)
("sysdata1", w.sysData1, def->sysData1)

View file

@ -101,7 +101,6 @@ struct XSPRITE {
TObjPtr<DBloodActor*> target; // target sprite
TObjPtr<DBloodActor*> burnSource;
int32_t targetY; // target y
int32_t targetZ; // target z
vec3_t TargetPos;
int32_t sysData1; // used to keep here various system data, so user can't change it in map editor

View file

@ -689,7 +689,7 @@ void nnExtInitModernStuff(TArray<DBloodActor*>& actors)
actor->xspr.Proximity = actor->xspr.Push = actor->xspr.Vector = actor->xspr.triggerOn = false;
actor->xspr.state = actor->xspr.restState = 0;
actor->xspr.TargetPos.X = actor->xspr.targetY = actor->xspr.targetZ = actor->xspr.sysData2 = -1;
actor->xspr.TargetPos.X = actor->xspr.TargetPos.Y = actor->xspr.targetZ = actor->xspr.sysData2 = -1;
actor->SetTarget(nullptr);
ChangeActorStat(actor, kStatModernCondition);
auto oldStat = actor->spr.cstat;
@ -3009,7 +3009,7 @@ void useTeleportTarget(DBloodActor* sourceactor, DBloodActor* actor)
if (actor->spr.statnum == kStatDude && actor->IsDudeActor() && !actor->IsPlayerActor())
{
int x = actor->xspr.TargetPos.X;
int y = actor->xspr.targetY;
int y = actor->xspr.TargetPos.Y;
int z = actor->xspr.targetZ;
auto target = actor->GetTarget();
@ -3018,7 +3018,7 @@ void useTeleportTarget(DBloodActor* sourceactor, DBloodActor* actor)
if (target != nullptr)
{
actor->xspr.TargetPos.X = x;
actor->xspr.targetY = y;
actor->xspr.TargetPos.Y = y;
actor->xspr.targetZ = z;
actor->SetTarget(target);
aiActivateDude(actor);
@ -6825,7 +6825,7 @@ void useTargetChanger(DBloodActor* sourceactor, DBloodActor* actor)
actor->SetTarget(pMateTargetActor);
auto pMate = pMateTargetActor->GetTarget();
actor->xspr.TargetPos.X = pMate->spr.pos.X;
actor->xspr.targetY = pMate->spr.pos.Y;
actor->xspr.TargetPos.Y = pMate->spr.pos.Y;
actor->xspr.targetZ = pMate->spr.pos.Z;
if (!isActive(actor))
aiActivateDude(actor);
@ -7720,7 +7720,7 @@ void aiPatrolStop(DBloodActor* actor, DBloodActor* targetactor, bool alarm)
else
{
aiInitSprite(actor);
aiSetTarget(actor, actor->xspr.TargetPos.X, actor->xspr.targetY, actor->xspr.targetZ);
aiSetTarget(actor, actor->xspr.TargetPos.X, actor->xspr.TargetPos.Y, actor->xspr.targetZ);
}
actor->xspr.dudeFlag4 = patrol; // this must be kept so enemy can patrol after respawn again