Add SQUARE macro to improve readibility for distances

This commit is contained in:
LagoLunatic
2025-08-08 21:51:30 -04:00
parent b24d8574cd
commit 5802571a56
37 changed files with 107 additions and 106 deletions
+2 -2
View File
@@ -321,7 +321,7 @@ BOOL daNh_c::checkEscapeEnd() {
setAction(&daNh_c::waitAction, NULL);
return TRUE;
}
if (homeDelta.abs2XZ() > l_HIO.prm.mMaxHomeDist*l_HIO.prm.mMaxHomeDist) {
if (homeDelta.abs2XZ() > SQUARE(l_HIO.prm.mMaxHomeDist)) {
setAction(&daNh_c::returnAction, NULL);
return TRUE;
}
@@ -366,7 +366,7 @@ BOOL daNh_c::returnAction(void*) {
} else {
s16 targetAngle = cLib_targetAngleY(&current.pos, &home.pos);
cXyz homeDelta = home.pos - current.pos;
if (homeDelta.abs2XZ() < l_HIO.prm.mMaxHomeDist*l_HIO.prm.mMaxHomeDist) {
if (homeDelta.abs2XZ() < SQUARE(l_HIO.prm.mMaxHomeDist)) {
s16 angle = targetAngle - fopAcM_searchPlayerAngleY(this);
if (abs(angle) < 0x1000) {
if (angle < 0) {