From fe79d732bdb884fe16c43f5059743ddd12954dfc Mon Sep 17 00:00:00 2001 From: TakaRikka Date: Sun, 10 Sep 2023 04:50:27 -0700 Subject: [PATCH] fix some d_com_inf_game stuff --- configure.py | 1 + include/d/d_com_inf_game.h | 68 ++++++++-- include/d/d_event.h | 36 +++++ include/d/d_event_data.h | 9 ++ include/d/d_event_manager.h | 46 +++++++ include/d/d_save.h | 2 + src/d/d_com_inf_game.cpp | 254 +++++++++++++----------------------- 7 files changed, 242 insertions(+), 174 deletions(-) diff --git a/configure.py b/configure.py index 843d64c8d..09306efee 100644 --- a/configure.py +++ b/configure.py @@ -301,6 +301,7 @@ def NonMatching(obj_path, **kwargs): Matching ("d/d_com_lib_game.cpp"), Matching ("d/d_particle_name.cpp"), NonMatching("d/d_s_title.cpp"), + NonMatching("d/d_com_inf_game.cpp"), NonMatching("d/d_save.cpp"), NonMatching("d/d_save_init.cpp"), diff --git a/include/d/d_com_inf_game.h b/include/d/d_com_inf_game.h index 7ebce7421..8ee0db3a9 100644 --- a/include/d/d_com_inf_game.h +++ b/include/d/d_com_inf_game.h @@ -27,11 +27,18 @@ class dTimer_c; class camera_class; class J2DOrthoGraph; -struct dADM { +class dADM { +public: /* 0x00 */ int mBlockCount; /* 0x04 */ void* mpData; /* 0x08 */ u8 mCharTbl[0x90]; - /* 0x98 */ void* vtbl; + +public: + dADM(); + void FindTag(u32, u32*, u32*); + void SetData(void*); + + virtual ~dADM(); }; // setup properly later @@ -75,14 +82,47 @@ class dComIfG_camera_info_class { /* 0x05 */ u8 mCamIdx; /* 0x06 */ u8 field_0x06; /* 0x07 */ u8 field_0x07; - /* 0x08 */ u32 field_0x08; - /* 0x0C */ f32 field_0x0c; - /* 0x10 */ f32 field_0x10; + /* 0x08 */ u32 mCameraAttentionStatus; + /* 0x0C */ f32 mCameraZoomScale; + /* 0x10 */ f32 mCameraZoomForcus; }; STATIC_ASSERT(sizeof(dComIfG_camera_info_class) == 0x14); class dComIfG_play_c { public: + dComIfG_play_c() { ct(); } + + void ct(); + void init(); + void itemInit(); + void getLayerNo(int); + void createParticle(); + void createDemo(); + void removeDemo(); + void executeEvtManager(); + void createMagma(); + void removeMagma(); + void executeMagma(); + void drawMagma(); + void createGrass(); + void removeGrass(); + void executeGrass(); + void drawGrass(); + void createFlower(); + void removeFlower(); + void executeFlower(); + void drawFlower(); + void createTree(); + void removeTree(); + void executeTree(); + void drawTree(); + void createWood(); + void removeWood(); + void executeWood(); + void drawWood(); + + ~dComIfG_play_c(); + /* 0x0000 */ dBgS mBgS; /* 0x1404 */ dCcS mCcS; /* 0x3DF8 */ dADM mADM; @@ -131,19 +171,18 @@ class dComIfG_play_c { /* 0x4834 */ dTree_packet_c* mpTreePacket; /* 0x4838 */ Packet_c* mpWoodPacket; /* 0x483C */ dFlower_packet_c* mpFlowerPacket; - /* 0x4840 */ u8 mLkDArcIdx; + /* 0x4840 */ s8 mLkDArcIdx; /* 0x4841 */ u8 field_0x4841; - /* 0x4842 */ short mVrboxFlags; + /* 0x4842 */ s16 mVrboxFlags; /* 0x4844 */ dDlst_window_c mDlstWindow[1]; /* 0x486C */ u8 mCurCameraInfo; /* 0x486D */ u8 field_0x486D[0x4870 - 0x486D]; /* 0x4870 */ dComIfG_camera_info_class mCameraInfo[1]; - /* 0x48A4 */ daPy_py_c* mpCurPlayerActor[1]; - /* 0x48A8 */ u8 mCurCamera; + /* 0x4884 */ u8 field_0x4884[0x48A4 - 0x4884]; + /* 0x48A4 */ daPy_py_c* mpPlayer[1]; + /* 0x48A8 */ s8 mCurCamera[1]; /* 0x48A9 */ u8 field_0x48A9[0x48AC - 0x48A9]; - /* 0x48AC */ daPy_lk_c* mpLinkActor; - /* 0x48B0 */ daPy_npc_c* mpPlayerPartnerActor; - /* 0x48B4 */ daShip_c* mpShip; + /* 0x48AC */ fopAc_ac_c* mpPlayerPtr[3]; // 0: Link, 1: Partner, 2: Ship /* 0x48B8 */ f32 field_0x48b8; /* 0x48BC */ int mItemLifeCount; /* 0x48C0 */ int mItemRupeeCount; @@ -258,6 +297,11 @@ class dComIfG_play_c { class dComIfG_inf_c { public: + dComIfG_inf_c() { ct(); } + ~dComIfG_inf_c(); + + void ct(); + /* 0x00000 */ dSv_info_c info; /* 0x012A0 */ dComIfG_play_c play; /* 0x05D1C */ dDlst_list_c drawlist; diff --git a/include/d/d_event.h b/include/d/d_event.h index e5d7e3dd3..2281f342a 100644 --- a/include/d/d_event.h +++ b/include/d/d_event.h @@ -23,6 +23,42 @@ class dEvt_order_c { class dEvt_control_c { public: + dEvt_control_c(); + + void orderOld(u16, u16, u16, u16, void*, void*, const void*); + void order(u16, u16, u16, u16, void*, void*, s16, u8); + void setParam(dEvt_order_c*); + void beforeFlagProc(dEvt_order_c*); + void afterFlagProc(dEvt_order_c*); + void commonCheck(dEvt_order_c*, u16, u16); + void talkCheck(dEvt_order_c*); + void talkXyCheck(dEvt_order_c*); + void photoCheck(dEvt_order_c*); + void catchCheck(dEvt_order_c*); + void talkEnd(); + void demoCheck(dEvt_order_c*); + void demoEnd(); + void potentialCheck(dEvt_order_c*); + void doorCheck(dEvt_order_c*); + void itemCheck(dEvt_order_c*); + void endProc(); + void checkChange(); + void changeProc(); + void checkStart(); + void soundProc(); + void check(); + void photoCheck(); + void moveApproval(void*); + void compulsory(void*, const char*, u16); + void remove(); + void getStageEventDt(); + void nextStageEventDt(void*); + void getPId(void*); + void convPId(unsigned int); + void getTactFreeMStick(int); + void getTactFreeCStick(int); + void giveItemCut(u8); + /* 0x00 */ dEvt_order_c mOrder[8]; /* 0xC0 */ u8 mOrderCount; /* 0xC1 */ u8 mFirstOrderIdx; diff --git a/include/d/d_event_data.h b/include/d/d_event_data.h index ed56a30fb..f3c3ee6af 100644 --- a/include/d/d_event_data.h +++ b/include/d/d_event_data.h @@ -31,11 +31,20 @@ class dEvDtEvent_c {}; class dEvDtFlag_c { public: + dEvDtFlag_c() {} + u32 mFlags[320]; }; // Size = 0x500 class dEvDtBase_c { public: + dEvDtBase_c() { init(); } + ~dEvDtBase_c() {} + + void init(); + void advanceCut(dEvDtEvent_c*); + void advanceCutLocal(dEvDtStaff_c*); + /* 0x00 */ event_binary_data_header* mHeaderP; /* 0x04 */ dEvDtEvent_c* mEventP; /* 0x08 */ dEvDtStaff_c* mStaffP; diff --git a/include/d/d_event_manager.h b/include/d/d_event_manager.h index 53ee6aa9b..b14995d7d 100644 --- a/include/d/d_event_manager.h +++ b/include/d/d_event_manager.h @@ -8,6 +8,8 @@ class fopAc_ac_c; class dEvent_exception_c { public: + dEvent_exception_c() { mEventInfoIdx = -1; } + /* 0x0 */ s32 mEventInfoIdx; /* 0x4 */ u8 field_0x4; /* 0x5 */ u8 field_0x5; @@ -18,6 +20,50 @@ class dEvent_exception_c { class dEvent_manager_c { public: + dEvent_manager_c() {} + ~dEvent_manager_c() {} + + void debugBfProc(); + void getSubstance(dEvDtData_c*, int); + void setData(const char*); + void create(); + void remove(const char*); + void startProc(dEvDtEvent_c*); + void closeProc(dEvDtEvent_c*); + void endProc(s16, int); + void mainProc(); + void runProc(); + void getEventData(s16); + void getEventIdx(const char*, u8); + void order(s16); + void startCheck(s16); + void startCheckOld(const char*); + void endCheck(s16); + void endCheckOld(const char*); + void getMyStaffId(const char*, fopAc_ac_c*, int); + void getIsAddvance(int); + void getMyActIdx(int, const char* const*, int, int, int); + void getMyActName(int); + void getMyNowCutName(int); + void getMyDataP(int, const char*, int); + void getMySubstanceP(int, const char*, int); + void getMySubstanceNum(int, const char*); + void cutEnd(int); + void getEventPrio(s16); + void getEventEndSound(s16); + void exceptionProc(); + void issueStaff(const char*); + void cancelStaff(const char*); + void setGoal(cXyz*); + void getGoal(); + void specialCast_Shutter(s16, int); + void specialCast(const char*, int); + void setPrmStaff(void*, int); + void getToolId(u8, int); + void ChkPresentEnd(); + void CancelPresent(); + void checkStartDemo(); + /* 0x000 */ dEvDtBase_c mList; /* 0x020 */ int mCameraPlay; /* 0x024 */ dEvent_exception_c mException; diff --git a/include/d/d_save.h b/include/d/d_save.h index c45198adf..903e32cd7 100644 --- a/include/d/d_save.h +++ b/include/d/d_save.h @@ -672,6 +672,7 @@ class dSv_reserve_c { class dSv_memory_c { public: + dSv_memory_c() { init(); } /* 8005CBB0 */ void init(); dSv_memBit_c& getBit() { return mMembit; } @@ -723,6 +724,7 @@ class dSv_zoneActor_c { class dSv_zone_c { public: + dSv_zone_c() { mRoomNo = -1; } /* 8005D468 */ void init(int); dSv_zoneBit_c& getZoneBit() { return mZoneBit; } diff --git a/src/d/d_com_inf_game.cpp b/src/d/d_com_inf_game.cpp index 7195e30d3..658b5a5cc 100644 --- a/src/d/d_com_inf_game.cpp +++ b/src/d/d_com_inf_game.cpp @@ -3,17 +3,91 @@ // Translation Unit: d_com_inf_game.cpp // -#include "d_com_inf_game.h" -#include "dolphin/types.h" +#include "d/d_com_inf_game.h" +#include "SSystem/SComponent/c_phase.h" + +class J3DModel; + +class dGrass_data_c { +public: + ~dGrass_data_c(); + dGrass_data_c(); +}; + +class dGrass_packet_c { +public: + ~dGrass_packet_c(); + dGrass_packet_c(); + void draw(); + void calc(); + void update(); + void setData(dGrass_data_c*, int, cXyz*, int, u8); + void newData(cXyz*, int, u8); + void newAnm(); + void setAnm(int, s16); +}; + +class dFlower_data_c { +public: + ~dFlower_data_c(); + dFlower_data_c(); +}; + +class dFlower_packet_c { +public: + ~dFlower_packet_c(); +}; + +class dTree_data_c { +public: + ~dTree_data_c(); + dTree_data_c(); +}; + +class dTree_packet_c { +public: + ~dTree_packet_c(); +}; + +class dTree_anm_c { +public: + ~dTree_anm_c(); +}; + +class scene_class; + +dComIfG_inf_c g_dComIfG_gameInfo; /* 80052134-800521A4 .text ct__14dComIfG_play_cFv */ void dComIfG_play_c::ct() { - /* Nonmatching */ + field_0x4841 = 0; + mParticle = NULL; + mDemo = NULL; + mpMagmaPacket = NULL; + mpGrassPacket = NULL; + mpTreePacket = NULL; + mpWoodPacket = NULL; + mpFlowerPacket = NULL; + field_0x4A64[0] = 0xFF; + field_0x4A64[1] = 0xFF; + mLastSeaRoom = 0xFF; + field_0x4A67[0] = 0xFF; + mIkadaLinkPos.set(0.0f, 0.0f, 0.0f); + mLkDArcIdx = -1; + + init(); } /* 800521A4-800521D4 .text init__14dComIfG_play_cFv */ void dComIfG_play_c::init() { - /* Nonmatching */ + for (int i = 0; i < 1; i++) { + mpPlayer[i] = NULL; + mCurCamera[i] = -1; + } + + for (int i = 0; i < 3; i++) { + mpPlayerPtr[i] = NULL; + } } /* 800521D4-80052400 .text itemInit__14dComIfG_play_cFv */ @@ -43,7 +117,7 @@ void dComIfG_play_c::removeDemo() { /* 800529B8-800529DC .text executeEvtManager__14dComIfG_play_cFv */ void dComIfG_play_c::executeEvtManager() { - /* Nonmatching */ + mEventMgr.runProc(); } /* 800529DC-80052A30 .text createMagma__14dComIfG_play_cFv */ @@ -183,11 +257,12 @@ void dComIfG_play_c::drawWood() { /* 80053178-800531A8 .text ct__13dComIfG_inf_cFv */ void dComIfG_inf_c::ct() { - /* Nonmatching */ + field_0x1d1c1 = 0xFF; + play.ct(); } /* 800531A8-8005326C .text dComIfG_changeOpeningScene__FP11scene_classs */ -void dComIfG_changeOpeningScene(scene_class*, short) { +void dComIfG_changeOpeningScene(scene_class*, s16) { /* Nonmatching */ } @@ -207,8 +282,8 @@ void phase_2(char*) { } /* 80053388-80053390 .text phase_3__FPc */ -void phase_3(char*) { - /* Nonmatching */ +int phase_3(char*) { + return cPhs_COMPLEATE_e; } /* 80053390-800533D0 .text dComIfG_resLoad__FP30request_of_phase_process_classPCc */ @@ -227,7 +302,7 @@ void dComIfGp_getReverb(int) { } /* 800534C4-800535B8 .text dComIfGd_setSimpleShadow2__FP4cXyzffR13cBgS_PolyInfosfP9_GXTexObj */ -void dComIfGd_setSimpleShadow2(cXyz*, float, float, cBgS_PolyInfo&, short, float, _GXTexObj*) { +void dComIfGd_setSimpleShadow2(cXyz*, f32, f32, cBgS_PolyInfo&, s16, f32, _GXTexObj*) { /* Nonmatching */ } @@ -237,7 +312,7 @@ void dComIfGp_getShip(int, int) { } /* 80053678-80053728 .text dComIfGp_getMapTrans__FiPfPfPs */ -void dComIfGp_getMapTrans(int, float*, float*, short*) { +void dComIfGp_getMapTrans(int, f32*, f32*, s16*) { /* Nonmatching */ } @@ -252,7 +327,7 @@ void dComIfGp_getRoomArrow(int) { } /* 800537C8-8005388C .text dComIfGp_setNextStage__FPCcsScScfUliSc */ -void dComIfGp_setNextStage(const char*, short, signed char, signed char, float, unsigned long, int, signed char) { +void dComIfGp_setNextStage(const char*, s16, s8, s8, f32, u32, int, s8) { /* Nonmatching */ } @@ -282,17 +357,17 @@ void dComIfGs_isStageLife(int) { } /* 80053B30-80053F70 .text dComIfGs_checkGetItem__FUc */ -void dComIfGs_checkGetItem(unsigned char) { +void dComIfGs_checkGetItem(u8) { /* Nonmatching */ } /* 80053F70-80054578 .text dComIfGs_checkGetItemNum__FUc */ -void dComIfGs_checkGetItemNum(unsigned char) { +void dComIfGs_checkGetItemNum(u8) { /* Nonmatching */ } /* 80054578-8005468C .text dComIfGd_setShadow__FUlScP8J3DModelP4cXyzffffR13cBgS_PolyInfoP12dKy_tevstr_csfP9_GXTexObj */ -void dComIfGd_setShadow(unsigned long, signed char, J3DModel*, cXyz*, float, float, float, float, cBgS_PolyInfo&, dKy_tevstr_c*, short, float, _GXTexObj*) { +void dComIfGd_setShadow(u32, s8, J3DModel*, cXyz*, f32, f32, f32, f32, cBgS_PolyInfo&, dKy_tevstr_c*, s16, f32, _GXTexObj*) { /* Nonmatching */ } @@ -307,7 +382,7 @@ void dComIfGd_getMeshSceneList(Vec&) { } /* 80054870-800548FC .text dComIfGs_checkSeaLandingEvent__FSc */ -void dComIfGs_checkSeaLandingEvent(signed char) { +void dComIfGs_checkSeaLandingEvent(s8) { /* Nonmatching */ } @@ -342,152 +417,7 @@ void dComIfGs_exchangePlayerRecollectionData() { } /* 8005586C-800559E8 .text dComIfGs_setSelectEquip__FiUc */ -void dComIfGs_setSelectEquip(int, unsigned char) { - /* Nonmatching */ -} - -/* 80055C08-80055C7C .text __dt__13dComIfG_inf_cFv */ -dComIfG_inf_c::~dComIfG_inf_c() { - /* Nonmatching */ -} - -/* 80055C7C-80055DB8 .text __dt__14dComIfG_play_cFv */ -dComIfG_play_c::~dComIfG_play_c() { - /* Nonmatching */ -} - -/* 80055DB8-80055DF4 .text __dt__12dEvt_order_cFv */ -dEvt_order_c::~dEvt_order_c() { - /* Nonmatching */ -} - -/* 80055DF4-80055E30 .text __dt__25dComIfG_camera_info_classFv */ -dComIfG_camera_info_class::~dComIfG_camera_info_class() { - /* Nonmatching */ -} - -/* 80055E30-80055E34 .text __ct__25dComIfG_camera_info_classFv */ -dComIfG_camera_info_class::dComIfG_camera_info_class() { - /* Nonmatching */ -} - -/* 80055E34-80055E70 .text __dt__14dDlst_window_cFv */ -dDlst_window_c::~dDlst_window_c() { - /* Nonmatching */ -} - -/* 80055E70-80055E74 .text __ct__14dDlst_window_cFv */ -dDlst_window_c::dDlst_window_c() { - /* Nonmatching */ -} - -/* 80055E74-80055ED0 .text __dt__19dAttDraw_CallBack_cFv */ -dAttDraw_CallBack_c::~dAttDraw_CallBack_c() { - /* Nonmatching */ -} - -/* 80055ED0-80055F18 .text __dt__25mDoExt_McaMorfCallBack1_cFv */ -mDoExt_McaMorfCallBack1_c::~mDoExt_McaMorfCallBack1_c() { - /* Nonmatching */ -} - -/* 80055F18-80055FB8 .text __dt__4dCcSFv */ -dCcS::~dCcS() { - /* Nonmatching */ -} - -/* 80055FB8-8005613C .text __dt__12dCcMassS_MngFv */ -dCcMassS_Mng::~dCcMassS_Mng() { - /* Nonmatching */ -} - -/* 8005613C-8005619C .text __dt__12dCcMassS_ObjFv */ -dCcMassS_Obj::~dCcMassS_Obj() { - /* Nonmatching */ -} - -/* 8005619C-80056210 .text __dt__4cCcSFv */ -cCcS::~cCcS() { - /* Nonmatching */ -} - -/* 80056210-8005628C .text __dt__4dBgSFv */ -dBgS::~dBgS() { - /* Nonmatching */ -} - -/* 8005628C-800562F8 .text __dt__4cBgSFv */ -cBgS::~cBgS() { - /* Nonmatching */ -} - -/* 800562F8-80056340 .text __dt__11cBgS_ChkElmFv */ -cBgS_ChkElm::~cBgS_ChkElm() { - /* Nonmatching */ -} - -/* 80056340-8005637C .text __ct__11cBgS_ChkElmFv */ -cBgS_ChkElm::cBgS_ChkElm() { - /* Nonmatching */ -} - -/* 8005637C-80056388 .text __ct__10dSv_zone_cFv */ -dSv_zone_c::dSv_zone_c() { - /* Nonmatching */ -} - -/* 80056388-800563B8 .text __ct__12dSv_memory_cFv */ -dSv_memory_c::dSv_memory_c() { - /* Nonmatching */ -} - -/* 800563B8-80056400 .text __dt__8cM3dGCylFv */ -cM3dGCyl::~cM3dGCyl() { - /* Nonmatching */ -} - -/* 80056400-8005645C .text __dt__14cCcD_ShapeAttrFv */ -cCcD_ShapeAttr::~cCcD_ShapeAttr() { - /* Nonmatching */ -} - -/* 8005645C-80056464 .text CrossAtTg__14cCcD_ShapeAttrCFRC14cCcD_ShapeAttrP4cXyz */ -void cCcD_ShapeAttr::CrossAtTg(const cCcD_ShapeAttr&, cXyz*) const { - /* Nonmatching */ -} - -/* 80056464-8005646C .text CrossCo__14cCcD_ShapeAttrCFRC14cCcD_ShapeAttrPf */ -void cCcD_ShapeAttr::CrossCo(const cCcD_ShapeAttr&, float*) const { - /* Nonmatching */ -} - -/* 8005646C-80056478 .text GetCoCP__14cCcD_ShapeAttrFv */ -void cCcD_ShapeAttr::GetCoCP() { - /* Nonmatching */ -} - -/* 80056478-80056484 .text GetCoCP__14cCcD_ShapeAttrCFv */ -void cCcD_ShapeAttr::GetCoCP() const { - /* Nonmatching */ -} - -/* 80056484-800564E0 .text __dt__8cM3dGCpsFv */ -cM3dGCps::~cM3dGCps() { - /* Nonmatching */ -} - -/* 800564E0-80056528 .text __dt__15cCcD_DivideInfoFv */ -cCcD_DivideInfo::~cCcD_DivideInfo() { - /* Nonmatching */ -} - -/* 80056528-80056570 .text __dt__8cM3dGAabFv */ -cM3dGAab::~cM3dGAab() { - /* Nonmatching */ -} - -/* 80056570-800565CC .text __dt__15cCcD_DivideAreaFv */ -cCcD_DivideArea::~cCcD_DivideArea() { +void dComIfGs_setSelectEquip(int, u8) { /* Nonmatching */ }