diff --git a/configure.py b/configure.py index eb816b250..47e4f7a01 100644 --- a/configure.py +++ b/configure.py @@ -1309,7 +1309,7 @@ config.libs = [ ActorRel(NonMatching, "d_a_tag_ba1"), ActorRel(NonMatching, "d_a_tag_event"), ActorRel(NonMatching, "d_a_tag_evsw"), - ActorRel(NonMatching, "d_a_tag_ghostship"), + ActorRel(Matching, "d_a_tag_ghostship"), ActorRel(NonMatching, "d_a_tag_hint"), ActorRel(Matching, "d_a_tag_kb_item"), ActorRel(NonMatching, "d_a_tag_kk1"), diff --git a/include/d/actor/d_a_tag_ghostship.h b/include/d/actor/d_a_tag_ghostship.h index 589226a98..99a03eb9c 100644 --- a/include/d/actor/d_a_tag_ghostship.h +++ b/include/d/actor/d_a_tag_ghostship.h @@ -6,7 +6,8 @@ class daTag_Gship_c : public fopAc_ac_c { public: enum Proc_e { - + CLEAR_WAIT = 0, + CLEAR_EVENT }; void modeProcInit(int) {} @@ -16,20 +17,28 @@ public: void modeClearEventInit(); void modeClearEvent(); void modeProc(Proc_e, int); - BOOL _execute(); - BOOL _draw(); + bool _execute(); + bool _draw(); void getArg(); s32 _create(); - BOOL _delete(); + bool _delete(); public: /* 0x290 */ int mMode; - /* 0x294 */ s8 m294; - /* 0x295 */ s8 m295; - /* 0x296 */ s8 m296; - /* 0x297 */ s8 m297; - /* 0x298 */ f32 m298; - /* 0x29C */ u8 m29C[0x2A4 - 0x29C]; -}; + /* 0x294 */ s8 field_0x294; + /* 0x298 */ f32 field_0x298; + /* 0x29C */ u8 field_0x29C[0x2A4 - 0x29C]; +}; // Size: 0x2A4 + +class daTag_Gship_HIO_c { +public: + daTag_Gship_HIO_c(); + virtual ~daTag_Gship_HIO_c() {} + + /* 0x04 */ s8 field_0x04; + /* 0x05 */ u8 field_0x05; + /* 0x08 */ u32 field_0x08; + /* 0x0C */ u32 field_0x0C; +}; // Size: 0x10 #endif /* D_A_TAG_GHOSTSHIP_H */ diff --git a/src/d/actor/d_a_ghostship.cpp b/src/d/actor/d_a_ghostship.cpp index 9f2f8c6ee..ec113edef 100644 --- a/src/d/actor/d_a_ghostship.cpp +++ b/src/d/actor/d_a_ghostship.cpp @@ -12,6 +12,12 @@ #include "d/d_s_play.h" #include "d/d_kankyo_wether.h" +// Needed for .data to match. +static f32 dummy1[3] = {1.0f, 1.0f, 1.0f}; +static f32 dummy2[3] = {1.0f, 1.0f, 1.0f}; +static u8 dummy3[4] = {0x02, 0x00, 0x02, 0x01}; +static f64 dummy4[2] = {3.0, 0.5}; + const u32 daGhostship_c::m_heapsize = 0x1EA0; const char daGhostship_c::m_arc_name[] = "Ayush"; const char daGhostship_c::m_cloth_arc_name[] = "Cloth"; diff --git a/src/d/actor/d_a_tag_ghostship.cpp b/src/d/actor/d_a_tag_ghostship.cpp index ce05241ca..522f84dab 100644 --- a/src/d/actor/d_a_tag_ghostship.cpp +++ b/src/d/actor/d_a_tag_ghostship.cpp @@ -4,85 +4,171 @@ // #include "d/actor/d_a_tag_ghostship.h" -#include "dolphin/types.h" +#include "JSystem/JKernel/JKRHeap.h" +#include "d/d_com_inf_game.h" +#include "d/d_procname.h" + +// Needed for .data to match. +static f32 dummy1[3] = {1.0f, 1.0f, 1.0f}; +static f32 dummy2[3] = {1.0f, 1.0f, 1.0f}; +static u8 dummy3[4] = {0x02, 0x00, 0x02, 0x01}; +static f64 dummy4[2] = {3.0, 0.5}; + +static daTag_Gship_HIO_c l_HIO; -/* 000000EC-0000010C .text __ct__17daTag_Gship_HIO_cFv */ daTag_Gship_HIO_c::daTag_Gship_HIO_c() { - /* Nonmatching */ + field_0x04 = -1; + field_0x05 = 0; } -/* 0000010C-00000110 .text modeClearWaitInit__13daTag_Gship_cFv */ void daTag_Gship_c::modeClearWaitInit() { - /* Nonmatching */ + return; } -/* 00000110-000001C0 .text modeClearWait__13daTag_Gship_cFv */ void daTag_Gship_c::modeClearWait() { - /* Nonmatching */ + if(dComIfGp_evmng_endCheck("DEFAULT_TREASURE") || dComIfGp_evmng_endCheck("DEFAULT_TREASURE2") || dComIfGp_evmng_endCheck("DEFAULT_TREASURE_A") || l_HIO.field_0x05) { + modeProc(CLEAR_WAIT, 1); + } } -/* 000001C0-00000214 .text modeClearEventInit__13daTag_Gship_cFv */ void daTag_Gship_c::modeClearEventInit() { - /* Nonmatching */ + dComIfGs_getEventReg(0x8803); + dComIfGs_setEventReg(0x8803, 3); } -/* 00000214-00000418 .text modeClearEvent__13daTag_Gship_cFv */ void daTag_Gship_c::modeClearEvent() { - /* Nonmatching */ + if(mEvtInfo.checkCommandDemoAccrpt()) { + int staffIdx = dComIfGp_evmng_getMyStaffId("PScnChg", 0, 0); + if(dEvmng_strcmp(dComIfGp_getPEvtManager()->getMyNowCutName(staffIdx), "WARAIGOE") == 0) { + if(dComIfGs_getEventReg(0x8803) == 3) { + mDoAud_seStart(JA_SE_CV_G_SHIP_SCREAM, 0, 0, 0); + } + else { + mDoAud_seStart(JA_SE_CV_G_SHIP_LAUGH, 0, 0, 0); + } + + dComIfGp_evmng_cutEnd(staffIdx); + } + + if(dComIfGp_evmng_endCheck("PSHIP_CLEAR")) { + mDoAud_seStart(JA_SE_LK_WARP_TO_G_SHIP, 0, 0, 0); + s8 room = dComIfGs_getEventReg(0xC3FF); + s8 spawn = dComIfGs_getEventReg(0x85FF); + dKy_set_nexttime(120.0f); + dComIfGp_setNextStage("sea", spawn, room, 0xFF, 0.0f, 5, 1, 0); + } + } + else { + fopAcM_orderOtherEvent2(this, "PSHIP_CLEAR", 1, 0xFFFF); + } } -/* 00000418-00000508 .text modeProc__13daTag_Gship_cFQ213daTag_Gship_c6Proc_ei */ -void daTag_Gship_c::modeProc(daTag_Gship_c::Proc_e, int) { - /* Nonmatching */ +void daTag_Gship_c::modeProc(daTag_Gship_c::Proc_e proc, int param_2) { + typedef void(daTag_Gship_c::*ProcFunc)(void); + struct ProcEntry { + ProcFunc init; + ProcFunc run; + const char* name; + }; + + static const ProcEntry mode_proc[] = { + { + &daTag_Gship_c::modeClearWaitInit, + &daTag_Gship_c::modeClearWait, + "CLEAR_WAIT" + }, + { + &daTag_Gship_c::modeClearEventInit, + &daTag_Gship_c::modeClearEvent, + "CLEAR_EVENT" + } + }; + + if(proc == CLEAR_WAIT) { + mMode = param_2; + (this->*mode_proc[mMode].init)(); + } + else if(proc == CLEAR_EVENT) { + (this->*mode_proc[mMode].run)(); + } } -/* 00000508-00000534 .text _execute__13daTag_Gship_cFv */ -BOOL daTag_Gship_c::_execute() { - /* Nonmatching */ +bool daTag_Gship_c::_execute() { + modeProc(CLEAR_EVENT, 2); + return true; } -/* 00000534-0000053C .text _draw__13daTag_Gship_cFv */ -BOOL daTag_Gship_c::_draw() { - /* Nonmatching */ +bool daTag_Gship_c::_draw() { + return true; } -/* 0000053C-00000594 .text getArg__13daTag_Gship_cFv */ void daTag_Gship_c::getArg() { - /* Nonmatching */ + u32 param = fopAcM_GetParam(this); + + field_0x294 = param; + s32 bit = fopAcM_GetParamBit(param, 8, 8); + if(bit == 0xFF) { + field_0x298 = 1000.0f; + } + else { + field_0x298 = bit * 100; + } } -/* 00000594-000005EC .text _create__13daTag_Gship_cFv */ s32 daTag_Gship_c::_create() { - /* Nonmatching */ + fopAcM_SetupActor(this, daTag_Gship_c); + + getArg(); + + return cPhs_COMPLEATE_e; } -/* 000005EC-000005F4 .text _delete__13daTag_Gship_cFv */ -BOOL daTag_Gship_c::_delete() { - /* Nonmatching */ +bool daTag_Gship_c::_delete() { + return true; } -/* 000005F4-00000614 .text daTag_GshipCreate__FPv */ -static s32 daTag_GshipCreate(void*) { - /* Nonmatching */ +static s32 daTag_GshipCreate(void* i_this) { + return static_cast(i_this)->_create(); } -/* 00000614-00000638 .text daTag_GshipDelete__FPv */ -static BOOL daTag_GshipDelete(void*) { - /* Nonmatching */ +static BOOL daTag_GshipDelete(void* i_this) { + return static_cast(i_this)->_delete(); } -/* 00000638-0000065C .text daTag_GshipExecute__FPv */ -static BOOL daTag_GshipExecute(void*) { - /* Nonmatching */ +static BOOL daTag_GshipExecute(void* i_this) { + return static_cast(i_this)->_execute(); } -/* 0000065C-00000680 .text daTag_GshipDraw__FPv */ -static BOOL daTag_GshipDraw(void*) { - /* Nonmatching */ +static BOOL daTag_GshipDraw(void* i_this) { + return static_cast(i_this)->_draw(); } -/* 00000680-00000688 .text daTag_GshipIsDelete__FPv */ static BOOL daTag_GshipIsDelete(void*) { - /* Nonmatching */ + return true; } + +static actor_method_class daTag_GshipMethodTable = { + (process_method_func)daTag_GshipCreate, + (process_method_func)daTag_GshipDelete, + (process_method_func)daTag_GshipExecute, + (process_method_func)daTag_GshipIsDelete, + (process_method_func)daTag_GshipDraw, +}; + +actor_process_profile_definition g_profile_TAG_GSHIP = { + fpcLy_CURRENT_e, + 8, + fpcPi_CURRENT_e, + PROC_TAG_GSHIP, + &g_fpcLf_Method.mBase, + sizeof(daTag_Gship_c), + 0, + 0, + &g_fopAc_Method.base, + 0x0066, + &daTag_GshipMethodTable, + fopAcStts_UNK40000_e | fopAcStts_UNK4000_e, + fopAc_ACTOR_e, + fopAc_CULLBOX_4_e, +};