diff --git a/include/SSystem/SComponent/c_bg_s.h b/include/SSystem/SComponent/c_bg_s.h index 577d0e7af..340820277 100644 --- a/include/SSystem/SComponent/c_bg_s.h +++ b/include/SSystem/SComponent/c_bg_s.h @@ -4,7 +4,8 @@ #include "SSystem/SComponent/c_bg_s_poly_info.h" #include "dolphin/types.h" -#define C_BG_INVALID_HEIGHT (-1e+9f) +#define C_BG_MIN_HEIGHT (-1e+9f) +#define C_BG_MAX_HEIGHT (1e+9f) class fopAc_ac_c; class cBgS_ShdwDraw; diff --git a/include/SSystem/SComponent/c_m3d_g_aab.h b/include/SSystem/SComponent/c_m3d_g_aab.h index 33a936835..8d0b0b1eb 100644 --- a/include/SSystem/SComponent/c_m3d_g_aab.h +++ b/include/SSystem/SComponent/c_m3d_g_aab.h @@ -1,6 +1,7 @@ #ifndef C_M3D_G_AAB_H #define C_M3D_G_AAB_H +#include "SSystem/SComponent/c_bg_s.h" #include "SSystem/SComponent/c_xyz.h" #include "SSystem/SComponent/c_m3d.h" #include "SSystem/SComponent/c_m3d_g_lin.h" @@ -61,8 +62,8 @@ public: mMax.x = -1000000000.0f; } void ClearForMinMaxY() { - mMin.y = 1000000000.0f; - mMax.y = -1000000000.0f; + mMin.y = C_BG_MAX_HEIGHT; + mMax.y = C_BG_MIN_HEIGHT; } void SetMinMaxY(f32 y) { if (mMin.y > y) { diff --git a/include/d/actor/d_a_bomb.h b/include/d/actor/d_a_bomb.h index 90da2711d..7fc4ca49d 100644 --- a/include/d/actor/d_a_bomb.h +++ b/include/d/actor/d_a_bomb.h @@ -1,8 +1,7 @@ #ifndef D_A_BOMB_H #define D_A_BOMB_H -#include "f_op/f_op_actor_mng.h" -#include "d/d_a_obj.h" +#include "f_op/f_op_actor.h" #include "d/d_particle.h" #include "d/d_bg_s_acch.h" #include "d/d_cc_d.h" @@ -178,7 +177,9 @@ private: /* 0x2FC */ dBgS_BombAcch mAcch; /* 0x4C0 */ dBgS_AcchCir mCir; /* 0x500 */ dBgS_ObjGndChk_Yogan mGndChk; - /* 0x554 */ cXyz field_0x554; + /* 0x554 */ f32 field_0x554; + /* 0x558 */ f32 field_0x558; + /* 0x55C */ f32 field_0x55C; /* 0x560 */ bool field_0x560; /* 0x561 */ bool mbWaterIn; /* 0x562 */ u8 field_0x562; diff --git a/include/d/actor/d_a_bomb2.h b/include/d/actor/d_a_bomb2.h index e7edf60bd..45ab22533 100644 --- a/include/d/actor/d_a_bomb2.h +++ b/include/d/actor/d_a_bomb2.h @@ -1,8 +1,7 @@ #ifndef D_A_BOMB_2_H #define D_A_BOMB_2_H -#include "f_op/f_op_actor_mng.h" -#include "d/d_a_obj.h" +#include "f_op/f_op_actor.h" #include "d/d_particle.h" #include "d/d_bg_s_acch.h" #include "d/d_cc_d.h" diff --git a/include/d/d_bg_s.h b/include/d/d_bg_s.h index eebed39a6..3fbeb322d 100644 --- a/include/d/d_bg_s.h +++ b/include/d/d_bg_s.h @@ -121,7 +121,7 @@ public: mWallRadius = 0.0f; pm_pos = NULL; pm_old_pos = NULL; - mGroundH = C_BG_INVALID_HEIGHT; + mGroundH = C_BG_MIN_HEIGHT; field_0x60 = 0; field_0x68 = 20.0f; field_0x58 = NULL; diff --git a/include/d/d_com_inf_game.h b/include/d/d_com_inf_game.h index 3f8025fbe..24625bdaa 100644 --- a/include/d/d_com_inf_game.h +++ b/include/d/d_com_inf_game.h @@ -2982,10 +2982,10 @@ int dComIfGd_setShadow(u32 id, s8 param_2, J3DModel* pModel, cXyz* pPos, f32 par s16 rotY = 0, f32 param_12 = 1.0f, GXTexObj* pTexObj = dDlst_shadowControl_c::getSimpleTex()); -inline int dComIfGd_setSimpleShadow(cXyz* i_pos, f32 param_1, f32 param_2, cXyz* param_3, +inline int dComIfGd_setSimpleShadow(cXyz* i_pos, f32 groundY, f32 param_2, cXyz* param_3, s16 i_angle = 0, f32 param_5 = 1.0f, GXTexObj* i_tex = dDlst_shadowControl_c::getSimpleTex()) { - return g_dComIfG_gameInfo.drawlist.setSimpleShadow(i_pos, param_1, param_2, param_3, i_angle, + return g_dComIfG_gameInfo.drawlist.setSimpleShadow(i_pos, groundY, param_2, param_3, i_angle, param_5, i_tex); } diff --git a/include/d/d_drawlist.h b/include/d/d_drawlist.h index d5ddc38e6..56a5bb268 100644 --- a/include/d/d_drawlist.h +++ b/include/d/d_drawlist.h @@ -551,9 +551,9 @@ public: void drawXluListInvisible() { drawXluDrawList(mpXluListInvisible); } void drawOpaList2D() { drawOpaDrawList(mpOpaList2D); } - int setSimpleShadow(cXyz* i_pos, f32 param_1, f32 param_2, cXyz* param_3, s16 i_angle, + int setSimpleShadow(cXyz* i_pos, f32 groundY, f32 param_2, cXyz* param_3, s16 i_angle, f32 param_5, GXTexObj* i_tex) { - return mShadowControl.setSimple(i_pos, param_1, param_2, param_3, i_angle, param_5, + return mShadowControl.setSimple(i_pos, groundY, param_2, param_3, i_angle, param_5, i_tex); } int setRealShadow(u32 id, s8 param_2, J3DModel* pModel, cXyz* pPos, f32 param_5, f32 param_6, diff --git a/src/SSystem/SComponent/c_bg_s.cpp b/src/SSystem/SComponent/c_bg_s.cpp index b2e3ffc6e..83836432a 100644 --- a/src/SSystem/SComponent/c_bg_s.cpp +++ b/src/SSystem/SComponent/c_bg_s.cpp @@ -128,7 +128,7 @@ bool cBgS::LineCross(cBgS_LinChk* chk) { /* 802468E4-80246A14 .text GroundCross__4cBgSFP11cBgS_GndChk */ f32 cBgS::GroundCross(cBgS_GndChk* chk) { - chk->SetNowY(C_BG_INVALID_HEIGHT); + chk->SetNowY(C_BG_MIN_HEIGHT); chk->ClearPi(); chk->mWallPrecheck = (chk->mFlag & 0x02); chk->mGndPrecheck = (chk->mFlag & 0x01); diff --git a/src/SSystem/SComponent/c_m3d_g_aab.cpp b/src/SSystem/SComponent/c_m3d_g_aab.cpp index 80d2519b0..1d89a2434 100644 --- a/src/SSystem/SComponent/c_m3d_g_aab.cpp +++ b/src/SSystem/SComponent/c_m3d_g_aab.cpp @@ -4,7 +4,6 @@ // #include "SSystem/SComponent/c_m3d_g_aab.h" -#include "dolphin/types.h" /* 80251CC4-80251D08 .text SetMinMax__8cM3dGAabFRC4cXyz */ void cM3dGAab::SetMinMax(const cXyz& pMinMax) { diff --git a/src/d/actor/d_a_agb.cpp b/src/d/actor/d_a_agb.cpp index e8ee08b5e..2387c76a4 100644 --- a/src/d/actor/d_a_agb.cpp +++ b/src/d/actor/d_a_agb.cpp @@ -1310,7 +1310,7 @@ void daAgb_c::CursorMove(fopAc_ac_c* actor, u32 stage_type) { cXyz r1_14; dBgS_GndChk r1_5C; - f32 f30 = C_BG_INVALID_HEIGHT; + f32 f30 = C_BG_MIN_HEIGHT; r1_5C.OffWall(); r1_14.y = actor->current.pos.y + 150.0f; static cXy l_ckOffset[] = { diff --git a/src/d/actor/d_a_am2.cpp b/src/d/actor/d_a_am2.cpp index 01948b4cc..adb58c791 100644 --- a/src/d/actor/d_a_am2.cpp +++ b/src/d/actor/d_a_am2.cpp @@ -387,7 +387,7 @@ static BOOL Line_check(am2_class* i_this, cXyz destPos) { /* 0000177C-00001A24 .text naraku_check__FP9am2_class */ static BOOL naraku_check(am2_class* i_this) { // Checks if the Armos has fallen into an abyss. - if (i_this->mAcch.GetGroundH() != -1000000000.0f && + if (i_this->mAcch.GetGroundH() != C_BG_MIN_HEIGHT && dComIfG_Bgsp()->ChkPolySafe(i_this->mAcch.m_gnd) && dComIfG_Bgsp()->GetGroundCode(i_this->mAcch.m_gnd) == 4) // Abyss ground code { diff --git a/src/d/actor/d_a_arrow.cpp b/src/d/actor/d_a_arrow.cpp index d6ba1b183..c3ffce425 100644 --- a/src/d/actor/d_a_arrow.cpp +++ b/src/d/actor/d_a_arrow.cpp @@ -514,7 +514,7 @@ void daArrow_c::setRoomInfo() { mGndChk.SetPos(¤t.pos); f32 groundY = dComIfG_Bgsp()->GroundCross(&mGndChk); - if (groundY != -1000000000.0f) { + if (groundY != C_BG_MIN_HEIGHT) { roomNo = dComIfG_Bgsp()->GetRoomId(mGndChk); tevStr.mEnvrIdxOverride = dComIfG_Bgsp()->GetPolyColor(mGndChk); } else { diff --git a/src/d/actor/d_a_bk.cpp b/src/d/actor/d_a_bk.cpp index e8081a6b8..fd42d11ec 100644 --- a/src/d/actor/d_a_bk.cpp +++ b/src/d/actor/d_a_bk.cpp @@ -625,8 +625,8 @@ static u8 ground_4_check(bk_class* i_this, int r18, s16 r20, f32 f29) { sp8 += i_this->current.pos; gndChk.SetPos(&sp8); sp8.y = dComIfG_Bgsp()->GroundCross(&gndChk); - if (sp8.y == -1e9f) { - sp8.y = 1e9f; + if (sp8.y == C_BG_MIN_HEIGHT) { + sp8.y = C_BG_MAX_HEIGHT; } if (i_this->dr.mAcch.GetGroundH() - sp8.y > 200.0f) { r19 |= check_bit[i]; @@ -3225,14 +3225,14 @@ static BOOL daBk_Execute(bk_class* i_this) { sp28.y += 50.0f - i_this->dr.m44C.y; gndChk.SetPos(&sp28); sp28.y = dComIfG_Bgsp()->GroundCross(&gndChk); - if (sp28.y != -1e9f) { + if (sp28.y != C_BG_MIN_HEIGHT) { Vec temp; temp.x = sp28.x; temp.y = 50.0f + sp28.y; temp.z = sp28.z + f31; gndChk.SetPos(&temp); f32 f1 = dComIfG_Bgsp()->GroundCross(&gndChk); - if (f1 != -1e9f) { + if (f1 != C_BG_MIN_HEIGHT) { r21 = (s16)-cM_atan2s(f1 - sp28.y, temp.z - sp28.z); if (r21 > 0x2000 || r21 < -0x2000) { r21 = 0; @@ -3243,7 +3243,7 @@ static BOOL daBk_Execute(bk_class* i_this) { temp.z = sp28.z; gndChk.SetPos(&temp); f1 = dComIfG_Bgsp()->GroundCross(&gndChk); - if (f1 != -1e9f) { + if (f1 != C_BG_MIN_HEIGHT) { r23 = (s16)cM_atan2s(f1 - sp28.y, temp.x - sp28.x); if (r23 > 0x2000 || r23 < -0x2000) { r23 = 0; diff --git a/src/d/actor/d_a_boko.cpp b/src/d/actor/d_a_boko.cpp index fc594d802..4d2b79af6 100644 --- a/src/d/actor/d_a_boko.cpp +++ b/src/d/actor/d_a_boko.cpp @@ -69,7 +69,7 @@ void daBoko_c::setFlameEffect() { /* 00001340-000013CC .text setRoomInfo__8daBoko_cFv */ void daBoko_c::setRoomInfo() { int roomNo; - if (mAcch.GetGroundH() != -1e9f) { + if (mAcch.GetGroundH() != C_BG_MIN_HEIGHT) { roomNo = dComIfG_Bgsp()->GetRoomId(mAcch.m_gnd); tevStr.mEnvrIdxOverride = dComIfG_Bgsp()->GetPolyColor(mAcch.m_gnd); } else { @@ -194,7 +194,7 @@ BOOL daBoko_c::procCarry() { int i; for (i = 0; i < 3; i++) { m_ground_check.SetPos(¤t.pos); - if (dComIfG_Bgsp()->GroundCross(&m_ground_check) != -1e9f) { + if (dComIfG_Bgsp()->GroundCross(&m_ground_check) != C_BG_MIN_HEIGHT) { break; } current.pos.x -= 50.0f * cM_ssin(shape_angle.y); diff --git a/src/d/actor/d_a_bomb2.cpp b/src/d/actor/d_a_bomb2.cpp index 9f51e2356..734cc1a62 100644 --- a/src/d/actor/d_a_bomb2.cpp +++ b/src/d/actor/d_a_bomb2.cpp @@ -6,6 +6,7 @@ #include "d/actor/d_a_bomb2.h" #include "d/actor/d_a_sea.h" #include "d/actor/d_a_player.h" +#include "d/d_a_obj.h" #include "d/d_procname.h" #include "d/d_kankyo_wether.h" #include "d/d_com_inf_game.h" @@ -292,12 +293,12 @@ namespace daBomb2 { mAcch.ClrRoofNone(); mAcch.m_roof_crr_height = 50.0f; mAcch.OnLineCheck(); - field_0x51C = -1.0e9f; - field_0x520 = -1.0e9f; + field_0x51C = C_BG_MIN_HEIGHT; + field_0x520 = C_BG_MIN_HEIGHT; field_0x524 = 0; mbWaterIn = 0; field_0x526 = 0; - field_0x528 = -1.0e9f; + field_0x528 = C_BG_MIN_HEIGHT; } dCcD_SrcSph Act_c::M_sph_src = { @@ -553,7 +554,7 @@ namespace daBomb2 { r5 = true; field_0x526 = 1; } else { - field_0x520 = -1e9f; + field_0x520 = C_BG_MIN_HEIGHT; field_0x526 = 0; } mbWaterIn = r5; @@ -564,7 +565,7 @@ namespace daBomb2 { } bool Act_c::chk_lava_in() const { - if(field_0x51C == -1.0e9f) { + if(field_0x51C == C_BG_MIN_HEIGHT) { return false; } @@ -573,7 +574,7 @@ namespace daBomb2 { void Act_c::setRoomInfo() { s32 roomNo; - if(mAcch.GetGroundH() != -1.0e9f) { + if(mAcch.GetGroundH() != C_BG_MIN_HEIGHT) { roomNo = dComIfG_Bgsp()->GetRoomId(mAcch.m_gnd); tevStr.mEnvrIdxOverride = dComIfG_Bgsp()->GetPolyColor(mAcch.m_gnd); } @@ -1092,7 +1093,7 @@ namespace daBomb2 { void Act_c::mode_sink() { f32 temp; bool temp2 = fopAcM_getWaterY(¤t.pos, &temp); - if(temp2 && field_0x528 != -1.0e9f && --field_0x698 > 0) { + if(temp2 && field_0x528 != C_BG_MIN_HEIGHT && --field_0x698 > 0) { current.pos.y += temp - field_0x528; field_0x528 = temp; posMoveF(); diff --git a/src/d/actor/d_a_bomb3.inc b/src/d/actor/d_a_bomb3.inc index cbcead242..6ce3a9866 100644 --- a/src/d/actor/d_a_bomb3.inc +++ b/src/d/actor/d_a_bomb3.inc @@ -4,6 +4,7 @@ #include "d/actor/d_a_bomb.h" #include "SSystem/SComponent/c_counter.h" +#include "d/d_a_obj.h" #include "d/d_com_inf_game.h" #include "d/d_procname.h" #include "d/actor/d_a_player_main.h" @@ -198,7 +199,7 @@ BOOL daBomb_c::draw() { draw_norm(); } - if(fopAcM_GetModel(this) == 0 && mAcch.GetGroundH() != -1.0e9f) { + if(fopAcM_GetModel(this) == 0 && mAcch.GetGroundH() != C_BG_MIN_HEIGHT) { cM3dGPla* pNormal = dComIfG_Bgsp()->GetTriPla(mAcch.m_gnd); if(pNormal) { dComIfGd_setSimpleShadow(¤t.pos, mAcch.GetGroundH(), 25.0f, pNormal->GetNP()); @@ -439,8 +440,8 @@ bool daBomb_c::checkExplodeBg() { /* 800DA320-800DA3A0 .text water_tention__8daBomb_cFv */ void daBomb_c::water_tention() { if(chk_water_in()) { - if(field_0x554.y != -1.0e9f && field_0x554.z != -1.0e9f) { - f32 temp = field_0x554.y - field_0x554.z; + if(field_0x558 != C_BG_MIN_HEIGHT && field_0x55C != C_BG_MIN_HEIGHT) { + f32 temp = field_0x558 - field_0x55C; current.pos.y += temp < 0.0f ? 0.8f * temp : 0.2f * temp; } } @@ -506,7 +507,7 @@ void daBomb_c::bgCrrPos_lava() { cXyz temp(current.pos.x, old.pos.y + 1.0f, current.pos.z); mGndChk.SetPos(&temp); - field_0x554.x = dComIfG_Bgsp()->GroundCross(&mGndChk); + field_0x554 = dComIfG_Bgsp()->GroundCross(&mGndChk); } /* 800DA5E0-800DA700 .text bgCrrPos_water__8daBomb_cFv */ @@ -517,7 +518,7 @@ void daBomb_c::bgCrrPos_water() { bool r4 = mAcch.ChkWaterIn(); bool r3 = r31 && current.pos.y < f1; bool r5 = false; - field_0x554.z = field_0x554.y; + field_0x55C = field_0x558; if (r4 && r3) { if (f31 > f1) { r3 = 0; @@ -526,15 +527,15 @@ void daBomb_c::bgCrrPos_water() { } } if (r4) { - field_0x554.y = f31; + field_0x558 = f31; r5 = true; field_0x562 = 0; } else if (r3) { - field_0x554.y = f1; + field_0x558 = f1; r5 = true; field_0x562 = 1; } else { - field_0x554.y = -1e9f; + field_0x558 = C_BG_MIN_HEIGHT; field_0x562 = 0; } field_0x560 = r5 && !mbWaterIn; @@ -555,21 +556,21 @@ bool daBomb_c::chk_water_in() { bool daBomb_c::chk_water_sink() { bool water = chk_water_in(); - return water && field_0x554.y - current.pos.y > 30.0f; + return water && field_0x558 - current.pos.y > 30.0f; } /* 800DA768-800DA794 .text chk_lava_hit__8daBomb_cFv */ bool daBomb_c::chk_lava_hit() { - if(field_0x554.x == -1.0e9f) { + if(field_0x554 == C_BG_MIN_HEIGHT) { return false; } - return current.pos.y < field_0x554.x; + return current.pos.y < field_0x554; } /* 800DA794-800DA7CC .text chk_dead_zone__8daBomb_cFv */ bool daBomb_c::chk_dead_zone() { - return mAcch.GetGroundH() == -1.0e9f && field_0x554.y == -1.0e9f && field_0x554.x == -1.0e9f; + return mAcch.GetGroundH() == C_BG_MIN_HEIGHT && field_0x558 == C_BG_MIN_HEIGHT && field_0x554 == C_BG_MIN_HEIGHT; } /* 800DA7CC-800DA8C8 .text bound__8daBomb_cFf */ @@ -630,7 +631,7 @@ void daBomb_c::set_real_shadow_flag() { /* 800DA9DC-800DAA60 .text setRoomInfo__8daBomb_cFv */ void daBomb_c::setRoomInfo() { s32 roomNo; - if(mAcch.GetGroundH() != -1.0e9f) { + if(mAcch.GetGroundH() != C_BG_MIN_HEIGHT) { roomNo = dComIfG_Bgsp()->GetRoomId(mAcch.m_gnd); tevStr.mEnvrIdxOverride = dComIfG_Bgsp()->GetPolyColor(mAcch.m_gnd); } @@ -1210,7 +1211,7 @@ void daBomb_c::se_cannon_fly_stop() { /* 800DC44C-800DC568 .text eff_water_splash__8daBomb_cFv */ void daBomb_c::eff_water_splash() { - cXyz pos(current.pos.x, field_0x554.y, current.pos.z); + cXyz pos(current.pos.x, field_0x558, current.pos.z); fopKyM_createWpillar(&pos, 0.5f, 0.75f, 0); cBgS_PolyInfo* temp[2] = { @@ -1399,7 +1400,9 @@ void daBomb_c::create_init() { mAcch.m_roof_crr_height = 50.0f; mAcch.OnLineCheck(); - field_0x554.setall(-1.0e9f); + field_0x554 = C_BG_MIN_HEIGHT; + field_0x558 = C_BG_MIN_HEIGHT; + field_0x55C = C_BG_MIN_HEIGHT; field_0x560 = 0; mbWaterIn = 0; field_0x562 = 0; diff --git a/src/d/actor/d_a_esa.cpp b/src/d/actor/d_a_esa.cpp index 689c2e021..ae80f8ce5 100644 --- a/src/d/actor/d_a_esa.cpp +++ b/src/d/actor/d_a_esa.cpp @@ -51,7 +51,7 @@ void bg_check(esa_class* i_this) { cXyz sp54 = i_this->current.pos; sp54.y += 100.0f; f32 waterHeight = dBgS_GetWaterHeight(sp54); - if(waterHeight != -1000000000.0f && i_this->mGroundHeight <= waterHeight) { + if(waterHeight != C_BG_MIN_HEIGHT && i_this->mGroundHeight <= waterHeight) { i_this->mGroundHeight = waterHeight; state = 2; } diff --git a/src/d/actor/d_a_ib.cpp b/src/d/actor/d_a_ib.cpp index 1da550291..017f8c2ed 100644 --- a/src/d/actor/d_a_ib.cpp +++ b/src/d/actor/d_a_ib.cpp @@ -201,19 +201,19 @@ void daIball_c::checkGeo() { (this->*mode_proc[mMode])(); - dBgS_ObjGndChk_Yogan gnd_chk; + dBgS_ObjGndChk_Yogan lavaChk; cXyz pos(current.pos.x, old.pos.y + 30.0f + m_data.mYOffset, current.pos.z); - gnd_chk.SetPos(&pos); - f32 groundY = dComIfG_Bgsp()->GroundCross(&gnd_chk); + lavaChk.SetPos(&pos); + f32 lavaY = dComIfG_Bgsp()->GroundCross(&lavaChk); f32 groundH = mAcch.GetGroundH(); - if (groundY != -1000000000.0f) { - f32 dist_off_gnd = groundY - groundH; - if ((dist_off_gnd < 20.0f && groundY > current.pos.y) || (dist_off_gnd >= 20.0f && groundY > current.pos.y + 20.0f)) { + if (lavaY != C_BG_MIN_HEIGHT) { + f32 lava_depth = lavaY - groundH; + if ((lava_depth < 20.0f && lavaY > current.pos.y) || (lava_depth >= 20.0f && lavaY > current.pos.y + 20.0f)) { fopAcM_seStartCurrent(this, JA_SE_OBJ_FALL_MAGMA_S, 0); cXyz particle_scale; particle_scale.setall(0.25f); cXyz particle_pos(current.pos); - particle_pos.y = groundY; + particle_pos.y = lavaY; dComIfGp_particle_set(dPa_name::ID_SCENE_80D5, &particle_pos, NULL, &particle_scale); fopAcM_delete(this); } @@ -238,7 +238,7 @@ void daIball_c::mode_wait() { } f32 seaHeight = mAcch.GetSeaHeight(); - if (seaHeight > current.pos.y && seaHeight != -1000000000.0f) { + if (seaHeight > current.pos.y && seaHeight != C_BG_MIN_HEIGHT) { mode_water_init(); current.pos.y = seaHeight; } @@ -254,10 +254,10 @@ void daIball_c::mode_water_init() { /* 800F3FE8-800F4054 .text mode_water__9daIball_cFv */ void daIball_c::mode_water() { f32 seaHeight = mAcch.GetSeaHeight(); - if (seaHeight == -1000000000.0f || seaHeight < current.pos.y) { + if (seaHeight == C_BG_MIN_HEIGHT || seaHeight < current.pos.y) { mode_wait_init(); } - if (seaHeight != -1000000000.0f) { + if (seaHeight != C_BG_MIN_HEIGHT) { current.pos.y = seaHeight; } } diff --git a/src/d/actor/d_a_item.cpp b/src/d/actor/d_a_item.cpp index 2cc266cbc..abc7af9ae 100644 --- a/src/d/actor/d_a_item.cpp +++ b/src/d/actor/d_a_item.cpp @@ -1296,12 +1296,12 @@ void daItem_c::mode_wait() { mode_water_init(); } - dBgS_ObjGndChk_Yogan gndChk; + dBgS_ObjGndChk_Yogan lavaChk; cXyz temp; temp.set(old.pos.x, old.pos.y, old.pos.z); - gndChk.SetPos(&temp); - f32 groundY = dComIfG_Bgsp()->GroundCross(&gndChk); - if (groundY != -1000000000.0f && groundY > current.pos.y) { + lavaChk.SetPos(&temp); + f32 lavaY = dComIfG_Bgsp()->GroundCross(&lavaChk); + if (lavaY != C_BG_MIN_HEIGHT && lavaY > current.pos.y) { fopAcM_delete(this); } } diff --git a/src/d/actor/d_a_kt.cpp b/src/d/actor/d_a_kt.cpp index e06022a6b..0b43fe787 100644 --- a/src/d/actor/d_a_kt.cpp +++ b/src/d/actor/d_a_kt.cpp @@ -100,7 +100,7 @@ void kotori_move(kt_class* i_this) { gndChk.SetPos(&i_this->mTargetPosHome); i_this->mTargetPosHome.y = dComIfG_Bgsp()->GroundCross(&gndChk); - if (i_this->mTargetPosHome.y == -1e9f) + if (i_this->mTargetPosHome.y == C_BG_MIN_HEIGHT) i_this->mTargetPosHome = player->current.pos; i_this->mTargetPos = i_this->mTargetPosHome; i_this->mSpeedLerp = 0.0f; diff --git a/src/d/actor/d_a_leaflift.cpp b/src/d/actor/d_a_leaflift.cpp index 60732b718..5e851374b 100644 --- a/src/d/actor/d_a_leaflift.cpp +++ b/src/d/actor/d_a_leaflift.cpp @@ -112,7 +112,7 @@ void daLlift_c::CreateInit() { cXyz waterCheckPos = current.pos; waterCheckPos.y += 200.0f; mWaterY = dBgS_ObjGndChk_Wtr_Func(waterCheckPos); - if (mWaterY != -1e9f) { + if (mWaterY != C_BG_MIN_HEIGHT) { cXyz particlePos = current.pos; particlePos.y = mWaterY + 1.0f; mEmitter3 = dComIfGp_particle_set(dPa_name::ID_SCENE_82AA, &particlePos, ¤t.angle); diff --git a/src/d/actor/d_a_nh.cpp b/src/d/actor/d_a_nh.cpp index 43e865788..3ac7c7355 100644 --- a/src/d/actor/d_a_nh.cpp +++ b/src/d/actor/d_a_nh.cpp @@ -273,7 +273,7 @@ void daNh_c::BGCheck() { dBgS_ObjGndChk_All gndChk; gndChk.SetPos(¤t.pos); f32 groundY = dComIfG_Bgsp()->GroundCross(&gndChk); - if (groundY != -1000000000.0f) { + if (groundY != C_BG_MIN_HEIGHT) { mGroundY = groundY; tevStr.mRoomNo = current.roomNo = dComIfG_Bgsp()->GetRoomId(gndChk); tevStr.mEnvrIdxOverride = dComIfG_Bgsp()->GetPolyColor(gndChk); diff --git a/src/d/actor/d_a_npc_kamome.cpp b/src/d/actor/d_a_npc_kamome.cpp index f70fbb3aa..7cea42425 100644 --- a/src/d/actor/d_a_npc_kamome.cpp +++ b/src/d/actor/d_a_npc_kamome.cpp @@ -1285,7 +1285,7 @@ BOOL daNpc_kam_c::execute() { if (!isNoBgCheck()) { mAcch.CrrPos(*dComIfG_Bgsp()); - if (mAcch.GetGroundH() != -1000000000.0f) { + if (mAcch.GetGroundH() != C_BG_MIN_HEIGHT) { s8 roomNo = dComIfG_Bgsp()->GetRoomId(mAcch.m_gnd); fopAcM_SetRoomNo(this, roomNo); tevStr.mRoomNo = roomNo; diff --git a/src/d/actor/d_a_npc_os.cpp b/src/d/actor/d_a_npc_os.cpp index b55c3fe49..6b52605d8 100644 --- a/src/d/actor/d_a_npc_os.cpp +++ b/src/d/actor/d_a_npc_os.cpp @@ -2129,7 +2129,7 @@ BOOL daNpc_Os_c::execute() { mAcch.CrrPos(*dComIfG_Bgsp()); field_0x784 |= 0x10; - if(mAcch.GetGroundH() != -1.0e9f) { + if(mAcch.GetGroundH() != C_BG_MIN_HEIGHT) { tevStr.mRoomNo = dComIfG_Bgsp()->GetRoomId(mAcch.m_gnd); tevStr.mEnvrIdxOverride = dComIfG_Bgsp()->GetPolyColor(mAcch.m_gnd); @@ -2206,7 +2206,7 @@ BOOL daNpc_Os_c::execute() { } } - if(mAcch.GetGroundH() != -1.0e9f) { + if(mAcch.GetGroundH() != C_BG_MIN_HEIGHT) { cM3dGPla* plane = dComIfG_Bgsp()->GetTriPla(mAcch.m_gnd.GetBgIndex(), mAcch.m_gnd.GetPolyIndex()); if(plane) { field_0x7F0 = *plane->GetNP(); @@ -2226,7 +2226,7 @@ BOOL daNpc_Os_c::execute() { field_0x7A8 = mAcch.ChkGroundHit(); if(!fopAcM_checkCarryNow(this)) { - if(mAcch.GetGroundH() == -1.0e9f || dComIfG_Bgsp()->GetGroundCode(mAcch.m_gnd) == 4) { + if(mAcch.GetGroundH() == C_BG_MIN_HEIGHT || dComIfG_Bgsp()->GetGroundCode(mAcch.m_gnd) == 4) { if(m4E8 < 30) { m4E8 += 1; } @@ -2268,7 +2268,7 @@ BOOL daNpc_Os_c::execute() { mAcch.CrrPos(*dComIfG_Bgsp()); field_0x784 |= 0x10; - if(mAcch.GetGroundH() != -1.0e9f) { + if(mAcch.GetGroundH() != C_BG_MIN_HEIGHT) { tevStr.mRoomNo = dComIfG_Bgsp()->GetRoomId(mAcch.m_gnd); tevStr.mEnvrIdxOverride = dComIfG_Bgsp()->GetPolyColor(mAcch.m_gnd); } diff --git a/src/d/actor/d_a_npc_people.cpp b/src/d/actor/d_a_npc_people.cpp index b650bdd40..d536f7804 100644 --- a/src/d/actor/d_a_npc_people.cpp +++ b/src/d/actor/d_a_npc_people.cpp @@ -4430,7 +4430,7 @@ s32 daNpcPeople_c::createInit() { if(mNpcType != 0xB) { mObjAcch.CrrPos(*dComIfG_Bgsp()); - if(-1.0e9f != mObjAcch.GetGroundH()) { + if(C_BG_MIN_HEIGHT != mObjAcch.GetGroundH()) { current.pos.y = home.pos.y = mObjAcch.GetGroundH(); } } diff --git a/src/d/actor/d_a_npc_roten.cpp b/src/d/actor/d_a_npc_roten.cpp index b89d5a1d0..1b2d04bf2 100644 --- a/src/d/actor/d_a_npc_roten.cpp +++ b/src/d/actor/d_a_npc_roten.cpp @@ -1733,7 +1733,7 @@ s32 daNpcRoten_c::createInit() { fopAcM_setCullSizeBox(this, -200.0f, 0.0f, -200.0f, 200.0f, 300.0f, 200.0f); mObjAcch.CrrPos(*dComIfG_Bgsp()); - if(-1e9f != mObjAcch.GetGroundH()) { + if(C_BG_MIN_HEIGHT != mObjAcch.GetGroundH()) { current.pos.y = home.pos.y = mObjAcch.GetGroundH(); } diff --git a/src/d/actor/d_a_obj_movebox.cpp b/src/d/actor/d_a_obj_movebox.cpp index 38e8acbd0..0da9612ff 100644 --- a/src/d/actor/d_a_obj_movebox.cpp +++ b/src/d/actor/d_a_obj_movebox.cpp @@ -116,7 +116,7 @@ namespace daObjMovebox { /* 000001F0-000003A4 .text gnd_pos__Q212daObjMovebox5Bgc_cFPCQ212daObjMovebox5Act_cPCQ212daObjMovebox8BgcSrc_cif */ void Bgc_c::gnd_pos(const Act_c* movebox, const BgcSrc_c* bgcSrc, int bgcSrcCount, f32 param_4) { f32 tempz; - f32 maxGroundY = -1000000000.0f; + f32 maxGroundY = C_BG_MIN_HEIGHT; mDoMtx_stack_c::transS(movebox->current.pos); mDoMtx_stack_c::YrotM(movebox->home.angle.y); @@ -1872,7 +1872,7 @@ namespace daObjMovebox { int temp = mBgc.mMaxGroundIdx; f32 groundH = mBgc.mGroundY[temp]; cM3dGPla* triPla = dComIfG_Bgsp()->GetTriPla(Bgc_c::M_gnd_work[temp]); - if (triPla && groundH != -1000000000.0f) { + if (triPla && groundH != C_BG_MIN_HEIGHT) { dComIfGd_setSimpleShadow(¤t.pos, groundH, i_attr()->m10, triPla->GetNP(), shape_angle.y, 1.0f, NULL); } } diff --git a/src/d/actor/d_a_player_main.cpp b/src/d/actor/d_a_player_main.cpp index 630d892e2..da2891ba3 100644 --- a/src/d/actor/d_a_player_main.cpp +++ b/src/d/actor/d_a_player_main.cpp @@ -3087,7 +3087,7 @@ BOOL daPy_lk_c::checkLavaFace(cXyz* oldPos, int attributeCode) { mLavaGndChk.SetPos(&pos); m35D4 = dComIfG_Bgsp()->GroundCross(&mLavaGndChk); if (mAcch.GetGroundH() > m35D4) { - m35D4 = -1000000000.0f; + m35D4 = C_BG_MIN_HEIGHT; } if (m35D4 > current.pos.y) { attributeCode = dComIfG_Bgsp()->GetAttributeCode(mLavaGndChk); @@ -3337,7 +3337,7 @@ BOOL daPy_lk_c::execute() { !dComIfGp_checkPlayerStatus0(0, daPyStts0_SHIP_RIDE_e) && !checkModeFlg(ModeFlg_ROPE | ModeFlg_CLIMB | ModeFlg_LADDER) && mCurProc != daPyProc_DEMO_TOOL_e && - mAcch.GetGroundH() != -1e9f && + mAcch.GetGroundH() != C_BG_MIN_HEIGHT && !checkNoResetFlg0((daPy_FLG0)(daPyFlg0_UNK20000000 | daPyFlg0_UNK80000000)) && dComIfG_Bgsp()->ChkPolySafe(mAcch.m_gnd) && dComIfG_Bgsp()->ChkMoveBG(mAcch.m_gnd) @@ -3495,7 +3495,7 @@ BOOL daPy_lk_c::execute() { } } else if (mCurProc == daPyProc_DEMO_TOOL_e) { current.pos = sp14; - if (m3574 != 0 && mAcch.GetGroundH() != -1e9f) { + if (m3574 != 0 && mAcch.GetGroundH() != C_BG_MIN_HEIGHT) { current.pos.y = mAcch.GetGroundH(); } } else if (mCurProc == daPyProc_HOOKSHOT_FLY_e || @@ -3515,7 +3515,7 @@ BOOL daPy_lk_c::execute() { } int roomNo; - if (mAcch.GetGroundH() != -1e9f) { + if (mAcch.GetGroundH() != C_BG_MIN_HEIGHT) { roomNo = setRoomInfo(); m357C = m3580; m3580 = dComIfG_Bgsp()->GetGroundCode(mAcch.m_gnd); diff --git a/src/d/actor/d_a_player_npc.cpp b/src/d/actor/d_a_player_npc.cpp index 0e38e3fa1..98278a1af 100644 --- a/src/d/actor/d_a_player_npc.cpp +++ b/src/d/actor/d_a_player_npc.cpp @@ -13,7 +13,7 @@ int daPy_npc_c::check_initialRoom() { if (home.roomNo < 0) { mAcch.CrrPos(*dComIfG_Bgsp()); - if (mAcch.GetGroundH() == -1000000000.0f || dComIfG_Bgsp()->GetGroundCode(mAcch.m_gnd) == 4) { + if (mAcch.GetGroundH() == C_BG_MIN_HEIGHT || dComIfG_Bgsp()->GetGroundCode(mAcch.m_gnd) == 4) { return 0; } else { int roomNo = dComIfG_Bgsp()->GetRoomId(mAcch.m_gnd); diff --git a/src/d/actor/d_a_player_particle.inc b/src/d/actor/d_a_player_particle.inc index 0ea595c4b..bdcd324d3 100644 --- a/src/d/actor/d_a_player_particle.inc +++ b/src/d/actor/d_a_player_particle.inc @@ -37,7 +37,7 @@ void daPy_swimTailEcallBack_c::getMaxWaterY(JGeometry::TVec3* pos) { if (field_0x10 > pos->y) { pos->y = field_0x10 + 2.0f; } - } else if (field_0x10 != -1e9f) { + } else if (field_0x10 != C_BG_MIN_HEIGHT) { pos->y = field_0x10 + 2.0f; } else { pos->y = field_0x0C; @@ -899,7 +899,7 @@ void daPy_lk_c::setFootMark(cXyz* i_pos) { mGndChk.SetPos(&pos); pos.y = dComIfG_Bgsp()->GroundCross(&mGndChk); - if (pos.y != -1e9f && dComIfG_Bgsp()->GetAttributeCode(mGndChk) == dBgS_Attr_SAND_e) { + if (pos.y != C_BG_MIN_HEIGHT && dComIfG_Bgsp()->GetAttributeCode(mGndChk) == dBgS_Attr_SAND_e) { fopKyM_create(PROC_WATER_MARK, (shape_angle.y << 16) | 2, &pos, &scale, NULL); } @@ -1049,7 +1049,7 @@ void daPy_lk_c::setFootEffect() { mGndChk.SetPos(&pos); f32 groundY = dComIfG_Bgsp()->GroundCross(&mGndChk); - if (groundY != -1e9f) { + if (groundY != C_BG_MIN_HEIGHT) { pos.y = groundY; } diff --git a/src/d/d_a_bomb_static.cpp b/src/d/d_a_bomb_static.cpp index cff831245..1de8baf05 100644 --- a/src/d/d_a_bomb_static.cpp +++ b/src/d/d_a_bomb_static.cpp @@ -5,6 +5,7 @@ #include "d/actor/d_a_bomb.h" #include "d/actor/d_a_bomb2.h" +#include "d/d_a_obj.h" #include "JSystem/JUtility/JUTAssert.h" const int L_daBomb_Version = 1; diff --git a/src/d/d_bg_s.cpp b/src/d/d_bg_s.cpp index c560cc9e7..b396e9268 100644 --- a/src/d/d_bg_s.cpp +++ b/src/d/d_bg_s.cpp @@ -354,7 +354,7 @@ void dBgS::WallCorrect(dBgS_Acch* acch) { /* 800A13E0-800A14FC .text RoofChk__4dBgSFP12dBgS_RoofChk */ f32 dBgS::RoofChk(dBgS_RoofChk* chk) { - chk->SetNowY(1e+09f); + chk->SetNowY(C_BG_MAX_HEIGHT); chk->ClearPi(); cBgS_ChkElm* elm; for (s32 bg_index = 0; bg_index < (s32)ARRAY_SIZE(m_chk_element); bg_index++) { @@ -606,7 +606,7 @@ void dBgS_CrrPos::CrrPos(dBgS& i_bgs) { mGndChk.SetPos(&pos); f32 f31 = pm_pos->y; mGroundH = i_bgs.GroundCross(&mGndChk); - if (mGroundH != -1e+09f && mGroundH > f31) { + if (mGroundH != C_BG_MIN_HEIGHT && mGroundH > f31) { pm_pos->y = mGroundH; if (field_0x58) { field_0x58->y = 0.0f; diff --git a/src/d/d_bg_s_acch.cpp b/src/d/d_bg_s_acch.cpp index 3c9bede6d..2380ac545 100644 --- a/src/d/d_bg_s_acch.cpp +++ b/src/d/d_bg_s_acch.cpp @@ -56,7 +56,7 @@ dBgS_Acch::dBgS_Acch() { pm_pos = NULL; pm_old_pos = NULL; pm_speed = NULL; - m_ground_h = -1000000000.0f; + m_ground_h = C_BG_MIN_HEIGHT; m_ground_up_h = 0.0f; m_ground_check_offset = 60.0f; m_ground_up_h_diff = 0.0f; @@ -73,7 +73,7 @@ dBgS_Acch::dBgS_Acch() { pm_shape_angle = NULL; m_my_ac = NULL; pm_out_poly_info = NULL; - m_sea_height = -1000000000.0f; + m_sea_height = C_BG_MIN_HEIGHT; } static void dummy1() { @@ -108,7 +108,7 @@ void dBgS_Acch::Set(cXyz* pos, cXyz* old_pos, fopAc_ac_c* actor, int tbl_size, d /* 800A2E80-800A2EE8 .text GroundCheckInit__9dBgS_AcchFR4dBgS */ void dBgS_Acch::GroundCheckInit(dBgS&) { - m_ground_h = -1000000000.0f; + m_ground_h = C_BG_MIN_HEIGHT; if (m_flags & GRND_NONE) { return; } @@ -131,7 +131,7 @@ void dBgS_Acch::GroundCheck(dBgS& i_bgs) { m_gnd.m_pos = pos; m_ground_h = i_bgs.GroundCross(&m_gnd); - if (m_ground_h != -1000000000.0f) { + if (m_ground_h != C_BG_MIN_HEIGHT) { field_0xb8 = m_ground_h + m_ground_up_h; if (field_0xb8 > field_0xb4) { pm_pos->y = field_0xb8; @@ -155,8 +155,8 @@ void dBgS_Acch::GroundCheck(dBgS& i_bgs) { /* 800A305C-800A313C .text GroundRoofProc__9dBgS_AcchFR4dBgS */ f32 dBgS_Acch::GroundRoofProc(dBgS& i_bgs) { - f32 y = -1000000000.0f; - if (m_ground_h != -1000000000.0f) { + f32 y = C_BG_MIN_HEIGHT; + if (m_ground_h != C_BG_MIN_HEIGHT) { // y = m_roof_height; // fakematch to fix load order if (field_0xb8 < (y = m_roof_height) && y < pm_pos->y) { @@ -257,14 +257,14 @@ void dBgS_Acch::CrrPos(dBgS& i_bgs) { LineCheck(i_bgs); } - m_roof_height = 1000000000.0f; + m_roof_height = C_BG_MAX_HEIGHT; if (!(m_flags & ROOF_NONE)) { m_roof.SetExtChk(*(cBgS_Chk*)this); ClrRoofHit(); cXyz roofPos = *pm_pos; m_roof.SetPos(roofPos); m_roof_y = i_bgs.RoofChk(&m_roof); - if (m_roof_y != 1000000000.0f && pm_pos->y + m_roof_crr_height > m_roof_y) { + if (m_roof_y != C_BG_MAX_HEIGHT && pm_pos->y + m_roof_crr_height > m_roof_y) { m_roof_height = m_roof_y - m_roof_crr_height; SetRoofHit(); } @@ -281,10 +281,10 @@ void dBgS_Acch::CrrPos(dBgS& i_bgs) { if (!(m_flags & WATER_NONE)) { ClrWaterHit(); ClrWaterIn(); - m_wtr.SetHeight(-1000000000.0f); + m_wtr.SetHeight(C_BG_MIN_HEIGHT); int room_no = i_bgs.GetRoomId(m_gnd); - if (m_ground_h != -1000000000.0f && 0 <= room_no && room_no < 64) { + if (m_ground_h != C_BG_MIN_HEIGHT && 0 <= room_no && room_no < 64) { JUT_ASSERT(693, 0 <= room_no && room_no < 64); dBgW* bgw = dComIfGp_roomControl_getBgW(room_no); @@ -312,7 +312,7 @@ void dBgS_Acch::CrrPos(dBgS& i_bgs) { if (ChkSeaCheckOn()) { m_flags &= ~SEA_IN; - m_sea_height = -1000000000.0f; + m_sea_height = C_BG_MIN_HEIGHT; if (daSea_ChkArea(pm_pos->x, pm_pos->z)) { m_sea_height = daSea_calcWave(pm_pos->x, pm_pos->z); diff --git a/src/d/d_bg_s_func.cpp b/src/d/d_bg_s_func.cpp index 75bc3687f..2bbafb2c8 100644 --- a/src/d/d_bg_s_func.cpp +++ b/src/d/d_bg_s_func.cpp @@ -34,7 +34,7 @@ bool dBgS_SplGrpChk_In_ObjGnd(cXyz& r30, dBgS_SplGrpChk* r31, f32 f31) { gndChk.SetPos(&sp1c); f32 height = dComIfG_Bgsp()->GroundCross(&gndChk); r31->SetHeight(height); - if (height == -1e9f) { + if (height == C_BG_MIN_HEIGHT) { return FALSE; } @@ -79,7 +79,7 @@ u32 dBgS_GetGndMtrlSndId_Func(cXyz r21, f32 f1) { r21.y += f1; dBgS_ObjGndChk gndChk; gndChk.SetPos(&r21); - if (dComIfG_Bgsp()->GroundCross(&gndChk) == -1e9f) { + if (dComIfG_Bgsp()->GroundCross(&gndChk) == C_BG_MIN_HEIGHT) { return 0; } return dComIfG_Bgsp()->GetMtrlSndId(gndChk); diff --git a/src/d/d_bg_s_spl_grp_chk.cpp b/src/d/d_bg_s_spl_grp_chk.cpp index e1dcf4815..59e703795 100644 --- a/src/d/d_bg_s_spl_grp_chk.cpp +++ b/src/d/d_bg_s_spl_grp_chk.cpp @@ -4,7 +4,7 @@ // #include "d/d_bg_s_spl_grp_chk.h" -#include "dolphin/types.h" +#include "SSystem/SComponent/c_bg_s.h" /* 800A5A7C-800A5B94 .text __ct__14dBgS_SplGrpChkFv */ dBgS_SplGrpChk::dBgS_SplGrpChk() { @@ -14,7 +14,7 @@ dBgS_SplGrpChk::dBgS_SplGrpChk() { m_ground.x = 0.0f; m_ground.y = 0.0f; m_ground.z = 0.0f; - m_roof = 1000000000.0f; + m_roof = C_BG_MAX_HEIGHT; m_height = 0.0f; } @@ -25,4 +25,3 @@ void dBgS_SplGrpChk::Init() { SetHeight(GetPosP()->y); ClearPi(); } - diff --git a/src/d/d_bg_w_hf.cpp b/src/d/d_bg_w_hf.cpp index 5446c8ad0..6c1082b02 100644 --- a/src/d/d_bg_w_hf.cpp +++ b/src/d/d_bg_w_hf.cpp @@ -4,6 +4,7 @@ // #include "d/d_bg_w_hf.h" +#include "SSystem/SComponent/c_bg_s.h" #include "dolphin/types.h" #define CHECK_MINMAX_1(line, min, max) \ @@ -152,8 +153,8 @@ void dBgWHf::MakeBlckBndHf(int blck_id, f32* r28, f32* r29) { r31 = pm_bgd->m_t_num - 1; } - *r28 = 1000000000.0f; - *r29 = -1000000000.0f; + *r28 = C_BG_MAX_HEIGHT; + *r29 = C_BG_MIN_HEIGHT; for (int t = r7; t <= r31; t++) { #if VERSION != VERSION_JPN diff --git a/src/d/d_cc_mass_s.cpp b/src/d/d_cc_mass_s.cpp index c3f569cb2..c2e322079 100644 --- a/src/d/d_cc_mass_s.cpp +++ b/src/d/d_cc_mass_s.cpp @@ -6,6 +6,7 @@ #include "d/d_cc_mass_s.h" #include "d/d_cc_d.h" #include "JSystem/JUtility/JUTAssert.h" +#include "SSystem/SComponent/c_bg_s.h" #include "SSystem/SComponent/c_math.h" #include "f_op/f_op_actor.h" @@ -19,10 +20,10 @@ void dCcMassS_Mng::Ct() { mFlag = 0; mResultCam = 0; mCamTopPos.x = 0.0f; - mCamTopPos.y = -1e+9f; + mCamTopPos.y = C_BG_MIN_HEIGHT; mCamTopPos.z = 0.0f; mCamBottomPos.x = 0.0f; - mCamBottomPos.y = -1e+9f; + mCamBottomPos.y = C_BG_MIN_HEIGHT; mCamBottomPos.z = 0.0f; Clear(); } @@ -70,13 +71,13 @@ void dCcMassS_Mng::Prepare() { mDivideArea.CalcDivideInfo(&mDivideInfo, mCpsAttr.GetWorkAab(), 0); } mCamTopPos.x = 0.0f; - mCamTopPos.y = -1e+9f; + mCamTopPos.y = C_BG_MIN_HEIGHT; mCamTopPos.z = 0.0f; - mCamTopDist = 1e+9f; + mCamTopDist = C_BG_MAX_HEIGHT; mCamBottomPos.x = 0.0f; - mCamBottomPos.y = -1e+9f; + mCamBottomPos.y = C_BG_MIN_HEIGHT; mCamBottomPos.z = 0.0f; - mCamBottomDist = 1e+9f; + mCamBottomDist = C_BG_MAX_HEIGHT; } /* 800ACCB8-800AD17C .text Chk__12dCcMassS_MngFP4cXyzPP10fopAc_ac_cP15dCcMassS_HitInf */ diff --git a/src/d/d_com_inf_game.cpp b/src/d/d_com_inf_game.cpp index 11d04f3da..4cdae031c 100644 --- a/src/d/d_com_inf_game.cpp +++ b/src/d/d_com_inf_game.cpp @@ -557,13 +557,13 @@ s8 dComIfGp_getReverb(int param_0) { /* 800534C4-800535B8 .text dComIfGd_setSimpleShadow2__FP4cXyzffR13cBgS_PolyInfosfP9_GXTexObj */ -int dComIfGd_setSimpleShadow2(cXyz* i_pos, f32 param_1, f32 param_2, cBgS_PolyInfo& i_floorPoly, +int dComIfGd_setSimpleShadow2(cXyz* i_pos, f32 groundY, f32 param_2, cBgS_PolyInfo& i_floorPoly, s16 i_angle, f32 param_5, GXTexObj* i_tex) { - if (i_floorPoly.ChkSetInfo() && -1000000000.0f != param_1) { + if (i_floorPoly.ChkSetInfo() && C_BG_MIN_HEIGHT != groundY) { cM3dGPla* plane_p = dComIfG_Bgsp()->GetTriPla(i_floorPoly); - return dComIfGd_setSimpleShadow(i_pos, param_1, param_2, plane_p->GetNP(), i_angle, param_5, i_tex); + return dComIfGd_setSimpleShadow(i_pos, groundY, param_2, plane_p->GetNP(), i_angle, param_5, i_tex); } else { return 0; } @@ -1036,16 +1036,16 @@ u8 dComIfGs_checkGetItemNum(u8 i_itemNo) { /* 80054578-8005468C .text dComIfGd_setShadow__FUlScP8J3DModelP4cXyzffffR13cBgS_PolyInfoP12dKy_tevstr_csfP9_GXTexObj */ int dComIfGd_setShadow(u32 id, s8 param_2, J3DModel* pModel, cXyz* pPos, f32 param_5, f32 param_6, - f32 y, f32 param_8, cBgS_PolyInfo& pFloorPoly, dKy_tevstr_c* param_10, + f32 y, f32 groundY, cBgS_PolyInfo& pFloorPoly, dKy_tevstr_c* param_10, s16 rotY, f32 param_12, GXTexObj* pTexObj) { - if (param_8 <= -1000000000.0f) { + if (groundY <= C_BG_MIN_HEIGHT) { return 0; } - int sid = dComIfGd_setRealShadow2(id, param_2, pModel, pPos, param_5, y - param_8, param_10); + int sid = dComIfGd_setRealShadow2(id, param_2, pModel, pPos, param_5, y - groundY, param_10); if (sid == 0) { cXyz pos(pPos->x, y, pPos->z); - dComIfGd_setSimpleShadow2(&pos, param_8, param_6, pFloorPoly, rotY, param_12, pTexObj); + dComIfGd_setSimpleShadow2(&pos, groundY, param_6, pFloorPoly, rotY, param_12, pTexObj); } return sid; } diff --git a/src/d/d_drawlist.cpp b/src/d/d_drawlist.cpp index f7d84729c..cdb86e67f 100644 --- a/src/d/d_drawlist.cpp +++ b/src/d/d_drawlist.cpp @@ -1827,11 +1827,11 @@ bool dDlst_shadowControl_c::addReal(u32 key, J3DModel* model) { } /* 80085274-800852D8 .text setSimple__21dDlst_shadowControl_cFP4cXyzffP4cXyzsfP9_GXTexObj */ -int dDlst_shadowControl_c::setSimple(cXyz* pos, f32 f0, f32 f1, cXyz* floor_nrm, s16 rotY, f32 f2, GXTexObj* tex) { +int dDlst_shadowControl_c::setSimple(cXyz* pos, f32 groundY, f32 f1, cXyz* floor_nrm, s16 rotY, f32 f2, GXTexObj* tex) { if (floor_nrm == NULL || mSimpleNum >= ARRAY_SIZE(mSimple)) return false; - mSimple[mSimpleNum].set(pos, f0, f1, floor_nrm, rotY, f2, tex); + mSimple[mSimpleNum].set(pos, groundY, f1, floor_nrm, rotY, f2, tex); mSimpleNum++; return true; } diff --git a/src/d/d_grass.cpp b/src/d/d_grass.cpp index d078aa582..d80c0eff4 100644 --- a/src/d/d_grass.cpp +++ b/src/d/d_grass.cpp @@ -352,7 +352,7 @@ static f32 checkGroundY(cXyz& pos) { chk.SetPos(&pos); f32 y = dComIfG_Bgsp()->GroundCross(&chk); pos.y -= 50.0f; - if (y <= -1000000000.0f) + if (y <= C_BG_MIN_HEIGHT) return pos.y; else return y; diff --git a/src/d/d_kankyo_rain.cpp b/src/d/d_kankyo_rain.cpp index 2d096780b..0b4130abc 100644 --- a/src/d/d_kankyo_rain.cpp +++ b/src/d/d_kankyo_rain.cpp @@ -726,7 +726,7 @@ bool overhead_bg_chk() { pos.y += 50.0f; roofChk.SetPos(pos); - if (dComIfG_Bgsp()->RoofChk(&roofChk) != 1000000000.0f) + if (dComIfG_Bgsp()->RoofChk(&roofChk) != C_BG_MAX_HEIGHT) ret = true; pos.y += 10000.0f; gndChk.SetPos(&pos); @@ -755,7 +755,7 @@ bool forward_overhead_bg_chk(cXyz* pPos, f32 dist) { *pPos = pos; roofChk.SetPos(pos); - if (dComIfG_Bgsp()->RoofChk(&roofChk) != 1000000000.0f) + if (dComIfG_Bgsp()->RoofChk(&roofChk) != C_BG_MAX_HEIGHT) ret = true; pos.y += 10000.0f; gndChk.SetPos(&pos); diff --git a/src/d/d_lib.cpp b/src/d/d_lib.cpp index a83362d37..a3792ad8c 100644 --- a/src/d/d_lib.cpp +++ b/src/d/d_lib.cpp @@ -27,7 +27,7 @@ void dLib_setCirclePath(dLib_circle_path_c* path) { /* 800570CC-8005716C .text dLib_getWaterY__FR4cXyzR12dBgS_ObjAcch */ f32 dLib_getWaterY(cXyz& pos, dBgS_ObjAcch& acch) { BOOL waterHit = acch.ChkWaterHit(); - f32 waterHeight = waterHit ? acch.m_wtr.GetHeight() : C_BG_INVALID_HEIGHT; + f32 waterHeight = waterHit ? acch.m_wtr.GetHeight() : C_BG_MIN_HEIGHT; if (daSea_ChkArea(pos.x, pos.z)) { f32 seaHeight = daSea_calcWave(pos.x, pos.z); if (!waterHit || seaHeight > waterHeight) { diff --git a/src/d/d_particle.cpp b/src/d/d_particle.cpp index 41acef786..5ec938051 100644 --- a/src/d/d_particle.cpp +++ b/src/d/d_particle.cpp @@ -773,7 +773,7 @@ JPABaseEmitter* dPa_control_c::setSimpleLand(int code, const cXyz* pos, const cs dBgS_ObjGndChk chk; cXyz chkPos(pos->x, pos->y + 10.0f, pos->z); chk.SetPos(&chkPos); - if (dComIfG_Bgsp()->GroundCross(&chk) != C_BG_INVALID_HEIGHT) { + if (dComIfG_Bgsp()->GroundCross(&chk) != C_BG_MIN_HEIGHT) { code = dComIfG_Bgsp()->GetAttributeCode(chk); } } diff --git a/src/d/d_wood.cpp b/src/d/d_wood.cpp index 185b16e54..f29da42fa 100644 --- a/src/d/d_wood.cpp +++ b/src/d/d_wood.cpp @@ -606,7 +606,7 @@ bool dWood::Unit_c::set_ground() { gndChk.SetPos(&pos); f32 gndHeight = dComIfG_Bgsp()->GroundCross(&gndChk); - if (gndHeight > -1000000000.0f) { + if (gndHeight > C_BG_MIN_HEIGHT) { mPos.y = gndHeight; cM3dGPla *triPla = dComIfG_Bgsp()->GetTriPla(gndChk); diff --git a/src/d/d_wpot_water.cpp b/src/d/d_wpot_water.cpp index 408963e7f..c023a5df1 100644 --- a/src/d/d_wpot_water.cpp +++ b/src/d/d_wpot_water.cpp @@ -76,8 +76,8 @@ s32 dWpotWater_c::create() { static s32 dWpotWater_Create(kankyo_class* i_k) { dWpotWater_c* i_this = (dWpotWater_c*)i_k; - dBgS_GndChk chk2; - dBgS_ObjGndChk_Yogan chk; + dBgS_GndChk gndChk; + dBgS_ObjGndChk_Yogan lavaChk; cXyz pos; s16 angle = 0; @@ -88,13 +88,13 @@ static s32 dWpotWater_Create(kankyo_class* i_k) { i_this->mPos.y + 100.0f, i_this->mPos.z + f4 * cM_ssin(angle) ); - chk.SetPos(&pos); - f32 ret = dComIfG_Bgsp()->GroundCross(&chk); - if (ret != -1000000000.0f) { - chk2.SetPos(&pos); - f32 ret2 = dComIfG_Bgsp()->GroundCross(&chk2); - if (chk.ChkSetInfo() && dComIfG_Bgsp()->GetAttributeCode(chk) == dBgS_Attr_LAVA_e && ret > ret2) { - cXyz spawnPos(pos.x, ret + 25.0f, pos.z); + lavaChk.SetPos(&pos); + f32 lavaY = dComIfG_Bgsp()->GroundCross(&lavaChk); + if (lavaY != C_BG_MIN_HEIGHT) { + gndChk.SetPos(&pos); + f32 groundY = dComIfG_Bgsp()->GroundCross(&gndChk); + if (lavaChk.ChkSetInfo() && dComIfG_Bgsp()->GetAttributeCode(lavaChk) == dBgS_Attr_LAVA_e && lavaY > groundY) { + cXyz spawnPos(pos.x, lavaY + 25.0f, pos.z); fopAcM_create(PROC_Obj_Magmarock, 0, &spawnPos, i_this->mParam); break; } @@ -106,10 +106,10 @@ static s32 dWpotWater_Create(kankyo_class* i_k) { i_this->mPos.y + 100.0f, i_this->mPos.z ); - chk2.SetPos(&pos); - f32 ret = dComIfG_Bgsp()->GroundCross(&chk2); - i_this->mPos.y = ret; - if (ret != -1000000000.0f) { + gndChk.SetPos(&pos); + f32 groundY = dComIfG_Bgsp()->GroundCross(&gndChk); + i_this->mPos.y = groundY; + if (groundY != C_BG_MIN_HEIGHT) { cXyz sp18(i_this->mPos.x, i_this->mPos.y, i_this->mPos.z); fopAcM_create(PROC_HITOBJ, 0, &sp18, i_this->mParam); return i_this->create(); diff --git a/src/f_op/f_op_actor_mng.cpp b/src/f_op/f_op_actor_mng.cpp index 6555385f8..57c8097c9 100644 --- a/src/f_op/f_op_actor_mng.cpp +++ b/src/f_op/f_op_actor_mng.cpp @@ -1293,13 +1293,13 @@ BOOL fopAcM_getGroundAngle(fopAc_ac_c* actor, csXyz* p_angle) { pos.y = dComIfG_Bgsp()->GroundCross(&gndChk); s16 targetAngleX; int targetAngleZ; - if (pos.y != -1e9f) { + if (pos.y != C_BG_MIN_HEIGHT) { f32 origY = pos.y + 50.0f; gndChk.GetPointP()->set(pos.x, origY, pos.z + 10.0f); f32 origX = gndChk.GetPointP()->x; f32 origZ = gndChk.GetPointP()->z; f32 groundY = dComIfG_Bgsp()->GroundCross(&gndChk); - if (groundY != -1e9f) { + if (groundY != C_BG_MIN_HEIGHT) { targetAngleX = -cM_atan2s(groundY - pos.y, origZ - pos.z); } else { pos.y = pos.y; // ?? fakematch? @@ -1311,7 +1311,7 @@ BOOL fopAcM_getGroundAngle(fopAc_ac_c* actor, csXyz* p_angle) { f32 tempZ = pos.z; gndChk.GetPointP()->set(origX, origY, tempZ); groundY = dComIfG_Bgsp()->GroundCross(&gndChk); - if (groundY != -1e9f) { + if (groundY != C_BG_MIN_HEIGHT) { targetAngleZ = cM_atan2s(groundY - pos.y, origX - pos.x); } else { ret = FALSE; @@ -1412,7 +1412,7 @@ s32 fopAcM_getWaterY(const cXyz* pPos, f32* pDstWaterY) { static dBgS_WtrChk water_check; s32 ret = 0; - *pDstWaterY = -1e09; + *pDstWaterY = C_BG_MIN_HEIGHT; cXyz pos; pos.x = pPos->x;