mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 08:52:00 +00:00
- Simple VecToAngle() > .Angle() replacements.
This commit is contained in:
parent
75047b6ad5
commit
c00c8d196e
33 changed files with 78 additions and 78 deletions
|
@ -62,7 +62,7 @@ static walltype* IsOnWall(tspritetype* tspr, int height, DVector2& outpos)
|
|||
{
|
||||
// Intentionally include two sided walls. Even on them the sprite should be projected onto the wall for better results.
|
||||
auto d = wal.delta();
|
||||
auto deltaang = absangle(VecToAngle(d), tspr->angle);
|
||||
auto deltaang = absangle(d.Angle(), tspr->angle);
|
||||
const DAngle maxangdelta = DAngle360 / 1024;
|
||||
|
||||
// angle of the sprite must either be the wall's normal or the negative wall's normal to be aligned.
|
||||
|
|
|
@ -1505,7 +1505,7 @@ void aiThinkTarget(DBloodActor* actor)
|
|||
if (!cansee(ppos, pSector, actor->spr.pos.plusZ(-height), actor->sector()))
|
||||
continue;
|
||||
|
||||
DAngle nDeltaAngle = absangle(actor->spr.angle, VecToAngle(dvec));
|
||||
DAngle nDeltaAngle = absangle(actor->spr.angle, dvec.Angle());
|
||||
if (nDist < pDudeInfo->SeeDist() && nDeltaAngle <= pDudeInfo->Periphery())
|
||||
{
|
||||
aiSetTarget(actor, pPlayer->actor);
|
||||
|
@ -1549,7 +1549,7 @@ void aiLookForTarget(DBloodActor* actor)
|
|||
double height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) * REPEAT_SCALE;
|
||||
if (!cansee(ppos, pSector, actor->spr.pos.plusZ(-height), actor->sector()))
|
||||
continue;
|
||||
DAngle nDeltaAngle = absangle(actor->spr.angle, VecToAngle(dvec));
|
||||
DAngle nDeltaAngle = absangle(actor->spr.angle, dvec.Angle());
|
||||
if (nDist < pDudeInfo->SeeDist() && nDeltaAngle <= pDudeInfo->Periphery())
|
||||
{
|
||||
aiSetTarget(actor, pPlayer->actor);
|
||||
|
|
|
@ -107,7 +107,7 @@ static void batThinkTarget(DBloodActor* actor)
|
|||
double height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) * REPEAT_SCALE;
|
||||
if (!cansee(ppos, pSector, actor->spr.pos.plusZ(-height), actor->sector()))
|
||||
continue;
|
||||
DAngle nDeltaAngle = absangle(actor->spr.angle, VecToAngle(dvec));
|
||||
DAngle nDeltaAngle = absangle(actor->spr.angle, dvec.Angle());
|
||||
if (nDist < pDudeInfo->SeeDist() && nDeltaAngle <= pDudeInfo->Periphery())
|
||||
{
|
||||
aiSetTarget(actor, pPlayer->actor);
|
||||
|
@ -136,7 +136,7 @@ static void batThinkGoto(DBloodActor* actor)
|
|||
assert(actor->spr.type >= kDudeBase && actor->spr.type < kDudeMax);
|
||||
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
|
||||
auto dvec = actor->xspr.TargetPos.XY() - actor->spr.pos.X;
|
||||
auto nAngle = VecToAngle(dvec);
|
||||
auto nAngle = dvec.Angle();
|
||||
double nDist = dvec.Length();
|
||||
aiChooseDirection(actor, nAngle);
|
||||
if (nDist < 32 && absangle(actor->spr.angle, nAngle) < pDudeInfo->Periphery())
|
||||
|
@ -156,7 +156,7 @@ static void batThinkPonder(DBloodActor* actor)
|
|||
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
||||
auto pTarget = actor->GetTarget();
|
||||
auto dvec = pTarget->spr.pos.XY() - actor->spr.pos.XY();
|
||||
aiChooseDirection(actor, VecToAngle(dvec));
|
||||
aiChooseDirection(actor, dvec.Angle());
|
||||
if (pTarget->xspr.health == 0)
|
||||
{
|
||||
aiNewState(actor, &batSearch);
|
||||
|
@ -165,7 +165,7 @@ static void batThinkPonder(DBloodActor* actor)
|
|||
double nDist = dvec.Length();
|
||||
if (nDist <= pDudeInfo->SeeDist())
|
||||
{
|
||||
DAngle nDeltaAngle = absangle(actor->spr.angle, VecToAngle(dvec));
|
||||
DAngle nDeltaAngle = absangle(actor->spr.angle, dvec.Angle());
|
||||
double height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) * REPEAT_SCALE;
|
||||
double height2 = (getDudeInfo(pTarget->spr.type)->eyeHeight * pTarget->spr.yrepeat) * REPEAT_SCALE;
|
||||
double top, bottom;
|
||||
|
@ -245,7 +245,7 @@ static void batThinkChase(DBloodActor* actor)
|
|||
auto pTarget = actor->GetTarget();
|
||||
auto dvec = pTarget->spr.pos.XY() - actor->spr.pos.XY();
|
||||
|
||||
aiChooseDirection(actor, VecToAngle(dvec));
|
||||
aiChooseDirection(actor, dvec.Angle());
|
||||
if (pTarget->xspr.health == 0)
|
||||
{
|
||||
aiNewState(actor, &batSearch);
|
||||
|
|
|
@ -176,7 +176,7 @@ static void beastThinkGoto(DBloodActor* actor)
|
|||
auto pXSector = pSector->hasX() ? &pSector->xs() : nullptr;
|
||||
|
||||
auto dvec = actor->xspr.TargetPos.XY() - actor->spr.pos.XY();
|
||||
auto nAngle = VecToAngle(dvec);
|
||||
auto nAngle = dvec.Angle();
|
||||
double nDist = dvec.Length();
|
||||
aiChooseDirection(actor, nAngle);
|
||||
if (nDist < 32 && absangle(actor->spr.angle, nAngle) < pDudeInfo->Periphery())
|
||||
|
@ -208,7 +208,7 @@ static void beastThinkChase(DBloodActor* actor)
|
|||
auto target = actor->GetTarget();
|
||||
|
||||
auto dv = target->spr.pos.XY() - actor->spr.pos.XY();
|
||||
aiChooseDirection(actor, VecToAngle(dv));
|
||||
aiChooseDirection(actor, dv.Angle());
|
||||
|
||||
auto pSector = actor->sector();
|
||||
auto pXSector = pSector->hasX() ? &pSector->xs() : nullptr;
|
||||
|
@ -232,7 +232,7 @@ static void beastThinkChase(DBloodActor* actor)
|
|||
double nDist = dv.Length();
|
||||
if (nDist <= pDudeInfo->SeeDist())
|
||||
{
|
||||
DAngle nDeltaAngle = absangle(actor->spr.angle, VecToAngle(dv));
|
||||
DAngle nDeltaAngle = absangle(actor->spr.angle, dv.Angle());
|
||||
double height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) * REPEAT_SCALE;
|
||||
if (cansee(target->spr.pos, target->sector(), actor->spr.pos.plusZ(-height), actor->sector()))
|
||||
{
|
||||
|
@ -325,7 +325,7 @@ static void beastThinkSwimGoto(DBloodActor* actor)
|
|||
assert(actor->spr.type >= kDudeBase && actor->spr.type < kDudeMax);
|
||||
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
|
||||
auto dvec = actor->xspr.TargetPos.XY() - actor->spr.pos.XY();
|
||||
auto nAngle = VecToAngle(dvec);
|
||||
auto nAngle = dvec.Angle();
|
||||
double nDist = dvec.Length();
|
||||
aiChooseDirection(actor, nAngle);
|
||||
if (nDist < 32 && absangle(actor->spr.angle, nAngle) < pDudeInfo->Periphery())
|
||||
|
@ -346,7 +346,7 @@ static void beastThinkSwimChase(DBloodActor* actor)
|
|||
auto target = actor->GetTarget();
|
||||
|
||||
auto dvec = target->spr.pos.XY() - actor->spr.pos.XY();
|
||||
DAngle nAngle = VecToAngle(dvec);
|
||||
DAngle nAngle = dvec.Angle();
|
||||
double nDist = dvec.Length();
|
||||
|
||||
aiChooseDirection(actor, nAngle);
|
||||
|
|
|
@ -118,7 +118,7 @@ static void eelThinkTarget(DBloodActor* actor)
|
|||
double height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) * REPEAT_SCALE;
|
||||
if (!cansee(ppos, pSector, actor->spr.pos.plusZ(-height), actor->sector()))
|
||||
continue;
|
||||
DAngle nDeltaAngle = absangle(actor->spr.angle, VecToAngle(dvect));
|
||||
DAngle nDeltaAngle = absangle(actor->spr.angle, dvect.Angle());
|
||||
if (nDist < pDudeInfo->SeeDist() && nDeltaAngle <= pDudeInfo->Periphery())
|
||||
{
|
||||
pDudeExtraE->thinkTime = 0;
|
||||
|
@ -149,7 +149,7 @@ static void eelThinkGoto(DBloodActor* actor)
|
|||
assert(actor->spr.type >= kDudeBase && actor->spr.type < kDudeMax);
|
||||
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
|
||||
auto dvec = actor->xspr.TargetPos.XY() - actor->spr.pos.XY();
|
||||
auto nAngle = VecToAngle(dvec);
|
||||
auto nAngle = dvec.Angle();
|
||||
double nDist = dvec.Length();
|
||||
aiChooseDirection(actor, nAngle);
|
||||
if (nDist < 32 && absangle(actor->spr.angle, nAngle) < pDudeInfo->Periphery())
|
||||
|
@ -169,7 +169,7 @@ static void eelThinkPonder(DBloodActor* actor)
|
|||
auto target = actor->GetTarget();
|
||||
|
||||
auto dvec = target->spr.pos.XY() - actor->spr.pos.XY();
|
||||
DAngle nAngle = VecToAngle(dvec);
|
||||
DAngle nAngle = dvec.Angle();
|
||||
double nDist = dvec.Length();
|
||||
aiChooseDirection(actor, nAngle);
|
||||
if (target->xspr.health == 0)
|
||||
|
@ -259,7 +259,7 @@ static void eelThinkChase(DBloodActor* actor)
|
|||
auto target = actor->GetTarget();
|
||||
|
||||
auto dvec = target->spr.pos.XY() - actor->spr.pos.XY();
|
||||
DAngle nAngle = VecToAngle(dvec);
|
||||
DAngle nAngle = dvec.Angle();
|
||||
double nDist = dvec.Length();
|
||||
aiChooseDirection(actor, nAngle);
|
||||
if (target->xspr.health == 0)
|
||||
|
|
|
@ -85,7 +85,7 @@ static void burnThinkGoto(DBloodActor* actor)
|
|||
assert(actor->spr.type >= kDudeBase && actor->spr.type < kDudeMax);
|
||||
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
|
||||
auto dvec = actor->xspr.TargetPos.XY() - actor->spr.pos.XY();
|
||||
DAngle nAngle = VecToAngle(dvec);
|
||||
DAngle nAngle = dvec.Angle();
|
||||
double nDist = dvec.Length();
|
||||
aiChooseDirection(actor, nAngle);
|
||||
if (nDist < 32 && absangle(actor->spr.angle, nAngle) < pDudeInfo->Periphery())
|
||||
|
@ -157,7 +157,7 @@ static void burnThinkChase(DBloodActor* actor)
|
|||
auto target = actor->GetTarget();
|
||||
|
||||
auto dvec = target->spr.pos.XY() - actor->spr.pos.XY();
|
||||
DAngle nAngle = VecToAngle(dvec);
|
||||
DAngle nAngle = dvec.Angle();
|
||||
double nDist = dvec.Length();
|
||||
|
||||
aiChooseDirection(actor, nAngle);
|
||||
|
|
|
@ -94,7 +94,7 @@ static void calebThinkGoto(DBloodActor* actor)
|
|||
auto pXSector = pSector->hasX() ? &pSector->xs() : nullptr;
|
||||
|
||||
auto dvec = actor->xspr.TargetPos.XY() - actor->spr.pos.XY();
|
||||
DAngle nAngle = VecToAngle(dvec);
|
||||
DAngle nAngle = dvec.Angle();
|
||||
double nDist = dvec.Length();
|
||||
aiChooseDirection(actor, nAngle);
|
||||
if (nDist < 32 && absangle(actor->spr.angle, nAngle) < pDudeInfo->Periphery())
|
||||
|
@ -125,7 +125,7 @@ static void calebThinkChase(DBloodActor* actor)
|
|||
auto target = actor->GetTarget();
|
||||
|
||||
auto dvec = target->spr.pos.XY() - actor->spr.pos.XY();
|
||||
DAngle nAngle = VecToAngle(dvec);
|
||||
DAngle nAngle = dvec.Angle();
|
||||
double nDist = dvec.Length();
|
||||
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);
|
||||
auto dvec = actor->xspr.TargetPos.XY() - actor->spr.pos.XY();
|
||||
DAngle nAngle = VecToAngle(dvec);
|
||||
DAngle nAngle = dvec.Angle();
|
||||
double nDist = dvec.Length();
|
||||
aiChooseDirection(actor, nAngle);
|
||||
if (nDist < 32 && absangle(actor->spr.angle, nAngle) < pDudeInfo->Periphery())
|
||||
|
@ -233,7 +233,7 @@ static void calebThinkSwimChase(DBloodActor* actor)
|
|||
auto target = actor->GetTarget();
|
||||
|
||||
auto dvec = target->spr.pos.XY() - actor->spr.pos.XY();
|
||||
DAngle nAngle = VecToAngle(dvec);
|
||||
DAngle nAngle = dvec.Angle();
|
||||
double nDist = dvec.Length();
|
||||
aiChooseDirection(actor, nAngle);
|
||||
|
||||
|
|
|
@ -249,7 +249,7 @@ static void cerberusThinkTarget(DBloodActor* actor)
|
|||
double height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) * REPEAT_SCALE;
|
||||
if (!cansee(ppos, pSector, actor->spr.pos.plusZ(-height), actor->sector()))
|
||||
continue;
|
||||
DAngle nDeltaAngle = absangle(actor->spr.angle, VecToAngle(dvect));
|
||||
DAngle nDeltaAngle = absangle(actor->spr.angle, dvect.Angle());
|
||||
if (nDist < pDudeInfo->SeeDist() && nDeltaAngle <= pDudeInfo->Periphery())
|
||||
{
|
||||
pDudeExtraE->thinkTime = 0;
|
||||
|
@ -277,7 +277,7 @@ static void cerberusThinkGoto(DBloodActor* actor)
|
|||
}
|
||||
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
|
||||
auto dvec = actor->xspr.TargetPos.XY() - actor->spr.pos.XY();
|
||||
DAngle nAngle = VecToAngle(dvec);
|
||||
DAngle nAngle = dvec.Angle();
|
||||
double nDist = dvec.Length();
|
||||
aiChooseDirection(actor, nAngle);
|
||||
if (nDist < 32 && absangle(actor->spr.angle, nAngle) < pDudeInfo->Periphery())
|
||||
|
@ -320,7 +320,7 @@ static void cerberusThinkChase(DBloodActor* actor)
|
|||
auto target = actor->GetTarget();
|
||||
|
||||
auto dvec = target->spr.pos.XY() - actor->spr.pos.XY();
|
||||
DAngle nAngle = VecToAngle(dvec);
|
||||
DAngle nAngle = dvec.Angle();
|
||||
double nDist = dvec.Length();
|
||||
aiChooseDirection(actor, nAngle);
|
||||
|
||||
|
|
|
@ -185,7 +185,7 @@ static void cultThinkGoto(DBloodActor* actor)
|
|||
assert(actor->spr.type >= kDudeBase && actor->spr.type < kDudeMax);
|
||||
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
|
||||
auto dvec = actor->xspr.TargetPos.XY() - actor->spr.pos.XY();
|
||||
DAngle nAngle = VecToAngle(dvec);
|
||||
DAngle nAngle = dvec.Angle();
|
||||
double nDist = dvec.Length();
|
||||
aiChooseDirection(actor, nAngle);
|
||||
if (nDist < 320 && absangle(actor->spr.angle, nAngle) < pDudeInfo->Periphery())
|
||||
|
@ -226,7 +226,7 @@ static void cultThinkChase(DBloodActor* actor)
|
|||
|
||||
auto dvec = target->spr.pos - actor->spr.pos;
|
||||
double nDist = dvec.XY().Length();
|
||||
DAngle nAngle = VecToAngle(dvec);
|
||||
DAngle nAngle = dvec.Angle();
|
||||
aiChooseDirection(actor, nAngle);
|
||||
|
||||
if (target->xspr.health == 0)
|
||||
|
|
|
@ -205,7 +205,7 @@ static void gargThinkTarget(DBloodActor* actor)
|
|||
double height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) * REPEAT_SCALE;
|
||||
if (!cansee(ppos, pSector, actor->spr.pos.plusZ(-height), actor->sector()))
|
||||
continue;
|
||||
DAngle nDeltaAngle = absangle(actor->spr.angle, VecToAngle(dvect));
|
||||
DAngle nDeltaAngle = absangle(actor->spr.angle, dvect.Angle());
|
||||
if (nDist < pDudeInfo->SeeDist() && nDeltaAngle <= pDudeInfo->Periphery())
|
||||
{
|
||||
pDudeExtraE->thinkTime = 0;
|
||||
|
@ -239,7 +239,7 @@ static void gargThinkGoto(DBloodActor* actor)
|
|||
}
|
||||
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
|
||||
auto dvec = actor->xspr.TargetPos.XY() - actor->spr.pos.XY();
|
||||
DAngle nAngle = VecToAngle(dvec);
|
||||
DAngle nAngle = dvec.Angle();
|
||||
double nDist = dvec.Length();
|
||||
aiChooseDirection(actor, nAngle);
|
||||
if (nDist < 32 && absangle(actor->spr.angle, nAngle) < pDudeInfo->Periphery())
|
||||
|
|
|
@ -186,7 +186,7 @@ static void ghostThinkTarget(DBloodActor* actor)
|
|||
double height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) * REPEAT_SCALE;
|
||||
if (!cansee(ppos, pSector, actor->spr.pos.plusZ(-height), actor->sector()))
|
||||
continue;
|
||||
DAngle nDeltaAngle = absangle(actor->spr.angle, VecToAngle(dvect));
|
||||
DAngle nDeltaAngle = absangle(actor->spr.angle, dvect.Angle());
|
||||
if (nDist < pDudeInfo->SeeDist() && nDeltaAngle <= pDudeInfo->Periphery())
|
||||
{
|
||||
pDudeExtraE->thinkTime = 0;
|
||||
|
@ -219,7 +219,7 @@ static void ghostThinkGoto(DBloodActor* actor)
|
|||
}
|
||||
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
|
||||
auto dvec = actor->xspr.TargetPos.XY() - actor->spr.pos.XY();
|
||||
DAngle nAngle = VecToAngle(dvec);
|
||||
DAngle nAngle = dvec.Angle();
|
||||
double nDist = dvec.Length();
|
||||
aiChooseDirection(actor, nAngle);
|
||||
if (nDist < 32 && absangle(actor->spr.angle, nAngle) < pDudeInfo->Periphery())
|
||||
|
|
|
@ -84,7 +84,7 @@ static void gillThinkGoto(DBloodActor* actor)
|
|||
auto pXSector = pSector->hasX() ? &pSector->xs() : nullptr;
|
||||
|
||||
auto dvec = actor->xspr.TargetPos.XY() - actor->spr.pos.XY();
|
||||
DAngle nAngle = VecToAngle(dvec);
|
||||
DAngle nAngle = dvec.Angle();
|
||||
double nDist = dvec.Length();
|
||||
aiChooseDirection(actor, nAngle);
|
||||
if (nDist < 32 && absangle(actor->spr.angle, nAngle) < pDudeInfo->Periphery())
|
||||
|
@ -115,7 +115,7 @@ static void gillThinkChase(DBloodActor* actor)
|
|||
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
||||
auto target = actor->GetTarget();
|
||||
auto dv = target->spr.pos.XY() - actor->spr.pos.XY();
|
||||
DAngle nAngle = VecToAngle(dv);
|
||||
DAngle nAngle = dv.Angle();
|
||||
aiChooseDirection(actor, nAngle);
|
||||
if (actor->xspr.health == 0)
|
||||
{
|
||||
|
@ -197,7 +197,7 @@ static void gillThinkSwimGoto(DBloodActor* actor)
|
|||
assert(actor->spr.type >= kDudeBase && actor->spr.type < kDudeMax);
|
||||
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
|
||||
auto dvec = actor->xspr.TargetPos.XY() - actor->spr.pos.XY();
|
||||
DAngle nAngle = VecToAngle(dvec);
|
||||
DAngle nAngle = dvec.Angle();
|
||||
double nDist = dvec.Length();
|
||||
aiChooseDirection(actor, nAngle);
|
||||
if (nDist < 32 && absangle(actor->spr.angle, nAngle) < pDudeInfo->Periphery())
|
||||
|
@ -217,7 +217,7 @@ static void gillThinkSwimChase(DBloodActor* actor)
|
|||
if (!actor->ValidateTarget(__FUNCTION__)) return;
|
||||
auto target = actor->GetTarget();
|
||||
auto dvec = target->spr.pos.XY() - actor->spr.pos.XY();
|
||||
DAngle nAngle = VecToAngle(dvec);
|
||||
DAngle nAngle = dvec.Angle();
|
||||
double nDist = dvec.Length();
|
||||
aiChooseDirection(actor, nAngle);
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ static void handThinkGoto(DBloodActor* actor)
|
|||
assert(actor->spr.type >= kDudeBase && actor->spr.type < kDudeMax);
|
||||
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
|
||||
auto dvec = actor->xspr.TargetPos.XY() - actor->spr.pos.XY();
|
||||
DAngle nAngle = VecToAngle(dvec);
|
||||
DAngle nAngle = dvec.Angle();
|
||||
double nDist = dvec.Length();
|
||||
aiChooseDirection(actor, nAngle);
|
||||
if (nDist < 32 && absangle(actor->spr.angle, nAngle) < pDudeInfo->Periphery())
|
||||
|
@ -88,7 +88,7 @@ static void handThinkChase(DBloodActor* actor)
|
|||
auto target = actor->GetTarget();
|
||||
|
||||
auto dvec = target->spr.pos.XY() - actor->spr.pos.XY();
|
||||
DAngle nAngle = VecToAngle(dvec);
|
||||
DAngle nAngle = dvec.Angle();
|
||||
double nDist = dvec.Length();
|
||||
aiChooseDirection(actor, nAngle);
|
||||
if (target->xspr.health == 0)
|
||||
|
|
|
@ -76,7 +76,7 @@ static void houndThinkGoto(DBloodActor* actor)
|
|||
|
||||
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
|
||||
auto dvec = actor->xspr.TargetPos.XY() - actor->spr.pos.XY();
|
||||
DAngle nAngle = VecToAngle(dvec);
|
||||
DAngle nAngle = dvec.Angle();
|
||||
double nDist = dvec.Length();
|
||||
aiChooseDirection(actor, nAngle);
|
||||
if (nDist < 32 && absangle(actor->spr.angle, nAngle) < pDudeInfo->Periphery())
|
||||
|
@ -99,7 +99,7 @@ static void houndThinkChase(DBloodActor* actor)
|
|||
auto target = actor->GetTarget();
|
||||
|
||||
auto dvec = target->spr.pos.XY() - actor->spr.pos.XY();
|
||||
DAngle nAngle = VecToAngle(dvec);
|
||||
DAngle nAngle = dvec.Angle();
|
||||
double nDist = dvec.Length();
|
||||
aiChooseDirection(actor, nAngle);
|
||||
if (target->xspr.health == 0)
|
||||
|
|
|
@ -51,7 +51,7 @@ static void innocThinkGoto(DBloodActor* actor)
|
|||
assert(actor->spr.type >= kDudeBase && actor->spr.type < kDudeMax);
|
||||
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
|
||||
auto dvec = actor->xspr.TargetPos.XY() - actor->spr.pos.XY();
|
||||
DAngle nAngle = VecToAngle(dvec);
|
||||
DAngle nAngle = dvec.Angle();
|
||||
double nDist = dvec.Length();
|
||||
aiChooseDirection(actor, nAngle);
|
||||
if (nDist < 32 && absangle(actor->spr.angle, nAngle) < pDudeInfo->Periphery())
|
||||
|
@ -72,7 +72,7 @@ static void innocThinkChase(DBloodActor* actor)
|
|||
auto target = actor->GetTarget();
|
||||
|
||||
auto dvec = target->spr.pos.XY() - actor->spr.pos.XY();
|
||||
DAngle nAngle = VecToAngle(dvec);
|
||||
DAngle nAngle = dvec.Angle();
|
||||
double nDist = dvec.Length();
|
||||
aiChooseDirection(actor, nAngle);
|
||||
if (target->xspr.health == 0)
|
||||
|
|
|
@ -137,7 +137,7 @@ static void aiPodMove(DBloodActor* actor)
|
|||
|
||||
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
|
||||
auto dvec = actor->xspr.TargetPos.XY() - actor->spr.pos.XY();
|
||||
DAngle nAngle = VecToAngle(dvec);
|
||||
DAngle nAngle = dvec.Angle();
|
||||
double nDist = dvec.Length();
|
||||
aiChooseDirection(actor, nAngle);
|
||||
if (nDist < 32 && absangle(actor->spr.angle, nAngle) < pDudeInfo->Periphery())
|
||||
|
@ -179,7 +179,7 @@ static void aiPodChase(DBloodActor* actor)
|
|||
auto target = actor->GetTarget();
|
||||
|
||||
auto dvec = target->spr.pos.XY() - actor->spr.pos.XY();
|
||||
DAngle nAngle = VecToAngle(dvec);
|
||||
DAngle nAngle = dvec.Angle();
|
||||
double nDist = dvec.Length();
|
||||
aiChooseDirection(actor, nAngle);
|
||||
if (target->xspr.health == 0) {
|
||||
|
|
|
@ -64,7 +64,7 @@ static void ratThinkGoto(DBloodActor* actor)
|
|||
assert(actor->spr.type >= kDudeBase && actor->spr.type < kDudeMax);
|
||||
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
|
||||
auto dvec = actor->xspr.TargetPos.XY() - actor->spr.pos.XY();
|
||||
DAngle nAngle = VecToAngle(dvec);
|
||||
DAngle nAngle = dvec.Angle();
|
||||
double nDist = dvec.Length();
|
||||
aiChooseDirection(actor, nAngle);
|
||||
if (nDist < 32 && absangle(actor->spr.angle, nAngle) < pDudeInfo->Periphery())
|
||||
|
@ -84,7 +84,7 @@ static void ratThinkChase(DBloodActor* actor)
|
|||
auto target = actor->GetTarget();
|
||||
|
||||
auto dvec = target->spr.pos.XY() - actor->spr.pos.XY();
|
||||
DAngle nAngle = VecToAngle(dvec);
|
||||
DAngle nAngle = dvec.Angle();
|
||||
double nDist = dvec.Length();
|
||||
aiChooseDirection(actor, nAngle);
|
||||
if (target->xspr.health == 0)
|
||||
|
|
|
@ -137,7 +137,7 @@ void SpidBirthSeqCallback(int, DBloodActor* actor)
|
|||
auto target = actor->GetTarget();
|
||||
DUDEEXTRA_STATS* pDudeExtraE = &actor->dudeExtra.stats;
|
||||
auto dvec = actor->xspr.TargetPos.XY() - actor->spr.pos.XY();
|
||||
DAngle nAngle = VecToAngle(dvec);
|
||||
DAngle nAngle = dvec.Angle();
|
||||
double nDist = dvec.Length();
|
||||
|
||||
DBloodActor* spawned = nullptr;
|
||||
|
@ -172,7 +172,7 @@ static void spidThinkGoto(DBloodActor* actor)
|
|||
assert(actor->spr.type >= kDudeBase && actor->spr.type < kDudeMax);
|
||||
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
|
||||
auto dvec = actor->xspr.TargetPos.XY() - actor->spr.pos.XY();
|
||||
DAngle nAngle = VecToAngle(dvec);
|
||||
DAngle nAngle = dvec.Angle();
|
||||
double nDist = dvec.Length();
|
||||
aiChooseDirection(actor, nAngle);
|
||||
if (nDist < 32 && absangle(actor->spr.angle, nAngle) < pDudeInfo->Periphery())
|
||||
|
@ -192,7 +192,7 @@ static void spidThinkChase(DBloodActor* actor)
|
|||
auto target = actor->GetTarget();
|
||||
|
||||
auto dvec = target->spr.pos.XY() - actor->spr.pos.XY();
|
||||
DAngle nAngle = VecToAngle(dvec);
|
||||
DAngle nAngle = dvec.Angle();
|
||||
double nDist = dvec.Length();
|
||||
aiChooseDirection(actor, nAngle);
|
||||
if (target->xspr.health == 0)
|
||||
|
|
|
@ -204,7 +204,7 @@ static void sub_725A4(DBloodActor* actor)
|
|||
auto ppos = pPlayer->actor->spr.pos;
|
||||
auto dvect = ppos.XY() - actor->spr.pos;
|
||||
auto pSector = pPlayer->actor->sector();
|
||||
DAngle nAngle = VecToAngle(dvect);
|
||||
DAngle nAngle = dvect.Angle();
|
||||
double nDist = dvect.Length();
|
||||
|
||||
if (nDist > pDudeInfo->SeeDist() && nDist > pDudeInfo->HearDist())
|
||||
|
@ -240,7 +240,7 @@ static void sub_72850(DBloodActor* actor)
|
|||
}
|
||||
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
|
||||
auto dvec = actor->xspr.TargetPos.XY() - actor->spr.pos.XY();
|
||||
DAngle nAngle = VecToAngle(dvec);
|
||||
DAngle nAngle = dvec.Angle();
|
||||
double nDist = dvec.Length();
|
||||
aiChooseDirection(actor, nAngle);
|
||||
if (nDist < 32 && absangle(actor->spr.angle, nAngle) < pDudeInfo->Periphery())
|
||||
|
@ -264,7 +264,7 @@ static void tchernobogThinkChase(DBloodActor* actor)
|
|||
auto target = actor->GetTarget();
|
||||
|
||||
auto dvec = target->spr.pos.XY() - actor->spr.pos.XY();
|
||||
DAngle nAngle = VecToAngle(dvec);
|
||||
DAngle nAngle = dvec.Angle();
|
||||
double nDist = dvec.Length();
|
||||
aiChooseDirection(actor, nAngle);
|
||||
if (target->xspr.health == 0)
|
||||
|
|
|
@ -419,7 +419,7 @@ static void unicultThinkGoto(DBloodActor* actor)
|
|||
}
|
||||
|
||||
auto dvec = actor->xspr.TargetPos.XY() - actor->spr.pos.XY();
|
||||
DAngle nAngle = VecToAngle(dvec);
|
||||
DAngle nAngle = dvec.Angle();
|
||||
double nDist = dvec.Length();
|
||||
aiChooseDirection(actor, nAngle);
|
||||
|
||||
|
@ -480,7 +480,7 @@ static void unicultThinkChase(DBloodActor* actor)
|
|||
// check target
|
||||
auto dv = target->spr.pos.XY() - actor->spr.pos.XY();
|
||||
double dist = max(dv.Length(), 1 / 256.);
|
||||
DAngle nAngle = VecToAngle(dv);
|
||||
DAngle nAngle = dv.Angle();
|
||||
|
||||
// quick hack to prevent spinning around or changing attacker's sprite angle on high movement speeds
|
||||
// when attacking the target. It happens because vanilla function takes in account x and y velocity,
|
||||
|
|
|
@ -91,7 +91,7 @@ static void zombaThinkGoto(DBloodActor* actor)
|
|||
assert(actor->spr.type >= kDudeBase && actor->spr.type < kDudeMax);
|
||||
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
|
||||
auto dvec = actor->xspr.TargetPos.XY() - actor->spr.pos.XY();
|
||||
DAngle nAngle = VecToAngle(dvec);
|
||||
DAngle nAngle = dvec.Angle();
|
||||
double nDist = dvec.Length();
|
||||
aiChooseDirection(actor, nAngle);
|
||||
if (nDist < 51.3125 && absangle(actor->spr.angle, nAngle) < pDudeInfo->Periphery())
|
||||
|
@ -112,7 +112,7 @@ static void zombaThinkChase(DBloodActor* actor)
|
|||
auto target = actor->GetTarget();
|
||||
|
||||
auto dvec = target->spr.pos.XY() - actor->spr.pos.XY();
|
||||
DAngle nAngle = VecToAngle(dvec);
|
||||
DAngle nAngle = dvec.Angle();
|
||||
double nDist = dvec.Length();
|
||||
aiChooseDirection(actor, nAngle);
|
||||
|
||||
|
@ -164,7 +164,7 @@ static void zombaThinkPonder(DBloodActor* actor)
|
|||
auto target = actor->GetTarget();
|
||||
|
||||
auto dvec = target->spr.pos.XY() - actor->spr.pos.XY();
|
||||
DAngle nAngle = VecToAngle(dvec);
|
||||
DAngle nAngle = dvec.Angle();
|
||||
double nDist = dvec.Length();
|
||||
aiChooseDirection(actor, nAngle);
|
||||
if (target->xspr.health == 0)
|
||||
|
@ -222,7 +222,7 @@ static void myThinkTarget(DBloodActor* actor)
|
|||
double height = (pDudeInfo->eyeHeight * actor->spr.yrepeat) * REPEAT_SCALE;
|
||||
if (!cansee(ppos, pSector, actor->spr.pos.plusZ(-height), actor->sector()))
|
||||
continue;
|
||||
DAngle nDeltaAngle = absangle(actor->spr.angle, VecToAngle(dvect));
|
||||
DAngle nDeltaAngle = absangle(actor->spr.angle, dvect.Angle());
|
||||
if (nDist < pDudeInfo->SeeDist() && abs(nDeltaAngle) <= pDudeInfo->Periphery())
|
||||
{
|
||||
aiSetTarget(actor, pPlayer->actor);
|
||||
|
|
|
@ -91,7 +91,7 @@ static void zombfThinkGoto(DBloodActor* actor)
|
|||
assert(actor->spr.type >= kDudeBase && actor->spr.type < kDudeMax);
|
||||
DUDEINFO* pDudeInfo = getDudeInfo(actor->spr.type);
|
||||
auto dvec = actor->xspr.TargetPos.XY() - actor->spr.pos.XY();
|
||||
DAngle nAngle = VecToAngle(dvec);
|
||||
DAngle nAngle = dvec.Angle();
|
||||
double nDist = dvec.Length();
|
||||
aiChooseDirection(actor, nAngle);
|
||||
if (nDist < 32 && absangle(actor->spr.angle, nAngle) < pDudeInfo->Periphery())
|
||||
|
@ -112,7 +112,7 @@ static void zombfThinkChase(DBloodActor* actor)
|
|||
auto target = actor->GetTarget();
|
||||
|
||||
auto dv = target->spr.pos - actor->spr.pos;
|
||||
auto nAngle = VecToAngle(dv);
|
||||
auto nAngle = dv.Angle();
|
||||
aiChooseDirection(actor, nAngle);
|
||||
if (target->xspr.health == 0)
|
||||
{
|
||||
|
|
|
@ -3261,7 +3261,7 @@ void useTeleportTarget(DBloodActor* sourceactor, DBloodActor* actor)
|
|||
if (sourceactor->xspr.data3 & kModernTypeFlag2)
|
||||
{
|
||||
auto velv = actor->vel.XY();
|
||||
auto pt = rotatepoint(actor->spr.pos.XY(), velv, sourceactor->spr.angle - VecToAngle(velv));
|
||||
auto pt = rotatepoint(actor->spr.pos.XY(), velv, sourceactor->spr.angle - velv.Angle());
|
||||
actor->vel.XY() = pt;
|
||||
|
||||
}
|
||||
|
@ -4448,7 +4448,7 @@ bool condCheckDude(DBloodActor* aCond, int cmpOp, bool PUSH)
|
|||
var = cansee(objActor->spr.pos, objActor->sector(), targ->spr.pos.plusZ(-height), targ->sector());
|
||||
if (cond == 4 && var > 0)
|
||||
{
|
||||
DAngle absang = absangle(VecToAngle(delta), objActor->spr.angle);
|
||||
DAngle absang = absangle(delta.Angle(), objActor->spr.angle);
|
||||
var = absang < (arg1 <= 0 ? pInfo->Periphery() : min(mapangle(arg1), DAngle360));
|
||||
}
|
||||
break;
|
||||
|
@ -8366,7 +8366,7 @@ bool readyForCrit(DBloodActor* hunter, DBloodActor* victim)
|
|||
if (dvect.Length() >= (437.5 / max(gGameOptions.nDifficulty >> 1, 1)))
|
||||
return false;
|
||||
|
||||
return absangle(victim->spr.angle, VecToAngle(dvect)) <= DAngle45;
|
||||
return absangle(victim->spr.angle, dvect.Angle()) <= DAngle45;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -8560,7 +8560,7 @@ DBloodActor* aiPatrolSearchTargets(DBloodActor* actor)
|
|||
if (seeDistf)
|
||||
{
|
||||
DAngle periphery = max(pDudeInfo->Periphery(), DAngle60);
|
||||
DAngle nDeltaAngle = absangle(actor->spr.angle, VecToAngle(dv));
|
||||
DAngle nDeltaAngle = absangle(actor->spr.angle, dv.Angle());
|
||||
if ((itCanSee = (!blind && nDistf < seeDistf && nDeltaAngle < periphery)) == true)
|
||||
{
|
||||
int base = 100 + ((20 * gGameOptions.nDifficulty) - (nDeltaAngle.Buildang() / 5));
|
||||
|
|
|
@ -527,7 +527,7 @@ void UpdateAimVector(PLAYER* pPlayer)
|
|||
if (lpos.Z - zRange > bottom || lpos.Z + zRange < top)
|
||||
continue;
|
||||
|
||||
DAngle angle = VecToAngle(dv);
|
||||
DAngle angle = dv.Angle();
|
||||
DAngle deltaangle = absangle(angle, plActor->spr.angle);
|
||||
if (deltaangle > DAngle::fromBuild(pWeaponTrack->thingAngle))
|
||||
continue;
|
||||
|
|
|
@ -1285,7 +1285,7 @@ void bounce(DDukeActor* actor)
|
|||
|
||||
actor->vel.Z = vect.Z;
|
||||
actor->vel.X = vect.XY().Length();
|
||||
actor->spr.angle = VecToAngle(vect);
|
||||
actor->spr.angle = vect.Angle();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
|
@ -604,7 +604,7 @@ double PlotCourseToSprite(DExhumedActor* pActor1, DExhumedActor* pActor2)
|
|||
return -1;
|
||||
|
||||
auto vect = pActor2->spr.pos.XY() - pActor1->spr.pos.XY();
|
||||
pActor1->spr.angle = VecToAngle(vect);
|
||||
pActor1->spr.angle = vect.Angle();
|
||||
return vect.Length();
|
||||
|
||||
}
|
||||
|
@ -769,7 +769,7 @@ void MoveSector(sectortype* pSector, DAngle nAngle, DVector2& nVel)
|
|||
if (nAngle < nullAngle)
|
||||
{
|
||||
nVect = nVel;
|
||||
nAngle = VecToAngle(nVect);
|
||||
nAngle = nVect.Angle();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1002,7 +1002,7 @@ Collision AngleChase(DExhumedActor* pActor, DExhumedActor* pActor2, int threshol
|
|||
{
|
||||
double nHeight = GetActorHeight(pActor2) / 2;
|
||||
auto vect = pActor2->spr.pos.XY() - pActor->spr.pos.XY();
|
||||
DAngle nMyAngle = VecToAngle(vect);
|
||||
DAngle nMyAngle = vect.Angle();
|
||||
double nSqrt = vect.Length();
|
||||
DAngle nPitch = VecToAngle(nSqrt, (pActor2->spr.pos.Z - nHeight - pActor->spr.pos.Z) / 16.);
|
||||
|
||||
|
|
|
@ -857,7 +857,7 @@ bool CheckMovingBlocks(int nPlayer, Collision& nMove, DVector3& spr_pos, sectort
|
|||
PlayerList[nPlayer].pPlayerPushSect = sect;
|
||||
|
||||
DVector2 vel = sPlayerInput[nPlayer].vel;
|
||||
auto nMyAngle = VecToAngle(vel).Normalized360();
|
||||
auto nMyAngle = vel.Angle().Normalized360();
|
||||
|
||||
setsectinterpolate(sect);
|
||||
MoveSector(sect, nMyAngle, vel);
|
||||
|
|
|
@ -334,7 +334,7 @@ Collision QueenAngleChase(DExhumedActor* pActor, DExhumedActor* pActor2, int thr
|
|||
double edx = ((pActor2->spr.pos.Z - nTileY) - pActor->spr.pos.Z);
|
||||
double nSqrt = vect.Length();
|
||||
|
||||
DAngle nMyAngle = VecToAngle(vect);
|
||||
DAngle nMyAngle = vect.Angle();
|
||||
DAngle nPitch = VecToAngle(nSqrt * 16, edx);
|
||||
DAngle nAngDelta = deltaangle(pActor->spr.angle, nMyAngle);
|
||||
|
||||
|
|
|
@ -1783,7 +1783,7 @@ int runlist_CheckRadialDamage(DExhumedActor* pActor)
|
|||
}
|
||||
else if (edi > 20)
|
||||
{
|
||||
auto nAngle = VecToAngle(pos);
|
||||
auto nAngle = pos.Angle();
|
||||
pActor->vel.XY() += nAngle.ToVector() * edi * 128;
|
||||
|
||||
pActor->vel.Z = (- edi * 24) / 256.;
|
||||
|
|
|
@ -1079,7 +1079,7 @@ int DoRipperBeginJumpAttack(DSWActor* actor)
|
|||
if (coll.type != kHitNone)
|
||||
actor->spr.angle += RandomAngle(DAngle45) + DAngle180 - DAngle22_5;
|
||||
else
|
||||
actor->spr.angle = VecToAngle(vec) + RandomAngle(DAngle45) - DAngle22_5;
|
||||
actor->spr.angle = vec.Angle() + RandomAngle(DAngle45) - DAngle22_5;
|
||||
|
||||
DoActorSetSpeed(actor, FAST_SPEED);
|
||||
|
||||
|
|
|
@ -1086,7 +1086,7 @@ int DoRipper2BeginJumpAttack(DSWActor* actor)
|
|||
if (coll.type != kHitNone)
|
||||
actor->spr.angle += RandomAngle(DAngle45) + DAngle180 - DAngle22_5;
|
||||
else
|
||||
actor->spr.angle = VecToAngle(vec);
|
||||
actor->spr.angle = vec.Angle();
|
||||
|
||||
DoActorSetSpeed(actor, FAST_SPEED);
|
||||
|
||||
|
|
|
@ -275,7 +275,7 @@ bool FAFcansee(const DVector3& start, sectortype* sects, const DVector3& end, se
|
|||
|
||||
// get angle
|
||||
DVector3 diff = end - start;
|
||||
DAngle ang = VecToAngle(diff);
|
||||
DAngle ang = diff.Angle();
|
||||
DVector3 vect;
|
||||
vect.XY() = ang.ToVector() * 1024;
|
||||
double dist = diff.XY().Length();
|
||||
|
|
|
@ -12839,7 +12839,7 @@ int WeaponAutoAim(DSWActor* actor, DSWActor* mislActor, DAngle ang, bool test)
|
|||
hitActor->user.Flags |= (SPR_ATTACKED);
|
||||
|
||||
auto delta = hitActor->spr.pos.XY() - mislActor->spr.pos.XY();
|
||||
mislActor->spr.angle = VecToAngle(delta);
|
||||
mislActor->spr.angle = delta.Angle();
|
||||
double dist = delta.Length();
|
||||
|
||||
if (dist != 0)
|
||||
|
@ -12935,7 +12935,7 @@ DSWActor* AimHitscanToTarget(DSWActor* actor, double *z, DAngle *ang, double z_r
|
|||
hitActor->user.Flags |= (SPR_ATTACKED);
|
||||
|
||||
auto delta = hitActor->spr.pos.XY() - actor->spr.pos.XY();
|
||||
*ang = VecToAngle(delta);
|
||||
*ang = delta.Angle();
|
||||
|
||||
// find the distance to the target
|
||||
double dist = delta.Length();
|
||||
|
@ -13022,7 +13022,7 @@ DSWActor* WeaponAutoAimHitscan(DSWActor* actor, double *z, DAngle *ang, bool tes
|
|||
void WeaponHitscanShootFeet(DSWActor* actor, DSWActor* hitActor, double *zvect)
|
||||
{
|
||||
auto delta = hitActor->spr.pos.XY() - actor->spr.pos.XY();
|
||||
DAngle ang = VecToAngle(delta);
|
||||
DAngle ang = delta.Angle();
|
||||
|
||||
// find the distance to the target
|
||||
double dist = delta.Length();
|
||||
|
|
Loading…
Reference in a new issue