Simplify daNpc_Zl1_c::setFrontWallType

This commit is contained in:
LagoLunatic
2026-03-14 19:21:48 -04:00
parent 73c7b44d57
commit 70a0a15b35
+13 -65
View File
@@ -2052,47 +2052,15 @@ void daNpc_Zl1_c::setEff() {
/* 00004118-0000498C .text setFrontWallType__11daNpc_Zl1_cFv */
BOOL daNpc_Zl1_c::setFrontWallType() {
BOOL ret;
f32 sin = cM_ssin(shape_angle.y);
f32 cos = cM_scos(shape_angle.y);
dBgS_LinChk linChk;
dBgS_ObjRoofChk roofChk;
cXyz temp;
cXyz temp2;
f32 tempX;
f32 tempY;
f32 tempZ;
#if VERSION > VERSION_DEMO
temp.set(current.pos.x, current.pos.y + mAcchCir.GetWallH(), current.pos.z);
#else
tempZ = current.pos.z;
tempY = current.pos.y + mAcchCir.GetWallH();
tempX = current.pos.x;
temp.set(tempX, tempY, tempZ);
#endif
f32 wallRadius = mAcchCir.GetWallR() + 25.0f;
#if VERSION > VERSION_DEMO
tempX = temp.x;
tempY = temp.y;
tempZ = temp.z;
tempZ += cos * wallRadius;
tempX += sin * wallRadius;
temp2.set(tempX, tempY, tempZ);
// temp2.set(temp.z + sin * wallRadius, temp.y, temp.z + cos * wallRadius);
#else
f32 tempZ2 = temp.z + cos * wallRadius;
f32 tempY2 = temp.y;
f32 tempX2 = temp.x + sin * wallRadius;
temp2.set(tempX2, tempY2, tempZ2);
#endif
linChk.Set(&temp, &temp2, this);
cXyz sp14(current.pos.x, current.pos.y + mAcchCir.GetWallH(), current.pos.z);
cXyz sp08(sp14.x + sin * (mAcchCir.GetWallR() + 25.0f), sp14.y, sp14.z + cos * (mAcchCir.GetWallR() + 25.0f));
linChk.Set(&sp14, &sp08, this);
if (!dComIfG_Bgsp()->LineCross(&linChk)) {
return FALSE;
@@ -2103,38 +2071,18 @@ BOOL daNpc_Zl1_c::setFrontWallType() {
return FALSE;
}
f32 tempX3;
f32 tempY3;
f32 tempZ3;
tempZ3 = current.pos.z;
tempY3 = current.pos.y + 70.0f + 0.1f;
tempX3 = current.pos.x;
sp14.set(current.pos.x, current.pos.y + 70.0f + 0.1f, current.pos.z);
sp08.set(sp14.x + sin * (mAcchCir.GetWallR() + 25.0f), sp14.y, sp14.z + cos * (mAcchCir.GetWallR() + 25.0f));
linChk.Set(&sp14, &sp08, this);
temp.set(tempX3, tempY3, tempZ3);
#if VERSION > VERSION_DEMO
f32 wallRadius2 = mAcchCir.GetWallR() + 25.0f;
tempZ = temp.z + cos * wallRadius2;
tempY = temp.y;
tempX = temp.x + sin * wallRadius2;
temp2.set(tempX, tempY, tempZ);
#else
wallRadius = mAcchCir.GetWallR() + 25.0f;
f32 tempZ4 = temp.z + cos * wallRadius;
f32 tempY4 = temp.y;
f32 tempX4 = temp.x + sin * wallRadius;
temp2.set(tempX4, tempY4, tempZ4);
#endif
linChk.Set(&temp, &temp2, this);
ret = dComIfG_Bgsp()->LineCross(&linChk);
BOOL ret = dComIfG_Bgsp()->LineCross(&linChk);
if (!ret) {
roofChk.SetPos(current.pos);
ret = dComIfG_Bgsp()->RoofChk(&roofChk) - current.pos.y > 80.0f ? FALSE : TRUE;
if (dComIfG_Bgsp()->RoofChk(&roofChk) - current.pos.y > 80.0f) {
ret = FALSE;
} else {
ret = TRUE;
}
}
return ret == FALSE;