diff --git a/source/core/rendering/scene/hw_walls.cpp b/source/core/rendering/scene/hw_walls.cpp index 40e1c2b6f..4d3a0ae86 100644 --- a/source/core/rendering/scene/hw_walls.cpp +++ b/source/core/rendering/scene/hw_walls.cpp @@ -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. diff --git a/source/games/blood/src/ai.cpp b/source/games/blood/src/ai.cpp index 376b44f84..0f3623ccc 100644 --- a/source/games/blood/src/ai.cpp +++ b/source/games/blood/src/ai.cpp @@ -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); diff --git a/source/games/blood/src/aibat.cpp b/source/games/blood/src/aibat.cpp index 2f827613a..7704ff86d 100644 --- a/source/games/blood/src/aibat.cpp +++ b/source/games/blood/src/aibat.cpp @@ -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); diff --git a/source/games/blood/src/aibeast.cpp b/source/games/blood/src/aibeast.cpp index 2d6716d07..71da4ef30 100644 --- a/source/games/blood/src/aibeast.cpp +++ b/source/games/blood/src/aibeast.cpp @@ -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); diff --git a/source/games/blood/src/aiboneel.cpp b/source/games/blood/src/aiboneel.cpp index 887b73687..2364bcf25 100644 --- a/source/games/blood/src/aiboneel.cpp +++ b/source/games/blood/src/aiboneel.cpp @@ -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) diff --git a/source/games/blood/src/aiburn.cpp b/source/games/blood/src/aiburn.cpp index e55e673a6..fa524c8f8 100644 --- a/source/games/blood/src/aiburn.cpp +++ b/source/games/blood/src/aiburn.cpp @@ -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); diff --git a/source/games/blood/src/aicaleb.cpp b/source/games/blood/src/aicaleb.cpp index ca7e1bb7d..2731feda8 100644 --- a/source/games/blood/src/aicaleb.cpp +++ b/source/games/blood/src/aicaleb.cpp @@ -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); diff --git a/source/games/blood/src/aicerber.cpp b/source/games/blood/src/aicerber.cpp index 7938674f7..a16792b8a 100644 --- a/source/games/blood/src/aicerber.cpp +++ b/source/games/blood/src/aicerber.cpp @@ -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); diff --git a/source/games/blood/src/aicult.cpp b/source/games/blood/src/aicult.cpp index 26a3555d5..ac4107b33 100644 --- a/source/games/blood/src/aicult.cpp +++ b/source/games/blood/src/aicult.cpp @@ -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) diff --git a/source/games/blood/src/aigarg.cpp b/source/games/blood/src/aigarg.cpp index fecf70bdb..349d55038 100644 --- a/source/games/blood/src/aigarg.cpp +++ b/source/games/blood/src/aigarg.cpp @@ -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()) diff --git a/source/games/blood/src/aighost.cpp b/source/games/blood/src/aighost.cpp index 62a81c646..bfc514c24 100644 --- a/source/games/blood/src/aighost.cpp +++ b/source/games/blood/src/aighost.cpp @@ -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()) diff --git a/source/games/blood/src/aigilbst.cpp b/source/games/blood/src/aigilbst.cpp index 07b87634b..7030f2ce8 100644 --- a/source/games/blood/src/aigilbst.cpp +++ b/source/games/blood/src/aigilbst.cpp @@ -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); diff --git a/source/games/blood/src/aihand.cpp b/source/games/blood/src/aihand.cpp index 07dda7476..0adfc4db7 100644 --- a/source/games/blood/src/aihand.cpp +++ b/source/games/blood/src/aihand.cpp @@ -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) diff --git a/source/games/blood/src/aihound.cpp b/source/games/blood/src/aihound.cpp index e9fb32521..1dc3897e3 100644 --- a/source/games/blood/src/aihound.cpp +++ b/source/games/blood/src/aihound.cpp @@ -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) diff --git a/source/games/blood/src/aiinnoc.cpp b/source/games/blood/src/aiinnoc.cpp index 03730b64b..21a96bb6b 100644 --- a/source/games/blood/src/aiinnoc.cpp +++ b/source/games/blood/src/aiinnoc.cpp @@ -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) diff --git a/source/games/blood/src/aipod.cpp b/source/games/blood/src/aipod.cpp index 551c0d175..62f99b19b 100644 --- a/source/games/blood/src/aipod.cpp +++ b/source/games/blood/src/aipod.cpp @@ -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) { diff --git a/source/games/blood/src/airat.cpp b/source/games/blood/src/airat.cpp index dc38cf2d9..07ff65f27 100644 --- a/source/games/blood/src/airat.cpp +++ b/source/games/blood/src/airat.cpp @@ -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) diff --git a/source/games/blood/src/aispid.cpp b/source/games/blood/src/aispid.cpp index a537c4def..e81a7c2eb 100644 --- a/source/games/blood/src/aispid.cpp +++ b/source/games/blood/src/aispid.cpp @@ -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) diff --git a/source/games/blood/src/aitchern.cpp b/source/games/blood/src/aitchern.cpp index cd8805b68..fb0dbb11a 100644 --- a/source/games/blood/src/aitchern.cpp +++ b/source/games/blood/src/aitchern.cpp @@ -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) diff --git a/source/games/blood/src/aiunicult.cpp b/source/games/blood/src/aiunicult.cpp index d5f636934..6c7f5d31b 100644 --- a/source/games/blood/src/aiunicult.cpp +++ b/source/games/blood/src/aiunicult.cpp @@ -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, diff --git a/source/games/blood/src/aizomba.cpp b/source/games/blood/src/aizomba.cpp index a4aff2bae..56529a2e0 100644 --- a/source/games/blood/src/aizomba.cpp +++ b/source/games/blood/src/aizomba.cpp @@ -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); diff --git a/source/games/blood/src/aizombf.cpp b/source/games/blood/src/aizombf.cpp index 0b3f83eed..078266d8b 100644 --- a/source/games/blood/src/aizombf.cpp +++ b/source/games/blood/src/aizombf.cpp @@ -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) { diff --git a/source/games/blood/src/nnexts.cpp b/source/games/blood/src/nnexts.cpp index 672cf1bec..33f6ea2b6 100644 --- a/source/games/blood/src/nnexts.cpp +++ b/source/games/blood/src/nnexts.cpp @@ -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)); diff --git a/source/games/blood/src/weapon.cpp b/source/games/blood/src/weapon.cpp index f23120b70..ea667fb36 100644 --- a/source/games/blood/src/weapon.cpp +++ b/source/games/blood/src/weapon.cpp @@ -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; diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index 3507685b8..bb97cd7d7 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -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(); } //--------------------------------------------------------------------------- diff --git a/source/games/exhumed/src/move.cpp b/source/games/exhumed/src/move.cpp index 518505d65..fcdf1751a 100644 --- a/source/games/exhumed/src/move.cpp +++ b/source/games/exhumed/src/move.cpp @@ -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.); diff --git a/source/games/exhumed/src/player.cpp b/source/games/exhumed/src/player.cpp index 5b6250805..aad34d81a 100644 --- a/source/games/exhumed/src/player.cpp +++ b/source/games/exhumed/src/player.cpp @@ -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); diff --git a/source/games/exhumed/src/queen.cpp b/source/games/exhumed/src/queen.cpp index 20add8ca2..84484ea05 100644 --- a/source/games/exhumed/src/queen.cpp +++ b/source/games/exhumed/src/queen.cpp @@ -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); diff --git a/source/games/exhumed/src/runlist.cpp b/source/games/exhumed/src/runlist.cpp index 011f2d641..ef3ae6cf6 100644 --- a/source/games/exhumed/src/runlist.cpp +++ b/source/games/exhumed/src/runlist.cpp @@ -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.; diff --git a/source/games/sw/src/ripper.cpp b/source/games/sw/src/ripper.cpp index 223e7b33a..520f83e1d 100644 --- a/source/games/sw/src/ripper.cpp +++ b/source/games/sw/src/ripper.cpp @@ -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); diff --git a/source/games/sw/src/ripper2.cpp b/source/games/sw/src/ripper2.cpp index ed0867854..af5312bb1 100644 --- a/source/games/sw/src/ripper2.cpp +++ b/source/games/sw/src/ripper2.cpp @@ -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); diff --git a/source/games/sw/src/rooms.cpp b/source/games/sw/src/rooms.cpp index 1aeccb7d1..c4970cdbc 100644 --- a/source/games/sw/src/rooms.cpp +++ b/source/games/sw/src/rooms.cpp @@ -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(); diff --git a/source/games/sw/src/weapon.cpp b/source/games/sw/src/weapon.cpp index 27af21171..2d7c4a1b9 100644 --- a/source/games/sw/src/weapon.cpp +++ b/source/games/sw/src/weapon.cpp @@ -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();