From ea02e17b83df8ef9632f2a72ab0f7ce197a43da0 Mon Sep 17 00:00:00 2001 From: LagoLunatic Date: Mon, 14 Jul 2025 19:11:39 -0400 Subject: [PATCH] obj_mkiek demo match, remove fake inlines from cXyz --- configure.py | 4 ++-- include/SSystem/SComponent/c_xyz.h | 32 ++------------------------ src/SSystem/SComponent/c_m3d_g_aab.cpp | 20 ++++++++++++++-- src/d/actor/d_a_acorn_leaf.cpp | 12 ++++------ src/d/actor/d_a_obj_mkiek.cpp | 5 +++- src/d/actor/d_a_player_main.cpp | 2 +- src/d/actor/d_a_sea.cpp | 2 +- src/d/d_kankyo_rain.cpp | 4 ++-- 8 files changed, 35 insertions(+), 46 deletions(-) diff --git a/configure.py b/configure.py index a698ec886..f75f3dbae 100755 --- a/configure.py +++ b/configure.py @@ -1530,7 +1530,7 @@ config.libs = [ ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_tornado", extra_cflags=['-pragma "nosyminline on"']), ActorRel(NonMatching, "d_a_warpf"), ActorRel(NonMatching, "d_a_wind_tag"), - ActorRel(MatchingFor("D44J01", "GZLJ01", "GZLE01", "GZLP01"), "d_a_acorn_leaf", extra_cflags=['-pragma "nosyminline on"']), + ActorRel(Matching, "d_a_acorn_leaf", extra_cflags=['-pragma "nosyminline on"']), ActorRel(NonMatching, "d_a_atdoor"), ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_auction", extra_cflags=['-pragma "nosyminline on"']), ActorRel(NonMatching, "d_a_bb"), @@ -1693,7 +1693,7 @@ config.libs = [ ActorRel(Matching, "d_a_obj_ladder", extra_cflags=['-pragma "nosyminline on"']), ActorRel(NonMatching, "d_a_obj_light"), ActorRel(NonMatching, "d_a_obj_mkie"), - ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_obj_mkiek", extra_cflags=['-pragma "nosyminline on"']), + ActorRel(Matching, "d_a_obj_mkiek", extra_cflags=['-pragma "nosyminline on"']), ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_obj_mknjd", extra_cflags=['-pragma "nosyminline on"']), ActorRel(NonMatching, "d_a_obj_mmrr"), ActorRel(NonMatching, "d_a_obj_msdan"), diff --git a/include/SSystem/SComponent/c_xyz.h b/include/SSystem/SComponent/c_xyz.h index 7c3e1cdab..ec7ba6fff 100644 --- a/include/SSystem/SComponent/c_xyz.h +++ b/include/SSystem/SComponent/c_xyz.h @@ -93,39 +93,12 @@ struct cXyz : Vec { } void setall(f32 f) { set(f, f, f); } - void zero() { x = y = z = 0.0f; } - - void setMin(const cXyz& other) { - if (x > other.x) { - x = other.x; - } - if (y > other.y) { - y = other.y; - } - if (z > other.z) { - z = other.z; - } - } - - void setMax(const cXyz& other) { - if (x < other.x) { - x = other.x; - } - if (y < other.y) { - y = other.y; - } - if (z < other.z) { - z = other.z; - } - } f32 getSquareMag() const { return VECSquareMag(this); } f32 getSquareDistance(const Vec& other) const { return VECSquareDistance(this, &other); } - static f32 getNearZeroValue() { return 8e-11f; } - - bool isNearZeroSquare() const { return (this->getSquareMag() < getNearZeroValue()); } - bool isNearZeroSquare(const cXyz& other) const { return (VECSquareMag(&other) < getNearZeroValue()); } + bool isNearZeroSquare() const { return (this->getSquareMag() < 8e-11f); } + bool isNearZeroSquare(const cXyz& other) const { return (VECSquareMag(&other) < 8e-11f); } f32 abs2() const { return this->getSquareMag(); } f32 abs2(const Vec& other) const { return this->getSquareDistance(other); } f32 abs2XZ() const { @@ -141,7 +114,6 @@ struct cXyz : Vec { f32 abs(const Vec& other) const { return std::sqrtf(this->abs2(other)); } f32 absXZ() const { return std::sqrtf(this->abs2XZ()); } f32 absXZ(const Vec& other) const { return std::sqrtf(this->abs2XZ(other)); } - f32 getMagXZ() const { return cXyz(this->x, 0, this->z).getSquareMag(); } f32 getDotProduct(const Vec& other) const { return VECDotProduct(this, &other); } f32 inprod(const Vec& other) const { return getDotProduct(other); } diff --git a/src/SSystem/SComponent/c_m3d_g_aab.cpp b/src/SSystem/SComponent/c_m3d_g_aab.cpp index 1d89a2434..4932804d7 100644 --- a/src/SSystem/SComponent/c_m3d_g_aab.cpp +++ b/src/SSystem/SComponent/c_m3d_g_aab.cpp @@ -13,10 +13,26 @@ void cM3dGAab::SetMinMax(const cXyz& pMinMax) { /* 80251D08-80251D48 .text SetMin__8cM3dGAabFRC4cXyz */ void cM3dGAab::SetMin(const cXyz& pMin) { - mMin.setMin(pMin); + if (mMin.x > pMin.x) { + mMin.x = pMin.x; + } + if (mMin.y > pMin.y) { + mMin.y = pMin.y; + } + if (mMin.z > pMin.z) { + mMin.z = pMin.z; + } } /* 80251D48-80251D88 .text SetMax__8cM3dGAabFRC4cXyz */ void cM3dGAab::SetMax(const cXyz& pMax) { - mMax.setMax(pMax); + if (mMax.x < pMax.x) { + mMax.x = pMax.x; + } + if (mMax.y < pMax.y) { + mMax.y = pMax.y; + } + if (mMax.z < pMax.z) { + mMax.z = pMax.z; + } } diff --git a/src/d/actor/d_a_acorn_leaf.cpp b/src/d/actor/d_a_acorn_leaf.cpp index ce929193f..e1730d1bf 100644 --- a/src/d/actor/d_a_acorn_leaf.cpp +++ b/src/d/actor/d_a_acorn_leaf.cpp @@ -9,7 +9,7 @@ #include "d/d_cc_d.h" #include "d/d_com_inf_game.h" #include "f_op/f_op_actor_mng.h" -#include "JSystem/J3DGraphANimator/J3DModel.h" +#include "JSystem/J3DGraphAnimator/J3DModel.h" #include "d/actor/d_a_tsubo.h" #include "d/actor/d_a_player.h" #include "d/res/res_vigah.h" @@ -151,8 +151,7 @@ void daAleaf_c::set_mtx() { /* 000008D0-00000C44 .text _execute__9daAleaf_cFv */ bool daAleaf_c::_execute() { daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); - fpc_ProcID sp14 = unk_424; - fopAc_ac_c* actor = fopAcM_Search(fpcSch_JudgeByID, &sp14); + fopAc_ac_c* actor = fopAcM_SearchByID(unk_424); bool var_r29 = false; @@ -180,7 +179,7 @@ bool daAleaf_c::_execute() { unk_408.setPlaySpeed(1.0f); } - f32 var_f31 = std::sqrtf((player->current.pos - current.pos).getMagXZ()); + f32 var_f31 = (player->current.pos - current.pos).absXZ(); if (var_f31 < 50.0f && (unk_42C - var_f31) > 3.0f && std::fabsf(player->current.pos.y - current.pos.y) < 5.0f) { unk_418 = true; @@ -188,11 +187,10 @@ bool daAleaf_c::_execute() { } if (var_f31 < 200.0f && unk_428 != player->getGrabActorID() && player->getGrabActorID() == fpcM_ERROR_PROCESS_ID_e) { - fpc_ProcID sp14 = unk_428; - fopAc_ac_c* actor = fopAcM_Search(fpcSch_JudgeByID, &sp14); + fopAc_ac_c* actor = fopAcM_SearchByID(unk_428); if (actor != NULL) { - f32 var_f1 = std::sqrtf((actor->current.pos - current.pos).getMagXZ()); + f32 var_f1 = (actor->current.pos - current.pos).absXZ(); if (var_f1 < 70.0f) { unk_418 = true; diff --git a/src/d/actor/d_a_obj_mkiek.cpp b/src/d/actor/d_a_obj_mkiek.cpp index cee4a23cf..271bd78d7 100644 --- a/src/d/actor/d_a_obj_mkiek.cpp +++ b/src/d/actor/d_a_obj_mkiek.cpp @@ -109,7 +109,7 @@ BOOL daObjMkiek::Act_c::Delete() { BOOL daObjMkiek::Act_c::Mthd_Delete() { BOOL result = this->MoveBGDelete(); if (fpcM_CreateResult(this) != cPhs_STOP_e) { - dComIfG_resDelete(&mPhs, M_arcname); + dComIfG_resDeleteDemo(&mPhs, M_arcname); } return result; } @@ -150,6 +150,9 @@ void daObjMkiek::Act_c::demo_wait() { if (prm_get_sound() == 0) { mDoAud_seStart(JA_SE_READ_RIDDLE_1); } +#if VERSION == VERSION_DEMO + dComIfGp_getVibration().StartShock(4, -0x21, cXyz(0.0f, 1.0f, 0.0f)); +#endif if (m460 < 0x14) { m460++; } else { diff --git a/src/d/actor/d_a_player_main.cpp b/src/d/actor/d_a_player_main.cpp index 076ce0c6c..472aec73b 100644 --- a/src/d/actor/d_a_player_main.cpp +++ b/src/d/actor/d_a_player_main.cpp @@ -2612,7 +2612,7 @@ void daPy_lk_c::posMove() { } } m3644 = 0.0f; - mStts.GetCCMoveP()->zero(); + mStts.GetCCMoveP()->x = mStts.GetCCMoveP()->y = mStts.GetCCMoveP()->z = 0.0f; if (m34C2 == 1 || m34C2 == 8 || m34C2 == 9 || m34C2 == 5) { cXyz sp5C; if (m34C2 == 1 || m34C2 == 5) { diff --git a/src/d/actor/d_a_sea.cpp b/src/d/actor/d_a_sea.cpp index ab77ab131..f45035829 100644 --- a/src/d/actor/d_a_sea.cpp +++ b/src/d/actor/d_a_sea.cpp @@ -227,7 +227,7 @@ void daSea_packet_c::CleanUp() { for (s32 z = 0; z < GRID_CELLS; z++) for (s32 x = 0; x < GRID_CELLS; x++) mpHeightTable[idx++] = BASE_HEIGHT; - mCurPos.zero(); + mCurPos.x = mCurPos.y = mCurPos.z = 0.0f; } /* 8015B7E4-8015B84C .text __ct__14daSea_packet_cFv */ diff --git a/src/d/d_kankyo_rain.cpp b/src/d/d_kankyo_rain.cpp index 84f52469a..3bc65a38c 100644 --- a/src/d/d_kankyo_rain.cpp +++ b/src/d/d_kankyo_rain.cpp @@ -883,7 +883,7 @@ void wave_move() { } dKy_set_eyevect_calc2(pCamera, &eyevect, g_env_light.mWaveChan.mWaveSpawnDist, 0.0f); - d0.zero(); + d0.x = d0.y = d0.z = 0.0f; windVecP = dKyw_get_wind_vec(); windPow = dKyw_get_wind_pow(); @@ -924,7 +924,7 @@ void wave_move() { windPow = 0.6f; } - d0.zero(); + d0.x = d0.y = d0.z = 0.0f; deltaXZ.x = pCamera->mLookat.mCenter.x - pCamera->mLookat.mEye.x; deltaXZ.y = 0.0f;