diff --git a/include/JSystem/J3DGraphAnimator/J3DAnimation.h b/include/JSystem/J3DGraphAnimator/J3DAnimation.h index f8746cc04..21ec3200d 100644 --- a/include/JSystem/J3DGraphAnimator/J3DAnimation.h +++ b/include/JSystem/J3DGraphAnimator/J3DAnimation.h @@ -698,7 +698,6 @@ public: virtual ~J3DAnmVtxColor(); virtual void getColor(u8, u16, GXColor*) const {} - inline J3DAnmVtxColorIndexData* getAnmVtxColorIndexData(u8 idx, u16 frame) { return &mAnmVtxColorIndexData[idx][frame]; } protected: /* 0x10 */ u16 mAnmTableNum[2]; diff --git a/include/JSystem/J3DGraphAnimator/J3DMaterialAnm.h b/include/JSystem/J3DGraphAnimator/J3DMaterialAnm.h index d4541799c..797c40609 100644 --- a/include/JSystem/J3DGraphAnimator/J3DMaterialAnm.h +++ b/include/JSystem/J3DGraphAnimator/J3DMaterialAnm.h @@ -155,11 +155,11 @@ public: J3DMaterialAnm() { initialize(); } void initialize(); - inline void setMatColorAnm(int i, J3DMatColorAnm* pAnm) { mMatColorAnm[i] = pAnm; } - inline void setTexMtxAnm(int i, J3DTexMtxAnm* pAnm) { mTexMtxAnm[i] = pAnm; } - inline void setTexNoAnm(int i, J3DTexNoAnm* pAnm) { mTexNoAnm[i] = pAnm; } - inline void setTevColorAnm(int i, J3DTevColorAnm* pAnm) { mTevColorAnm[i] = pAnm; } - inline void setTevKColorAnm(int i, J3DTevKColorAnm* pAnm) { mTevKColorAnm[i] = pAnm; } + void setMatColorAnm(int i, J3DMatColorAnm* pAnm) { mMatColorAnm[i] = pAnm; } + void setTexMtxAnm(int i, J3DTexMtxAnm* pAnm) { mTexMtxAnm[i] = pAnm; } + void setTexNoAnm(int i, J3DTexNoAnm* pAnm) { mTexNoAnm[i] = pAnm; } + void setTevColorAnm(int i, J3DTevColorAnm* pAnm) { mTevColorAnm[i] = pAnm; } + void setTevKColorAnm(int i, J3DTevKColorAnm* pAnm) { mTevKColorAnm[i] = pAnm; } virtual ~J3DMaterialAnm() {} virtual void calc(J3DMaterial*) const; diff --git a/include/JSystem/JUtility/JUTGamePad.h b/include/JSystem/JUtility/JUTGamePad.h index f3ba6c390..bf0844e0e 100644 --- a/include/JSystem/JUtility/JUTGamePad.h +++ b/include/JSystem/JUtility/JUTGamePad.h @@ -122,7 +122,7 @@ public: return isPushingReset; } - inline void stopMotorWave() { mRumble.stopPatternedRumbleAtThePeriod(); } + void stopMotorWave() { mRumble.stopPatternedRumbleAtThePeriod(); } void stopMotor() { mRumble.stopMotor(mPortNum); } void stopMotorHard() { mRumble.stopMotorHard(mPortNum); } diff --git a/include/SSystem/SComponent/c_bg_s_lin_chk.h b/include/SSystem/SComponent/c_bg_s_lin_chk.h index b465cd6e4..de2d420ef 100644 --- a/include/SSystem/SComponent/c_bg_s_lin_chk.h +++ b/include/SSystem/SComponent/c_bg_s_lin_chk.h @@ -39,7 +39,7 @@ public: void SetCross(cXyz& pos) { mLin.SetEnd(pos); } cXyz& GetCross() { return mLin.GetEnd(); } - cXyz& GetCrossP() { return mLin.GetEndP(); } + cXyz* GetCrossP() { return mLin.GetEndP(); } cM3dGLin* GetLinP() { return &mLin; } void OnFrontFlag() { mFrontFlag = true; } diff --git a/include/SSystem/SComponent/c_bg_s_poly_info.h b/include/SSystem/SComponent/c_bg_s_poly_info.h index 621c070d5..b22b02724 100644 --- a/include/SSystem/SComponent/c_bg_s_poly_info.h +++ b/include/SSystem/SComponent/c_bg_s_poly_info.h @@ -60,7 +60,10 @@ public: // TODO void ChkSafe(const void*, unsigned int) const {} void ChkSetInf() const {} - void SetPolyIndex(int) {} + void SetPolyIndex(int poly_index) { + JUT_ASSERT(0x7b, 0 <= poly_index); + mPolyIndex = poly_index; + } }; // Size: 0x10 STATIC_ASSERT(sizeof(cBgS_PolyInfo) == 0x10); diff --git a/include/SSystem/SComponent/c_bg_w.h b/include/SSystem/SComponent/c_bg_w.h index d1440f033..4e48c1809 100644 --- a/include/SSystem/SComponent/c_bg_w.h +++ b/include/SSystem/SComponent/c_bg_w.h @@ -35,7 +35,7 @@ public: struct cBgD_Vtx_t; struct cBgD_Blk_t { - /* 0x0 */ u16 field_0x00; + /* 0x00 */ u16 startTri; }; struct cBgD_Ti_t { @@ -69,9 +69,18 @@ struct cBgD_Grp_t { /* 0x30 */ u32 m_info; }; // Size: 0x34 +struct cBgD_Tree_t { + /* 0x00 */ u16 mFlag; + /* 0x02 */ u16 mParent; + union { + /* 0x04 */ u16 mChild[8]; // branch + /* 0x04 */ u16 mBlock; // leaf + }; +}; // Size: 0x14 + class cBgW_NodeTree : public cM3dGAab { public: - virtual ~cBgW_NodeTree(); + virtual ~cBgW_NodeTree() {} }; class cBgD_t { @@ -83,7 +92,7 @@ public: /* 0x10 */ s32 m_b_num; /* 0x14 */ cBgD_Blk_t* m_b_tbl; /* 0x18 */ s32 m_tree_num; - /* 0x1C */ void* m_tree_tbl; + /* 0x1C */ cBgD_Tree_t* m_tree_tbl; /* 0x20 */ s32 m_g_num; /* 0x24 */ cBgD_Grp_t* m_g_tbl; /* 0x28 */ s32 m_ti_num; @@ -104,7 +113,13 @@ public: virtual ~cBgW_RwgElm() {} }; -class cBgW_BlkElm; +class cBgW_BlkElm { +public: + /* 0x00 */ u16 roof; + /* 0x02 */ u16 wall; + /* 0x04 */ u16 ground; +}; + class cBgW_TriElm { public: /* 0x00 */ cM3dGPla m_plane; @@ -126,6 +141,7 @@ public: MOVE_BG_e = 0x1, NO_VTX_TBL_e = 0x10, GLOBAL_e = 0x20, + UNK40_e = 0x40, LOCK_e = 0x80, }; @@ -137,8 +153,7 @@ public: void FreeArea(); void GlobalVtx(); - void SetVtx(); - + bool SetVtx(); bool SetTri(); void BlckConnect(u16*, int*, int); void MakeBlckTransMinMax(cXyz*, cXyz*); @@ -149,13 +164,13 @@ public: void MakeNodeTree(); bool ChkMemoryError(); bool Set(cBgD_t*, u32, f32(*)[3][4]); - void RwgLineCheck(u16, cBgS_LinChk*); - void LineCheckRp(cBgS_LinChk*, int); + bool RwgLineCheck(u16, cBgS_LinChk*); + bool LineCheckRp(cBgS_LinChk*, int); bool LineCheckGrpRp(cBgS_LinChk*, int, int); bool RwgGroundCheckCommon(f32, u16, cBgS_GndChk*); bool RwgGroundCheckGnd(u16, cBgS_GndChk*); bool RwgGroundCheckWall(u16, cBgS_GndChk*); - void GroundCrossRp(cBgS_GndChk*, int); + bool GroundCrossRp(cBgS_GndChk*, int); bool GroundCrossGrpRp(cBgS_GndChk*, int, int); void CopyOldMtx(); void Move(); @@ -247,7 +262,7 @@ public: /* 0x7C */ cXyz mTransVel; /* 0x88 */ cBgW_TriElm* pm_tri; /* 0x8C */ cBgW_RwgElm* pm_rwg; - /* 0x90 */ cXyz* pm_vtx_tbl; + /* 0x90 */ Vec* pm_vtx_tbl; /* 0x94 */ cBgD_t* pm_bgd; /* 0x98 */ cBgW_BlkElm* pm_blk; /* 0x9C */ cBgW_GrpElm* pm_grp; diff --git a/include/SSystem/SComponent/c_m3d_g_aab.h b/include/SSystem/SComponent/c_m3d_g_aab.h index b85bd6891..3c5861c25 100644 --- a/include/SSystem/SComponent/c_m3d_g_aab.h +++ b/include/SSystem/SComponent/c_m3d_g_aab.h @@ -3,6 +3,7 @@ #include "SSystem/SComponent/c_xyz.h" #include "SSystem/SComponent/c_m3d.h" +#include "SSystem/SComponent/c_m3d_g_lin.h" #include "global.h" // Axis aligned bounding box @@ -23,20 +24,25 @@ public: void SetMax(const cXyz&); const cXyz* GetMaxP(void) const { return &mMax; } const cXyz* GetMinP(void) const { return &mMin; } + cXyz* GetMaxP(void) { return &mMax; } + cXyz* GetMinP(void) { return &mMin; } const f32 GetMaxX(void) const { return mMax.x; } const f32 GetMaxY(void) const { return mMax.y; } const f32 GetMaxZ(void) const { return mMax.z; } const f32 GetMinX(void) const { return mMin.x; } const f32 GetMinY(void) const { return mMin.y; } const f32 GetMinZ(void) const { return mMin.z; } - bool Cross(const cM3dGAab *param_1) { - return cM3d_Cross_AabAab(this, param_1); + bool Cross(const cM3dGAab *aab) { + return cM3d_Cross_AabAab(this, aab); } - bool Cross(const cM3dGCyl *param_1) { - return cM3d_Cross_AabCyl(this, param_1); + bool Cross(const cM3dGCyl *cyl) { + return cM3d_Cross_AabCyl(this, cyl); } - bool Cross(const cM3dGSph *param_1) { - return cM3d_Cross_AabSph(this, param_1); + bool Cross(const cM3dGSph *sph) { + return cM3d_Cross_AabSph(this, sph); + } + bool Cross(const cM3dGLin *lin) { + return cM3d_Cross_MinMaxBoxLine(GetMinP(), GetMaxP(), lin->GetStartP(), lin->GetEndP()); } void CalcCenter(cXyz* pOut) const { VECAdd(&mMin, &mMax, pOut); diff --git a/include/SSystem/SComponent/c_m3d_g_lin.h b/include/SSystem/SComponent/c_m3d_g_lin.h index 12492b87a..5945aa87b 100644 --- a/include/SSystem/SComponent/c_m3d_g_lin.h +++ b/include/SSystem/SComponent/c_m3d_g_lin.h @@ -26,12 +26,12 @@ public: void CalcPos(Vec*, f32) const { /* TODO */ } void CalcVec(Vec* pOut) const { VECSubtract(&this->mEnd, &this->mStart, pOut); } void SetEnd(const cXyz& pos) { mEnd = pos; } - const cXyz& GetStartP() const { return mStart; } - cXyz& GetStartP() { return mStart; } + const cXyz* GetStartP() const { return &mStart; } + cXyz* GetStartP() { return &mStart; } const cXyz& GetStart() const { return mStart; } cXyz& GetStart() { return mStart; } - const cXyz& GetEndP() const { return mEnd; } - cXyz& GetEndP() { return mEnd; } + const cXyz* GetEndP() const { return &mEnd; } + cXyz* GetEndP() { return &mEnd; } const cXyz& GetEnd() const { return mEnd; } cXyz& GetEnd() { return mEnd; } void GetLen() const { /* TODO */ } diff --git a/include/SSystem/SComponent/c_m3d_g_tri.h b/include/SSystem/SComponent/c_m3d_g_tri.h index 2b4620351..c4882fd58 100644 --- a/include/SSystem/SComponent/c_m3d_g_tri.h +++ b/include/SSystem/SComponent/c_m3d_g_tri.h @@ -46,7 +46,12 @@ public: void crossX(const Vec*, f32*) const {} void crossY(const Vec*) const {} void crossZ(const Vec*, f32*) const {} - void setBg(const Vec*, const Vec*, const Vec*, const cM3dGPla*) {} + void setBg(const Vec* a, const Vec* b, const Vec* c, const cM3dGPla* pla) { + mA = *a; + mB = *b; + mC = *c; + *((cM3dGPla*)this) = *pla; + } void setPos(const Vec*, const Vec*, const Vec*) {} void setUp() {} ~cM3dGTri() {} diff --git a/include/d/actor/d_a_bwdg.h b/include/d/actor/d_a_bwdg.h index 79cf2f223..1c9b4fe22 100644 --- a/include/d/actor/d_a_bwdg.h +++ b/include/d/actor/d_a_bwdg.h @@ -8,4 +8,14 @@ public: /* Place member variables here */ }; +class daBwdg_packet_c { +public: + void getMtx() {} + void getNrm() {} + void getPos() {} + void setTevStr(dKy_tevstr_c*) {} + + void draw(); +}; + #endif /* D_A_BWDG_H */ diff --git a/include/d/actor/d_a_coming3.h b/include/d/actor/d_a_coming3.h index dbff9817c..ae1a288ae 100644 --- a/include/d/actor/d_a_coming3.h +++ b/include/d/actor/d_a_coming3.h @@ -4,6 +4,9 @@ #include "f_op/f_op_actor.h" namespace daComing3 { + static void position_is_safety_call_back(void*, void*); + static void position_is_none_obj(cXyz*); + class Act_c : public fopAc_ac_c { public: void get_water_height(float*, int*, const cXyz*); diff --git a/include/d/actor/d_a_fallrock_tag.h b/include/d/actor/d_a_fallrock_tag.h index 5b9fbd8b7..fb7d765eb 100644 --- a/include/d/actor/d_a_fallrock_tag.h +++ b/include/d/actor/d_a_fallrock_tag.h @@ -8,7 +8,7 @@ public: inline s32 create(); inline BOOL draw(); inline BOOL execute(); - void getData() {} + void getData(); // weak but not inlined? void createRock(cXyz*, cXyz*, csXyz*, int, unsigned long); diff --git a/include/d/actor/d_a_himo3.h b/include/d/actor/d_a_himo3.h index d934fc97a..1a3d91639 100644 --- a/include/d/actor/d_a_himo3.h +++ b/include/d/actor/d_a_himo3.h @@ -3,6 +3,10 @@ #include "f_op/f_op_actor.h" +struct himo3_s { + +}; + class himo3_class : public fopAc_ac_c { public: void getPlayerMoveLength() {} diff --git a/include/d/actor/d_a_lod_bg.h b/include/d/actor/d_a_lod_bg.h index ce6882674..310223c37 100644 --- a/include/d/actor/d_a_lod_bg.h +++ b/include/d/actor/d_a_lod_bg.h @@ -9,7 +9,7 @@ class JKRArchive; class daLodbg_c : public fopAc_ac_c { public: - void createHeap() {} + inline void createHeap(); inline BOOL draw(); inline BOOL execute(); void setExecute(int (daLodbg_c::*)()) {} diff --git a/include/d/actor/d_a_majuu_flag.h b/include/d/actor/d_a_majuu_flag.h index b8864dd55..ee0b7f3ab 100644 --- a/include/d/actor/d_a_majuu_flag.h +++ b/include/d/actor/d_a_majuu_flag.h @@ -4,6 +4,23 @@ #include "f_op/f_op_actor.h" #include "SSystem/SComponent/c_phase.h" +class daMajuu_Flag_packet_c { +public: + void changeCurrentPos() {} + void getImageTexObj() {} + void getMtx() {} + void getNrm() {} + void getOffsetVec() {} + void getPos() {} + void getToonTexObj() {} + void setTevStr(dKy_tevstr_c*) {} + + void setNrmMtx(); + void setBackNrm(); + void setNrmVtx(cXyz*, int); + void draw(); +}; + class daMajuu_Flag_c : public fopAc_ac_c { public: void setBaseScale(float) {} diff --git a/include/d/actor/d_a_mant.h b/include/d/actor/d_a_mant.h index 0b3381731..e0e3c79b3 100644 --- a/include/d/actor/d_a_mant.h +++ b/include/d/actor/d_a_mant.h @@ -3,6 +3,24 @@ #include "f_op/f_op_actor.h" +struct mant_j_s { + +}; + +class daMant_packet_c { +public: + void getMtx() {} + void getMtx2() {} + void getNrm() {} + void getPos() {} + void getTexNo() {} + void setTevStr(dKy_tevstr_c*) {} + void setTexNo(unsigned char) {} + void setarg0(unsigned char) {} + + void draw(); +}; + class mant_class : public fopAc_ac_c { public: /* 0x0290 */ u8 m0290[0x1BEC - 0x0290]; diff --git a/include/d/actor/d_a_obj_ajav.h b/include/d/actor/d_a_obj_ajav.h index a976e2429..addce4771 100644 --- a/include/d/actor/d_a_obj_ajav.h +++ b/include/d/actor/d_a_obj_ajav.h @@ -3,15 +3,67 @@ #include "f_op/f_op_actor.h" -class daObjAjav : public fopAc_ac_c { -public: - void daObjAjav_make_splash(cXyz, float); - void check_angle(short*, short); - void daObjAjav_limit_angle(short*, short); - void daObjAjav_get_rot_speed(cXyz, cXyz, short); - -public: - /* Place member variables here */ +namespace daObjAjav { + static void daObjAjav_make_splash(cXyz, float); + static void check_angle(short*, short); + static void daObjAjav_limit_angle(short*, short); + static void daObjAjav_get_rot_speed(cXyz, cXyz, short); + + class Act_c; + + class Part_c { + public: + void checkExeProc(void (daObjAjav::Part_c::*)(daObjAjav::Act_c*)) {} + void draw(daObjAjav::Act_c*) {} + void execute(daObjAjav::Act_c*) {} + void setDrawProc(void (daObjAjav::Part_c::*)(daObjAjav::Act_c*)) {} + void setExeProc(void (daObjAjav::Part_c::*)(daObjAjav::Act_c*)) {} + void set_se_pos(cXyz) {} + + void make_hamon(cXyz, float); + void no_proc(daObjAjav::Act_c*); + void init_data(cXyz, cXyz, dKy_tevstr_c*, cXyz*); + void set_mdl_area(const char*, int, unsigned long); + void init_mtx(cXyz, csXyz, cXyz); + void set_flaw_mtx(cXyz, csXyz); + void set_fall_mtx(cXyz, csXyz); + void fall_init(cXyz, csXyz, short, unsigned short); + void fall_0(daObjAjav::Act_c*); + void fall_1(daObjAjav::Act_c*); + void flaw(daObjAjav::Act_c*); + void draw_normal(daObjAjav::Act_c*); + void draw_flashing(daObjAjav::Act_c*); + void draw_flashing_normal(daObjAjav::Act_c*); + void draw_shy(daObjAjav::Act_c*); + void make_fall_rock(int); + }; + + class Act_c : public fopAc_ac_c { + public: + void check_ev() {} + void check_sw() {} + void on_sw() {} + + void solidHeapCB(fopAc_ac_c*); + void create_heap(); + s32 _create(); + BOOL _delete(); + void init_mtx(); + void set_tex(); + void set_co_offset(); + void check_all_wait(); + void check_end(); + void to_broken(); + void damage_part(); + void make_shot_rock(); + void make_hamon2(cXyz, float); + void set_hamon(float); + BOOL _execute(); + BOOL _draw(); + + public: + /* Place member variables here */ + }; }; #endif /* D_A_OBJ_AJAV_H */ diff --git a/include/d/actor/d_a_obj_buoyflag.h b/include/d/actor/d_a_obj_buoyflag.h index 0b8581934..0b3639da8 100644 --- a/include/d/actor/d_a_obj_buoyflag.h +++ b/include/d/actor/d_a_obj_buoyflag.h @@ -7,6 +7,8 @@ #include "f_op/f_op_actor_mng.h" namespace daObjBuoyflag { + class Act_c; + enum Type_e { }; @@ -14,6 +16,36 @@ namespace daObjBuoyflag { }; + class Packet_c { + public: + void calc_pos_gravity(int, int) {} + void calc_pos_spd(int, int) {} + void calc_pos_spring(int, int) {} + void calc_pos_wave(int, int) {} + + void hasi_nrm_init(); + void draw_hata(daObjBuoyflag::Act_c*); + void draw_hasi(daObjBuoyflag::Act_c*); + void draw(); + void init(daObjBuoyflag::Act_c*); + void calc_wind_base(daObjBuoyflag::Act_c*); + void calc_pos_spring_near(const cXyz*, const cXyz*, float, float); + void calc_pos(daObjBuoyflag::Act_c*); + void calc_nrm(); + void calc(daObjBuoyflag::Act_c*); + void update(daObjBuoyflag::Act_c*); + }; + + class DrawVtx_c { + public: + + }; + + class MoveVtx_c { + public: + + }; + class Act_c : public fopAc_ac_c { public: static s32 make_norm(unsigned int parentPId, cXyz* pos, int roomNo, csXyz* angle) { @@ -33,9 +65,9 @@ namespace daObjBuoyflag { void jump_to_sea(float, float, short) {} void make_barrel2_mine(unsigned int, cXyz*, int, csXyz*, Texture_e, bool) {} void make_barrel2_norm(unsigned int, cXyz*, int, csXyz*, Texture_e) {} - void attr_type() const {} + void attr_type() const; // weak but not inlined? void prm_get_noCull() const {} - void prm_get_texture() const {} + void prm_get_texture() const; // weak but not inlined? void prm_get_type() const {} void mtx_init(); diff --git a/include/d/actor/d_a_obj_coming.h b/include/d/actor/d_a_obj_coming.h index 7481aea3f..90b893f05 100644 --- a/include/d/actor/d_a_obj_coming.h +++ b/include/d/actor/d_a_obj_coming.h @@ -34,7 +34,7 @@ namespace daObjComing { void prm_get_swSave() const {} void prm_get_tblNum() const {} void prm_get_type() const {} - void prm_get_waitTime() const {} + void prm_get_waitTime() const; // weak but not inlined? void chk_switch(); s32 _create(); diff --git a/include/d/actor/d_a_obj_correct.h b/include/d/actor/d_a_obj_correct.h index 97c30fcc8..fff43d562 100644 --- a/include/d/actor/d_a_obj_correct.h +++ b/include/d/actor/d_a_obj_correct.h @@ -5,10 +5,6 @@ #include "d/actor/d_a_obj_try.h" namespace daObjCorrect { - enum Type_e { - - }; - class Act_c : public fopAc_ac_c { public: void prm_get_evId() const {} @@ -18,8 +14,8 @@ namespace daObjCorrect { s32 _create(); BOOL _delete(); void chk_try_actor0(fopAc_ac_c*); - void chk_try_actor1(Act_c*, Type_e, float) const; - void chk_try_actor2(Act_c*, Type_e, bool, float, float) const; + void chk_try_actor1(daObjTry::Act_c*, daObjTry::Type_e, float) const; + void chk_try_actor2(daObjTry::Act_c*, daObjTry::Type_e, bool, float, float) const; void search_movebox(void*, void*); void search_tryColSun(void*, void*); void search_tryColMer(void*, void*); diff --git a/include/d/actor/d_a_obj_doguu.h b/include/d/actor/d_a_obj_doguu.h index 8e91fa3ff..4769e131d 100644 --- a/include/d/actor/d_a_obj_doguu.h +++ b/include/d/actor/d_a_obj_doguu.h @@ -9,7 +9,7 @@ public: inline BOOL _delete(); inline BOOL _draw(); inline BOOL _execute(); - void setEffectMtx(const cXyz*, float) {} + void setEffectMtx(const cXyz*, float); // weak but not inlined? void setPointLight(); void CreateHeap(); diff --git a/include/d/actor/d_a_obj_hsehi1.h b/include/d/actor/d_a_obj_hsehi1.h index b54621de8..64328042d 100644 --- a/include/d/actor/d_a_obj_hsehi1.h +++ b/include/d/actor/d_a_obj_hsehi1.h @@ -7,6 +7,8 @@ class JPABaseEmitter; class daObj_hsh_c : public fopAc_ac_c { public: + ~daObj_hsh_c(); + void isEventAccept() {} void isOffDraw() {} void isTactCancel() {} diff --git a/include/d/actor/d_a_obj_try.h b/include/d/actor/d_a_obj_try.h index 3a659019f..022d5ee16 100644 --- a/include/d/actor/d_a_obj_try.h +++ b/include/d/actor/d_a_obj_try.h @@ -4,6 +4,10 @@ #include "f_op/f_op_actor.h" namespace daObjTry { + enum Type_e { + + }; + class Act_c : public fopAc_ac_c { public: void attr() const {} diff --git a/include/d/actor/d_a_obj_vmsms.h b/include/d/actor/d_a_obj_vmsms.h index 4f3c50635..608d2d195 100644 --- a/include/d/actor/d_a_obj_vmsms.h +++ b/include/d/actor/d_a_obj_vmsms.h @@ -5,7 +5,7 @@ class daObjVmsms_c : public fopAc_ac_c { public: - void check_demo() const {} + void check_demo() const; // weak but not inlined? void solidHeapCB(fopAc_ac_c*); void create_heap(); diff --git a/include/d/actor/d_a_obj_vtil.h b/include/d/actor/d_a_obj_vtil.h index 56e0b9d54..29a013629 100644 --- a/include/d/actor/d_a_obj_vtil.h +++ b/include/d/actor/d_a_obj_vtil.h @@ -6,7 +6,7 @@ class daObjVtil_c : public fopAc_ac_c { public: void camera_off() {} - void check_ev_bit() const {} + void check_ev_bit() const; // weak but not inlined? void prm_get_type() const {} void solidHeapCB(fopAc_ac_c*); diff --git a/include/d/actor/d_a_pirate_flag.h b/include/d/actor/d_a_pirate_flag.h index 22e69376e..f983698d7 100644 --- a/include/d/actor/d_a_pirate_flag.h +++ b/include/d/actor/d_a_pirate_flag.h @@ -3,6 +3,23 @@ #include "f_op/f_op_actor.h" +class daPirate_Flag_packet_c { +public: + void changeCurrentPos() {} + void getEscapeNrmAngle() {} + void getMtx() {} + void getNrm() {} + void getOffsetVec() {} + void getPos() {} + void setNrmMtx() {} + void setTevStr(dKy_tevstr_c*) {} + + void setCorrectNrmAngle(short, float); + void setBackNrm(); + void setNrmVtx(cXyz*, int, int); + void draw(); +}; + class pirate_flag_class : public fopAc_ac_c { public: /* Place member variables here */ diff --git a/include/d/actor/d_a_saku.h b/include/d/actor/d_a_saku.h index f479ea5f2..0f8b21582 100644 --- a/include/d/actor/d_a_saku.h +++ b/include/d/actor/d_a_saku.h @@ -5,14 +5,15 @@ class daSaku_c : public fopAc_ac_c { public: - void _daSaku_create() {} - void _daSaku_delete() {} - void _daSaku_draw() {} - void _daSaku_execute() {} - void _daSaku_isdelete() {} void chkFlag(unsigned char) {} void setFlag(unsigned char) {} + inline s32 _daSaku_create(); + inline BOOL _daSaku_delete(); + inline BOOL _daSaku_draw(); + inline BOOL _daSaku_execute(); + inline BOOL _daSaku_isdelete(); + void CreateInit(); void saku_draw_sub(int); void mode_break_none(int); diff --git a/include/d/actor/d_a_stone2.h b/include/d/actor/d_a_stone2.h index bf456ce26..9e6babcc4 100644 --- a/include/d/actor/d_a_stone2.h +++ b/include/d/actor/d_a_stone2.h @@ -6,6 +6,8 @@ namespace daStone2 { class Act_c : public fopAc_ac_c { public: + Act_c(); + void attr() {} void prmZ_get_evId() const {} void prm_get_cull() const {} diff --git a/include/d/actor/d_a_tag_light.h b/include/d/actor/d_a_tag_light.h index 0a08e2e8a..7f127cf77 100644 --- a/include/d/actor/d_a_tag_light.h +++ b/include/d/actor/d_a_tag_light.h @@ -7,6 +7,8 @@ class J3DMaterial; namespace daTagLight { + static void get_cross_plane_line(cXyz*, float, float, float, float, float, float, float, float, float, float); + class Act_c : public fopAc_ac_c { public: enum Prm_e { diff --git a/include/d/actor/d_a_tag_photo.h b/include/d/actor/d_a_tag_photo.h index 92a199105..8bdec3420 100644 --- a/include/d/actor/d_a_tag_photo.h +++ b/include/d/actor/d_a_tag_photo.h @@ -5,6 +5,8 @@ class daTagPhoto_c : public fopAc_ac_c { public: + daTagPhoto_c(); + void getTagNo() {} s32 _create(); diff --git a/include/d/actor/d_a_warpdm20.h b/include/d/actor/d_a_warpdm20.h index d4ecd32dd..941cafbc5 100644 --- a/include/d/actor/d_a_warpdm20.h +++ b/include/d/actor/d_a_warpdm20.h @@ -5,7 +5,7 @@ class daWarpdm20_c : public fopAc_ac_c { public: - void set_mtx() {} + void set_mtx(); // weak but not inlined? BOOL _delete(); void CreateHeap(); diff --git a/include/d/actor/d_a_ygcwp.h b/include/d/actor/d_a_ygcwp.h index a9d6aa2fa..e64bc91d1 100644 --- a/include/d/actor/d_a_ygcwp.h +++ b/include/d/actor/d_a_ygcwp.h @@ -5,8 +5,8 @@ class daYgcwp_c : public fopAc_ac_c { public: - void check_ev() const {} - void off_ev() const {} + void check_ev() const; // weak but not inlined? + void off_ev() const; // weak but not inlined? void solidHeapCB(fopAc_ac_c*); void create_heap(); diff --git a/include/d/d_bg_w_sv.h b/include/d/d_bg_w_sv.h new file mode 100644 index 000000000..4f5fe9f51 --- /dev/null +++ b/include/d/d_bg_w_sv.h @@ -0,0 +1,22 @@ +#ifndef D_BG_W_SV_H +#define D_BG_W_SV_H + +#include "d/d_bg_w.h" + +class dBgWSv : public dBgW { +public: + void ChkNoCrrPos() {} + void GetBackVtx() {} + virtual void MatrixCrrPos(cBgS_PolyInfo&, void*, bool, cXyz*, csXyz*, csXyz*) {} + void SetBackVtx(Vec*) {} + void SetFlag(unsigned long) {} + + void Set(cBgD_t*, unsigned long); + void CopyBackVtx(); + void CrrPosWork(cXyz*, int, int, int); + virtual void CrrPos(cBgS_PolyInfo&, void*, bool, cXyz*, csXyz*, csXyz*); + void TransPosWork(cXyz*, int, int, int); + virtual void TransPos(cBgS_PolyInfo&, void*, bool, cXyz*, csXyz*, csXyz*); +}; + +#endif /* D_BG_W_SV_H */ diff --git a/include/d/d_drawlist.h b/include/d/d_drawlist.h index a1592b8a3..96150c570 100644 --- a/include/d/d_drawlist.h +++ b/include/d/d_drawlist.h @@ -458,7 +458,6 @@ public: virtual void draw(); public: - /* 0x04 */ u32 field_0x04[3]; /* 0x10 */ Mtx mtx; }; @@ -467,7 +466,6 @@ public: virtual void draw(); public: - /* 0x04 */ u32 field_0x04[3]; /* 0x10 */ Mtx mtx; }; diff --git a/include/f_op/f_op_actor_mng.h b/include/f_op/f_op_actor_mng.h index 1d7b535ed..a17c91801 100644 --- a/include/f_op/f_op_actor_mng.h +++ b/include/f_op/f_op_actor_mng.h @@ -129,10 +129,22 @@ inline s16 fopAcM_GetProfName(void* pActor) { return fpcM_GetProfName(pActor); } +inline actor_process_profile_definition* fopAcM_GetProfile(void* pActor) { + return (actor_process_profile_definition*)fpcM_GetProfile(pActor); +} + +inline void fopAcM_SetPriority(void* pActor, int priority) { + fpcM_SetPriority(pActor, priority); +} + inline u8 fopAcM_GetGroup(fopAc_ac_c* p_actor) { return p_actor->mGroup; } +inline void fopAcM_SetGroup(fopAc_ac_c* pActor, u8 group) { + pActor->mGroup = group; +} + inline void fopAcM_OnStatus(fopAc_ac_c* pActor, u32 flag) { pActor->mStatus |= flag; } @@ -154,28 +166,32 @@ inline fopAc_ac_c* fopAcM_Search(fopAcIt_JudgeFunc func, void* param) { return (fopAc_ac_c*)fopAcIt_Judge(func, param); } -inline cXyz& fopAcM_GetPosition_p(fopAc_ac_c* pActor) { - return pActor->current.pos; +inline cXyz* fopAcM_GetPosition_p(fopAc_ac_c* pActor) { + return &pActor->current.pos; } inline cXyz& fopAcM_GetPosition(fopAc_ac_c* pActor) { return pActor->current.pos; } -inline cXyz& fopAcM_GetOldPosition_p(fopAc_ac_c* pActor) { - return pActor->old.pos; +inline cXyz* fopAcM_GetOldPosition_p(fopAc_ac_c* pActor) { + return &pActor->old.pos; } -inline cXyz& fopAcM_GetSpeed_p(fopAc_ac_c* pActor) { +inline cXyz* fopAcM_GetSpeed_p(fopAc_ac_c* pActor) { + return &pActor->speed; +} + +inline cXyz& fopAcM_GetSpeed(fopAc_ac_c* pActor) { return pActor->speed; } -inline csXyz& fopAcM_GetAngle_p(fopAc_ac_c* pActor) { - return pActor->current.angle; +inline csXyz* fopAcM_GetAngle_p(fopAc_ac_c* pActor) { + return &pActor->current.angle; } -inline csXyz& fopAcM_GetShapeAngle_p(fopAc_ac_c* pActor) { - return pActor->shape_angle; +inline csXyz* fopAcM_GetShapeAngle_p(fopAc_ac_c* pActor) { + return &pActor->shape_angle; } inline bool fopAcM_CheckCondition(fopAc_ac_c* p_actor, u32 flag) { @@ -278,6 +294,10 @@ inline f32 fopAcM_getCullSizeFar(fopAc_ac_c* i_actor) { return i_actor->mCullSizeFar; } +inline void fopAcM_SetCullSize(fopAc_ac_c* i_actor, int i_culltype) { + i_actor->mCullType = i_culltype; +} + inline int fopAcM_GetCullSize(fopAc_ac_c* i_actor) { return i_actor->mCullType; } @@ -589,4 +609,10 @@ inline void fopAcM_offDraw(fopAc_ac_c* actor) { fopDwTg_DrawQTo(&actor->mDwTg); } +inline void fopAcM_getCullSizeBoxMax(fopAc_ac_c*) {} +inline void fopAcM_getCullSizeBoxMin(fopAc_ac_c*) {} +inline void fopAcM_monsSeStart(fopAc_ac_c*, unsigned long, Vec*, unsigned long) {} +inline void fopAcM_getNameString(fopAc_ac_c*, char*) {} +inline void fopAcM_orderOtherEvent(fopAc_ac_c*, char*, unsigned short) {} + #endif diff --git a/include/f_op/f_op_msg_mng.h b/include/f_op/f_op_msg_mng.h index 51ca989ca..b04018845 100644 --- a/include/f_op/f_op_msg_mng.h +++ b/include/f_op/f_op_msg_mng.h @@ -27,14 +27,12 @@ struct fopMsg_prm_class { struct fopMsg_prm_timer : public fopMsg_prm_class { /* 0x1C */ int mTimerMode; - /* 0x20 */ u16 field_0x20; + /* 0x20 */ u16 mLimitTimeMs; /* 0x22 */ u8 mShowType; /* 0x23 */ u8 mIconType; - /* 0x24 */ u8 field_0x24; - /* 0x25 */ u8 field_0x25; - /* 0x28 */ cXy mTimerPos; - /* 0x30 */ cXy mRupeePos; -}; // Size: 0x38 + /* 0x24 */ cXy mTimerPos; + /* 0x2C */ cXy mRupeePos; +}; // Size: 0x34 class J2DScreen; diff --git a/include/f_pc/f_pc_manager.h b/include/f_pc/f_pc_manager.h index 559829225..97876450d 100644 --- a/include/f_pc/f_pc_manager.h +++ b/include/f_pc/f_pc_manager.h @@ -46,6 +46,10 @@ inline s32 fpcM_ChangeLayerID(void* proc, int layerID) { return fpcPi_Change(&((base_process_class*)proc)->mPi, layerID, fpcPi_CURRENT_e, fpcPi_CURRENT_e); } +inline void fpcM_SetPriority(void* proc, int priority) { + fpcPi_Change(&((base_process_class*)proc)->mPi, fpcLy_CURRENT_e, priority, fpcPi_CURRENT_e); +} + inline s32 fpcM_IsJustType(int type1, int type2) { return fpcBs_Is_JustOfType(type1, type2); } diff --git a/src/SSystem/SComponent/c_bg_s.cpp b/src/SSystem/SComponent/c_bg_s.cpp index 0355e87a5..3ab4cd948 100644 --- a/src/SSystem/SComponent/c_bg_s.cpp +++ b/src/SSystem/SComponent/c_bg_s.cpp @@ -165,7 +165,7 @@ void* cBgS::ConvDzb(void* work) { pbgd->m_t_tbl = (cBgD_Tri_t*)((u32)pbgd->m_t_tbl + (u32)pbgd); pbgd->m_b_tbl = (cBgD_Blk_t*)((u32)pbgd->m_b_tbl + (u32)pbgd); - pbgd->m_tree_tbl = (void*)((u32)pbgd->m_tree_tbl + (u32)pbgd); + pbgd->m_tree_tbl = (cBgD_Tree_t*)((u32)pbgd->m_tree_tbl + (u32)pbgd); pbgd->m_g_tbl = (cBgD_Grp_t*)((u32)pbgd->m_g_tbl + (u32)pbgd); pbgd->m_ti_tbl = (cBgD_Ti_t*)((u32)pbgd->m_ti_tbl + (u32)pbgd); diff --git a/src/SSystem/SComponent/c_bg_w.cpp b/src/SSystem/SComponent/c_bg_w.cpp index 5bfe65b65..9f4d5eaa8 100644 --- a/src/SSystem/SComponent/c_bg_w.cpp +++ b/src/SSystem/SComponent/c_bg_w.cpp @@ -5,9 +5,14 @@ #include "SSystem/SComponent/c_bg_w.h" #include "SSystem/SComponent/c_bg_s_gnd_chk.h" +#include "SSystem/SComponent/c_bg_s_lin_chk.h" +#include "SSystem/SComponent/c_bg_s_shdw_draw.h" +#include "SSystem/SComponent/c_m3d_g_tri.h" +#include "SSystem/SComponent/c_math.h" #include "JSystem/JUtility/JUTAssert.h" #include "JSystem/JKernel/JKRHeap.h" #include "m_Do/m_Do_printf.h" +#include "m_Do/m_Do_mtx.h" #include "dolphin/mtx/mtxvec.h" #include "dolphin/types.h" @@ -19,7 +24,23 @@ void ASSERT_SOLDHEAP() { /* 8024754C-8024760C .text __ct__4cBgWFv */ cBgW::cBgW() { - /* Nonmatching */ + pm_bgd = NULL; + mFlags = GLOBAL_e; + mbNeedsFullTransform = true; + mMoveCounter = 0; + mTransVel.setall(0.0f); + pm_tri = NULL; + pm_rwg = NULL; + pm_blk = NULL; + pm_node_tree = NULL; + pm_grp = NULL; + pm_vtx_tbl = NULL; + pm_base = NULL; + mDoMtx_identity(mOldMtx); + mDoMtx_identity(mCurMtx); + m_rootGrpIdx = 0xFFFF; + mWallCorrectPriority = 2; + mIgnorePlaneType = 0; } /* 8024760C-8024767C .text __dt__4cBgWFv */ @@ -51,13 +72,50 @@ void cBgW::GlobalVtx() { } /* 8024775C-80247840 .text SetVtx__4cBgWFv */ -void cBgW::SetVtx() { - /* Nonmatching */ +bool cBgW::SetVtx() { + ASSERT_SOLDHEAP(); + if (mFlags & NO_VTX_TBL_e) { + pm_vtx_tbl = NULL; + } else { + if (mFlags & MOVE_BG_e) { + pm_vtx_tbl = new Vec[pm_bgd->m_v_num]; + if (pm_vtx_tbl == NULL) + return true; + + if (mFlags & UNK40_e) { + for (s32 i = 0; i < pm_bgd->m_v_num; i++) { + pm_vtx_tbl[i].x = 0.0f; + pm_vtx_tbl[i].y = 0.0f; + pm_vtx_tbl[i].z = 0.0f; + } + } + GlobalVtx(); + } else { + pm_vtx_tbl = pm_bgd->m_v_tbl; + } + } + + return false; } /* 80247840-80247944 .text CalcPlane__4cBgWFv */ void cBgW::CalcPlane() { - /* Nonmatching */ + const cBgD_Tri_t* t_tbl = pm_bgd->m_t_tbl; + + if (pm_vtx_tbl == NULL) + return; + + if (!mbNeedsFullTransform) { + for (s32 i = 0; i < pm_bgd->m_t_num; i++) { + f32 dot = VECDotProduct(pm_tri[i].m_plane.GetNP(), &mTransVel); + pm_tri[i].m_plane.mD -= dot; + } + } else { + for (s32 i = 0; i < pm_bgd->m_t_num; i++) { + cBgW_TriElm* tri_elm = &pm_tri[i]; + cM3d_CalcPla(&pm_vtx_tbl[t_tbl[i].vtx0], &pm_vtx_tbl[t_tbl[i].vtx1], &pm_vtx_tbl[t_tbl[i].vtx2], &tri_elm->m_plane.mNormal, &tri_elm->m_plane.mD); + } + } } /* 80247944-802479D8 .text SetTri__4cBgWFv */ @@ -83,6 +141,44 @@ void cBgW::BlckConnect(u16* rwg, int* prev, int i_no) { /* 80247A24-80247BF8 .text ClassifyPlane__4cBgWFv */ void cBgW::ClassifyPlane() { /* Nonmatching */ + if (pm_vtx_tbl == NULL) + return; + + s32 i = 0; + f32 eps = G_CM3D_F_ABS_MIN; + + int roof, wall, ground; + for (; i < pm_bgd->m_b_num; i++) { + s32 startTri = pm_bgd->m_b_tbl[i].startTri; + s32 lastTri = (i != pm_bgd->m_b_num - 1) ? pm_bgd->m_b_tbl[i + 1].startTri - 1 : pm_bgd->m_t_num - 1; + + pm_blk[i].roof = 0xFFFF; + pm_blk[i].wall = 0xFFFF; + pm_blk[i].ground = 0xFFFF; + + ground = 0xFFFF; + wall = 0xFFFF; + roof = 0xFFFF; + + for (s32 j = startTri; j <= lastTri; j++) { + cBgW_TriElm* tri_elm = &pm_tri[j]; + + f32 ny = tri_elm->m_plane.mNormal.y; + if (fabsf(tri_elm->m_plane.mNormal.x) < eps && fabsf(tri_elm->m_plane.mNormal.y) < eps && fabsf(tri_elm->m_plane.mNormal.z) < eps) + continue; + + if (ny >= 0.5f) { + if (!(mIgnorePlaneType & 1)) + BlckConnect(&pm_blk[i].ground, &ground, i); + } else if (ny < -0.8f) { + if (!(mIgnorePlaneType & 4)) + BlckConnect(&pm_blk[i].roof, &roof, i); + } else { + if (!(mIgnorePlaneType & 2)) + BlckConnect(&pm_blk[i].wall, &wall, i); + } + } + } } /* 80247BF8-80247C4C .text MakeBlckTransMinMax__4cBgWFP4cXyzP4cXyz */ @@ -93,7 +189,7 @@ void cBgW::MakeBlckTransMinMax(cXyz* min, cXyz* max) { /* 80247C4C-80247CD4 .text MakeBlckMinMax__4cBgWFiP4cXyzP4cXyz */ void cBgW::MakeBlckMinMax(int i_no, cXyz* min, cXyz* max) { - cXyz * vtx = &pm_vtx_tbl[i_no]; + Vec* vtx = &pm_vtx_tbl[i_no]; if (min->x > vtx->x) min->x = vtx->x; if (max->x < vtx->x) max->x = vtx->x; if (min->y > vtx->y) min->y = vtx->y; @@ -103,39 +199,96 @@ void cBgW::MakeBlckMinMax(int i_no, cXyz* min, cXyz* max) { } /* 80247CD4-80247E48 .text MakeBlckBnd__4cBgWFiP4cXyzP4cXyz */ -void cBgW::MakeBlckBnd(int, cXyz*, cXyz*) { - /* Nonmatching */ +void cBgW::MakeBlckBnd(int i, cXyz* min, cXyz* max) { + s32 startTri = pm_bgd->m_b_tbl[i].startTri; + s32 lastTri = (i != pm_bgd->m_b_num - 1) ? pm_bgd->m_b_tbl[i + 1].startTri - 1 : pm_bgd->m_t_num - 1; + + if (!mbNeedsFullTransform) { + MakeBlckTransMinMax(min, max); + } else { + min->x = min->y = min->z = 1000000000.0f; + max->x = max->y = max->z = -1000000000.0f; + + for (s32 j = startTri; j <= lastTri; j++) { + MakeBlckMinMax(pm_bgd->m_t_tbl[j].vtx0, min, max); + MakeBlckMinMax(pm_bgd->m_t_tbl[j].vtx1, min, max); + MakeBlckMinMax(pm_bgd->m_t_tbl[j].vtx2, min, max); + } + + min->x -= 1.0f; + min->y -= 1.0f; + min->z -= 1.0f; + max->x += 1.0f; + max->y += 1.0f; + max->z += 1.0f; + } } /* 80247E48-80247F4C .text MakeNodeTreeRp__4cBgWFi */ -void cBgW::MakeNodeTreeRp(int) { - /* Nonmatching */ +void cBgW::MakeNodeTreeRp(int i) { + const cBgD_Tree_t* tree = &pm_bgd->m_tree_tbl[i]; + if (tree->mFlag & 1) { + // leaf + s32 block = tree->mBlock; + if (block != 0xFFFF) { + MakeBlckBnd(tree->mBlock, pm_node_tree[i].GetMinP(), pm_node_tree[i].GetMaxP()); + } + } else { + // branch + pm_node_tree[i].ClearForMinMax(); + for (s32 j = 0; j < 8; j++) { + s32 child = tree->mChild[j]; + if (child == 0xFFFF) + continue; + MakeNodeTreeRp(child); + pm_node_tree[i].SetMinMax(*pm_node_tree[child].GetMinP()); + pm_node_tree[i].SetMinMax(*pm_node_tree[child].GetMaxP()); + } + } } /* 80247F4C-80248078 .text MakeNodeTreeGrpRp__4cBgWFi */ -void cBgW::MakeNodeTreeGrpRp(int grp_idx) { - /* Nonmatching */ - u32 tree_idx = pm_bgd->m_g_tbl[grp_idx].m_tree_idx; +void cBgW::MakeNodeTreeGrpRp(int grp_id) { + u32 tree_idx = pm_bgd->m_g_tbl[grp_id].m_tree_idx; if (tree_idx != 0xFFFF) { MakeNodeTreeRp(tree_idx); - pm_grp[grp_idx].aab.SetMin(pm_node_tree[pm_bgd->m_g_tbl[grp_idx].m_tree_idx].mMin); - pm_grp[grp_idx].aab.SetMax(pm_node_tree[pm_bgd->m_g_tbl[grp_idx].m_tree_idx].mMax); + pm_grp[grp_id].aab.SetMin(*pm_node_tree[pm_bgd->m_g_tbl[grp_id].m_tree_idx].GetMinP()); + pm_grp[grp_id].aab.SetMax(*pm_node_tree[pm_bgd->m_g_tbl[grp_id].m_tree_idx].GetMaxP()); } - u32 chld_idx = pm_bgd->m_g_tbl[grp_idx].m_first_child; + s32 child_idx = pm_bgd->m_g_tbl[grp_id].m_first_child; while (true) { - if (chld_idx == 0xFFFF) + if (child_idx == 0xFFFF) break; - MakeNodeTreeGrpRp(chld_idx); - pm_grp[grp_idx].aab.SetMin(pm_grp[chld_idx].aab.mMin); - pm_grp[grp_idx].aab.SetMax(pm_grp[chld_idx].aab.mMax); - chld_idx = pm_bgd->m_g_tbl[chld_idx].m_next_sibling; + MakeNodeTreeGrpRp(child_idx); + pm_grp[grp_id].aab.SetMin(*pm_grp[child_idx].aab.GetMinP()); + pm_grp[grp_id].aab.SetMax(*pm_grp[child_idx].aab.GetMaxP()); + child_idx = pm_bgd->m_g_tbl[child_idx].m_next_sibling; } } /* 80248078-80248178 .text MakeNodeTree__4cBgWFv */ void cBgW::MakeNodeTree() { - /* Nonmatching */ + if (pm_vtx_tbl == NULL) { + for (s32 i = 0; i < pm_bgd->m_g_num; i++) { + if (pm_bgd->m_g_tbl[i].m_parent == 0xFFFF) { + m_rootGrpIdx = i; + break; + } + } + } else { + for (s32 i = 0; i < pm_bgd->m_g_num; i++) { + pm_grp[i].aab.ClearForMinMax(); + } + + for (s32 i = 0; i < pm_bgd->m_g_num; i++) { + if (pm_bgd->m_g_tbl[i].m_parent == 0xFFFF) { + m_rootGrpIdx = i; + MakeNodeTreeGrpRp(i); + break; + } + } + } } /* 80248178-802481C4 .text ChkMemoryError__4cBgWFv */ @@ -146,60 +299,253 @@ bool cBgW::ChkMemoryError() { } /* 802481C4-80248414 .text Set__4cBgWFP6cBgD_tUlPA3_A4_f */ -bool cBgW::Set(cBgD_t*, u32, Mtx*) { - /* Nonmatching */ +bool cBgW::Set(cBgD_t* bgd, u32 flag, Mtx* mtx) { + ASSERT_SOLDHEAP(); + mFlags = GLOBAL_e; + pm_vtx_tbl = NULL; + pm_tri = NULL; + pm_rwg = NULL; + pm_blk = NULL; + pm_node_tree = NULL; + pm_grp = NULL; + mMoveCounter = cM_rndF(128.0f); + if (bgd == NULL) + return true; + + mFlags = flag; + if (mFlags & GLOBAL_e) { + pm_base = NULL; + mDoMtx_identity(mOldMtx); + mDoMtx_identity(mCurMtx); + } else { + pm_base = mtx; + mDoMtx_copy(*pm_base, mOldMtx); + mDoMtx_copy(*pm_base, mCurMtx); + } + + pm_bgd = bgd; + if (SetVtx() || SetTri()) { + FreeArea(); + return true; + } + + pm_rwg = new cBgW_RwgElm[pm_bgd->m_t_num]; + if (pm_rwg == NULL) { + FreeArea(); + return true; + } + + pm_blk = new cBgW_BlkElm[pm_bgd->m_b_num]; + if (pm_blk == NULL) { + FreeArea(); + return true; + } + + pm_node_tree = new cBgW_NodeTree[pm_bgd->m_tree_num]; + if (pm_node_tree == NULL) { + FreeArea(); + return true; + } + + pm_grp = new cBgW_GrpElm[pm_bgd->m_g_num]; + if (pm_grp == NULL) { + FreeArea(); + return true; + } + + ClassifyPlane(); + mbNeedsFullTransform = true; + MakeNodeTree(); + return false; } /* 80248414-802485FC .text RwgLineCheck__4cBgWFUsP11cBgS_LinChk */ -void cBgW::RwgLineCheck(u16, cBgS_LinChk*) { - /* Nonmatching */ +bool cBgW::RwgLineCheck(u16 poly_index, cBgS_LinChk* chk) { + bool ret = false; + cM3dGTri gtri; + + cM3dGLin *lin = chk->GetLinP(); + while (true) { + cBgW_TriElm* tri_elm; + cBgD_Tri_t* tri; + + tri = &pm_bgd->m_t_tbl[poly_index]; + tri_elm = &pm_tri[poly_index]; + + gtri.setBg(&pm_vtx_tbl[tri->vtx0], &pm_vtx_tbl[tri->vtx1], &pm_vtx_tbl[tri->vtx2], &tri_elm->m_plane); + bool backFlag = chk->ChkBackFlag(); + bool frontFlag = chk->ChkFrontFlag(); + + cXyz pt; + if (cM3d_Cross_LinTri(lin, >ri, &pt, frontFlag, backFlag) && !ChkPolyThrough(poly_index, chk->GetPolyPassChk())) { + chk->GetLinP()->SetEnd(pt); + chk->SetPolyIndex(poly_index); + ret = true; + } + + if (pm_rwg[poly_index].next == 0xFFFF) + break; + + poly_index = pm_rwg[poly_index].next; + } + + return ret; +} + +static void dummy() { + // 0 <= bg_index + cBgS_PolyInfo pi; + pi.SetActorInfo(-1, NULL, 0); } /* 802485FC-80248868 .text LineCheckRp__4cBgWFP11cBgS_LinChki */ -void cBgW::LineCheckRp(cBgS_LinChk*, int) { +bool cBgW::LineCheckRp(cBgS_LinChk* chk, int i) { /* Nonmatching */ + + if (!pm_node_tree[i].Cross(chk->GetLinP())) + return false; + + cBgD_Tree_t* tree = &pm_bgd->m_tree_tbl[i]; + bool ret = false; + if (tree->mFlag & 1) { + if (chk->mPreWallChk && pm_blk[tree->mBlock].wall != 0xFFFF && RwgLineCheck(pm_blk[tree->mBlock].wall, chk)) + ret = true; + if (chk->mPreGroundChk && pm_blk[tree->mBlock].ground != 0xFFFF && RwgLineCheck(pm_blk[tree->mBlock].ground, chk)) + ret = true; + if (chk->mPreRoofChk && pm_blk[tree->mBlock].roof != 0xFFFF && RwgLineCheck(pm_blk[tree->mBlock].roof, chk)) + ret = true; + return ret; + } else { + if (tree->mChild[0] != 0xFFFF && LineCheckRp(chk, tree->mChild[0])) + ret = true; + if (tree->mChild[1] != 0xFFFF && LineCheckRp(chk, tree->mChild[1])) + ret = true; + if (tree->mChild[2] != 0xFFFF && LineCheckRp(chk, tree->mChild[2])) + ret = true; + if (tree->mChild[3] != 0xFFFF && LineCheckRp(chk, tree->mChild[3])) + ret = true; + if (tree->mChild[4] != 0xFFFF && LineCheckRp(chk, tree->mChild[4])) + ret = true; + if (tree->mChild[5] != 0xFFFF && LineCheckRp(chk, tree->mChild[5])) + ret = true; + if (tree->mChild[6] != 0xFFFF && LineCheckRp(chk, tree->mChild[6])) + ret = true; + if (tree->mChild[7] != 0xFFFF && LineCheckRp(chk, tree->mChild[7])) + ret = true; + return ret; + } } /* 80248868-8024898C .text LineCheckGrpRp__4cBgWFP11cBgS_LinChkii */ -bool cBgW::LineCheckGrpRp(cBgS_LinChk*, int, int) { +bool cBgW::LineCheckGrpRp(cBgS_LinChk* chk, int grp_id, int depth) { /* Nonmatching */ + if (ChkGrpThrough(grp_id, chk->GetGrpPassChk(), depth)) + return false; + + if (!pm_grp[grp_id].aab.Cross(chk->GetLinP())) + return false; + + bool ret = false; + u16 tree = pm_bgd->m_g_tbl[grp_id].m_tree_idx; + if (tree != 0xFFFF && LineCheckRp(chk, tree)) + ret = true; + + s32 child_idx = pm_bgd->m_g_tbl[grp_id].m_first_child; + while (true) { + if (child_idx == 0xFFFF) + break; + if (LineCheckGrpRp(chk, child_idx, depth + 1)) + ret = true; + child_idx = pm_bgd->m_g_tbl[child_idx].m_next_sibling; + } + + return ret; } /* 8024898C-80248AB8 .text RwgGroundCheckCommon__4cBgWFfUsP11cBgS_GndChk */ -bool cBgW::RwgGroundCheckCommon(f32 y, u16 idx, cBgS_GndChk* chk) { - /* Nonmatching */ +bool cBgW::RwgGroundCheckCommon(f32 y, u16 poly_index, cBgS_GndChk* chk) { + if (y < chk->GetPointP()->y && y > chk->GetNowY()) { + cBgD_Tri_t* tri = &pm_bgd->m_t_tbl[poly_index]; + if (cM3d_CrossY_Tri_Front(pm_vtx_tbl[tri->vtx0], pm_vtx_tbl[tri->vtx1], pm_vtx_tbl[tri->vtx2], &chk->m_pos) && !ChkPolyThrough(poly_index, chk->GetPolyPassChk())) { + chk->SetNowY(y); + chk->SetPolyIndex(poly_index); + return true; + } + } + + return false; } /* 80248AB8-80248B68 .text RwgGroundCheckGnd__4cBgWFUsP11cBgS_GndChk */ -bool cBgW::RwgGroundCheckGnd(u16 idx, cBgS_GndChk* chk) { - /* Nonmatching */ +bool cBgW::RwgGroundCheckGnd(u16 poly_index, cBgS_GndChk* chk) { bool ret = false; while (true) { - cBgW_RwgElm * rwg = &pm_rwg[idx]; - cBgW_TriElm * tri = &pm_tri[idx]; + cBgW_RwgElm* rwg = &pm_rwg[poly_index]; + cBgW_TriElm* tri = &pm_tri[poly_index]; f32 y = tri->m_plane.getCrossY_NonIsZero(*chk->GetPointP()); - if (RwgGroundCheckCommon(y, (u16)idx, chk)) + if (RwgGroundCheckCommon(y, (u16)poly_index, chk)) ret = true; - idx = rwg->next; - if (idx == 0xFFFF) + if (rwg->next == 0xFFFF) break; + poly_index = rwg->next; } return ret; } /* 80248B68-80248C38 .text RwgGroundCheckWall__4cBgWFUsP11cBgS_GndChk */ -bool cBgW::RwgGroundCheckWall(u16, cBgS_GndChk*) { - /* Nonmatching */ +bool cBgW::RwgGroundCheckWall(u16 poly_index, cBgS_GndChk* chk) { + bool ret = false; + while (true) { + cBgW_TriElm* tri = &pm_tri[poly_index]; + cBgW_RwgElm* rwg = &pm_rwg[poly_index]; + if (tri->m_plane.mNormal.y >= 0.014f && RwgGroundCheckCommon(tri->m_plane.getCrossY_NonIsZero(*chk->GetPointP()), (u16)poly_index, chk)) + ret = true; + if (rwg->next == 0xFFFF) + break; + poly_index = rwg->next; + } + return ret; } /* 80248C38-802491F4 .text GroundCrossRp__4cBgWFP11cBgS_GndChki */ -void cBgW::GroundCrossRp(cBgS_GndChk*, int) { +bool cBgW::GroundCrossRp(cBgS_GndChk*, int) { /* Nonmatching */ } /* 802491F4-80249368 .text GroundCrossGrpRp__4cBgWFP11cBgS_GndChkii */ -bool cBgW::GroundCrossGrpRp(cBgS_GndChk*, int, int) { +bool cBgW::GroundCrossGrpRp(cBgS_GndChk* chk, int grp_id, int depth) { /* Nonmatching */ + if (ChkGrpThrough(grp_id, chk->GetGrpPassChk(), depth)) + return false; + + bool insideXZ; + cBgW_GrpElm* grp = &pm_grp[grp_id]; + + // is this an inline? also seems to be used in GroundCrossGrp + if (grp->aab.mMin.x > chk->GetPointP()->x || grp->aab.mMax.x < chk->GetPointP()->x || + grp->aab.mMin.z > chk->GetPointP()->z || grp->aab.mMax.z < chk->GetPointP()->z) + insideXZ = false; + else + insideXZ = true; + + if (!insideXZ || (grp->aab.mMin.y > chk->GetPointP()->y || grp->aab.mMax.y < chk->GetNowY())) + return false; + + bool ret = false; + u32 tree_idx = pm_bgd->m_g_tbl[grp_id].m_tree_idx; + if (tree_idx != 0xFFFF && GroundCrossRp(chk, tree_idx)) + ret = true; + + s32 child_idx = pm_bgd->m_g_tbl[grp_id].m_first_child; + while (true) { + if (child_idx == 0xFFFF) + break; + if (GroundCrossGrpRp(chk, child_idx, depth + 1)) + ret = true; + child_idx = pm_bgd->m_g_tbl[child_idx].m_next_sibling; + } + + return ret; } /* 80249368-802493B4 .text CopyOldMtx__4cBgWFv */ @@ -216,18 +562,71 @@ void cBgW::Move() { } /* 80249584-80249698 .text RwgShdwDraw__4cBgWFiP13cBgS_ShdwDraw */ -void cBgW::RwgShdwDraw(int, cBgS_ShdwDraw*) { +void cBgW::RwgShdwDraw(int index, cBgS_ShdwDraw* shdw) { /* Nonmatching */ + while (true) { + cBgW_RwgElm* rwg = &pm_rwg[index]; + if (!ChkShdwDrawThrough(index, shdw->GetPolyPassChk())) { + const cBgD_Tri_t* tri = &pm_bgd->m_t_tbl[index]; + shdw->mCallbackFun(shdw, (cBgD_Vtx_t*)pm_vtx_tbl, tri->vtx0, tri->vtx1, tri->vtx2, &pm_tri[index].m_plane); + } + if (rwg->next == 0xFFFF) + break; + index = rwg->next; + JUT_ASSERT(0xbc6, 0 <= index && index < pm_bgd->m_t_num); + } } /* 80249698-80249840 .text ShdwDrawRp__4cBgWFP13cBgS_ShdwDrawi */ -void cBgW::ShdwDrawRp(cBgS_ShdwDraw*, int) { - /* Nonmatching */ +void cBgW::ShdwDrawRp(cBgS_ShdwDraw* shdw, int i) { + if (!pm_node_tree[i].Cross(shdw->GetBndP())) + return; + + cBgD_Tree_t* tree = &pm_bgd->m_tree_tbl[i]; + if (tree->mFlag & 1) { + if (pm_blk[tree->mBlock].wall != 0xFFFF) + RwgShdwDraw(pm_blk[tree->mBlock].wall, shdw); + if (pm_blk[tree->mBlock].roof != 0xFFFF) + RwgShdwDraw(pm_blk[tree->mBlock].roof, shdw); + if (pm_blk[tree->mBlock].ground != 0xFFFF) + RwgShdwDraw(pm_blk[tree->mBlock].ground, shdw); + } else { + if (tree->mChild[0] != 0xFFFF) + ShdwDrawRp(shdw, tree->mChild[0]); + if (tree->mChild[1] != 0xFFFF) + ShdwDrawRp(shdw, tree->mChild[1]); + if (tree->mChild[2] != 0xFFFF) + ShdwDrawRp(shdw, tree->mChild[2]); + if (tree->mChild[3] != 0xFFFF) + ShdwDrawRp(shdw, tree->mChild[3]); + if (tree->mChild[4] != 0xFFFF) + ShdwDrawRp(shdw, tree->mChild[4]); + if (tree->mChild[5] != 0xFFFF) + ShdwDrawRp(shdw, tree->mChild[5]); + if (tree->mChild[6] != 0xFFFF) + ShdwDrawRp(shdw, tree->mChild[6]); + if (tree->mChild[7] != 0xFFFF) + ShdwDrawRp(shdw, tree->mChild[7]); + } } /* 80249840-80249904 .text ShdwDrawGrpRp__4cBgWFP13cBgS_ShdwDrawi */ -void cBgW::ShdwDrawGrpRp(cBgS_ShdwDraw*, int) { - /* Nonmatching */ +void cBgW::ShdwDrawGrpRp(cBgS_ShdwDraw* shdw, int grp_id) { + if (!pm_grp[grp_id].aab.Cross(shdw->GetBndP())) + return; + + u32 tree_idx = pm_bgd->m_g_tbl[grp_id].m_tree_idx; + if (tree_idx != 0xFFFF) { + ShdwDrawRp(shdw, tree_idx); + } + + s32 child_idx = pm_bgd->m_g_tbl[grp_id].m_first_child; + while (true) { + if (child_idx == 0xFFFF) + break; + ShdwDrawGrpRp(shdw, child_idx); + child_idx = pm_bgd->m_g_tbl[child_idx].m_next_sibling; + } } /* 80249904-8024990C .text ChkPolyThrough__4cBgWFiP16cBgS_PolyPassChk */ @@ -272,8 +671,7 @@ void cBgW::GetTriPnt(int i_no, cXyz* p0, cXyz* p1, cXyz* p2) const { } /* 80249B64-80249BA0 .text GetTopUnder__4cBgWCFPfPf */ -void cBgW::GetTopUnder(f32* min, f32* max) const { - /* Nonmatching */ - *min = pm_grp[m_rootGrpIdx].aab.mMin.y; - *max = pm_grp[m_rootGrpIdx].aab.mMax.y; +void cBgW::GetTopUnder(f32* max, f32* min) const { + *min = pm_grp[m_rootGrpIdx].aab.GetMinP()->y; + *max = pm_grp[m_rootGrpIdx].aab.GetMaxP()->y; } diff --git a/src/SSystem/SComponent/c_cc_d.cpp b/src/SSystem/SComponent/c_cc_d.cpp index 5d88b46d5..01dd30c97 100644 --- a/src/SSystem/SComponent/c_cc_d.cpp +++ b/src/SSystem/SComponent/c_cc_d.cpp @@ -358,17 +358,17 @@ bool cCcD_CpsAttr::GetNVec(const cXyz& vec, cXyz* dst) const { return false; cXyz p0_v; - VECSubtract(&vec, &GetStartP(), &p0_v); + VECSubtract(&vec, GetStartP(), &p0_v); f32 dot = p0_v.getDotProduct(lin) / len; cXyz pt; if (dot < 0.0f) { - pt.set(GetStartP()); + pt.set(*GetStartP()); } else if (dot > 1.0f) { - pt.set(GetEndP()); + pt.set(*GetEndP()); } else { VECScale(&lin, &lin, dot); - VECAdd(&lin, &GetStartP(), &pt); + VECAdd(&lin, GetStartP(), &pt); } VECSubtract(&vec, &pt, dst); diff --git a/src/SSystem/SComponent/c_m3d.cpp b/src/SSystem/SComponent/c_m3d.cpp index 2d3897e9d..973c1f628 100644 --- a/src/SSystem/SComponent/c_m3d.cpp +++ b/src/SSystem/SComponent/c_m3d.cpp @@ -179,7 +179,7 @@ int cM3d_Check_LinLin(const cM3dGLin* lin_a, const cM3dGLin* lin_b, f32* dst_a, VECScale(&linAVec, &linAVec, invLinALen); VECScale(&linBVec, &linBVec, invLinBLen); Vec tmp; - VECSubtract(&lin_a->GetStartP(), &lin_b->GetStartP(), &tmp); + VECSubtract(lin_a->GetStartP(), lin_b->GetStartP(), &tmp); f32 tmpF = -VECDotProduct(&linAVec, &linBVec); f32 tmpF2 = VECDotProduct(&tmp, &linAVec); VECSquareMag(&tmp); // result not used @@ -217,22 +217,22 @@ int cM3d_Check_LinLin(const cM3dGLin* lin_a, const cM3dGLin* lin_b, f32* dst_a, /* 8024ACA8-8024AE3C .text cM3d_Cross_LinPla__FPC8cM3dGLinPC8cM3dGPlaP3Vecbb */ bool cM3d_Cross_LinPla(const cM3dGLin* lin, const cM3dGPla* pla, Vec* dst, bool a, bool b) { - f32 startVal = pla->getPlaneFunc(&lin->GetStartP()); - f32 endVal = pla->getPlaneFunc(&lin->GetEndP()); + f32 startVal = pla->getPlaneFunc(lin->GetStartP()); + f32 endVal = pla->getPlaneFunc(lin->GetEndP()); if (startVal * endVal > 0.0f) { - *dst = lin->GetEndP(); + *dst = *lin->GetEndP(); return false; } else { if (startVal >= 0.0f && endVal <= 0.0f) { if (a) { - return cM3d_CrossInfLineVsInfPlane_proc(startVal, endVal, &lin->GetStartP(), &lin->GetEndP(), dst); + return cM3d_CrossInfLineVsInfPlane_proc(startVal, endVal, lin->GetStartP(), lin->GetEndP(), dst); } } else { if (b) { - return cM3d_CrossInfLineVsInfPlane_proc(startVal, endVal, &lin->GetStartP(), &lin->GetEndP(), dst); + return cM3d_CrossInfLineVsInfPlane_proc(startVal, endVal, lin->GetStartP(), lin->GetEndP(), dst); } } - *dst = lin->GetEndP(); + *dst = *lin->GetEndP(); return false; } } @@ -540,22 +540,22 @@ int cM3d_2PlaneCrossLine(const cM3dGPla& pPlaneA, const cM3dGPla& pPlaneB, cM3dG if (absTX >= absTY && absTX >= absTZ) { cM3d_PlaneCrossLineProcWork(pPlaneA.GetNP()->y, pPlaneA.GetNP()->z, pPlaneB.GetNP()->y, pPlaneB.GetNP()->z, tmp.x, pPlaneA.GetD(), pPlaneB.GetD(), - &pLinOut->GetStartP().y, &pLinOut->GetStartP().z); - pLinOut->GetStartP().x = 0.0f; + &pLinOut->GetStartP()->y, &pLinOut->GetStartP()->z); + pLinOut->GetStartP()->x = 0.0f; } else if (absTY >= absTX && absTY >= absTZ) { cM3d_PlaneCrossLineProcWork(pPlaneA.GetNP()->z, pPlaneA.GetNP()->x, pPlaneB.GetNP()->z, pPlaneB.GetNP()->x, tmp.y, pPlaneA.GetD(), pPlaneB.GetD(), - &pLinOut->GetStartP().z, &pLinOut->GetStartP().x); - pLinOut->GetStartP().y = 0.0f; + &pLinOut->GetStartP()->z, &pLinOut->GetStartP()->x); + pLinOut->GetStartP()->y = 0.0f; } else { cM3d_PlaneCrossLineProcWork(pPlaneA.GetNP()->x, pPlaneA.GetNP()->y, pPlaneB.GetNP()->x, pPlaneB.GetNP()->y, tmp.z, pPlaneA.GetD(), pPlaneB.GetD(), - &pLinOut->GetStartP().x, &pLinOut->GetStartP().y); - pLinOut->GetStartP().z = 0.0f; + &pLinOut->GetStartP()->x, &pLinOut->GetStartP()->y); + pLinOut->GetStartP()->z = 0.0f; } - f32 scale = VECMag(&pLinOut->GetStartP()); + f32 scale = VECMag(pLinOut->GetStartP()); VECScale(&tmp, &tmp, scale); - VECAdd(&pLinOut->GetStartP(), &tmp, &pLinOut->GetEndP()); + VECAdd(pLinOut->GetStartP(), &tmp, pLinOut->GetEndP()); return 1; } } @@ -585,13 +585,13 @@ f32 cM3d_lineVsPosSuisenCross(const cM3dGLin* g_lin, const Vec* pt, Vec* dst) { } Vec p0_v; - VECSubtract(pt, &g_lin->GetStartP(), &p0_v); + VECSubtract(pt, g_lin->GetStartP(), &p0_v); f32 dot = VECDotProduct(&p0_v, &lin); f32 v = dot / len; Vec ret; VECScale(&lin, &ret, v); - VECAdd(&ret, &g_lin->GetStartP(), dst); + VECAdd(&ret, g_lin->GetStartP(), dst); return v; } diff --git a/src/d/actor/d_a_agb.cpp b/src/d/actor/d_a_agb.cpp index a28961005..9bb53a1e2 100644 --- a/src/d/actor/d_a_agb.cpp +++ b/src/d/actor/d_a_agb.cpp @@ -1568,11 +1568,11 @@ static int daAgb_Create(fopAc_ac_c* i_this) { return cPhs_ERROR_e; } - a_this->mCrrPos.Set(&fopAcM_GetPosition_p(a_this), &fopAcM_GetOldPosition_p(a_this), (void*)NULL, NULL); + a_this->mCrrPos.Set(fopAcM_GetPosition_p(a_this), fopAcM_GetOldPosition_p(a_this), (void*)NULL, NULL); a_this->mCrrPos.SetWall(171.0f, 50.0f); a_this->mCrrPos.SetGndUpY(170.0f); a_this->mCrrPos.ClrNoRoof(); - a_this->mAcch.Set(&fopAcM_GetPosition_p(a_this), &fopAcM_GetOldPosition_p(a_this), a_this, 1, &a_this->mAcchCir); + a_this->mAcch.Set(fopAcM_GetPosition_p(a_this), fopAcM_GetOldPosition_p(a_this), a_this, 1, &a_this->mAcchCir); a_this->mAcch.OnLineCheck(); a_this->mAcch.SetGrndNone(); a_this->mAcchCir.SetWall(171.0f, 40.0f); diff --git a/src/d/actor/d_a_am.cpp b/src/d/actor/d_a_am.cpp index 3a9cb9777..95fda2183 100644 --- a/src/d/actor/d_a_am.cpp +++ b/src/d/actor/d_a_am.cpp @@ -1241,8 +1241,8 @@ static s32 daAM_Create(fopAc_ac_c* i_actor) { i_this->mAttentionInfo.mFlags = 0; i_this->mAcch.Set( - &fopAcM_GetPosition_p(i_this), &fopAcM_GetOldPosition_p(i_this), - i_this, 1, &i_this->mAcchCir, &fopAcM_GetSpeed_p(i_this) + fopAcM_GetPosition_p(i_this), fopAcM_GetOldPosition_p(i_this), + i_this, 1, &i_this->mAcchCir, fopAcM_GetSpeed_p(i_this) ); i_this->mStts.Init(254, 1, i_this); diff --git a/src/d/actor/d_a_am2.cpp b/src/d/actor/d_a_am2.cpp index e244406ca..20055d3f2 100644 --- a/src/d/actor/d_a_am2.cpp +++ b/src/d/actor/d_a_am2.cpp @@ -1347,8 +1347,8 @@ static s32 daAM2_Create(fopAc_ac_c* i_actor) { i_this->mAttentionInfo.mFlags = 0; i_this->mAcch.Set( - &fopAcM_GetPosition_p(i_this), &fopAcM_GetOldPosition_p(i_this), - i_this, 1, &i_this->mAcchCir, &fopAcM_GetSpeed_p(i_this) + fopAcM_GetPosition_p(i_this), fopAcM_GetOldPosition_p(i_this), + i_this, 1, &i_this->mAcchCir, fopAcM_GetSpeed_p(i_this) ); i_this->mStts.Init(254, 1, i_this); diff --git a/src/d/actor/d_a_arrow.cpp b/src/d/actor/d_a_arrow.cpp index 9c49cb6ed..6dab73289 100644 --- a/src/d/actor/d_a_arrow.cpp +++ b/src/d/actor/d_a_arrow.cpp @@ -754,7 +754,7 @@ BOOL daArrow_c::procMove() { setStopActorMatrix(); } } else if (dComIfG_Bgsp()->LineCross(&mLinChk)) { - cXyz* linEnd = &mLinChk.GetLinP()->GetEndP(); + cXyz* linEnd = mLinChk.GetLinP()->GetEndP(); field_0x6a8 = *linEnd; current.pos = *linEnd - (speed * 0.25f); diff --git a/src/d/actor/d_a_beam.cpp b/src/d/actor/d_a_beam.cpp index 5ed10c783..8fa8ac5f3 100644 --- a/src/d/actor/d_a_beam.cpp +++ b/src/d/actor/d_a_beam.cpp @@ -4,7 +4,7 @@ // #include "d/actor/d_a_beam.h" -#include "dolphin/types.h" +#include "d/d_cc_d.h" /* 000000EC-00000118 .text __ct__12daBeam_HIO_cFv */ daBeam_HIO_c::daBeam_HIO_c() { diff --git a/src/d/actor/d_a_bk.cpp b/src/d/actor/d_a_bk.cpp index ee9a648f6..ab5c2a487 100644 --- a/src/d/actor/d_a_bk.cpp +++ b/src/d/actor/d_a_bk.cpp @@ -809,9 +809,9 @@ static s32 daBk_Create(fopAc_ac_c* i_actor) { } i_this->mDamageReaction.mAcch.Set( - &fopAcM_GetPosition_p(i_this), &fopAcM_GetOldPosition_p(i_this), + fopAcM_GetPosition_p(i_this), fopAcM_GetOldPosition_p(i_this), i_this, 1, &i_this->mDamageReaction.mAcchCir, - &fopAcM_GetSpeed_p(i_this) + fopAcM_GetSpeed_p(i_this) ); i_this->mDamageReaction.mAcchCir.SetWall(40.0f, 40.0f); i_this->mDamageReaction.mAcch.ClrRoofNone(); diff --git a/src/d/actor/d_a_ghostship.cpp b/src/d/actor/d_a_ghostship.cpp index 045b55438..cc35a9a5f 100644 --- a/src/d/actor/d_a_ghostship.cpp +++ b/src/d/actor/d_a_ghostship.cpp @@ -217,7 +217,7 @@ void daGhostship_c::createInit() { } mCir.SetWall(30.0f, 30.0f); - mAcch.Set(&fopAcM_GetPosition_p(this), &fopAcM_GetOldPosition_p(this), this, 1, &mCir, &fopAcM_GetSpeed_p(this)); + mAcch.Set(fopAcM_GetPosition_p(this), fopAcM_GetOldPosition_p(this), this, 1, &mCir, fopAcM_GetSpeed_p(this)); mAcch.SetWallNone(); mAcch.SetRoofNone(); dLib_waveRot(¤t.pos, 0.0f, &mWave); diff --git a/src/d/actor/d_a_item.cpp b/src/d/actor/d_a_item.cpp index a912c4b76..a340aa9ca 100644 --- a/src/d/actor/d_a_item.cpp +++ b/src/d/actor/d_a_item.cpp @@ -134,7 +134,7 @@ void itemGetCallBack(fopAc_ac_c* item_actor, dCcD_GObjInf*, fopAc_ac_c* collided /* 800F5044-800F53EC .text CreateInit__8daItem_cFv */ void daItem_c::CreateInit() { mAcchCir.SetWall(30.0f, 30.0f); - mAcch.Set(¤t.pos, &old.pos, this, 1, &mAcchCir, &fopAcM_GetSpeed_p(this)); + mAcch.Set(¤t.pos, &old.pos, this, 1, &mAcchCir, fopAcM_GetSpeed_p(this)); mAcch.m_flags &= ~0x400; mAcch.m_flags &= ~0x8; fopAcM_SetMtx(this, mpModel->getBaseTRMtx()); @@ -157,7 +157,7 @@ void daItem_c::CreateInit() { mDisappearTimer = getData()->mDuration; field_0x65a = getData()->field_0x18; - field_0x650 = fopAcM_GetSpeed_p(this).y; + field_0x650 = fopAcM_GetSpeed(this).y; mItemStatus = 0; mType = daItem_prm::getType(this); diff --git a/src/d/actor/d_a_kanban.cpp b/src/d/actor/d_a_kanban.cpp index a1676fa11..cd4e6040c 100644 --- a/src/d/actor/d_a_kanban.cpp +++ b/src/d/actor/d_a_kanban.cpp @@ -4,7 +4,7 @@ // #include "d/actor/d_a_kanban.h" -#include "dolphin/types.h" +#include "JSystem/J3DGraphAnimator/J3DModel.h" /* 000000EC-0000012C .text __ct__14daKanban_HIO_cFv */ daKanban_HIO_c::daKanban_HIO_c() { diff --git a/src/d/actor/d_a_kui.cpp b/src/d/actor/d_a_kui.cpp index 3eab41353..04cc0ba65 100644 --- a/src/d/actor/d_a_kui.cpp +++ b/src/d/actor/d_a_kui.cpp @@ -6,6 +6,8 @@ #include "d/actor/d_a_kui.h" #include "dolphin/types.h" +class J3DModelData; + /* 00000078-000000C4 .text s_a_i_sub__FPvPv */ void s_a_i_sub(void*, void*) { /* Nonmatching */ diff --git a/src/d/actor/d_a_npc_btsw2.cpp b/src/d/actor/d_a_npc_btsw2.cpp index c540d49e3..3be5a8f0c 100644 --- a/src/d/actor/d_a_npc_btsw2.cpp +++ b/src/d/actor/d_a_npc_btsw2.cpp @@ -145,17 +145,17 @@ daNpc_Btsw2_HIO_c::daNpc_Btsw2_HIO_c() { const char daNpc_Btsw2_c::m_arc_name[] = "Btsw"; static const int l_bck_ix_tbl[] = { - BTSW_INDEX_BCK_BN_WAIT01, - BTSW_INDEX_BCK_BN_WAIT02, - BTSW_INDEX_BCK_BN_TALK01, - BTSW_INDEX_BCK_BN_TALK02, - BTSW_INDEX_BCK_BN_ONEGAI, - BTSW_INDEX_BCK_BN_SUGOI, - BTSW_INDEX_BCK_BN_SUGOI, - BTSW_INDEX_BCK_BN_WALK, - BTSW_INDEX_BCK_BN_KASIGE, - BTSW_INDEX_BCK_BN_SIWAKE01, - BTSW_INDEX_BCK_BN_SIWAKE02, + BTSW_INDEX_BCK_BN_WAIT01, + BTSW_INDEX_BCK_BN_WAIT02, + BTSW_INDEX_BCK_BN_TALK01, + BTSW_INDEX_BCK_BN_TALK02, + BTSW_INDEX_BCK_BN_ONEGAI, + BTSW_INDEX_BCK_BN_SUGOI, + BTSW_INDEX_BCK_BN_SUGOI, + BTSW_INDEX_BCK_BN_WALK, + BTSW_INDEX_BCK_BN_KASIGE, + BTSW_INDEX_BCK_BN_SIWAKE01, + BTSW_INDEX_BCK_BN_SIWAKE02, }; static const int l_btp_ix_tbl[] = { diff --git a/src/d/actor/d_a_obj_ajav.cpp b/src/d/actor/d_a_obj_ajav.cpp index 125a7465a..6e51bb70c 100644 --- a/src/d/actor/d_a_obj_ajav.cpp +++ b/src/d/actor/d_a_obj_ajav.cpp @@ -181,11 +181,6 @@ BOOL daObjAjav::Act_c::_execute() { /* Nonmatching */ } -/* 00002CF4-00002D50 .text set_se_pos__Q29daObjAjav6Part_cF4cXyz */ -void daObjAjav::Part_c::set_se_pos(cXyz) { - /* Nonmatching */ -} - /* 00002D50-00002DCC .text _draw__Q29daObjAjav5Act_cFv */ BOOL daObjAjav::Act_c::_draw() { /* Nonmatching */ diff --git a/src/d/actor/d_a_obj_hami2.cpp b/src/d/actor/d_a_obj_hami2.cpp index 7a13a81e4..388a95afe 100644 --- a/src/d/actor/d_a_obj_hami2.cpp +++ b/src/d/actor/d_a_obj_hami2.cpp @@ -4,7 +4,7 @@ // #include "d/actor/d_a_obj_hami2.h" -#include "dolphin/types.h" +#include "m_Do/m_Do_ext.h" /* 00000078-0000012C .text nodeCallBack__FP7J3DNodei */ static BOOL nodeCallBack(J3DNode*, int) { diff --git a/src/d/actor/d_a_obj_hami3.cpp b/src/d/actor/d_a_obj_hami3.cpp index 6ed90c039..4016b073a 100644 --- a/src/d/actor/d_a_obj_hami3.cpp +++ b/src/d/actor/d_a_obj_hami3.cpp @@ -4,7 +4,7 @@ // #include "d/actor/d_a_obj_hami3.h" -#include "dolphin/types.h" +#include "m_Do/m_Do_ext.h" /* 00000078-0000012C .text nodeCallBack__FP7J3DNodei */ static BOOL nodeCallBack(J3DNode*, int) { diff --git a/src/d/actor/d_a_player_main.cpp b/src/d/actor/d_a_player_main.cpp index 7c06be9d3..23fb0c866 100644 --- a/src/d/actor/d_a_player_main.cpp +++ b/src/d/actor/d_a_player_main.cpp @@ -3669,7 +3669,7 @@ BOOL daPy_lk_c::playerDelete() { mDoAud_seDeleteObject(&mSwordTopPos); mDoAud_seDeleteObject(&mRopePos); mDoAud_seDeleteObject(&m338C.field_0x08); - mDoAud_seDeleteObject(&mFanWindCps.GetEndP()); + mDoAud_seDeleteObject(mFanWindCps.GetEndP()); for (i = 0; i < (int)ARRAY_SIZE(m_anm_heap_under); i++) { mDoExt_destroySolidHeap(m_anm_heap_under[i].mpAnimeHeap); diff --git a/src/d/actor/d_a_player_sword.inc b/src/d/actor/d_a_player_sword.inc index 4b61dd1ff..df7f39d8a 100644 --- a/src/d/actor/d_a_player_sword.inc +++ b/src/d/actor/d_a_player_sword.inc @@ -27,7 +27,7 @@ void daPy_lk_c::setSwordModel(BOOL r28) { /* 0x0E */ u16 tipStabBrk; }; static const sword_model_tbl_s sword_model_tbl[] = { - { + { LINK_BDL_SWA, LINK_BDL_YHSLS00, LKANM_BTK_YHSLS00, @@ -37,7 +37,7 @@ void daPy_lk_c::setSwordModel(BOOL r28) { LKANM_BTK_CUTFH, LKANM_BRK_CUTFH }, - { + { LINK_BDL_SWMS, LINK_BDL_YMSLI00, LKANM_BTK_YMSLI00, diff --git a/src/d/actor/d_a_rd.cpp b/src/d/actor/d_a_rd.cpp index 5ba205c27..a47a2d95e 100644 --- a/src/d/actor/d_a_rd.cpp +++ b/src/d/actor/d_a_rd.cpp @@ -839,7 +839,7 @@ void daRd_c::modeDeath() { fopAcM_onActor(this); // Do not consider the ReDead to be a living enemy while its death animation is playing out. - mGroup = fopAc_ENV_e; + fopAcM_SetGroup(this, fopAc_ENV_e); if (cLib_calcTimer(&mTimer1) == 0) { fopAcM_createDisappear(this, ¤t.pos, 5); @@ -1773,7 +1773,7 @@ void daRd_c::createInit() { mCyl.Set(m_cyl_src); mCyl.SetStts(&mStts); mAcchCir.SetWall(30.0f, 30.0f); - mAcch.Set(&fopAcM_GetPosition_p(this), &fopAcM_GetOldPosition_p(this), this, 1, &mAcchCir, &fopAcM_GetSpeed_p(this)); + mAcch.Set(fopAcM_GetPosition_p(this), fopAcM_GetOldPosition_p(this), this, 1, &mAcchCir, fopAcM_GetSpeed_p(this)); mAcch.SetRoofNone(); J3DModelData* modelData = mpMorf->getModel()->getModelData(); mJntCtrl.setHeadJntNum(0x0A); // ree_kubi_1 diff --git a/src/d/actor/d_a_saku.cpp b/src/d/actor/d_a_saku.cpp index 5adf446cc..5412eacd3 100644 --- a/src/d/actor/d_a_saku.cpp +++ b/src/d/actor/d_a_saku.cpp @@ -6,6 +6,9 @@ #include "d/actor/d_a_saku.h" #include "dolphin/types.h" +class J3DModelData; +class J3DMaterial; + /* 000000EC-00000200 .text CreateInit__8daSaku_cFv */ void daSaku_c::CreateInit() { /* Nonmatching */ @@ -127,7 +130,7 @@ static s32 daSaku_Create(fopAc_ac_c*) { } /* 00001BB8-00001F28 .text _daSaku_create__8daSaku_cFv */ -void daSaku_c::_daSaku_create() { +s32 daSaku_c::_daSaku_create() { /* Nonmatching */ } diff --git a/src/d/actor/d_a_salvage.cpp b/src/d/actor/d_a_salvage.cpp index 5bb652973..70463c349 100644 --- a/src/d/actor/d_a_salvage.cpp +++ b/src/d/actor/d_a_salvage.cpp @@ -165,19 +165,3 @@ static BOOL daSalvageDraw(void*) { static BOOL daSalvageIsDelete(void*) { /* Nonmatching */ } - -/* 000025A4-000025EC .text setPos__11daSalvage_cFi4cXyz */ -void daSalvage_c::setPos(int, cXyz) { - /* Nonmatching */ -} - -/* 000025EC-00002620 .text getPos__11daSalvage_cFi */ -void daSalvage_c::getPos(int) { - /* Nonmatching */ -} - -/* 00002620-00002654 .text getScale__11daSalvage_cFi */ -void daSalvage_c::getScale(int) { - /* Nonmatching */ -} - diff --git a/src/d/actor/d_a_sk2.cpp b/src/d/actor/d_a_sk2.cpp index 00cbdc961..f3efd2832 100644 --- a/src/d/actor/d_a_sk2.cpp +++ b/src/d/actor/d_a_sk2.cpp @@ -5,6 +5,7 @@ #include "d/actor/d_a_sk2.h" #include "m_Do/m_Do_ext.h" +#include "d/d_bg_w_sv.h" /* 00000078-00000194 .text nodeCallBack__FP7J3DNodei */ static BOOL nodeCallBack(J3DNode*, int) { @@ -45,9 +46,3 @@ static BOOL useHeapInit(fopAc_ac_c*) { static s32 daSk2_Create(fopAc_ac_c*) { /* Nonmatching */ } - -/* 00000C78-00000C7C .text MatrixCrrPos__6dBgWSvFR13cBgS_PolyInfoPvbP4cXyzP5csXyzP5csXyz */ -void dBgWSv::MatrixCrrPos(cBgS_PolyInfo&, void*, bool, cXyz*, csXyz*, csXyz*) { - /* Nonmatching */ -} - diff --git a/src/d/actor/d_a_tag_attention.cpp b/src/d/actor/d_a_tag_attention.cpp index 807967661..a5588a5b1 100644 --- a/src/d/actor/d_a_tag_attention.cpp +++ b/src/d/actor/d_a_tag_attention.cpp @@ -15,7 +15,3 @@ s32 daTagAttention::Act_c::_create() { BOOL daTagAttention::Act_c::_execute() { /* Nonmatching */ } -/* 000005C4-000007E0 .text chk_inside__Q214daTagAttention5Act_cCFP4cXyz */ -void daTagAttention::Act_c::chk_inside(cXyz*) const { - /* Nonmatching */ -} diff --git a/src/d/d_attention.cpp b/src/d/d_attention.cpp index 8b38898af..39e25ab44 100644 --- a/src/d/d_attention.cpp +++ b/src/d/d_attention.cpp @@ -17,7 +17,6 @@ u32 dAttention_c::act_type_num = 5; /* 8009D220-8009D268 .text __ct__11dAttParam_cFl */ dAttParam_c::dAttParam_c(s32) { - /* Nonmatching */ field_0x04 = 45.0f; field_0x08 = 30.0f; field_0x0c = 90.0f; @@ -41,7 +40,6 @@ bool dAttDraw_CallBack_c::execute(u16 timing, J3DTransformInfo* xform) { /* 8009D2E0-8009D654 .text __ct__12dAttention_cFP10fopAc_ac_cUl */ dAttention_c::dAttention_c(fopAc_ac_c* player, u32 playerNo) { - /* Nonmatching */ mpPlayer = (daPy_lk_c*)player; mPlayerNo = playerNo; initList(0xFFFFFFFF); @@ -88,6 +86,7 @@ dAttention_c::dAttention_c(fopAc_ac_c* player, u32 playerNo) { mCatch.init(); mLook[0].init(); mLook[1].init(); + new(&mAttParam) dAttParam_c(0); } /* 8009D654-8009D6EC .text __dt__12dAttention_cFv */ diff --git a/src/d/d_bg_w_sv.cpp b/src/d/d_bg_w_sv.cpp index 3a443ff73..b357d16b6 100644 --- a/src/d/d_bg_w_sv.cpp +++ b/src/d/d_bg_w_sv.cpp @@ -3,7 +3,7 @@ // Translation Unit: d_bg_w_sv.cpp // -#include "d_bg_w_sv.h" +#include "d/d_bg_w_sv.h" #include "dolphin/types.h" /* 800AABFC-800AAC84 .text Set__6dBgWSvFP6cBgD_tUl */ @@ -35,9 +35,3 @@ void dBgWSv::TransPosWork(cXyz*, int, int, int) { void dBgWSv::TransPos(cBgS_PolyInfo&, void*, bool, cXyz*, csXyz*, csXyz*) { /* Nonmatching */ } - -/* 800AB23C-800AB2AC .text __dt__6dBgWSvFv */ -dBgWSv::~dBgWSv() { - /* Nonmatching */ -} - diff --git a/src/d/d_drawlist.cpp b/src/d/d_drawlist.cpp index 3a94f6540..abd8e662c 100644 --- a/src/d/d_drawlist.cpp +++ b/src/d/d_drawlist.cpp @@ -1556,10 +1556,10 @@ void dDlst_alphaVolPacket::draw() { GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0); GXClearVtxDesc(); GXSetVtxDesc(GX_VA_POS, GX_INDEX8); - GXSetArray(GX_VA_POS, (void*)l_simpleShadowPos, ARRAY_SIZE(l_simpleShadowPos)); + GXSetArray(GX_VA_POS, (void*)l_simpleShadowPos, 0x0C); GXLoadPosMtxImm(mtx, GX_PNMTX0); GXSetCurrentMtx(GX_PNMTX0); - GXCallDisplayList(l_frontMat, 0x40); + GXCallDisplayList(l_frontMat, 0x40) GXCallDisplayList(l_shadowVolumeDL, 0x40); GXCallDisplayList(l_backSubMat, 0x20); GXCallDisplayList(l_shadowVolumeDL, 0x40); @@ -1576,7 +1576,7 @@ void dDlst_alphaInvVolPacket::draw() { GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0); GXClearVtxDesc(); GXSetVtxDesc(GX_VA_POS, GX_INDEX8); - GXSetArray(GX_VA_POS, (void*)l_simpleShadowPos, ARRAY_SIZE(l_simpleShadowPos)); + GXSetArray(GX_VA_POS, (void*)l_simpleShadowPos, 0x0C); GXLoadPosMtxImm(mtx, GX_PNMTX0); GXSetCurrentMtx(GX_PNMTX0); GXSetTevColor(GX_TEVREG0, g_whiteColor); diff --git a/src/d/d_timer.cpp b/src/d/d_timer.cpp index 2990c3245..318590e10 100644 --- a/src/d/d_timer.cpp +++ b/src/d/d_timer.cpp @@ -50,8 +50,9 @@ u32 VolcanoSeTable[] = { s32 dTimer_c::_create() { /* Nonmatching */ s32 rt = dComIfG_resLoad(&mPhs, "Timer"); + fopMsg_prm_timer* prm; if (rt == cPhs_COMPLEATE_e) { - fopMsg_prm_timer* prm = (fopMsg_prm_timer*)fopMsgM_GetAppend(this); + prm = (fopMsg_prm_timer*)fopMsgM_GetAppend(this); if (prm == NULL) return cPhs_ERROR_e; @@ -78,60 +79,61 @@ s32 dTimer_c::_create() { } else { return cPhs_ERROR_e; } + } else { + return rt; + } - mpScrnDraw->setRupeePos(prm->mRupeePos.x, prm->mRupeePos.y); - mpScrnDraw->setTimerPos(prm->mTimerPos.x, prm->mTimerPos.y); - mpScrnDraw->setShowType(prm->mShowType); - mTimerMode = prm->mTimerMode; - if (mTimerMode == 7) { - mLimitTime = OSMillisecondsToTicks(dComIfG_getTimerRestTimeMs()); - OSTime curTime = OSGetTime(); - mStartTime = curTime; - mTime = curTime; - mStartTime = dComIfG_getTimerNowTimeMs(); - mState = 0; - mTimerMode = dComIfG_getTimerMode(); - dComIfG_setTimerNowTimeMs(getTimeMs()); - dComIfG_setTimerLimitTimeMs(getLimitTimeMs()); - dComIfG_setTimerMode(mTimerMode); - dComIfG_setTimerPtr(this); - if (dComIfG_getTimerMode() == 3) - mpScrnDraw->setShowType(1); - stock_start(10); - } else { - mLimitTime = OSSecondsToTicks(prm->field_0x20); - mStartTime = 0; - mTime = 0; - mState = 0; - dComIfG_setTimerNowTimeMs(getTimeMs()); - dComIfG_setTimerLimitTimeMs(getLimitTimeMs()); - dComIfG_setTimerMode(mTimerMode); - dComIfG_setTimerPtr(this); - } + mpScrnDraw->setRupeePos(prm->mRupeePos.x, prm->mRupeePos.y); + mpScrnDraw->setTimerPos(prm->mTimerPos.x, prm->mTimerPos.y); + mpScrnDraw->setShowType(prm->mShowType); + mTimerMode = prm->mTimerMode; + if (mTimerMode == 7) { + mLimitTime = OSMillisecondsToTicks((OSTime)dComIfG_getTimerLimitTimeMs()); + OSTime curTime = OSGetTime(); + mTime = mStartTime = curTime; + mStartTime -= OSMillisecondsToTicks((OSTime)dComIfG_getTimerNowTimeMs()); + mState = 0; + mTimerMode = dComIfG_getTimerMode(); + dComIfG_setTimerNowTimeMs(getTimeMs()); + dComIfG_setTimerLimitTimeMs(getLimitTimeMs()); + dComIfG_setTimerMode(mTimerMode); + dComIfG_setTimerPtr(this); + if (dComIfG_getTimerMode() == 3) + mpScrnDraw->setShowType(1); + stock_start(10); + } else { + mLimitTime = OSSecondsToTicks((OSTime)prm->mLimitTimeMs); + mStartTime = 0; + mTime = 0; + mState = 0; + dComIfG_setTimerNowTimeMs(getTimeMs()); + dComIfG_setTimerLimitTimeMs(getLimitTimeMs()); + dComIfG_setTimerMode(mTimerMode); + dComIfG_setTimerPtr(this); + } - field_0x120 = 0; - field_0x128 = 0; - field_0x130 = 0; - field_0x138 = 0; - field_0x162 = 0; - field_0x163 = 0; - field_0x158 = 120; - field_0x15c = 0; + field_0x120 = 0; + field_0x128 = 0; + field_0x130 = 0; + field_0x138 = 0; + field_0x162 = 0; + field_0x163 = 0; + field_0x158 = 120; + field_0x15c = 0; - u32* seTable = NULL; - field_0x16c = 0; - field_0x168 = 0; - switch (mTimerMode) { - case 2: seTable = ShipRaceSeTable; break; - case 3: seTable = VolcanoSeTable; break; - } - if (seTable != NULL) { - while (field_0x168 >= 0) { - field_0x168 = seTable[field_0x16c * 2 + 0]; - if (getRestTimeMs() > field_0x168) - break; - field_0x16c++; - } + u32* seTable = NULL; + field_0x16c = 0; + field_0x168 = 0; + switch (mTimerMode) { + case 2: seTable = ShipRaceSeTable; break; + case 3: seTable = VolcanoSeTable; break; + } + if (seTable != NULL) { + while (field_0x168 >= 0) { + field_0x168 = seTable[field_0x16c * 2 + 0]; + if (getRestTimeMs() > field_0x168) + break; + field_0x16c++; } } @@ -277,7 +279,7 @@ bool dTimer_c::stock_start() { OSTime time = OSGetTime(); mStartTime = time; mTime = time; - mStartTime -= OSMillisecondsToTicks(dComIfG_getTimerNowTimeMs()); + mStartTime -= OSMillisecondsToTicks((OSTime)dComIfG_getTimerNowTimeMs()); return true; } else { return false; @@ -355,7 +357,9 @@ s32 dTimer_c::getLimitTimeMs() { /* 8023C628-8023C69C .text getRestTimeMs__8dTimer_cFv */ s32 dTimer_c::getRestTimeMs() { /* Nonmatching */ - return OSTicksToMilliseconds((mTime - mStartTime - field_0x138) - mLimitTime); + OSTime time = mTime - mStartTime - field_0x138; + time = mLimitTime - time; + return OSTicksToMilliseconds(time); } /* 8023C69C-8023CA24 .text setScreen__21dDlst_TimerScrnDraw_cFPCcP10JKRArchive */ @@ -420,14 +424,15 @@ const char* dDlst_TimerScrnDraw_c::getNumber(int no) { void dDlst_TimerScrnDraw_c::setTimer(int time) { /* Nonmatching */ s32 minsec = time / 1000; + s32 ms = time % 1000; s32 min = minsec / 60; s32 sec = minsec % 60; changeNumberTexture(mTimerNumber0.pane, min / 10); changeNumberTexture(mTimerNumber[0], min % 10); changeNumberTexture(mTimerNumber[1], sec / 10); changeNumberTexture(mTimerNumber[2], sec % 10); - changeNumberTexture(mTimerNumber[3], (time % 1000) / 100); - changeNumberTexture(mTimerNumber[4], ((time % 1000) / 100) / 10); + changeNumberTexture(mTimerNumber[3], ms / 100); + changeNumberTexture(mTimerNumber[4], (ms % 100) / 10); if (dComIfGp_event_getMode() == 1) { if (mClockIcon.mUserArea < 5) { mClockIcon.mUserArea++; @@ -643,7 +648,6 @@ bool dDlst_TimerScrnDraw_c::hide() { /* 8023D8BC-8023D9A0 .text draw__21dDlst_TimerScrnDraw_cFv */ void dDlst_TimerScrnDraw_c::draw() { - /* Nonmatching */ fopMsgM_setAlpha(&mClockIcon); fopMsgM_setAlpha(&mClockBG); fopMsgM_setAlpha(&mTimerNumber0); diff --git a/src/f_op/f_op_actor_mng.cpp b/src/f_op/f_op_actor_mng.cpp index 0284cd54b..1cd94c354 100644 --- a/src/f_op/f_op_actor_mng.cpp +++ b/src/f_op/f_op_actor_mng.cpp @@ -490,16 +490,16 @@ f32 fopAcM_searchActorDistance2(fopAc_ac_c* i_this, fopAc_ac_c* i_other) { /* 800253C0-80025470 .text fopAcM_searchActorDistanceXZ__FP10fopAc_ac_cP10fopAc_ac_c */ f32 fopAcM_searchActorDistanceXZ(fopAc_ac_c* i_this, fopAc_ac_c* i_other) { - cXyz& this_pos = fopAcM_GetPosition_p(i_this); - cXyz& other_pos = fopAcM_GetPosition_p(i_other); - return (other_pos - this_pos).absXZ(); + cXyz* this_pos = fopAcM_GetPosition_p(i_this); + cXyz* other_pos = fopAcM_GetPosition_p(i_other); + return (*other_pos - *this_pos).absXZ(); } /* 80025470-800254BC .text fopAcM_searchActorDistanceXZ2__FP10fopAc_ac_cP10fopAc_ac_c */ f32 fopAcM_searchActorDistanceXZ2(fopAc_ac_c* i_this, fopAc_ac_c* i_other) { - cXyz& this_pos = fopAcM_GetPosition_p(i_this); - cXyz& other_pos = fopAcM_GetPosition_p(i_other); - return (other_pos - this_pos).abs2XZ(); + cXyz* this_pos = fopAcM_GetPosition_p(i_this); + cXyz* other_pos = fopAcM_GetPosition_p(i_other); + return (*other_pos - *this_pos).abs2XZ(); } /* 800254BC-800255B4 .text fopAcM_rollPlayerCrash__FP10fopAc_ac_cfUl */