diff --git a/.clangd b/.clangd index 2426bef5b..6c7744b87 100644 --- a/.clangd +++ b/.clangd @@ -12,7 +12,7 @@ CompileFlags: "-Wbitwise-op-parentheses", "-Wunused-variable", # "-Wunused-but-set-variable", - # "-Wunused-parameter", + "-Wunused-parameter", "-Wunused-but-set-parameter", "-Wself-assign", ] diff --git a/configure.py b/configure.py index 22f2216da..2eda6e000 100755 --- a/configure.py +++ b/configure.py @@ -1524,7 +1524,7 @@ config.libs = [ ActorRel(Matching, "d_a_kamome2"), # Demo-only ActorRel(NonMatching, "d_a_kantera"), ActorRel(Matching, "d_a_kn"), - ActorRel(Equivalent, "d_a_kokiie"), + ActorRel(Matching, "d_a_kokiie"), ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_ks"), ActorRel(NonMatching, "d_a_kt"), # regalloc ActorRel(Matching, "d_a_mflft"), @@ -1703,8 +1703,8 @@ config.libs = [ ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_obj_ganonbed"), ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_obj_gaship"), ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_obj_gaship2"), - ActorRel(Matching, "d_a_obj_gnnbtltaki"), - ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_obj_gnndemotakie"), + ActorRel(Matching, "d_a_obj_gnnbtltaki"), + ActorRel(Matching, "d_a_obj_gnndemotakie"), ActorRel(NonMatching, "d_a_obj_gnndemotakis"), ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_obj_gong"), ActorRel(NonMatching, "d_a_obj_gtaki"), @@ -1736,7 +1736,7 @@ config.libs = [ ActorRel(Matching, "d_a_obj_mtest"), ActorRel(Matching, "d_a_obj_nest"), ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_obj_ojtree"), - ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_obj_ospbox"), + ActorRel(Matching, "d_a_obj_ospbox"), ActorRel(Matching, "d_a_obj_paper"), ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_obj_pbka"), ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_obj_pfall"), diff --git a/include/JSystem/J3DAssert.h b/include/JSystem/J3DAssert.h new file mode 100644 index 000000000..4cda7704d --- /dev/null +++ b/include/JSystem/J3DAssert.h @@ -0,0 +1,11 @@ +#ifndef J3DASSERT_H +#define J3DASSERT_H + +#include "JSystem/JUtility/JUTAssert.h" + +#define J3D_ASSERT_NULLPTR(LINE, COND) +#define J3D_ASSERT_RANGE(LINE, COND) +#define J3D_ASSERT_NONZEROARG(LINE, COND) +#define J3D_ASSERT_ALLOCMEM(LINE, COND) + +#endif /* J3DASSERT_H */ diff --git a/include/JSystem/J3DGraphBase/J3DTransform.h b/include/JSystem/J3DGraphBase/J3DTransform.h index 0c7829796..c76dc51e8 100644 --- a/include/JSystem/J3DGraphBase/J3DTransform.h +++ b/include/JSystem/J3DGraphBase/J3DTransform.h @@ -41,173 +41,120 @@ void J3DMtxProjConcat(Mtx, Mtx, Mtx); void J3DPSMtx33Copy(Mtx3P src, Mtx3P dst); void J3DPSMtx33CopyFrom34(MtxP src, Mtx3P dst); -// regalloc issues inline void J3DPSMulMtxVec(register MtxP mtx, register Vec* vec, register Vec* dst) { - register f32 fr12; - register f32 fr11; - register f32 fr10; - register f32 fr9; - register f32 fr8; - register f32 fr6; - register f32 fr5; - register f32 fr4; - register f32 fr3; - register f32 fr2; - register f32 fr1; - register f32 fr0; #ifdef __MWERKS__ asm { - psq_l fr0, 0(vec), 0, 0 - psq_l fr2, 0(mtx), 0, 0 - psq_l fr1, 8(vec), 1, 0 - ps_mul fr4, fr2, fr0 - psq_l fr3, 8(mtx), 0, 0 - ps_madd fr5, fr3, fr1, fr4 - psq_l fr8, 16(mtx), 0, 0 - ps_sum0 fr6, fr5, fr6, fr5 - psq_l fr9, 24(mtx), 0, 0 - ps_mul fr10, fr8, fr0 - psq_st fr6, 0(dst), 1, 0 - ps_madd fr11, fr9, fr1, fr10 - psq_l fr2, 32(mtx), 0, 0 - ps_sum0 fr12, fr11, fr12, fr11 - psq_l fr3, 40(mtx), 0, 0 - ps_mul fr4, fr2, fr0 - psq_st fr12, 4(dst), 1, 0 - ps_madd fr5, fr3, fr1, fr4 - ps_sum0 fr6, fr5, fr6, fr5 - psq_st fr6, 8(dst), 1, 0 + psq_l f0, 0(vec), 0, 0 + psq_l f2, 0(mtx), 0, 0 + psq_l f1, 8(vec), 1, 0 + ps_mul f4, f2, f0 + psq_l f3, 8(mtx), 0, 0 + ps_madd f5, f3, f1, f4 + psq_l f8, 16(mtx), 0, 0 + ps_sum0 f6, f5, f6, f5 + psq_l f9, 24(mtx), 0, 0 + ps_mul f10, f8, f0 + psq_st f6, 0(dst), 1, 0 + ps_madd f11, f9, f1, f10 + psq_l f2, 32(mtx), 0, 0 + ps_sum0 f12, f11, f12, f11 + psq_l f3, 40(mtx), 0, 0 + ps_mul f4, f2, f0 + psq_st f12, 4(dst), 1, 0 + ps_madd f5, f3, f1, f4 + ps_sum0 f6, f5, f6, f5 + psq_st f6, 8(dst), 1, 0 } #endif } -// regalloc issues -inline void J3DPSMulMtxVec(register MtxP mtx, register SVec* vec, register SVec* dst) { - register f32 fr12; - register f32 fr11; - register f32 fr10; - register f32 fr9; - register f32 fr8; - register f32 fr6; - register f32 fra6; - register f32 fr5; - register f32 fra5; - register f32 fra4; - register f32 fr4; - register f32 fr3; - register f32 fr2; - register f32 fra2; - register f32 fr01; - register f32 fr00; +inline void J3DPSMulMtxVec(register MtxP mtx, register S16Vec* vec, register S16Vec* dst) { #ifdef __MWERKS__ asm { - psq_l fr00, 0(vec), 0, 7 - psq_l fr2, 0(mtx), 0, 0 - psq_l fr01, 4(vec), 1, 7 - ps_mul fr4, fr2, fr00 - psq_l fr3, 8(mtx), 0, 0 - ps_madd fr5, fr3, fr01, fr4 - psq_l fr8, 16(mtx), 0, 0 - ps_sum0 fr6, fr5, fr6, fr5 - psq_l fr9, 24(mtx), 0, 0 - ps_mul fr10, fr8, fr00 - psq_st fr6, 0(dst), 1, 7 - ps_madd fr11, fr9, fr01, fr10 - psq_l fra2, 32(mtx), 0, 0 - ps_sum0 fr12, fr11, fr12, fr11 - psq_l fr3, 40(mtx), 0, 0 - ps_mul fra4, fra2, fr00 - psq_st fr12, 2(dst), 1, 7 - ps_madd fra5, fr3, fr01, fra4 - ps_sum0 fra6, fra5, fra6, fra5 - psq_st fra6, 4(dst), 1, 7 + psq_l f0, 0(vec), 0, 7 + psq_l f2, 0(mtx), 0, 0 + psq_l f1, 4(vec), 1, 7 + ps_mul f4, f2, f0 + psq_l f3, 8(mtx), 0, 0 + ps_madd f5, f3, f1, f4 + psq_l f8, 16(mtx), 0, 0 + ps_sum0 f6, f5, f6, f5 + psq_l f9, 24(mtx), 0, 0 + ps_mul f10, f8, f0 + psq_st f6, 0(dst), 1, 7 + ps_madd f11, f9, f1, f10 + psq_l f2, 32(mtx), 0, 0 + ps_sum0 f12, f11, f12, f11 + psq_l f3, 40(mtx), 0, 0 + ps_mul f4, f2, f0 + psq_st f12, 2(dst), 1, 7 + ps_madd f5, f3, f1, f4 + ps_sum0 f6, f5, f6, f5 + psq_st f6, 4(dst), 1, 7 } #endif } // regalloc issues inline void J3DPSMulMtxVec(register Mtx3P mtx, register Vec* vec, register Vec* dst) { - register f32* punit; - register f32 unit; - register f32 fr12; - register f32 fr11; - register f32 fr10; - register f32 fr9; - register f32 fr8; - register f32 fr6; - register f32 fr5; - register f32 fr4; - register f32 fr3; - register f32 fr2; - register f32 fr01; - register f32 fr00; #ifdef __MWERKS__ asm { - lis punit, PSMulUnit01@ha - psq_l fr00, 0(vec), 0, 0 - addi punit, punit, PSMulUnit01@l - psq_l fr2, 0(mtx), 0, 0 - psq_l unit, 0(punit), 0, 0 - psq_l fr01, 8(vec), 1, 0 - ps_add fr01, unit, fr01 - psq_l fr3, 8(mtx), 1, 0 - ps_mul fr4, fr2, fr00 - psq_l fr8, 12(mtx), 0, 0 - ps_madd fr5, fr3, fr01, fr4 - ps_sum0 fr6, fr5, fr6, fr5 - psq_l fr9, 20(mtx), 1, 0 - ps_mul fr10, fr8, fr00 - psq_st fr6, 0(dst), 1, 0 - ps_madd fr11, fr9, fr01, fr10 - psq_l fr2, 24(mtx), 0, 0 - ps_sum0 fr12, fr11, fr12, fr11 - psq_l fr3, 32(mtx), 1, 0 - ps_mul fr4, fr2, fr00 - psq_st fr12, 4(dst), 1, 0 - ps_madd fr5, fr3, fr01, fr4 - ps_sum0 fr6, fr5, fr6, fr5 - psq_st fr6, 8(dst), 1, 0 + lis r6, PSMulUnit01@ha + psq_l f0, 0(vec), 0, 0 + addi r6, r6, PSMulUnit01@l + psq_l f2, 0(mtx), 0, 0 + psq_l f13, 0(r6), 0, 0 + psq_l f1, 8(vec), 1, 0 + ps_add f1, f13, f1 + psq_l f3, 8(mtx), 1, 0 + ps_mul f4, f2, f0 + psq_l f8, 12(mtx), 0, 0 + ps_madd f5, f3, f1, f4 + ps_sum0 f6, f5, f6, f5 + psq_l f9, 20(mtx), 1, 0 + ps_mul f10, f8, f0 + psq_st f6, 0(dst), 1, 0 + ps_madd f11, f9, f1, f10 + psq_l f2, 24(mtx), 0, 0 + ps_sum0 f12, f11, f12, f11 + psq_l f3, 32(mtx), 1, 0 + ps_mul f4, f2, f0 + psq_st f12, 4(dst), 1, 0 + ps_madd f5, f3, f1, f4 + ps_sum0 f6, f5, f6, f5 + psq_st f6, 8(dst), 1, 0 } #endif } // regalloc issues -inline void J3DPSMulMtxVec(register Mtx3P mtx, register SVec* vec, register SVec* dst) { - register f32* punit; - register f32 unit; - register f32 fr6; - register f32 fr5; - register f32 fr4; - register f32 fr3; - register f32 fr2; - register f32 fr01; - register f32 fr00; +inline void J3DPSMulMtxVec(register Mtx3P mtx, register S16Vec* vec, register S16Vec* dst) { #ifdef __MWERKS__ asm { - lis punit, PSMulUnit01@ha - psq_l fr00, 0(vec), 0, 7 - addi punit, punit, PSMulUnit01@l - psq_l fr2, 0(mtx), 0, 0 - psq_l unit, 0(punit), 0, 0 - psq_l fr01, 4(vec), 1, 7 - ps_add fr01, unit, fr01 - psq_l fr3, 8(mtx), 1, 0 - ps_mul fr4, fr2, fr00 - psq_l fr2, 12(mtx), 0, 0 - ps_madd fr5, fr3, fr01, fr4 - ps_sum0 fr6, fr5, fr6, fr5 - psq_l fr3, 20(mtx), 1, 0 - ps_mul fr4, fr2, fr00 - psq_st fr6, 0(dst), 1, 7 - ps_madd fr5, fr3, fr01, fr4 - psq_l fr2, 24(mtx), 0, 0 - ps_sum0 fr6, fr5, fr6, fr5 - psq_l fr3, 32(mtx), 1, 0 - ps_mul fr4, fr2, fr00 - psq_st fr6, 2(dst), 1, 7 - ps_madd fr5, fr3, fr01, fr4 - ps_sum0 fr6, fr5, fr6, fr5 - psq_st fr6, 4(dst), 1, 7 + lis r6, PSMulUnit01@ha + psq_l f0, 0(vec), 0, 7 + addi r6, r6, PSMulUnit01@l + psq_l f2, 0(mtx), 0, 0 + psq_l f13, 0(r6), 0, 0 + psq_l f1, 4(vec), 1, 7 + ps_add f1, f13, f1 + psq_l f3, 8(mtx), 1, 0 + ps_mul f4, f2, f0 + psq_l f8, 12(mtx), 0, 0 + ps_madd f5, f3, f1, f4 + ps_sum0 f6, f5, f6, f5 + psq_l f9, 20(mtx), 1, 0 + ps_mul f10, f8, f0 + psq_st f6, 0(dst), 1, 7 + ps_madd f11, f9, f1, f10 + psq_l f2, 24(mtx), 0, 0 + ps_sum0 f12, f11, f12, f11 + psq_l f3, 32(mtx), 1, 0 + ps_mul f4, f2, f0 + psq_st f12, 2(dst), 1, 7 + ps_madd f5, f3, f1, f4 + ps_sum0 f6, f5, f6, f5 + psq_st f6, 4(dst), 1, 7 } #endif } diff --git a/include/JSystem/JGeometry.h b/include/JSystem/JGeometry.h index c76bc0ab4..e452126b2 100644 --- a/include/JSystem/JGeometry.h +++ b/include/JSystem/JGeometry.h @@ -278,9 +278,9 @@ struct TVec3 : public Vec { template struct TVec2 { TVec2() {} - TVec2(T x, T y) { set(x, y); } + TVec2(const T x, const T y) { set(x, y); } - void set(T x, T y) { + void set(const T x, const T y) { this->x = x; this->y = y; } diff --git a/include/d/actor/d_a_ks.h b/include/d/actor/d_a_ks.h index b1313ab55..bdf3a89a2 100644 --- a/include/d/actor/d_a_ks.h +++ b/include/d/actor/d_a_ks.h @@ -4,11 +4,6 @@ #include "f_op/f_op_actor.h" #include "c/c_damagereaction.h" -class mDoExt_McaMorf; -class mDoExt_brkAnm; -class mDoExt_btkAnm; -class daPy_lk_c; - class ks_class : public fopEn_enemy_c { public: /* 0x2AC */ request_of_phase_process_class mPhs; diff --git a/include/d/actor/d_a_obj_gnnbtltaki.h b/include/d/actor/d_a_obj_gnnbtltaki.h index 70593920d..e6cf59c58 100644 --- a/include/d/actor/d_a_obj_gnnbtltaki.h +++ b/include/d/actor/d_a_obj_gnnbtltaki.h @@ -2,6 +2,7 @@ #define D_A_OBJ_GNNBTLTAKI_H #include "f_op/f_op_actor.h" +#include "m_Do/m_Do_ext.h" class daObjGnnbtaki_c : public fopAc_ac_c { public: @@ -14,8 +15,7 @@ public: bool _draw(); static const char M_arcname[]; public: - /* Place member variables here */ - /* 0x290 */ J3DModel* mJ3DModel; + /* 0x290 */ J3DModel* mpModel; /* 0x294 */ request_of_phase_process_class mPhase; /* 0x29C */ mDoExt_btkAnm mBtkAnm; /* 0x2B0 */ u8 field_0x2B0; diff --git a/include/d/actor/d_a_obj_gnndemotakie.h b/include/d/actor/d_a_obj_gnndemotakie.h index a7f4cf423..5e9cf797f 100644 --- a/include/d/actor/d_a_obj_gnndemotakie.h +++ b/include/d/actor/d_a_obj_gnndemotakie.h @@ -2,6 +2,7 @@ #define D_A_OBJ_GNNDEMOTAKIE_H #include "f_op/f_op_actor.h" +#include "m_Do/m_Do_ext.h" class daObjGnntakie_c : public fopAc_ac_c { public: diff --git a/include/d/actor/d_a_obj_ospbox.h b/include/d/actor/d_a_obj_ospbox.h index 987dc73e7..ccbb33de1 100644 --- a/include/d/actor/d_a_obj_ospbox.h +++ b/include/d/actor/d_a_obj_ospbox.h @@ -2,7 +2,7 @@ #define D_A_OBJ_OSPBOX_H #include "d/d_bg_s_movebg_actor.h" -#include "include/d/d_bg_s_gnd_chk.h" +#include "d/d_bg_s_gnd_chk.h" namespace daObjOspbox { class Act_c : public dBgS_MoveBgActor { diff --git a/include/d/actor/d_a_player.h b/include/d/actor/d_a_player.h index f09701769..868beefa4 100644 --- a/include/d/actor/d_a_player.h +++ b/include/d/actor/d_a_player.h @@ -1,6 +1,7 @@ #ifndef D_A_PLAYER #define D_A_PLAYER +#include "d/d_com_inf_game.h" #include "f_op/f_op_actor.h" #include "d/d_particle.h" #include "d/d_cc_d.h" @@ -598,4 +599,8 @@ public: void stopDoButtonQuake(BOOL); }; // Size: 0x320 +inline daPy_py_c* daPy_getPlayerActorClass() { + return (daPy_py_c*)dComIfGp_getPlayer(0); +} + #endif /* D_A_PLAYER */ diff --git a/include/d/actor/d_a_player_main.h b/include/d/actor/d_a_player_main.h index 058433d77..e05da8899 100644 --- a/include/d/actor/d_a_player_main.h +++ b/include/d/actor/d_a_player_main.h @@ -2343,4 +2343,8 @@ public: static const AnmDataTableEntry mAnmDataTable[]; }; // Size: 0x4C28 +inline daPy_lk_c* daPy_getPlayerLinkActorClass() { + return (daPy_lk_c*)dComIfGp_getLinkPlayer(); +} + #endif /* D_A_PLAYER_MAIN */ diff --git a/include/d/d_attention.h b/include/d/d_attention.h index 12fadfaa2..fdad31613 100644 --- a/include/d/d_attention.h +++ b/include/d/d_attention.h @@ -119,8 +119,6 @@ public: virtual bool execute(u16, J3DTransformInfo*); }; -class daPy_lk_c; - enum AttentionFlags { AttnFlag_00000001 = 0x00000001, AttnFlag_00000002 = 0x00000002, @@ -205,7 +203,7 @@ public: bool LockonTruth(); void Init(fopAc_ac_c* i_owner, u32 i_padNo) { - mpPlayer = (daPy_lk_c*)i_owner; + mpPlayer = i_owner; mPadNo = i_padNo; } @@ -263,7 +261,7 @@ public: void Look2RequestF(fopAc_ac_c* param_1, s16 param_2, int param_3) {mLook[1].requestF(param_1,param_2,param_3);} public: - /* 0x000 */ daPy_lk_c* mpPlayer; + /* 0x000 */ fopAc_ac_c* mpPlayer; /* 0x004 */ fpc_ProcID mLockonTargetID; /* 0x008 */ dAttDraw_CallBack_c mCallBack; /* 0x00C */ int mPadNo; diff --git a/include/d/d_com_inf_game.h b/include/d/d_com_inf_game.h index ee437c053..c446f978a 100644 --- a/include/d/d_com_inf_game.h +++ b/include/d/d_com_inf_game.h @@ -28,8 +28,6 @@ class dGrass_packet_c; class dTree_packet_c; class dFlower_packet_c; namespace dWood { class Packet_c; }; -class daPy_py_c; -class daPy_lk_c; class daShip_c; class daAgb_c; class camera_class; @@ -237,7 +235,7 @@ public: dStage_roomControl_c* getRoomControl() { return &mRoomCtrl; } dStage_dt_c& getStage() { return mStageData; } - dEvt_control_c& getEvent() { return mEvtCtrl; } + dEvt_control_c* getEvent() { return &mEvtCtrl; } dEvent_manager_c& getEvtManager() { return mEvtManager; } dPa_control_c* getParticle() { return mParticle; } dVibration_c& getVibration() { return mVibration; } @@ -2337,10 +2335,6 @@ inline daAgb_c* dComIfGp_getAgb() { return g_dComIfG_gameInfo.play.getAgb(); } -inline daPy_py_c* daPy_getPlayerActorClass() { - return (daPy_py_c*)dComIfGp_getPlayer(0); -} - inline fopAc_ac_c* dComIfGp_getLinkPlayer() { return g_dComIfG_gameInfo.play.getPlayerPtr(0); } @@ -2349,10 +2343,6 @@ inline void dComIfGp_setLinkPlayer(fopAc_ac_c* player) { g_dComIfG_gameInfo.play.setPlayerPtr(0, player); } -inline daPy_lk_c* daPy_getPlayerLinkActorClass() { - return (daPy_lk_c*)dComIfGp_getLinkPlayer(); -} - inline void dComIfGp_setWindowNum(int num) { g_dComIfG_gameInfo.play.setWindowNum(num); } @@ -3128,14 +3118,14 @@ inline BOOL dComIfGp_roomControl_checkRoomDisp(int i_roomNo) { */ inline BOOL dComIfGp_event_runCheck() { - return g_dComIfG_gameInfo.play.getEvent().runCheck(); + return g_dComIfG_gameInfo.play.getEvent()->runCheck(); } inline u16 dComIfGp_event_checkHind(u16 i_hindFlag) { if (!dComIfGp_event_runCheck()) { return false; } - return g_dComIfG_gameInfo.play.getEvent().checkHind(i_hindFlag); + return g_dComIfG_gameInfo.play.getEvent()->checkHind(i_hindFlag); } /** @@ -3143,112 +3133,112 @@ inline u16 dComIfGp_event_checkHind(u16 i_hindFlag) { * @return The dTalkXYButton_e of the button the player used to initiate this event. */ inline u8 dComIfGp_event_getTalkXYBtn() { - return g_dComIfG_gameInfo.play.getEvent().getTalkXYBtn(); + return g_dComIfG_gameInfo.play.getEvent()->getTalkXYBtn(); } inline bool dComIfGp_event_chkTalkXY() { - return g_dComIfG_gameInfo.play.getEvent().chkTalkXY(); + return g_dComIfG_gameInfo.play.getEvent()->chkTalkXY(); } inline void dComIfGp_event_onEventFlag(u16 flag) { - g_dComIfG_gameInfo.play.getEvent().onEventFlag(flag); + g_dComIfG_gameInfo.play.getEvent()->onEventFlag(flag); } inline void dComIfGp_event_offEventFlag(u16 flag) { - g_dComIfG_gameInfo.play.getEvent().offEventFlag(flag); + g_dComIfG_gameInfo.play.getEvent()->offEventFlag(flag); } inline u16 dComIfGp_event_chkEventFlag(u16 flag) { - return g_dComIfG_gameInfo.play.getEvent().chkEventFlag(flag); + return g_dComIfG_gameInfo.play.getEvent()->chkEventFlag(flag); } inline void dComIfGp_event_remove() { - g_dComIfG_gameInfo.play.getEvent().remove(); + g_dComIfG_gameInfo.play.getEvent()->remove(); } inline void dComIfGp_event_reset() { - g_dComIfG_gameInfo.play.getEvent().reset(); + g_dComIfG_gameInfo.play.getEvent()->reset(); } inline int dComIfGp_event_getPreItemNo() { - return g_dComIfG_gameInfo.play.getEvent().getPreItemNo(); + return g_dComIfG_gameInfo.play.getEvent()->getPreItemNo(); } inline void dComIfGp_event_setGtItm(u8 itemNo) { - g_dComIfG_gameInfo.play.getEvent().setGtItm(itemNo); + g_dComIfG_gameInfo.play.getEvent()->setGtItm(itemNo); } inline u8 dComIfGp_event_getGtItm() { - return g_dComIfG_gameInfo.play.getEvent().getGtItm(); + return g_dComIfG_gameInfo.play.getEvent()->getGtItm(); } inline s32 dComIfGp_event_moveApproval(void* actor) { - return g_dComIfG_gameInfo.play.getEvent().moveApproval(actor); + return g_dComIfG_gameInfo.play.getEvent()->moveApproval(actor); } inline BOOL dComIfGp_event_compulsory(void* param_1, const char* param_2 = NULL, u16 param_3 = -1) { - return g_dComIfG_gameInfo.play.getEvent().compulsory(param_1, param_2, param_3); + return g_dComIfG_gameInfo.play.getEvent()->compulsory(param_1, param_2, param_3); } inline s32 dComIfGp_event_order(u16 eventType, u16 priority, u16 flag, u16 hind, void* pActor1, void* pActor2, s16 eventID = -1, u8 infoIdx = -1) { - return g_dComIfG_gameInfo.play.getEvent().order(eventType, priority, flag, hind, pActor1, pActor2, eventID, infoIdx); + return g_dComIfG_gameInfo.play.getEvent()->order(eventType, priority, flag, hind, pActor1, pActor2, eventID, infoIdx); } inline s32 dComIfGp_event_orderOld(u16 eventType, u16 priority, u16 flag, u16 hind, void* pActor1, void* pActor2, const char *pEventName) { - return g_dComIfG_gameInfo.play.getEvent().orderOld(eventType, priority, flag, hind, pActor1, pActor2, pEventName); + return g_dComIfG_gameInfo.play.getEvent()->orderOld(eventType, priority, flag, hind, pActor1, pActor2, pEventName); } inline fopAc_ac_c* dComIfGp_event_getTalkPartner() { - return g_dComIfG_gameInfo.play.getEvent().getPtT(); + return g_dComIfG_gameInfo.play.getEvent()->getPtT(); } inline void dComIfGp_event_setTalkPartner(void* i_actor) { - g_dComIfG_gameInfo.play.getEvent().setPtT(i_actor); + g_dComIfG_gameInfo.play.getEvent()->setPtT(i_actor); } inline fopAc_ac_c* dComIfGp_event_getItemPartner() { - return g_dComIfG_gameInfo.play.getEvent().getPtI(); + return g_dComIfG_gameInfo.play.getEvent()->getPtI(); } inline void dComIfGp_event_setItemPartner(void* pt) { - g_dComIfG_gameInfo.play.getEvent().setPtI(pt); + g_dComIfG_gameInfo.play.getEvent()->setPtI(pt); } inline void dComIfGp_event_setItemPartnerId(fpc_ProcID id) { - g_dComIfG_gameInfo.play.getEvent().setPtI_Id(id); + g_dComIfG_gameInfo.play.getEvent()->setPtI_Id(id); } inline fopAc_ac_c* dComIfGp_event_getPt1() { - return g_dComIfG_gameInfo.play.getEvent().getPt1(); + return g_dComIfG_gameInfo.play.getEvent()->getPt1(); } inline fopAc_ac_c* dComIfGp_event_getPt2() { - return g_dComIfG_gameInfo.play.getEvent().getPt2(); + return g_dComIfG_gameInfo.play.getEvent()->getPt2(); } inline f32 dComIfGp_event_getCullRate() { - return g_dComIfG_gameInfo.play.getEvent().getCullRate(); + return g_dComIfG_gameInfo.play.getEvent()->getCullRate(); } inline void dComIfGp_event_setCullRate(f32 ratio) { - g_dComIfG_gameInfo.play.getEvent().setCullRate(ratio); + g_dComIfG_gameInfo.play.getEvent()->setCullRate(ratio); } inline BOOL dComIfGp_event_check() { - return g_dComIfG_gameInfo.play.getEvent().check(); + return g_dComIfG_gameInfo.play.getEvent()->check(); } inline u8 dComIfGp_event_getMode() { - return g_dComIfG_gameInfo.play.getEvent().getMode(); + return g_dComIfG_gameInfo.play.getEvent()->getMode(); } inline u8 dComIfGp_event_getTactFreeMStick(int which) { - return g_dComIfG_gameInfo.play.getEvent().getTactFreeMStick(which); + return g_dComIfG_gameInfo.play.getEvent()->getTactFreeMStick(which); } inline u8 dComIfGp_event_getTactFreeCStick(int which) { - return g_dComIfG_gameInfo.play.getEvent().getTactFreeCStick(which); + return g_dComIfG_gameInfo.play.getEvent()->getTactFreeCStick(which); } inline bool dComIfGp_getMetronome() { diff --git a/include/d/d_npc.h b/include/d/d_npc.h index 9d4bc1939..6db4ab716 100644 --- a/include/d/d_npc.h +++ b/include/d/d_npc.h @@ -270,7 +270,7 @@ public: virtual u16 next_msgStatus(u32* pMsgNo) { return fopMsgStts_MSG_ENDS_e; } virtual u32 getMsg() { return 0; } - virtual void anmAtr(u16) {} + virtual void anmAtr(u16 i_msgStatus) {} void setCollision(float radius, float height); u16 talk(int); diff --git a/include/dolphin/mtx/vec.h b/include/dolphin/mtx/vec.h index 54ced2cbd..48f0bbfc8 100644 --- a/include/dolphin/mtx/vec.h +++ b/include/dolphin/mtx/vec.h @@ -19,6 +19,10 @@ typedef struct SVec { s16 x, y, z; } SVec; +typedef struct S16Vec { + s16 x, y, z; +} S16Vec; + void C_VECAdd(const Vec* a, const Vec* b, Vec* ab); void PSVECAdd(const Vec* a, const Vec* b, Vec* ab); void C_VECSubtract(const Vec* a, const Vec* b, Vec* a_b); diff --git a/include/global.h b/include/global.h index 4ec7e4259..b3ce236fe 100644 --- a/include/global.h +++ b/include/global.h @@ -13,6 +13,10 @@ #define IS_ALIGNED(X, N) (((X) & ((N)-1)) == 0) #define IS_NOT_ALIGNED(X, N) (((X) & ((N)-1)) != 0) +// Silence unused parameter warnings. +// TP debug suggests the original devs used something like this. +#define UNUSED(x) ((void)(x)) + #define JUT_EXPECT(...) #define ASSERT(...) #define LOGF(FMT, ...) diff --git a/src/JSystem/J3DGraphAnimator/J3DCluster.cpp b/src/JSystem/J3DGraphAnimator/J3DCluster.cpp index b7643d765..6b5197189 100644 --- a/src/JSystem/J3DGraphAnimator/J3DCluster.cpp +++ b/src/JSystem/J3DGraphAnimator/J3DCluster.cpp @@ -10,8 +10,10 @@ #include "JSystem/J3DGraphAnimator/J3DSkinDeform.h" #include "JSystem/J3DGraphAnimator/J3DAnimation.h" #include "JSystem/JKernel/JKRHeap.h" +#include "JSystem/J3DAssert.h" #include "dolphin/os/OS.h" #include "string.h" +#include "stdint.h" /* 802F37C4-802F37E4 .text clear__13J3DDeformDataFv */ void J3DDeformData::clear() { @@ -75,8 +77,8 @@ void J3DDeformer::deform(J3DVertexBuffer* vtx, u16 idx, f32* weightList) { /* Nonmatching */ if (checkFlag(2) && vtx->getVertexData()->getVtxPosType() == GX_F32) { J3DCluster* cluster = mDeformData->getClusterPointer(idx); - s32 posNum = cluster->mPosNum; - s32 keyNum = cluster->mKeyNum; + int posNum = cluster->mPosNum; + int keyNum = cluster->mKeyNum; u16 keyStart = 0; for (u16 i = 0; i < idx; i++) @@ -88,7 +90,7 @@ void J3DDeformer::deform(J3DVertexBuffer* vtx, u16 idx, f32* weightList) { f32* vtxPosDst = (f32*)vtx->getVtxPosArrayPointer(0); f32* vtxPosSrc = (f32*)mDeformData->getVtxPos(); - for (s32 i = 0; i < posNum; i++) { + for (int i = 0; i < posNum; i++) { f32* vtx = &vtxPosDst[cluster->mPosDstIdx[i] * 3]; vtx[0] = 0.0f; vtx[1] = 0.0f; @@ -228,8 +230,6 @@ J3DSkinDeform::J3DSkinDeform() { /* 802F40F0-802F44E8 .text initMtxIndexArray__13J3DSkinDeformFP12J3DModelData */ int J3DSkinDeform::initMtxIndexArray(J3DModelData* modelData) { - /* Nonmatching - operand swap */ - if (mPosUseMtx != NULL && mNrmUseMtx != NULL) return J3DErrType_Success; @@ -271,18 +271,26 @@ int J3DSkinDeform::initMtxIndexArray(J3DModelData* modelData) { posOffs = vtxSize; if (desc->type != GX_INDEX16) { OSReport(" Invlid Data : CPU Pipeline process GX_INDEX16 Data Only\n"); + #if VERSION == VERSION_DEMO + return; // !@bug: No return value + #endif } break; case GX_VA_NRM: nrmOffs = vtxSize; if (desc->type != GX_INDEX16) { OSReport(" Invlid Data : CPU Pipeline process GX_INDEX16 Data Only\n"); + #if VERSION == VERSION_DEMO + return; // !@bug: No return value + #endif } break; case GX_VA_TEX0: + #if VERSION > VERSION_DEMO if (desc->type != GX_INDEX16) { OSReport(" Invlid Data : CPU Pipeline process GX_INDEX16 Data Only\n"); } + #endif break; default: break; @@ -296,18 +304,20 @@ int J3DSkinDeform::initMtxIndexArray(J3DModelData* modelData) { u8* displayListStart = modelData->getShapeNodePointer(i)->getShapeDraw(j)->getDisplayList(); for (u8* dl = displayListStart; (dl - displayListStart) < modelData->getShapeNodePointer(i)->getShapeDraw(j)->getDisplayListSize(); ) { - u8 cmd = dl[0]; + u8 cmd = *dl; + dl++; if (cmd != GX_TRIANGLEFAN && cmd != GX_TRIANGLESTRIP) break; - u16 vtxCount = *(u16*)&dl[1]; + int vtxCount = *(u16*)dl; + dl += 2; u16 useMtxIdxBuf[10]; - for (s32 k = 0; k < vtxCount; k++) { - u8* vtx = &dl[3 + vtxSize * k]; - u8 pnmtxIdx = (u32)*(u8*)&vtx[pnmtxIdxOffs] / 3; - u16 posIdx = *(u16*)&vtx[posOffs]; - u16 nrmIdx = *(u16*)&vtx[nrmOffs]; + for (int k = 0; k < vtxCount; k++) { + u8* src = &dl[vtxSize * k]; + u8 pnmtxIdx = (u32)*(u8*)&src[pnmtxIdxOffs] / 3; + u16 posIdx = *(u16*)&src[posOffs]; + u16 nrmIdx = *(u16*)&src[nrmOffs]; u16 useMtxIdx = shapeMtx->getUseMtxIndex(pnmtxIdx); if (useMtxIdx == 0xFFFF) { @@ -321,8 +331,7 @@ int J3DSkinDeform::initMtxIndexArray(J3DModelData* modelData) { mNrmUseMtx[nrmIdx] = useMtxIdx; } - dl += vtxSize * vtxCount; - dl += 3; + dl = (u8*)dl + vtxSize * vtxCount; } if (nrmOffs == -1) { @@ -342,69 +351,66 @@ int J3DSkinDeform::initMtxIndexArray(J3DModelData* modelData) { return J3DErrType_Success; } -/* 802F44E8-802F4734 .text changeFastSkinDL__13J3DSkinDeformFP12J3DModelData */ -void J3DSkinDeform::changeFastSkinDL(J3DModelData* modelData) { - /* Nonmatching */ - for (u16 i = 0; i < modelData->getShapeNum(); i++) { - int size[4] = { 0, 1, 1, 2 }; +void J3DSkinDeform::changeFastSkinDL(J3DModelData* pModelData) { + J3D_ASSERT_NULLPTR(740, pModelData != NULL); + for (u16 i = 0; i < pModelData->getShapeNum(); i++) { + u32 kSize[4] = {0,1,1,2}; int pnmtxIdxOffs = -1; int vtxSize = 0; - for (GXVtxDescList* desc = modelData->getShapeNodePointer(i)->getVtxDesc(); desc->attr != GX_VA_NULL; desc++) { - if (desc->attr == GX_VA_PNMTXIDX) { + J3DShape* pShapeNode = pModelData->getShapeNodePointer(i); + for (GXVtxDescList* vtxDesc = pShapeNode->getVtxDesc(); vtxDesc->attr != GX_VA_NULL; vtxDesc++) { + if (vtxDesc->attr == GX_VA_PNMTXIDX) { pnmtxIdxOffs = vtxSize; } - - vtxSize += size[desc->type]; + vtxSize += kSize[vtxDesc->type]; } if (pnmtxIdxOffs != -1) { - for (u16 j = 0; j < modelData->getShapeNodePointer(i)->getMtxGroupNum(); j++) { - J3DShapeDraw* shapeDraw = modelData->getShapeNodePointer(i)->getShapeDraw(j); - u8* displayListStart = shapeDraw->getDisplayList(); + for (u16 j = 0; j < (u16)pShapeNode->getMtxGroupNum(); j++) { + u8* displayListStart = pShapeNode->getShapeDraw(j)->getDisplayList(); u8* dl = displayListStart; u8* dst = displayListStart; - - for (; (dl - displayListStart) < shapeDraw->getDisplayListSize(); ) { - u8 cmd = dl[0]; - *dst = cmd; - dst += 1; + while ((dl - displayListStart) < pShapeNode->getShapeDraw(j)->getDisplayListSize()) { + u8 cmd = *dl; + dl++; + *dst++ = cmd; if (cmd != GX_TRIANGLEFAN && cmd != GX_TRIANGLESTRIP) break; - u32 vtxCount = *(u16*)&dl[1]; + int vtxCount = *(u16*)dl; + dl += 2; *(u16*)dst = vtxCount; dst += 2; - u32 vtxSizeDst = vtxSize - 1; // remove GX_VA_PNMTXIDX - for (s32 k = 0; k < vtxCount; k++) { - memcpy(dst, &dl[vtxSize * k + 3 + 1], vtxSizeDst); - dst += vtxSizeDst; + for (int k = 0; k < vtxCount; k++) { + u8* src = &dl[vtxSize * k]; + memcpy(dst, src + 1, (int)(vtxSize - 1)); // The -1 is to remove GX_VA_PNMTXIDX + dst += (int)(vtxSize - 1); } - - dl += vtxSize * vtxCount + 3; + dl = (u8*)dl + vtxSize * vtxCount; } - u32 newSize = ((u32)dst + 0x1F & ~0x1F) - (u32)displayListStart; - - for (; (dst - displayListStart) < modelData->getShapeNodePointer(i)->getShapeDraw(j)->getDisplayListSize();) { + int dlistSize = ((intptr_t)dst - (intptr_t)displayListStart + 0x1f) & ~0x1f; + while ((intptr_t)dst - (intptr_t)displayListStart < pShapeNode->getShapeDraw(j)->getDisplayListSize()) { *dst++ = 0; } - shapeDraw->setDisplayListSize(newSize); - DCStoreRange(displayListStart, shapeDraw->getDisplayListSize()); + pShapeNode->getShapeDraw(j)->setDisplayListSize(dlistSize); + DCStoreRange(displayListStart, pShapeNode->getShapeDraw(j)->getDisplayListSize()); } } } - for (u16 i = 0; i < modelData->getShapeNum(); i++) { - J3DShape* shape = modelData->getShapeNodePointer(i); + for (u16 i = 0; i < pModelData->getShapeNum(); i++) { + J3DShape* shape = pModelData->getShapeNodePointer(i); GXVtxDescList* desc = shape->getVtxDesc(); GXVtxDescList* descDst = desc; for (; desc->attr != GX_VA_NULL; desc++) { if (desc->attr != GX_VA_PNMTXIDX) { - *descDst = *desc; + descDst->attr = desc->attr; + descDst->type = desc->type; descDst++; } } @@ -434,23 +440,18 @@ void J3DSkinDeform::calcNrmMtx(J3DModel* model) { } } -#ifdef DEBUG -#pragma push -#pragma optimization_level 1 -#endif /* 802F4850-802F4974 .text deformVtxPos_F32__13J3DSkinDeformCFP8J3DModel */ void J3DSkinDeform::deformVtxPos_F32(J3DModel* model) const { - /* Nonmatching - J3DPSMulMtxVec regalloc */ Mtx* mtxArr[2]; mtxArr[0] = (Mtx*)model->getAnmMtx(0); mtxArr[1] = (Mtx*)model->getWeightAnmMtx(0); model->getVertexBuffer()->swapTransformedVtxPos(); - s32 vtxNum = model->getModelData()->getVtxNum(); + int vtxNum = model->getModelData()->getVtxNum(); Vec* curVtxPos = (Vec*)model->getCurrentVtxPos(); Vec* transformedVtxPos = (Vec*)model->getVertexBuffer()->getTransformedVtxPos(0); - for (s32 i = 0; i < vtxNum; i++) { + for (int i = 0; i < vtxNum; i++) { Mtx* mtx = mtxArr[model->getModelData()->getDrawMtxFlag(mPosUseMtx[i])]; J3DPSMulMtxVec(mtx[model->getModelData()->getDrawMtxIndex(mPosUseMtx[i])], &curVtxPos[i], &transformedVtxPos[i]); } @@ -458,13 +459,9 @@ void J3DSkinDeform::deformVtxPos_F32(J3DModel* model) const { DCStoreRange(model->getVertexBuffer()->getTransformedVtxPos(0), model->getModelData()->getVtxNum() * sizeof(Vec)); model->setCurrentVtxPos(transformedVtxPos); } -#ifdef DEBUG -#pragma pop -#endif /* 802F4974-802F4AB4 .text deformVtxPos_S16__13J3DSkinDeformCFP8J3DModel */ void J3DSkinDeform::deformVtxPos_S16(J3DModel* model) const { - /* Nonmatching - J3DPSMulMtxVec regalloc */ Mtx* mtxArr[2]; mtxArr[0] = (Mtx*)model->getAnmMtx(0); mtxArr[1] = (Mtx*)model->getWeightAnmMtx(0); @@ -472,16 +469,13 @@ void J3DSkinDeform::deformVtxPos_S16(J3DModel* model) const { J3DGQRSetup7(model->getModelData()->getVertexData().getVtxPosFrac(), 7, model->getModelData()->getVertexData().getVtxPosFrac(), 7); model->getVertexBuffer()->swapTransformedVtxPos(); - s32 vtxNum = model->getModelData()->getVtxNum(); - SVec* curVtxPos = (SVec*)model->getCurrentVtxPos(); - SVec* transformedVtxPos = (SVec*)model->getVertexBuffer()->getTransformedVtxPos(0); + int vtxNum = model->getModelData()->getVtxNum(); + S16Vec* curVtxPos = (S16Vec*)model->getCurrentVtxPos(); + S16Vec* transformedVtxPos = (S16Vec*)model->getVertexBuffer()->getTransformedVtxPos(0); - for (s32 i = 0; i < vtxNum; i++) { + for (int i = 0; i < vtxNum; i++) { Mtx* mtx = mtxArr[model->getModelData()->getDrawMtxFlag(mPosUseMtx[i])]; -// TODO: this line doesn't compile on debug -#ifndef DEBUG J3DPSMulMtxVec(mtx[model->getModelData()->getDrawMtxIndex(mPosUseMtx[i])], &curVtxPos[i], &transformedVtxPos[i]); -#endif } DCStoreRange(model->getVertexBuffer()->getTransformedVtxPos(0), model->getModelData()->getVtxNum() * sizeof(SVec)); @@ -490,14 +484,13 @@ void J3DSkinDeform::deformVtxPos_S16(J3DModel* model) const { /* 802F4AB4-802F4BB8 .text deformVtxNrm_F32__13J3DSkinDeformCFP8J3DModel */ void J3DSkinDeform::deformVtxNrm_F32(J3DModel* model) const { - /* Nonmatching - J3DPSMulMtxVec regalloc */ model->getVertexBuffer()->swapTransformedVtxNrm(); - s32 vtxNum = model->getModelData()->getNrmNum(); + int vtxNum = model->getModelData()->getNrmNum(); Vec* curVtxNrm = (Vec*)model->getCurrentVtxNrm(); Vec* transformedVtxNrm = (Vec*)model->getVertexBuffer()->getTransformedVtxNrm(0); - for (s32 i = 0; i < vtxNum; i++) { + for (int i = 0; i < vtxNum; i++) { J3DPSMulMtxVec(mNrmMtx[mNrmUseMtx[i]], &curVtxNrm[i], &transformedVtxNrm[i]); } @@ -507,15 +500,14 @@ void J3DSkinDeform::deformVtxNrm_F32(J3DModel* model) const { /* 802F4BB8-802F4CD8 .text deformVtxNrm_S16__13J3DSkinDeformCFP8J3DModel */ void J3DSkinDeform::deformVtxNrm_S16(J3DModel* model) const { - /* Nonmatching - J3DPSMulMtxVec regalloc */ J3DGQRSetup7(model->getModelData()->getVertexData().getVtxNrmFrac(), 7, model->getModelData()->getVertexData().getVtxNrmFrac(), 7); model->getVertexBuffer()->swapTransformedVtxNrm(); - s32 vtxNum = model->getModelData()->getNrmNum(); - SVec* curVtxNrm = (SVec*)model->getCurrentVtxNrm(); - SVec* transformedVtxNrm = (SVec*)model->getVertexBuffer()->getTransformedVtxNrm(0); + int vtxNum = model->getModelData()->getNrmNum(); + S16Vec* curVtxNrm = (S16Vec*)model->getCurrentVtxNrm(); + S16Vec* transformedVtxNrm = (S16Vec*)model->getVertexBuffer()->getTransformedVtxNrm(0); - for (s32 i = 0; i < vtxNum; i++) { + for (int i = 0; i < vtxNum; i++) { J3DPSMulMtxVec(mNrmMtx[mNrmUseMtx[i]], &curVtxNrm[i], &transformedVtxNrm[i]); } diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include/cstdint.h b/src/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include/cstdint.h new file mode 100644 index 000000000..e9530a60b --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include/cstdint.h @@ -0,0 +1,30 @@ +#ifndef MSL_CSTDINT_H_ +#define MSL_CSTDINT_H_ + +#ifdef __cplusplus +namespace std { +extern "C" { +#endif + +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef unsigned long uint32_t; + +typedef signed char int8_t; +typedef short int16_t; +typedef long int32_t; + +typedef unsigned long long uint64_t; +typedef long long int64_t; + +typedef uint32_t uintptr_t; +typedef int32_t intptr_t; + +typedef long long intmax_t; + +#ifdef __cplusplus +}; +} +#endif + +#endif diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include/stdint.h b/src/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include/stdint.h new file mode 100644 index 000000000..e6ed832a3 --- /dev/null +++ b/src/PowerPC_EABI_Support/MSL/MSL_C++/MSL_Common/Include/stdint.h @@ -0,0 +1,27 @@ +#ifndef STDINT_H +#define STDINT_H +#ifndef MSL_STDINT_H_ +#define MSL_STDINT_H_ + +#include + +#ifdef __cplusplus + using std::uint8_t; + using std::uint16_t; + using std::uint32_t; + + using std::int8_t; + using std::int16_t; + using std::int32_t; + + using std::uint64_t; + using std::int64_t; + + using std::uintptr_t; + using std::intptr_t; +#endif + +#endif + + +#endif /* STDINT_H */ diff --git a/src/d/actor/d_a_bb.cpp b/src/d/actor/d_a_bb.cpp index b2a5ad35d..bd03be1e4 100644 --- a/src/d/actor/d_a_bb.cpp +++ b/src/d/actor/d_a_bb.cpp @@ -1362,11 +1362,12 @@ void bb_atack_move(bb_class* i_this) { kuti_open(i_this, 0x30, JA_SE_CV_BB_NORMAL); } -#if VERSION == VERSION_DEMO - if (&player->base.base == fpcM_Search(pl_name_check, i_this) || l_bbHIO.unk_10 != 0) -#else - if (&player->base.base == fpcM_Search(pl_name_check, i_this)) -#endif + if ( + &player->base.base == fpcM_Search(pl_name_check, i_this) + #if VERSION == VERSION_DEMO + || l_bbHIO.unk_10 != 0 + #endif + ) { bb_kamome_attack(i_this); return; diff --git a/src/d/actor/d_a_bita.cpp b/src/d/actor/d_a_bita.cpp index 3a66b7f2c..56c30bd75 100644 --- a/src/d/actor/d_a_bita.cpp +++ b/src/d/actor/d_a_bita.cpp @@ -26,6 +26,7 @@ static u32 ita_Ef[] = { BITA_BRK_EF_BTDITA0, BITA_BRK_EF_BTDITA1 }; /* 00000078-000000C4 .text b_a_sub__FPvPv */ static void* b_a_sub(void* search, void* user) { + UNUSED(user); if (fopAc_IsActor(search) && fopAcM_GetName(search) == PROC_BTD) return search; return NULL; diff --git a/src/d/actor/d_a_bmdfoot.cpp b/src/d/actor/d_a_bmdfoot.cpp index b5245c903..d2ec25ba0 100644 --- a/src/d/actor/d_a_bmdfoot.cpp +++ b/src/d/actor/d_a_bmdfoot.cpp @@ -607,6 +607,7 @@ void move(bmdfoot_class* i_this) { /* 000021B8-00002204 .text s_a_d_sub__FPvPv */ void* s_a_d_sub(void* search, void* param_2) { + UNUSED(param_2); if ((fopAc_IsActor(search)) && (fopAcM_GetName(search) == PROC_BMD)) { return search; } else { diff --git a/src/d/actor/d_a_bmdhand.cpp b/src/d/actor/d_a_bmdhand.cpp index 1acc0d4de..53b4de71f 100644 --- a/src/d/actor/d_a_bmdhand.cpp +++ b/src/d/actor/d_a_bmdhand.cpp @@ -637,6 +637,7 @@ void hand_move(bmdhand_class* i_this) { /* 00002E74-00002EC0 .text s_a_d_sub__FPvPv */ void* s_a_d_sub(void* param_1, void* param_2) { + UNUSED(param_2); if ((fopAc_IsActor(param_1)) && (fopAcM_GetName(param_1) == PROC_BMD)) { return param_1; } else { diff --git a/src/d/actor/d_a_bpw.cpp b/src/d/actor/d_a_bpw.cpp index 761139d66..5a6f49421 100644 --- a/src/d/actor/d_a_bpw.cpp +++ b/src/d/actor/d_a_bpw.cpp @@ -877,6 +877,7 @@ void light_on_off(bpw_class* i_this) { /* 0000242C-000024B0 .text skull_search_sub__FPvPv */ void* skull_search_sub(void* param_1, void* param_2) { + UNUSED(param_2); fopAc_ac_c* actor = (fopAc_ac_c*)param_1; if ((get_check_count < 100) && (fopAc_IsActor(actor))) { diff --git a/src/d/actor/d_a_btd.cpp b/src/d/actor/d_a_btd.cpp index 3a7edc7b5..a0be3a5ef 100644 --- a/src/d/actor/d_a_btd.cpp +++ b/src/d/actor/d_a_btd.cpp @@ -1769,6 +1769,7 @@ void move(btd_class* i_this) { /* 00005BCC-00005C24 .text k_a_d_sub__FPvPv */ void* k_a_d_sub(void* i_this, void* param_2) { + UNUSED(param_2); if (((fopAc_IsActor(i_this)) && (fopAcM_GetName(i_this) == PROC_KUI)) && (fopAcM_GetParam(i_this) == 0x511)) { return i_this; } @@ -1777,6 +1778,7 @@ void* k_a_d_sub(void* i_this, void* param_2) { /* 00005C24-00005C70 .text dr2_a_d_sub__FPvPv */ void* dr2_a_d_sub(void* i_this, void* param_2) { + UNUSED(param_2); if ((fopAc_IsActor(i_this)) && (fopAcM_GetName(i_this) == PROC_DR2)) { return i_this; } else { @@ -1786,6 +1788,7 @@ void* dr2_a_d_sub(void* i_this, void* param_2) { /* 00005C70-00005CC8 .text wepon_s_sub__FPvPv */ void* wepon_s_sub(void* i_this, void* param_2) { + UNUSED(param_2); if (((fopAc_IsActor(i_this)) && (fopAcM_GetName(i_this) == PROC_HIMO2)) || (fopAcM_GetName(i_this) == PROC_BOOMERANG)) { return i_this; } diff --git a/src/d/actor/d_a_bwd.cpp b/src/d/actor/d_a_bwd.cpp index 6adbd1ba7..8258a5045 100644 --- a/src/d/actor/d_a_bwd.cpp +++ b/src/d/actor/d_a_bwd.cpp @@ -112,6 +112,7 @@ void g_eff_off(bwd_class* i_this) { /* 000001CC-00000250 .text ko_s_sub__FPvPv */ void* ko_s_sub(void* param_1, void* param_2) { + UNUSED(param_2); fopAc_ac_c* actor = (fopAc_ac_c*)param_1; if ((fopAc_IsActor(actor)) && (fopAcM_GetName(actor) == PROC_BWDS)) { @@ -126,6 +127,7 @@ void* ko_s_sub(void* param_1, void* param_2) { /* 00000250-0000029C .text ko_delete_sub__FPvPv */ void* ko_delete_sub(void* param_1, void* param_2) { + UNUSED(param_2); bwds_class* actor = (bwds_class*)param_1; if ((fopAc_IsActor(actor)) && (fopAcM_GetName(actor) == PROC_BWDS)) { diff --git a/src/d/actor/d_a_bwdg.cpp b/src/d/actor/d_a_bwdg.cpp index d5d57511d..aef1a9ad0 100644 --- a/src/d/actor/d_a_bwdg.cpp +++ b/src/d/actor/d_a_bwdg.cpp @@ -153,6 +153,7 @@ static void wave_cont(bwdg_class* i_this, u8 r4) { /* 00000734-00000780 .text boss_a_d_sub__FPvPv */ static void* boss_a_d_sub(void* param_1, void* param_2) { + UNUSED(param_2); if (fopAc_IsActor(param_1) && fopAcM_GetName(param_1) == PROC_BWD) { return param_1; } diff --git a/src/d/actor/d_a_cc.cpp b/src/d/actor/d_a_cc.cpp index 45dec4a4d..6482ed48e 100644 --- a/src/d/actor/d_a_cc.cpp +++ b/src/d/actor/d_a_cc.cpp @@ -271,6 +271,7 @@ void damage_mode_move(cc_class* i_this) { /* 00000C74-00000D30 .text s_b_sub__FPvPv */ void* s_b_sub(void* arg0, void* arg1) { + UNUSED(arg1); if (fopAcM_IsActor(arg0)) { bool bVar2 = false; if (fopAcM_GetName(arg0) == PROC_BOMB) { diff --git a/src/d/actor/d_a_door10.cpp b/src/d/actor/d_a_door10.cpp index 698a4e116..781cb498e 100644 --- a/src/d/actor/d_a_door10.cpp +++ b/src/d/actor/d_a_door10.cpp @@ -132,8 +132,12 @@ BOOL daDoor10_c::chkStopOpen() { } if ((mFrontCheck == 0 && cVar3 == 2) || (mFrontCheck == 1 && cVar3 == 5)) { -#if VERSION == VERSION_DEMO - if (dComIfGp_event_runCheck() == FALSE) { + if ( + dComIfGp_event_runCheck() == FALSE + #if VERSION > VERSION_DEMO + || m2A1 == 0 + #endif + ) { if (dComIfGp_roomControl_checkRoomDisp(roomNo)) { if (fopAcM_myRoomSearchEnemy(roomNo) == NULL) { if (m2A1 != 0) { @@ -147,36 +151,23 @@ BOOL daDoor10_c::chkStopOpen() { return TRUE; } } - } - - if (getArg1() == 15) { - m2A1 = 0; - } else { - m2A1 = 0x41; - } -#else - if (dComIfGp_event_runCheck() == FALSE || m2A1 == 0) { - if (dComIfGp_roomControl_checkRoomDisp(roomNo)) { - if (fopAcM_myRoomSearchEnemy(roomNo) == NULL) { - if (m2A1 != 0) { - m2A1--; - return FALSE; - } - - if (swbit != 0xFF) { - dComIfGs_onSwitch(swbit, roomNo); - } - return TRUE; - } - } - + + #if VERSION > VERSION_DEMO if (getArg1() == 15) { m2A1 = 0; } else { m2A1 = 0x41; } + #endif } -#endif + + #if VERSION == VERSION_DEMO + if (getArg1() == 15) { + m2A1 = 0; + } else { + m2A1 = 0x41; + } + #endif } else if (swbit != 0xFF && dComIfGs_isSwitch(swbit, roomNo)) { return TRUE; } diff --git a/src/d/actor/d_a_door12.cpp b/src/d/actor/d_a_door12.cpp index 955df5f6f..a02c2ccd3 100644 --- a/src/d/actor/d_a_door12.cpp +++ b/src/d/actor/d_a_door12.cpp @@ -156,21 +156,12 @@ BOOL daDoor12_c::chkStopOpen() { } if (mFrontCheck == 0 && cVar4 == 2) { -#if VERSION == VERSION_DEMO - if (dComIfGp_event_runCheck() == FALSE && dComIfGp_roomControl_checkRoomDisp(bVar5) && fopAcM_myRoomSearchEnemy(bVar5) == NULL) { - if (m2A1 != 0) { - m2A1--; - return FALSE; - } - - if (uVar2 != 0xff) { - dComIfGs_onSwitch(uVar2, bVar5); - } - return TRUE; - } - m2A1 = 0x41; -#else - if (!dComIfGp_event_runCheck() != FALSE || m2A1 == 0) { + if ( + dComIfGp_event_runCheck() == FALSE + #if VERSION > VERSION_DEMO + || m2A1 == 0 + #endif + ) { if (dComIfGp_roomControl_checkRoomDisp(bVar5) && fopAcM_myRoomSearchEnemy(bVar5) == NULL) { if (m2A1 != 0) { m2A1--; @@ -182,9 +173,13 @@ BOOL daDoor12_c::chkStopOpen() { } return TRUE; } + #if VERSION > VERSION_DEMO m2A1 = 0x41; + #endif } -#endif + #if VERSION == VERSION_DEMO + m2A1 = 0x41; + #endif } else if (uVar2 != 0xff && dComIfGs_isSwitch(uVar2, bVar5)) { return TRUE; } diff --git a/src/d/actor/d_a_dr2.cpp b/src/d/actor/d_a_dr2.cpp index d730c9259..8e51c3f99 100644 --- a/src/d/actor/d_a_dr2.cpp +++ b/src/d/actor/d_a_dr2.cpp @@ -186,6 +186,7 @@ static BOOL daDr2_Draw(dr2_class* i_this) { /* 000006D4-00000720 .text s_a_d_sub__FPvPv */ void* s_a_d_sub(void* ac1, void* ac2) { + UNUSED(ac2); if (fopAcM_IsActor(ac1) && fopAcM_GetName(ac1) == PROC_BTD) { return ac1; } diff --git a/src/d/actor/d_a_himo2.cpp b/src/d/actor/d_a_himo2.cpp index 5c4434b9e..106e62a5c 100644 --- a/src/d/actor/d_a_himo2.cpp +++ b/src/d/actor/d_a_himo2.cpp @@ -5,6 +5,7 @@ #include "d/dolzel.h" // IWYU pragma: keep #include "d/actor/d_a_bk.h" +#include "d/actor/d_a_player_main.h" #include "d/actor/d_a_ykgr.h" #include "d/actor/d_a_himo2.h" #include "d/actor/d_a_btd.h" diff --git a/src/d/actor/d_a_kamome.cpp b/src/d/actor/d_a_kamome.cpp index 5453fdab8..7d787bac8 100644 --- a/src/d/actor/d_a_kamome.cpp +++ b/src/d/actor/d_a_kamome.cpp @@ -114,6 +114,7 @@ fopAc_ac_c* search_esa(kamome_class* i_this) { /* 00000A44-00000A90 .text s_a_i_sub__FPvPv */ void* s_a_i_sub(void* ac1, void* ac2) { + UNUSED(ac2); if (fopAc_IsActor(ac1) && fpcM_GetName(ac1) == PROC_NPC_LS1) { return ac1; } @@ -257,6 +258,7 @@ void kamome_ground_pos_move(kamome_class* i_this) { /* 00001150-000011B8 .text ko_s_sub__FPvPv */ void* ko_s_sub(void* ac1, void* ac2) { + UNUSED(ac2); kamome_class* i_this = (kamome_class*)ac1; if (fopAcM_IsActor(&i_this->actor) && fopAcM_GetName(&i_this->actor) == PROC_KAMOME && (fopAcM_GetParam(&i_this->actor) & 0xf) == 7) { ko_count++; @@ -292,6 +294,7 @@ void heisou_control(kamome_class* i_this) { /* 00001304-00001360 .text h_s_sub__FPvPv */ void* h_s_sub(void* ac1, void* ac2) { + UNUSED(ac2); kamome_class* i_this = (kamome_class*)ac1; if (fopAcM_IsActor(&i_this->actor) && fopAcM_GetName(&i_this->actor) == PROC_KAMOME && (fopAcM_GetParam(&i_this->actor) & 0xf) == 6) { return &i_this->actor; diff --git a/src/d/actor/d_a_knob00.cpp b/src/d/actor/d_a_knob00.cpp index 718956618..f910c44ca 100644 --- a/src/d/actor/d_a_knob00.cpp +++ b/src/d/actor/d_a_knob00.cpp @@ -618,14 +618,9 @@ BOOL daKnob00_c::actionPassward2() { dComIfGs_onEventBit(dSv_event_flag_c::UNK_3B20); dComIfGs_setEventReg(dSv_event_flag_c::UNK_BA0F, (s8)cM_rndF(6.0f)); } -#if VERSION == VERSION_DEMO - s32 tmp = dComIfGs_getEventReg(dSv_event_flag_c::UNK_BA0F); - m2D0.init(tmp + 0x1b1a); -#else - s32 tmp = dComIfGs_getEventReg(dSv_event_flag_c::UNK_BA0F); - tmp += 0x1b1a; - m2D0.init(tmp); -#endif + int tmp = dComIfGs_getEventReg(dSv_event_flag_c::UNK_BA0F); + int tmp2 = tmp; + m2D0.init(tmp2 + 0x1b1a); } break; diff --git a/src/d/actor/d_a_kokiie.cpp b/src/d/actor/d_a_kokiie.cpp index 23be18d56..1f82761d0 100644 --- a/src/d/actor/d_a_kokiie.cpp +++ b/src/d/actor/d_a_kokiie.cpp @@ -16,9 +16,9 @@ #include "f_op/f_op_camera.h" #include "JSystem/JUtility/JUTReport.h" -static void ride_call_back(dBgW*, fopAc_ac_c*, fopAc_ac_c*) { - // There was an unused function here that got stripped out, but it still affected literal ordering. - f32* dummy; +static cXyz ride_call_back(dBgW*, fopAc_ac_c*, fopAc_ac_c*) { + // There was an unused function here that got stripped out, but it still affected literal and weak function ordering. + f32* dummy = NULL; *dummy = 10.0f; *dummy = 50.0f; *dummy = 5.0f; @@ -26,11 +26,14 @@ static void ride_call_back(dBgW*, fopAc_ac_c*, fopAc_ac_c*) { *dummy = 1.2f; *dummy = -100.0f; *dummy = 0.1f; + cXyz temp(0.0f, 0.0f, 0.0f); + return temp; } /* 000000B4-00000154 .text daKokiie_Draw__FP12kokiie_class */ static BOOL daKokiie_Draw(kokiie_class* i_this) { - g_env_light.settingTevStruct(TEV_TYPE_BG0, &i_this->actor.current.pos, &i_this->actor.tevStr); + fopAc_ac_c* actor = (fopAc_ac_c*)&i_this->actor; + g_env_light.settingTevStruct(TEV_TYPE_BG0, &actor->current.pos, &actor->tevStr); g_env_light.setLightTevColorType(i_this->mpModel, &(i_this->actor).tevStr); dComIfGd_setListBG(); @@ -41,6 +44,13 @@ static BOOL daKokiie_Draw(kokiie_class* i_this) { /* 00000154-00000884 .text kokiie_move__FP12kokiie_class */ void kokiie_move(kokiie_class* i_this) { + fopAc_ac_c* actor = (fopAc_ac_c*)&i_this->actor; + int i; + int uVar6; + s16 maxSpeed; + s16 target; + s16 sVar1; + static u8 himo_off_check[] = {1, 2, 4, 8, 16}; static s16 himo_off_ya[] = { 0x1, 0x0, 0x2EE0, 0x1D4C, 0x5FB4, 0x0, 0x4E20, 0x30D4, 0x987C, 0x0, 0x0, 0x1964, 0x7FFF, 0x7FFF, 0x6784, 0x5014, @@ -59,8 +69,8 @@ void kokiie_move(kokiie_class* i_this) { switch (i_this->m29A) { case 0: { - s32 uVar6 = 0; - for (s32 i = 0; i < ARRAY_SSIZE(i_this->m32C); i++) { + uVar6 = 0; + for (i = 0; i < ARRAY_SSIZE(i_this->m32C); i++) { if (i_this->m32C[i] == 2) { i_this->m32C[i] = 0; i_this->m338 = 0.0f; @@ -75,16 +85,16 @@ void kokiie_move(kokiie_class* i_this) { } } - s16 sVar1 = himo_off_ya[uVar6]; - s16 target = himo_off_xa[uVar6]; + sVar1 = himo_off_ya[uVar6]; + target = himo_off_xa[uVar6]; cLib_addCalc2(&i_this->m2D0, REG8_F(4) - himo_off_yp[uVar6], 0.1f, i_this->m338 * 50.0f); if ((uVar6 == 0x1f) && dComIfGs_checkGetItem(dItem_BOOMERANG_e)) { i_this->m29A = 1; - i_this->actor.health = 0; + actor->health = 0; i_this->m378 = 1; } - s16 maxSpeed = i_this->m338 * 10000.0f; + maxSpeed = i_this->m338 * 10000.0f; cLib_addCalcAngleS2(&i_this->m334, target, 4, maxSpeed); if (target != 0) { @@ -92,8 +102,8 @@ void kokiie_move(kokiie_class* i_this) { } cLib_addCalc2(&i_this->m338, 1.0f, 1.0f, REG8_F(14) + 0.001f); - cLib_addCalcAngleS2(&i_this->actor.current.angle.x, 0, 10, 0x200); - cLib_addCalcAngleS2(&i_this->actor.current.angle.z, 0, 10, 0x200); + cLib_addCalcAngleS2(&actor->current.angle.x, 0, 10, 0x200); + cLib_addCalcAngleS2(&actor->current.angle.z, 0, 10, 0x200); i_this->m2C8.x = i_this->m2BC * cM_ssin(i_this->m298 * 900); i_this->m2C8.z = i_this->m2C4 * cM_ssin(i_this->m298 * 700); @@ -107,19 +117,19 @@ void kokiie_move(kokiie_class* i_this) { cLib_addCalc0(&i_this->m2B0, 1.0f, 0.25f); cLib_addCalc0(&i_this->m2B8, 1.0f, 0.25f); - i_this->actor.shape_angle = i_this->actor.current.angle + i_this->m2C8; - i_this->actor.current.pos = i_this->actor.home.pos + i_this->m2A4; - i_this->actor.current.pos.y += i_this->m2D0; + actor->shape_angle = actor->current.angle + i_this->m2C8; + actor->current.pos = actor->home.pos + i_this->m2A4; + actor->current.pos.y += i_this->m2D0; cLib_addCalc0(&i_this->m2A4.y, 0.05f, REG0_F(7) + 2.0f); } break; case 1: - cLib_addCalcAngleS2(&i_this->actor.shape_angle.x, 0, 10, 0x800); - cLib_addCalcAngleS2(&i_this->actor.shape_angle.z, 0, 10, 0x800); + cLib_addCalcAngleS2(&actor->shape_angle.x, 0, 10, 0x800); + cLib_addCalcAngleS2(&actor->shape_angle.z, 0, 10, 0x800); cLib_addCalcAngleS2(&i_this->m334, 0, 4, 0x200); - i_this->actor.current.pos.y += i_this->actor.speed.y; - i_this->actor.speed.y -= REG12_F(14) + 3.0f; + actor->current.pos.y += actor->speed.y; + actor->speed.y -= REG12_F(14) + 3.0f; if (i_this->m37A == (s16)(REG0_S(4) + 0x1b)) { if (i_this->m2A2 != 0xff) { @@ -131,23 +141,23 @@ void kokiie_move(kokiie_class* i_this) { } if (i_this->m37A == (s16)(REG0_S(5) + 0x40)) { - cXyz sp44 = i_this->actor.current.pos; + cXyz sp44 = actor->current.pos; sp44.y = 1170.0f; dComIfGp_particle_set(dPa_name::ID_SCENE_82A4, &sp44); dComIfGp_particle_set(dPa_name::ID_SCENE_82A5, &sp44); - dComIfGp_particle_set(dPa_name::ID_SCENE_82A6, &i_this->actor.current.pos); + dComIfGp_particle_set(dPa_name::ID_SCENE_82A6, &actor->current.pos); dComIfGp_particle_set(dPa_name::ID_SCENE_82A7, &sp44); } i_this->m374 = (REG0_F(9) + 5180.0f) - 3800.0f; - if (i_this->actor.current.pos.y <= i_this->m374) { - i_this->actor.current.pos.y = i_this->m374; - if (i_this->actor.speed.y < -20.0f) { + if (actor->current.pos.y <= i_this->m374) { + actor->current.pos.y = i_this->m374; + if (actor->speed.y < -20.0f) { dComIfGp_getVibration().StartShock(REG6_S(2) + 7, -0x21, cXyz(0.0f, 1.0f, 0.0f)); fopAcM_seStartCurrent(&i_this->actor, JA_SE_OBJ_KOKIRI_H_LANDING, 0); i_this->m39C = REG12_F(10) + 40.0f + 50.0f; } - i_this->actor.speed.y = 0.0f; + actor->speed.y = 0.0f; cLib_addCalcAngleS2(&i_this->m334, 0, 2, 0x2000); } break; @@ -160,6 +170,7 @@ void himo_create(kokiie_class* i_this) { #else BOOL himo_create(kokiie_class* i_this) { #endif + fopAc_ac_c* actor = (fopAc_ac_c*)&i_this->actor; #if VERSION > VERSION_DEMO if ((i_this->m2A2 != 0xff) && fopAcM_isSwitch(&i_this->actor, i_this->m2A2)) { return FALSE; @@ -174,10 +185,10 @@ BOOL himo_create(kokiie_class* i_this) { switch (i_this->m2E8[i]) { case 0: pfVar3 = fopAcM_CreateAppend(); - pfVar3->base.position = i_this->actor.current.pos; - pfVar3->base.angle.y = i_this->actor.current.angle.y + i * 0x3333 + -13000; + pfVar3->base.position = actor->current.pos; + pfVar3->base.angle.y = actor->current.angle.y + i * 0x3333 + -13000; pfVar3->base.parameters = 0xffffff01; - pfVar3->room_no = i_this->actor.current.roomNo; + pfVar3->room_no = actor->current.roomNo; i_this->m2D4[i] = fopAcM_create(PROC_SHAND, NULL, pfVar3); i_this->m2E8[i]++; @@ -206,45 +217,46 @@ BOOL himo_create(kokiie_class* i_this) { /* 00000A18-00000E98 .text demo_camera__FP12kokiie_class */ void demo_camera(kokiie_class* i_this) { + fopAc_ac_c* actor = (fopAc_ac_c*)&i_this->actor; camera_class* camera = dComIfGp_getCamera(dComIfGp_getPlayerCameraID(0)); cXyz sp5C; cXyz sp50; - cMtx_YrotS(*calc_mtx, i_this->actor.shape_angle.y); + cMtx_YrotS(*calc_mtx, actor->shape_angle.y); switch (i_this->m378) { case 0: break; case 1: - if (!i_this->actor.eventInfo.checkCommandDemoAccrpt()) { + if (!actor->eventInfo.checkCommandDemoAccrpt()) { fopAcM_orderPotentialEvent(&i_this->actor, 2, 0xffff, 0); - i_this->actor.eventInfo.onCondition(dEvtCnd_UNK2_e); + actor->eventInfo.onCondition(dEvtCnd_UNK2_e); return; } i_this->m378++; camera->mCamera.Stop(); camera->mCamera.SetTrimSize(2); - i_this->m37C = i_this->actor.current.pos; + i_this->m37C = actor->current.pos; sp5C.x = (REG12_F(2) + 1300.0f) - 800.0f; sp5C.y = 0.0f; sp5C.z = REG12_F(4) - 1000.0f; MtxPosition(&sp5C, &sp50); - i_this->m37C.x = i_this->actor.current.pos.x + sp50.x; + i_this->m37C.x = actor->current.pos.x + sp50.x; i_this->m37C.y = ((REG12_F(5) + 4030.0f) - 3800.0f) + 1500.0f; - i_this->m37C.z = i_this->actor.current.pos.z + sp50.z; - i_this->m388 = i_this->actor.current.pos; + i_this->m37C.z = actor->current.pos.z + sp50.z; + i_this->m388 = actor->current.pos; i_this->m388.y += REG12_F(6) + -450.0f; i_this->m3A0 = REG12_F(18) + 65.0f; i_this->m37A = 0; case 2: if (i_this->m37A < (s16)(REG12_S(3) + 10)) { - i_this->actor.speed.y = 0.0f; + actor->speed.y = 0.0f; } - cLib_addCalc2(&i_this->m388.y, (i_this->actor.current.pos.y - 450.0f) + REG12_F(6), REG12_F(7) + 0.5f, REG12_F(8) + 200.0f); + cLib_addCalc2(&i_this->m388.y, (actor->current.pos.y - 450.0f) + REG12_F(6), REG12_F(7) + 0.5f, REG12_F(8) + 200.0f); if (i_this->m37A > (s16)(REG12_S(4) + 0x32)) { cLib_addCalc2(&i_this->m3A0, REG12_F(19) + 80.0f, 0.02f, REG12_F(20) + 0.5f); } @@ -287,15 +299,16 @@ void demo_camera(kokiie_class* i_this) { /* 00000E98-0000107C .text daKokiie_Execute__FP12kokiie_class */ static BOOL daKokiie_Execute(kokiie_class* i_this) { + fopAc_ac_c* actor = (fopAc_ac_c*)&i_this->actor; kokiie_move(i_this); - MtxTrans(i_this->actor.current.pos.x, i_this->actor.current.pos.y, i_this->actor.current.pos.z, 0); + MtxTrans(actor->current.pos.x, actor->current.pos.y, actor->current.pos.z, 0); - cMtx_YrotM(*calc_mtx, i_this->actor.shape_angle.y); + cMtx_YrotM(*calc_mtx, actor->shape_angle.y); cMtx_YrotM(*calc_mtx, i_this->m332); cMtx_XrotM(*calc_mtx, i_this->m334); cMtx_YrotM(*calc_mtx, -i_this->m332); - cMtx_XrotM(*calc_mtx, i_this->actor.shape_angle.x); - cMtx_ZrotM(*calc_mtx, i_this->actor.shape_angle.z); + cMtx_XrotM(*calc_mtx, actor->shape_angle.x); + cMtx_ZrotM(*calc_mtx, actor->shape_angle.z); cMtx_YrotM(*calc_mtx, 0xb54); i_this->mpModel->setBaseTRMtx(*calc_mtx); @@ -328,9 +341,10 @@ static BOOL daKokiie_IsDelete(kokiie_class*) { /* 00001084-000010E4 .text daKokiie_Delete__FP12kokiie_class */ static BOOL daKokiie_Delete(kokiie_class* i_this) { + fopAc_ac_c* actor = (fopAc_ac_c*)&i_this->actor; dComIfG_resDeleteDemo(&i_this->mPhase, "Kokiie"); #if VERSION > VERSION_DEMO - if (i_this->actor.heap != NULL) + if (actor->heap != NULL) #endif { dComIfG_Bgsp()->Release(i_this->pm_bgw); @@ -419,7 +433,7 @@ static cPhs_State daKokiie_Create(fopAc_ac_c* a_this) { a_this->scale.y = 1.0f; fopAcM_SetMtx(a_this, i_this->mpModel->getBaseTRMtx()); - fopAcM_SetMin(a_this, a_this->scale.x * -1000.0f, DEMO_SELECT(-1000.0f, -1500.0f), a_this->scale.z * -1000.0f); + fopAcM_SetMin(a_this, a_this->scale.x * -1000.0f, VERSION_SELECT(-1000.0f, -1000.0f, -1500.0f, -1000.0f), a_this->scale.z * -1000.0f); fopAcM_SetMax(a_this, a_this->scale.x * 1000.0f, 1000.0f, a_this->scale.z * 1000.0f); i_this->mpModel->setBaseScale(a_this->scale); diff --git a/src/d/actor/d_a_npc_bmsw.cpp b/src/d/actor/d_a_npc_bmsw.cpp index a09e7e815..afaf05985 100644 --- a/src/d/actor/d_a_npc_bmsw.cpp +++ b/src/d/actor/d_a_npc_bmsw.cpp @@ -557,7 +557,7 @@ u32 daNpc_Bmsw_c::getMsg() { } /* 0000102C-000010C0 .text anmAtr__12daNpc_Bmsw_cFUs */ -void daNpc_Bmsw_c::anmAtr(unsigned short mesgNo) { +void daNpc_Bmsw_c::anmAtr(u16 i_msgStatus) { switch (dComIfGp_getMesgAnimeAttrInfo()) { case 5: setAnm(1); diff --git a/src/d/actor/d_a_npc_btsw.cpp b/src/d/actor/d_a_npc_btsw.cpp index 5432ffb86..0e0d7325f 100644 --- a/src/d/actor/d_a_npc_btsw.cpp +++ b/src/d/actor/d_a_npc_btsw.cpp @@ -418,7 +418,7 @@ u32 daNpc_Btsw_c::getMsg() { } /* 00000DF0-00000F0C .text anmAtr__12daNpc_Btsw_cFUs */ -void daNpc_Btsw_c::anmAtr(unsigned short mesgNo) { +void daNpc_Btsw_c::anmAtr(u16 i_msgStatus) { switch (dComIfGp_getMesgAnimeAttrInfo()) { case 0: setAnm(0); diff --git a/src/d/actor/d_a_npc_btsw2.cpp b/src/d/actor/d_a_npc_btsw2.cpp index 63e8ab017..be56ca8f0 100644 --- a/src/d/actor/d_a_npc_btsw2.cpp +++ b/src/d/actor/d_a_npc_btsw2.cpp @@ -257,7 +257,7 @@ void daNpc_Btsw2_c::checkOrder() { } /* 00000860-0000097C .text anmAtr__13daNpc_Btsw2_cFUs */ -void daNpc_Btsw2_c::anmAtr(u16) { +void daNpc_Btsw2_c::anmAtr(u16 i_msgStatus) { switch (dComIfGp_getMesgAnimeAttrInfo()) { case 0: setAnm(0); diff --git a/src/d/actor/d_a_npc_hi1.cpp b/src/d/actor/d_a_npc_hi1.cpp index 411e4ecbb..a1bac45e7 100644 --- a/src/d/actor/d_a_npc_hi1.cpp +++ b/src/d/actor/d_a_npc_hi1.cpp @@ -371,9 +371,9 @@ void daNpc_Hi1_c::setAnm_ATR() { } /* 00000D1C-00000DD8 .text anmAtr__11daNpc_Hi1_cFUs */ -void daNpc_Hi1_c::anmAtr(u16 param_1) { - switch (param_1) { - case 6: +void daNpc_Hi1_c::anmAtr(u16 i_msgStatus) { + switch (i_msgStatus) { + case fopMsgStts_MSG_TYPING_e: { if(field_0x7C8 == 0) { chngAnmAtr(dComIfGp_getMesgAnimeAttrInfo()); field_0x7C8++; @@ -385,7 +385,8 @@ void daNpc_Hi1_c::anmAtr(u16 param_1) { chngAnmTag(); } break; - case 0xe: + } + case fopMsgStts_MSG_DISPLAYED_e: field_0x7C8 = 0; break; default: @@ -397,7 +398,7 @@ void daNpc_Hi1_c::anmAtr(u16 param_1) { /* 00000DD8-00000DE0 .text next_msgStatus__11daNpc_Hi1_cFPUl */ u16 daNpc_Hi1_c::next_msgStatus(u32* pMsgNo) { - return 0x10; + return fopMsgStts_MSG_ENDS_e; } /* 00000DE0-00000DE8 .text getMsg_HI1_0__11daNpc_Hi1_cFv */ diff --git a/src/d/actor/d_a_npc_km1.cpp b/src/d/actor/d_a_npc_km1.cpp index d408ec676..a8dbf5f54 100644 --- a/src/d/actor/d_a_npc_km1.cpp +++ b/src/d/actor/d_a_npc_km1.cpp @@ -298,8 +298,8 @@ void daNpc_Km1_c::setAnm_ATR(int param_1) { } /* 00000B50-00000C0C .text anmAtr__11daNpc_Km1_cFUs */ -void daNpc_Km1_c::anmAtr(unsigned short param_1) { - if(param_1 == 6){ +void daNpc_Km1_c::anmAtr(u16 i_msgStatus) { + if(i_msgStatus == fopMsgStts_MSG_TYPING_e){ if(field_0x7D6 == 0){ field_0x7CC = 0xFF; chngAnmAtr(dComIfGp_getMesgAnimeAttrInfo()); @@ -311,7 +311,7 @@ void daNpc_Km1_c::anmAtr(unsigned short param_1) { field_0x7CC = uVar1; chngAnmTag(); } - }else if(param_1 == 0xE){ + }else if(i_msgStatus == fopMsgStts_MSG_DISPLAYED_e){ field_0x7D6 = 0; } ctrlAnmAtr(); diff --git a/src/d/actor/d_a_npc_nz.cpp b/src/d/actor/d_a_npc_nz.cpp index 67d7dd9c0..f2998d49a 100644 --- a/src/d/actor/d_a_npc_nz.cpp +++ b/src/d/actor/d_a_npc_nz.cpp @@ -726,7 +726,7 @@ u16 daNpc_Nz_c::next_msgStatus(u32* pMsgNo) { } /* 00002038-000022C0 .text anmAtr__10daNpc_Nz_cFUs */ -void daNpc_Nz_c::anmAtr(u16) { +void daNpc_Nz_c::anmAtr(u16 i_msgStatus) { if(field_0x6D5 == 9 && mpMorf->checkFrame(mpMorf->getEndFrame() - 1.0f)) { setAnm(0, false); } diff --git a/src/d/actor/d_a_npc_people.cpp b/src/d/actor/d_a_npc_people.cpp index 22686c571..1a372133f 100644 --- a/src/d/actor/d_a_npc_people.cpp +++ b/src/d/actor/d_a_npc_people.cpp @@ -6667,7 +6667,7 @@ u32 daNpcPeople_c::getMsg() { m734 = NULL; - if(g_dComIfG_gameInfo.play.getEvent().chkPhoto()) { + if(g_dComIfG_gameInfo.play.getEvent()->chkPhoto()) { switch(mNpcType) { case 2: if(dComIfGp_getPictureResult() == 1) { diff --git a/src/d/actor/d_a_npc_photo.cpp b/src/d/actor/d_a_npc_photo.cpp index 04b143330..b2bced6d0 100644 --- a/src/d/actor/d_a_npc_photo.cpp +++ b/src/d/actor/d_a_npc_photo.cpp @@ -1714,7 +1714,7 @@ u32 daNpcPhoto_c::getMsg() { field_0x980 = 0; field_0x9D0 = 0; - if(g_dComIfG_gameInfo.play.getEvent().chkPhoto()) { + if(g_dComIfG_gameInfo.play.getEvent()->chkPhoto()) { if (eventReg < 1) { msgNo = 0x2A5C; } else if (eventReg < 3) { diff --git a/src/d/actor/d_a_obj_gnnbtltaki.cpp b/src/d/actor/d_a_obj_gnnbtltaki.cpp index a68e12516..6ea9d72d2 100644 --- a/src/d/actor/d_a_obj_gnnbtltaki.cpp +++ b/src/d/actor/d_a_obj_gnnbtltaki.cpp @@ -6,7 +6,7 @@ #include "d/actor/d_a_obj_gnnbtltaki.h" #include "d/d_procname.h" #include "d/d_priority.h" -#include "d/res/res_kamome.h" +#include "d/res/res_gnnbtltaki.h" const char daObjGnnbtaki_c::M_arcname[] = "Gnnbtltaki"; @@ -18,29 +18,18 @@ BOOL daObjGnnbtaki_c::solidHeapCB(fopAc_ac_c *i_this) { /* 00000098-000001F4 .text create_heap__15daObjGnnbtaki_cFv */ BOOL daObjGnnbtaki_c::create_heap() { -#if VERSION == VERSION_DEMO J3DModelData* mdl_data; J3DAnmTextureSRTKey* btk_data; BOOL ret = FALSE; - mdl_data = (J3DModelData*)dComIfG_getObjectRes(M_arcname, 4); -#else - BOOL ret = FALSE; - J3DModelData *mdl_data = static_cast(dComIfG_getObjectRes(M_arcname, 4)); -#endif - JUT_ASSERT(0x5A, mdl_data != NULL); + mdl_data = static_cast(dComIfG_getObjectRes(M_arcname, GNNBTLTAKI_BDL_GNN_BTL_TAKI)); + JUT_ASSERT(90, mdl_data != NULL); if (mdl_data != NULL) { - mJ3DModel = mDoExt_J3DModel__create(mdl_data, 0, 0x11020203); - if (mJ3DModel != NULL) { -#if VERSION == VERSION_DEMO - btk_data = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes(M_arcname, 7); -#else - J3DAnmTextureSRTKey *btk_data = static_cast(dComIfG_getObjectRes(M_arcname, 7)); -#endif - JUT_ASSERT(0x61, btk_data != NULL); - if (btk_data != NULL) { - if (mBtkAnm.init(mdl_data, btk_data, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0, 0, -1, false, FALSE)) { - ret = TRUE; - } + mpModel = mDoExt_J3DModel__create(mdl_data, 0, 0x11020203); + if (mpModel != NULL) { + btk_data = static_cast(dComIfG_getObjectRes(M_arcname, GNNBTLTAKI_BTK_GNN_BTL_TAKI)); + JUT_ASSERT(97, btk_data != NULL); + if (btk_data != NULL && mBtkAnm.init(mdl_data, btk_data, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0, 0, -1, false, FALSE)) { + ret = TRUE; } } } @@ -58,7 +47,7 @@ cPhs_State daObjGnnbtaki_c::_create() { if (field_0x2B1 == 0xF) { field_0x2B1 = 0; } - cullMtx = mJ3DModel->getBaseTRMtx(); + cullMtx = mpModel->getBaseTRMtx(); init_mtx(); mBtkAnm.getFrameCtrl()->setFrame(mBtkAnm.getStartFrame()); if (field_0x2B1 == 1) { @@ -76,17 +65,13 @@ cPhs_State daObjGnnbtaki_c::_create() { /* 000003EC-0000041C .text _delete__15daObjGnnbtaki_cFv */ bool daObjGnnbtaki_c::_delete() { -#if VERSION == VERSION_DEMO - dComIfG_deleteObjectRes(M_arcname); -#else - dComIfG_resDelete(&mPhase, M_arcname); -#endif + dComIfG_resDeleteDemo(&mPhase, M_arcname); return true; } /* 0000041C-0000043C .text init_mtx__15daObjGnnbtaki_cFv */ void daObjGnnbtaki_c::init_mtx() { - mJ3DModel->setBaseScale(scale); + mpModel->setBaseScale(scale); } /* 0000043C-00000548 .text _execute__15daObjGnnbtaki_cFv */ @@ -111,9 +96,9 @@ bool daObjGnnbtaki_c::_execute() { bool daObjGnnbtaki_c::_draw() { if (field_0x2B0 != NULL) { g_env_light.settingTevStruct(TEV_TYPE_BG3, ¤t.pos, &tevStr); - g_env_light.setLightTevColorType(mJ3DModel, &tevStr); - mBtkAnm.entry(mJ3DModel->getModelData()); - mDoExt_modelUpdateDL(mJ3DModel); + g_env_light.setLightTevColorType(mpModel, &tevStr); + mBtkAnm.entry(mpModel->getModelData()); + mDoExt_modelUpdateDL(mpModel); } return true; } diff --git a/src/d/actor/d_a_obj_gnndemotakie.cpp b/src/d/actor/d_a_obj_gnndemotakie.cpp index fc85bdc4a..57bdb37b9 100644 --- a/src/d/actor/d_a_obj_gnndemotakie.cpp +++ b/src/d/actor/d_a_obj_gnndemotakie.cpp @@ -18,18 +18,18 @@ BOOL daObjGnntakie_c::solidHeapCB(fopAc_ac_c* a_this) { /* 00000098-000001F4 .text create_heap__15daObjGnntakie_cFv */ BOOL daObjGnntakie_c::create_heap() { + J3DModelData* mdl_data; + J3DAnmTextureSRTKey* btk_data; BOOL ret = FALSE; - J3DModelData* mdl_data = static_cast(dComIfG_getObjectRes(M_arcname, GNNDEMOTAKIE_BDL_GNN_DEMO_TAKI_E)); - JUT_ASSERT(0x5A, mdl_data != NULL); + mdl_data = static_cast(dComIfG_getObjectRes(M_arcname, GNNDEMOTAKIE_BDL_GNN_DEMO_TAKI_E)); + JUT_ASSERT(90, mdl_data != NULL); if (mdl_data != NULL) { mpModel = mDoExt_J3DModel__create(mdl_data, 0, 0x11020203); if (mpModel != NULL) { - J3DAnmTextureSRTKey* btk_data = static_cast(dComIfG_getObjectRes(M_arcname, GNNDEMOTAKIE_BTK_GNN_DEMO_TAKI_E)); - JUT_ASSERT(0x61, btk_data != NULL); - if (btk_data != NULL) { - if (mpBtkAnm.init(mdl_data, btk_data, true, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, false, FALSE)) { - ret = TRUE; - } + btk_data = static_cast(dComIfG_getObjectRes(M_arcname, GNNDEMOTAKIE_BTK_GNN_DEMO_TAKI_E)); + JUT_ASSERT(97, btk_data != NULL); + if (btk_data != NULL && mpBtkAnm.init(mdl_data, btk_data, true, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, false, FALSE)) { + ret = TRUE; } } } diff --git a/src/d/actor/d_a_obj_ospbox.cpp b/src/d/actor/d_a_obj_ospbox.cpp index 5ec9432aa..b94fffb79 100644 --- a/src/d/actor/d_a_obj_ospbox.cpp +++ b/src/d/actor/d_a_obj_ospbox.cpp @@ -76,23 +76,6 @@ BOOL daObjOspbox::Act_c::Create() { return TRUE; } -const s16 pf_name[] = { - PROC_Obj_Ospbox, - PROC_KB, - PROC_KB, - PROC_KB, - PROC_Obj_Ospbox, - PROC_Obj_Ospbox, - PROC_Obj_Ospbox, - PROC_Obj_Ospbox -}; -const u32 prm[] = { - 0x00000000, - 0x01FF0000, - 0x01FF0001, - 0x01FF0002 -}; - Mtx daObjOspbox::Act_c::M_tmp_mtx; /* 00000294-000004F8 .text Mthd_Create__Q211daObjOspbox5Act_cFv */ @@ -100,7 +83,12 @@ cPhs_State daObjOspbox::Act_c::Mthd_Create() { fopAcM_SetupActor(this, Act_c); cPhs_State phase_state = dComIfG_resLoad(&mPhase, M_arcname); if (phase_state == cPhs_COMPLEATE_e) { - phase_state = MoveBGCreate(M_arcname, OSPBOX_DZB_OSPBOX, NULL, 0x8a0); + #if VERSION == VERSION_DEMO + const u32 heapSize = 0x1620; + #else + const u32 heapSize = 0x8A0; + #endif + phase_state = MoveBGCreate(M_arcname, OSPBOX_DZB_OSPBOX, NULL, heapSize); JUT_ASSERT(0xc3, (phase_state == cPhs_COMPLEATE_e) || (phase_state == cPhs_ERROR_e)); } return phase_state; @@ -134,6 +122,23 @@ void daObjOspbox::Act_c::init_mtx() { /* 00000CC0-00000D7C .text make_item__Q211daObjOspbox5Act_cFv */ void daObjOspbox::Act_c::make_item() { + static const s16 pf_name[] = { + PROC_Obj_Ospbox, + PROC_KB, + PROC_KB, + PROC_KB, + PROC_Obj_Ospbox, + PROC_Obj_Ospbox, + PROC_Obj_Ospbox, + PROC_Obj_Ospbox + }; + static const u32 prm[] = { + 0x00000000, + 0x01FF0000, + 0x01FF0001, + 0x01FF0002 + }; + int prm_index = prm_get_spec(); if (pf_name[prm_index] == PROC_Obj_Ospbox) { int item_no = prm_get_itemNo(); @@ -141,14 +146,14 @@ void daObjOspbox::Act_c::make_item() { item_no, 0x7F, fopAcM_GetHomeRoomNo(this), daItemType_0_e, - fopAcM_GetAngle_p(this), + ¤t.angle, daItemAct_7_e, NULL); } else { fopAcM_create(pf_name[prm_index], prm[prm_index], ¤t.pos, fopAcM_GetHomeRoomNo(this), - fopAcM_GetAngle_p(this), + ¤t.angle, NULL, 0xFF, NULL); diff --git a/src/d/actor/d_a_player_food.inc b/src/d/actor/d_a_player_food.inc index 90950b027..425e55beb 100644 --- a/src/d/actor/d_a_player_food.inc +++ b/src/d/actor/d_a_player_food.inc @@ -41,7 +41,7 @@ BOOL daPy_lk_c::procFoodThrow_init() { dBgS* bgs = dComIfG_Bgsp(); // This is kinda weird, maybe fakematch - if (dComIfGp_event_runCheck() == FALSE) { + if (!dComIfGp_event_runCheck()) { if (!dComIfGp_event_compulsory(this)) { return FALSE; } else { @@ -167,7 +167,7 @@ BOOL daPy_lk_c::procFoodSet_init() { return TRUE; } - if (dComIfGp_event_runCheck() == FALSE) { + if (!dComIfGp_event_runCheck()) { if (!dComIfGp_event_compulsory(this)) { return FALSE; } diff --git a/src/d/actor/d_a_player_main.cpp b/src/d/actor/d_a_player_main.cpp index 4a8b7f45e..2b7d28285 100644 --- a/src/d/actor/d_a_player_main.cpp +++ b/src/d/actor/d_a_player_main.cpp @@ -9073,22 +9073,21 @@ void daPy_lk_c::setNeckAngle() { checkAttentionPosAngle(mpAttnActorZ, &sp18) ) { r28 = true; - } else { - if (dComIfGp_getDetect().chk_attention(&spA0) && - cLib_distanceAngleS(cLib_targetAngleY(¤t.pos, &spA0), m34DE) <= 0x6000) - { + } else if ( + dComIfGp_getDetect().chk_attention(&spA0) && + cLib_distanceAngleS(cLib_targetAngleY(¤t.pos, &spA0), m34DE) <= 0x6000 + ) { + sp18 = &spA0; + r28 = true; + } else if (m34C3 == 10) { + spA0.set( + current.pos.x - 10.0f * (m3730.x + m36B8.x), + 120.0f + current.pos.y, + current.pos.z - 10.0f * (m3730.z + m36B8.z) + ); + if (cLib_distanceAngleS(cLib_targetAngleY(¤t.pos, &spA0), m34DE) <= 0x6000) { sp18 = &spA0; r28 = true; - } else if (m34C3 == 10) { - spA0.set( - current.pos.x - 10.0f * (m3730.x + m36B8.x), - 120.0f + current.pos.y, - current.pos.z - 10.0f * (m3730.z + m36B8.z) - ); - if (cLib_distanceAngleS(cLib_targetAngleY(¤t.pos, &spA0), m34DE) <= 0x6000) { - sp18 = &spA0; - r28 = true; - } } } } else if (mCurProc == daPyProc_BOTTLE_OPEN_e) { diff --git a/src/d/actor/d_a_pz.cpp b/src/d/actor/d_a_pz.cpp index b4b4a7f94..70f4fc57f 100644 --- a/src/d/actor/d_a_pz.cpp +++ b/src/d/actor/d_a_pz.cpp @@ -141,7 +141,7 @@ u16 daPz_c::next_msgStatus(unsigned long*) { } /* 00001208-00001288 .text anmAtr__6daPz_cFUs */ -void daPz_c::anmAtr(unsigned short) { +void daPz_c::anmAtr(u16 i_msgStatus) { /* Nonmatching */ } diff --git a/src/d/actor/d_a_tbox.cpp b/src/d/actor/d_a_tbox.cpp index c355a17f8..70d8ef36d 100644 --- a/src/d/actor/d_a_tbox.cpp +++ b/src/d/actor/d_a_tbox.cpp @@ -919,27 +919,14 @@ BOOL daTbox_c::actionWait() { /* 000024B4-000025A4 .text actionDemo__8daTbox_cFv */ BOOL daTbox_c::actionDemo() { - /* Fakematch - the temp variable for play is definitely not right. */ - s16 eventId = eventInfo.getEventId(); - dComIfG_play_c* play = &g_dComIfG_gameInfo.play; - if (dComIfGp_evmng_endCheck(eventId)) { - // if (dComIfGp_evmng_endCheck(eventInfo.getEventId())) { + if (dComIfGp_evmng_endCheck(eventInfo.getEventId())) { setAction(&daTbox_c::actionWait); - // Fakematch: - // When dComIfGp_event_reset is used here, the way gameInfo is loaded matches the demo - // binary, but not the release binary. So the demo's debug map may be misleading here? - // But daTbox_c::actionDemo in TP debug still calls dComIfGp_event_reset, so maybe not? - // Also, putting a cast like (void) on dComIfGp_event_reset() slightly improves the - // codegen, but it's still slightly wrong. - // dComIfGp_event_reset(); - play->getEvent().reset(); + dComIfGp_event_reset(); dKy_set_allcol_ratio(1.0f); flagOff(daTboxFlg_UNK_08 | daTboxFlg_OPENING_e); - // The fakematch also might be related to dComIfGp_event_setItemPartner? Removing this - // call fixes the load above. dComIfGp_event_setItemPartner(NULL); if (mSmokeEmitter != NULL) { diff --git a/src/d/d_attention.cpp b/src/d/d_attention.cpp index d0550559a..0a847bfac 100644 --- a/src/d/d_attention.cpp +++ b/src/d/d_attention.cpp @@ -55,7 +55,7 @@ bool dAttDraw_CallBack_c::execute(u16 timing, J3DTransformInfo* xform) { /* 8009D2E0-8009D654 .text __ct__12dAttention_cFP10fopAc_ac_cUl */ dAttention_c::dAttention_c(fopAc_ac_c* i_player, u32 i_padNo) { - mpPlayer = (daPy_lk_c*)i_player; + mpPlayer = i_player; mPadNo = i_padNo; initList(0xFFFFFFFF); mFlagMask = 0; @@ -848,7 +848,7 @@ void dAttention_c::judgementStatusHd(u32 interactMask) { bool dAttention_c::Run(u32 interactMask) { bool var = dComIfGs_getOptAttentionType() == 0; if (chkFlag(AttnFlag_00000080)) { - mpPlayer = (daPy_lk_c*)dComIfGp_getPlayer(0); + mpPlayer = dComIfGp_getPlayer(0); mPadNo = 0; } runDebugDisp0(); diff --git a/src/d/d_com_inf_game.cpp b/src/d/d_com_inf_game.cpp index e9df273e2..9bde2487d 100644 --- a/src/d/d_com_inf_game.cpp +++ b/src/d/d_com_inf_game.cpp @@ -1138,7 +1138,7 @@ void dComIfGs_setGameStartStage() { {true, dSv_event_flag_c::UNK_0801, "MajyuE", 0, 0}, {true, dSv_event_flag_c::UNK_0808, "MajyuE", 0, 18}, {true, dSv_event_flag_c::UNK_2401, "A_umikz", 0, 204}, - {false, 0, "sea", dIsleRoom_OutsetIsland_e, 128}, + {false, 0, "sea", dIsleRoom_OutsetIsland_e, 128}, }; check_data* data_p = l_checkData; diff --git a/src/d/d_event_manager.cpp b/src/d/d_event_manager.cpp index e5c4f33aa..ac2361cf2 100644 --- a/src/d/d_event_manager.cpp +++ b/src/d/d_event_manager.cpp @@ -674,7 +674,7 @@ fopAc_ac_c* dEvent_manager_c::specialCast_Shutter(s16 profName, int flag) { goal.x += cM_ssin(angle) * 100.0f; goal.z += cM_scos(angle) * 100.0f; dComIfGp_evmng_setGoal(&goal); - g_dComIfG_gameInfo.play.getEvent().setPt2(shutter); + g_dComIfG_gameInfo.play.getEvent()->setPt2(shutter); } return shutter;