mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-06-22 23:09:52 -04:00
event lib
This commit is contained in:
+113
-225
@@ -4,187 +4,23 @@
|
||||
//
|
||||
|
||||
#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"
|
||||
|
||||
//
|
||||
// Types:
|
||||
//
|
||||
|
||||
struct fopAc_ac_c {};
|
||||
|
||||
struct dEvt_control_c {
|
||||
/* 80042468 */ void reset();
|
||||
};
|
||||
|
||||
struct dEvent_manager_c {
|
||||
/* 80047698 */ void getEventIdx(fopAc_ac_c*, u8);
|
||||
/* 80047A78 */ void endCheck(s16);
|
||||
};
|
||||
|
||||
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();
|
||||
};
|
||||
|
||||
//
|
||||
// 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];
|
||||
#include "f_op/f_op_actor_mng.h"
|
||||
|
||||
//
|
||||
// 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"
|
||||
inline dEvent_manager_c& dComIfGp_getEventManager() {
|
||||
return g_dComIfG_gameInfo.play.getEvtManager();
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 804246E0-804246F8 051400 0018+00 2/2 0/0 0/0 .bss l_startAction */
|
||||
static u8 l_startAction[24];
|
||||
|
||||
/* 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"
|
||||
inline dEvt_control_c& dComIfGp_getEvent() {
|
||||
return g_dComIfG_gameInfo.play.getEvent();
|
||||
}
|
||||
#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"
|
||||
}
|
||||
#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"
|
||||
}
|
||||
#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"
|
||||
}
|
||||
#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"
|
||||
}
|
||||
#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"
|
||||
}
|
||||
#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"
|
||||
}
|
||||
#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"
|
||||
}
|
||||
#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"
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 803A82B8-803A82C4 0053D8 000C+00 1/1 0/0 0/0 .data cNullVec__6Z2Calc */
|
||||
@@ -192,59 +28,111 @@ 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"
|
||||
/* 8004886C-800488A4 0431AC 0038+00 0/0 0/0 23/23 .text eventUpdate__17dEvLib_callback_cFv */
|
||||
BOOL dEvLib_callback_c::eventUpdate() {
|
||||
if (mAction == NULL) {
|
||||
return FALSE;
|
||||
} else {
|
||||
executeAction();
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
#pragma push
|
||||
#pragma force_active on
|
||||
REGISTER_CTORS(0x80048BD8, __sinit_d_event_lib_cpp);
|
||||
#pragma pop
|
||||
/* ############################################################################################## */
|
||||
/* 804246E0-804246F8 051400 0018+00 2/2 0/0 0/0 .bss l_startAction */
|
||||
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
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/* 80048940-80048970 043280 0030+00 0/0 0/0 21/21 .text orderEvent__17dEvLib_callback_cFiii */
|
||||
void dEvLib_callback_c::orderEvent(int param_0, int param_1, int param_2) {
|
||||
setEvent(param_0, param_1, param_2 != 0 ? 0x101 : 1);
|
||||
}
|
||||
|
||||
/* 80048970-800489A8 0432B0 0038+00 3/3 0/0 0/0 .text
|
||||
* setAction__17dEvLib_callback_cFP33action_class<17dEvLib_callback_c> */
|
||||
BOOL dEvLib_callback_c::setAction(action_class<dEvLib_callback_c>* action) {
|
||||
mAction = action;
|
||||
if (mAction == NULL) {
|
||||
return FALSE;
|
||||
} else {
|
||||
return initAction();
|
||||
}
|
||||
}
|
||||
|
||||
/* 800489A8-800489F8 0432E8 0050+00 1/1 0/0 0/0 .text initAction__17dEvLib_callback_cFv
|
||||
*/
|
||||
BOOL dEvLib_callback_c::initAction() {
|
||||
if (!mAction->getInit()) {
|
||||
return TRUE;
|
||||
} else {
|
||||
return (this->*(mAction->getInit()))();
|
||||
}
|
||||
}
|
||||
|
||||
/* 800489F8-80048A50 043338 0058+00 1/1 0/0 0/0 .text executeAction__17dEvLib_callback_cFv */
|
||||
BOOL dEvLib_callback_c::executeAction() {
|
||||
if (!mAction->getExecute()) {
|
||||
return TRUE;
|
||||
} else {
|
||||
return (this->*(mAction->getExecute()))();
|
||||
}
|
||||
}
|
||||
|
||||
/* 80048A50-80048A70 043390 0020+00 1/0 0/0 0/0 .text initStart__17dEvLib_callback_cFv */
|
||||
BOOL dEvLib_callback_c::initStart() {
|
||||
return executeStart();
|
||||
}
|
||||
|
||||
/* 80048A70-80048B1C 0433B0 00AC+00 2/1 0/0 0/0 .text executeStart__17dEvLib_callback_cFv
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/* 80048B1C-80048B48 04345C 002C+00 1/0 0/0 0/0 .text initRun__17dEvLib_callback_cFv */
|
||||
BOOL dEvLib_callback_c::initRun() {
|
||||
return eventStart();
|
||||
}
|
||||
|
||||
/* 80048B48-80048BD8 043488 0090+00 1/0 0/0 0/0 .text executeRun__17dEvLib_callback_cFv
|
||||
*/
|
||||
BOOL dEvLib_callback_c::executeRun() {
|
||||
if (!dComIfGp_getEventManager().endCheck(mActor->mEvtInfo.getEventId())) {
|
||||
return eventRun();
|
||||
} else {
|
||||
dComIfGp_getEvent().reset();
|
||||
setAction(NULL);
|
||||
return eventEnd();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user