diff --git a/include/JSystem/JHostIO/JORMContext.h b/include/JSystem/JHostIO/JORMContext.h index b0fe0081863..5bb6cdacc1b 100644 --- a/include/JSystem/JHostIO/JORMContext.h +++ b/include/JSystem/JHostIO/JORMContext.h @@ -27,44 +27,53 @@ #define MCTX_COMMAND_INVALID_NODE (u32)7 #define MCTX_COMMAND_UPDATE_CONTROL (u32)8 +#define JORM_DEFAULT_WIDTH 0x200 +#define JORM_DEFAULT_HEIGHT 0x18 + #define DEFINE_GEN_CHECKBOX(T, kind) \ - void genCheckBox(const char* label, T* pSrc, T mask, u32 style, JOREventListener* pListener, \ - u16 posX, u16 posY, u16 width, u16 height) { \ + void genCheckBox(const char* label, T* pSrc, T mask, u32 style = 0, \ + JOREventListener* pListener = NULL, u16 posX = -1, u16 posY = -1, \ + u16 width = JORM_DEFAULT_WIDTH, u16 height = JORM_DEFAULT_HEIGHT) { \ genCheckBoxSub(kind, label, (uintptr_t)pSrc, style, *pSrc, mask, pListener, posX, posY, \ width, height); \ } #define DEFINE_GEN_CHECKBOX_ID(T, kind) \ - void genCheckBoxID(const char* label, u32 id, T mask, T initValue, u32 style, \ - JOREventListener* pListener, u16 posX, u16 posY, u16 width, u16 height) { \ + void genCheckBoxID(const char* label, u32 id, T mask, T initValue, u32 style = 0, \ + JOREventListener* pListener = NULL, u16 posX = -1, u16 posY = -1, \ + u16 width = JORM_DEFAULT_WIDTH, u16 height = JORM_DEFAULT_HEIGHT) { \ genCheckBoxSub(kind, label, id, style, initValue, mask, pListener, posX, posY, width, \ height); \ } #define DEFINE_GEN_SLIDER(T, kind) \ - void genSlider(const char* label, T* pSrc, T rangeMin, T rangeMax, u32 style, \ - JOREventListener* pListener, u16 posX, u16 posY, u16 width, u16 height) { \ + void genSlider(const char* label, T* pSrc, T rangeMin, T rangeMax, u32 style = 0, \ + JOREventListener* pListener = NULL, u16 posX = -1, u16 posY = -1, \ + u16 width = JORM_DEFAULT_WIDTH, u16 height = JORM_DEFAULT_HEIGHT) { \ genSliderSub(kind, label, (uintptr_t)pSrc, style, *pSrc, rangeMin, rangeMax, pListener, \ posX, posY, width, height); \ } #define DEFINE_GEN_SLIDER_ID(T, kind) \ - void genSliderID(const char* label, u32 id, T data, T rangeMin, T rangeMax, u32 style, \ - JOREventListener* pListener, u16 posX, u16 posY, u16 width, u16 height) { \ + void genSliderID(const char* label, u32 id, T data, T rangeMin, T rangeMax, u32 style = 0, \ + JOREventListener* pListener = NULL, u16 posX = -1, u16 posY = -1, \ + u16 width = JORM_DEFAULT_WIDTH, u16 height = JORM_DEFAULT_HEIGHT) { \ genSliderSub(kind, label, id, style, data, rangeMin, rangeMax, pListener, posX, posY, \ width, height); \ } #define DEFINE_START_COMBO_BOX(T, kind) \ - void startComboBox(const char* label, T* pSrc, u32 style, JOREventListener* pListener, \ - u16 posX, u16 posY, u16 width, u16 height) { \ + void startComboBox(const char* label, T* pSrc, u32 style = 0, \ + JOREventListener* pListener = NULL, u16 posX = -1, u16 posY = -1, \ + u16 width = JORM_DEFAULT_WIDTH, u16 height = JORM_DEFAULT_HEIGHT) { \ startSelectorSub('CMBX', kind, label, (uintptr_t)pSrc, style, *pSrc, pListener, posX, \ posY, width, height); \ } #define DEFINE_START_COMBO_BOX_ID(T, kind) \ - void startComboBoxID(const char* label, u32 id, T data, u32 style, \ - JOREventListener* pListener, u16 posX, u16 posY, u16 width, u16 height) { \ + void startComboBoxID(const char* label, u32 id, T data, u32 style = 0, \ + JOREventListener* pListener = NULL, u16 posX = -1, u16 posY = -1, \ + u16 width = JORM_DEFAULT_WIDTH, u16 height = JORM_DEFAULT_HEIGHT) { \ startSelectorSub('CMBX', kind, label, id, style, data, pListener, posX, posY, width, \ height); \ } @@ -194,17 +203,21 @@ public: void genSelectorItemSub(const char* label, s32 itemNo, u32 param_2, u16 posX, u16 posY, u16 width, u16 height); - void genButton(const char* label, u32 id, u32 style, JOREventListener* pListener, u16 posX, - u16 posY, u16 width, u16 height); + void genButton(const char* label, u32 id, u32 style = 0, JOREventListener* pListener = NULL, + u16 posX = -1, u16 posY = -1, u16 width = JORM_DEFAULT_WIDTH, + u16 height = JORM_DEFAULT_HEIGHT); - void genLabel(const char* label, u32 id, u32 style, JOREventListener* pListener, u16 posX, - u16 posY, u16 width, u16 height); + void genLabel(const char* label, u32 id, u32 style = 0, JOREventListener* pListener = NULL, + u16 posX = -1, u16 posY = -1, u16 width = JORM_DEFAULT_WIDTH, + u16 height = JORM_DEFAULT_HEIGHT); - void genGroupBox(const char* label, u32 id, u32 style, JOREventListener* pListener, u16 posX, - u16 posY, u16 width, u16 height); + void genGroupBox(const char* label, u32 id, u32 style = 0, JOREventListener* pListener = NULL, + u16 posX = -1, u16 posY = -1, u16 width = JORM_DEFAULT_WIDTH, + u16 height = JORM_DEFAULT_HEIGHT); - void genEditBoxID(const char* label, u32 id, const char* string, u16 length, u32 style, - JOREventListener* pListener, u16 posX, u16 posY, u16 width, u16 height); + void genEditBoxID(const char* label, u32 id, const char* string, u16 length, u32 style = 0, + JOREventListener* pListener = NULL, u16 posX = -1, u16 posY = -1, + u16 width = JORM_DEFAULT_WIDTH, u16 height = JORM_DEFAULT_HEIGHT); /** * === CHECKBOX === diff --git a/include/d/actor/d_a_obj_burnbox.h b/include/d/actor/d_a_obj_burnbox.h index fa54a370d20..6083f83939a 100644 --- a/include/d/actor/d_a_obj_burnbox.h +++ b/include/d/actor/d_a_obj_burnbox.h @@ -24,7 +24,7 @@ public: int Draw(); int Delete(); - static void make_prm_burnBox(u32* param_0, u8 param_1) { *param_0 = param_1; } + static void make_prm_burnBox(u32* param_0, u8 param_1) { *param_0 = param_1 & 0xff; } u8 getType() { return fopAcM_GetParamBit(this, 0, 8); } diff --git a/include/d/actor/d_a_obj_movebox.h b/include/d/actor/d_a_obj_movebox.h index 5e3158e8afb..e64436e13dc 100644 --- a/include/d/actor/d_a_obj_movebox.h +++ b/include/d/actor/d_a_obj_movebox.h @@ -1,11 +1,12 @@ #ifndef D_A_OBJ_MOVEBOX_H #define D_A_OBJ_MOVEBOX_H -#include "d/d_com_inf_game.h" #include "d/d_a_obj.h" -#include "f_op/f_op_actor_mng.h" #include "d/d_bg_s_movebg_actor.h" #include "d/d_bg_w.h" +#include "d/d_com_inf_game.h" +#include "f_op/f_op_actor_mng.h" + /** * @ingroup actors-objects @@ -14,228 +15,242 @@ * * @details Multi-purpose moving box actor. * Used for: Goron Mines Push Block, Death Mountain Block, - * Large Wooden Crate, Sacred Grove Block, + * Large Wooden Crate, Sacred Grove Block, * Arbiter's Grounds Block (2 of them), Kakariko Graveyard Gravestone * */ namespace daObjMovebox { - class Hio_c { - public: - class Attr_c { - public: - /* 0x00 */ s16 mFirstPushStopTime; - /* 0x02 */ s16 mRepeatPushStopTime; - /* 0x04 */ s16 mPushMoveTime; - /* 0x06 */ s16 mFirstPullStopTime; - /* 0x08 */ s16 mRepeatPullStopTime; - /* 0x0A */ s16 mPullMoveTime; - /* 0x0C */ f32 mUnitDistance; - /* 0x10 */ f32 mShadowSize; - /* 0x14 */ f32 mGravity; - /* 0x18 */ f32 mViscosityResistance; - /* 0x1C */ f32 mInertiaResistance; - /* 0x20 */ f32 mFallYInitSpeed; - /* 0x24 */ f32 mLandSmokeScale; - /* 0x28 */ f32 mBuoyancy; - /* 0x2C */ f32 mPlayerGravity; - /* 0x30 */ f32 mMiscGravity; - /* 0x34 */ f32 mWaterOscillationAccel; - /* 0x38 */ s16 mWaterOscillationAngleSpeed; - /* 0x3C */ f32 mWaterViscoscityResistance; - /* 0x40 */ f32 mWaterInertiaResistance; - /* 0x44 */ f32 mPlayerTiltPower; - /* 0x48 */ f32 mMiscTiltPower; - /* 0x4C */ f32 mMaxTiltPower; - /* 0x50 */ f32 mTiltSpringFactor; - /* 0x54 */ f32 mTiltViscoscityResistance; - /* 0x58 */ int field_0x58; - /* 0x5C */ int field_0x5c; - /* 0x60 */ u32 field_0x60; - /* 0x64 */ f32 field_0x64; - /* 0x68 */ f32 field_0x68; - /* 0x6C */ f32 field_0x6c; - /* 0x70 */ f32 field_0x70; - /* 0x74 */ f32 field_0x74; - /* 0x78 */ f32 field_0x78; - /* 0x7C */ u32 field_0x7c; - /* 0x80 */ u32 field_0x80; - /* 0x84 */ u32 field_0x84; - /* 0x88 */ u32 field_0x88; - /* 0x8C */ int field_0x8c; - /* 0x90 */ s16 field_0x90; - /* 0x92 */ s16 field_0x92; - /* 0x94 */ s16 field_0x94; - /* 0x96 */ s16 field_0x96; - /* 0x98 */ s16 field_0x98; - /* 0x9A */ s16 field_0x9a; - /* 0x9C */ u8 field_0x9c; - /* 0x9D */ u8 field_0x9d; - /* 0x9E */ u8 field_0x9e; - }; - }; - - class BgcSrc_c { - public: - /* 0x0 */ f32 field_0x0; - /* 0x4 */ f32 field_0x4; - /* 0x8 */ f32 field_0x8; - /* 0xC */ f32 field_0xc; - }; - - class Act_c; - - class Bgc_c { - public: - enum State_e { - STATE_0_e = 0x0, - STATE_1_e = 0x1, - STATE_2_e = 0x2, - STATE_4_e = 0x4, - STATE_8_e = 0x8, - STATE_10_e = 0x10, - STATE_20_e = 0x20, - STATE_40_e = 0x40, - }; - - Bgc_c(); - void gnd_pos(daObjMovebox::Act_c const*, daObjMovebox::BgcSrc_c const*, int, - f32); - void wrt_pos(cXyz const&); - void wall_pos(daObjMovebox::Act_c const*, daObjMovebox::BgcSrc_c const*, int, - s16, f32); - void proc_vertical(daObjMovebox::Act_c*); - bool chk_wall_pre(daObjMovebox::Act_c const*, daObjMovebox::BgcSrc_c const*, - int, s16); - bool chk_wall_touch(daObjMovebox::Act_c const*, - daObjMovebox::BgcSrc_c const*, s16); - bool chk_wall_touch2(daObjMovebox::Act_c const*, - daObjMovebox::BgcSrc_c const*, int, s16); - - static const daObjMovebox::BgcSrc_c M_lin5[]; - static const daObjMovebox::BgcSrc_c M_lin20[]; - - static dBgS_ObjGndChk M_gnd_work[23]; - static dBgS_WtrChk M_wrt_work; - static dBgS_ObjLinChk M_wall_work[23]; - - /* 0x000 */ f32 field_0x0[23]; - /* 0x05C */ int field_0x5c; - /* 0x060 */ f32 field_0x60; - /* 0x064 */ cXyz field_0x64[23]; - /* 0x178 */ int field_0x178; - /* 0x17C */ f32 field_0x17c; - /* 0x180 */ State_e mState; - }; - - class Act_c : public dBgS_MoveBgActor { - public: - enum Prm_e { - PRM_4_e = 0x4, - PRM_8_e = 0x8, - PRM_18_e = 0x18, - PRM_1C_e = 0x1C, - }; - - int prm_get_swSave1() const; - void prmZ_init(); - void prmX_init(); - const daObjMovebox::Hio_c::Attr_c& attr() const; - void set_mtx(); - void init_mtx(); - void path_init(); - void path_save(); - static void RideCallBack(dBgW*, fopAc_ac_c*, fopAc_ac_c*); - static fopAc_ac_c* PPCallBack(fopAc_ac_c*, fopAc_ac_c*, s16, dBgW_Base::PushPullLabel); - void afl_sway(); - int check_to_walk(); - void clr_moment_cnt(); - bool chk_appear() const; - void eff_smoke_slip_start(); - void mode_wait_init(); - void mode_wait(); - void mode_walk_init(); - void mode_walk(); - void mode_afl_init(); - void mode_afl(); - void sound_slip(); - void sound_limit(); - void sound_land(); - void vib_land(); - void eff_land_smoke(); - - virtual int CreateHeap(); - virtual int Create(); - virtual int Execute(Mtx**); - virtual int Draw(); - virtual int Delete(); - - inline void mode_proc_call(); - inline int Mthd_Create(); - inline int Mthd_Delete(); - - // some functions need an inlined version of `attr`, find better fix later - const daObjMovebox::Hio_c::Attr_c& i_attr() const { return M_attr[mType]; } - - int prm_get_swSave() const { return daObj::PrmAbstract(this, PRM_8_e, PRM_8_e); } - int prmZ_get_swSave2() const { return (u8)(mPrmZ >> 8); } - int prm_get_dmy() const { return 0; } - int prmZ_get_pathId() const { return mPrmZ & 0xFF; } - u8 prm_get_answer() const { return daObj::PrmAbstract(this, PRM_4_e, PRM_1C_e); } - int prm_get_type() const { return daObj::PrmAbstract(this, PRM_4_e, PRM_18_e); } - - int is_switch1() const { return fopAcM_isSwitch(this, prm_get_swSave1()) != 0; } - int is_switch2() const { return fopAcM_isSwitch(this, prmZ_get_swSave2()) != 0; } - - void on_switch1() const { fopAcM_onSwitch(this, prm_get_swSave1()); } - void on_switch2() const { fopAcM_onSwitch(this, prmZ_get_swSave2()); } - void off_switch1() const { fopAcM_offSwitch(this, prm_get_swSave1()); } - void off_switch2() const { fopAcM_offSwitch(this, prmZ_get_swSave2()); } - - int getType() { return prm_get_type(); } - - static const s16 M_dir_base[4]; - static const char* const M_arcname[8]; - static const dCcD_SrcCyl M_cyl_src; - static const daObjMovebox::Hio_c::Attr_c M_attr[8]; - - /* 0x5A0 */ request_of_phase_process_class mPhase; - /* 0x5A8 */ J3DModel* mpModel; - /* 0x5AC */ int field_0x5ac; - /* 0x5B0 */ dCcD_Stts mCcStts; - /* 0x5EC */ dCcD_Cyl mCcCyl; - /* 0x728 */ Bgc_c mBgc; - /* 0x8AC */ int mType; - /* 0x8B0 */ u16 mPrmZ; - /* 0x8B2 */ u16 mPrmX; - /* 0x8B4 */ dPath* mpPath; - /* 0x8B8 */ s16 field_0x8b8; - /* 0x8BC */ f32 field_0x8bc; - /* 0x8C0 */ f32 field_0x8c0; - /* 0x8C4 */ f32 field_0x8c4; - /* 0x8C8 */ f32 field_0x8c8; - /* 0x8CC */ f32 field_0x8cc; - /* 0x8D0 */ f32 field_0x8d0; - /* 0x8D4 */ f32 field_0x8d4; - /* 0x8D8 */ f32 field_0x8d8; - /* 0x8DC */ int field_0x8dc; - /* 0x8E0 */ int field_0x8e0; - /* 0x8E4 */ f32 field_0x8e4; - /* 0x8E8 */ int field_0x8e8; - /* 0x8EC */ dBgW::PushPullLabel mPPLabel; - /* 0x8F0 */ s16 field_0x8f0[4]; - /* 0x8F8 */ s16 field_0x8f8; - /* 0x8FA */ s16 field_0x8fa; - /* 0x8FC */ s16 field_0x8fc; - /* 0x8FE */ u8 field_0x8fe; - /* 0x8FF */ s8 mReverb; - /* 0x900 */ u8 field_0x900; - /* 0x901 */ u8 field_0x901; - /* 0x902 */ u8 field_0x902; - /* 0x904 */ int field_0x904; - /* 0x908 */ s8 field_0x908; + +enum Type_e { pp_field = 3 }; + +struct Attr_c { + struct sMinMax { // fabricated + s16 min; + s16 max; }; + /* 0x00 */ s16 mFirstPushStopTime; + /* 0x02 */ s16 mRepeatPushStopTime; + /* 0x04 */ s16 mPushMoveTime; + /* 0x06 */ s16 mFirstPullStopTime; + /* 0x08 */ s16 mRepeatPullStopTime; + /* 0x0A */ s16 mPullMoveTime; + /* 0x0C */ f32 mUnitDistance; + /* 0x10 */ f32 mShadowSize; + /* 0x14 */ f32 mGravity; + /* 0x18 */ f32 mViscosityResistance; + /* 0x1C */ f32 mInertiaResistance; + /* 0x20 */ f32 mFallYInitSpeed; + /* 0x24 */ f32 mLandSmokeScale; + /* 0x28 */ f32 mBuoyancy; + /* 0x2C */ f32 mPlayerGravity; + /* 0x30 */ f32 mMiscGravity; + /* 0x34 */ f32 mWaterOscillationAccel; + /* 0x38 */ s16 mWaterOscillationAngleSpeed; + /* 0x3C */ f32 mWaterViscoscityResistance; + /* 0x40 */ f32 mWaterInertiaResistance; + /* 0x44 */ f32 mPlayerTiltPower; + /* 0x48 */ f32 mMiscTiltPower; + /* 0x4C */ f32 mMaxTiltPower; + /* 0x50 */ f32 mTiltSpringFactor; + /* 0x54 */ f32 mTiltViscoscityResistance; + /* 0x58 */ int field_0x58; + /* 0x5C */ int field_0x5c; + /* 0x60 */ u32 field_0x60; + /* 0x64 */ f32 field_0x64; + /* 0x68 */ f32 field_0x68; + /* 0x6C */ f32 field_0x6c; + /* 0x70 */ f32 field_0x70; + /* 0x74 */ f32 field_0x74; + /* 0x78 */ f32 field_0x78; + /* 0x7C */ u32 field_0x7c; + /* 0x80 */ u32 field_0x80; + /* 0x84 */ u32 field_0x84; + /* 0x88 */ u32 field_0x88; + /* 0x8C */ int field_0x8c; + /* 0x90 */ sMinMax mCullX; + /* 0x94 */ sMinMax mCullY; + /* 0x98 */ sMinMax mCullZ; + /* 0x9C */ u8 field_0x9c; + /* 0x9D */ u8 field_0x9d; + /* 0x9E */ u8 field_0x9e; }; +struct Hio_c : JORReflexible { + Hio_c(daObjMovebox::Type_e); + void default_set(); + void ct(); + void dt(); + void genMessage(JORMContext*); + + static u8 M_flag_bgc[8]; + static const char* const M_name[]; + + /* 0x4 */ Type_e mType; + /* 0x8 */ int mCount; + /* 0xC */ daObjMovebox::Attr_c mAttr; +}; + +struct BgcSrc_c { + /* 0x0 */ f32 field_0x0; + /* 0x4 */ f32 field_0x4; + /* 0x8 */ f32 field_0x8; + /* 0xC */ f32 field_0xc; +}; + +class Act_c; + +struct Bgc_c { + enum State_e { + STATE_0_e = 0x0, + STATE_1_e = 0x1, + STATE_2_e = 0x2, + STATE_4_e = 0x4, + STATE_8_e = 0x8, + STATE_10_e = 0x10, + STATE_20_e = 0x20, + STATE_40_e = 0x40, + }; + + Bgc_c(); + void gnd_pos(daObjMovebox::Act_c const*, daObjMovebox::BgcSrc_c const*, int, f32); + void wrt_pos(cXyz const&); + void wall_pos(daObjMovebox::Act_c const*, daObjMovebox::BgcSrc_c const*, int, s16, f32); + void proc_vertical(daObjMovebox::Act_c*); + bool chk_wall_pre(daObjMovebox::Act_c const*, daObjMovebox::BgcSrc_c const*, int, s16); + bool chk_wall_touch(daObjMovebox::Act_c const*, daObjMovebox::BgcSrc_c const*, s16); + bool chk_wall_touch2(daObjMovebox::Act_c const*, daObjMovebox::BgcSrc_c const*, int, s16); + + static const daObjMovebox::BgcSrc_c M_lin5[]; + static const daObjMovebox::BgcSrc_c M_lin20[]; + + static dBgS_ObjGndChk M_gnd_work[23]; + static dBgS_WtrChk M_wrt_work; + static dBgS_ObjLinChk M_wall_work[23]; + + /* 0x000 */ f32 field_0x0[23]; + /* 0x05C */ int field_0x5c; + /* 0x060 */ f32 field_0x60; + /* 0x064 */ cXyz field_0x64[23]; + /* 0x178 */ int field_0x178; + /* 0x17C */ f32 field_0x17c; + /* 0x180 */ State_e mState; +#if DEBUG + /* 0x184 */ cXyz field_0x184[92]; + /* 0x184 */ cXyz field_0x5D4[92]; + /* 0xA24 */ int field_0xA24; + /* 0xA28 */ int field_0xA28; +#endif +}; + +struct Act_c : public dBgS_MoveBgActor { + enum Prm_e { + PRM_4_e = 0x4, + PRM_8_e = 0x8, + PRM_18_e = 0x18, + PRM_1C_e = 0x1C, + }; + + int prm_get_swSave1() const; + void prmZ_init(); + void prmX_init(); + const daObjMovebox::Attr_c& attr() const; + void set_mtx(); + void init_mtx(); + void path_init(); + void path_save(); + static void RideCallBack(dBgW*, fopAc_ac_c*, fopAc_ac_c*); + static fopAc_ac_c* PPCallBack(fopAc_ac_c*, fopAc_ac_c*, s16, dBgW_Base::PushPullLabel); + void afl_sway(); + int check_to_walk(); + void clr_moment_cnt(); + bool chk_appear() const; + void eff_smoke_slip_start(); + void mode_wait_init(); + void mode_wait(); + void mode_walk_init(); + void mode_walk(); + void mode_afl_init(); + void mode_afl(); + void sound_slip(); + void sound_limit(); + void sound_land(); + void vib_land(); + void eff_land_smoke(); + + virtual int CreateHeap(); + virtual int Create(); + virtual int Execute(Mtx**); + virtual int Draw(); + virtual int Delete(); + + inline void mode_proc_call(); + inline int Mthd_Create(); + inline int Mthd_Delete(); + + int prm_get_swSave() const { return daObj::PrmAbstract(this, PRM_8_e, PRM_8_e); } + int prmZ_get_swSave2() const { return (u8)(mPrmZ >> 8); } + int prm_get_dmy() const { return 0; } + int prmZ_get_pathId() const { return mPrmZ & 0xFF; } + u8 prm_get_answer() const { return daObj::PrmAbstract(this, PRM_4_e, PRM_1C_e); } + int prm_get_type() const { return daObj::PrmAbstract(this, PRM_4_e, PRM_18_e); } + + bool is_switch1() const { return fopAcM_isSwitch(this, prm_get_swSave1()); } + int is_switch2() const { return fopAcM_isSwitch(this, prmZ_get_swSave2()) != 0; } + + void on_switch1() const { fopAcM_onSwitch(this, prm_get_swSave1()); } + void on_switch2() const { fopAcM_onSwitch(this, prmZ_get_swSave2()); } + void off_switch1() const { fopAcM_offSwitch(this, prm_get_swSave1()); } + void off_switch2() const { fopAcM_offSwitch(this, prmZ_get_swSave2()); } + + int getType() { return prm_get_type(); } + + static const s16 M_dir_base[4]; + static const char* const M_arcname[8]; + static const dCcD_SrcCyl M_cyl_src; + + static const daObjMovebox::Attr_c M_attr[8]; + + /* 0x5A0 */ request_of_phase_process_class mPhase; + /* 0x5A8 */ J3DModel* mpModel; + /* 0x5AC */ int field_0x5ac; + /* 0x5B0 */ dCcD_Stts mCcStts; + /* 0x5EC */ dCcD_Cyl mCcCyl; + /* 0x728 */ Bgc_c mBgc; + /* 0x8AC */ int mType; + /* 0x8B0 */ u16 mPrmZ; + /* 0x8B2 */ u16 mPrmX; + /* 0x8B4 */ dPath* mpPath; + /* 0x8B8 */ s16 field_0x8b8; + /* 0x8BC */ f32 field_0x8bc; + /* 0x8C0 */ f32 field_0x8c0; + /* 0x8C4 */ f32 field_0x8c4; + /* 0x8C8 */ f32 field_0x8c8; + /* 0x8CC */ f32 field_0x8cc; + /* 0x8D0 */ f32 field_0x8d0; + /* 0x8D4 */ f32 field_0x8d4; + /* 0x8D8 */ f32 field_0x8d8; + /* 0x8DC */ int field_0x8dc; + /* 0x8E0 */ int field_0x8e0; + /* 0x8E4 */ f32 field_0x8e4; + /* 0x8E8 */ int field_0x8e8; + /* 0x8EC */ dBgW::PushPullLabel mPPLabel; + /* 0x8F0 */ s16 field_0x8f0[4]; + /* 0x8F8 */ s16 field_0x8f8; + /* 0x8FA */ s16 field_0x8fa; + /* 0x8FC */ s16 field_0x8fc; + /* 0x8FE */ u8 field_0x8fe; + /* 0x8FF */ s8 mReverb; + /* 0x900 */ u8 field_0x900; + /* 0x901 */ u8 field_0x901; + /* 0x902 */ u8 field_0x902; + /* 0x904 */ int field_0x904; + /* 0x908 */ s8 field_0x908; +#if DEBUG + static daObjMovebox::Hio_c M_hio[]; +#endif +}; +}; // namespace daObjMovebox + STATIC_ASSERT(sizeof(daObjMovebox::Act_c) == 0x90C); #endif /* D_A_OBJ_MOVEBOX_H */ diff --git a/include/d/d_bg_s.h b/include/d/d_bg_s.h index 082723a8285..2ce64932606 100644 --- a/include/d/d_bg_s.h +++ b/include/d/d_bg_s.h @@ -150,6 +150,7 @@ public: bool WaterChk(dBgS_SplGrpChk* chk) { return SplGrpChk(chk); } u32 GetMtrlSndId(const cBgS_PolyInfo& param_0) { return dKy_pol_sound_get(¶m_0); } void DebugDrawPoly(dBgW_Base *param_1) {} + void DebugDrawPoly(dBgW_Base const& param_1) {} fopAc_ac_c* GetActorPointer(cBgS_PolyInfo const& param_0) const { return cBgS::GetActorPointer(param_0); } bool LineCross(cBgS_LinChk* i_linChk) { #if DEBUG diff --git a/include/d/d_bg_s_movebg_actor.h b/include/d/d_bg_s_movebg_actor.h index f419ec7e412..be09052ee52 100644 --- a/include/d/d_bg_s_movebg_actor.h +++ b/include/d/d_bg_s_movebg_actor.h @@ -21,7 +21,10 @@ public: int MoveBGExecute(); int MoveBGDraw() { return Draw(); } - int MoveBGIsDelete() { return IsDelete(); } + int MoveBGIsDelete() { + BOOL b = IsDelete(); + return b; + } virtual int CreateHeap(); virtual int Create(); diff --git a/src/d/actor/d_a_obj_movebox.cpp b/src/d/actor/d_a_obj_movebox.cpp index 326ad20996c..64e91865ef2 100644 --- a/src/d/actor/d_a_obj_movebox.cpp +++ b/src/d/actor/d_a_obj_movebox.cpp @@ -1,17 +1,40 @@ /** -* @file d_a_obj_movebox.cpp + * @file d_a_obj_movebox.cpp * */ -#include "d/dolzel_rel.h" // IWYU pragma: keep +#include "d/dolzel_rel.h" // IWYU pragma: keep -#include "d/actor/d_a_obj_movebox.h" +#if DEBUG +#include "d/d_debug_viewer.h" +#endif +#include "SSystem/SComponent/c_counter.h" #include "SSystem/SComponent/c_math.h" #include "Z2AudioLib/Z2Instances.h" -#include "d/actor/d_a_player.h" -#include "d/d_path.h" #include "d/actor/d_a_obj_burnbox.h" #include "d/actor/d_a_obj_eff.h" +#include "d/actor/d_a_obj_movebox.h" +#include "d/actor/d_a_player.h" +#include "d/d_path.h" + +#define ATTR_F32(x) (*((f32*)&attr().x)) +#define ATTR_S16(x) (*((s16*)&attr().x)) +// There are a lot of attr() problems in debug, +// they seem to be fixed by casting, like `((daObjMovebox::Attr_c*)&attr())->field` +// but sometimes breaks in release + +#if DEBUG +const char* const daObjMovebox::Hio_c::M_name[8] = { + "押引・木・1.5m", // Push-pull type, wood, 1.5m + "押引・石・1.5m", // Push/Pull/Stone/1.5m + "デスマウンテン用・2.0m", // For Death Mountain - 2.0m + "聖なる森用・3.0m", // For the sacred forest - 3.0m + "押引・Lv4・3.0m", // Push/Pull/Lv4/3.0m + "押引・Lv4・1.5m", // Push/Pull/Lv4/1.5m + "押し引き墓", // Push-pull grave + "dummy4", +}; +#endif const daObjMovebox::BgcSrc_c daObjMovebox::Bgc_c::M_lin5[] = { {0.0f, 0.0f, 0.0f, 0.0f}, {-0.5f, -0.5f, 1.0f, 1.0f}, {0.5f, -0.5f, -1.0f, 1.0f}, @@ -42,6 +65,76 @@ daObjMovebox::Bgc_c::Bgc_c() { mState = STATE_0_e; } + +#if DEBUG +namespace daObjMovebox { + namespace { + static cXyz L_wall_start[8][23]; + static cXyz L_wall_end[8][23]; + static u8 L_wall_flag[8][23]; + static cXyz L_gnd_start[8][23]; + static u8 L_gnd_flag[8][23]; + } +} + +u8 daObjMovebox::Hio_c::M_flag_bgc[8]; +daObjMovebox::Hio_c::Hio_c(daObjMovebox::Type_e type) { + mCount = 0; + mType = type; + default_set(); +} + +void daObjMovebox::Hio_c::default_set() { + mAttr = Act_c::M_attr[mType]; +} + +void daObjMovebox::Hio_c::ct() { + if (mCount++ == 0) { + daObj::HioVarious_c::init(this, M_name[mType]); + } +} + +void daObjMovebox::Hio_c::dt() { + if (--mCount == 0) { + daObj::HioVarious_c::clean(this); + } +} + +void daObjMovebox::Hio_c::genMessage(JORMContext* context) { + context->genLabel("§ 押引パラメータ設定 §\n", 0); + context->genCheckBox("bgc", &M_flag_bgc[mType], 1); + context->genLabel("\n【地表】", 1); + context->genSlider("押し停止時間初回", &mAttr.mFirstPushStopTime, 0, 100); + context->genSlider("押し停止時間連続", &mAttr.mRepeatPushStopTime, 0, 100); + context->genSlider("押し移動時間", &mAttr.mPushMoveTime, 0, 100); + context->genSlider("引き停止時間初回", &mAttr.mFirstPullStopTime, 0, 100); + context->genSlider("引き停止時間連続", &mAttr.mRepeatPullStopTime, 0, 100); + context->genSlider("引き移動時間", &mAttr.mPullMoveTime, 0, 100); + context->genSlider("ユニット距離", &mAttr.mUnitDistance, 0.0f, 300.0f); + context->genSlider("影サイズ", &mAttr.mShadowSize, 0.0f, 300.0f); + context->genLabel("\n【空中】", 2); + context->genSlider("重力", &mAttr.mGravity, -40.0f, 0.0f); + context->genSlider("粘性抵抗", &mAttr.mViscosityResistance, 0.0f, 0.05f); + context->genSlider("慣性抵抗", &mAttr.mInertiaResistance, 0.0f, 0.01f); + context->genSlider("落下Y初速", &mAttr.mFallYInitSpeed, 0.0f, 100.0f); + context->genSlider("着地煙スケール", &mAttr.mLandSmokeScale, 0.0f, 10.0f); + context->genLabel("\n【水中】", 3); + context->genSlider("浮力", &mAttr.mBuoyancy, 0.0f, 20.0f); + context->genSlider("プレイヤ重力", &mAttr.mPlayerGravity, -5.0f, 0.0f); + context->genSlider("その他重力", &mAttr.mMiscGravity, -5.0f, 0.0f); + context->genSlider("上下揺加速振幅", &mAttr.mWaterOscillationAccel, 0.0f, 2.0f); + context->genSlider("上下揺角速度", &mAttr.mWaterOscillationAngleSpeed, 0, 0x4000); + context->genSlider("粘性抵抗", &mAttr.mWaterViscoscityResistance, 0.0f, 0.2f); + context->genSlider("慣性抵抗", &mAttr.mWaterInertiaResistance, 0.0f, 0.1f); + context->genSlider("プレイヤ傾斜パワー", &mAttr.mPlayerTiltPower, 0.0f, 0.5f); + context->genSlider("その他傾斜パワー", &mAttr.mMiscTiltPower, 0.0f, 0.5f); + context->genSlider("最大傾斜パワー", &mAttr.mMaxTiltPower, 0.0f, 0.5f); + context->genSlider("傾斜ばね係数", &mAttr.mTiltSpringFactor, 0.0f, 0.1f); + context->genSlider("傾斜粘性抵抗", &mAttr.mTiltViscoscityResistance, 0.0f, 0.2f); +} + +#endif + dBgS_ObjGndChk daObjMovebox::Bgc_c::M_gnd_work[23]; void daObjMovebox::Bgc_c::gnd_pos(const daObjMovebox::Act_c* i_actor, @@ -63,7 +156,10 @@ void daObjMovebox::Bgc_c::gnd_pos(const daObjMovebox::Act_c* i_actor, M_gnd_work[i].SetPos(&sp5C); M_gnd_work[i].SetActorPid(i_actor->base.base.id); field_0x0[i] = dComIfG_Bgsp().GroundCross(&M_gnd_work[i]); - +#if DEBUG + L_gnd_start[i_actor->mType][i].set(sp50); + L_gnd_flag[i_actor->mType][i] = 1; +#endif if (field_0x0[i] > var_f31) { fopAc_ac_c* bg_actor = dComIfG_Bgsp().GetActorPointer(M_gnd_work[i]); if (bg_actor == NULL || fopAcM_GetName(bg_actor) != PROC_Obj_Movebox || @@ -78,6 +174,7 @@ void daObjMovebox::Bgc_c::gnd_pos(const daObjMovebox::Act_c* i_actor, dBgS_WtrChk daObjMovebox::Bgc_c::M_wrt_work; + void daObjMovebox::Bgc_c::wrt_pos(cXyz const& param_0) { cXyz sp28(param_0); @@ -98,6 +195,7 @@ void daObjMovebox::Bgc_c::wrt_pos(cXyz const& param_0) { dBgS_ObjLinChk daObjMovebox::Bgc_c::M_wall_work[23]; + void daObjMovebox::Bgc_c::wall_pos(daObjMovebox::Act_c const* i_actor, daObjMovebox::BgcSrc_c const* i_bgcSrc, int i_num, s16 param_3, f32 param_4) { @@ -124,7 +222,8 @@ void daObjMovebox::Bgc_c::wall_pos(daObjMovebox::Act_c const* i_actor, mDoMtx_stack_c::YrotS(sp8C); mDoMtx_stack_c::transM(sp60); - mDoMtx_stack_c::scaleM(i_actor->attr().field_0x70, i_actor->attr().field_0x64, + mDoMtx_stack_c::scaleM(i_actor->attr().field_0x70, + i_actor->attr().field_0x64, i_actor->attr().field_0x70); mDoMtx_stack_c::transM(0.0f, 0.5f, 0.0f); mDoMtx_stack_c::XrotM(0x4000); @@ -136,7 +235,10 @@ void daObjMovebox::Bgc_c::wall_pos(daObjMovebox::Act_c const* i_actor, M_wall_work[i].Set(&sp48, &sp54, i_actor); M_wall_work[i].SetActorPid(i_actor->base.base.id); - +#if DEBUG + L_wall_start[i_actor->mType][i].set(sp48); + L_wall_end[i_actor->mType][i].set(sp54); +#endif if (dComIfG_Bgsp().LineCross(&M_wall_work[i])) { field_0x64[i] = M_wall_work[i].GetCross(); @@ -145,6 +247,9 @@ void daObjMovebox::Bgc_c::wall_pos(daObjMovebox::Act_c const* i_actor, field_0x17c = var_f31; field_0x178 = i; } +#if DEBUG + L_wall_flag[i_actor->mType][i] = 1; +#endif } else { field_0x64[i] = cXyz::Zero; } @@ -152,13 +257,12 @@ void daObjMovebox::Bgc_c::wall_pos(daObjMovebox::Act_c const* i_actor, } void daObjMovebox::Bgc_c::proc_vertical(daObjMovebox::Act_c* i_actor) { + enum {e_21 = 21, e_5 = 5}; State_e var_r29 = mState; mState = STATE_0_e; - int check_num = i_actor->attr().field_0x9e ? 21 : 5; - const BgcSrc_c* pbgc = i_actor->attr().field_0x9e ? M_lin20 : M_lin5; - - gnd_pos(i_actor, pbgc, check_num, 100.0f); + gnd_pos(i_actor, i_actor->attr().field_0x9e ? M_lin20 : M_lin5, + i_actor->attr().field_0x9e ? 21 : 5, 100.0f); if (field_0x5c >= 0 && field_0x0[field_0x5c] > i_actor->current.pos.y) { i_actor->current.pos.y = field_0x0[field_0x5c]; @@ -222,7 +326,9 @@ bool daObjMovebox::Bgc_c::chk_wall_touch(daObjMovebox::Act_c const* i_actor, mDoMtx_stack_c::YrotS(sp8C); mDoMtx_stack_c::transM(sp5C); - mDoMtx_stack_c::scaleM(i_actor->attr().field_0x70, i_actor->attr().field_0x64, + + mDoMtx_stack_c::scaleM(i_actor->attr().field_0x70, + i_actor->attr().field_0x64, i_actor->attr().field_0x70); mDoMtx_stack_c::transM(0.0f, 0.5f, 0.0f); mDoMtx_stack_c::XrotM(0x4000); @@ -233,16 +339,43 @@ bool daObjMovebox::Bgc_c::chk_wall_touch(daObjMovebox::Act_c const* i_actor, sp44 = sp38 + sp68; touch_work.SetActorPid(i_actor->base.base.id); + +#if DEBUG + if (field_0xA28 != g_Counter.mCounter0) { + field_0xA28 = g_Counter.mCounter0; + field_0xA24 = 0; + } + field_0x184[field_0xA24].set(sp38); + field_0x5D4[field_0xA24].set(sp44); + field_0xA24++; +#endif + touch_work.Set(&sp38, &sp44, i_actor); return dComIfG_Bgsp().LineCross(&touch_work); } +#if DEBUG + +daObjMovebox::Hio_c daObjMovebox::Act_c::M_hio[] = { + daObjMovebox::Hio_c((daObjMovebox::Type_e)0), + daObjMovebox::Hio_c((daObjMovebox::Type_e)1), + daObjMovebox::Hio_c((daObjMovebox::Type_e)2), + daObjMovebox::Hio_c((daObjMovebox::Type_e)3), + daObjMovebox::Hio_c((daObjMovebox::Type_e)4), + daObjMovebox::Hio_c((daObjMovebox::Type_e)5), + daObjMovebox::Hio_c((daObjMovebox::Type_e)6), + daObjMovebox::Hio_c((daObjMovebox::Type_e)7), +}; + +#endif + bool daObjMovebox::Bgc_c::chk_wall_touch2(daObjMovebox::Act_c const* i_actor, daObjMovebox::BgcSrc_c const* i_bgcSrc, int i_num, s16 param_3) { bool chk = false; for (int i = 0; i < i_num; i++) { - if (chk_wall_touch(i_actor, &i_bgcSrc[i], param_3)) { + const daObjMovebox::BgcSrc_c *p = &i_bgcSrc[i]; + if (chk_wall_touch(i_actor, p, param_3)) { chk = true; break; } @@ -301,73 +434,78 @@ const dCcD_SrcCyl daObjMovebox::Act_c::M_cyl_src = { } // mCyl }; -const daObjMovebox::Hio_c::Attr_c daObjMovebox::Act_c::M_attr[8] = { +// __declspec(section ".rodata") +const daObjMovebox::Attr_c daObjMovebox::Act_c::M_attr[8] = { { - 0x6, 0xE, 0xA, 0x6, 0xE, 0xA, 75.0f, 90.0f, -3.0f, - 0.005f, 0.001f, 0.0f, 1.8f, 3.9f, -0.39f, -0.2f, 0.02f, 0x3E8, - 0.04f, 0.013f, 0.15f, 0.1f, 0.1f, 0.06f, 0.075f, 4, 7, - 0xC00, 150.0f, 150.0f, 0.0066666668f, 150.0f, 0.0066666668f, 150.0f, 0x8013C, 0x8013D, - 0x80151, 0x8002A, 0x8002D, 0xFFA6, 0xFFFF, 0xFFA6, 0x5A, 0x97, 0x5A, - 0, 0, 0, + 0x6, 0xE, 0xA, 0x6, 0xE, 0xA, 75.0f, 90.0f, + -3.0f, 0.005f, 0.001f, 0.0f, 1.8f, 3.9f, -0.39f, -0.2f, + 0.02f, 1000, 0.04f, 0.013f, 0.15f, 0.1f, 0.1f, 0.06f, + 0.075f, 4, 7, 0xC00, 150.0f, 150.0f, 0.0066666668f, 150.0f, + 0.0066666668f, 150.0f, 0x8013C, 0x8013D, 0x80151, 0x8002A, 0x8002D, {-90, -1}, + {-90, 90}, {151, 90}, 0, 0, 0, }, { - 0x8, 0x13, 0xD, 0x8, 0x13, 0xD, 75.0f, 90.0f, -5.0f, - 0.005f, 0.001f, 0.0f, 1.8f, 4.5f, -0.5f, -0.2f, 0.02f, 0x3E8, - 0.04f, 0.013f, 0.15f, 0.1f, 0.1f, 0.06f, 0.075f, 4, 7, - 0xC00, 150.0f, 150.0f, 0.0066666668f, 150.0f, 0.0066666668f, 150.0f, 0x20038, 0x20039, - 0x8002F, 0x8002B, 0x8002E, 0xFFA6, 0xFFFF, 0xFFA6, 0x5A, 0x97, 0x5A, - 0, 0, 0, + 0x8, 0x13, 0xD, 0x8, 0x13, 0xD, 75.0f, 90.0f, + -5.0f, 0.005f, 0.001f, 0.0f, 1.8f, 4.5f, -0.5f, -0.2f, + 0.02f, 1000, 0.04f, 0.013f, 0.15f, 0.1f, 0.1f, 0.06f, + 0.075f, 4, 7, 0xC00, 150.0f, 150.0f, 0.0066666668f, 150.0f, + 0.0066666668f, 150.0f, 0x20038, 0x20039, 0x8002F, 0x8002B, 0x8002E, {-90, -1}, + {-90, 90}, {151, 90}, 0, 0, 0, }, { - 0x8, 0x13, 0xD, 0x8, 0x13, 0xD, 50.0f, 110.0f, -5.0f, 0.005f, - 0.001f, 0.0f, 1.8f, 4.5f, -0.5f, -0.2f, 0.02f, 0x3E8, 0.04f, 0.013f, - 0.15f, 0.1f, 0.1f, 0.06f, 0.075f, 4, 7, 0x1000, 200.0f, 200.0f, - 0.005f, 200.0f, 0.005f, 200.0f, 0x80154, 0x80155, 0x8002F, 0x8002B, 0x8002E, 0xFF92, - 0xFFFF, 0xFF92, 0x6E, 0xD2, 0x6E, 0, 1, 0, + 0x8, 0x13, 0xD, 0x8, 0x13, 0xD, 50.0f, 110.0f, -5.0f, + 0.005f, 0.001f, 0.0f, 1.8f, 4.5f, -0.5f, -0.2f, 0.02f, 1000, + 0.04f, 0.013f, 0.15f, 0.1f, 0.1f, 0.06f, 0.075f, 4, 7, + 0x1000, 200.0f, 200.0f, 0.005f, 200.0f, 0.005f, 200.0f, 0x80154, 0x80155, + 0x8002F, 0x8002B, 0x8002E, {-110, -1}, {-110, 110}, {210, 110}, 0, 1, 0, }, { - 0x8, 0x13, 0xD, 0x8, 0x13, 0xD, 75.0f, 180.0f, -5.0f, - 0.005f, 0.001f, 0.0f, 1.8f, 4.5f, -0.5f, -0.2f, 0.02f, 0x3E8, - 0.04f, 0.013f, 0.15f, 0.1f, 0.1f, 0.06f, 0.075f, 4, 7, - 0xC00, 300.0f, 300.0f, 0.0033333334f, 300.0f, 0.0033333334f, 300.0f, 0x20038, 0x20039, - 0x8002F, 0x8002B, 0x8002E, 0xFF4C, 0xFFFF, 0xFF4C, 0xB4, 0x136, 0xB4, - 0, 0, 0, + 0x8, 0x13, 0xD, 0x8, 0x13, 0xD, 75.0f, 180.0f, + -5.0f, 0.005f, 0.001f, 0.0f, 1.8f, 4.5f, -0.5f, -0.2f, + 0.02f, 1000, 0.04f, 0.013f, 0.15f, 0.1f, 0.1f, 0.06f, + 0.075f, 4, 7, 0xC00, 300.0f, 300.0f, 0.0033333334f, 300.0f, + 0.0033333334f, 300.0f, 0x20038, 0x20039, 0x8002F, 0x8002B, 0x8002E, {-180, -1}, + {-180, 180}, {310, 180}, 0, 0, 0, }, { - 0x8, 0x13, 0xD, 0x8, 0x13, 0xD, 75.0f, 180.0f, -5.0f, - 0.005f, 0.001f, 0.0f, 1.8f, 4.5f, -0.5f, -0.2f, 0.02f, 0x3E8, - 0.04f, 0.013f, 0.15f, 0.1f, 0.1f, 0.06f, 0.075f, 4, 7, - 0x2670, 300.0f, 300.0f, 0.0033333334f, 300.0f, 0.0033333334f, 300.0f, 0x20038, 0x20039, - 0x8002F, 0x8002B, 0x8002E, 0xFF4C, 0xFFFF, 0xFF4C, 0xB4, 0x136, 0xB4, - 0, 0, 0, + 0x8, 0x13, 0xD, 0x8, 0x13, 0xD, 75.0f, 180.0f, + -5.0f, 0.005f, 0.001f, 0.0f, 1.8f, 4.5f, -0.5f, -0.2f, + 0.02f, 1000, 0.04f, 0.013f, 0.15f, 0.1f, 0.1f, 0.06f, + 0.075f, 4, 7, 0x2670, 300.0f, 300.0f, 0.0033333334f, 300.0f, + 0.0033333334f, 300.0f, 0x20038, 0x20039, 0x8002F, 0x8002B, 0x8002E, {-180, -1}, + {-180, 180}, {310, 180}, 0, 0, 0, }, { - 0x8, 0x13, 0xD, 0x8, 0x13, 0xD, 75.0f, 90.0f, -5.0f, - 0.005f, 0.001f, 0.0f, 1.8f, 4.5f, -0.5f, -0.2f, 0.02f, 0x3E8, - 0.04f, 0.013f, 0.15f, 0.1f, 0.1f, 0.06f, 0.075f, 4, 7, - 0xC00, 150.0f, 150.0f, 0.0066666668f, 150.0f, 0.0066666668f, 150.0f, 0x20038, 0x20039, - 0x8002F, 0x8002B, 0x8002E, 0xFFA6, 0xFFFF, 0xFFA6, 0x5A, 0x168, 0x5A, - 0, 0, 0, + 0x8, 0x13, 0xD, 0x8, 0x13, 0xD, 75.0f, 90.0f, + -5.0f, 0.005f, 0.001f, 0.0f, 1.8f, 4.5f, -0.5f, -0.2f, + 0.02f, 1000, 0.04f, 0.013f, 0.15f, 0.1f, 0.1f, 0.06f, + 0.075f, 4, 7, 0xC00, 150.0f, 150.0f, 0.0066666668f, 150.0f, + 0.0066666668f, 150.0f, 0x20038, 0x20039, 0x8002F, 0x8002B, 0x8002E, {-90, -1}, + {-90, 90}, {360, 90}, 0, 0, 0, }, { - 0x8, 0x13, 0xD, 0x8, 0x13, 0xD, 50.0f, 90.0f, -3.0f, 0.005f, - 0.001f, 0.0f, 1.8f, 3.9f, -0.39f, -0.2f, 0.02f, 0x3E8, 0.04f, 0.013f, - 0.15f, 0.1f, 0.1f, 0.06f, 0.075f, 4, 7, 0x1620, 200.0f, 200.0f, - 0.005f, 230.0f, 0.0043478259f, 100.0f, 0x8013C, 0x8013D, 0x80151, 0x8002A, 0x8002D, 0xFF7E, - 0xFFF6, 0xFFC4, 0x82, 0xD2, 0x3C, 0, 1, 0, + 0x8, 0x13, 0xD, 0x8, 0x13, 0xD, 50.0f, 90.0f, -3.0f, + 0.005f, 0.001f, 0.0f, 1.8f, 3.9f, -0.39f, -0.2f, 0.02f, 1000, + 0.04f, 0.013f, 0.15f, 0.1f, 0.1f, 0.06f, 0.075f, 4, 7, + 0x1620, 200.0f, 200.0f, 0.005f, 230.0f, 0.0043478259f, 100.0f, 0x8013C, 0x8013D, + 0x80151, 0x8002A, 0x8002D, {-130, -10}, {-60, 130}, {210, 60}, 0, 1, 0, }, { - 0x4, 0x4, 0x14, 0x4, 0x4, 0x14, 75.0f, 90.0f, -3.0f, - 0.005f, 0.001f, 0.0f, 1.8f, 3.9f, -0.39f, -0.2f, 0.02f, 0x3E8, - 0.04f, 0.013f, 0.15f, 0.1f, 0.1f, 0.06f, 0.075f, 4, 7, - 0x1620, 150.0f, 150.0f, 0.0066666668f, 150.0f, 0.0066666668f, 150.0f, 0x8013C, 0x8013D, - 0x80151, 0x8002A, 0x8002D, 0xFFA6, 0xFFFF, 0xFFA6, 0x5A, 0x97, 0x5A, - 0, 0, 0, + 0x4, 0x4, 0x14, 0x4, 0x4, 0x14, 75.0f, 90.0f, + -3.0f, 0.005f, 0.001f, 0.0f, 1.8f, 3.9f, -0.39f, -0.2f, + 0.02f, 1000, 0.04f, 0.013f, 0.15f, 0.1f, 0.1f, 0.06f, + 0.075f, 4, 7, 0x1620, 150.0f, 150.0f, 0.0066666668f, 150.0f, + 0.0066666668f, 150.0f, 0x8013C, 0x8013D, 0x80151, 0x8002A, 0x8002D, {-90, -1}, + {-90, 90}, {151, 90}, 0, 0, 0, }, }; -const daObjMovebox::Hio_c::Attr_c& daObjMovebox::Act_c::attr() const { +const inline daObjMovebox::Attr_c& daObjMovebox::Act_c::attr() const { +#if DEBUG + return daObjMovebox::Act_c::M_hio[mType].mAttr; +#else return M_attr[mType]; +#endif } void daObjMovebox::Act_c::set_mtx() { @@ -490,10 +628,10 @@ void daObjMovebox::Act_c::path_save() { int daObjMovebox::Act_c::CreateHeap() { BOOL var_r29 = true; - if (i_attr().field_0x58 >= 0) { + if (attr().field_0x58 >= 0) { J3DModelData* modelData = - (J3DModelData*)dComIfG_getObjectRes(M_arcname[mType], i_attr().field_0x58); - JUT_ASSERT(0, modelData != NULL); + (J3DModelData*)dComIfG_getObjectRes(M_arcname[mType], attr().field_0x58); + JUT_ASSERT(1403, modelData != NULL); mpModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000084); var_r29 = mpModel != NULL; @@ -505,6 +643,7 @@ int daObjMovebox::Act_c::CreateHeap() { } void daObjMovebox::Act_c::RideCallBack(dBgW* i_bgw, fopAc_ac_c* i_actor, fopAc_ac_c* i_rideActor) { + (void)i_bgw; Act_c* a_this = (Act_c*)i_actor; if (a_this->field_0x5ac == 2) { @@ -515,20 +654,20 @@ void daObjMovebox::Act_c::RideCallBack(dBgW* i_bgw, fopAc_ac_c* i_actor, fopAc_a f32 var_f28; f32 var_f27; - var_f26 = a_this->i_attr().mPlayerGravity + a_this->i_attr().mMiscGravity; + var_f26 = a_this->attr().mPlayerGravity + a_this->attr().mMiscGravity; var_f29 = i_rideActor->current.pos.x - a_this->current.pos.x; var_f28 = i_rideActor->current.pos.z - a_this->current.pos.z; if (fopAcM_GetProfName(i_rideActor) == PROC_ALINK) { - var_f30 = a_this->i_attr().mPlayerGravity; - var_f27 = a_this->i_attr().field_0x74 * a_this->i_attr().mPlayerTiltPower; + var_f30 = a_this->attr().mPlayerGravity; + var_f27 = a_this->attr().field_0x74 * a_this->attr().mPlayerTiltPower; } else { - var_f30 = a_this->i_attr().mMiscGravity; - var_f27 = a_this->i_attr().field_0x74 * a_this->i_attr().mMiscTiltPower; + var_f30 = a_this->attr().mMiscGravity; + var_f27 = a_this->attr().field_0x74 * a_this->attr().mMiscTiltPower; } var_f31 = 1.0f - (JMAFastSqrt(var_f29 * var_f29 + var_f28 * var_f28) * - a_this->i_attr().field_0x74); + a_this->attr().field_0x74); var_f31 = (var_f31 * 0.9f) + 0.1f; if (var_f31 < 0.0f) { var_f31 = 0.0f; @@ -557,32 +696,32 @@ enum MOVE_DIR { }; fopAc_ac_c* daObjMovebox::Act_c::PPCallBack(fopAc_ac_c* i_bgActor, fopAc_ac_c* i_pushActor, - s16 i_angle, dBgW_Base::PushPullLabel i_pplabel) { - Act_c* a_this = (Act_c*)i_bgActor; + s16 i_angle, dBgW_Base::PushPullLabel pp_label) { + (void)i_pushActor; + dBgW::PushPullLabel var_r26 = cLib_checkBit( - i_pplabel, (dBgW::PushPullLabel)(dBgW::PPLABEL_PUSH | dBgW::PPLABEL_PULL)); + pp_label, (dBgW::PushPullLabel)(dBgW::PPLABEL_PUSH | dBgW::PPLABEL_PULL)); + Act_c* a_this = (Act_c*)i_bgActor; - bool sp34; - if (a_this->i_attr().field_0x9e) { - sp34 = cLib_checkBit(i_pplabel, dBgW::PPLABEL_HEAVY) != 0; - } else { - sp34 = true; - } + bool sp_e = + a_this->attr().field_0x9e ? + (cLib_checkBit(pp_label, dBgW::PPLABEL_HEAVY) ? true : false) : + true; - if (var_r26 != 0 && sp34) { - s16 var_r29 = (s16)(cLib_checkBit(var_r26, dBgW::PPLABEL_PULL) ? - i_angle - 0x8000 : - i_angle) - - a_this->home.angle.y; + if (var_r26 && sp_e) { + s16 sp10 = + cLib_checkBit(var_r26, dBgW::PPLABEL_PULL) ? i_angle - 0x8000 : i_angle; + s16 dir = sp10 - a_this->home.angle.y; - a_this->mPPLabel = i_pplabel; + JUT_ASSERT(1499, pp_label != pp_field); + a_this->mPPLabel = pp_label; int move_dir; - if (var_r29 >= -0x2000 && var_r29 < 0x2000) { + if (dir >= -0x2000 && dir < 0x2000) { move_dir = DIR_SOUTH; - } else if (var_r29 >= 0x2000 && var_r29 < 0x6000) { + } else if (dir >= 0x2000 && dir < 0x6000) { move_dir = DIR_EAST; - } else if (var_r29 >= 0x6000 || var_r29 < -0x6000) { + } else if (dir >= 0x6000 || dir < -0x6000) { move_dir = DIR_NORTH; } else { move_dir = DIR_WEST; @@ -611,7 +750,7 @@ int daObjMovebox::Act_c::Create() { field_0x8cc = 0.0f; field_0x8d0 = 0.0f; field_0x8d4 = 0.0f; - field_0x8d8 = i_attr().field_0x68 * 0.5f; + field_0x8d8 = attr().field_0x68 * 0.5f; field_0x8dc = 0; field_0x8e0 = 0; field_0x8e4 = 0.0f; @@ -637,10 +776,10 @@ int daObjMovebox::Act_c::Create() { fopAcM_SetMtx(this, mBgMtx); - fopAcM_setCullSizeBox(this, i_attr().field_0x90, i_attr().field_0x92, i_attr().field_0x94, - i_attr().field_0x96, i_attr().field_0x98, i_attr().field_0x9a); + fopAcM_setCullSizeBox(this, attr().mCullX.min, attr().mCullX.max, attr().mCullY.min, + attr().mCullY.max, attr().mCullZ.min, attr().mCullZ.max); fopAcM_SetSpeedF(this, 0.0f); - fopAcM_SetGravity(this, i_attr().mGravity); + fopAcM_SetGravity(this, ATTR_F32(mGravity)); fopAcM_posMoveF(this, NULL); mBgc.proc_vertical(this); @@ -669,27 +808,27 @@ int daObjMovebox::Act_c::Create() { mpBgW->Move(); field_0x904 = 0; eyePos = current.pos; - mode_wait_init(); +#if DEBUG + daObjMovebox::Act_c::M_hio[mType].ct(); +#endif return 1; } void daObjMovebox::Act_c::afl_sway() { - const BgcSrc_c* pbgc; - s32 check_num; bool var_r22; bool var_r21; - + f32 var_f31 = field_0x8c0 * field_0x8c0 + field_0x8c4 * field_0x8c4; - f32 var_f29 = i_attr().mMaxTiltPower * i_attr().mMaxTiltPower; + f32 var_f29 = attr().mMaxTiltPower * attr().mMaxTiltPower; - if (i_attr().field_0x9e) { + const BgcSrc_c* pbgc; + if (attr().field_0x9e) { pbgc = mBgc.M_lin20; } else { pbgc = mBgc.M_lin5; } - - check_num = i_attr().field_0x9e ? 21 : 5; + s32 check_num = attr().field_0x9e ? 21 : 5; var_r22 = mBgc.chk_wall_touch2(this, pbgc, check_num, M_dir_base[0]) || mBgc.chk_wall_touch2(this, pbgc, check_num, M_dir_base[2]); @@ -698,7 +837,7 @@ void daObjMovebox::Act_c::afl_sway() { mBgc.chk_wall_touch2(this, pbgc, check_num, M_dir_base[3]); if (var_f31 > var_f29) { - f32 var_f30 = i_attr().mMaxTiltPower / JMAFastSqrt(var_f31); + f32 var_f30 = attr().mMaxTiltPower / JMAFastSqrt(var_f31); field_0x8c0 *= var_f30; field_0x8c4 *= var_f30; } @@ -709,10 +848,10 @@ void daObjMovebox::Act_c::afl_sway() { f32 var_f25; f32 var_f24_debug = field_0x8c8 - field_0x8c0; f32 var_f23_debug = field_0x8cc - field_0x8c4; - var_f28 = i_attr().mTiltSpringFactor * -(var_f24_debug); - var_f27 = i_attr().mTiltSpringFactor * -(var_f23_debug); - var_f26 = -field_0x8d0 * i_attr().mTiltViscoscityResistance; - var_f25 = -field_0x8d4 * i_attr().mTiltViscoscityResistance; + var_f28 = attr().mTiltSpringFactor * -(var_f24_debug); + var_f27 = attr().mTiltSpringFactor * -(var_f23_debug); + var_f26 = -field_0x8d0 * attr().mTiltViscoscityResistance; + var_f25 = -field_0x8d4 * attr().mTiltViscoscityResistance; field_0x8d0 += var_f28 + var_f26; field_0x8d4 += var_f27 + var_f25; @@ -742,25 +881,25 @@ int daObjMovebox::Act_c::check_to_walk() { dBgW::PushPullLabel sp28 = cLib_checkBit(mPPLabel, dBgW::PPLABEL_PULL); dBgW::PushPullLabel var_r25 = cLib_checkBit(mPPLabel, dBgW::PPLABEL_4); - s16 var_r28; + int var_r28; if (sp28) { if (var_r25) { - var_r28 = i_attr().mFirstPullStopTime; + var_r28 = attr().mFirstPullStopTime; } else { - var_r28 = i_attr().mRepeatPullStopTime; + var_r28 = attr().mRepeatPullStopTime; } } else { if (var_r25) { - var_r28 = i_attr().mFirstPushStopTime; + var_r28 = attr().mFirstPushStopTime; } else { - var_r28 = i_attr().mRepeatPushStopTime; + var_r28 = attr().mRepeatPushStopTime; } } for (int i = 0; i < 4; i++) { - if (field_0x8f0[i] >= var_r28) { - const BgcSrc_c* pbgc = i_attr().field_0x9e ? mBgc.M_lin20 : mBgc.M_lin5; - int check_num = i_attr().field_0x9e ? 21 : 5; + if (field_0x8f0[i] >= (s16)var_r28) { + const BgcSrc_c* pbgc = attr().field_0x9e ? mBgc.M_lin20 : mBgc.M_lin5; + int check_num = attr().field_0x9e ? 21 : 5; if (!mBgc.chk_wall_pre(this, pbgc, check_num, M_dir_base[i])) { var_r27 = i; @@ -791,25 +930,25 @@ bool daObjMovebox::Act_c::chk_appear() const { if (path_id != 0xFF || sw1 == 0xFF) { return true; + } else { + BOOL is_sw1 = is_switch1(); + BOOL temp_r29 = prm_get_dmy(); + + return (!is_sw1 && !temp_r29) || (is_sw1 && temp_r29); } - - BOOL is_sw1 = is_switch1(); - BOOL temp_r29 = prm_get_dmy(); - - return (!is_sw1 && !temp_r29) || (is_sw1 && temp_r29); } void daObjMovebox::Act_c::eff_smoke_slip_start() { static cXyz scl(0.6f, 0.6f, 0.6f); - - s16 var_r30 = cLib_checkBit(mPPLabel, dBgW::PPLABEL_PULL) != 0 ? - i_attr().mPushMoveTime : - i_attr().mPullMoveTime; + s16 r29 = M_dir_base[field_0x8e8] + home.angle.y; + int var_r30 = cLib_checkBit(mPPLabel, dBgW::PPLABEL_PULL) != 0 ? + attr().mPushMoveTime : + attr().mPullMoveTime; } void daObjMovebox::Act_c::mode_wait_init() { fopAcM_SetSpeedF(this, 0.0f); - fopAcM_SetGravity(this, i_attr().mGravity); + fopAcM_SetGravity(this, ATTR_F32(mGravity)); mpBgW->SetCrrFunc(dBgS_MoveBGProc_Trans); clr_moment_cnt(); field_0x8e8 = -1; @@ -829,14 +968,14 @@ void daObjMovebox::Act_c::mode_wait() { path_save(); } - daObj::posMoveF_stream(this, NULL, &cXyz::Zero, i_attr().mViscosityResistance, - i_attr().mInertiaResistance); + daObj::posMoveF_stream(this, NULL, &cXyz::Zero, ATTR_F32(mViscosityResistance), + ATTR_F32(mInertiaResistance)); cXyz sp48; mDoMtx_stack_c::transS(home.pos); mDoMtx_stack_c::YrotM(home.angle.y); - mDoMtx_stack_c::transM(field_0x8dc * i_attr().mUnitDistance, 0.0f, - field_0x8e0 * i_attr().mUnitDistance); + mDoMtx_stack_c::transM(field_0x8dc * attr().mUnitDistance, 0.0f, + field_0x8e0 * attr().mUnitDistance); mDoMtx_stack_c::multVecZero(&sp48); current.pos.x = sp48.x; @@ -850,11 +989,11 @@ void daObjMovebox::Act_c::mode_wait() { mode_walk_init(); if (cLib_checkBit(mPPLabel, dBgW::PPLABEL_PULL)) { - field_0x8f8 = i_attr().mPullMoveTime; - field_0x8e4 = 32768.0f / i_attr().mPullMoveTime; + field_0x8f8 = ATTR_S16(mPullMoveTime); + field_0x8e4 = 32768.0f / attr().mPullMoveTime; } else { - field_0x8f8 = i_attr().mPushMoveTime; - field_0x8e4 = 32768.0f / i_attr().mPushMoveTime; + field_0x8f8 = ATTR_S16(mPushMoveTime); + field_0x8e4 = 32768.0f / attr().mPushMoveTime; } } } @@ -880,8 +1019,8 @@ void daObjMovebox::Act_c::mode_walk() { mDoMtx_stack_c::transS(home.pos); mDoMtx_stack_c::YrotM(home.angle.y); mDoMtx_stack_c::transM( - (field_0x8dc + var_f31 * dir_vec[field_0x8e8].x) * i_attr().mUnitDistance, 0.0f, - (field_0x8e0 + var_f31 * dir_vec[field_0x8e8].z) * i_attr().mUnitDistance); + (field_0x8dc + var_f31 * dir_vec[field_0x8e8].x) * attr().mUnitDistance, 0.0f, + (field_0x8e0 + var_f31 * dir_vec[field_0x8e8].z) * attr().mUnitDistance); mDoMtx_stack_c::multVecZero(&sp78); current.pos.x = sp78.x; @@ -891,16 +1030,16 @@ void daObjMovebox::Act_c::mode_walk() { sound_slip(); if (var_r28) { - const BgcSrc_c* pbgc = i_attr().field_0x9e ? mBgc.M_lin20 : mBgc.M_lin5; - int check_num = i_attr().field_0x9e ? 21 : 5; + const BgcSrc_c* pbgc = attr().field_0x9e ? mBgc.M_lin20 : mBgc.M_lin5; + int check_num = attr().field_0x9e ? 21 : 5; if (mBgc.chk_wall_pre(this, pbgc, check_num, M_dir_base[field_0x8e8])) { sound_limit(); } } - daObj::posMoveF_stream(this, NULL, &cXyz::Zero, i_attr().mViscosityResistance, - i_attr().mInertiaResistance); + daObj::posMoveF_stream(this, NULL, &cXyz::Zero, ATTR_F32(mViscosityResistance), + ATTR_F32(mInertiaResistance)); current.pos.x = sp78.x; current.pos.z = sp78.z; @@ -930,34 +1069,38 @@ void daObjMovebox::Act_c::mode_afl_init() { void daObjMovebox::Act_c::mode_afl() { f32 var_f31; f32 var_f30 = current.pos.y - mBgc.field_0x60; + f32 tmp; + f32 viscosity_resistance; + f32 inertia_resistance; + f32 newGravity; if (var_f30 >= 0.0f) { var_f31 = 0.0f; - } else if (var_f30 <= -i_attr().field_0x68) { + } else if (var_f30 <= -attr().field_0x68) { var_f31 = 1.0f; } else { - var_f31 = -var_f30 * i_attr().field_0x6c; + var_f31 = -var_f30 * attr().field_0x6c; } - field_0x8b8 += (s16)(i_attr().mWaterOscillationAngleSpeed * (cM_rnd() + 1.0f)); - fopAcM_SetGravity(this, var_f31 * i_attr().mBuoyancy + i_attr().mGravity + - i_attr().mWaterOscillationAccel * cM_ssin(field_0x8b8) + field_0x8bc); + field_0x8b8 += (s16)(attr().mWaterOscillationAngleSpeed * (cM_rnd() + 1.0f)); + newGravity = var_f31 * attr().mBuoyancy + attr().mGravity + + attr().mWaterOscillationAccel * cM_ssin(field_0x8b8) + field_0x8bc; + fopAcM_SetGravity(this, newGravity); field_0x8bc = 0.0f; if (!cLib_checkBit(mBgc.mState, daObjMovebox::Bgc_c::STATE_1_e)) { afl_sway(); } - f32 tmp = 1.0f - var_f31; - f32 viscosity_resistance = var_f31 * i_attr().mWaterViscoscityResistance - + tmp * i_attr().mViscosityResistance; - f32 inertia_resistance = var_f31 * i_attr().mWaterInertiaResistance - + tmp * i_attr().mInertiaResistance; + tmp = 1.0f - var_f31; + viscosity_resistance = + var_f31 * attr().mWaterViscoscityResistance + tmp * attr().mViscosityResistance; + inertia_resistance = var_f31 * attr().mWaterInertiaResistance + tmp * attr().mInertiaResistance; field_0x8d8 = mBgc.field_0x60 - current.pos.y; if (field_0x8d8 < 0.0f) { field_0x8d8 = 0.0f; - } else if (field_0x8d8 > i_attr().field_0x68) { - field_0x8d8 = i_attr().field_0x68; + } else if (field_0x8d8 > attr().field_0x68) { + field_0x8d8 = attr().field_0x68; } daObj::posMoveF_stream(this, NULL, &cXyz::Zero, viscosity_resistance, inertia_resistance); @@ -988,7 +1131,7 @@ void daObjMovebox::Act_c::sound_slip() { } } - mDoAud_seStartLevel(i_attr().field_0x7c, &eyePos, var_r29, mReverb); + mDoAud_seStartLevel(attr().field_0x7c, &eyePos, var_r29, mReverb); } void daObjMovebox::Act_c::sound_limit() { @@ -1001,7 +1144,7 @@ void daObjMovebox::Act_c::sound_limit() { } } - mDoAud_seStart(i_attr().field_0x80, &eyePos, var_r29, mReverb); + mDoAud_seStart(attr().field_0x80, &eyePos, var_r29, mReverb); } void daObjMovebox::Act_c::sound_land() { @@ -1014,7 +1157,7 @@ void daObjMovebox::Act_c::sound_land() { } } - mDoAud_seStart(i_attr().field_0x84, &eyePos, var_r29, mReverb); + mDoAud_seStart(attr().field_0x84, &eyePos, var_r29, mReverb); } void daObjMovebox::Act_c::vib_land() { @@ -1026,7 +1169,7 @@ f32 dummy_literal(f32 x) { } void daObjMovebox::Act_c::eff_land_smoke() { - daObjEff::Act_c::make_land_smoke(¤t.pos, i_attr().mLandSmokeScale); + daObjEff::Act_c::make_land_smoke(¤t.pos, ATTR_F32(mLandSmokeScale)); } void dummy_static() { @@ -1040,10 +1183,16 @@ int daObjMovebox::Act_c::Execute(Mtx** param_0) { if (--field_0x908 == 0) { fopAcM_delete(this); } - return 1; } +#if DEBUG + for (int i = 0; i < 23; i++) { + daObjMovebox::L_wall_flag[mType][i] = 0; + daObjMovebox::L_gnd_flag[mType][i] = 0; + } +#endif + if (mCcCyl.ChkTgHit()) { dCcD_GObjInf* hit_obj = mCcCyl.GetTgHitGObj(); @@ -1061,7 +1210,7 @@ int daObjMovebox::Act_c::Execute(Mtx** param_0) { cXyz sp48(current.pos); J3DModelData* kibako_bmd = (J3DModelData*)dComIfG_getObjectRes("Always", "BreakWoodBox.bmd"); - JUT_ASSERT(0, kibako_bmd != NULL); + JUT_ASSERT(2402, kibako_bmd != NULL); JPABaseEmitter* emitter = dComIfGp_particle_set( 0x82AF, &sp48, NULL, NULL, 0xFF, &dPa_modelEcallBack::getEcallback(), @@ -1084,7 +1233,7 @@ int daObjMovebox::Act_c::Execute(Mtx** param_0) { if (cLib_checkBit(mBgc.mState, daObjMovebox::Bgc_c::STATE_20_e)) { - mDoAud_seStart(i_attr().field_0x88, &eyePos, 0, mReverb); + mDoAud_seStart(attr().field_0x88, &eyePos, 0, mReverb); } if (field_0x5ac == 0) { @@ -1095,7 +1244,7 @@ int daObjMovebox::Act_c::Execute(Mtx** param_0) { if (cLib_checkBit(mBgc.mState, daObjMovebox::Bgc_c::STATE_1_e)) { - if (i_attr().mBuoyancy + i_attr().mGravity > 0.0f) { + if (attr().mBuoyancy + attr().mGravity > 0.0f) { mode_afl_init(); } } else { @@ -1154,22 +1303,45 @@ int daObjMovebox::Act_c::Draw() { dComIfGd_setList(); } - if (i_attr().field_0x9d == 0 && mBgc.field_0x5c >= 0) { - f32 var_f31 = mBgc.field_0x0[mBgc.field_0x5c]; + if (attr().field_0x9d == 0 && mBgc.field_0x5c >= 0) { + int index = mBgc.field_0x5c; + f32 var_f31 = mBgc.field_0x0[index]; cM3dGPla sp40; - - if (dComIfG_Bgsp().GetTriPla(mBgc.M_gnd_work[mBgc.field_0x5c], &sp40) && - var_f31 != -G_CM3D_F_INF) - { - dComIfGd_setSimpleShadow(¤t.pos, var_f31, i_attr().mShadowSize, &sp40.mNormal, + bool b = dComIfG_Bgsp().GetTriPla(mBgc.M_gnd_work[index], &sp40); + if (b && var_f31 != -G_CM3D_F_INF) { + dComIfGd_setSimpleShadow(¤t.pos, var_f31, ATTR_F32(mShadowSize), &sp40.mNormal, shape_angle.y, -0.4f, NULL); } } +#if DEBUG + dComIfG_Bgsp().DebugDrawPoly(*mpBgW); + if (Hio_c::M_flag_bgc[mType] == 1) { + for (int i = 0; i < 23; i++) { + if (L_wall_flag[mType][i]) { + static GXColor color = {0, 0xff, 0, 0xff}; + dDbVw_drawLineOpa(L_wall_start[mType][i], L_wall_end[mType][i], color, 1, 0xc); + } + if (L_gnd_flag[mType][i]) { + static GXColor color = {0, 0, 0xff, 0xff}; + dDbVw_drawPointOpa(L_gnd_start[mType][i], color, 1, 0x24); + } + } + for (int i = 0; i < mBgc.field_0xA24; i++) { + static GXColor color = {0xff, 0, 0xff, 0xff}; + dDbVw_drawLineOpa(mBgc.field_0x184[i], mBgc.field_0x5D4[i], color, 1, 0xc); + } + } +#endif + return 1; } int daObjMovebox::Act_c::Delete() { +#if DEBUG + M_hio[mType].dt(); +#endif + if (mpBgW != NULL) { mpBgW->SetRideCallback(NULL); mpBgW->SetPushPullCallback(NULL); @@ -1191,10 +1363,10 @@ int daObjMovebox::Act_c::Mthd_Create() { int phase_state = dComIfG_resLoad(&mPhase, M_arcname[mType]); if (phase_state == cPhs_COMPLEATE_e) { - u32 heap_size = i_attr().field_0x60; + u32 heap_size = attr().field_0x60; path_init(); - phase_state = MoveBGCreate(M_arcname[mType], i_attr().field_0x5c, dBgS_MoveBGProc_Trans, + phase_state = MoveBGCreate(M_arcname[mType], attr().field_0x5c, dBgS_MoveBGProc_Trans, heap_size, NULL); JUT_ASSERT(0, (phase_state == cPhs_COMPLEATE_e) || (phase_state == cPhs_ERROR_e)); }