diff options
| author | TakaRikka <38417346+TakaRikka@users.noreply.github.com> | 2022-06-27 17:23:08 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-06-27 17:23:08 -0700 |
| commit | cd5b02450cf278cbeb2c8bb90be1ad22518938c7 (patch) | |
| tree | d69e02aa4b1e45ae2865389a4d70c28969ebe475 /src/d | |
| parent | fb9dd3cdee440e61d96ddd2efd0216a99df14997 (diff) | |
| parent | 0b060164da0da9062813792880eb1304652022f1 (diff) | |
Merge pull request #200 from lepelog/event_data
Event data
Diffstat (limited to 'src/d')
| -rw-r--r-- | src/d/a/d_a_alink.cpp | 2 | ||||
| -rw-r--r-- | src/d/d_demo.cpp | 38 | ||||
| -rw-r--r-- | src/d/d_gameover.cpp | 84 | ||||
| -rw-r--r-- | src/d/d_name.cpp | 1 | ||||
| -rw-r--r-- | src/d/event/d_event.cpp | 2 | ||||
| -rw-r--r-- | src/d/event/d_event_data.cpp | 1239 | ||||
| -rw-r--r-- | src/d/event/d_event_lib.cpp | 282 | ||||
| -rw-r--r-- | src/d/event/d_event_manager.cpp | 4 |
8 files changed, 1109 insertions, 543 deletions
diff --git a/src/d/a/d_a_alink.cpp b/src/d/a/d_a_alink.cpp index df0a1b555d..eefe632c4b 100644 --- a/src/d/a/d_a_alink.cpp +++ b/src/d/a/d_a_alink.cpp @@ -19218,7 +19218,7 @@ MtxP daAlink_c::getRightItemMatrix() { /* 800CF344-800CF380 0C9C84 003C+00 1/0 0/0 0/0 .text checkPlayerNoDraw__9daAlink_cFv */ BOOL daAlink_c::checkPlayerNoDraw() { return dComIfGp_checkCameraAttentionStatus(field_0x317c, 2) || - i_checkNoResetFlg0(FLG0_UNK_8000000); + i_checkNoResetFlg0(PLAYER_NO_DRAW); } /* 800CF380-800CFC3C 0C9CC0 08BC+00 1/1 0/0 0/0 .text __ct__9daAlink_cFv */ diff --git a/src/d/d_demo.cpp b/src/d/d_demo.cpp index 4d8d7c3ad4..4ba75c4d93 100644 --- a/src/d/d_demo.cpp +++ b/src/d/d_demo.cpp @@ -221,38 +221,6 @@ struct dDemo_camera_c { /* 80039FFC */ ~dDemo_camera_c(); }; -struct dDemo_c { - /* 80039678 */ void create(); - /* 80039910 */ void remove(); - /* 80039B6C */ void start(u8 const*, cXyz*, f32); - /* 80039CF8 */ void end(); - /* 80039D4C */ void branch(); - /* 80039DA4 */ void update(); - /* 80039EDC */ void setBranchType(u16); - /* 80039EEC */ void setBranchId(u16, s16); - /* 80039F04 */ void reset(); - - static u16 m_branchId[1 + 3 /* padding */]; - static u8 m_system[4]; - static u8 m_control[4]; - static u8 m_stage[4]; - static u8 m_audio[4]; - static u8 m_particle[4]; - static u8 m_message[4]; - static u8 m_factory[4]; - static u8 m_mesgControl[4]; - static u8 m_object[4]; - static u8 m_data[4]; - static u8 m_frame[4]; - static u8 m_translation[4]; - static f32 m_rotationY; - static u8 m_frameNoMsg[4]; - static u8 m_mode[4]; - static u8 m_status[4]; - static u8 m_branchType[2 + 2 /* padding */]; - static u8 m_branchData[4]; -}; - struct dDemo_ambient_c { /* 80038DF0 */ void JSGSetColor(_GXColor); /* 800394C8 */ ~dDemo_ambient_c(); @@ -977,7 +945,7 @@ static u8 dummy[20]; u8 dDemo_c::m_system[4]; /* 80450E04-80450E08 000304 0004+00 6/6 3/3 0/0 .sbss m_control__7dDemo_c */ -u8 dDemo_c::m_control[4]; +JStudio::stb::TControl* dDemo_c::m_control; /* 80450E08-80450E0C 000308 0004+00 2/2 0/0 0/0 .sbss m_stage__7dDemo_c */ u8 dDemo_c::m_stage[4]; @@ -1013,10 +981,10 @@ u8 dDemo_c::m_translation[4]; f32 dDemo_c::m_rotationY; /* 80450E34-80450E38 000334 0004+00 2/2 1/1 0/0 .sbss m_frameNoMsg__7dDemo_c */ -u8 dDemo_c::m_frameNoMsg[4]; +u32 dDemo_c::m_frameNoMsg; /* 80450E38-80450E3C 000338 0004+00 4/4 4/4 0/0 .sbss m_mode__7dDemo_c */ -u8 dDemo_c::m_mode[4]; +s32 dDemo_c::m_mode; /* 80450E3C-80450E40 00033C 0004+00 2/2 1/1 0/0 .sbss m_status__7dDemo_c */ u8 dDemo_c::m_status[4]; diff --git a/src/d/d_gameover.cpp b/src/d/d_gameover.cpp index 33f61dc2dc..e3f7aba547 100644 --- a/src/d/d_gameover.cpp +++ b/src/d/d_gameover.cpp @@ -13,8 +13,6 @@ struct request_of_phase_process_class {}; -struct msg_class {}; - struct mDoRst { static u8 mResetData[4 + 4 /* padding */]; }; @@ -28,8 +26,6 @@ struct mDoGph_gInf_c { static f32 mFadeRate; }; -struct fopAc_ac_c {}; - struct dSv_player_item_c { /* 80032FB8 */ void setItem(int, u8); /* 80033030 */ void getItem(int, bool) const; @@ -86,31 +82,6 @@ struct dGov_HIO_c { /* 8019C06C */ ~dGov_HIO_c(); }; -struct dGameover_c { - /* 8019B044 */ void _create(); - /* 8019B2F4 */ void _execute(); - /* 8019B384 */ void playerAnmWait_init(); - /* 8019B388 */ void playerAnmWait_proc(); - /* 8019B3A0 */ void dispFadeOut_init(); - /* 8019B3E8 */ void dispFadeOut_proc(); - /* 8019B40C */ void dispWait_init(); - /* 8019B454 */ void dispWait_proc(); - /* 8019B478 */ void demoFadeIn_init(); - /* 8019B484 */ void demoFadeIn_proc(); - /* 8019B4D8 */ void demoFadeOut_init(); - /* 8019B4E4 */ void demoFadeOut_proc(); - /* 8019B560 */ void saveOpen_init(); - /* 8019B564 */ void saveOpen_proc(); - /* 8019B5A4 */ void saveMove_init(); - /* 8019B5A8 */ void saveMove_proc(); - /* 8019B5F0 */ void saveClose_init(); - /* 8019B5F4 */ void saveClose_proc(); - /* 8019B7BC */ void deleteWait_init(); - /* 8019B7C0 */ void deleteWait_proc(); - /* 8019B7C4 */ void _draw(); - /* 8019B864 */ void _delete(); -}; - struct dDlst_base_c {}; struct dDlst_list_c { @@ -122,8 +93,6 @@ struct dDlst_Gameover_CAPTURE_c { /* 8019C2CC */ ~dDlst_Gameover_CAPTURE_c(); }; -struct JKRArchive {}; - struct dDlst_GameOverScrnDraw_c { /* 8019B940 */ dDlst_GameOverScrnDraw_c(JKRArchive*); /* 8019BBFC */ ~dDlst_GameOverScrnDraw_c(); @@ -131,24 +100,6 @@ struct dDlst_GameOverScrnDraw_c { /* 8019BCF4 */ void draw(); }; -struct cXyz {}; - -struct ResTLUT {}; - -struct ResTIMG {}; - -struct JKRHeap { - /* 802CE5CC */ void freeAll(); - /* 802CE784 */ void getTotalFreeSize(); -}; - -struct JGeometry { - template <typename A1> - struct TBox2 {}; - /* TBox2<f32> */ - struct TBox2__template0 {}; -}; - struct JFWDisplay { static u8 sManager[4]; }; @@ -254,38 +205,6 @@ extern "C" void setPriority__9J2DScreenFPCcUlP10JKRArchive(); extern "C" void draw__9J2DScreenFffPC14J2DGrafContext(); extern "C" void func_802FC800(); extern "C" void setString__10J2DTextBoxFPCce(); -extern "C" void C_MTXOrtho(); -extern "C" void GXSetVtxDesc(); -extern "C" void GXClearVtxDesc(); -extern "C" void GXSetVtxAttrFmt(); -extern "C" void GXSetTexCoordGen2(); -extern "C" void GXSetNumTexGens(); -extern "C" void GXPixModeSync(); -extern "C" void GXBegin(); -extern "C" void GXSetCullMode(); -extern "C" void GXSetTexCopySrc(); -extern "C" void GXSetTexCopyDst(); -extern "C" void GXCopyTex(); -extern "C" void GXSetNumChans(); -extern "C" void GXInitTexObj(); -extern "C" void GXInitTexObjLOD(); -extern "C" void GXLoadTexObj(); -extern "C" void GXSetTevColorIn(); -extern "C" void GXSetTevAlphaIn(); -extern "C" void GXSetTevColorOp(); -extern "C" void GXSetTevAlphaOp(); -extern "C" void GXSetAlphaCompare(); -extern "C" void GXSetTevOrder(); -extern "C" void GXSetNumTevStages(); -extern "C" void GXSetFog(); -extern "C" void GXSetFogRangeAdj(); -extern "C" void GXSetBlendMode(); -extern "C" void GXSetZMode(); -extern "C" void GXSetZCompLoc(); -extern "C" void GXSetDither(); -extern "C" void GXSetProjection(); -extern "C" void GXLoadPosMtxImm(); -extern "C" void GXSetCurrentMtx(); extern "C" void __register_global_object(); extern "C" void __ptmf_scall(); extern "C" void _savegpr_24(); @@ -297,7 +216,6 @@ extern "C" void _restgpr_29(); extern "C" void strcmp(); extern "C" extern u8 g_mDoMtx_identity[48 + 24 /* padding */]; extern "C" extern void* g_fopMsg_Method[5 + 1 /* padding */]; -extern "C" extern void* g_fpcLf_Method[5 + 1 /* padding */]; extern "C" extern void* __vt__12dDlst_base_c[3]; extern "C" u8 saveBitLabels__16dSv_event_flag_c[1644 + 4 /* padding */]; extern "C" extern void* __vt__14mDoHIO_entry_c[3]; @@ -981,7 +899,7 @@ static asm void dGameover_Create(msg_class* param_0) { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void d_GameOver_Create(u8 param_0) { +asm s32 d_GameOver_Create(u8 param_0) { nofralloc #include "asm/d/d_gameover/d_GameOver_Create__FUc.s" } diff --git a/src/d/d_name.cpp b/src/d/d_name.cpp index fa74ecb42d..7ed8aed09a 100644 --- a/src/d/d_name.cpp +++ b/src/d/d_name.cpp @@ -1428,6 +1428,7 @@ s32 dName_c::getMenuPosIdx(u8 selPos) { case 3: return 3; } + //!@bug UB: no default return } /* 80251094-8025115C 24B9D4 00C8+00 1/0 0/0 0/0 .text draw__14dDlst_NameIN_cFv */ diff --git a/src/d/event/d_event.cpp b/src/d/event/d_event.cpp index 025b6f7473..942fb09b8e 100644 --- a/src/d/event/d_event.cpp +++ b/src/d/event/d_event.cpp @@ -686,7 +686,7 @@ asm void* dEvt_control_c::convPId(unsigned int param_0) { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void dEvt_control_c::getStbDemoData(char* param_0) { +asm void* dEvt_control_c::getStbDemoData(char* param_0) { nofralloc #include "asm/d/event/d_event/getStbDemoData__14dEvt_control_cFPc.s" } diff --git a/src/d/event/d_event_data.cpp b/src/d/event/d_event_data.cpp index 9f3c49323c..86140548c4 100644 --- a/src/d/event/d_event_data.cpp +++ b/src/d/event/d_event_data.cpp @@ -5,25 +5,13 @@ #include "d/event/d_event_data.h" #include "d/com/d_com_inf_game.h" +#include "d/d_camera.h" +#include "d/d_demo.h" +#include "d/d_gameover.h" +#include "d/msg/d_msg_object.h" #include "dol2asm.h" #include "dolphin/types.h" - -// -// Types: -// - -struct dDemo_c { - /* 80039B6C */ void start(u8 const*, cXyz*, f32); - /* 80039CF8 */ void end(); - - static u8 m_control[4]; - static u8 m_frameNoMsg[4]; - static u8 m_mode[4]; -}; - -struct dCamera_c { - /* 80181170 */ void StartBlure(int, fopAc_ac_c*, f32, f32); -}; +#include "f_op/f_op_msg_mng.h" // // Forward References: @@ -140,88 +128,121 @@ extern "C" u8 mAudioMgrPtr__10Z2AudioMgr[4 + 4 /* padding */]; // Declarations: // +inline dEvent_manager_c& dComIfGp_getEventManager() { + return g_dComIfG_gameInfo.play.getEvtManager(); +} + +inline BOOL dComIfGs_isEventBit(u16 id) { + return g_dComIfG_gameInfo.info.getEvent().isEventBit(id); +} + +inline s32 dStage_stagInfo_GetSaveTbl(stage_stag_info_class* param_0) { + return param_0->field_0x09 >> 1 & 0x1f; +} + +inline BOOL dEvDtFlagCheck(int flag) { + return dComIfGp_getEventManager().flagCheck(flag); +} + +inline void dEvDtFlagSet(int flag) { + dComIfGp_getEventManager().setFlag(flag); +} + +inline dEvt_control_c& dComIfGp_getEvent() { + return g_dComIfG_gameInfo.play.getEvent(); +} + +struct TelopDataStruct { + s32 mName; + u16 mTelopNo; + u16 _6; + u16 _8; + // padding +}; + /* ############################################################################################## */ /* 803A7FB0-803A8238 0050D0 0288+00 2/2 0/0 0/0 .data TelopData */ -SECTION_DATA static u8 TelopData[648] = { - 0x44, 0x30, 0x35, 0x00, 0x04, 0x4D, 0x10, 0x69, 0x00, 0x03, 0x00, 0x00, 0x44, 0x30, 0x35, 0x41, - 0x04, 0x4D, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x44, 0x30, 0x35, 0x42, 0x04, 0x4D, 0xFF, 0xFF, - 0x00, 0x00, 0x00, 0x00, 0x44, 0x30, 0x34, 0x00, 0x04, 0x4E, 0xFF, 0xFF, 0x00, 0x01, 0x00, 0x00, - 0x44, 0x30, 0x34, 0x41, 0x04, 0x4E, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x44, 0x30, 0x34, 0x42, - 0x04, 0x4E, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x44, 0x30, 0x31, 0x00, 0x04, 0x4F, 0x12, 0x78, - 0x00, 0x03, 0x00, 0x00, 0x44, 0x30, 0x31, 0x41, 0x04, 0x4F, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, - 0x44, 0x30, 0x31, 0x42, 0x04, 0x4F, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x44, 0x31, 0x30, 0x00, - 0x04, 0x50, 0x13, 0x2C, 0x00, 0x03, 0x00, 0x00, 0x44, 0x31, 0x30, 0x41, 0x04, 0x50, 0xFF, 0xFF, - 0x00, 0x00, 0x00, 0x00, 0x44, 0x31, 0x30, 0x42, 0x04, 0x50, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, - 0x44, 0x31, 0x31, 0x00, 0x04, 0x51, 0x14, 0x78, 0x00, 0x03, 0x00, 0x00, 0x44, 0x31, 0x31, 0x41, - 0x04, 0x51, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x44, 0x31, 0x31, 0x42, 0x04, 0x51, 0xFF, 0xFF, - 0x00, 0x00, 0x00, 0x00, 0x44, 0x30, 0x36, 0x00, 0x04, 0x52, 0x15, 0x59, 0x00, 0x03, 0x00, 0x00, - 0x44, 0x30, 0x36, 0x41, 0x04, 0x52, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x44, 0x30, 0x36, 0x42, - 0x04, 0x52, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x44, 0x30, 0x37, 0x00, 0x04, 0x53, 0x16, 0x39, - 0x00, 0x03, 0x00, 0x00, 0x44, 0x30, 0x37, 0x41, 0x04, 0x53, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, - 0x44, 0x30, 0x37, 0x42, 0x04, 0x53, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x44, 0x30, 0x38, 0x00, - 0x04, 0x54, 0xFF, 0xFF, 0x00, 0x01, 0x00, 0x00, 0x44, 0x30, 0x38, 0x41, 0x04, 0x54, 0xFF, 0xFF, - 0x00, 0x00, 0x00, 0x00, 0x44, 0x30, 0x38, 0x42, 0x04, 0x54, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, - 0x44, 0x30, 0x38, 0x43, 0x04, 0x54, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x44, 0x30, 0x38, 0x44, - 0x04, 0x54, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x44, 0x30, 0x39, 0x00, 0x04, 0x55, 0xFF, 0xFF, - 0x00, 0x01, 0x00, 0x00, 0x44, 0x30, 0x39, 0x41, 0x04, 0x55, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, - 0x44, 0x30, 0x39, 0x42, 0x04, 0x55, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x44, 0x30, 0x39, 0x43, - 0x04, 0x55, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x46, 0x30, 0x30, 0x00, 0x04, 0x56, 0xFF, 0xFF, - 0x00, 0x01, 0x00, 0x00, 0x46, 0x31, 0x30, 0x33, 0x04, 0x57, 0x00, 0x0A, 0x00, 0x03, 0x00, 0x00, - 0x52, 0x30, 0x31, 0x00, 0x04, 0x57, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x46, 0x31, 0x30, 0x39, - 0x04, 0x58, 0xFF, 0xFF, 0x00, 0x01, 0x00, 0x00, 0x52, 0x31, 0x30, 0x39, 0x04, 0x58, 0xFF, 0xFF, - 0x00, 0x00, 0x00, 0x00, 0x52, 0x32, 0x30, 0x39, 0x04, 0x58, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, - 0x46, 0x31, 0x31, 0x32, 0x04, 0x59, 0x04, 0x09, 0x00, 0x03, 0x00, 0x00, 0x46, 0x31, 0x31, 0x33, - 0x04, 0x5A, 0x04, 0x00, 0x00, 0x03, 0x00, 0x00, 0x46, 0x31, 0x30, 0x38, 0x04, 0x5B, 0xFF, 0xFF, - 0x00, 0x01, 0x00, 0x00, 0x52, 0x31, 0x30, 0x38, 0x04, 0x5B, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, - 0x46, 0x31, 0x31, 0x35, 0x04, 0x5C, 0x04, 0x1E, 0x00, 0x03, 0x00, 0x00, 0x46, 0x31, 0x31, 0x31, - 0x04, 0x5E, 0xFF, 0xFF, 0x00, 0x01, 0x00, 0x00, 0x46, 0x31, 0x32, 0x34, 0x04, 0x5F, 0xFF, 0xFF, - 0x00, 0x01, 0x00, 0x00, 0x46, 0x31, 0x31, 0x34, 0x04, 0x60, 0x08, 0x00, 0x00, 0x03, 0x00, 0x00, - 0x46, 0x31, 0x32, 0x35, 0x04, 0x61, 0x0A, 0x0C, 0x00, 0x03, 0x00, 0x00, 0x46, 0x31, 0x32, 0x31, - 0x04, 0x62, 0x06, 0x2D, 0x00, 0x03, 0x00, 0x00, 0x46, 0x31, 0x32, 0x32, 0x04, 0x62, 0x06, 0x2D, - 0x00, 0x03, 0x00, 0x00, 0x46, 0x31, 0x32, 0x33, 0x04, 0x62, 0x06, 0x2D, 0x00, 0x03, 0x00, 0x00, - 0x46, 0x31, 0x31, 0x37, 0x04, 0x63, 0xFF, 0xFF, 0x00, 0x01, 0x00, 0x00, 0x46, 0x31, 0x32, 0x38, - 0x04, 0x6E, 0x03, 0x2E, 0x00, 0x03, 0x00, 0x00, 0x52, 0x31, 0x32, 0x38, 0x04, 0x6E, 0xFF, 0xFF, - 0x00, 0x00, 0x00, 0x00, 0x46, 0x31, 0x32, 0x37, 0x04, 0x74, 0xFF, 0xFF, 0x00, 0x01, 0x00, 0x00, - 0x52, 0x31, 0x32, 0x37, 0x04, 0x74, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x46, 0x31, 0x32, 0x36, - 0x04, 0x75, 0xFF, 0xFF, 0x00, 0x01, 0x00, 0x00, -}; +static TelopDataStruct TelopData[] = { + {'D05\0', 1101, 4201, 3}, {'D05A', 1101, -1, 0}, {'D05B', 1101, -1, 0}, + {'D04\0', 1102, -1, 1}, {'D04A', 1102, -1, 0}, {'D04B', 1102, -1, 0}, + {'D01\0', 1103, 4728, 3}, {'D01A', 1103, -1, 0}, {'D01B', 1103, -1, 0}, + {'D10\0', 1104, 4908, 3}, {'D10A', 1104, -1, 0}, {'D10B', 1104, -1, 0}, + {'D11\0', 1105, 5240, 3}, {'D11A', 1105, -1, 0}, {'D11B', 1105, -1, 0}, + {'D06\0', 1106, 5465, 3}, {'D06A', 1106, -1, 0}, {'D06B', 1106, -1, 0}, + {'D07\0', 1107, 5689, 3}, {'D07A', 1107, -1, 0}, {'D07B', 1107, -1, 0}, + {'D08\0', 1108, -1, 1}, {'D08A', 1108, -1, 0}, {'D08B', 1108, -1, 0}, + {'D08C', 1108, -1, 0}, {'D08D', 1108, -1, 0}, {'D09\0', 1109, -1, 1}, + {'D09A', 1109, -1, 0}, {'D09B', 1109, -1, 0}, {'D09C', 1109, -1, 0}, + {'F00\0', 1110, -1, 1}, {'F103', 1111, 10, 3}, {'R01\0', 1111, -1, 0}, + {'F109', 1112, -1, 1}, {'R109', 1112, -1, 0}, {'R209', 1112, -1, 0}, + {'F112', 1113, 1033, 3}, {'F113', 1114, 1024, 3}, {'F108', 1115, -1, 1}, + {'R108', 1115, -1, 0}, {'F115', 1116, 1054, 3}, {'F111', 1118, -1, 1}, + {'F124', 1119, -1, 1}, {'F114', 1120, 2048, 3}, {'F125', 1121, 2572, 3}, + {'F121', 1122, 1581, 3}, {'F122', 1122, 1581, 3}, {'F123', 1122, 1581, 3}, + {'F117', 1123, -1, 1}, {'F128', 1134, 814, 3}, {'R128', 1134, -1, 0}, + {'F127', 1140, -1, 1}, {'R127', 1140, -1, 0}, {'F126', 1141, -1, 1}}; /* 80450640-80450648 0000C0 0004+04 2/2 0/0 0/0 .sdata numTelopData */ -SECTION_SDATA static u32 numTelopData[1 + 1 /* padding */] = { - 0x00000036, - /* padding */ - 0x00000000, -}; +static s32 numTelopData = ARRAY_SIZE(TelopData); /* 8004372C-800437C4 03E06C 0098+00 2/2 0/0 0/0 .text getTelopNo__FPCc */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void getTelopNo(char const* param_0) { - nofralloc -#include "asm/d/event/d_event_data/getTelopNo__FPCc.s" +static u16 getTelopNo(char const* pName) { + s32 val = + ((pName[3] == 'B' ? 'd' : pName[0]) << 0x18 | pName[4] << 0x10 | pName[5] << 8 | pName[6]); + for (s32 i = 0; i < numTelopData; i++) { + if (val == TelopData[i].mName) { + return TelopData[i].mTelopNo; + } + } + return 0xFFFF; } -#pragma pop /* 800437C4-800437F0 03E104 002C+00 1/1 0/0 0/0 .text getTelopNo__Fv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void getTelopNo() { - nofralloc -#include "asm/d/event/d_event_data/getTelopNo__Fv.s" +static u16 getTelopNo() { + return getTelopNo(dComIfGp_getStartStageName()); } -#pragma pop /* 800437F0-80043A14 03E130 0224+00 1/1 0/0 0/0 .text getStartTelopNo__Fv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void getStartTelopNo() { - nofralloc -#include "asm/d/event/d_event_data/getStartTelopNo__Fv.s" +static u16 getStartTelopNo() { + const char* startStageName = dComIfGp_getStartStageName(); + const char* lastPlayStateName = dComIfGp_getLastPlayStageName(); + if (strcmp(startStageName, lastPlayStateName) == 0) { + return 0xFFFF; + } + TelopDataStruct* telopData = NULL; + s32 val = ((startStageName[3] == 'B' ? 'd' : startStageName[0]) << 0x18 | + startStageName[4] << 0x10 | startStageName[5] << 8 | startStageName[6]); + for (s32 i = 0; i < numTelopData; i++) { + if (val == TelopData[i].mName) { + telopData = &TelopData[i]; + break; + } + } + if (telopData == NULL || telopData->_8 == 0) { + return 0xFFFF; + } else if (telopData->_8 == 2 && telopData->_6 != 0xFFFF && + !dComIfGs_isEventBit(telopData->_6)) { + return 0xFFFF; + } else if (telopData->_8 == 3 && telopData->_6 != 0xFFFF && + !dComIfGs_isStageSwitch(telopData->_6 >> 8, telopData->_6 & 0xFF)) { + return 0xFFFF; + } else { + TelopDataStruct* lastTelopData = NULL; + val = ((lastPlayStateName[3] == 'B' ? 'd' : lastPlayStateName[0]) << 0x18 | + lastPlayStateName[4] << 0x10 | lastPlayStateName[5] << 8 | lastPlayStateName[6]); + for (s32 i = 0; i < numTelopData; i++) { + if (val == TelopData[i].mName) { + lastTelopData = &TelopData[i]; + break; + } + } + if (lastTelopData != NULL && telopData->mTelopNo == lastTelopData->mTelopNo) { + return 0xFFFF; + } else { + return telopData->mTelopNo; + } + } } -#pragma pop /* ############################################################################################## */ /* 80379DD0-80379DD0 006430 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ @@ -254,20 +275,26 @@ SECTION_SDATA2 static f32 lit_4265 = 15.0f; SECTION_SDATA2 static f64 lit_4267 = 4503601774854144.0 /* cast s32 to float */; /* 80043A14-80043D60 03E354 034C+00 1/1 0/0 0/0 .text dEvDt_Next_Stage__Fii */ -// bunch of issues with sclsInfo section. regalloc for the rest #ifdef NONMATCHING +// matches besides floats static int dEvDt_Next_Stage(int index, int wipe_type) { char* stage; s16 point; + int mode; s8 roomNo; s8 layer; - u32 mode = 0; // uvar8 - retail - s8 wipe = wipe_type; // ivar10 - int noVisit = true; - int wipe_time = 0; // bvar9 - f32 speed = FLOAT_LABEL(lit_4264); // dvar12 - bool setHour = false; // bvar2 - f32 hour = speed; // set to 0.0f dvar13 + s8 wipe; + s32 noVisit; + s32 wipe_time; + f32 hour; + f32 speed; + mode = 0; + wipe = wipe_type; + noVisit = true; + wipe_time = 0; + hour = 0; + bool setHour = false; + speed = 0; int* p_id = dComIfGp_evmng_getMyIntegerP(index, "ID"); if (p_id != NULL) { @@ -281,18 +308,19 @@ static int dEvDt_Next_Stage(int index, int wipe_type) { } if (info != NULL && id >= 0 && id < info->numEntries) { - stage = info->mEntries[id].mStage; - point = info->mEntries[id].mStart; - roomNo = info->mEntries[id].mRoom; - layer = dStage_sclsInfo_getSceneLayer(&info->mEntries[id]); - wipe = dStage_sclsInfo_getWipe(&info->mEntries[id]); - wipe_time = dStage_sclsInfo_getWipeTime(&info->mEntries[id]); + stage_scls_info_class* stgInfo = &info->mEntries[id]; + stage = stgInfo->mStage; + point = stgInfo->mStart; + roomNo = (s8)stgInfo->mRoom; + layer = dStage_sclsInfo_getSceneLayer(stgInfo); + wipe = (s8)dStage_sclsInfo_getWipe(stgInfo); + wipe_time = dStage_sclsInfo_getWipeTime(stgInfo); if (wipe == 15) { wipe = 0; } - s8 timeH = dStage_sclsInfo_getTimeH(&info->mEntries[id]); + int timeH = dStage_sclsInfo_getTimeH(stgInfo); if (timeH >= 0 && timeH <= 23) { setHour = true; hour = timeH; @@ -312,7 +340,7 @@ static int dEvDt_Next_Stage(int index, int wipe_type) { int* roomP = dComIfGp_evmng_getMyIntegerP(index, "RoomNo"); if (roomP != NULL) { - roomNo = *roomP; + roomNo = (s8)*roomP; } int* layerP = dComIfGp_evmng_getMyIntegerP(index, "Layer"); @@ -367,31 +395,38 @@ static asm int dEvDt_Next_Stage(int param_0, int param_1) { #endif /* 80043D60-80043DC8 03E6A0 0068+00 3/3 0/0 0/0 .text flagCheck__11dEvDtFlag_cFi */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void dEvDtFlag_c::flagCheck(int param_0) { - nofralloc -#include "asm/d/event/d_event_data/flagCheck__11dEvDtFlag_cFi.s" +BOOL dEvDtFlag_c::flagCheck(int param_0) { + if (flagMaxCheck(param_0)) { + return FALSE; + } else { + if (mFlags[(u32)param_0 / 0x20] & (1 << (param_0 & 0x1F))) { + return TRUE; + } else { + return FALSE; + } + } } -#pragma pop /* 80043DC8-80043E30 03E708 0068+00 2/2 1/1 0/0 .text flagSet__11dEvDtFlag_cFi */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void dEvDtFlag_c::flagSet(int param_0) { - nofralloc -#include "asm/d/event/d_event_data/flagSet__11dEvDtFlag_cFi.s" +BOOL dEvDtFlag_c::flagSet(int param_0) { + if (flagMaxCheck(param_0)) { + return FALSE; + } else { + mFlags[(u32)param_0 / 0x20] |= (1 << (param_0 & 0x1F)); + return TRUE; + } } -#pragma pop -bool dEvDtFlag_c::flagMaxCheck(int flag_id) { +BOOL dEvDtFlag_c::flagMaxCheck(int flag_id) { if (flag_id == -1) { - return true; + return TRUE; } - return FlagMax <= flag_id; + if (FlagMax <= flag_id) { + return TRUE; + } else { + return FALSE; + } } void dEvDtFlag_c::init() { @@ -401,35 +436,38 @@ void dEvDtFlag_c::init() { } /* 80043E78-80043EFC 03E7B8 0084+00 0/0 1/1 0/0 .text finishCheck__12dEvDtEvent_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm int dEvDtEvent_c::finishCheck() { - nofralloc -#include "asm/d/event/d_event_data/finishCheck__12dEvDtEvent_cFv.s" +int dEvDtEvent_c::finishCheck() { + for (int i = 0; i < 3; i++) { + int tmp = field_0x88[i]; + if (tmp == -1) { + return 1; + } + if (!dComIfGp_getEventManager().flagCheck(tmp)) { + return 0; + } + } + return 1; } -#pragma pop /* 80043EFC-80043F70 03E83C 0074+00 0/0 1/1 0/0 .text forceFinish__12dEvDtEvent_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void dEvDtEvent_c::forceFinish() { - nofralloc -#include "asm/d/event/d_event_data/forceFinish__12dEvDtEvent_cFv.s" +int dEvDtEvent_c::forceFinish() { + for (int i = 0; i < 3; i++) { + int tmp = field_0x88[i]; + if (tmp == -1) { + return 1; + } + dComIfGp_getEventManager().setFlag(tmp); + } + return 1; } -#pragma pop /* 80043F70-80043FD8 03E8B0 0068+00 0/0 1/1 0/0 .text * specialStaffProc__12dEvDtEvent_cFP12dEvDtStaff_c */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void dEvDtEvent_c::specialStaffProc(dEvDtStaff_c* param_0) { - nofralloc -#include "asm/d/event/d_event_data/specialStaffProc__12dEvDtEvent_cFP12dEvDtStaff_c.s" +void dEvDtEvent_c::specialStaffProc(dEvDtStaff_c* param_0) { + for (int i = 0; i < mNStaff; i++) { + param_0[mStaff[i]].specialProc(); + } } -#pragma pop /* ############################################################################################## */ /* 80379DD0-80379DD0 006430 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ @@ -439,57 +477,56 @@ SECTION_DEAD static char const* const stringBase_80379E0D = "Timer"; #pragma pop /* 80043FD8-8004403C 03E918 0064+00 4/4 0/0 0/0 .text specialProc_WaitStart__12dEvDtStaff_cFi */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void dEvDtStaff_c::specialProc_WaitStart(int param_0) { - nofralloc -#include "asm/d/event/d_event_data/specialProc_WaitStart__12dEvDtStaff_cFi.s" +void dEvDtStaff_c::specialProc_WaitStart(int param_0) { + int* timer = dComIfGp_evmng_getMyIntegerP(param_0, "Timer"); + if (timer == NULL) { + mWaitTimer = 0; + } else { + mWaitTimer = *timer; + } } -#pragma pop /* 8004403C-80044080 03E97C 0044+00 4/4 0/0 0/0 .text specialProc_WaitProc__12dEvDtStaff_cFi */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void dEvDtStaff_c::specialProc_WaitProc(int param_0) { - nofralloc -#include "asm/d/event/d_event_data/specialProc_WaitProc__12dEvDtStaff_cFi.s" +void dEvDtStaff_c::specialProc_WaitProc(int param_0) { + if (mWaitTimer > 0) { + mWaitTimer--; + } else { + dComIfGp_evmng_cutEnd(param_0); + } } -#pragma pop - -/* ############################################################################################## */ -/* 803A8238-803A8270 -00001 0034+04 1/1 0/0 0/0 .data @4398 */ -SECTION_DATA static void* lit_4398[13 + 1 /* padding */] = { - (void*)(((char*)specialProc__12dEvDtStaff_cFv) + 0xA0), - (void*)(((char*)specialProc__12dEvDtStaff_cFv) + 0x50), - (void*)(((char*)specialProc__12dEvDtStaff_cFv) + 0xA0), - (void*)(((char*)specialProc__12dEvDtStaff_cFv) + 0x68), - (void*)(((char*)specialProc__12dEvDtStaff_cFv) + 0x48), - (void*)(((char*)specialProc__12dEvDtStaff_cFv) + 0xA0), - (void*)(((char*)specialProc__12dEvDtStaff_cFv) + 0x40), - (void*)(((char*)specialProc__12dEvDtStaff_cFv) + 0x94), - (void*)(((char*)specialProc__12dEvDtStaff_cFv) + 0x8C), - (void*)(((char*)specialProc__12dEvDtStaff_cFv) + 0x9C), - (void*)(((char*)specialProc__12dEvDtStaff_cFv) + 0xA0), - (void*)(((char*)specialProc__12dEvDtStaff_cFv) + 0x38), - (void*)(((char*)specialProc__12dEvDtStaff_cFv) + 0x70), - /* padding */ - NULL, -}; /* 80044080-80044134 03E9C0 00B4+00 2/1 0/0 0/0 .text specialProc__12dEvDtStaff_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void dEvDtStaff_c::specialProc() { - nofralloc -#include "asm/d/event/d_event_data/specialProc__12dEvDtStaff_cFv.s" -} -#pragma pop - -inline dEvent_manager_c& dComIfGp_getEventManager() { - return g_dComIfG_gameInfo.play.getEvtManager(); +void dEvDtStaff_c::specialProc() { + switch (mType) { + case TYPE_PACKAGE: + specialProcPackage(); + break; + case TYPE_DIRECTOR: + specialProcDirector(); + break; + case TYPE_TIMEKEEPER: + specialProcTimekeeper(); + break; + case TYPE_ALL: + dComIfGp_evmng_cutEnd(mIndex); + break; + case TYPE_EFFECT: + specialProcEffect(); + break; + case TYPE_CREATE: + specialProcCreate(); + dComIfGp_evmng_cutEnd(mIndex); + break; + case TYPE_SOUND: + specialProcSound(); + break; + case TYPE_MESSAGE: + specialProcMessage(); + break; + case TYPE_LIGHT: + specialProcLight(); + break; + } } /* 80044134-80044170 03EA74 003C+00 0/0 1/1 0/0 .text init__12dEvDtStaff_cFv */ @@ -531,6 +568,45 @@ SECTION_SDATA2 static f64 lit_4461 = 24.0; /* 80044190-80044324 03EAD0 0194+00 1/1 0/0 0/0 .text specialProcLight__12dEvDtStaff_cFv */ +#ifdef NONMATCHING +// matches besides floats +void dEvDtStaff_c::specialProcLight() { + int staffId = i_dComIfGp_evmng_getMyStaffId("LIGHT", NULL, 0); + if (staffId != -1) { + char* nowCutName = dComIfGp_getEventManager().getMyNowCutName(staffId); + if (dComIfGp_evmng_getIsAddvance(staffId)) { + f32* hourP; + switch (*(int*)nowCutName) { + case 'CHAN': + hourP = dComIfGp_evmng_getMyFloatP(staffId, "Hour"); + if (hourP != NULL) { + dKy_instant_timechg(*hourP * 15.0f); + } + int* weatherP = dComIfGp_evmng_getMyIntegerP(staffId, "Weather"); + if (weatherP != NULL) { + switch (*weatherP) { + case 0: + dKy_instant_rainchg(); + } + } + break; + case 'ADD_': + hourP = dComIfGp_evmng_getMyFloatP(staffId, "Hour"); + if (hourP != NULL) { + f32 hours = dComIfGs_getTime() * (1.0f / 15.0f); + hours += *hourP; + while (hours >= 24.0) { + hours -= 24.0; + } + dKy_instant_timechg(hours * 15.0f); + } + break; + } + } + dComIfGp_evmng_cutEnd(staffId); + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -539,27 +615,184 @@ asm void dEvDtStaff_c::specialProcLight() { #include "asm/d/event/d_event_data/specialProcLight__12dEvDtStaff_cFv.s" } #pragma pop - -/* ############################################################################################## */ -/* 80379DD0-80379DD0 006430 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_80379E21 = "MESSAGE"; -SECTION_DEAD static char const* const stringBase_80379E29 = "msgNo"; -SECTION_DEAD static char const* const stringBase_80379E2F = "No"; -SECTION_DEAD static char const* const stringBase_80379E32 = "Type"; -SECTION_DEAD static char const* const stringBase_80379E37 = "ForStart"; -#pragma pop +#endif /* 80044324-80044A58 03EC64 0734+00 1/1 0/0 0/0 .text specialProcMessage__12dEvDtStaff_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void dEvDtStaff_c::specialProcMessage() { - nofralloc -#include "asm/d/event/d_event_data/specialProcMessage__12dEvDtStaff_cFv.s" +void dEvDtStaff_c::specialProcMessage() { + MessageData* data = (MessageData*)&mData; + StaffWork* work = &mWork; + int staffId = i_dComIfGp_evmng_getMyStaffId("MESSAGE", NULL, 0); + if (staffId == -1) { + return; + } + char* nowCutName = dComIfGp_getEventManager().getMyNowCutName(staffId); + if (dComIfGp_evmng_getIsAddvance(staffId)) { + switch (*(int*)nowCutName) { + case 'WAIT': + specialProc_WaitStart(staffId); + break; + case 'CREA': + case 'SHOW': + work->_0 = UINT32_MAX; + work->mLMsg = NULL; + work->mMsgSubstanceNum = dComIfGp_evmng_getMySubstanceNum(staffId, "msgNo"); + work->mMsgSubstanceP = dComIfGp_evmng_getMyIntegerP(staffId, "msgNo"); + if (work->mMsgSubstanceNum < 1) { + work->mMsgSubstanceNum = dComIfGp_evmng_getMySubstanceNum(staffId, "No"); + work->mMsgSubstanceP = dComIfGp_evmng_getMyIntegerP(staffId, "No"); + } + work->mMsgNo = *work->mMsgSubstanceP; + data->unk = 0; + break; + case 'END\0': + case 'FINI': + work->mLMsg->field_0xf8 = 0x10; + break; + case 'CONT': + work->mLMsg->field_0xf8 = 0xF; + int* ptr = dComIfGp_evmng_getMyIntegerP(staffId, "msgNo"); + if (ptr == NULL) { + ptr = dComIfGp_evmng_getMyIntegerP(staffId, "No"); + } + work->mMsgNo = *ptr; + fopMsgM_messageSet(work->mMsgNo, 1000); + break; + case 'SAVE': + work->mMsgNo = 1; + int* typeP = dComIfGp_evmng_getMyIntegerP(staffId, "Type"); + if (typeP != NULL && *typeP == 1) { + work->mMsgNo = 2; + } + work->_0 = d_GameOver_Create(work->mMsgNo); + break; + case 'TELO': + int* forStartP = dComIfGp_evmng_getMyIntegerP(staffId, "ForStart"); + if (forStartP != NULL && *forStartP != 0) { + work->mMsgNo = getStartTelopNo(); + } else { + char* stageP = dComIfGp_evmng_getMyStringP(staffId, "Stage"); + int* noP = dComIfGp_evmng_getMyIntegerP(staffId, "No"); + if (noP != NULL) { + work->mMsgNo = *noP; + } else if (stageP != NULL) { + work->mMsgNo = getTelopNo(stageP); + } else { + work->mMsgNo = getTelopNo(); + } + } + data->unk = 0; + if (work->mMsgNo != 0xFFFF) { + work->_0 = fopMsgM_messageSetDemo(work->mMsgNo); + } + } + } + switch (*(int*)nowCutName) { + case 'WAIT': + specialProc_WaitProc(staffId); + break; + case 'CREA': + switch (data->unk) { + case 0: + work->_0 = fopMsgM_messageSet(work->mMsgNo, 1000); + if (work->_0 != UINT32_MAX) { + data->unk++; + } + break; + case 1: + work->mLMsg = fopMsgM_SearchByID(work->_0); + if (work->mLMsg != NULL) { + data->unk++; + } + break; + case 2: + dComIfGp_evmng_cutEnd(staffId); + break; + } + break; + case 'PUSH': + if (work->mLMsg->field_0xf8 == 0xE) { + dComIfGp_evmng_cutEnd(staffId); + } + break; + case 'TELO': + dComIfGp_evmng_cutEnd(staffId); + break; + case 'SHOW': + switch (data->unk) { + case 0: + work->_0 = fopMsgM_messageSet(work->mMsgNo, 1000); + if (work->_0 != UINT32_MAX) { + data->unk = 1; + } else { + break; + } + case 1: + work->mLMsg = fopMsgM_SearchByID(work->_0); + if (work->mLMsg == NULL) { + break; + } + switch (work->mLMsg->field_0xf8) { + case 0xE: + work->mLMsg->field_0xf8 = 0x10; + break; + case 0x11: + break; + case 0x12: + work->mLMsg->field_0xf8 = 0x13; + work->_0 = UINT32_MAX; + work->mLMsg = NULL; + work->mMsgSubstanceNum--; + if (work->mMsgSubstanceNum != 0) { + data->unk = 0; + work->mMsgSubstanceP++; + work->mMsgNo = *work->mMsgSubstanceP; + } else { + dComIfGp_evmng_cutEnd(staffId); + data->unk = 99; + } + break; + default: + break; + } + break; + default: + dComIfGp_evmng_cutEnd(staffId); + break; + } + break; + case 'DELE': + case 'FINI': + if (work->mLMsg == NULL) { + dComIfGp_evmng_cutEnd(staffId); + } else if (work->mLMsg->field_0xf8 == 0x12) { + work->mLMsg->field_0xf8 = 0x13; + work->_0 = UINT32_MAX; + work->mLMsg = NULL; + dComIfGp_evmng_cutEnd(staffId); + } + break; + case 'CONT': + dComIfGp_evmng_cutEnd(staffId); + break; + case 'END\0': + switch (work->mLMsg->field_0xf8) { + case 0x11: + case 0x12: + dComIfGp_evmng_cutEnd(staffId); + break; + } + break; + case 'SAVE': + if (d_GameOver_CheckDelete(work->_0) && dComIfGp_getGameoverStatus() == 1) { + dComIfGp_evmng_cutEnd(staffId); + d_GameOver_Delete(work->_0); + } + break; + default: + dComIfGp_evmng_cutEnd(staffId); + break; + } } -#pragma pop /* ############################################################################################## */ /* 80379DD0-80379DD0 006430 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ @@ -576,6 +809,54 @@ SECTION_SDATA2 static f32 lit_4669 = -1.0f; /* 80044A58-80044CB8 03F398 0260+00 1/1 0/0 0/0 .text specialProcSound__12dEvDtStaff_cFv */ +#ifdef NONMATCHING +// matches besides floats +void dEvDtStaff_c::specialProcSound() { + int staffId = i_dComIfGp_evmng_getMyStaffId("SOUND", NULL, 0); + if (staffId == -1) { + return; + } + char* nowCutName = dComIfGp_getEventManager().getMyNowCutName(staffId); + if (dComIfGp_evmng_getIsAddvance(staffId)) { + switch (*(int*)nowCutName) { + case 'WAIT': + specialProc_WaitStart(staffId); + break; + case 'STRM': + mDoAud_bgmStreamPlay(); + break; + case 'NOMS': + specialProc_WaitStart(staffId); + break; + case 'RIDD': + int* typeP = dComIfGp_evmng_getMyIntegerP(staffId, "Type"); + if (typeP != NULL && *typeP == 1) { + mDoAud_seStart(0xC, NULL, 0, 0); + } else { + mDoAud_seStart(0xD, NULL, 0, 0); + } + break; + case 'BGMS': + int* timerP = dComIfGp_evmng_getMyIntegerP(staffId, "Timer"); + if (timerP != NULL) { + mDoAud_bgmStop(*timerP); + } + } + } + switch (*(int*)nowCutName) { + case 'WAIT': + specialProc_WaitProc(staffId); + break; + case 'NOMS': + if (mSoundWait <= dDemo_c::getFrameNoMsg()) { + dComIfGp_evmng_cutEnd(staffId); + } + break; + default: + dComIfGp_evmng_cutEnd(staffId); + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -584,6 +865,7 @@ asm void dEvDtStaff_c::specialProcSound() { #include "asm/d/event/d_event_data/specialProcSound__12dEvDtStaff_cFv.s" } #pragma pop +#endif /* ############################################################################################## */ /* 80379DD0-80379DD0 006430 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ @@ -599,6 +881,58 @@ SECTION_DEAD static char const* const stringBase_80379E65 = "SCALE"; /* 80044CB8-80044EE4 03F5F8 022C+00 1/1 0/0 0/0 .text specialProcCreate__12dEvDtStaff_cFv */ +#ifdef NONMATCHING +void dEvDtStaff_c::specialProcCreate() { + // regalloc + char* name; + u32 arg; + cXyz pos; + csXyz angle; + cXyz scale; + dStage_objectNameInf* objNameInf; + int staffId = i_dComIfGp_evmng_getMyStaffId("CREATER", NULL, 0); + if (staffId == -1) { + return; + } + char* nowCutName = dComIfGp_getEventManager().getMyNowCutName(staffId); + if (dComIfGp_evmng_getIsAddvance(staffId)) { + switch (*(int*)nowCutName) { + case 'WAIT': + break; + case 'CREA': + name = dComIfGp_evmng_getMyStringP(staffId, "MAKECAST"); + objNameInf = dStage_searchName(name); + int* argP = dComIfGp_evmng_getMyIntegerP(staffId, "ARG"); + if (argP == NULL) { + arg = UINT32_MAX; + } else { + arg = *argP; + } + cXyz* posP = dComIfGp_evmng_getMyXyzP(staffId, "POS"); + if (posP == NULL) { + pos = ((fopAc_ac_c*)dComIfGp_getPlayer(0))->getPosition(); + } else { + pos = *posP; + } + int* angleP = dComIfGp_evmng_getMyIntegerP(staffId, "ANGLE"); + if (angleP == NULL) { + angle.setall(0); + } else { + angle.set(angleP[0], angleP[1], angleP[2]); + } + cXyz* scaleP = dComIfGp_evmng_getMyXyzP(staffId, "SCALE"); + if (scaleP == NULL) { + scale.setAll(1.0f); + } else { + scale = *scaleP; + } + fopAcM_create(objNameInf->mProcName, arg, &pos, dComIfGp_roomControl_getStayNo(), + &angle, &scale, objNameInf->mSubtype); + break; + } + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -607,6 +941,7 @@ asm void dEvDtStaff_c::specialProcCreate() { #include "asm/d/event/d_event_data/specialProcCreate__12dEvDtStaff_cFv.s" } #pragma pop +#endif /* ############################################################################################## */ /* 80379DD0-80379DD0 006430 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ @@ -633,6 +968,226 @@ SECTION_DEAD static char const* const stringBase_80379EF9 = "PtD"; #pragma pop /* 80044EE4-80045878 03F824 0994+00 1/1 0/0 0/0 .text specialProcDirector__12dEvDtStaff_cFv */ +#ifdef NONMATCHING +// matches besides floats +void dEvDtStaff_c::specialProcDirector() { + DirectorData* data = (DirectorData*)mData; + daPy_py_c* player = dComIfGp_getLinkPlayer(); + dEvt_control_c& evtControl = dComIfGp_getEvent(); + int staffId = i_dComIfGp_evmng_getMyStaffId("DIRECTOR", NULL, 0); + if (staffId == -1) { + return; + } + char* nowCutName = dComIfGp_getEventManager().getMyNowCutName(staffId); + if (dComIfGp_evmng_getIsAddvance(staffId)) { + int* eventFlagP = dComIfGp_evmng_getMyIntegerP(staffId, "EventFlag"); + if (eventFlagP != NULL) { + dComIfGs_onEventBit(dSv_event_flag_c::saveBitLabels[*eventFlagP]); + } + int* eventFlagOffP = dComIfGp_evmng_getMyIntegerP(staffId, "EventFlagOff"); + if (eventFlagOffP != NULL) { + dComIfGs_offEventBit(dSv_event_flag_c::saveBitLabels[*eventFlagOffP]); + } + int* switchTableP = dComIfGp_evmng_getMyIntegerP(staffId, "SwitchTable"); + int switchTable; + if (switchTableP != NULL) { + switchTable = *switchTableP; + } else { + switchTable = dStage_stagInfo_GetSaveTbl(dComIfGp_getStageStagInfo()); + } + int* switchBitP = dComIfGp_evmng_getMyIntegerP(staffId, "SwitchBit"); + if (switchBitP != NULL) { + dComIfGs_onStageSwitch(switchTable, *switchBitP); + } + int* switchOffP = dComIfGp_evmng_getMyIntegerP(staffId, "SwitchOff"); + if (switchOffP != NULL) { + dComIfGs_offStageSwitch(switchTable, *switchOffP); + } + int* tmpBitP = dComIfGp_evmng_getMyIntegerP(staffId, "TmpBit"); + if (tmpBitP != NULL) { + dComIfGs_onTmpBit(dSv_event_tmp_flag_c::tempBitLabels[*tmpBitP]); + } + int* tmpOffP = dComIfGp_evmng_getMyIntegerP(staffId, "TmpBitOff"); + if (tmpOffP != NULL) { + dComIfGs_offTmpBit(dSv_event_tmp_flag_c::tempBitLabels[*tmpOffP]); + } + switch (*(int*)nowCutName) { + case 'WAIT': + specialProc_WaitStart(staffId); + break; + case 'PLAY': + if (strcmp(nowCutName, "PLAYER_NODRAW") == 0) { + player->i_onPlayerNoDraw(); + } else if (strcmp(nowCutName, "PLAYER_DRAW") == 0) { + player->i_offPlayerNoDraw(); + } + break; + case 'NEXT': + dEvDt_Next_Stage(staffId, 0xD); + break; + case 'SKIP': + char* zev = dComIfGp_evmng_getMyStringP(staffId, "Zev"); + // cast needed to match + void* pt = (void*)evtControl.getPt1(); + if (NULL == pt) { + pt = evtControl.getPt2(); + } + if (zev != NULL) { + evtControl.setSkipZev(pt, zev); + } else { + evtControl.setSkipProc(pt, dEv_defaultSkipProc, 0); + } + break; + case 'FADE': + f32* rateP = dComIfGp_evmng_getMyFloatP(staffId, "Rate"); + int* colorP = dComIfGp_evmng_getMyIntegerP(staffId, "Color"); + if (*rateP > 0) { + mDoGph_gInf_c::setFadeRate(0); + } + if (colorP != NULL) { + GXColor color; + color.r = colorP[0]; + color.g = colorP[1]; + color.b = colorP[2]; + color.a = colorP[3]; + mDoGph_gInf_c::fadeOut(*rateP, color); + } else { + mDoGph_gInf_c::fadeOut(*rateP); + } + break; + case 'VIBR': + specialProc_WaitStart(staffId); + int* patternP = dComIfGp_evmng_getMyIntegerP(staffId, "Pattern"); + int* typeP = dComIfGp_evmng_getMyIntegerP(staffId, "Type"); + dComIfGp_getVibration().StartQuake((u8*)patternP, 0, *typeP, cXyz(0, 1, 0)); + break; + case 'WIPE': + f32* wipeRateP = dComIfGp_evmng_getMyFloatP(staffId, "Rate"); + dDlst_list_c::wipeIn(-*wipeRateP); + if (*wipeRateP > 0) { + data->unk = 0; + } else { + data->unk = 1; + } + int* soundP = dComIfGp_evmng_getMyIntegerP(staffId, "SOUND"); + if (soundP != NULL) { + switch (*soundP) { + case 0: + mDoAud_seStart(0, NULL, 0, 0); + } + } + break; + case 'MAPT': + int* idP = dComIfGp_evmng_getMyIntegerP(staffId, "ID"); + data->unk = *idP; + dStage_MapEvent_dt_c* mapEvent = dEvt_control_c::searchMapEventData(data->unk); + if (mapEvent != NULL) { + if (mapEvent->mType == 0) { + data->mSoundWait = mapEvent->field_0x14; + } else { + data->mSoundWait = -1; + } + } else { + data->mSoundWait = 0; + } + break; + case 'CAST': + char* pt2Name = dComIfGp_evmng_getMyStringP(staffId, "Pt2"); + if (pt2Name != NULL) { + fopAc_ac_c* pt2 = fopAcM_searchFromName4Event(pt2Name, -1); + if (pt2 != NULL) { + evtControl.setPt2(pt2); + } + } + char* ptTName = dComIfGp_evmng_getMyStringP(staffId, "PtT"); + if (ptTName != NULL) { + fopAc_ac_c* ptT = fopAcM_searchFromName4Event(ptTName, -1); + if (ptT != NULL) { + evtControl.setPtT(ptT); + } + } + char* ptIName = dComIfGp_evmng_getMyStringP(staffId, "PtI"); + if (ptIName != NULL) { + fopAc_ac_c* ptI = fopAcM_searchFromName4Event(ptIName, -1); + if (ptI != NULL) { + evtControl.setPtI(ptI); + } + } + char* ptDName = dComIfGp_evmng_getMyStringP(staffId, "PtD"); + if (ptDName != NULL) { + fopAc_ac_c* ptD = fopAcM_searchFromName4Event(ptDName, -1); + if (ptD != NULL) { + evtControl.setPtD(ptD); + } + } + break; + case 'SPEC': + int* specTypeP = dComIfGp_evmng_getMyIntegerP(staffId, "Type"); + if (specTypeP != NULL) { + switch (*specTypeP) { + case 8: + if (dComIfGs_isEventBit(dSv_event_flag_c::saveBitLabels[506])) { + dComIfGs_onEventBit(dSv_event_flag_c::saveBitLabels[566]); + } + if (dComIfGs_isEventBit(dSv_event_flag_c::saveBitLabels[507])) { + dComIfGs_onEventBit(dSv_event_flag_c::saveBitLabels[567]); + } + } + } + break; + } + } + switch (*(int*)nowCutName) { + case 'WAIT': + specialProc_WaitProc(staffId); + break; + case 'FADE': + if (!mDoGph_gInf_c::isFade()) { + dComIfGp_evmng_cutEnd(staffId); + break; + } + if (mDoGph_gInf_c::getFadeRate() >= 1) { + f32* rateP = dComIfGp_evmng_getMyFloatP(staffId, "Rate"); + if (*rateP > 0) { + dComIfGp_evmng_cutEnd(staffId); + } + } + break; + case 'NEXT': + break; + case 'VIBR': + if (data->mSoundWait > 0) { + data->mSoundWait--; + if (data->mSoundWait == 0) { + dComIfGp_getVibration().StopQuake(0x1F); + } + } else { + dComIfGp_evmng_cutEnd(staffId); + } + break; + case 'WIPE': + if (data->unk != 0) { + if (dDlst_list_c::getWipeRate() == 0) { + dComIfGp_evmng_cutEnd(staffId); + } + } else { + if (dDlst_list_c::getWipeRate() >= 1) { + dComIfGp_evmng_cutEnd(staffId); + } + } + break; + case 'MAPT': + data->mSoundWait--; + if (data->mSoundWait <= 0) { + dComIfGp_evmng_cutEnd(staffId); + } + break; + default: + dComIfGp_evmng_cutEnd(staffId); + break; + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -641,6 +1196,7 @@ asm void dEvDtStaff_c::specialProcDirector() { #include "asm/d/event/d_event_data/specialProcDirector__12dEvDtStaff_cFv.s" } #pragma pop +#endif /* ############################################################################################## */ /* 80379DD0-80379DD0 006430 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ @@ -655,7 +1211,73 @@ SECTION_DEAD static char const* const stringBase_80379F18 = "OffsetAngY"; /* 80451EF8-80451EFC 0004F8 0004+00 1/1 0/0 0/0 .sdata2 @5057 */ SECTION_SDATA2 static f32 lit_5057 = 10.0f; +inline void dComIfGp_event_setCullRate(f32 f) { + g_dComIfG_gameInfo.play.getEvent().setCullRate(f); +} + /* 80045878-80045AFC 0401B8 0284+00 1/1 0/0 0/0 .text specialProcPackage__12dEvDtStaff_cFv */ +#ifdef NONMATCHING +void dEvDtStaff_c::specialProcPackage() { + dMsgObject_c* msgObj = dComIfGp_getMsgObjectClass(); + if (!!msgObj) { + dMsgObject_demoMessageGroup(); + } + int staffId = i_dComIfGp_evmng_getMyStaffId("PACKAGE", NULL, 0); + if (staffId == -1) { + return; + } + char* nowCutName = dComIfGp_getEventManager().getMyNowCutName(staffId); + if (dComIfGp_evmng_getIsAddvance(staffId)) { + switch (*(int*)nowCutName) { + case 'WAIT': + specialProc_WaitStart(staffId); + break; + case 'PLAY': + char* fileName = dComIfGp_evmng_getMyStringP(staffId, "FileName"); + cXyz* offsetPos = dComIfGp_evmng_getMyXyzP(staffId, "OffsetPos"); + f32* offsetAngYP = dComIfGp_evmng_getMyFloatP(staffId, "OffsetAngY"); + f32 offsetAngY; + if (offsetAngYP != NULL) { + offsetAngY = *offsetAngYP; + } else { + offsetAngY = 0.0f; + } + // should not save event from g_dComIfG_gameInfo to register + u8* demoData = (u8*)dComIfGp_getEvent().getStbDemoData(fileName); + dDemo_c::start(demoData, offsetPos, offsetAngY); + dComIfGp_event_setCullRate(10.0f); + int* eventFlagP = dComIfGp_evmng_getMyIntegerP(staffId, "EventFlag"); + if (eventFlagP != NULL) { + dComIfGs_onEventBit(dSv_event_flag_c::saveBitLabels[*eventFlagP]); + } + break; + } + } + switch (*(int*)nowCutName) { + case 'WAIT': + specialProc_WaitProc(staffId); + break; + case 'PLAY': + dEvt_control_c& evtControl = dComIfGp_getEvent(); + if (dDemo_c::getMode() == 2) { + dStage_MapEvent_dt_c* event = evtControl.getStageEventDt(); + if (event != NULL && event->field_0x7 != 0xFF && !evtControl.chkFlag2(1)) { + dDemo_c::getControl()->referObject_control().suspend(100); + dComIfGp_evmng_cutEnd(staffId); + } else { + dDemo_c::end(); + } + } + if (dDemo_c::getMode() == 0) { + dComIfGp_evmng_cutEnd(staffId); + } + break; + default: + dComIfGp_evmng_cutEnd(staffId); + break; + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -664,6 +1286,7 @@ asm void dEvDtStaff_c::specialProcPackage() { #include "asm/d/event/d_event_data/specialProcPackage__12dEvDtStaff_cFv.s" } #pragma pop +#endif /* ############################################################################################## */ /* 80379DD0-80379DD0 006430 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ @@ -673,14 +1296,35 @@ SECTION_DEAD static char const* const stringBase_80379F23 = "TIMEKEEPER"; #pragma pop /* 80045AFC-80045C34 04043C 0138+00 1/1 0/0 0/0 .text specialProcTimekeeper__12dEvDtStaff_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void dEvDtStaff_c::specialProcTimekeeper() { - nofralloc -#include "asm/d/event/d_event_data/specialProcTimekeeper__12dEvDtStaff_cFv.s" +void dEvDtStaff_c::specialProcTimekeeper() { + TimerKeeperData* dataP = (TimerKeeperData*)&mData; + int staffId = i_dComIfGp_evmng_getMyStaffId("TIMEKEEPER", NULL, 0); + if (staffId == -1) { + return; + } + char* nowCutName = dComIfGp_getEventManager().getMyNowCutName(staffId); + if (dComIfGp_evmng_getIsAddvance(staffId)) { + switch (*(int*)nowCutName) { + case 'COUN': + dataP->timer = *dComIfGp_evmng_getMyIntegerP(staffId, "Timer"); + break; + case 'WAIT': + break; + } + } + switch (*(int*)nowCutName) { + case 'COUN': + if (dataP->timer > 0) { + dataP->timer--; + } else { + dComIfGp_evmng_cutEnd(staffId); + } + break; + case 'WAIT': + default: + dComIfGp_evmng_cutEnd(staffId); + } } -#pragma pop /* ############################################################################################## */ /* 80379DD0-80379DD0 006430 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ @@ -700,6 +1344,136 @@ SECTION_SDATA2 static f32 lit_5200 = 4.0f / 5.0f; /* 80045C34-800460A8 040574 0474+00 1/1 0/0 0/0 .text specialProcEffect__12dEvDtStaff_cFv */ +#ifdef NONMATCHING +// matches besides floats +void dEvDtStaff_c::specialProcEffect() { + EffectData* data = (EffectData*)mData; + int staffId = i_dComIfGp_evmng_getMyStaffId("EFFECT", NULL, 0); + if (staffId == -1) { + return; + } + char* nowCutName = dComIfGp_getEventManager().getMyNowCutName(staffId); + if (dComIfGp_evmng_getIsAddvance(staffId)) { + data->unk = 0; + switch (*(int*)nowCutName) { + case 'WAIT': { + int* timerP = dComIfGp_evmng_getMyIntegerP(staffId, "Timer"); + int timer; + if (timerP != NULL) { + timer = *timerP; + } else { + timer = 0; + } + data->unk = timer; + } break; + case 'SHOC': { + int* powerP = dComIfGp_evmng_getMyIntegerP(staffId, "Power"); + int power; + if (powerP != NULL) { + power = *powerP; + } else { + power = 5; + } + int* typeP = dComIfGp_evmng_getMyIntegerP(staffId, "Type"); + int type; + if (typeP != NULL) { + type = *typeP; + } else { + type = 0xF; + } + dComIfGp_getVibration().StartShock(power, type, cXyz(0, 1, 0)); + } break; + case 'QUAK': { + int power; + int type; + int timer; + int random; + u8* pattern; + int* timerP = dComIfGp_evmng_getMyIntegerP(staffId, "Timer"); + if (timerP != NULL) { + timer = *timerP; + } else { + timer = 30; + } + data->unk = timer; + int* powerP = dComIfGp_evmng_getMyIntegerP(staffId, "Power"); + if (powerP != NULL) { + power = *powerP; + } else { + power = 5; + } + int* typeP = dComIfGp_evmng_getMyIntegerP(staffId, "Type"); + if (typeP != NULL) { + type = *typeP; + } else { + type = 0xF; + } + pattern = (u8*)dComIfGp_evmng_getMyStringP(staffId, "Pattern"); + if (pattern != NULL) { + int* randomP = dComIfGp_evmng_getMyIntegerP(staffId, "Random"); + if (randomP != NULL) { + random = *randomP; + } else { + random = 0; + } + dComIfGp_getVibration().StartQuake(pattern, random, type, cXyz(0, 1, 0)); + } else { + dComIfGp_getVibration().StartQuake(power, type, cXyz(0, 1, 0)); + } + } break; + case 'BLUR': { + int* timerP = dComIfGp_evmng_getMyIntegerP(staffId, "Timer"); + int timer; + if (timerP != NULL) { + timer = *timerP; + } else { + timer = 30; + } + int timer2 = data->unk = timer; + f32* alphaP = dComIfGp_evmng_getMyFloatP(staffId, "Alpha"); + f32 alpha; + if (alphaP != NULL) { + alpha = *alphaP; + } else { + alpha = 0.8f; + } + f32* scaleP = dComIfGp_evmng_getMyFloatP(staffId, "Scale"); + f32 scale; + if (scaleP != NULL) { + scale = *scaleP; + } else { + scale = 0.8f; + } + dCam_getBody()->StartBlure(timer2, NULL, alpha, scale); + } break; + } + } + if (data->unk != 0) { + data->unk--; + } + switch (*(int*)nowCutName) { + case 'WAIT': + if (data->unk == 0) { + dComIfGp_evmng_cutEnd(staffId); + } + break; + case 'QUAK': + if (data->unk == 0) { + dComIfGp_getVibration().StopQuake(0x1F); + dComIfGp_evmng_cutEnd(staffId); + } + break; + case 'BLUR': + if (data->unk == 0) { + dComIfGp_evmng_cutEnd(staffId); + } + break; + default: + dComIfGp_evmng_cutEnd(staffId); + break; + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -708,16 +1482,25 @@ asm void dEvDtStaff_c::specialProcEffect() { #include "asm/d/event/d_event_data/specialProcEffect__12dEvDtStaff_cFv.s" } #pragma pop +#endif /* 800460A8-80046138 0409E8 0090+00 1/1 0/0 0/0 .text startCheck__10dEvDtCut_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void dEvDtCut_c::startCheck() { - nofralloc -#include "asm/d/event/d_event_data/startCheck__10dEvDtCut_cFv.s" +int dEvDtCut_c::startCheck() { + for (int i = 0; i < 3; i++) { + int flag = this->getStartFlag(i); + if (flag == -1) { + if (i == 0) { + return -1; + } else { + return 1; + } + } + if (!dEvDtFlagCheck(flag)) { + return 0; + } + } + return 1; } -#pragma pop /* 80046138-8004616C 040A78 0034+00 1/1 7/7 0/0 .text init__11dEvDtBase_cFv */ int dEvDtBase_c::init() { @@ -783,13 +1566,21 @@ void dEvDtBase_c::advanceCut(dEvDtEvent_c* p_event) { /* 800462FC-800463DC 040C3C 00E0+00 1/1 0/0 0/0 .text * advanceCutLocal__11dEvDtBase_cFP12dEvDtStaff_c */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void dEvDtBase_c::advanceCutLocal(dEvDtStaff_c* param_0) { - nofralloc -#include "asm/d/event/d_event_data/advanceCutLocal__11dEvDtBase_cFP12dEvDtStaff_c.s" +BOOL dEvDtBase_c::advanceCutLocal(dEvDtStaff_c* param_0) { + dEvDtCut_c* cut = &mCutP[param_0->getCurrentCut()]; + if (dEvDtFlagCheck(cut->getFlagId()) && cut->getNext() != -1) { + switch (mCutP[cut->getNext()].startCheck()) { + case -1: + param_0->advanceCut(cut->getNext()); + return TRUE; + case 1: + dEvDtFlagSet(cut->getFlagId()); + param_0->advanceCut(cut->getNext()); + return TRUE; + } + } + param_0->field_0x40 = false; + return FALSE; } -#pragma pop /* 80379DD0-80379DD0 006430 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ diff --git a/src/d/event/d_event_lib.cpp b/src/d/event/d_event_lib.cpp index 50e996ddc0..404cfef825 100644 --- a/src/d/event/d_event_lib.cpp +++ b/src/d/event/d_event_lib.cpp @@ -4,247 +4,135 @@ // #include "d/event/d_event_lib.h" +#include "d/com/d_com_inf_game.h" +#include "d/event/d_event_manager.h" #include "dol2asm.h" #include "dolphin/types.h" +#include "f_op/f_op_actor_mng.h" // -// Types: +// Declarations: // -struct fopAc_ac_c {}; - -struct dEvt_control_c { - /* 80042468 */ void reset(); -}; +inline dEvent_manager_c& dComIfGp_getEventManager() { + return g_dComIfG_gameInfo.play.getEvtManager(); +} -struct dEvent_manager_c { - /* 80047698 */ void getEventIdx(fopAc_ac_c*, u8); - /* 80047A78 */ void endCheck(s16); -}; +inline dEvt_control_c& dComIfGp_getEvent() { + return g_dComIfG_gameInfo.play.getEvent(); +} -template <typename A0> -struct action_class {}; -/* action_class<dEvLib_callback_c> */ -struct action_class__template0 {}; - -struct dEvLib_callback_c { - /* 8004886C */ void eventUpdate(); - /* 800488A4 */ void setEvent(int, int, int); - /* 80048940 */ void orderEvent(int, int, int); - /* 80048970 */ void setAction(action_class<dEvLib_callback_c>*); - /* 800489A8 */ void initAction(); - /* 800489F8 */ void executeAction(); - /* 80048A50 */ void initStart(); - /* 80048A70 */ void executeStart(); - /* 80048B1C */ void initRun(); - /* 80048B48 */ void executeRun(); +/* ############################################################################################## */ +/* 803A82B8-803A82C4 0053D8 000C+00 1/1 0/0 0/0 .data cNullVec__6Z2Calc */ +SECTION_DATA static u8 cNullVec__6Z2Calc[12] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; -// -// Forward References: -// - -extern "C" void eventUpdate__17dEvLib_callback_cFv(); -extern "C" void setEvent__17dEvLib_callback_cFiii(); -extern "C" void orderEvent__17dEvLib_callback_cFiii(); -extern "C" void func_80048970(); -extern "C" void initAction__17dEvLib_callback_cFv(); -extern "C" void executeAction__17dEvLib_callback_cFv(); -extern "C" void initStart__17dEvLib_callback_cFv(); -extern "C" void executeStart__17dEvLib_callback_cFv(); -extern "C" void initRun__17dEvLib_callback_cFv(); -extern "C" void executeRun__17dEvLib_callback_cFv(); -extern "C" void __sinit_d_event_lib_cpp(); - -// -// External References: -// - -extern "C" void fopAcM_orderOtherEventId__FP10fopAc_ac_csUcUsUsUs(); -extern "C" void fopAcM_orderMapToolEvent__FP10fopAc_ac_cUcsUsUsUs(); -extern "C" void reset__14dEvt_control_cFv(); -extern "C" void getEventIdx__16dEvent_manager_cFP10fopAc_ac_cUc(); -extern "C" void endCheck__16dEvent_manager_cFs(); -extern "C" void __ptmf_test(); -extern "C" void __ptmf_scall(); -extern "C" extern u8 g_dComIfG_gameInfo[122384]; - -// -// Declarations: -// - /* 8004886C-800488A4 0431AC 0038+00 0/0 0/0 23/23 .text eventUpdate__17dEvLib_callback_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void dEvLib_callback_c::eventUpdate() { - nofralloc -#include "asm/d/event/d_event_lib/eventUpdate__17dEvLib_callback_cFv.s" +BOOL dEvLib_callback_c::eventUpdate() { + if (mAction == NULL) { + return FALSE; + } else { + executeAction(); + return TRUE; + } } -#pragma pop /* ############################################################################################## */ /* 804246E0-804246F8 051400 0018+00 2/2 0/0 0/0 .bss l_startAction */ -static u8 l_startAction[24]; +static action_class<dEvLib_callback_c> l_startAction(&dEvLib_callback_c::initStart, + &dEvLib_callback_c::executeStart); +/* 804246F8-80424710 051418 0018+00 2/2 0/0 0/0 .bss l_runAction */ +static action_class<dEvLib_callback_c> l_runAction(&dEvLib_callback_c::initRun, + &dEvLib_callback_c::executeRun); /* 800488A4-80048940 0431E4 009C+00 1/1 0/0 1/1 .text setEvent__17dEvLib_callback_cFiii */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void dEvLib_callback_c::setEvent(int param_0, int param_1, int param_2) { - nofralloc -#include "asm/d/event/d_event_lib/setEvent__17dEvLib_callback_cFiii.s" +BOOL dEvLib_callback_c::setEvent(int mapToolId, int eventIdx, int param_2) { + if (mAction != NULL) { + return FALSE; + } else { + mActor->mEvtInfo.setMapToolId(mapToolId); + if (mapToolId != 0xFF && eventIdx == 0xFF) { + eventIdx = dComIfGp_getEventManager().getEventIdx(mActor, mapToolId); + } + mActor->mEvtInfo.setEventId(eventIdx); + _C = param_2; + return setAction(&l_startAction); + } } -#pragma pop /* 80048940-80048970 043280 0030+00 0/0 0/0 21/21 .text orderEvent__17dEvLib_callback_cFiii */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void dEvLib_callback_c::orderEvent(int param_0, int param_1, int param_2) { - nofralloc -#include "asm/d/event/d_event_lib/orderEvent__17dEvLib_callback_cFiii.s" +void dEvLib_callback_c::orderEvent(int param_0, int param_1, int param_2) { + setEvent(param_0, param_1, param_2 != 0 ? 0x101 : 1); } -#pragma pop /* 80048970-800489A8 0432B0 0038+00 3/3 0/0 0/0 .text * setAction__17dEvLib_callback_cFP33action_class<17dEvLib_callback_c> */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void dEvLib_callback_c::setAction(action_class<dEvLib_callback_c>* param_0) { - nofralloc -#include "asm/d/event/d_event_lib/func_80048970.s" +BOOL dEvLib_callback_c::setAction(action_class<dEvLib_callback_c>* action) { + mAction = action; + if (mAction == NULL) { + return FALSE; + } else { + return initAction(); + } } -#pragma pop /* 800489A8-800489F8 0432E8 0050+00 1/1 0/0 0/0 .text initAction__17dEvLib_callback_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void dEvLib_callback_c::initAction() { - nofralloc -#include "asm/d/event/d_event_lib/initAction__17dEvLib_callback_cFv.s" +BOOL dEvLib_callback_c::initAction() { + if (!mAction->getInit()) { + return TRUE; + } else { + return (this->*(mAction->getInit()))(); + } } -#pragma pop /* 800489F8-80048A50 043338 0058+00 1/1 0/0 0/0 .text executeAction__17dEvLib_callback_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void dEvLib_callback_c::executeAction() { - nofralloc -#include "asm/d/event/d_event_lib/executeAction__17dEvLib_callback_cFv.s" +BOOL dEvLib_callback_c::executeAction() { + if (!mAction->getExecute()) { + return TRUE; + } else { + return (this->*(mAction->getExecute()))(); + } } -#pragma pop /* 80048A50-80048A70 043390 0020+00 1/0 0/0 0/0 .text initStart__17dEvLib_callback_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void dEvLib_callback_c::initStart() { - nofralloc -#include "asm/d/event/d_event_lib/initStart__17dEvLib_callback_cFv.s" +BOOL dEvLib_callback_c::initStart() { + return executeStart(); } -#pragma pop - -/* ############################################################################################## */ -/* 804246F8-80424710 051418 0018+00 2/2 0/0 0/0 .bss l_runAction */ -static u8 l_runAction[24]; /* 80048A70-80048B1C 0433B0 00AC+00 2/1 0/0 0/0 .text executeStart__17dEvLib_callback_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void dEvLib_callback_c::executeStart() { - nofralloc -#include "asm/d/event/d_event_lib/executeStart__17dEvLib_callback_cFv.s" +BOOL dEvLib_callback_c::executeStart() { + if (!mActor->mEvtInfo.checkCommandDemoAccrpt()) { + if (mActor->mEvtInfo.getMapToolId() != 0xFF) { + fopAcM_orderMapToolEvent(mActor, mActor->mEvtInfo.getMapToolId(), + mActor->mEvtInfo.getEventId(), 0xFFFF, _C, 0); + } else { + fopAcM_orderOtherEventId(mActor, mActor->mEvtInfo.getEventId(), + mActor->mEvtInfo.getMapToolId(), 0xFFFF, 0, _C); + } + mActor->mEvtInfo.i_onCondition(2); + return TRUE; + } else { + return setAction(&l_runAction); + } } -#pragma pop /* 80048B1C-80048B48 04345C 002C+00 1/0 0/0 0/0 .text initRun__17dEvLib_callback_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void dEvLib_callback_c::initRun() { - nofralloc -#include "asm/d/event/d_event_lib/initRun__17dEvLib_callback_cFv.s" +BOOL dEvLib_callback_c::initRun() { + return eventStart(); } -#pragma pop /* 80048B48-80048BD8 043488 0090+00 1/0 0/0 0/0 .text executeRun__17dEvLib_callback_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void dEvLib_callback_c::executeRun() { - nofralloc -#include "asm/d/event/d_event_lib/executeRun__17dEvLib_callback_cFv.s" +BOOL dEvLib_callback_c::executeRun() { + if (!dComIfGp_getEventManager().endCheck(mActor->mEvtInfo.getEventId())) { + return eventRun(); + } else { + dComIfGp_getEvent().reset(); + setAction(NULL); + return eventEnd(); + } } -#pragma pop - -/* ############################################################################################## */ -/* 803A82B8-803A82C4 0053D8 000C+00 1/1 0/0 0/0 .data cNullVec__6Z2Calc */ -SECTION_DATA static u8 cNullVec__6Z2Calc[12] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; - -/* 803A82C4-803A82D0 -00001 000C+00 0/1 0/0 0/0 .data @3617 */ -#pragma push -#pragma force_active on -SECTION_DATA static void* lit_3617[3] = { - (void*)NULL, - (void*)0xFFFFFFFF, - (void*)initStart__17dEvLib_callback_cFv, -}; -#pragma pop - -/* 803A82D0-803A82DC -00001 000C+00 0/1 0/0 0/0 .data @3618 */ -#pragma push -#pragma force_active on -SECTION_DATA static void* lit_3618[3] = { - (void*)NULL, - (void*)0xFFFFFFFF, - (void*)executeStart__17dEvLib_callback_cFv, -}; -#pragma pop - -/* 803A82DC-803A82E8 -00001 000C+00 0/1 0/0 0/0 .data @3621 */ -#pragma push -#pragma force_active on -SECTION_DATA static void* lit_3621[3] = { - (void*)NULL, - (void*)0xFFFFFFFF, - (void*)initRun__17dEvLib_callback_cFv, -}; -#pragma pop - -/* 803A82E8-803A82F8 -00001 000C+04 0/1 0/0 0/0 .data @3622 */ -#pragma push -#pragma force_active on -SECTION_DATA static void* lit_3622[3 + 1 /* padding */] = { - (void*)NULL, - (void*)0xFFFFFFFF, - (void*)executeRun__17dEvLib_callback_cFv, - /* padding */ - NULL, -}; -#pragma pop - -/* 80048BD8-80048C54 043518 007C+00 0/0 1/0 0/0 .text __sinit_d_event_lib_cpp */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void __sinit_d_event_lib_cpp() { - nofralloc -#include "asm/d/event/d_event_lib/__sinit_d_event_lib_cpp.s" -} -#pragma pop - -#pragma push -#pragma force_active on -REGISTER_CTORS(0x80048BD8, __sinit_d_event_lib_cpp); -#pragma pop diff --git a/src/d/event/d_event_manager.cpp b/src/d/event/d_event_manager.cpp index d3da00c8f6..8a8420f48f 100644 --- a/src/d/event/d_event_manager.cpp +++ b/src/d/event/d_event_manager.cpp @@ -797,7 +797,7 @@ int dEvent_manager_c::endCheckOld(char const* pName) { /* 80047B1C-80047D4C 04245C 0230+00 1/1 10/10 210/210 .text * getMyStaffId__16dEvent_manager_cFPCcP10fopAc_ac_ci */ -s32 dEvent_manager_c::getMyStaffId(char const* pStaffName, fopAc_ac_c* pActor, int tagId) { +int dEvent_manager_c::getMyStaffId(char const* pStaffName, fopAc_ac_c* pActor, int tagId) { int staffNum; int i; int evtIdx = -1; @@ -820,7 +820,7 @@ s32 dEvent_manager_c::getMyStaffId(char const* pStaffName, fopAc_ac_c* pActor, i for (i = 0; i < staffCount; i++) { staffNum = event->getStaff(i); dEvDtStaff_c* staff = getBase().getStaffP(staffNum); - if (staff->mType != 1) { + if (staff->mType != dEvDtStaff_c::TYPE_ALL) { char buf[0x18]; strcpy(buf, staff->mName); char* ptr = NULL; |
