From f1d8c41c389b2c6203d0e04ab0d7e892a5b78acf Mon Sep 17 00:00:00 2001 From: TakaRikka <38417346+TakaRikka@users.noreply.github.com> Date: Thu, 14 Sep 2023 12:45:49 -0700 Subject: [PATCH] work on d_s_play (#31) * work on d_s_play * some fixes --- configure.py | 1 + include/JAZelAudio/JAIZelBasic.h | 2 +- .../SSystem/SComponent/c_API_controller_pad.h | 5 +- include/d/actor/d_a_player_link.h | 2 +- include/d/actor/d_a_title.h | 9 + include/d/d_attention.h | 7 + include/d/d_bg_s.h | 11 +- include/d/d_com_inf_game.h | 172 ++++- include/d/d_drawlist.h | 4 + include/d/d_kankyo.h | 2 +- include/d/d_kankyo_rain.h | 7 + include/d/d_map.h | 9 + include/d/d_material.h | 17 + include/d/d_meter.h | 6 + include/d/d_particle.h | 52 +- include/d/d_s_play.h | 118 +++- include/d/d_snap.h | 7 + include/d/d_stage.h | 20 + include/f_op/f_op_msg_mng.h | 9 +- include/f_op/f_op_scene.h | 5 + include/m_Do/m_Do_audio.h | 14 + include/m_Do/m_Do_controller_pad.h | 26 + include/m_Do/m_Do_ext.h | 5 + include/m_Do/m_Do_graphic.h | 73 +++ src/d/d_s_play.cpp | 594 +++++++++++++++--- src/m_Do/m_Do_controller_pad.cpp | 2 +- 26 files changed, 1067 insertions(+), 112 deletions(-) create mode 100644 include/d/actor/d_a_title.h create mode 100644 include/d/d_kankyo_rain.h create mode 100644 include/d/d_map.h create mode 100644 include/d/d_material.h create mode 100644 include/d/d_meter.h create mode 100644 include/d/d_snap.h diff --git a/configure.py b/configure.py index 15b31a8b9..bf8d0e9a6 100644 --- a/configure.py +++ b/configure.py @@ -369,6 +369,7 @@ config.libs = [ Object(NonMatching, "d/d_save.cpp"), Object(NonMatching, "d/d_save_init.cpp"), Object(Matching, "d/d_bg_s_movebg_actor.cpp"), + Object(NonMatching, "d/d_s_play.cpp"), Object(NonMatching, "d/actor/d_a_player_main.cpp"), Object(NonMatching, "d/actor/d_a_itembase_static.cpp"), diff --git a/include/JAZelAudio/JAIZelBasic.h b/include/JAZelAudio/JAIZelBasic.h index bfc614ecf..01b6f5ee4 100644 --- a/include/JAZelAudio/JAIZelBasic.h +++ b/include/JAZelAudio/JAIZelBasic.h @@ -97,7 +97,7 @@ public: void sceneChange(u32, u32, u32, s32); void sceneBgmStart(); void load1stDynamicWave(); - void check1stDynamicWave(); + BOOL check1stDynamicWave(); void load2ndDynamicWave(); void loadStaticWaves(); void checkFirstWaves(); diff --git a/include/SSystem/SComponent/c_API_controller_pad.h b/include/SSystem/SComponent/c_API_controller_pad.h index 21e136857..c1f746112 100644 --- a/include/SSystem/SComponent/c_API_controller_pad.h +++ b/include/SSystem/SComponent/c_API_controller_pad.h @@ -20,7 +20,10 @@ struct interface_of_controller_pad { /* 0x24 */ f32 mAnalogB; /* 0x28 */ f32 mTriggerLeft; /* 0x2C */ f32 mTriggerRight; - /* 0x30 */ u32 mButtonFlags; + /* 0x30 */ u8 mButtonHold0; + /* 0x31 */ u8 mButtonHold1; + /* 0x32 */ u8 mButtonTrig0; + /* 0x33 */ u8 mButtonTrig1; /* 0x34 */ s8 mGamepadErrorFlags; /* 0x35 */ u8 mHoldLockL; /* 0x36 */ u8 mTrigLockL; diff --git a/include/d/actor/d_a_player_link.h b/include/d/actor/d_a_player_link.h index c13f540b3..47fb44708 100644 --- a/include/d/actor/d_a_player_link.h +++ b/include/d/actor/d_a_player_link.h @@ -539,7 +539,7 @@ public: void dProcFreezeDamage(); void dProcDead_init_sub(); void dProcDead_init_sub2(); - void checkGameOverStart(); + BOOL checkGameOverStart(); void dProcDead_init(); void dProcDead(); void dProcLookAround_init(); diff --git a/include/d/actor/d_a_title.h b/include/d/actor/d_a_title.h new file mode 100644 index 000000000..f3aea3bb0 --- /dev/null +++ b/include/d/actor/d_a_title.h @@ -0,0 +1,9 @@ +#ifndef D_A_TITLE_H +#define D_A_TITLE_H + +class daTitle_proc_c { +public: + static void daTitle_Kirakira_Sound_flag_on(); +}; + +#endif /* D_A_TITLE_H */ diff --git a/include/d/d_attention.h b/include/d/d_attention.h index 1fa2253c8..113bbc7ed 100644 --- a/include/d/d_attention.h +++ b/include/d/d_attention.h @@ -143,6 +143,13 @@ public: void LockonTruth(); void Lockon(); + void Init(fopAc_ac_c* i_owner, u32 i_playerNo) { + mpPlayer = (daPy_lk_c*)i_owner; + mPlayerNo = i_playerNo; + } + + fopAc_ac_c* Owner() { return (fopAc_ac_c*)mpPlayer; } + public: /* 0x000 */ daPy_lk_c* mpPlayer; /* 0x004 */ int mLockOnTargetBsPcID; diff --git a/include/d/d_bg_s.h b/include/d/d_bg_s.h index e98560b18..6e04b5a6a 100644 --- a/include/d/d_bg_s.h +++ b/include/d/d_bg_s.h @@ -61,13 +61,13 @@ public: void GetGrpToRoomId(int, int) const; cM3dGPla* GetTriPla(int, int) const; bool GetTriPnt(cBgS_PolyInfo&, cXyz*, cXyz*, cXyz*) const; - void Move(void); void ShdwDraw(cBgS_ShdwDraw*); u32 GetGrpInf(cBgS_PolyInfo&, int) const; virtual ~cBgS() {} virtual void Ct(); virtual void Dt(); + virtual void Move(); }; // Size: 0x1404 class dBgS_Acch; @@ -75,12 +75,13 @@ class dBgS_Acch; class dBgS : public cBgS { public: dBgS() {} - ~dBgS() {} + virtual ~dBgS() {} + + virtual void Ct(); + virtual void Dt(); + virtual void Move(); - void Ct(); - void Dt(); void ClrMoveFlag(); - void Move(); bool Regist(cBgW*, fopAc_ac_c*); bool ChkMoveBG(cBgS_PolyInfo&); bool ChkMoveBG_NoDABg(cBgS_PolyInfo&); diff --git a/include/d/d_com_inf_game.h b/include/d/d_com_inf_game.h index 88eb44254..e833d66eb 100644 --- a/include/d/d_com_inf_game.h +++ b/include/d/d_com_inf_game.h @@ -1,6 +1,7 @@ #ifndef D_COM_D_COM_INF_GAME_H #define D_COM_D_COM_INF_GAME_H +#include "JSystem/JUtility/TColor.h" #include "d/d_attention.h" #include "d/d_bg_s.h" #include "d/d_cc_s.h" @@ -8,12 +9,14 @@ #include "d/d_drawlist.h" #include "d/d_event.h" #include "d/d_event_manager.h" +#include "d/d_map.h" #include "d/d_particle.h" #include "d/d_resorce.h" #include "d/d_save.h" #include "d/d_stage.h" #include "d/d_vibration.h" #include "d/d_wood.h" +#include "d/d_demo.h" class JKRArchive; class JKRExpHeap; @@ -124,12 +127,23 @@ public: dEvt_control_c& getEvent() { return mEvtCtrl; } dEvent_manager_c& getEvtManager() { return mEvtManager; } dPa_control_c* getParticle() { return mParticle; } + dVibration_c& getVibration() { return mVibration; } + dAttention_c& getAttention() { return mAttention; } + dDetect_c& getDetect() { return mDetect; } + dDemo_manager_c* getDemo() { return mDemo; } + + dMagma_packet_c* getMagma() { return mpMagmaPacket; } + dGrass_packet_c* getGrass() { return mpGrassPacket; } + dTree_packet_c* getTree() { return mpTreePacket; } + dWood::Packet_c* getWood() { return mpWoodPacket; } + dFlower_packet_c* getFlower() { return mpFlowerPacket; } const char* getStartStageName() { return mCurStage.getName(); } s8 getStartStageRoomNo() { return mCurStage.getRoomNo(); } s8 getStartStageLayer() { return mCurStage.getLayer(); } s16 getStartStagePoint() { return mCurStage.getPoint(); } void setStartStageLayer(s8 layer) { mCurStage.setLayer(layer); } + void setStartStage(dStage_startStage_c* i_startStage) { mCurStage = *i_startStage; } const char* getNextStageName() { return mNextStage.getName(); } dStage_startStage_c* getNextStartStage() { return &mNextStage; } @@ -147,6 +161,9 @@ public: fopAc_ac_c* getPlayer(int idx) { return (fopAc_ac_c*)mpPlayer[idx]; } s8 getPlayerCameraID(int idx) { return mCurCamera[idx]; } + void setLkDemoAnmArchive(JKRArchive* i_arc) { mpLkDArc = i_arc; } + void setStatus(u16 status) { mStatus = status; } + /* 0x0000 */ dBgS mBgS; /* 0x1404 */ dCcS mCcS; /* 0x3DF8 */ dADM mADM; @@ -200,7 +217,7 @@ public: /* 0x483C */ dFlower_packet_c* mpFlowerPacket; /* 0x4840 */ s8 mLkDArcIdx; /* 0x4841 */ u8 field_0x4841; - /* 0x4842 */ s16 mVrboxFlags; + /* 0x4842 */ s16 mStatus; /* 0x4844 */ dDlst_window_c mDlstWindow[1]; /* 0x4870 */ dComIfG_camera_info_class mCameraInfo[1]; /* 0x48A4 */ daPy_py_c* mpPlayer[1]; @@ -336,12 +353,19 @@ STATIC_ASSERT(sizeof(dComIfG_inf_c) == 0x1D1C8); extern dComIfG_inf_c g_dComIfG_gameInfo; +extern JUtility::TColor g_saftyWhiteColor; +extern JUtility::TColor g_blackColor; + /** * === SAVE === */ u8 dComIfGs_checkGetItem(u8); +inline void dComIfGs_init() { + g_dComIfG_gameInfo.save.init(); +} + inline u8 dComIfGs_getSelectEquip(int param_0) { return g_dComIfG_gameInfo.save.getPlayer().getPlayerStatusA().getSelectEquip(param_0); } @@ -481,6 +505,10 @@ inline dStage_startStage_c* dComIfGp_getNextStartStage() { return g_dComIfG_gameInfo.play.getNextStartStage(); } +inline void dComIfGp_setStartStage(dStage_startStage_c* p_startStage) { + g_dComIfG_gameInfo.play.setStartStage(p_startStage); +} + inline s8 dComIfGp_getNextStageRoomNo() { return g_dComIfG_gameInfo.play.getNextStageRoomNo(); } @@ -521,6 +549,10 @@ inline dStage_roomStatus_c* dComIfGp_roomControl_getStatusRoomDt(int room_no) { return g_dComIfG_gameInfo.play.getRoomControl()->getStatusRoomDt(room_no); } +inline void dComIfGp_roomControl_checkDrawArea() { + return g_dComIfG_gameInfo.play.getRoomControl()->checkDrawArea(); +} + inline dBgS* dComIfG_Bgsp() { return &g_dComIfG_gameInfo.play.mBgS; } @@ -541,6 +573,94 @@ inline dStage_stageDt_c& dComIfGp_getStage() { return g_dComIfG_gameInfo.play.getStage(); } +inline dVibration_c& dComIfGp_getVibration() { + return g_dComIfG_gameInfo.play.getVibration(); +} + +inline dAttention_c& dComIfGp_getAttention() { + return g_dComIfG_gameInfo.play.getAttention(); +} + +inline dDetect_c& dComIfGp_getDetect() { + return g_dComIfG_gameInfo.play.getDetect(); +} + +inline dMagma_packet_c* dComIfGp_getMagma() { + return g_dComIfG_gameInfo.play.getMagma(); +} + +inline dGrass_packet_c* dComIfGp_getGrass() { + return g_dComIfG_gameInfo.play.getGrass(); +} + +inline dTree_packet_c* dComIfGp_getTree() { + return g_dComIfG_gameInfo.play.getTree(); +} + +inline dWood::Packet_c* dComIfGp_getWood() { + return g_dComIfG_gameInfo.play.getWood(); +} + +inline dFlower_packet_c* dComIfGp_getFlower() { + return g_dComIfG_gameInfo.play.getFlower(); +} + +inline void dComIfGp_executeMagma() { + return g_dComIfG_gameInfo.play.executeMagma(); +} + +inline void dComIfGp_executeGrass() { + return g_dComIfG_gameInfo.play.executeGrass(); +} + +inline void dComIfGp_executeTree() { + return g_dComIfG_gameInfo.play.executeTree(); +} + +inline void dComIfGp_executeWood() { + return g_dComIfG_gameInfo.play.executeWood(); +} + +inline void dComIfGp_executeFlower() { + return g_dComIfG_gameInfo.play.executeFlower(); +} + +inline void dComIfGp_drawMagma() { + return g_dComIfG_gameInfo.play.drawMagma(); +} + +inline void dComIfGp_drawGrass() { + return g_dComIfG_gameInfo.play.drawGrass(); +} + +inline void dComIfGp_drawTree() { + return g_dComIfG_gameInfo.play.drawTree(); +} + +inline void dComIfGp_drawWood() { + return g_dComIfG_gameInfo.play.drawWood(); +} + +inline void dComIfGp_drawFlower() { + return g_dComIfG_gameInfo.play.drawFlower(); +} + +inline void dComIfGp_map_mapBufferSendAGB(int param_0) { + dMap_c::mapBufferSendAGB(param_0); +} + +inline void dComIfGp_demo_update() { + g_dComIfG_gameInfo.play.getDemo()->update(); +} + +inline void dComIfGp_setLkDemoAnmArchive(JKRArchive* i_arc) { + g_dComIfG_gameInfo.play.setLkDemoAnmArchive(i_arc); +} + +inline void dComIfGp_setStatus(u16 status) { + g_dComIfG_gameInfo.play.setStatus(status); +} + inline daPy_py_c* daPy_getPlayerActorClass() { return (daPy_py_c*)dComIfGp_getPlayer(0); } @@ -572,7 +692,7 @@ inline dEvent_manager_c& dComIfGp_getEventManager() { return g_dComIfG_gameInfo.play.getEvtManager(); } -inline u32 dComIfGp_evmng_getEventIdx(char *pName, u8 evNo) { +inline u32 dComIfGp_evmng_getEventIdx(char* pName, u8 evNo) { return dComIfGp_getEventManager().getEventIdx(pName, evNo); } @@ -580,6 +700,10 @@ inline BOOL dComIfGp_evmng_endCheck(s16 eventID) { return g_dComIfG_gameInfo.play.getEvtManager().endCheck(eventID); } +inline void dComIfGp_evmng_execute() { + g_dComIfG_gameInfo.play.executeEvtManager(); +} + /** * === DRAWLIST === */ @@ -651,15 +775,49 @@ inline void* dComIfG_getObjectIDRes(const char* arcName, u16 id) { * === PARTICLE === */ -void set(u8, u16, cXyz const*, csXyz const*, cXyz const*, u8, dPa_levelEcallBack*, s8, GXColor const*, GXColor const*, cXyz const*); +void set(u8, u16, cXyz const*, csXyz const*, cXyz const*, u8, dPa_levelEcallBack*, s8, + GXColor const*, GXColor const*, cXyz const*); -inline JPABaseEmitter * dComIfGp_particle_set(u16 particleID, const cXyz* pos, const csXyz * angle, const cXyz * scale, u8 alpha, dPa_levelEcallBack * pCallBack, s8 setupInfo, const GXColor * pPrmColor, const GXColor * pEnvColor, const cXyz * pScale2D) { - dPa_control_c * pParticle = g_dComIfG_gameInfo.play.getParticle(); - return pParticle->set(0, particleID, pos, angle, scale, alpha, pCallBack, setupInfo, pPrmColor, pEnvColor, pScale2D); +inline JPABaseEmitter* dComIfGp_particle_set(u16 particleID, const cXyz* pos, const csXyz* angle, + const cXyz* scale, u8 alpha, + dPa_levelEcallBack* pCallBack, s8 setupInfo, + const GXColor* pPrmColor, const GXColor* pEnvColor, + const cXyz* pScale2D) { + dPa_control_c* pParticle = g_dComIfG_gameInfo.play.getParticle(); + return pParticle->set(0, particleID, pos, angle, scale, alpha, pCallBack, setupInfo, pPrmColor, + pEnvColor, pScale2D); } -inline JPABaseEmitter * dComIfGp_particle_set(u16 particleID, const cXyz* pos, const csXyz * angle, const cXyz * scale) { +inline JPABaseEmitter* dComIfGp_particle_set(u16 particleID, const cXyz* pos, const csXyz* angle, + const cXyz* scale) { return dComIfGp_particle_set(particleID, pos, angle, scale, 0xFF, NULL, -1, NULL, NULL, NULL); } +inline void dComIfGp_particle_calc3D() { + g_dComIfG_gameInfo.play.getParticle()->calc3D(); +} + +inline void dComIfGp_particle_calc2D() { + g_dComIfG_gameInfo.play.getParticle()->calc2D(); +} + +inline void dComIfGp_particle_calcMenu() { + g_dComIfG_gameInfo.play.getParticle()->calcMenu(); +} + +inline void dComIfGp_particle_drawModelParticle() { + g_dComIfG_gameInfo.play.getParticle()->drawModelParticle(); +} + +inline void dComIfGp_particle_readScene(u8 particle_no, mDoDvdThd_toMainRam_c** param_1) { + g_dComIfG_gameInfo.play.getParticle()->readScene(particle_no, param_1); +} + +/** + * === MISC === + */ + +class scene_class; +int dComIfG_resetToOpening(scene_class* i_scene); + #endif /* D_COM_D_COM_INF_GAME_H */ diff --git a/include/d/d_drawlist.h b/include/d/d_drawlist.h index 00212b530..a2918a937 100644 --- a/include/d/d_drawlist.h +++ b/include/d/d_drawlist.h @@ -187,6 +187,10 @@ public: param_6); } + static void offWipe() { mWipe = false; } + + static bool mWipe; + private: /* 0x00000 */ J3DDrawBuffer* mpBufSkyOpa; /* 0x00004 */ J3DDrawBuffer* mpBufSkyXlu; diff --git a/include/d/d_kankyo.h b/include/d/d_kankyo.h index 560b3a161..519a6a708 100644 --- a/include/d/d_kankyo.h +++ b/include/d/d_kankyo.h @@ -64,6 +64,6 @@ int dKy_getdaytime_hour(); BOOL dKy_checkEventNightStop(); void dKy_set_nexttime(f32); void dKy_Sound_set(cXyz i_pos, int param_1, unsigned int i_actorID, int param_3); - +void dKy_itudemo_se(); #endif /* D_KANKYO_D_KANKYO_H */ diff --git a/include/d/d_kankyo_rain.h b/include/d/d_kankyo_rain.h new file mode 100644 index 000000000..0cdf9a730 --- /dev/null +++ b/include/d/d_kankyo_rain.h @@ -0,0 +1,7 @@ +#ifndef D_KANKYO_D_KANKYO_RAIN_H +#define D_KANKYO_D_KANKYO_RAIN_H + +void dKyr_poison_light_colision(); +BOOL dKyr_poison_live_check(); + +#endif /* D_KANKYO_D_KANKYO_RAIN_H */ \ No newline at end of file diff --git a/include/d/d_map.h b/include/d/d_map.h new file mode 100644 index 000000000..0f8fb22ad --- /dev/null +++ b/include/d/d_map.h @@ -0,0 +1,9 @@ +#ifndef D_MAP_H +#define D_MAP_H + +class dMap_c { +public: + static void mapBufferSendAGB(int); +}; + +#endif /* D_MAP_H */ \ No newline at end of file diff --git a/include/d/d_material.h b/include/d/d_material.h new file mode 100644 index 000000000..038902cd1 --- /dev/null +++ b/include/d/d_material.h @@ -0,0 +1,17 @@ +#ifndef D_MATERIAL_H +#define D_MATERIAL_H + +class dMat_ice_c { +public: + void play(); +}; + +class dMat_control_c { +public: + static void icePlay() { mIce->play(); } + static void create(J3DMaterialTable*, J3DAnmTextureSRTKey*); + + static dMat_ice_c* mIce; +}; + +#endif /* D_MATERIAL_H */ \ No newline at end of file diff --git a/include/d/d_meter.h b/include/d/d_meter.h new file mode 100644 index 000000000..30e941389 --- /dev/null +++ b/include/d/d_meter.h @@ -0,0 +1,6 @@ +#ifndef D_METER_H +#define D_METER_H + +bool dMenu_flag(); + +#endif /* D_METER_H */ \ No newline at end of file diff --git a/include/d/d_particle.h b/include/d/d_particle.h index d3e2c644c..ea5f872d4 100644 --- a/include/d/d_particle.h +++ b/include/d/d_particle.h @@ -2,13 +2,13 @@ #define D_PARTICLE #include "JSystem/JParticle/JPAParticle.h" +#include "f_pc/f_pc_node.h" class mDoDvdThd_toMainRam_c; class dPa_levelEcallBack; class dKy_tevstr_c; class cBgS_PolyInfo; class JPADrawInfo; -class dPa_modelControl_c; class JKRHeap; class JPABaseEmitter; class JPAEmitterManager; @@ -46,6 +46,48 @@ public: /* 0x010 */ dPa_simpleData_c mSimpleData[32]; }; +class dPa_modelControl_c { +public: + dPa_modelControl_c(J3DModelData*); + ~dPa_modelControl_c(); + + void newModel(J3DModelData*); + void draw(); + + /* 0x00 */ node_list_class parent; + /* 0x0C */ void* field_0x0c; + /* 0x10 */ void* field_0x10; + /* 0x14 */ void* field_0x14; + /* 0x18 */ void* field_0x18; + /* 0x1C */ void* field_0x1c; + /* 0x20 */ void* field_0x20; + /* 0x24 */ void* field_0x24; + /* 0x28 */ void* field_0x28; + /* 0x2C */ void* field_0x2c; + /* 0x30 */ void* field_0x30; + /* 0x34 */ void* field_0x34; + /* 0x38 */ void* field_0x38; + /* 0x3C */ void* field_0x3c; + /* 0x40 */ void* field_0x40; + /* 0x44 */ void* field_0x44; + /* 0x48 */ void* field_0x48; + /* 0x4C */ void* field_0x4c; + /* 0x50 */ void* field_0x50; + /* 0x54 */ void* field_0x54; + /* 0x58 */ void* field_0x58; + /* 0x5C */ void* field_0x5c; + /* 0x60 */ void* field_0x60; + /* 0x64 */ void* field_0x64; + /* 0x68 */ void* field_0x68; + /* 0x6C */ void* field_0x6c; + /* 0x70 */ void* field_0x70; + /* 0x74 */ void* field_0x74; + /* 0x78 */ void* field_0x78; + /* 0x7C */ void* field_0x7c; + /* 0x80 */ void* field_0x80; + /* 0x84 */ J3DVertexData mVertexData; +}; + class dPa_control_c { public: dPa_control_c(); @@ -62,16 +104,20 @@ public: void calc2D(); void calcMenu(); void draw(JPADrawInfo*, u8); - JPABaseEmitter * set(u8, u16, cXyz const*, csXyz const*, cXyz const*, u8, dPa_levelEcallBack*, s8, GXColor const*, GXColor const*, cXyz const*); + JPABaseEmitter* set(u8, u16, cXyz const*, csXyz const*, cXyz const*, u8, dPa_levelEcallBack*, + s8, GXColor const*, GXColor const*, cXyz const*); void setBombSmoke(u16, cXyz const*, csXyz const*, cXyz const*, u8); void setSimpleLand(int, cXyz const*, csXyz const*, f32, f32, f32, dKy_tevstr_c*, int*, int); - void setSimpleLand(cBgS_PolyInfo&, cXyz const*, csXyz const*, f32, f32, f32, dKy_tevstr_c*, int*, int); + void setSimpleLand(cBgS_PolyInfo&, cXyz const*, csXyz const*, f32, f32, f32, dKy_tevstr_c*, + int*, int); void checkAtrCodeEffect(int); void setNormalStripes(u16, cXyz const*, csXyz const*, cXyz const*, u8, u16); void newSimple(u16, u8); void setSimple(u16, cXyz const*, u8, GXColor const&, GXColor const&, int); void getSimple(u16); + void drawModelParticle() { mModelCtrl->draw(); } + /* 0x0000 */ JKRHeap* mpHeap; /* 0x0004 */ JPAResourceManager* mpCommonResMgr; /* 0x0008 */ dPa_modelControl_c* mModelCtrl; diff --git a/include/d/d_s_play.h b/include/d/d_s_play.h index 0a5a35202..a622a4a3c 100644 --- a/include/d/d_s_play.h +++ b/include/d/d_s_play.h @@ -1,9 +1,11 @@ #ifndef D_S_PLAY #define D_S_PLAY -#include "f_op/f_op_scene.h" +#include "d/d_stage.h" +#include "f_op/f_op_scene_mng.h" #include "m_Do/m_Do_hostIO.h" +class mDoDvdThd_toMainRam_c; class dScnPly_ply_c : public scene_class { public: s8 calcPauseTimer(); @@ -15,22 +17,122 @@ public: static s8 pauseTimer; static s8 nextPauseTimer; + + /* 0x1C4 */ request_of_phase_process_class mLoadPhs; + /* 0x1CC */ mDoDvdThd_toMainRam_c* sceneCommand; +}; + +class dScnPly_dark_HIO_c { +public: + dScnPly_dark_HIO_c(); + virtual ~dScnPly_dark_HIO_c() {} + + /* 0x04 */ u8 field_0x04[0x05 - 0x04]; + /* 0x05 */ u8 field_0x05; + /* 0x06 */ u8 field_0x06; + /* 0x07 */ u8 field_0x07[0x08 - 0x07]; + /* 0x08 */ dStage_darkStatus_c mDarkStatus; }; class dScnPly_reg_childHIO_c { public: - virtual ~dScnPly_reg_childHIO_c(); + dScnPly_reg_childHIO_c(); + virtual ~dScnPly_reg_childHIO_c() {} - f32 mFloats[30]; - s16 mShorts[30]; + /* 0x04 */ f32 mFloatRegs[30]; + /* 0x7C */ s16 mShortRegs[10]; }; -class dScnPly_reg_HIO_c : public mDoHIO_entry_c { +class dScnPly_env_otherHIO_c { public: - void* field_0x04; - dScnPly_reg_childHIO_c mChild[22]; + dScnPly_env_otherHIO_c(); + virtual ~dScnPly_env_otherHIO_c() {} + + /* 0x04 */ u8 field_0x04; + /* 0x05 */ u8 field_0x05; + /* 0x06 */ u8 field_0x06; + /* 0x07 */ u8 field_0x07; + /* 0x08 */ u8 field_0x08; + /* 0x09 */ u8 field_0x09; + /* 0x0A */ u8 field_0x0a; + /* 0x0B */ u8 field_0x0b; + /* 0x0C */ u8 field_0x0c; + /* 0x0D */ u8 field_0x0d; + /* 0x0E */ u8 field_0x0e; + /* 0x0F */ u8 field_0x0f; + /* 0x10 */ u8 field_0x10; + /* 0x11 */ u8 field_0x11; + /* 0x12 */ u8 field_0x12; + /* 0x13 */ u8 field_0x13; + /* 0x14 */ u8 field_0x14; + /* 0x15 */ u8 field_0x15; + /* 0x16 */ u8 field_0x16; + /* 0x17 */ u8 field_0x17; + /* 0x18 */ u16 field_0x18[20]; + /* 0x40 */ s16 field_0x40; + /* 0x44 */ f32 field_0x44; }; -extern dScnPly_reg_HIO_c g_regHIO; +class dScnPly_env_debugHIO_c { +public: + dScnPly_env_debugHIO_c(); + virtual ~dScnPly_env_debugHIO_c() {} + + /* 0x04 */ u8 field_0x04[0x08 - 0x04]; + /* 0x08 */ f32 field_0x08; + /* 0x0C */ f32 field_0x0c; + /* 0x10 */ f32 field_0x10; + /* 0x14 */ f32 field_0x14; + /* 0x18 */ f32 field_0x18; + /* 0x1C */ f32 field_0x1c; + /* 0x20 */ f32 field_0x20; + /* 0x24 */ f32 field_0x24; + /* 0x28 */ f32 field_0x28; + /* 0x2C */ f32 field_0x2c; +}; + +class dScnPly_msg_HIO_c { +public: + dScnPly_msg_HIO_c(); + void dScnPly_msg_HIO_checkUpdate(u8); + void dScnPly_msg_HIO_setUpdate(u8); + void dScnPly_msg_HIO_numUpdate(s16, s16); + void dScnPly_msg_HIO_padCheck(); + void dScnPly_msg_HIO_messageProc(); + + virtual ~dScnPly_msg_HIO_c() {} + + /* 0x04 */ u8 field_0x04; + /* 0x05 */ u8 mIsUpdate; + /* 0x06 */ u8 field_0x06; + /* 0x07 */ u8 field_0x07; + /* 0x08 */ u8 field_0x08; + /* 0x09 */ u8 field_0x09; + /* 0x0A */ s16 mGroup; + /* 0x0C */ s16 mID; + /* 0x10 */ int field_0x10; +}; + +class dScnPly_preLoad_HIO_c : public mDoHIO_entry_c { +public: + virtual ~dScnPly_preLoad_HIO_c() {} +}; + +class dScnPly_env_HIO_c { +public: + virtual ~dScnPly_env_HIO_c() {} + + /* 0x04 */ u8 field_0x4; + /* 0x08 */ dScnPly_env_otherHIO_c mOther; + /* 0x50 */ dScnPly_env_debugHIO_c mEnvDebug; +}; + +class dScnPly_reg_HIO_c { +public: + virtual ~dScnPly_reg_HIO_c() {} + + /* 0x4 */ u8 field_0x4; + /* 0x8 */ dScnPly_reg_childHIO_c mChild[22]; +}; #endif /* D_S_PLAY */ diff --git a/include/d/d_snap.h b/include/d/d_snap.h new file mode 100644 index 000000000..13e6ce7de --- /dev/null +++ b/include/d/d_snap.h @@ -0,0 +1,7 @@ +#ifndef D_SNAP_H +#define D_SNAP_H + +void dSnap_DebugDraw(); +void dSnap_Execute(); + +#endif /* D_SNAP_H */ \ No newline at end of file diff --git a/include/d/d_stage.h b/include/d/d_stage.h index bc4135554..61bf310ac 100644 --- a/include/d/d_stage.h +++ b/include/d/d_stage.h @@ -417,6 +417,19 @@ public: /* 0x50 */ int mVrboxNum; }; +class dStage_darkStatus_c { +public: + // name to offset relation is guessed based on debug map + // may need to be fixed + + /* 0x00 */ u8 mRatio; + /* 0x01 */ u8 mNonAlpha[2]; + /* 0x04 */ f32 mNonScale[2]; + /* 0x0C */ int field_0xc; + /* 0x10 */ int field_0x10[2]; + /* 0x18 */ int field_0x18[2]; +}; + class dBgW_base; class dStage_roomStatus_c { public: @@ -469,6 +482,7 @@ public: static u32 getProcID() { return mProcID; } static void setStatusProcID(int i_roomNo, unsigned int i_id) { mStatus[i_roomNo].mProcID = i_id; } static int getStatusProcID(int i_roomNo) { return mStatus[i_roomNo].mProcID; } + static dStage_darkStatus_c& getDarkStatus(int i_idx) { return mDarkStatus[i_idx]; } static void setMemoryBlockID(int i_roomNo, int i_blockID) { mStatus[i_roomNo].mMemBlockID = i_blockID; @@ -492,6 +506,7 @@ public: static JKRExpHeap* mMemoryBlock[101]; static dStage_roomStatus_c mStatus[64]; + static dStage_darkStatus_c mDarkStatus[8]; static u32 mProcID; static s8 mStayNo; static s8 mOldStayNo; @@ -535,6 +550,7 @@ private: s8 dStage_roomRead_dt_c_GetReverbStage(roomRead_class&, int); int dStage_mapInfo_GetOceanZ(stage_map_info_class*); int dStage_mapInfo_GetOceanX(stage_map_info_class*); +void dStage_infoCreate(); inline s32 dStage_stagInfo_GetSaveTbl(stage_stag_info_class* i_stagInfo) { return (i_stagInfo->field_0x09 >> 1) & 0x7F; @@ -544,4 +560,8 @@ inline u32 dStage_stagInfo_GetSTType(stage_stag_info_class* i_stagInfo) { return (i_stagInfo->field_0x0c >> 16) & 7; } +inline u8 dStage_stagInfo_GetParticleNo(stage_stag_info_class* i_stagInfo) { + return (i_stagInfo->field_0x0a >> 0x3) & 0xFF; +} + #endif /* D_D_STAGE_H */ \ No newline at end of file diff --git a/include/f_op/f_op_msg_mng.h b/include/f_op/f_op_msg_mng.h index 9ae2018ab..80a69df88 100644 --- a/include/f_op/f_op_msg_mng.h +++ b/include/f_op/f_op_msg_mng.h @@ -3,6 +3,7 @@ #include "SSystem/SComponent/c_xyz.h" #include "f_pc/f_pc_leaf.h" +#include "f_op/f_op_msg.h" class JKRExpHeap; class JKRHeap; @@ -50,9 +51,9 @@ void fopMsgM_setMessageID(unsigned int); void fopMsgM_destroyExpHeap(JKRExpHeap*); f32 fopMsgM_valueIncrease(int param_0, int param_1, u8 param_2); s32 fopMsgM_setStageLayer(void*); -int fopMsgM_messageSet(u32 i_msgIdx, fopAc_ac_c* i_actorP, u32 param_2); -int fopMsgM_messageSet(u32 param_0, u32 param_1); -int fopMsgM_messageSet(u32 param_0, cXyz* param_1); +int fopMsgM_messageSet(u32 i_msgIdx, fopAc_ac_c* i_actorP); +int fopMsgM_messageSet(u32 param_0, cXyz*); +int fopMsgM_messageSet(u32 param_0); int fopMsgM_messageSetDemo(u32 param_0); msg_class* fopMsgM_SearchByID(unsigned int param_0); char* fopMsgM_messageGet(char* msg, u32 string_id); @@ -65,4 +66,6 @@ inline s32 fopMsgM_Timer_create(s16 param_0, u8 param_1, u32 param_2, u8 param_3 param_8, createFunc); } +u32 fopMsgM_searchMessageNumber(u32); + #endif diff --git a/include/f_op/f_op_scene.h b/include/f_op/f_op_scene.h index 20775d8dd..ee5b4bd1f 100644 --- a/include/f_op/f_op_scene.h +++ b/include/f_op/f_op_scene.h @@ -3,10 +3,15 @@ #include "f_op/f_op_scene_tag.h" #include "f_pc/f_pc_node.h" +#include "f_pc/f_pc_leaf.h" struct request_of_phase_process_class; class mDoDvdThd_command_c; +struct scene_method_class { + /* 0x00 */ leafdraw_method_class base; +}; + typedef struct scene_process_profile_definition { /* 0x00 */ node_process_profile_definition mBase; /* 0x20 */ process_method_class* mpMtd; // Subclass methods diff --git a/include/m_Do/m_Do_audio.h b/include/m_Do/m_Do_audio.h index 79f1da81e..1b6445b56 100644 --- a/include/m_Do/m_Do_audio.h +++ b/include/m_Do/m_Do_audio.h @@ -13,9 +13,13 @@ public: static bool isResetFlag() { return mResetFlag; } static void onResetFlag() { mResetFlag = true; } + static void offResetFlag() { mResetFlag = false; } static bool isInitFlag() { return mInitFlag; } + static bool isBgmSet() { return mBgmSet; } + static void offBgmSet() { mBgmSet = false; } + static void setLoadTimer(u8 i_timer) { mLoadTimer = i_timer; } static u8 getLoadTimer() { return mLoadTimer; } @@ -29,6 +33,8 @@ extern mDoAud_zelAudio_c g_mDoAud_zelAudio; void mDoAud_setSceneName(const char*, s32, s32); void mDoAud_Execute(); +BOOL mDoAud_isUsedHeapForStreamBuffer(); +int mDoAud_load1stDynamicWave(); extern JKRSolidHeap* g_mDoAud_audioHeap; @@ -36,6 +42,14 @@ inline void mDoAud_bgmStop(u32 param_0) { mDoAud_zelAudio_c::getInterface()->bgmStop(param_0, 0); } +inline void mDoAud_sceneBgmStart() { + mDoAud_zelAudio_c::getInterface()->sceneBgmStart(); +} + +inline void mDoAud_load2ndDynamicWave() { + mDoAud_zelAudio_c::getInterface()->load2ndDynamicWave(); +} + inline void mDoAud_resetProcess() { if (mDoAud_zelAudio_c::isResetFlag()) { mDoAud_zelAudio_c::getInterface()->resetProcess(); diff --git a/include/m_Do/m_Do_controller_pad.h b/include/m_Do/m_Do_controller_pad.h index 713044485..7957acc24 100644 --- a/include/m_Do/m_Do_controller_pad.h +++ b/include/m_Do/m_Do_controller_pad.h @@ -7,6 +7,32 @@ extern JUTGamePad* g_mDoCPd_gamePad[4]; extern interface_of_controller_pad g_mDoCPd_cpadInfo[4]; +#define CPad_CHECK_HOLD_A(padNo) (g_mDoCPd_cpadInfo[padNo].mButtonHold0 & 1) +#define CPad_CHECK_HOLD_B(padNo) ((g_mDoCPd_cpadInfo[padNo].mButtonHold1 >> 7) & 1) +#define CPad_CHECK_HOLD_X(padNo) ((g_mDoCPd_cpadInfo[padNo].mButtonHold1 >> 6) & 1) +#define CPad_CHECK_HOLD_Y(padNo) ((g_mDoCPd_cpadInfo[padNo].mButtonHold1 >> 5) & 1) +#define CPad_CHECK_HOLD_Z(padNo) ((g_mDoCPd_cpadInfo[padNo].mButtonHold0 >> 3) & 1) +#define CPad_CHECK_HOLD_START(padNo) ((g_mDoCPd_cpadInfo[padNo].mButtonHold1 >> 4) & 1) +#define CPad_CHECK_HOLD_L(padNo) ((g_mDoCPd_cpadInfo[padNo].mButtonHold0 >> 1) & 1) +#define CPad_CHECK_HOLD_R(padNo) ((g_mDoCPd_cpadInfo[padNo].mButtonHold0 >> 2) & 1) +#define CPad_CHECK_HOLD_UP(padNo) ((g_mDoCPd_cpadInfo[padNo].mButtonHold0 >> 4) & 1) +#define CPad_CHECK_HOLD_DOWN(padNo) ((g_mDoCPd_cpadInfo[padNo].mButtonHold0 >> 5) & 1) +#define CPad_CHECK_HOLD_RIGHT(padNo) ((g_mDoCPd_cpadInfo[padNo].mButtonHold0 >> 6) & 1) +#define CPad_CHECK_HOLD_LEFT(padNo) ((g_mDoCPd_cpadInfo[padNo].mButtonHold0 >> 7) & 1) + +#define CPad_CHECK_TRIG_A(padNo) (g_mDoCPd_cpadInfo[padNo].mButtonTrig0 & 1) +#define CPad_CHECK_TRIG_B(padNo) ((g_mDoCPd_cpadInfo[padNo].mButtonTrig1 >> 7) & 1) +#define CPad_CHECK_TRIG_X(padNo) ((g_mDoCPd_cpadInfo[padNo].mButtonTrig1 >> 6) & 1) +#define CPad_CHECK_TRIG_Y(padNo) ((g_mDoCPd_cpadInfo[padNo].mButtonTrig1 >> 5) & 1) +#define CPad_CHECK_TRIG_Z(padNo) ((g_mDoCPd_cpadInfo[padNo].mButtonTrig0 >> 3) & 1) +#define CPad_CHECK_TRIG_START(padNo) ((g_mDoCPd_cpadInfo[padNo].mButtonTrig1 >> 4) & 1) +#define CPad_CHECK_TRIG_L(padNo) ((g_mDoCPd_cpadInfo[padNo].mButtonTrig0 >> 1) & 1) +#define CPad_CHECK_TRIG_R(padNo) ((g_mDoCPd_cpadInfo[padNo].mButtonTrig0 >> 2) & 1) +#define CPad_CHECK_TRIG_UP(padNo) ((g_mDoCPd_cpadInfo[padNo].mButtonTrig0 >> 4) & 1) +#define CPad_CHECK_TRIG_DOWN(padNo) ((g_mDoCPd_cpadInfo[padNo].mButtonTrig0 >> 5) & 1) +#define CPad_CHECK_TRIG_RIGHT(padNo) ((g_mDoCPd_cpadInfo[padNo].mButtonTrig0 >> 6) & 1) +#define CPad_CHECK_TRIG_LEFT(padNo) ((g_mDoCPd_cpadInfo[padNo].mButtonTrig0 >> 7) & 1) + void mDoCPd_Create(); void mDoCPd_Read(); diff --git a/include/m_Do/m_Do_ext.h b/include/m_Do/m_Do_ext.h index ecfbd0d41..31a554f4e 100644 --- a/include/m_Do/m_Do_ext.h +++ b/include/m_Do/m_Do_ext.h @@ -290,6 +290,11 @@ JKRExpHeap* mDoExt_getZeldaHeap(); JKRExpHeap* mDoExt_getGameHeap(); JKRExpHeap* mDoExt_getArchiveHeap(); +int mDoExt_getSafeArchiveHeapSize(); +int mDoExt_getSafeGameHeapSize(); +int mDoExt_getSafeZeldaHeapSize(); +int mDoExt_getSafeCommandHeapSize(); + extern JKRExpHeap* zeldaHeap; extern JKRExpHeap* gameHeap; extern JKRExpHeap* archiveHeap; diff --git a/include/m_Do/m_Do_graphic.h b/include/m_Do/m_Do_graphic.h index c0ceefe7e..3d3ca202b 100644 --- a/include/m_Do/m_Do_graphic.h +++ b/include/m_Do/m_Do_graphic.h @@ -1,6 +1,79 @@ #ifndef M_DO_M_DO_GRAPHIC_H #define M_DO_M_DO_GRAPHIC_H +#include "JSystem/JFramework/JFWDisplay.h" +#include "dolphin/mtx/mtx.h" + void mDoGph_Create(); +struct ResTIMG; +class mDoGph_gInf_c { +public: + static void create(); + static void createHeap(); + static void alloc(u32, int); + static void free(); + static void fadeOut(f32, GXColor&); + static void onBlure(); + static void onBlure(const Mtx); + static void fadeOut(f32); + static void calcFade(); + static void onMonotone(); + static void offMonotone(); + static void calcMonotone(); + static void setFrameRate(u16); + static void getFrameRate(); + + static void setFader(JUTFader* fader) { + JFWDisplay::getManager()->setFader(fader); + mFader = fader; + } + + static int startFadeOut(int param_0) { return JFWDisplay::getManager()->startFadeOut(param_0); } + static int startFadeIn(int param_0) { return JFWDisplay::getManager()->startFadeIn(param_0); } + static void setFadeColor(JUtility::TColor color) { mFader->mColor.set(color); } + static void setClearColor(JUtility::TColor color) { + JFWDisplay::getManager()->setClearColor(color); + } + static void setBackColor(GXColor& color) { mBackColor = color; } + static void endFrame() { JFWDisplay::getManager()->endFrame(); } + static void offFade() { mFade = 0; } + static u8 isFade() { return mFade; } + static void offBlure() { mBlureFlag = false; } + static bool isBlure() { return mBlureFlag; } + static u8 getBlureRate() { return mBlureRate; } + static MtxP getBlureMtx() { return mBlureMtx; } + /* static void offAutoForcus() { data_80450BE7 = 0; } + static bool isAutoForcus() { return data_80450BE7; } */ + static void setTickRate(u32 rate) { JFWDisplay::getManager()->setTickRate(rate); } + static void waitBlanking(int wait) { JFWDisplay::getManager()->waitBlanking(wait); } + + static ResTIMG* getFrameBufferTimg() { return mFrameBufferTimg; } + static void* getFrameBufferTex() { return mFrameBufferTex; } + static void* getZbufferTex() { return mZbufferTex; } + static void setFadeRate(f32 rate) { mFadeRate = rate; } + static f32 getFadeRate() { return mFadeRate; } + static GXColor& getFadeColor() { return mFadeColor; } + static GXColor& getBackColor() { return mBackColor; } + static void endRender() { JFWDisplay::getManager()->endRender(); } + static GXTexObj* getZbufferTexObj() { return &mZbufferTexObj; } + static GXTexObj* getFrameBufferTexObj() { return &mFrameBufferTexObj; } + + static GXTexObj mFrameBufferTexObj; + static GXTexObj mZbufferTexObj; + static Mtx mBlureMtx; + static GXColor mBackColor; + static GXColor mFadeColor; + static JUTFader* mFader; + static ResTIMG* mFrameBufferTimg; + static void* mFrameBufferTex; + static ResTIMG* mZbufferTimg; + static void* mZbufferTex; + static f32 mFadeRate; + static f32 mFadeSpeed; + static bool mBlureFlag; + static u8 mBlureRate; + static u8 mFade; +}; + #endif /* M_DO_M_DO_GRAPHIC_H */ \ No newline at end of file diff --git a/src/d/d_s_play.cpp b/src/d/d_s_play.cpp index 69344ee17..82ae7d827 100644 --- a/src/d/d_s_play.cpp +++ b/src/d/d_s_play.cpp @@ -3,181 +3,613 @@ // Translation Unit: d_s_play.cpp // -#include "d_s_play.h" -#include "dolphin/types.h" +#include "d/d_s_play.h" +#include "JSystem/JKernel/JKRExpHeap.h" +#include "JSystem/JUtility/JUTAssert.h" +#include "JSystem/JUtility/JUTConsole.h" +#include "JSystem/JUtility/JUTReport.h" +#include "MSL_C/string.h" +#include "SSystem/SComponent/c_counter.h" +#include "d/actor/d_a_player_link.h" +#include "d/actor/d_a_title.h" +#include "d/d_com_inf_game.h" +#include "d/d_com_lib_game.h" +#include "d/d_kankyo_rain.h" +#include "d/d_material.h" +#include "d/d_meter.h" +#include "d/d_procname.h" +#include "d/d_snap.h" +#include "f_op/f_op_draw_iter.h" +#include "f_op/f_op_msg_mng.h" +#include "f_op/f_op_overlap_mng.h" +#include "f_pc/f_pc_manager.h" +#include "m_Do/m_Do_Reset.h" +#include "m_Do/m_Do_audio.h" +#include "m_Do/m_Do_controller_pad.h" +#include "m_Do/m_Do_dvd_thread.h" +#include "m_Do/m_Do_graphic.h" + +namespace daObjTribox { +class Act_c { +public: + static void reset(); +}; +}; // namespace daObjTribox + +s8 dScnPly_ply_c::pauseTimer; +s8 dScnPly_ply_c::nextPauseTimer; /* 80234570-802345B0 .text calcPauseTimer__13dScnPly_ply_cFv */ -void dScnPly_ply_c::calcPauseTimer() { - /* Nonmatching */ +s8 dScnPly_ply_c::calcPauseTimer() { + if (nextPauseTimer != 0) { + pauseTimer = nextPauseTimer; + nextPauseTimer = 0; + return pauseTimer; + } + + return cLib_calcTimer(&pauseTimer); } /* 802345B0-80234654 .text __ct__18dScnPly_dark_HIO_cFv */ dScnPly_dark_HIO_c::dScnPly_dark_HIO_c() { - /* Nonmatching */ + field_0x05 = 0; + field_0x06 = 0; + + mDarkStatus = dStage_roomControl_c::getDarkStatus(0); } +dScnPly_dark_HIO_c g_darkHIO; + /* 80234654-802346A4 .text __ct__22dScnPly_reg_childHIO_cFv */ dScnPly_reg_childHIO_c::dScnPly_reg_childHIO_c() { - /* Nonmatching */ + for (int i = 0; i < 30; i++) { + mFloatRegs[i] = 0.0f; + } + + for (int i = 0; i < 10; i++) { + mShortRegs[i] = 0; + } } +dScnPly_reg_HIO_c g_regHIO; + /* 802346A4-80234734 .text __ct__22dScnPly_env_otherHIO_cFv */ dScnPly_env_otherHIO_c::dScnPly_env_otherHIO_c() { - /* Nonmatching */ + field_0x05 = 1; + field_0x06 = 1; + field_0x40 = 0; + field_0x07 = 0; + field_0x08 = 0; + field_0x09 = 0; + field_0x44 = 4000.0f; + field_0x0a = 0; + field_0x0b = 0; + field_0x0c = 0; + field_0x0d = 128; + field_0x0e = 16; + field_0x0f = 0; + field_0x10 = 0; + field_0x11 = 0; + field_0x12 = 0; + field_0x15 = 0; + + for (int i = 0; i < 20; i++) { + field_0x18[i] = 0xFFFF; + } + + field_0x16 = 0; } /* 80234734-80234778 .text __ct__22dScnPly_env_debugHIO_cFv */ dScnPly_env_debugHIO_c::dScnPly_env_debugHIO_c() { - /* Nonmatching */ + field_0x08 = -100.0f; + field_0x0c = -100.0f; + field_0x10 = -100.0f; + + field_0x14 = 100.0f; + field_0x18 = 100.0f; + field_0x1c = 100.0f; + + field_0x20 = 0.0f; + field_0x24 = 0.0f; + field_0x28 = 0.0f; + + field_0x2c = 100.0f; } +dScnPly_env_HIO_c g_envHIO; + /* 80234778-802347B4 .text __ct__17dScnPly_msg_HIO_cFv */ dScnPly_msg_HIO_c::dScnPly_msg_HIO_c() { - /* Nonmatching */ + field_0x08 = 0; + mIsUpdate = false; + field_0x06 = 0; + field_0x07 = 0; + field_0x09 = 0; + mGroup = 0; + mID = 1; + field_0x10 = -1; } +dScnPly_msg_HIO_c g_msgDHIO; + /* 802347B4-802347BC .text dScnPly_msg_HIO_checkUpdate__17dScnPly_msg_HIO_cFUc */ -void dScnPly_msg_HIO_c::dScnPly_msg_HIO_checkUpdate(unsigned char) { - /* Nonmatching */ +void dScnPly_msg_HIO_c::dScnPly_msg_HIO_checkUpdate(u8 i_update) { + mIsUpdate = i_update; } /* 802347BC-802347C4 .text dScnPly_msg_HIO_setUpdate__17dScnPly_msg_HIO_cFUc */ -void dScnPly_msg_HIO_c::dScnPly_msg_HIO_setUpdate(unsigned char) { - /* Nonmatching */ +void dScnPly_msg_HIO_c::dScnPly_msg_HIO_setUpdate(u8 param_0) { + field_0x07 = param_0; } /* 802347C4-80234830 .text dScnPly_msg_HIO_numUpdate__17dScnPly_msg_HIO_cFss */ -void dScnPly_msg_HIO_c::dScnPly_msg_HIO_numUpdate(short, short) { - /* Nonmatching */ +void dScnPly_msg_HIO_c::dScnPly_msg_HIO_numUpdate(s16 i_addGroup, s16 i_addID) { + mGroup += i_addGroup; + mID += i_addID; + + if (mGroup > 99) { + mGroup = 99; + } + + if (mGroup < 0) { + mGroup = 0; + } + + if (mID > 0x7FFF) { + mID = 0x7FFF; + } + + if (mID < 0) { + mID = 0; + } } /* 80234830-80234AA8 .text dScnPly_msg_HIO_padCheck__17dScnPly_msg_HIO_cFv */ +// NONMATCHING - regswap void dScnPly_msg_HIO_c::dScnPly_msg_HIO_padCheck() { - /* Nonmatching */ + if (mIsUpdate) { + if (CPad_CHECK_TRIG_Z(3)) { + dScnPly_msg_HIO_checkUpdate(0); + } + + if (CPad_CHECK_TRIG_UP(3)) { + if (CPad_CHECK_HOLD_A(3)) { + dScnPly_msg_HIO_numUpdate(10, 0); + } else { + dScnPly_msg_HIO_numUpdate(1, 0); + } + } else if (CPad_CHECK_TRIG_DOWN(3)) { + if (CPad_CHECK_HOLD_A(3)) { + dScnPly_msg_HIO_numUpdate(-10, 0); + } else { + dScnPly_msg_HIO_numUpdate(-1, 0); + } + } else if (CPad_CHECK_TRIG_RIGHT(3)) { + if (CPad_CHECK_HOLD_Y(3)) { + dScnPly_msg_HIO_numUpdate(0, 1000); + } else if (CPad_CHECK_HOLD_X(3)) { + dScnPly_msg_HIO_numUpdate(0, 100); + } else if (CPad_CHECK_HOLD_A(3)) { + dScnPly_msg_HIO_numUpdate(0, 10); + } else { + dScnPly_msg_HIO_numUpdate(0, 1); + } + } else if (CPad_CHECK_TRIG_LEFT(3)) { + if (CPad_CHECK_HOLD_Y(3)) { + dScnPly_msg_HIO_numUpdate(0, -1000); + } else if (CPad_CHECK_HOLD_X(3)) { + dScnPly_msg_HIO_numUpdate(0, -100); + } else if (CPad_CHECK_HOLD_A(3)) { + dScnPly_msg_HIO_numUpdate(0, -10); + } else { + dScnPly_msg_HIO_numUpdate(0, -1); + } + } else if (CPad_CHECK_TRIG_B(3)) { + if (field_0x06 == 0) { + field_0x06 = 1; + } + } else if (field_0x07 != 0) { + if (field_0x06 == 0) { + field_0x06 = 1; + } + + dScnPly_msg_HIO_setUpdate(0); + } + + JUTReport(470, 250, "Group : %05d", mGroup); + JUTReport(470, 270, "ID : %05d", mID); + } } /* 80234AA8-80234B9C .text dScnPly_msg_HIO_messageProc__17dScnPly_msg_HIO_cFv */ +// NONMATCHING - regalloc void dScnPly_msg_HIO_c::dScnPly_msg_HIO_messageProc() { - /* Nonmatching */ + dScnPly_msg_HIO_padCheck(); + + if (field_0x06) { + if (field_0x10 == 0xFFFFFFFF) { + u32 msg_num = (mGroup << 0x10) | mID; + cXyz sp10(0.0f, 0.0f, 0.0f); + + if (mGroup != 99 && mGroup != 98 && mGroup != 89) { + msg_num = fopMsgM_searchMessageNumber(msg_num); + mGroup = (msg_num >> 0x10) & 0xFFFF; + mID = msg_num & 0xFFFF; + } + + field_0x10 = fopMsgM_messageSet(msg_num, &sp10); + } else { + msg_class* msg_p = fopMsgM_SearchByID(field_0x10); + if (msg_p != NULL) { + if (msg_p->mMode == 14) { + msg_p->mMode = 16; + } else if (msg_p->mMode == 18) { + msg_p->mMode = 19; + field_0x10 = -1; + field_0x06 = 0; + mID++; + } + } + } + } } /* 80234B9C-80234FD0 .text dScnPly_Draw__FP13dScnPly_ply_c */ -void dScnPly_Draw(dScnPly_ply_c*) { - /* Nonmatching */ +// NONMATCHING - close, just an issue with the wipe conditional +int dScnPly_Draw(dScnPly_ply_c* i_this) { + dComIfG_Ccsp()->Move(); + dComIfG_Bgsp()->ClrMoveFlag(); + + if (!fopOvlpM_IsPeek() && !dComIfG_resetToOpening(i_this) && fpcM_GetName(i_this) == PROC_PLAY_SCENE) { + if (dComIfGp_isEnableNextStage()) { + static s16 l_wipeType[] = {0, 0, 16, 17, 18, 1, 2, 1, 3, 3, 4, 4}; + + JUT_ASSERT(1001, + dComIfGp_getNextStageWipe() < (sizeof(l_wipeType) / sizeof(l_wipeType[0]))); + + if (strcmp(dComIfGp_getNextStageName(), "ENDING") == 0) { + fopScnM_ChangeReq(i_this, PROC_ENDING_SCENE, 0, 5); + mDoAud_bgmStop(30); + } else { + fopScnM_ChangeReq(i_this, PROC_PLAY_SCENE, l_wipeType[dComIfGp_getNextStageWipe()], 5); + + int hour = dKy_getdaytime_hour(); + bool useWhiteColor = false; + + if (dKy_checkEventNightStop()) { + useWhiteColor = true; + } else { + useWhiteColor = (hour >= 6 && hour < 18) == 0; + } + + int wipe = dComIfGp_getNextStageWipe(); + if (wipe == 1 || wipe == 2 || wipe == 7 || + ((wipe == 8 || wipe == 10) && useWhiteColor) || + ((wipe == 9 || wipe == 11) && !useWhiteColor)) + { + mDoGph_gInf_c::setFadeColor(g_saftyWhiteColor); + } else { + mDoGph_gInf_c::setFadeColor(g_blackColor); + } + + mDoAud_setSceneName(dComIfGp_getNextStageName(), dComIfGp_getNextStageRoomNo(), + dComIfGp_getNextStageLayer()); + } + } + } + + if (!dMenu_flag() && dScnPly_ply_c::pauseTimer == 0) { + dComIfGp_getVibration().Run(); + dMat_control_c::icePlay(); + dComIfGp_executeMagma(); + + if (dComIfGp_getGrass() != NULL || dComIfGp_getTree() != NULL || + dComIfGp_getWood() != NULL || dComIfGp_getFlower() != NULL || dKyr_poison_live_check()) + { + g_dComIfG_gameInfo.play.mCcS.PrepareMass(); + } + + dComIfGp_executeGrass(); + dComIfGp_executeTree(); + dComIfGp_executeWood(); + dComIfGp_executeFlower(); + dKyr_poison_light_colision(); + dComIfG_Bgsp()->Move(); + dSnap_Execute(); + + if (daPy_getPlayerLinkActorClass() == NULL || + !daPy_getPlayerLinkActorClass()->checkGameOverStart()) + { + dComIfGp_particle_calc3D(); + } + + dComIfGp_particle_calc2D(); + cCt_execCounter(); + } else { + dComIfGp_getVibration().Pause(); + } + + dComIfG_Ccsp()->MassClear(); + dComIfGp_particle_calcMenu(); + g_msgDHIO.dScnPly_msg_HIO_messageProc(); + dComIfGp_roomControl_checkDrawArea(); + + for (create_tag_class* i = fopDwIt_Begin(); i != NULL; i = fopDwIt_Next(i)) { + fpcM_Draw(i->mpTagData); + } + + if (!dMenu_flag()) { + dComIfGp_particle_drawModelParticle(); + dComIfGp_drawMagma(); + dComIfGp_drawGrass(); + dComIfGp_drawTree(); + dComIfGp_drawWood(); + dComIfGp_drawFlower(); + dComIfG_Ccsp()->Draw(); + dSnap_DebugDraw(); + dComIfGp_getAttention().Draw(); + dComIfGp_map_mapBufferSendAGB(3); + } + + return 1; } /* 80234FD0-802350B4 .text dScnPly_Execute__FP13dScnPly_ply_c */ -void dScnPly_Execute(dScnPly_ply_c*) { - /* Nonmatching */ +int dScnPly_Execute(dScnPly_ply_c* i_this) { + if (!fopOvlpM_IsPeek()) { + if (mDoAud_zelAudio_c::isBgmSet()) { + mDoAud_sceneBgmStart(); + mDoAud_load2ndDynamicWave(); + mDoAud_zelAudio_c::offBgmSet(); + } + + if (i_this->calcPauseTimer() != 0) { + return 1; + } + } + + dKy_itudemo_se(); + if (!dMenu_flag()) { + dComIfGp_demo_update(); + dComIfGp_evmng_execute(); + + if (dComIfGp_getAttention().Owner() != NULL) { + dComIfGp_getAttention().Run(-1); + } else { + dComIfGp_getAttention().Init(dComIfGp_getPlayer(0), 0); + } + + dComIfGp_getDetect().proc(); + } + + return 1; } /* 802350B4-802350BC .text dScnPly_IsDelete__FP13dScnPly_ply_c */ -void dScnPly_IsDelete(dScnPly_ply_c*) { - /* Nonmatching */ +int dScnPly_IsDelete(dScnPly_ply_c* i_this) { + return 1; } /* 802350BC-80235364 .text dScnPly_Delete__FP13dScnPly_ply_c */ -void dScnPly_Delete(dScnPly_ply_c*) { +void dScnPly_Delete(dScnPly_ply_c* i_this) { /* Nonmatching */ } /* 80235364-802355A8 .text heapSizeCheck__Fv */ -void heapSizeCheck() { - /* Nonmatching */ +BOOL heapSizeCheck() { + int archive_free = mDoExt_getArchiveHeap()->getFreeSize(); + int archive_total_free = mDoExt_getArchiveHeap()->getTotalFreeSize(); + f32 temp_f31 = (f32)archive_total_free / (f32)mDoExt_getSafeArchiveHeapSize(); + f32 temp_f30 = (f32)archive_free / (f32)archive_total_free; + + int game_free = mDoExt_getGameHeap()->getFreeSize(); + int game_total_free = mDoExt_getGameHeap()->getTotalFreeSize(); + f32 temp_f29 = (f32)game_total_free / (f32)mDoExt_getSafeGameHeapSize(); + f32 temp_f28 = (f32)game_free / (f32)game_total_free; + + mDoExt_getZeldaHeap()->getFreeSize(); + int zelda_total_free = mDoExt_getZeldaHeap()->getTotalFreeSize(); + f32 temp_f27 = (f32)zelda_total_free / (f32)mDoExt_getSafeZeldaHeapSize(); + + mDoExt_getCommandHeap()->getFreeSize(); + int command_total_free = mDoExt_getCommandHeap()->getTotalFreeSize(); + f32 temp_f1 = (f32)command_total_free / (f32)mDoExt_getSafeCommandHeapSize(); + + if (temp_f31 < 0.7f || temp_f30 < 0.7f || temp_f29 < 0.7f || temp_f28 < 0.7f || + temp_f27 < 0.7f || temp_f1 < 0.7f) + { + return 0; + } + + return 1; } /* 802355A8-802356B0 .text phase_00__FP13dScnPly_ply_c */ -void phase_00(dScnPly_ply_c*) { - /* Nonmatching */ +int phase_00(dScnPly_ply_c* i_this) { + if (mDoAud_isUsedHeapForStreamBuffer()) { + return 0; + } + + mDoGph_gInf_c::offBlure(); + + if (fpcM_GetName(i_this) != PROC_PLAY_SCENE) { + if (!heapSizeCheck()) { + mDoRst_reset(0, 0x80000000, 0); + } + + if (mDoRst::isReset()) { + if (mDoAud_zelAudio_c::isResetFlag()) { + mDoAud_zelAudio_c::getInterface()->resetRecover(); + mDoAud_zelAudio_c::offResetFlag(); + } + + mDoGph_gInf_c::offFade(); + mDoGph_gInf_c::offMonotone(); + dDlst_list_c::offWipe(); + daTitle_proc_c::daTitle_Kirakira_Sound_flag_on(); + daObjTribox::Act_c::reset(); + dComIfGp_offEnableNextStage(); + } + + dComIfGs_init(); + } else { + if (!heapSizeCheck()) { + JUT_WARN(3372, "%s", "Memory Danger !!"); + } + } + + return cPhs_NEXT_e; } /* 802356B0-802356E0 .text phase_01__FP13dScnPly_ply_c */ -void phase_01(dScnPly_ply_c*) { - /* Nonmatching */ +int phase_01(dScnPly_ply_c* i_this) { + if (!mDoAud_load1stDynamicWave()) { + return cPhs_INIT_e; + } else { + return cPhs_NEXT_e; + } } /* 802356E0-802357F4 .text phase_0__FP13dScnPly_ply_c */ -void phase_0(dScnPly_ply_c*) { +void phase_0(dScnPly_ply_c* i_this) { /* Nonmatching */ } +static mDoDvdThd_mountXArchive_c* l_lkDemoAnmCommand; + /* 802357F4-802359DC .text phase_1__FP13dScnPly_ply_c */ -void phase_1(dScnPly_ply_c*) { - /* Nonmatching */ +int phase_1(dScnPly_ply_c* i_this) { + if (l_lkDemoAnmCommand != NULL) { + if (!l_lkDemoAnmCommand->sync()) { + return 0; + } + + JUT_ASSERT(3439, l_lkDemoAnmCommand->getArchive()); + dComIfGp_setLkDemoAnmArchive(l_lkDemoAnmCommand->getArchive()); + + delete l_lkDemoAnmCommand; + } + + u32 id = fopScnM_GetID(i_this); + dStage_roomControl_c::setProcID(id); + + dComIfGp_setStartStage(dComIfGp_getNextStartStage()); + dComIfGp_offEnableNextStage(); + + JUTReportConsole_f("Start StageName:RoomNo [%s:%d]\n", dComIfGp_getStartStageName(), + dComIfGp_getStartStageRoomNo()); + dComIfGp_setStatus(0); + + int rt = dComIfG_setStageRes("Stage", NULL); + JUT_ASSERT(3458, rt == 1); + + dMat_control_c::create((J3DMaterialTable*)dComIfG_getObjectRes("Always", 0x41), + (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Always", 0x57)); + + return cPhs_NEXT_e; } /* 802359DC-80235ABC .text phase_2__FP13dScnPly_ply_c */ -void phase_2(dScnPly_ply_c*) { - /* Nonmatching */ +int phase_2(dScnPly_ply_c* i_this) { + int rt = dComIfG_syncStageRes("Stg_00"); + JUT_ASSERT(3485, rt >= 0) + + if (rt != 0) { + return cPhs_INIT_e; + } else { + dStage_infoCreate(); + u8 particle_no = dStage_stagInfo_GetParticleNo(dComIfGp_getStageStagInfo()); + dComIfGp_particle_readScene(particle_no, &i_this->sceneCommand); + return cPhs_NEXT_e; + } } /* 80235ABC-80235B0C .text phase_3__FP13dScnPly_ply_c */ -void phase_3(dScnPly_ply_c*) { - /* Nonmatching */ +int phase_3(dScnPly_ply_c* i_this) { + if ((i_this->sceneCommand != NULL && !i_this->sceneCommand->sync()) || + mDoAud_zelAudio_c::getInterface()->check1stDynamicWave()) + { + return cPhs_INIT_e; + } + + return cPhs_NEXT_e; } /* 80235B0C-80236334 .text phase_4__FP13dScnPly_ply_c */ -void phase_4(dScnPly_ply_c*) { +void phase_4(dScnPly_ply_c* i_this) { /* Nonmatching */ } /* 80236334-80236444 .text phase_5__FP13dScnPly_ply_c */ -void phase_5(dScnPly_ply_c*) { +void phase_5(dScnPly_ply_c* i_this) { /* Nonmatching */ } /* 80236444-80236554 .text phase_6__FP13dScnPly_ply_c */ -void phase_6(dScnPly_ply_c*) { +void phase_6(dScnPly_ply_c* i_this) { /* Nonmatching */ } /* 80236554-8023655C .text phase_compleate__FPv */ -void phase_compleate(void*) { - /* Nonmatching */ +int phase_compleate(void* i_this) { + return cPhs_COMPLEATE_e; } /* 8023655C-8023658C .text dScnPly_Create__FP11scene_class */ -void dScnPly_Create(scene_class*) { - /* Nonmatching */ +int dScnPly_Create(scene_class* i_this) { + static request_of_phase_process_fn l_method[] = { + (request_of_phase_process_fn)phase_00, (request_of_phase_process_fn)phase_01, + (request_of_phase_process_fn)phase_0, (request_of_phase_process_fn)phase_1, + (request_of_phase_process_fn)phase_2, (request_of_phase_process_fn)phase_3, + (request_of_phase_process_fn)phase_4, (request_of_phase_process_fn)phase_5, + (request_of_phase_process_fn)phase_6, (request_of_phase_process_fn)phase_compleate, + }; + + return dComLbG_PhaseHandler(&static_cast(i_this)->mLoadPhs, l_method, i_this); } -/* 8023658C-802365D4 .text __dt__17dScnPly_msg_HIO_cFv */ -dScnPly_msg_HIO_c::~dScnPly_msg_HIO_c() { - /* Nonmatching */ -} +static scene_method_class l_dScnPly_Method = { + (process_method_func)dScnPly_Create, (process_method_func)dScnPly_Delete, + (process_method_func)dScnPly_Execute, (process_method_func)dScnPly_IsDelete, + (process_method_func)dScnPly_Draw, +}; -/* 802365D4-8023661C .text __dt__22dScnPly_env_debugHIO_cFv */ -dScnPly_env_debugHIO_c::~dScnPly_env_debugHIO_c() { - /* Nonmatching */ -} +extern scene_process_profile_definition g_profile_PLAY_SCENE = { + fpcLy_ROOT_e, + 1, + fpcPi_CURRENT_e, + PROC_PLAY_SCENE, + &g_fpcLf_Method.mBase, + sizeof(dScnPly_ply_c), + 0, + 0, + &g_fopScn_Method.mBase, + &l_dScnPly_Method.base.mBase, +}; -/* 8023661C-80236664 .text __dt__22dScnPly_env_otherHIO_cFv */ -dScnPly_env_otherHIO_c::~dScnPly_env_otherHIO_c() { - /* Nonmatching */ -} - -/* 80236664-802366AC .text __dt__22dScnPly_reg_childHIO_cFv */ -dScnPly_reg_childHIO_c::~dScnPly_reg_childHIO_c() { - /* Nonmatching */ -} - -/* 802366AC-802366F4 .text __dt__18dScnPly_dark_HIO_cFv */ -dScnPly_dark_HIO_c::~dScnPly_dark_HIO_c() { - /* Nonmatching */ -} - -/* 802367F8-80236854 .text __dt__21dScnPly_preLoad_HIO_cFv */ -dScnPly_preLoad_HIO_c::~dScnPly_preLoad_HIO_c() { - /* Nonmatching */ -} - -/* 80236854-802368C8 .text __dt__17dScnPly_env_HIO_cFv */ -dScnPly_env_HIO_c::~dScnPly_env_HIO_c() { - /* Nonmatching */ -} - -/* 802368C8-80236938 .text __dt__17dScnPly_reg_HIO_cFv */ -dScnPly_reg_HIO_c::~dScnPly_reg_HIO_c() { - /* Nonmatching */ -} +extern scene_process_profile_definition g_profile_OPENING_SCENE = { + fpcLy_ROOT_e, + 1, + fpcPi_CURRENT_e, + PROC_OPENING_SCENE, + &g_fpcLf_Method.mBase, + sizeof(dScnPly_ply_c), + 0, + 0, + &g_fopScn_Method.mBase, + &l_dScnPly_Method.base.mBase, +}; +extern scene_process_profile_definition g_profile_OPENING2_SCENE = { + fpcLy_ROOT_e, + 1, + fpcPi_CURRENT_e, + PROC_OPENING2_SCENE, + &g_fpcLf_Method.mBase, + sizeof(dScnPly_ply_c), + 0, + 0, + &g_fopScn_Method.mBase, + &l_dScnPly_Method.base.mBase, +}; diff --git a/src/m_Do/m_Do_controller_pad.cpp b/src/m_Do/m_Do_controller_pad.cpp index 629c8070f..282ef0eec 100644 --- a/src/m_Do/m_Do_controller_pad.cpp +++ b/src/m_Do/m_Do_controller_pad.cpp @@ -27,7 +27,7 @@ inline void mDoCPd_TRIGGER_CONV(u8 analog, f32& param_1) { /* 80007598-800078C0 .text mDoCPd_Convert__FP27interface_of_controller_padP10JUTGamePad */ static s32 mDoCPd_Convert(interface_of_controller_pad* pInterface, JUTGamePad* pPad) { - pInterface->mButtonFlags = pPad->getButton(); + // pInterface->mButtonFlags = pPad->getButton(); pInterface->mMainStickPosX = pPad->getMainStickX(); pInterface->mMainStickPosY = pPad->getMainStickY(); pInterface->mMainStickValue = pPad->getMainStickValue();