From dbbd102db50e4992d7a28f095b1f6a3d5c2de8a6 Mon Sep 17 00:00:00 2001 From: Max Roncace Date: Sat, 13 Sep 2025 16:02:28 -0400 Subject: [PATCH] Improve several almost-matching TUs (#2653) --- config/GZ2E01/rels/d_a_grass/symbols.txt | 29 +- .../GZ2J01/rels/d_a_obj_volcball/splits.txt | 1 + configure.py | 12 +- include/d/actor/d_a_grass.h | 16 +- include/d/actor/d_a_npc_midp.h | 18 +- include/d/actor/d_a_obj_volcball.h | 4 - include/d/actor/d_a_player.h | 2 +- include/d/d_kankyo.h | 20 +- src/d/actor/d_a_grass.cpp | 8 +- src/d/actor/d_a_npc_midp.cpp | 49 +--- src/d/actor/d_a_npc_ne.cpp | 21 +- src/d/actor/d_a_npc_saru.cpp | 276 +++++++++--------- src/d/actor/d_a_obj_volcball.cpp | 43 ++- src/d/actor/d_a_vrbox2.cpp | 6 +- src/d/actor/d_flower.inc | 122 ++++---- src/d/actor/d_grass.inc | 178 +++++------ src/d/d_kankyo_rain.cpp | 12 +- 17 files changed, 405 insertions(+), 412 deletions(-) diff --git a/config/GZ2E01/rels/d_a_grass/symbols.txt b/config/GZ2E01/rels/d_a_grass/symbols.txt index 673555acc73..1f0245b732b 100644 --- a/config/GZ2E01/rels/d_a_grass/symbols.txt +++ b/config/GZ2E01/rels/d_a_grass/symbols.txt @@ -230,13 +230,18 @@ __global_destructor_chain = .bss:0x00000000; // type:object size:0x4 scope:globa @1012 = .bss:0x0000003C; // type:object size:0x1 scope:local @1010 = .bss:0x00000040; // type:object size:0x1 scope:local @1009 = .bss:0x00000044; // type:object size:0x1 scope:local +data_8052790d = .bss:0x00000045; // type:object size:0x1 scope:local @4293 = .bss:0x00000048; // type:object size:0xC scope:local +init$4294 = .bss:0x00000054; // type:object size:0x1 scope:local ang$4292 = .bss:0x00000058; // type:object size:0x6 scope:local exec_count_dammy$4868 = .bss:0x0000005E; // type:object size:0x2 scope:local +init$4869 = .bss:0x00000060; // type:object size:0x1 scope:local exec_count_dammy2$4871 = .bss:0x00000062; // type:object size:0x2 scope:local +init$4872 = .bss:0x00000064; // type:object size:0x1 scope:local mAngleZ$5046 = .bss:0x00000068; // type:object size:0xBB8 scope:local lbl_73_bss_C20 = .bss:0x00000C20; // type:object size:0x1 data:byte @5442 = .bss:0x00000C24; // type:object size:0xC scope:local +init$5443 = .bss:0x00000C30; // type:object size:0x1 scope:local ang$5441 = .bss:0x00000C34; // type:object size:0x6 scope:local @6340 = .bss:0x00000C3C; // type:object size:0xC scope:local @6342 = .bss:0x00000C48; // type:object size:0xC scope:local @@ -325,15 +330,15 @@ sInstance__32JASGlobalInstance<11Z2FxLineMgr> = .bss:0x00000F78; // type:object sInstance__31JASGlobalInstance<10Z2EnvSeMgr> = .bss:0x00000F7C; // type:object size:0x4 scope:global sInstance__32JASGlobalInstance<11Z2SpeechMgr> = .bss:0x00000F80; // type:object size:0x4 scope:global sInstance__34JASGlobalInstance<13Z2WolfHowlMgr> = .bss:0x00000F84; // type:object size:0x4 scope:global -lbl_73_bss_F88 = .bss:0x00000F88; // type:object size:0x1 data:byte -l_setType0$localstatic3$create__9daGrass_cFv = .bss:0x00000F8C; // type:object size:0x2A scope:local data:2byte -lbl_73_bss_FB6 = .bss:0x00000FB6; // type:object size:0x1 data:byte -l_setType1$localstatic5$create__9daGrass_cFv = .bss:0x00000FB8; // type:object size:0x7E scope:local data:2byte -lbl_73_bss_1036 = .bss:0x00001036; // type:object size:0x1 data:byte -l_setType2$localstatic7$create__9daGrass_cFv = .bss:0x00001038; // type:object size:0x12 scope:local data:2byte -lbl_73_bss_104A = .bss:0x0000104A; // type:object size:0x1 data:byte -l_setType3$localstatic9$create__9daGrass_cFv = .bss:0x0000104C; // type:object size:0x2A scope:local data:2byte -lbl_73_bss_1076 = .bss:0x00001076; // type:object size:0x1 data:byte -l_setType4$localstatic11$create__9daGrass_cFv = .bss:0x00001078; // type:object size:0x66 scope:local data:2byte -lbl_73_bss_10DE = .bss:0x000010DE; // type:object size:0x1 data:byte -l_setType5$localstatic13$create__9daGrass_cFv = .bss:0x000010E0; // type:object size:0x2A scope:local data:2byte +init$localstatic4$create__9daGrass_cFv = .bss:0x00000F88; // type:object size:0x1 scope:global data:byte +l_setType0$localstatic3$create__9daGrass_cFv = .bss:0x00000F8C; // type:object size:0x2A scope:global data:2byte +init$localstatic6$create__9daGrass_cFv = .bss:0x00000FB6; // type:object size:0x1 scope:global data:byte +l_setType1$localstatic5$create__9daGrass_cFv = .bss:0x00000FB8; // type:object size:0x7E scope:global data:2byte +init$localstatic8$create__9daGrass_cFv = .bss:0x00001036; // type:object size:0x1 scope:global data:byte +l_setType2$localstatic7$create__9daGrass_cFv = .bss:0x00001038; // type:object size:0x12 scope:global data:2byte +init$localstatic10$create__9daGrass_cFv = .bss:0x0000104A; // type:object size:0x1 scope:global data:byte +l_setType3$localstatic9$create__9daGrass_cFv = .bss:0x0000104C; // type:object size:0x2A scope:global data:2byte +init$localstatic12$create__9daGrass_cFv = .bss:0x00001076; // type:object size:0x1 scope:global data:byte +l_setType4$localstatic11$create__9daGrass_cFv = .bss:0x00001078; // type:object size:0x66 scope:global data:2byte +init$localstatic14$create__9daGrass_cFv = .bss:0x000010DE; // type:object size:0x1 scope:global data:byte +l_setType5$localstatic13$create__9daGrass_cFv = .bss:0x000010E0; // type:object size:0x2A scope:global data:2byte diff --git a/config/GZ2J01/rels/d_a_obj_volcball/splits.txt b/config/GZ2J01/rels/d_a_obj_volcball/splits.txt index 7bda84b3a2b..44516c0ecca 100644 --- a/config/GZ2J01/rels/d_a_obj_volcball/splits.txt +++ b/config/GZ2J01/rels/d_a_obj_volcball/splits.txt @@ -13,3 +13,4 @@ d/actor/d_a_obj_volcball.cpp: .text start:0x00000078 end:0x00002324 .rodata start:0x00000000 end:0x000000C0 .data start:0x00000000 end:0x00000270 + .bss start:0x00000000 end:0x00000004 diff --git a/configure.py b/configure.py index 6ef960938a0..b8028698363 100755 --- a/configure.py +++ b/configure.py @@ -1599,7 +1599,7 @@ config.libs = [ ActorRel(MatchingFor("GZ2E01", "GZ2J01"), "d_a_e_rd"), ActorRel(MatchingFor("GZ2E01", "GZ2J01"), "d_a_econt"), ActorRel(MatchingFor("GZ2E01", "GZ2J01"), "d_a_fr"), - ActorRel(NonMatching, "d_a_grass"), + ActorRel(Equivalent, "d_a_grass"), # __sinit regalloc ActorRel(MatchingFor("GZ2E01", "GZ2J01"), "d_a_kytag05"), ActorRel(MatchingFor("GZ2E01", "GZ2J01"), "d_a_kytag10"), ActorRel(MatchingFor("GZ2E01", "GZ2J01"), "d_a_kytag11"), @@ -1609,12 +1609,12 @@ config.libs = [ ActorRel(MatchingFor("GZ2E01", "GZ2J01"), "d_a_npc_fairy_seirei"), ActorRel(MatchingFor("GZ2E01", "GZ2J01"), "d_a_npc_fish"), ActorRel(MatchingFor("GZ2E01", "GZ2J01"), "d_a_npc_henna"), - ActorRel(MatchingFor("GZ2E01"), "d_a_npc_kakashi"), + ActorRel(MatchingFor("GZ2E01", "GZ2J01"), "d_a_npc_kakashi"), ActorRel(NonMatching, "d_a_npc_kkri"), ActorRel(MatchingFor("GZ2E01", "GZ2J01"), "d_a_npc_kolin"), ActorRel(MatchingFor("GZ2E01", "GZ2J01"), "d_a_npc_maro"), ActorRel(MatchingFor("GZ2E01", "GZ2J01"), "d_a_npc_taro"), - ActorRel(MatchingFor("GZ2E01"), "d_a_npc_tkj"), + ActorRel(MatchingFor("GZ2E01", "GZ2J01"), "d_a_npc_tkj"), ActorRel(NonMatching, "d_a_obj_bhashi"), ActorRel(MatchingFor("GZ2E01", "GZ2J01"), "d_a_obj_bkdoor"), ActorRel(MatchingFor("GZ2E01", "GZ2J01"), "d_a_obj_bosswarp"), @@ -1861,7 +1861,7 @@ config.libs = [ ActorRel(NonMatching, "d_a_npc_len"), ActorRel(MatchingFor("GZ2E01", "GZ2J01"), "d_a_npc_lf"), ActorRel(NonMatching, "d_a_npc_lud"), - ActorRel(NonMatching, "d_a_npc_midp"), + ActorRel(MatchingFor("GZ2E01", "GZ2J01"), "d_a_npc_midp"), ActorRel(MatchingFor("GZ2E01", "GZ2J01"), "d_a_npc_mk"), ActorRel(NonMatching, "d_a_npc_moi"), ActorRel(NonMatching, "d_a_npc_moir", extra_cflags=[DANPCF_C_HACK]), @@ -1878,7 +1878,7 @@ config.libs = [ ActorRel(MatchingFor("GZ2E01", "GZ2J01"), "d_a_npc_prayer", extra_cflags=[DANPCF_C_HACK]), ActorRel(NonMatching, "d_a_npc_raca"), ActorRel(NonMatching, "d_a_npc_rafrel"), - ActorRel(NonMatching, "d_a_npc_saru"), + ActorRel(MatchingFor("GZ2E01", "GZ2J01"), "d_a_npc_saru"), ActorRel(MatchingFor("GZ2E01", "GZ2J01"), "d_a_npc_seib"), ActorRel(MatchingFor("GZ2E01", "GZ2J01"), "d_a_npc_seic"), ActorRel(MatchingFor("GZ2E01", "GZ2J01"), "d_a_npc_seid"), @@ -2201,7 +2201,7 @@ config.libs = [ ActorRel(MatchingFor("GZ2E01", "GZ2J01"), "d_a_obj_udoor"), ActorRel(MatchingFor("GZ2E01", "GZ2J01"), "d_a_obj_usaku"), ActorRel(MatchingFor("GZ2E01", "GZ2J01"), "d_a_obj_vground"), - ActorRel(NonMatching, "d_a_obj_volcball"), + ActorRel(MatchingFor("GZ2E01", "GZ2J01"), "d_a_obj_volcball"), ActorRel(MatchingFor("GZ2E01", "GZ2J01"), "d_a_obj_volcbom"), ActorRel(MatchingFor("GZ2E01", "GZ2J01"), "d_a_obj_warp_kbrg"), ActorRel(MatchingFor("GZ2E01", "GZ2J01"), "d_a_obj_warp_obrg"), diff --git a/include/d/actor/d_a_grass.h b/include/d/actor/d_a_grass.h index 16d908c8189..8929d6029c4 100644 --- a/include/d/actor/d_a_grass.h +++ b/include/d/actor/d_a_grass.h @@ -13,8 +13,10 @@ public: /* 8051DF54 */ void Direction_Set(fopAc_ac_c*, u32, int, dCcMassS_HitInf*, cCcD_Obj*, csXyz*); /* 8051E1C8 */ void WorkAt(fopAc_ac_c*, u32, int, dCcMassS_HitInf*, u16); /* 8051EB88 */ void hitCheck(int, u16); - /* 80520940 */ ~dGrass_data_c(); - /* 8052097C */ dGrass_data_c(); + /* 80520940 */ ~dGrass_data_c() {} + /* 8052097C */ dGrass_data_c() { + m_state = 0; + } /* 0x00 */ u8 m_state; /* 0x01 */ u8 field_0x01; @@ -33,7 +35,9 @@ class dGrass_room_c { public: /* 8051EDE0 */ void newData(dGrass_data_c*); /* 8051EDF0 */ void deleteData(); - /* 80520928 */ dGrass_room_c(); + /* 80520928 */ dGrass_room_c() { + mp_data = NULL; + } dGrass_data_c* getData() { return mp_data; } @@ -42,7 +46,9 @@ public: class dGrass_anm_c { public: - /* 80520934 */ dGrass_anm_c(); + /* 80520934 */ dGrass_anm_c() { + m_state = 0; + } /* 0x00 */ u8 m_state; /* 0x02 */ s16 m_angY; @@ -62,7 +68,7 @@ public: /* 805208E4 */ void setAnm(int, s16); /* 8051F03C */ virtual void draw(); - /* 8051BFBC */ virtual ~dGrass_packet_c() {} + /* 8051BFBC */ virtual ~dGrass_packet_c(); typedef void (dGrass_packet_c::*deleteFunc)(int); static deleteFunc m_deleteRoom; diff --git a/include/d/actor/d_a_npc_midp.h b/include/d/actor/d_a_npc_midp.h index b593921e447..3ca21687821 100644 --- a/include/d/actor/d_a_npc_midp.h +++ b/include/d/actor/d_a_npc_midp.h @@ -20,7 +20,6 @@ public: TYPE_0, TYPE_1, }; - /* 80A70C6C */ ~daNpc_midP_c(); /* 80A70D90 */ int create(); /* 80A71074 */ int CreateHeap(); @@ -55,13 +54,13 @@ public: daNpcT_MotionSeqMngr_c::sequenceStepData_c const* param_5, int param_6, daNpcT_evtData_c const* param_7, char** param_8) : daNpcT_c(param_1, param_2, param_3, param_4, param_5, param_6, param_7, param_8) {} - /* 80A7390C */ u16 getEyeballRMaterialNo(); - /* 80A73914 */ u16 getEyeballLMaterialNo(); - /* 80A7391C */ s32 getHeadJointNo(); - /* 80A73924 */ s32 getNeckJointNo(); - /* 80A7392C */ s32 getBackboneJointNo(); - /* 80A73934 */ BOOL checkChangeJoint(int); - /* 80A73944 */ BOOL checkRemoveJoint(int); + /* 80A7390C */ u16 getEyeballRMaterialNo() { return 3; } + /* 80A73914 */ u16 getEyeballLMaterialNo() { return 2; } + /* 80A7391C */ s32 getHeadJointNo() { return 4; } + /* 80A73924 */ s32 getNeckJointNo() { return 3; } + /* 80A7392C */ s32 getBackboneJointNo() { return 2; } + /* 80A73934 */ BOOL checkChangeJoint(int param_0) { return param_0 == 4; } + /* 80A73944 */ BOOL checkRemoveJoint(int param_0) { return param_0 == 8; } int getFlowNodeNo() { u16 nodeNo = home.angle.x; @@ -88,7 +87,7 @@ STATIC_ASSERT(sizeof(daNpc_midP_c) == 0xfa0); class daNpc_midP_Param_c { public: - /* 80A73954 */ ~daNpc_midP_Param_c(); + /* 80A73954 */ virtual ~daNpc_midP_Param_c() {} struct Data { /* 0x00 */ f32 field_0x00; @@ -134,5 +133,4 @@ public: static const Data m; }; - #endif /* D_A_NPC_MIDP_H */ diff --git a/include/d/actor/d_a_obj_volcball.h b/include/d/actor/d_a_obj_volcball.h index d0ea3d5d0d7..2e7c936dbb5 100644 --- a/include/d/actor/d_a_obj_volcball.h +++ b/include/d/actor/d_a_obj_volcball.h @@ -27,9 +27,6 @@ public: }; struct vball_s { - /* 80D21FA8 */ ~vball_s() {} - /* 80D2214C */ vball_s() {} - /* 0x000 */ J3DModel* mpModel; /* 0x004 */ cXyz field_0x4; /* 0x010 */ cXyz field_0x10; @@ -108,7 +105,6 @@ public: /* 80D23A0C */ int _delete(); /* 80D22DDC */ virtual bool eventStart(); - /* 80D23B24 */ virtual ~daObjVolcBall_c() {} u8 getSwBit() { return fopAcM_GetParamBit(this, 0, 8); } u8 getSwBit2() { return fopAcM_GetParamBit(this, 8, 8); } diff --git a/include/d/actor/d_a_player.h b/include/d/actor/d_a_player.h index 93215282e93..6d2e0ed5e04 100644 --- a/include/d/actor/d_a_player.h +++ b/include/d/actor/d_a_player.h @@ -1043,7 +1043,7 @@ public: cXyz* getRightHandPosP() { return &mRightHandPos; } cXyz* getHeadTopPosP() { return &mHeadTopPos; } - const cXyz& getSwordTopPos() const { return mSwordTopPos; } + const cXyz getSwordTopPos() const { return mSwordTopPos; } u32 checkWolf() const { return checkNoResetFlg1(FLG1_IS_WOLF); } u32 checkEquipHeavyBoots() const { return checkNoResetFlg0(FLG0_EQUIP_HVY_BOOTS); } diff --git a/include/d/d_kankyo.h b/include/d/d_kankyo.h index 6adeba32c93..db2644224fc 100644 --- a/include/d/d_kankyo.h +++ b/include/d/d_kankyo.h @@ -507,12 +507,24 @@ inline dScnKy_env_light_c* dKy_getEnvlight() { class dKankyo_HIO_c { public: - /* 0x000 */ u8 pad[0xB4]; - /* 0x0B4 */ u8 field_0xB4; - /* 0x0B8 */ f32 field_0xB8; - /* 0x0BC */ u8 field_0xBC[0x3F4 - 0xbc]; + /* 0x000 */ u8 field_0x000[0x6d - 0x0]; + /* 0x000 */ u8 field_0x06d; + /* 0x000 */ u8 field_0x06e[0xb4 - 0x6e]; + /* 0x0B4 */ u8 field_0x0b4; + /* 0x0B8 */ f32 field_0x0b8; + /* 0x0BC */ u8 field_0x0bc[0x3f4 - 0xbc]; /* 0x3F4 */ f32 field_0x3f4; /* 0x3F8 */ f32 field_0x3f8; + /* 0x3FC */ u8 field_0x3fc[0x694 - 0x3fc]; + u8 field_0x694; + u8 field_0x695; + u8 field_0x696; + u8 field_0x697[0x698 - 0x697]; + bool field_0x698; + u8 field_0x699[0x69c - 0x699]; + f32 field_0x69c; + u8 field_0x6a0[0x79b - 0x6a0]; + u8 field_0x79b; }; extern dKankyo_HIO_c g_kankyoHIO; diff --git a/src/d/actor/d_a_grass.cpp b/src/d/actor/d_a_grass.cpp index 0b5e6a5c133..3207cb9655d 100644 --- a/src/d/actor/d_a_grass.cpp +++ b/src/d/actor/d_a_grass.cpp @@ -9,13 +9,10 @@ #include "SSystem/SComponent/c_counter.h" #include "SSystem/SComponent/c_math.h" #include "d/d_com_inf_game.h" -#include "dol2asm.h" -#include "m_Do/m_Do_lib.h" #include "Z2AudioLib/Z2Instances.h" #include -#include -#include "d/actor/d_grass.inc" +#include "d/actor/d_grass.inc" // IWYU pragma: keep #include "d/actor/d_flower.inc" /* 8051BD4C-8051BEFC 0000EC 01B0+00 1/1 0/0 0/0 .text randam_addcol_set__FPs */ @@ -86,6 +83,9 @@ void daGrass_c::deleteGrass() { } } +dGrass_packet_c::~dGrass_packet_c() { +} + /* 8051C040-8051C074 0003E0 0034+00 1/1 0/0 0/0 .text executeGrass__9daGrass_cFv */ void daGrass_c::executeGrass() { if (m_grass != NULL) { diff --git a/src/d/actor/d_a_npc_midp.cpp b/src/d/actor/d_a_npc_midp.cpp index 226af869a88..23db0b4a931 100644 --- a/src/d/actor/d_a_npc_midp.cpp +++ b/src/d/actor/d_a_npc_midp.cpp @@ -442,7 +442,7 @@ void daNpc_midP_c::setAttnPos() { daNpc_midP_Param_c::m.field_0x2c, daNpc_midP_Param_c::m.field_0x28, daNpc_midP_Param_c::m.field_0x34, daNpc_midP_Param_c::m.field_0x30, daNpc_midP_Param_c::m.field_0x3c, daNpc_midP_Param_c::m.field_0x38, - daNpc_midP_Param_c::m.field_0x40, dVar5, NULL); + daNpc_midP_Param_c::m.field_0x40, dVar5, &sp48); mJntAnm.calcJntRad(0.2f, 1.0f, dVar5); setMtx(); @@ -505,7 +505,7 @@ void daNpc_midP_c::drawGhost() { /* 80A721E0-80A72228 001660 0048+00 1/1 0/0 0/0 .text selectAction__12daNpc_midP_cFv */ int daNpc_midP_c::selectAction() { field_0xf84 = NULL; - field_0xf84 = &daNpc_midP_c::talk; + field_0xf84 = &daNpc_midP_c::wait; return 1; } @@ -644,50 +644,7 @@ static int daNpc_midP_IsDelete(void* i_this) { static u8 lit_3811[12]; /* 80A73D5C-80A73D60 000014 0004+00 1/1 0/0 0/0 .bss l_HIO */ -static u8 l_HIO[4]; - -/* 80A7390C-80A73914 002D8C 0008+00 1/0 0/0 0/0 .text getEyeballRMaterialNo__12daNpc_midP_cFv */ -u16 daNpc_midP_c::getEyeballRMaterialNo() { - return 3; -} - -/* 80A73914-80A7391C 002D94 0008+00 1/0 0/0 0/0 .text getEyeballLMaterialNo__12daNpc_midP_cFv */ -u16 daNpc_midP_c::getEyeballLMaterialNo() { - return 2; -} - -/* 80A7391C-80A73924 002D9C 0008+00 1/0 0/0 0/0 .text getHeadJointNo__12daNpc_midP_cFv */ -s32 daNpc_midP_c::getHeadJointNo() { - return 4; -} - -/* 80A73924-80A7392C 002DA4 0008+00 1/0 0/0 0/0 .text getNeckJointNo__12daNpc_midP_cFv */ -s32 daNpc_midP_c::getNeckJointNo() { - return 3; -} - -/* 80A7392C-80A73934 002DAC 0008+00 1/0 0/0 0/0 .text getBackboneJointNo__12daNpc_midP_cFv */ -s32 daNpc_midP_c::getBackboneJointNo() { - return 2; -} - -/* 80A73934-80A73944 002DB4 0010+00 1/0 0/0 0/0 .text checkChangeJoint__12daNpc_midP_cFi */ -BOOL daNpc_midP_c::checkChangeJoint(int param_1) { - // NONMATCHING - return (4 - param_1) >> 5 & 0xff; -} - -/* 80A73944-80A73954 002DC4 0010+00 1/0 0/0 0/0 .text checkRemoveJoint__12daNpc_midP_cFi */ -BOOL daNpc_midP_c::checkRemoveJoint(int param_1) { - // NONMATCHING - return (8 - param_1) >> 5 & 0xff; -} - -/* 80A73954-80A7399C 002DD4 0048+00 2/1 0/0 0/0 .text __dt__18daNpc_midP_Param_cFv */ -daNpc_midP_Param_c::~daNpc_midP_Param_c() { - // NONMATCHING - -} +static daNpc_midP_Param_c l_HIO; /* 80A73B8C-80A73BAC -00001 0020+00 1/0 0/0 0/0 .data daNpc_midP_MethodTable */ static actor_method_class daNpc_midP_MethodTable = { diff --git a/src/d/actor/d_a_npc_ne.cpp b/src/d/actor/d_a_npc_ne.cpp index f0c53cc4715..41ce8510085 100644 --- a/src/d/actor/d_a_npc_ne.cpp +++ b/src/d/actor/d_a_npc_ne.cpp @@ -3107,7 +3107,7 @@ static int useHeapInit(fopAc_ac_c* i_this) { J3DModel* model = _this->mpMorf->getModel(); i_this->model = model; - model->setUserArea((uintptr_t)i_this); + model->setUserArea((uintptr_t)_this); for (u16 i = 0; i < model->getModelData()->getJointNum(); i++) { if (i == 1 || i == 2 || i == 3 || i == 4 || i == 20 || i == 21) { @@ -3119,9 +3119,8 @@ static int useHeapInit(fopAc_ac_c* i_this) { if (_this->mpBtkAnm == NULL) { return 0; } - J3DAnmTextureSRTKey* btk = - static_cast(dComIfG_getObjectRes(_this->mResName, 32)); - if (!_this->mpBtkAnm->init(_this->mpMorf->getModel()->getModelData(), btk, 1, 0, 1.0f, 0, -1)) { + if (!_this->mpBtkAnm->init(_this->mpMorf->getModel()->getModelData(), + static_cast(dComIfG_getObjectRes(_this->mResName, 32)), 1, 0, 1.0f, 0, -1)) { return 0; } @@ -3129,18 +3128,22 @@ static int useHeapInit(fopAc_ac_c* i_this) { if (_this->mpBtpAnm == NULL) { return 0; } - J3DAnmTexPattern* btp = - static_cast(dComIfG_getObjectRes(_this->mResName, 35)); - if (!_this->mpBtpAnm->init(_this->mpMorf->getModel()->getModelData(), btp, 1, 0, 1.0f, 0, -1)) { + if (!_this->mpBtpAnm->init(_this->mpMorf->getModel()->getModelData(), + static_cast(dComIfG_getObjectRes(_this->mResName, 35)), 1, 0, 1.0f, 0, -1)) { return 0; } _this->mSound.init(&i_this->current.pos, 1); - + if (_this->mBehavior == npc_ne_class::BHV_DISH) { static int dish_bck[2] = {npc_ne_class::ANM_EMPTY_DISH, npc_ne_class::ANM_DRINK_DISH}; /* dSv_event_flag_c::F_0038 - Ordon Village - Opening (2nd day) cat returns home */ - s32 dish_flag = dComIfGs_isEventBit(0x1001) ? 1 : 0; + s32 dish_flag; + if (dComIfGs_isEventBit(0x1001)) { + dish_flag = 1; + } else { + dish_flag = 0; + } _this->mpDishMorf = new mDoExt_McaMorf( static_cast(dComIfG_getObjectRes(_this->mResName, 29)), NULL, NULL, static_cast(dComIfG_getObjectRes(_this->mResName, diff --git a/src/d/actor/d_a_npc_saru.cpp b/src/d/actor/d_a_npc_saru.cpp index 8149cf5ae25..c36e49de2df 100644 --- a/src/d/actor/d_a_npc_saru.cpp +++ b/src/d/actor/d_a_npc_saru.cpp @@ -355,25 +355,30 @@ int daNpc_Saru_c::create() { /* 80AC082C-80AC0A54 0004EC 0228+00 1/1 0/0 0/0 .text CreateHeap__12daNpc_Saru_cFv */ int daNpc_Saru_c::CreateHeap() { - // NONMATCHING static int const bmdTypeList[2] = { 2, 3, }; - u32 uVar1 = mTwilight == true; - J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes(l_resNameList[l_bmdData[uVar1][1]], l_bmdData[uVar1][0]); + void* modelData = NULL; + J3DModel* model = NULL; + BOOL uVar1 = mTwilight == true ? TRUE : FALSE; + int arcNameIdx = l_bmdData[uVar1][1]; + int resName = l_bmdData[uVar1][0]; + modelData = dComIfG_getObjectRes(l_resNameList[arcNameIdx], resName); if (modelData == NULL) { return 0; } - mpMorf[0] = new mDoExt_McaMorfSO(modelData, NULL, - NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, 0x11020084); + u32 temp1 = 0x11020084; + mpMorf[0] = new mDoExt_McaMorfSO((J3DModelData*)modelData, NULL, + NULL, NULL, -1, 1.0f, 0, -1, &mSound, 0x80000, temp1); if (mpMorf[0] == NULL || mpMorf[0]->getModel() == NULL) { return 0; } - J3DModel* model = mpMorf[0]->getModel(); - for (u16 i = 0; i < modelData->getJointNum(); i++) { - modelData->getJointNodePointer(i)->setCallBack(ctrlJointCallBack); + model = mpMorf[0]->getModel(); + model = mpMorf[0]->getModel(); + for (u16 i = 0; i < ((J3DModelData*)modelData)->getJointNum(); i++) { + ((J3DModelData*)modelData)->getJointNodePointer(i)->setCallBack(ctrlJointCallBack); } model->setUserArea((uintptr_t)this); @@ -386,7 +391,7 @@ int daNpc_Saru_c::CreateHeap() { } if (modelData != NULL) { - mpRoseModels[i] = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000084); + mpRoseModels[i] = mDoExt_J3DModel__create((J3DModelData*)modelData, 0x80000, 0x11000084); } else { mpRoseModels[i] = NULL; } @@ -486,7 +491,6 @@ int daNpc_Saru_c::isDelete() { /* 80AC0CE8-80AC0EA4 0009A8 01BC+00 1/1 0/0 0/0 .text reset__12daNpc_Saru_cFv */ void daNpc_Saru_c::reset() { - // NONMATCHING csXyz acStack_20; int iVar1 = (u8*)&field_0xfdc - (u8*)&field_0xfbc; initialize(); @@ -499,7 +503,7 @@ void daNpc_Saru_c::reset() { mPath.setPathInfo(getPathID(), fopAcM_GetRoomNo(this), 0); } - memset(&field_0xfbc, 0, 32); + memset(&field_0xfbc, 0, iVar1); acStack_20.setall(0); acStack_20.y = home.angle.y; @@ -773,7 +777,7 @@ void daNpc_Saru_c::drawOtherMdl() { /* 80AC1B30-80AC1B78 0017F0 0048+00 1/1 0/0 0/0 .text selectAction__12daNpc_Saru_cFv */ int daNpc_Saru_c::selectAction() { field_0xfbc = NULL; - field_0xfbc = &daNpc_Saru_c::talk; + field_0xfbc = &daNpc_Saru_c::wait; return 1; } @@ -1059,126 +1063,129 @@ int daNpc_Saru_c::cutYmLook(int param_1) { /* 80AC28A4-80AC2FD8 002564 0734+00 1/0 0/0 0/0 .text wait__12daNpc_Saru_cFPv */ int daNpc_Saru_c::wait(void* param_1) { - // NONMATCHING obj_so_class* cage_p; switch (mMode) { - case 1: - if (mStagger.checkStagger() == 0) { - switch (mType) { - case 0: - if (field_0xfd9 != 0) { - mFaceMotionSeqMngr.setNo(FACE_NONE, -1.0f, 0, 0); - mMotionSeqMngr.setNo(MOT_WAIT_A, -1.0f, 0, 0); - } else { - mFaceMotionSeqMngr.setNo(FACE_NONE, -1.0f, 0, 0); - mMotionSeqMngr.setNo(MOT_SCARED, -1.0f, 0, 0); - } - break; - - case 2: - cage_p = (obj_so_class*)mActrMngr[0].getActorP(); - if (cage_p != NULL) { - mFaceMotionSeqMngr.setNo(FACE_NONE, -1.0f, 0, 0); - mMotionSeqMngr.setNo(MOT_HELP_E, -1.0f, 0, 0); - if (cage_p->partBreak() == 1) { - mFaceMotionSeqMngr.setNo(FACE_NONE, -1.0f, 0 ,0); - mMotionSeqMngr.setNo(MOT_HELP_C, -1.0f, 0, 0); - } - } else { - mFaceMotionSeqMngr.setNo(FACE_NONE, -1.0f, 0, 0); - mMotionSeqMngr.setNo(MOT_WAIT_A, -1.0f, 0, 0); - } - break; - - default: + case 0: + case 1: + if (mStagger.checkStagger() == 0) { + switch (mType) { + case 0: + if (field_0xfd9 != 0) { mFaceMotionSeqMngr.setNo(FACE_NONE, -1.0f, 0, 0); mMotionSeqMngr.setNo(MOT_WAIT_A, -1.0f, 0, 0); - } + } else { + mFaceMotionSeqMngr.setNo(FACE_NONE, -1.0f, 0, 0); + mMotionSeqMngr.setNo(MOT_SCARED, -1.0f, 0, 0); + } + break; - mMode = 2; - } - // fallthrough - case 2: - if (mType == 1 && daNpcT_chkEvtBit(0x25C) /* dSv_event_flag_c::F_0701 - N/A - Talo discovers monkey in Link's house garden */) { - fopAcM_delete(this); - return 1; - } else { - if (mStagger.checkStagger() == 0) { - if (mType == 2 && mMotionSeqMngr.getNo() == MOT_HELP_E) { - cage_p = (obj_so_class*)mActrMngr[0].getActorP(); - if (cage_p != NULL && cage_p->partBreak() == 1) { - mFaceMotionSeqMngr.setNo(FACE_NONE, -1.0f, 0, 0); + case 2: + cage_p = (obj_so_class*)mActrMngr[0].getActorP(); + if (cage_p != NULL) { + mFaceMotionSeqMngr.setNo(FACE_NONE, -1.0f, 0, 0); + mMotionSeqMngr.setNo(MOT_HELP_E, -1.0f, 0, 0); + if (cage_p->partBreak() == 1) { + mFaceMotionSeqMngr.setNo(FACE_NONE, -1.0f, 0 ,0); mMotionSeqMngr.setNo(MOT_HELP_C, -1.0f, 0, 0); } + } else { + mFaceMotionSeqMngr.setNo(FACE_NONE, -1.0f, 0, 0); + mMotionSeqMngr.setNo(MOT_WAIT_A, -1.0f, 0, 0); + } + break; + + default: + mFaceMotionSeqMngr.setNo(FACE_NONE, -1.0f, 0, 0); + mMotionSeqMngr.setNo(MOT_WAIT_A, -1.0f, 0, 0); + } + + mMode = 2; + } + // fallthrough + case 2: + if (mType == 1 && daNpcT_chkEvtBit(0x25C) /* dSv_event_flag_c::F_0701 - N/A - Talo discovers monkey in Link's house garden */) { + fopAcM_delete(this); + return 1; + } else { + if (mStagger.checkStagger() == 0) { + if (mType == 2 && mMotionSeqMngr.getNo() == MOT_HELP_E) { + cage_p = (obj_so_class*)mActrMngr[0].getActorP(); + if (cage_p != NULL && cage_p->partBreak() == 1) { + mFaceMotionSeqMngr.setNo(FACE_NONE, -1.0f, 0, 0); + mMotionSeqMngr.setNo(MOT_HELP_C, -1.0f, 0, 0); + } + } + + if (mPlayerActorMngr.getActorP() != NULL && mTwilight == false) { + mJntAnm.lookPlayer(0); + if (!chkActorInSight(mPlayerActorMngr.getActorP(), mAttnFovY, mCurAngle.y)) { + mJntAnm.lookNone(0); } - if (mPlayerActorMngr.getActorP() != NULL && mTwilight == false) { - mJntAnm.lookPlayer(0); - if (!chkActorInSight(mPlayerActorMngr.getActorP(), mAttnFovY, mCurAngle.y)) { - mJntAnm.lookNone(0); - } - - if (!srchPlayerActor() && home.angle.y == mCurAngle.y) { - mMode = 1; - } - } else { - mJntAnm.lookNone(0); - if (home.angle.y != mCurAngle.y) { - if (field_0xe34 != 0) { - if (step(home.angle.y, -1, -1, 15, 0)) { - mMode = 1; - } - } else { - setAngle(home.angle.y); + if (!srchPlayerActor() && home.angle.y == mCurAngle.y) { + mMode = 1; + } + } else { + mJntAnm.lookNone(0); + if (home.angle.y != mCurAngle.y) { + if (field_0xe34 != 0) { + if (step(home.angle.y, -1, -1, 15, 0)) { mMode = 1; } - - attention_info.flags = 0; } else { - if (mType == 0) { - if (mMotionSeqMngr.getNo() == MOT_SCARED_LOOK) { - if (mMotionSeqMngr.checkEndSequence() != 0) { - mMode = 1; - } - } else if (field_0xfd4 != 0 && cLib_calcTimer(&field_0xfd4) == 0 && mType == 0 && field_0xfd9 == 0) { - mFaceMotionSeqMngr.setNo(FACE_NONE, -1.0f, 0, 0); - mMotionSeqMngr.setNo(MOT_SCARED_LOOK, -1.0f, 0, 0); - } - } + setAngle(home.angle.y); + mMode = 1; + } - if (!mTwilight) { - srchPlayerActor(); + attention_info.flags = 0; + } else { + if (mType == 0) { + if (mMotionSeqMngr.getNo() == MOT_SCARED_LOOK) { + if (mMotionSeqMngr.checkEndSequence() != 0) { + mMode = 1; + } + } else if (field_0xfd4 != 0 && cLib_calcTimer(&field_0xfd4) == 0 && mType == 0 && field_0xfd9 == 0) { + mFaceMotionSeqMngr.setNo(FACE_NONE, -1.0f, 0, 0); + mMotionSeqMngr.setNo(MOT_SCARED_LOOK, -1.0f, 0, 0); } } - } - mJntAnm.getMode(); + if (!mTwilight) { + srchPlayerActor(); + } + } } - if (mType == 0) { - if (field_0xfd9 == 0) { - mFindCount = 0; - fopAcM_Search(srchYm, this); - int iVar1 = 0; - for (int i = 0; i < mFindCount; i++) { - if (mFindActorPtrs[i]->health > 0) { - iVar1++; - } - } - - if (mFindCount != 0 && iVar1 == 0) { - mEvtNo = EVENT_YM_LOOK; - field_0xfd8 = 1; - } - } else { - field_0xfd8 = 0; - } + switch (mJntAnm.getMode()) { + case 0: + break; } } - break; - case 3: - break; + if (mType == 0) { + if (field_0xfd9 == 0) { + mFindCount = 0; + fopAcM_Search(srchYm, this); + int iVar1 = 0; + for (int i = 0; i < mFindCount; i++) { + if (mFindActorPtrs[i]->health > 0) { + iVar1++; + } + } + + if (mFindCount && iVar1 == 0) { + mEvtNo = EVENT_YM_LOOK; + field_0xfd8 = 1; + } + } else { + field_0xfd8 = 0; + } + } + } + break; + + case 3: + break; } return 1; @@ -1186,33 +1193,34 @@ int daNpc_Saru_c::wait(void* param_1) { /* 80AC2FD8-80AC31B4 002C98 01DC+00 3/0 0/0 0/0 .text talk__12daNpc_Saru_cFPv */ int daNpc_Saru_c::talk(void* param_1) { - // NONMATCHING switch (mMode) { - case 0: - case 1: - if (mStagger.checkStagger() == 0) { - initTalk(mFlowNodeNo, NULL); - mMode = 2; - } + case 0: + case 1: + if (mStagger.checkStagger() == 0) { + initTalk(mFlowNodeNo, NULL); + mMode = 2; + } - case 2: - if (mStagger.checkStagger() == 0) { - if (mTwilight != false || mPlayerAngle == mCurAngle.y) { - if (talkProc(NULL, FALSE, NULL, FALSE) && mFlow.checkEndFlow()) { - mPlayerActorMngr.entry(daPy_getPlayerActorClass()); - dComIfGp_event_reset(); - mMode = 3; - } - - mJntAnm.lookPlayer(0); - if (mTwilight != false) { - mJntAnm.lookNone(0); - } - } else { - mJntAnm.lookPlayer(0); - step(fopAcM_searchPlayerAngleY(this), -1, -1, 15, 0); + case 2: + if (mStagger.checkStagger() == 0) { + if (mTwilight != false || mPlayerAngle == mCurAngle.y) { + if (talkProc(NULL, FALSE, NULL, FALSE) && mFlow.checkEndFlow()) { + mPlayerActorMngr.entry(daPy_getPlayerActorClass()); + dComIfGp_event_reset(); + mMode = 3; } + + mJntAnm.lookPlayer(0); + if (mTwilight != false) { + mJntAnm.lookNone(0); + } + } else { + mJntAnm.lookPlayer(0); + step(fopAcM_searchPlayerAngleY(this), -1, -1, 15, 0); } + } + case 3: + break; } return 0; diff --git a/src/d/actor/d_a_obj_volcball.cpp b/src/d/actor/d_a_obj_volcball.cpp index 30756f81bcc..7b8d9b374bf 100644 --- a/src/d/actor/d_a_obj_volcball.cpp +++ b/src/d/actor/d_a_obj_volcball.cpp @@ -268,20 +268,12 @@ void daObjVolcBall_c::actionEruption() { startQuake(); } - daPy_py_c* player_p = daPy_getPlayerActorClass(); + daPy_py_c* player_p = (daPy_py_c*)daPy_getPlayerActorClass(); u32 timer = cLib_calcTimer(&mTime); - bool disable_ball_create = true; + bool disable_ball_create = timer == 0 || + (getSwBit() != 0xFF && !fopAcM_isSwitch(this, getSwBit())); - if (timer != 0) { - bool bvar2 = false; - if (getSwBit() != 0xFF && !fopAcM_isSwitch(this, getSwBit())) { - bvar2 = true; - } - - if (!bvar2) { - disable_ball_create = false; - } - } + vball_s* var_r29 = &mBall[8]; if (!disable_ball_create) { if (cLib_calcTimer(&mSearchBallCreateTimer) == 0) { @@ -293,30 +285,31 @@ void daObjVolcBall_c::actionEruption() { } } - if (mBall[8].field_0x376 != 0) { + if (var_r29->field_0x376 != 0) { field_0x603++; u8 search_time = getData()->mPlayerSearchTime; f32 shadow_intensity = getData()->mSearchBallShadowIntensity; if (field_0x603 < search_time) { - mBall[8].field_0x4.x = player_p->current.pos.x; - mBall[8].field_0x4.z = player_p->current.pos.z; - mBall[8].field_0x364 = player_p->current.pos; + var_r29->field_0x4.x = player_p->current.pos.x; + var_r29->field_0x4.z = player_p->current.pos.z; + var_r29->field_0x364 = player_p->current.pos; } - cLib_chaseF(&mBall[8].field_0x1c.x, field_0x291c, field_0x291c / (f32)search_time); - cLib_chaseF(&mBall[8].field_0x1c.y, field_0x291c, field_0x291c / (f32)search_time); - cLib_chaseF(&mBall[8].field_0x1c.z, field_0x291c, field_0x291c / (f32)search_time); - cLib_chaseF(&mBall[8].field_0x50, shadow_intensity, shadow_intensity / (f32)search_time); + cLib_chaseF(&var_r29->field_0x1c.x, field_0x291c, field_0x291c / (f32)search_time); + cLib_chaseF(&var_r29->field_0x1c.y, field_0x291c, field_0x291c / (f32)search_time); + cLib_chaseF(&var_r29->field_0x1c.z, field_0x291c, field_0x291c / (f32)search_time); + cLib_chaseF(&var_r29->field_0x50, shadow_intensity, shadow_intensity / (f32)search_time); - mBall[8].field_0x28 = mBall[8].field_0x1c; - mBall[8].mSphCc.SetR(field_0x291c * 100.0f); - mBall[8].mSphCc.SetC(mBall[8].field_0x4); - dComIfG_Ccsp()->Set(&mBall[8].mSphCc); + var_r29->field_0x28 = var_r29->field_0x1c; + var_r29->mSphCc.SetR(field_0x291c * 100.0f); + var_r29->mSphCc.SetC(var_r29->field_0x4); + dComIfG_Ccsp()->Set(&var_r29->mSphCc); } - if (!executeBall() && disable_ball_create) { + int executeResult = executeBall(); + if (!executeResult && disable_ball_create) { if (mIsBigVolc == 0) { setAction(MODE_STOP); mTime = getData()->mNormalWaitTime * 30.0f + cM_rndFX(getData()->mRandWaitTime * 30.0f); diff --git a/src/d/actor/d_a_vrbox2.cpp b/src/d/actor/d_a_vrbox2.cpp index 9e9a079eae8..648ce483df4 100644 --- a/src/d/actor/d_a_vrbox2.cpp +++ b/src/d/actor/d_a_vrbox2.cpp @@ -101,10 +101,10 @@ static int daVrbox2_Draw(vrbox2_class* i_this) { } #ifdef DEBUG - if (g_kankyoHIO.field_0xB4 != 0) { - var_f31 = g_kankyoHIO.field_0xB8; + if (g_kankyoHIO.field_0x0b4 != 0) { + var_f31 = g_kankyoHIO.field_0x0b8; } else { - g_kankyoHIO.field_0xB8 = var_f31; + g_kankyoHIO.field_0x0b8 = var_f31; } #endif diff --git a/src/d/actor/d_flower.inc b/src/d/actor/d_flower.inc index 5774bb9067f..f08767a1f72 100644 --- a/src/d/actor/d_flower.inc +++ b/src/d/actor/d_flower.inc @@ -11,9 +11,7 @@ const u16 l_J_Ohana00_64TEX__height = 63; #include "assets/l_J_Ohana00_64TEX.h" /* 805253D8-8052569C 002200 02C4+00 0/1 0/0 0/0 .data l_flowerPos */ -#pragma push -#pragma force_active on -SECTION_DATA static u8 l_flowerPos[708] = { +static u8 l_flowerPos[708] = { 0xC0, 0x8C, 0x2C, 0xF7, 0x42, 0x05, 0xBC, 0xDF, 0xC1, 0xA1, 0x00, 0x70, 0xBF, 0x50, 0x51, 0xB9, 0x42, 0x12, 0x58, 0xAD, 0xC0, 0xDE, 0xCE, 0x40, 0xC1, 0x04, 0x67, 0x23, 0x41, 0xE5, 0x87, 0x25, 0xC1, 0x1B, 0xF3, 0xF8, 0xC1, 0x8F, 0x17, 0x3E, 0x42, 0x05, 0x7F, 0xC6, 0xC1, 0x83, 0x9B, 0xFC, @@ -60,12 +58,9 @@ SECTION_DATA static u8 l_flowerPos[708] = { 0x41, 0x98, 0xE3, 0x73, 0xC0, 0xD3, 0xBD, 0x8E, 0xC0, 0xCB, 0xC6, 0x04, 0x41, 0x98, 0xC3, 0x84, 0xC0, 0xE9, 0x27, 0x8D, }; -#pragma pop /* 8052569C-80525750 0024C4 00B4+00 0/1 0/0 0/0 .data l_flowerNormal */ -#pragma push -#pragma force_active on -SECTION_DATA static u8 l_flowerNormal[180] = { +static u8 l_flowerNormal[180] = { 0x3C, 0x8D, 0x2C, 0x38, 0x3F, 0x7F, 0xF5, 0xF9, 0x3B, 0x46, 0xF7, 0xA1, 0x3C, 0x76, 0x83, 0x7F, 0x3F, 0x7F, 0xF5, 0xF9, 0x3C, 0x12, 0x5F, 0xE9, 0xBB, 0xE5, 0xA3, 0x5D, 0x3F, 0x7F, 0xF5, 0xF9, 0x3C, 0x83, 0x57, 0xA3, 0x3B, 0xF9, 0xB1, 0x31, 0x3F, 0x7F, 0xF5, 0xF9, 0x3C, @@ -79,20 +74,14 @@ SECTION_DATA static u8 l_flowerNormal[180] = { 0xF5, 0xF9, 0xBC, 0x4A, 0x31, 0xE8, 0x3C, 0x4F, 0x07, 0x3A, 0x3F, 0x7F, 0xF5, 0xF9, 0xBC, 0x46, 0x54, 0x0D, 0x3C, 0x4B, 0xEE, 0x80, 0x3F, 0x7F, 0xF5, 0xF9, 0x3C, 0x49, 0x81, 0xBF, }; -#pragma pop /* 80525750-80525758 002578 0008+00 0/1 0/0 0/0 .data l_flowerColor */ -#pragma push -#pragma force_active on -SECTION_DATA static u8 l_flowerColor[8] = { +static u8 l_flowerColor[8] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xB2, 0xB2, 0xB2, 0xFF, }; -#pragma pop /* 80525758-80525898 002580 0138+08 0/1 0/0 0/0 .data l_flowerTexCoord */ -#pragma push -#pragma force_active on -SECTION_DATA static u8 l_flowerTexCoord[] = { +static u8 l_flowerTexCoord[] = { 0x40, 0x40, 0xD0, 0xEA, 0x3D, 0x69, 0x70, 0x72, 0x40, 0x7D, 0xD8, 0x30, 0x3F, 0x81, 0x3D, 0xC9, 0x40, 0x40, 0xCE, 0x85, 0x3F, 0x81, 0x3D, 0xC9, 0x40, 0x01, 0xDD, 0x33, 0x3F, 0x81, 0x3D, 0xC9, 0x40, 0x40, 0xD0, 0xEA, 0x3F, 0xF9, 0x46, 0xD4, 0x40, 0x00, 0xCD, 0xB8, 0xBF, 0x7F, 0xD4, 0x39, @@ -113,7 +102,6 @@ SECTION_DATA static u8 l_flowerTexCoord[] = { 0x3F, 0x59, 0x4B, 0x6A, 0xBC, 0xAD, 0x94, 0x8E, 0x3E, 0xA7, 0x7F, 0x28, 0x3D, 0x28, 0x87, 0xA9, 0x3E, 0xA7, 0x67, 0x4D, 0x3C, 0x14, 0x46, 0x74, 0x3E, 0xA7, 0x73, 0xE2, 0xBC, 0x2F, 0x46, 0xAA, 0x3E, 0xA7, 0x72, 0xD6, 0xBD, 0x2F, 0x46, 0xAA}; -#pragma pop /* 80525898-805259F8 0026C0 0150+10 0/1 0/0 0/0 .data l_J_hana00DL */ #include "assets/l_J_hana00DL.h" @@ -135,9 +123,7 @@ const u16 l_J_Ohana01_64128_0419TEX__height = 127; #include "assets/l_J_Ohana01_64128_0419TEX.h" /* 80526C18-805270E0 003A40 04C8+00 0/1 0/0 0/0 .data l_flowerPos2 */ -#pragma push -#pragma force_active on -SECTION_DATA static u8 l_flowerPos2[1224] = { +static u8 l_flowerPos2[1224] = { 0x40, 0x25, 0x9F, 0x34, 0x42, 0xC2, 0x95, 0x72, 0xC1, 0x22, 0x34, 0x78, 0x41, 0x4D, 0xF9, 0x63, 0x43, 0x09, 0x35, 0x0D, 0x40, 0x97, 0xD7, 0x54, 0x41, 0x76, 0x80, 0x55, 0x42, 0xBA, 0x1C, 0xB4, 0x41, 0x91, 0x3E, 0x0D, 0xC0, 0x99, 0x8D, 0x47, 0x42, 0xC2, 0x8D, 0xF5, 0x41, 0x12, 0xA1, 0x12, @@ -216,12 +202,9 @@ SECTION_DATA static u8 l_flowerPos2[1224] = { 0x3E, 0xBC, 0xD0, 0x9A, 0xC1, 0x1E, 0x5D, 0x2E, 0x3F, 0xCC, 0x0D, 0x13, 0x3E, 0xBC, 0xC7, 0x2A, 0xC1, 0x1E, 0x5D, 0x2D, 0xBF, 0xA4, 0x4D, 0x4D, }; -#pragma pop /* 805270E0-80527200 003F08 0120+00 0/1 0/0 0/0 .data l_flowerNormal2 */ -#pragma push -#pragma force_active on -SECTION_DATA static u8 l_flowerNormal2[288] = { +static u8 l_flowerNormal2[288] = { 0xBB, 0xC4, 0x93, 0x42, 0x3F, 0x7F, 0xF6, 0x6F, 0xBC, 0x83, 0x0E, 0x3D, 0x3C, 0x83, 0x0C, 0x24, 0x3F, 0x7F, 0xF5, 0x84, 0x3C, 0x03, 0x0E, 0x3D, 0xB8, 0x51, 0xB7, 0x17, 0x3F, 0x7F, 0xF5, 0xF9, 0x3C, 0x8F, 0x57, 0xF7, 0xBC, 0x8F, 0x57, 0xF7, 0x3F, 0x7F, 0xF5, 0xF9, 0x38, 0x1F, 0x62, 0x30, @@ -241,20 +224,14 @@ SECTION_DATA static u8 l_flowerNormal2[288] = { 0x3F, 0x7F, 0xF5, 0xF9, 0xBC, 0x8A, 0x28, 0x78, 0x3C, 0x8B, 0xFE, 0x3B, 0x3F, 0x7F, 0xF5, 0xF9, 0x3B, 0x76, 0x7B, 0x1C, 0x3B, 0x99, 0x6B, 0x76, 0x3F, 0x7F, 0xF5, 0xF9, 0xBC, 0x8A, 0x1D, 0xFC, }; -#pragma pop /* 80527200-80527208 004028 0008+00 0/1 0/0 0/0 .data l_flowerColor2 */ -#pragma push -#pragma force_active on -SECTION_DATA static u8 l_flowerColor2[8] = { +static u8 l_flowerColor2[8] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xB2, 0xFF, }; -#pragma pop /* 80527208-80527338 004030 0120+10 0/1 0/0 0/0 .data l_flowerTexCoord2 */ -#pragma push -#pragma force_active on -SECTION_DATA static u8 l_flowerTexCoord2[] = { +static u8 l_flowerTexCoord2[] = { 0x3F, 0xF3, 0x6D, 0x11, 0x3F, 0x72, 0x0B, 0xA2, 0x3F, 0x80, 0x00, 0x00, 0x3C, 0xAB, 0xDC, 0x27, 0x3D, 0xC9, 0x2E, 0xE8, 0x3F, 0x72, 0x0B, 0xA2, 0x40, 0x2B, 0x93, 0x9A, 0x3F, 0x81, 0x7B, 0x96, 0x40, 0x2B, 0x93, 0x9A, 0x3F, 0x7B, 0xB5, 0x18, 0x40, 0x06, 0x1F, 0xCD, 0x3F, 0x7B, 0xB5, 0x18, @@ -273,7 +250,6 @@ SECTION_DATA static u8 l_flowerTexCoord2[] = { 0x40, 0x66, 0xBD, 0x6A, 0x3F, 0x97, 0xF6, 0xBA, 0x40, 0x7C, 0x19, 0xB1, 0x3F, 0x80, 0x5E, 0x57, 0x40, 0x1B, 0x7D, 0x52, 0x3F, 0x97, 0xF6, 0xBA, 0x40, 0x04, 0x26, 0x74, 0x3F, 0x80, 0x3F, 0x79, 0x40, 0x1B, 0x7D, 0x52, 0x3F, 0x80, 0x3F, 0x79, 0x40, 0x1B, 0x7D, 0x52, 0x3F, 0x51, 0x10, 0x6F}; -#pragma pop /* 80527338-80527478 004160 0138+08 0/1 0/0 0/0 .data l_J_hana01DL */ #include "assets/l_J_hana01DL.h" @@ -568,7 +544,6 @@ dFlower_packet_c::dFlower_packet_c() { } /* 80521DAC-80522774 00614C 09C8+00 2/0 0/0 0/0 .text draw__16dFlower_packet_cFv */ -// NONMATCHING void dFlower_packet_c::draw() { dScnKy_env_light_c* kankyo = dKy_getEnvlight(); j3dSys.reinitGX(); @@ -589,6 +564,7 @@ void dFlower_packet_c::draw() { GXSetArray(GX_VA_CLR0, &l_flowerColor, 4); GXSetArray(GX_VA_TEX0, &l_flowerTexCoord, 8); + GXColor sp64; dFlower_room_c* sp5C = m_room; for (int i = 0; i < 64; i++) { @@ -602,7 +578,7 @@ void dFlower_packet_c::draw() { if (dComIfGp_roomControl_getStatusRoomDt(i) != NULL) { sp4C = dComIfGp_roomControl_getStatusRoomDt(i)->getLightVecInfoNum(); } - + if (dKy_SunMoon_Light_Check() == TRUE && sp4C < 2) { sp4C = 2; } @@ -625,20 +601,32 @@ void dFlower_packet_c::draw() { dKy_setLight_nowroom_grass(sp50->room_no, 1.0f); for (dFlower_data_c* sp44 = sp5C->getData(); sp44 != NULL; sp44 = sp44->mp_next) { - GXColor sp64; - sp64.r = (sp44->field_0x04 & 0x1F) * 2; - sp64.g = ((sp44->field_0x04 >> 5) & 0x1F) * 2; - sp64.b = ((sp44->field_0x04 >> 0xA) & 0x1F) * 2; +#if DEBUG + if (g_kankyoHIO.field_0x698 != 0) { + sp64.r = g_kankyoHIO.field_0x694 * 2; + sp64.g = g_kankyoHIO.field_0x695 * 2; + sp64.b = g_kankyoHIO.field_0x696 * 2; + } else { +#endif + sp64.r = (sp44->field_0x04 & 0x1F) * 2; + sp64.g = ((sp44->field_0x04 >> 5) & 0x1F) * 2; + sp64.b = ((sp44->field_0x04 >> 0xA) & 0x1F) * 2; +#if DEBUG + } +#endif if (daPy_py_c::checkNowWolfPowerUp()) { f32 var_f31 = g_env_light.bg_amb_col[0].r / 255.0f; - sp64.r = (((sp44->field_0x04 & 0x1F) * 2) + 0x10) * (4.0f * var_f31); + f32 var_f1 = (((sp44->field_0x04 & 0x1F) * 2 + 0x10)); + sp64.r = var_f1 * (var_f31 * 4.0f); var_f31 = g_env_light.bg_amb_col[0].g / 255.0f; - sp64.g = ((((sp44->field_0x04 >> 5) & 0x1F) * 2) + 0x10) * (4.0f * var_f31); + f32 var_f1_2 = (((sp44->field_0x04 >> 5) & 0x1F) * 2 + 0x10); + sp64.g = var_f1_2 * (4.0f * var_f31); var_f31 = g_env_light.bg_amb_col[0].b / 255.0f; - sp64.b = ((((sp44->field_0x04 >> 0xA) & 0x1F) * 2) + 0x10) * (4.0f * var_f31); + f32 var_f1_3 = (((sp44->field_0x04 >> 10) & 0x1F) * 2 + 0x10); + sp64.b = var_f1_3 * (4.0f * var_f31); } if (sp64.r == 0x3E) { @@ -652,7 +640,7 @@ void dFlower_packet_c::draw() { if (sp64.b == 0x3E) { sp64.b = sp50->AmbCol.b; } - + GXSetChanAmbColor(GX_COLOR0A0, sp64); if (!cLib_checkBit(sp44->m_state, 4) && !cLib_checkBit(sp44->m_state, 0x40)) { @@ -686,12 +674,17 @@ void dFlower_packet_c::draw() { int sp2C = 6; dKy_tevstr_c* temp_r29 = dComIfGp_roomControl_getTevStr(i); GXColorS10 sp78 = {0, 0, 0, 0}; - int sp7C = 0; if (dComIfGp_roomControl_getStatusRoomDt(i) != NULL) { sp2C = dComIfGp_roomControl_getStatusRoomDt(i)->getLightVecInfoNum(); } +#if DEBUG + if (g_kankyoHIO.field_0x06d != 0) { + sp2C = g_kankyoHIO.field_0x79b; + } +#endif + if (dKy_SunMoon_Light_Check() == TRUE && sp2C < 2) { sp2C = 2; } @@ -707,64 +700,71 @@ void dFlower_packet_c::draw() { dKy_GxFog_tevstr_set(temp_r29); dKy_setLight_nowroom_grass(temp_r29->room_no, 1.0f); + f32 var_f29; + f32 var_f28; + f32 var_f27; + + f32 temp1 = 0.03125f; while (sp34 != NULL) { - f32 var_f29 = temp_r29->AmbCol.r * 0.03125f; + f32 var_f29 = temp_r29->AmbCol.r * temp1; if (var_f29 > 1.0f) { var_f29 = 1.0f; } - f32 var_f28 = temp_r29->AmbCol.g * 0.03125f; + f32 var_f28 = temp_r29->AmbCol.g * temp1; if (var_f28 > 1.0f) { var_f28 = 1.0f; } - f32 var_f27 = temp_r29->AmbCol.b * 0.03125f; + f32 var_f27 = temp_r29->AmbCol.b * temp1; if (var_f27 > 1.0f) { var_f27 = 1.0f; } GXColor sp28; - u8 sp24 = -0.4f * temp_r29->AmbCol.r * var_f29; - u8 sp25 = -0.4f * temp_r29->AmbCol.g * var_f28; - u8 sp26 = -0.4f * temp_r29->AmbCol.b * var_f27; + //u8 sp26, sp25, sp24; + GXColor sp24; + sp24.r = -0.4f * temp_r29->AmbCol.r * var_f29; + sp24.g = -0.4f * temp_r29->AmbCol.g * var_f28; + sp24.b = -0.4f * temp_r29->AmbCol.b * var_f27; u8 sp8 = sp30 & 7; switch (sp8) { case 0: - sp28.r = temp_r29->AmbCol.r + sp24; + sp28.r = temp_r29->AmbCol.r + sp24.r; sp28.g = temp_r29->AmbCol.g; sp28.b = temp_r29->AmbCol.b; break; case 1: sp28.r = temp_r29->AmbCol.r; - sp28.g = temp_r29->AmbCol.g + sp25; + sp28.g = temp_r29->AmbCol.g + sp24.g; sp28.b = temp_r29->AmbCol.b; break; case 2: sp28.r = temp_r29->AmbCol.r; sp28.g = temp_r29->AmbCol.g; - sp28.b = temp_r29->AmbCol.b + sp26; + sp28.b = temp_r29->AmbCol.b + sp24.b; break; case 3: - sp28.r = temp_r29->AmbCol.r + sp24; - sp28.g = temp_r29->AmbCol.g + sp25; + sp28.r = temp_r29->AmbCol.r + sp24.r; + sp28.g = temp_r29->AmbCol.g + sp24.g; sp28.b = temp_r29->AmbCol.b; break; case 4: sp28.r = temp_r29->AmbCol.r; - sp28.g = temp_r29->AmbCol.g + sp25; - sp28.b = temp_r29->AmbCol.b + sp26; + sp28.g = temp_r29->AmbCol.g + sp24.g; + sp28.b = temp_r29->AmbCol.b + sp24.b; break; case 5: - sp28.r = temp_r29->AmbCol.r + sp24; + sp28.r = temp_r29->AmbCol.r + sp24.r; sp28.g = temp_r29->AmbCol.g; - sp28.b = temp_r29->AmbCol.b + sp26; + sp28.b = temp_r29->AmbCol.b + sp24.b; break; case 6: - sp28.r = temp_r29->AmbCol.r + sp24; - sp28.g = temp_r29->AmbCol.g + sp25; - sp28.b = temp_r29->AmbCol.b + sp26; + sp28.r = temp_r29->AmbCol.r + sp24.r; + sp28.g = temp_r29->AmbCol.g + sp24.g; + sp28.b = temp_r29->AmbCol.b + sp24.b; break; case 7: break; diff --git a/src/d/actor/d_grass.inc b/src/d/actor/d_grass.inc index 96bac4cf995..672720ea35c 100644 --- a/src/d/actor/d_grass.inc +++ b/src/d/actor/d_grass.inc @@ -7,6 +7,9 @@ #include "f_op/f_op_overlap_mng.h" #include +#include "d/d_camera.h" +#include "f_op/f_op_camera_mng.h" + /* 805231F8-805239F8 000020 0800+00 0/1 0/0 0/0 .data l_M_kusa05_RGBATEX */ const u16 l_M_Hijiki00TEX__width = 31; const u16 l_M_Hijiki00TEX__height = 31; @@ -18,9 +21,7 @@ const u16 l_M_kusa05_RGBATEX__height = 31; #include "assets/l_M_Hijiki00TEX.h" // ALIGN 32 /* 805241F8-805245B8 001020 03C0+00 0/1 0/0 0/0 .data l_pos */ -#pragma push -#pragma force_active on -SECTION_DATA static u8 l_pos[960] = { +static u8 l_pos[960] = { 0x3F, 0x4A, 0x56, 0xEF, 0xC2, 0x20, 0x00, 0x00, 0x41, 0xFB, 0x17, 0xE4, 0x41, 0xAA, 0xBB, 0xEA, 0xC2, 0x20, 0x00, 0x00, 0xC1, 0xB7, 0x03, 0x7A, 0x42, 0x55, 0x8D, 0x6F, 0x43, 0x13, 0x16, 0x3F, 0xC0, 0xC7, 0x24, 0x07, 0x41, 0xE3, 0xC5, 0x31, 0x43, 0x13, 0x16, 0x3F, 0x42, 0x3A, 0x76, 0x90, @@ -82,27 +83,18 @@ SECTION_DATA static u8 l_pos[960] = { 0x43, 0x72, 0x8F, 0x21, 0x42, 0x23, 0xF4, 0x30, 0xC1, 0xE5, 0xEB, 0x07, 0x42, 0x80, 0xF7, 0x9F, 0x40, 0xD8, 0x8F, 0xF3, 0xC1, 0xDC, 0xC3, 0xBB, 0x42, 0x96, 0x89, 0xEC, 0xC1, 0xAA, 0x6C, 0x09, }; -#pragma pop /* 805245B8-805245C4 0013E0 000C+00 0/1 0/0 0/0 .data l_normal */ -#pragma push -#pragma force_active on -SECTION_DATA static Vec l_normal = {0.0f, 1.0f, 0.0f}; -#pragma pop +static Vec l_normal = {0.0f, 1.0f, 0.0f}; /* 805245C4-805245D8 0013EC 0014+00 0/1 0/0 0/0 .data l_color */ -#pragma push -#pragma force_active on -SECTION_DATA static GXColor l_color[] = { +static GXColor l_color[] = { {0xFF, 0xFF, 0xFF, 0x00}, {0xFF, 0xFF, 0xFF, 0x80}, {0xFF, 0xFF, 0xFF, 0x79}, {0xFF, 0xFF, 0xFF, 0x73}, {0xFF, 0xFF, 0xFF, 0xFF}, }; -#pragma pop /* 805245D8-80524678 001400 00A0+00 0/1 0/0 0/0 .data l_texCoord */ -#pragma push -#pragma force_active on -SECTION_DATA static u8 l_texCoord[160] = { +static u8 l_texCoord[160] = { 0x3F, 0x86, 0xF6, 0x27, 0x3F, 0x9C, 0x00, 0x00, 0x40, 0x03, 0x7B, 0x14, 0x3F, 0x9C, 0x00, 0x00, 0x40, 0x03, 0x7B, 0x14, 0x3D, 0x00, 0x00, 0x00, 0x3F, 0x86, 0xF6, 0x27, 0x3D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3D, 0x00, 0x00, 0x00, 0xBF, 0x80, 0x00, 0x00, 0x3D, 0x00, 0x00, 0x00, @@ -114,7 +106,6 @@ SECTION_DATA static u8 l_texCoord[160] = { 0x3F, 0x94, 0x00, 0x00, 0x3F, 0x9C, 0x00, 0x00, 0xBD, 0xC0, 0x00, 0x00, 0x3F, 0x9C, 0x00, 0x00, 0x3F, 0x94, 0x00, 0x00, 0x3F, 0x80, 0x00, 0x00, 0xBD, 0xC0, 0x00, 0x00, 0x3F, 0x80, 0x00, 0x00, }; -#pragma pop /* 80524678-80524758 0014A0 00CB+15 0/1 0/0 0/0 .data l_M_Kusa_9qDL */ #include "assets/l_M_Kusa_9qDL.h" @@ -127,6 +118,7 @@ SECTION_DATA static u8 l_texCoord[160] = { /* 80524918-805249D8 001740 00A8+18 0/2 0/0 0/0 .data l_Tengusa_matDL */ #include "assets/l_Tengusa_matDL.h" + l_Tengusa_matDL(l_M_Hijiki00TEX) /* 805249D8-80524A98 001800 00A8+18 0/2 0/0 0/0 .data l_kusa9q_matDL */ @@ -493,7 +485,6 @@ dGrass_packet_c::dGrass_packet_c() { } /* 8051F03C-8051FABC 0033DC 0A80+00 1/0 0/0 0/0 .text draw__15dGrass_packet_cFv */ -// NONMATCHING void dGrass_packet_c::draw() { dScnKy_env_light_c* kankyo = dKy_getEnvlight(); cXyz spB4; @@ -570,6 +561,12 @@ void dGrass_packet_c::draw() { var_f29 = 100.0f; } +#if DEBUG + if (g_kankyoHIO.field_0x69c != 0.0f) { + var_f29 = g_kankyoHIO.field_0x69c; + } +#endif + for (int i = 0; i < 64; i++) { dGrass_data_c* var_r29 = sp54->getData(); if (var_r29 != NULL && dComIfGp_roomControl_checkStatusFlag(i, 0x10)) { @@ -600,6 +597,12 @@ void dGrass_packet_c::draw() { sp48 = dComIfGp_roomControl_getStatusRoomDt(i)->getLightVecInfoNum(); } +#if DEBUG + if (g_kankyoHIO.field_0x06d != 0) { + sp48 = g_kankyoHIO.field_0x79b; + } +#endif + if (dKy_SunMoon_Light_Check() == TRUE && sp48 < 2) { sp48 = 2; } @@ -626,6 +629,20 @@ void dGrass_packet_c::draw() { dKy_GfFog_tevstr_set(sp44); dKy_setLight_nowroom_grass(sp44->room_no, 0.0f); + f32 temp1 = 0.001953125f; // fakematch + +#if DEBUG + camera_class* sp34 = dComIfGp_getCamera(0); + int sp30 = 0; + if (dCam_getBody() != NULL && + (dCam_getBody()->Mode() == 7 || dCam_getBody()->Mode() == 8) && + sp34 != NULL && + dCam_getBody()->V() < -750.0f && + var_r29->m_pos.abs(sp34->lookat.eye) < 200.0f) { + sp30 = 1; + } +#endif + while (var_r29 != NULL) { if (var_r29->field_0x05 <= 3 || var_r29->field_0x05 >= 10) { if (sp48 <= 2) { @@ -646,47 +663,61 @@ void dGrass_packet_c::draw() { GFSetTevColorS10(GX_TEVREG1, sp98); GXColor sp38; - sp38.r = (var_r29->m_addCol & 0x1F) * 2; - sp38.g = ((var_r29->m_addCol >> 5) & 0x1F) * 2; - sp38.b = ((var_r29->m_addCol >> 0xA) & 0x1F) * 2; - if (daPy_py_c::checkNowWolfPowerUp()) { - f32 var_f26 = g_env_light.bg_amb_col[0].r / 255.0f; - sp38.r = (((var_r29->m_addCol & 0x1F) * 2) + 0x10) * (4.0f * var_f26); - - var_f26 = g_env_light.bg_amb_col[0].g / 255.0f; - sp38.g = ((((var_r29->m_addCol >> 5) & 0x1F) * 2) + 0x10) * (4.0f * var_f26); - - var_f26 = g_env_light.bg_amb_col[0].b / 255.0f; - sp38.b = ((((var_r29->m_addCol >> 0xA) & 0x1F) * 2) + 0x10) * (4.0f * var_f26); - } - - f32 sp2C = 1.0f - ((int)var_r29->m_pos.x * 0.001953125f); - - f32 var_f28 = 1.1f - ((int)var_r29->m_pos.x / 2000.0f); - var_f28 -= (int)var_r29->m_pos.z / 2000.0f; - - if (var_f28 > 1.0f) { - var_f28 = 1.0f; - } - - if (sp38.r == 0x3E) { - sp38.r = sp44->AmbCol.r * sp2C; +#if DEBUG + if (g_kankyoHIO.field_0x698) { + sp38.r = g_kankyoHIO.field_0x694 * 2; + sp38.g = g_kankyoHIO.field_0x695 * 2; + sp38.b = g_kankyoHIO.field_0x696 * 2; } else { - sp38.r = sp38.r * var_f28; - } +#endif + sp38.r = (var_r29->m_addCol & 0x1F) * 2; + sp38.g = ((var_r29->m_addCol >> 5) & 0x1F) * 2; + sp38.b = ((var_r29->m_addCol >> 0xA) & 0x1F) * 2; - if (sp38.g == 0x3E) { - sp38.g = sp44->AmbCol.g * sp2C; - } else { - sp38.g = sp38.g * var_f28; - } + if (daPy_py_c::checkNowWolfPowerUp()) { + f32 var_f26 = g_env_light.bg_amb_col[0].r / 255.0f; + f32 var_f1 = (((var_r29->m_addCol & 0x1F) * 2 + 0x10)); + sp38.r = var_f1 * (var_f26 * 4.0f); - if (sp38.b == 0x3E) { - sp38.b = sp44->AmbCol.b * sp2C; - } else { - sp38.b = sp38.b * var_f28; + var_f26 = g_env_light.bg_amb_col[0].g / 255.0f; + f32 var_f1_2 = (((var_r29->m_addCol >> 5) & 0x1F) * 2 + 0x10); + sp38.g = var_f1_2 * (4.0f * var_f26); + + var_f26 = g_env_light.bg_amb_col[0].b / 255.0f; + f32 var_f1_3 = (((var_r29->m_addCol >> 10) & 0x1F) * 2 + 0x10); + sp38.b = var_f1_3 * (4.0f * var_f26); + } + + f32 sp2C = 1.0f - (((int)var_r29->m_pos.x & 0xFF) * temp1); + + f32 var_f28 = 1.1f - (((u8)(int)var_r29->m_pos.x & 0xFF) / 2000.0f); + var_f28 -= ((int)var_r29->m_pos.z & 0xFF) / 2000.0f; + + if (var_f28 > 1.0f) { + var_f28 = 1.0f; + } + + if (sp38.r == 0x3E) { + sp38.r = sp44->AmbCol.r * sp2C; + } else { + sp38.r = sp38.r * var_f28; + } + + if (sp38.g == 0x3E) { + sp38.g = sp44->AmbCol.g * sp2C; + } else { + sp38.g = sp38.g * var_f28; + } + + if (sp38.b == 0x3E) { + sp38.b = sp44->AmbCol.b * sp2C; + } else { + sp38.b = sp38.b * var_f28; + } +#ifdef DEBUG } +#endif GXSetChanAmbColor(GX_COLOR0A0, sp38); @@ -740,7 +771,6 @@ void dGrass_packet_c::draw() { } /* 8051FABC-8051FF88 003E5C 04CC+00 1/1 0/0 0/0 .text calc__15dGrass_packet_cFv */ -// NONMATCHING void dGrass_packet_c::calc() { cXyz* temp_r29 = dKyw_get_wind_vec(); f32 var_f31 = dKyw_get_wind_pow() * dKyw_get_wind_pow(); @@ -766,26 +796,28 @@ void dGrass_packet_c::calc() { var_f31 = 0.01f; } + int sp18; dGrass_anm_c* sp14 = getAnm(); f32 temp_f30 = cM_scos(field_0x1d714); field_0x1d714 += (int)(40.0f + cM_rndF(290.0f)); - int sp18 = 1.0f + ((1.0f - var_f31) * (2.0f + NREG_F(3))); + sp18 = 1.0f + ((1.0f - var_f31) * (2.0f + NREG_F(3))); - for (int i = 0; i < 16; i++) { - f32 temp_f28 = i * 0.0625f; - f32 temp_f29 = cLib_maxLimit(500.0f + (500.0f * (i / 16)), 2000.0f); + f32 temp1 = 0.0625f; + for (int i = 0; i < 16; sp14++, i++) { + f32 temp_f28 = i * temp1; + f32 temp2 = 500.0f + (500.0f * (i / 16)); + f32 temp_f29 = cLib_maxLimit(temp2, 2000.0f); f32 temp_f27_2 = 1.6f + (0.69999999f * cM_ssin(exec_count_dammy2)); - s16 sp8 = 0.69999999f * var_f31 * (temp_f29 + ((1.0f + (-0.2f * temp_f28)) * (10.0f * temp_f29 * (cM_ssin(exec_count_dammy + (i * 3050)) + temp_f27_2)))); + f32 temp3 = cM_ssin(exec_count_dammy + i * 3050); + s16 sp8 = 0.69999999f * var_f31 * (temp_f29 + ((1.0f + (-0.2f * temp_f28)) * (10.0f * temp_f29 * (temp3 + temp_f27_2)))); - exec_count_dammy += (int)(525.0f * var_f31); - exec_count_dammy2 += (int)(325.0f * var_f31); + exec_count_dammy += (int)(s16)(525.0f * var_f31); + exec_count_dammy2 += (int)(s16)(325.0f * var_f31); cLib_addCalcAngleS(&sp14->m_angX, (s16)sp8, sp18, 4000, 1); cLib_addCalcAngleS(&sp14->m_angY, (s16)cM_atan2s(temp_r29->x, temp_r29->z), 20, 4000, 1); - - sp14++; } int sp10 = dComIfGp_roomControl_getStayNo(); @@ -808,7 +840,7 @@ void dGrass_packet_c::calc() { if (var_r30->field_0x02 >= 0) { var_r30->hitCheck(sp10, spA); } else if (var_r30->field_0x02 < -2) { - var_r30->field_0x02 += 1; + var_r30->field_0x02++; } } else if (var_r30->field_0x02 >= 16) { daGrass_c::getGrass()->deleteAnm(var_r30->field_0x02); @@ -1037,21 +1069,3 @@ void dGrass_packet_c::setAnm(int i_idx, s16) { anm_p->m_angY = 0; anm_p->m_angX = 0; } - -/* 80520928-80520934 004CC8 000C+00 1/1 0/0 0/0 .text __ct__13dGrass_room_cFv */ -dGrass_room_c::dGrass_room_c() { - mp_data = NULL; -} - -/* 80520934-80520940 004CD4 000C+00 1/1 0/0 0/0 .text __ct__12dGrass_anm_cFv */ -dGrass_anm_c::dGrass_anm_c() { - m_state = 0; -} - -/* 80520940-8052097C 004CE0 003C+00 2/2 0/0 0/0 .text __dt__13dGrass_data_cFv */ -dGrass_data_c::~dGrass_data_c() {} - -/* 8052097C-80520988 004D1C 000C+00 1/1 0/0 0/0 .text __ct__13dGrass_data_cFv */ -dGrass_data_c::dGrass_data_c() { - m_state = 0; -} diff --git a/src/d/d_kankyo_rain.cpp b/src/d/d_kankyo_rain.cpp index d674040c307..dd95a4d08e3 100644 --- a/src/d/d_kankyo_rain.cpp +++ b/src/d/d_kankyo_rain.cpp @@ -1890,10 +1890,10 @@ void vrkumo_move() { if (filelist != NULL) { sp2C = dStage_FileList_dt_SeaLevel(filelist); #ifdef DEBUG - if (g_kankyoHIO.field_0xB4) { - sp2C = g_kankyoHIO.field_0xB8; + if (g_kankyoHIO.field_0x0b4) { + sp2C = g_kankyoHIO.field_0x0b8; } else { - g_kankyoHIO.field_0xB8 = sp2C; + g_kankyoHIO.field_0x0b8 = sp2C; } #endif } @@ -4615,10 +4615,10 @@ void drawVrkumo(Mtx drawMtx, GXColor& color, u8** tex) { sp70 = dStage_FileList_dt_SeaLevel(filelist); #ifdef DEBUG - if (g_kankyoHIO.field_0xB4) { - sp70 = g_kankyoHIO.field_0xB8; + if (g_kankyoHIO.field_0x0b4) { + sp70 = g_kankyoHIO.field_0x0b8; } else { - g_kankyoHIO.field_0xB8 = sp70; + g_kankyoHIO.field_0x0b8 = sp70; } #endif }