diff --git a/include/d/d_com_inf_game.h b/include/d/d_com_inf_game.h index 96c0ced72..b274b1bc6 100644 --- a/include/d/d_com_inf_game.h +++ b/include/d/d_com_inf_game.h @@ -1123,11 +1123,43 @@ inline s32 dComIfGp_event_moveApproval(void* actor) { return g_dComIfG_gameInfo.play.getEvent().moveApproval(actor); } +inline s32 dComIfGp_event_order(u16 eventType, u16 priority, u16 flag, u16 hind, void* pActor1, void* pActor2, s16 eventID, u8 infoIdx) { + return g_dComIfG_gameInfo.play.getEvent().order(eventType, priority, flag, hind, pActor1, pActor2, eventID, infoIdx); +} + +inline s32 dComIfGp_event_orderOld(u16 eventType, u16 priority, u16 flag, u16 hind, void* pActor1, void* pActor2, const char *pEventName) { + return g_dComIfG_gameInfo.play.getEvent().orderOld(eventType, priority, flag, hind, pActor1, pActor2, pEventName); +} + +inline fopAc_ac_c* dComIfGp_event_getTalkPartner() { + u32 t = g_dComIfG_gameInfo.play.getEvent().mPtTalk; + return g_dComIfG_gameInfo.play.getEvent().convPId(t); +} + +inline fopAc_ac_c* dComIfGp_event_getItemPartner() { + u32 i = g_dComIfG_gameInfo.play.getEvent().mPtItem; + return g_dComIfG_gameInfo.play.getEvent().convPId(i); +} + +inline fopAc_ac_c* dComIfGp_event_getPt1() { + u32 pt1 = g_dComIfG_gameInfo.play.getEvent().mPt1; + return g_dComIfG_gameInfo.play.getEvent().convPId(pt1); +} + +inline fopAc_ac_c* dComIfGp_event_getPt2() { + u32 pt2 = g_dComIfG_gameInfo.play.getEvent().mPt2; + return g_dComIfG_gameInfo.play.getEvent().convPId(pt2); +} + inline dEvent_manager_c& dComIfGp_getEventManager() { return g_dComIfG_gameInfo.play.getEvtManager(); } -inline u32 dComIfGp_evmng_getEventIdx(char* pName, u8 evNo) { +inline s32 dComIfGp_evmng_getEventPrio(s16 eventIdx) { + return dComIfGp_getEventManager().getEventPrio(eventIdx); +} + +inline s16 dComIfGp_evmng_getEventIdx(char* pName, u8 evNo) { return dComIfGp_getEventManager().getEventIdx(pName, evNo); } diff --git a/include/d/d_event.h b/include/d/d_event.h index c1dd57301..464231fc4 100644 --- a/include/d/d_event.h +++ b/include/d/d_event.h @@ -5,6 +5,22 @@ class fopAc_ac_c; +enum dEvtType_e { + /* 0x00 */ dEvtType_TALK_e, + /* 0x01 */ dEvtType_DOOR_e, + /* 0x02 */ dEvtType_OTHER_e, + /* 0x03 */ dEvtType_COMPULSORY_e, + /* 0x04 */ dEvtType_POTENTIAL_e, + /* 0x05 */ dEvtType_ITEM_e, + /* 0x06 */ dEvtType_SHOWITEM_X_e, + /* 0x07 */ dEvtType_SHOWITEM_Y_e, + /* 0x08 */ dEvtType_SHOWITEM_Z_e, + /* 0x09 */ dEvtType_CATCH_e, + /* 0x0A */ dEvtType_TREASURE_e, + /* 0x0B */ dEvtType_PHOTO_e, + /* 0x0A */ dEvtType_CHANGE_e, +}; + class dEvt_order_c { public: ~dEvt_order_c() {} @@ -25,8 +41,8 @@ class dEvt_control_c { public: dEvt_control_c(); - void orderOld(u16, u16, u16, u16, void*, void*, const void*); - void order(u16, u16, u16, u16, void*, void*, s16, u8); + s32 orderOld(u16, u16, u16, u16, void*, void*, const void*); + s32 order(u16, u16, u16, u16, void*, void*, s16, u8); void setParam(dEvt_order_c*); void beforeFlagProc(dEvt_order_c*); void afterFlagProc(dEvt_order_c*); @@ -54,7 +70,7 @@ public: void getStageEventDt(); void nextStageEventDt(void*); void getPId(void*); - void convPId(unsigned int); + fopAc_ac_c * convPId(unsigned int); void getTactFreeMStick(int); void getTactFreeCStick(int); void giveItemCut(u8); diff --git a/include/d/d_event_manager.h b/include/d/d_event_manager.h index e3044c15d..4be016f03 100644 --- a/include/d/d_event_manager.h +++ b/include/d/d_event_manager.h @@ -50,7 +50,7 @@ public: void* getMySubstanceP(int, const char*, int); void getMySubstanceNum(int, const char*); void cutEnd(int); - void getEventPrio(s16); + u16 getEventPrio(s16); void getEventEndSound(s16); void exceptionProc(); void issueStaff(const char*); diff --git a/include/f_op/f_op_actor.h b/include/f_op/f_op_actor.h index ef0c908c3..c1b79af2d 100644 --- a/include/f_op/f_op_actor.h +++ b/include/f_op/f_op_actor.h @@ -172,6 +172,7 @@ class JntHit_c; struct fopAc_cullSizeSphere { public: + fopAc_cullSizeSphere() {} fopAc_cullSizeSphere(cXyz, float); /* 0x0 */ Vec mCenter; @@ -180,6 +181,7 @@ public: struct fopAc_cullSizeBox { public: + fopAc_cullSizeBox() {} fopAc_cullSizeBox(const fopAc_cullSizeBox&); fopAc_cullSizeBox(cXyz, cXyz); diff --git a/include/f_op/f_op_actor_mng.h b/include/f_op/f_op_actor_mng.h index c315656d3..45e75568e 100644 --- a/include/f_op/f_op_actor_mng.h +++ b/include/f_op/f_op_actor_mng.h @@ -416,7 +416,8 @@ s32 fopAcM_orderCatchEvent(fopAc_ac_c*, fopAc_ac_c*, u16, u16); s32 fopAcM_orderOtherEvent(fopAc_ac_c*, char*, u16, u16, u16); s32 fopAcM_orderOtherEvent(fopAc_ac_c*, fopAc_ac_c*, char*, u16, u16, u16); s32 fopAcM_orderOtherEvent2(fopAc_ac_c*, char*, u16, u16); -s32 fopAcM_orderChangeEventId(fopAc_ac_c*, s16, u16, u16); +s32 fopAcM_orderChangeEventId(fopAc_ac_c* i_this, s16 eventIdx, u16 flag, u16 hind); +s32 fopAcM_orderChangeEventId(fopAc_ac_c* i_this, fopAc_ac_c* i_partner, s16 eventIdx, u16 flag, u16 hind); s32 fopAcM_orderOtherEventId(fopAc_ac_c* actor, s16 eventID, u8 mapToolID, u16 param_3, u16 priority, u16 flag); s32 fopAcM_orderMapToolEvent(fopAc_ac_c*, u8, s16, u16, u16, u16); diff --git a/src/f_op/f_op_actor_mng.cpp b/src/f_op/f_op_actor_mng.cpp index aeea87fe0..c50a7004e 100644 --- a/src/f_op/f_op_actor_mng.cpp +++ b/src/f_op/f_op_actor_mng.cpp @@ -508,103 +508,130 @@ s32 fopAcM_cullingCheck(fopAc_ac_c*) { } /* 800259A8-800259F8 .text fopAcM_orderTalkEvent__FP10fopAc_ac_cP10fopAc_ac_c */ -void fopAcM_orderTalkEvent(fopAc_ac_c*, fopAc_ac_c*) { - /* Nonmatching */ +s32 fopAcM_orderTalkEvent(fopAc_ac_c* i_this, fopAc_ac_c* i_partner) { + return dComIfGp_event_order(dEvtType_TALK_e, 0x1FF, 0, 0x14F, i_this, i_partner, -1, 0xFF); } /* 800259F8-80025A48 .text fopAcM_orderTalkXBtnEvent__FP10fopAc_ac_cP10fopAc_ac_c */ -void fopAcM_orderTalkXBtnEvent(fopAc_ac_c*, fopAc_ac_c*) { - /* Nonmatching */ +s32 fopAcM_orderTalkXBtnEvent(fopAc_ac_c* i_this, fopAc_ac_c* i_partner) { + return dComIfGp_event_order(dEvtType_SHOWITEM_X_e, 0x1F4, 0, 0x14F, i_this, i_partner, -1, 0xFF); } /* 80025A48-80025A98 .text fopAcM_orderTalkYBtnEvent__FP10fopAc_ac_cP10fopAc_ac_c */ -void fopAcM_orderTalkYBtnEvent(fopAc_ac_c*, fopAc_ac_c*) { - /* Nonmatching */ +s32 fopAcM_orderTalkYBtnEvent(fopAc_ac_c* i_this, fopAc_ac_c* i_partner) { + return dComIfGp_event_order(dEvtType_SHOWITEM_Y_e, 0x1F4, 0, 0x14F, i_this, i_partner, -1, 0xFF); } /* 80025A98-80025AE8 .text fopAcM_orderTalkZBtnEvent__FP10fopAc_ac_cP10fopAc_ac_c */ -void fopAcM_orderTalkZBtnEvent(fopAc_ac_c*, fopAc_ac_c*) { - /* Nonmatching */ +s32 fopAcM_orderTalkZBtnEvent(fopAc_ac_c* i_this, fopAc_ac_c* i_partner) { + return dComIfGp_event_order(dEvtType_SHOWITEM_Z_e, 0x1F4, 0, 0x14F, i_this, i_partner, -1, 0xFF); } /* 80025AE8-80025B3C .text fopAcM_orderZHintEvent__FP10fopAc_ac_cP10fopAc_ac_c */ -void fopAcM_orderZHintEvent(fopAc_ac_c*, fopAc_ac_c*) { - /* Nonmatching */ +s32 fopAcM_orderZHintEvent(fopAc_ac_c* i_this, fopAc_ac_c* i_partner) { + return dComIfGp_event_order(dEvtType_TALK_e, 0x1FF, 0, 0xFFFF, i_this, i_partner, -1, 0xFF); } /* 80025B3C-80025B8C .text fopAcM_orderSpeakEvent__FP10fopAc_ac_c */ -s32 fopAcM_orderSpeakEvent(fopAc_ac_c*) { - /* Nonmatching */ +s32 fopAcM_orderSpeakEvent(fopAc_ac_c* i_this) { + return dComIfGp_event_order(dEvtType_TALK_e, 0x1EA, 0, 0x14F, dComIfGp_getPlayer(0), i_this, -1, 0xFF); } /* 80025B8C-80025BE0 .text fopAcM_orderDoorEvent__FP10fopAc_ac_cP10fopAc_ac_c */ -void fopAcM_orderDoorEvent(fopAc_ac_c*, fopAc_ac_c*) { - /* Nonmatching */ +s32 fopAcM_orderDoorEvent(fopAc_ac_c* i_this, fopAc_ac_c* i_partner) { + return dComIfGp_event_order(dEvtType_DOOR_e, 0xFF, 0, 0xFFFF, i_this, i_partner, -1, 0xFF); } /* 80025BE0-80025C34 .text fopAcM_orderCatchEvent__FP10fopAc_ac_cP10fopAc_ac_c */ -void fopAcM_orderCatchEvent(fopAc_ac_c*, fopAc_ac_c*) { - /* Nonmatching */ +s32 fopAcM_orderCatchEvent(fopAc_ac_c* i_this, fopAc_ac_c* i_partner) { + return dComIfGp_event_order(dEvtType_CATCH_e, 1, 0, 0xFFFF, i_this, i_partner, -1, 0xFF); } /* 80025C34-80025CC8 .text fopAcM_orderOtherEvent2__FP10fopAc_ac_cPcUsUs */ -s32 fopAcM_orderOtherEvent2(fopAc_ac_c*, char*, u16, u16) { - /* Nonmatching */ +s32 fopAcM_orderOtherEvent2(fopAc_ac_c* i_this, char* pEventName, u16 flag, u16 hind) { + u16 prio = dComIfGp_evmng_getEventPrio(dComIfGp_evmng_getEventIdx(pEventName, 0xFF)); + if (prio == 0) + prio = 0xFF; + + return dComIfGp_event_orderOld(dEvtType_OTHER_e, prio, flag, hind, i_this, dComIfGp_getPlayer(0), pEventName); } /* 80025CC8-80025D28 .text fopAcM_orderChangeEvent__FP10fopAc_ac_cPcUsUs */ -void fopAcM_orderChangeEvent(fopAc_ac_c*, char*, u16, u16) { - /* Nonmatching */ +s32 fopAcM_orderChangeEvent(fopAc_ac_c* i_this, char* pEventName, u16 flag, u16 hind) { + return fopAcM_orderChangeEventId(i_this, dComIfGp_evmng_getEventIdx(pEventName, 0xFF), flag, hind); } /* 80025D28-80025D94 .text fopAcM_orderChangeEvent__FP10fopAc_ac_cP10fopAc_ac_cPcUsUs */ -void fopAcM_orderChangeEvent(fopAc_ac_c*, fopAc_ac_c*, char*, u16, u16) { - /* Nonmatching */ +s32 fopAcM_orderChangeEvent(fopAc_ac_c* i_this, fopAc_ac_c* i_partner, char* pEventName, u16 flag, u16 hind) { + return fopAcM_orderChangeEventId(i_this, i_partner, dComIfGp_evmng_getEventIdx(pEventName, 0xFF), flag, hind); } /* 80025D94-80025E1C .text fopAcM_orderChangeEventId__FP10fopAc_ac_csUsUs */ -s32 fopAcM_orderChangeEventId(fopAc_ac_c*, short, u16, u16) { - /* Nonmatching */ +s32 fopAcM_orderChangeEventId(fopAc_ac_c* i_this, s16 eventIdx, u16 flag, u16 hind) { + u16 prio = dComIfGp_evmng_getEventPrio(eventIdx); + if (prio == 0) + prio = 0xFF; + + return dComIfGp_event_order(dEvtType_CHANGE_e, prio, flag, hind, i_this, dComIfGp_getPlayer(0), eventIdx, 0xFF); } /* 80025E1C-80025EA4 .text fopAcM_orderChangeEventId__FP10fopAc_ac_cP10fopAc_ac_csUsUs */ -void fopAcM_orderChangeEventId(fopAc_ac_c*, fopAc_ac_c*, short, u16, u16) { - /* Nonmatching */ +s32 fopAcM_orderChangeEventId(fopAc_ac_c* i_this, fopAc_ac_c* i_partner, s16 eventIdx, u16 flag, u16 hind) { + u16 prio = dComIfGp_evmng_getEventPrio(eventIdx); + if (prio == 0) + prio = 0xFF; + + return dComIfGp_event_order(dEvtType_CHANGE_e, prio, flag, hind, i_this, i_partner, eventIdx, 0xFF); } /* 80025EA4-80025F3C .text fopAcM_orderOtherEventId__FP10fopAc_ac_csUcUsUsUs */ -s32 fopAcM_orderOtherEventId(fopAc_ac_c*, short, unsigned char, u16, u16, u16) { - /* Nonmatching */ +s32 fopAcM_orderOtherEventId(fopAc_ac_c* i_this, s16 eventIdx, u8 infoIdx, u16 hind, u16 priority, u16 flag) { + u16 prio; + if (priority != 0) { + prio = priority; + } else { + prio = dComIfGp_evmng_getEventPrio(eventIdx); + if (prio == 0) + prio = 0xFF; + } + + return dComIfGp_event_order(dEvtType_OTHER_e, prio, flag, hind, i_this, dComIfGp_getPlayer(0), eventIdx, infoIdx); } /* 80025F3C-80025F9C .text fopAcM_orderPotentialEvent__FP10fopAc_ac_cUsUsUs */ -s32 fopAcM_orderPotentialEvent(fopAc_ac_c*, u16, u16, u16) { - /* Nonmatching */ +s32 fopAcM_orderPotentialEvent(fopAc_ac_c* i_this, u16 flag, u16 hind, u16 priority) { + if (priority == 0) + priority = 0xFF; + + return dComIfGp_event_order(dEvtType_POTENTIAL_e, priority, flag, hind, i_this, dComIfGp_getPlayer(0), -1, 0xFF); } /* 80025F9C-80025FF0 .text fopAcM_orderItemEvent__FP10fopAc_ac_c */ -void fopAcM_orderItemEvent(fopAc_ac_c*) { - /* Nonmatching */ +s32 fopAcM_orderItemEvent(fopAc_ac_c* i_this) { + return dComIfGp_event_order(dEvtType_ITEM_e, 0xFF, 0, 0xFFFF, dComIfGp_getPlayer(0), i_this, -1, 0xFF); } /* 80025FF0-80026044 .text fopAcM_orderTreasureEvent__FP10fopAc_ac_cP10fopAc_ac_c */ -void fopAcM_orderTreasureEvent(fopAc_ac_c*, fopAc_ac_c*) { - /* Nonmatching */ +s32 fopAcM_orderTreasureEvent(fopAc_ac_c* i_this, fopAc_ac_c* i_partner) { + return dComIfGp_event_order(dEvtType_TREASURE_e, 0xFF, 0, 0xFFFF, i_this, i_partner, -1, 0xFF); } /* 80026044-80026074 .text fopAcM_getTalkEventPartner__FP10fopAc_ac_c */ fopAc_ac_c* fopAcM_getTalkEventPartner(fopAc_ac_c*) { - /* Nonmatching */ + return dComIfGp_event_getTalkPartner(); } /* 80026074-800260A4 .text fopAcM_getItemEventPartner__FP10fopAc_ac_c */ fopAc_ac_c* fopAcM_getItemEventPartner(fopAc_ac_c*) { - /* Nonmatching */ + return dComIfGp_event_getItemPartner(); } /* 800260A4-80026118 .text fopAcM_getEventPartner__FP10fopAc_ac_c */ -fopAc_ac_c* fopAcM_getEventPartner(fopAc_ac_c*) { - /* Nonmatching */ +fopAc_ac_c* fopAcM_getEventPartner(fopAc_ac_c* i_this) { + if (dComIfGp_event_getPt1() != i_this) + return dComIfGp_event_getPt1(); + + return dComIfGp_event_getPt2(); } /* 80026118-800261E8 .text fopAcM_createItemForPresentDemo__FP4cXyziUciiP5csXyzP4cXyz */