Make getEvent return a pointer instead of a reference, resolve tbox fakematch

This commit is contained in:
LagoLunatic
2025-12-29 13:05:34 -05:00
parent e095de7b01
commit 8651f98984
5 changed files with 35 additions and 48 deletions
+30 -30
View File
@@ -237,7 +237,7 @@ public:
dStage_roomControl_c* getRoomControl() { return &mRoomCtrl; }
dStage_dt_c& getStage() { return mStageData; }
dEvt_control_c& getEvent() { return mEvtCtrl; }
dEvt_control_c* getEvent() { return &mEvtCtrl; }
dEvent_manager_c& getEvtManager() { return mEvtManager; }
dPa_control_c* getParticle() { return mParticle; }
dVibration_c& getVibration() { return mVibration; }
@@ -3128,14 +3128,14 @@ inline BOOL dComIfGp_roomControl_checkRoomDisp(int i_roomNo) {
*/
inline BOOL dComIfGp_event_runCheck() {
return g_dComIfG_gameInfo.play.getEvent().runCheck();
return g_dComIfG_gameInfo.play.getEvent()->runCheck();
}
inline u16 dComIfGp_event_checkHind(u16 i_hindFlag) {
if (!dComIfGp_event_runCheck()) {
return false;
}
return g_dComIfG_gameInfo.play.getEvent().checkHind(i_hindFlag);
return g_dComIfG_gameInfo.play.getEvent()->checkHind(i_hindFlag);
}
/**
@@ -3143,112 +3143,112 @@ inline u16 dComIfGp_event_checkHind(u16 i_hindFlag) {
* @return The dTalkXYButton_e of the button the player used to initiate this event.
*/
inline u8 dComIfGp_event_getTalkXYBtn() {
return g_dComIfG_gameInfo.play.getEvent().getTalkXYBtn();
return g_dComIfG_gameInfo.play.getEvent()->getTalkXYBtn();
}
inline bool dComIfGp_event_chkTalkXY() {
return g_dComIfG_gameInfo.play.getEvent().chkTalkXY();
return g_dComIfG_gameInfo.play.getEvent()->chkTalkXY();
}
inline void dComIfGp_event_onEventFlag(u16 flag) {
g_dComIfG_gameInfo.play.getEvent().onEventFlag(flag);
g_dComIfG_gameInfo.play.getEvent()->onEventFlag(flag);
}
inline void dComIfGp_event_offEventFlag(u16 flag) {
g_dComIfG_gameInfo.play.getEvent().offEventFlag(flag);
g_dComIfG_gameInfo.play.getEvent()->offEventFlag(flag);
}
inline u16 dComIfGp_event_chkEventFlag(u16 flag) {
return g_dComIfG_gameInfo.play.getEvent().chkEventFlag(flag);
return g_dComIfG_gameInfo.play.getEvent()->chkEventFlag(flag);
}
inline void dComIfGp_event_remove() {
g_dComIfG_gameInfo.play.getEvent().remove();
g_dComIfG_gameInfo.play.getEvent()->remove();
}
inline void dComIfGp_event_reset() {
g_dComIfG_gameInfo.play.getEvent().reset();
g_dComIfG_gameInfo.play.getEvent()->reset();
}
inline int dComIfGp_event_getPreItemNo() {
return g_dComIfG_gameInfo.play.getEvent().getPreItemNo();
return g_dComIfG_gameInfo.play.getEvent()->getPreItemNo();
}
inline void dComIfGp_event_setGtItm(u8 itemNo) {
g_dComIfG_gameInfo.play.getEvent().setGtItm(itemNo);
g_dComIfG_gameInfo.play.getEvent()->setGtItm(itemNo);
}
inline u8 dComIfGp_event_getGtItm() {
return g_dComIfG_gameInfo.play.getEvent().getGtItm();
return g_dComIfG_gameInfo.play.getEvent()->getGtItm();
}
inline s32 dComIfGp_event_moveApproval(void* actor) {
return g_dComIfG_gameInfo.play.getEvent().moveApproval(actor);
return g_dComIfG_gameInfo.play.getEvent()->moveApproval(actor);
}
inline BOOL dComIfGp_event_compulsory(void* param_1, const char* param_2 = NULL, u16 param_3 = -1) {
return g_dComIfG_gameInfo.play.getEvent().compulsory(param_1, param_2, param_3);
return g_dComIfG_gameInfo.play.getEvent()->compulsory(param_1, param_2, param_3);
}
inline s32 dComIfGp_event_order(u16 eventType, u16 priority, u16 flag, u16 hind, void* pActor1,
void* pActor2, s16 eventID = -1, u8 infoIdx = -1) {
return g_dComIfG_gameInfo.play.getEvent().order(eventType, priority, flag, hind, pActor1, pActor2, eventID, 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);
return g_dComIfG_gameInfo.play.getEvent()->orderOld(eventType, priority, flag, hind, pActor1, pActor2, pEventName);
}
inline fopAc_ac_c* dComIfGp_event_getTalkPartner() {
return g_dComIfG_gameInfo.play.getEvent().getPtT();
return g_dComIfG_gameInfo.play.getEvent()->getPtT();
}
inline void dComIfGp_event_setTalkPartner(void* i_actor) {
g_dComIfG_gameInfo.play.getEvent().setPtT(i_actor);
g_dComIfG_gameInfo.play.getEvent()->setPtT(i_actor);
}
inline fopAc_ac_c* dComIfGp_event_getItemPartner() {
return g_dComIfG_gameInfo.play.getEvent().getPtI();
return g_dComIfG_gameInfo.play.getEvent()->getPtI();
}
inline void dComIfGp_event_setItemPartner(void* pt) {
g_dComIfG_gameInfo.play.getEvent().setPtI(pt);
g_dComIfG_gameInfo.play.getEvent()->setPtI(pt);
}
inline void dComIfGp_event_setItemPartnerId(fpc_ProcID id) {
g_dComIfG_gameInfo.play.getEvent().setPtI_Id(id);
g_dComIfG_gameInfo.play.getEvent()->setPtI_Id(id);
}
inline fopAc_ac_c* dComIfGp_event_getPt1() {
return g_dComIfG_gameInfo.play.getEvent().getPt1();
return g_dComIfG_gameInfo.play.getEvent()->getPt1();
}
inline fopAc_ac_c* dComIfGp_event_getPt2() {
return g_dComIfG_gameInfo.play.getEvent().getPt2();
return g_dComIfG_gameInfo.play.getEvent()->getPt2();
}
inline f32 dComIfGp_event_getCullRate() {
return g_dComIfG_gameInfo.play.getEvent().getCullRate();
return g_dComIfG_gameInfo.play.getEvent()->getCullRate();
}
inline void dComIfGp_event_setCullRate(f32 ratio) {
g_dComIfG_gameInfo.play.getEvent().setCullRate(ratio);
g_dComIfG_gameInfo.play.getEvent()->setCullRate(ratio);
}
inline BOOL dComIfGp_event_check() {
return g_dComIfG_gameInfo.play.getEvent().check();
return g_dComIfG_gameInfo.play.getEvent()->check();
}
inline u8 dComIfGp_event_getMode() {
return g_dComIfG_gameInfo.play.getEvent().getMode();
return g_dComIfG_gameInfo.play.getEvent()->getMode();
}
inline u8 dComIfGp_event_getTactFreeMStick(int which) {
return g_dComIfG_gameInfo.play.getEvent().getTactFreeMStick(which);
return g_dComIfG_gameInfo.play.getEvent()->getTactFreeMStick(which);
}
inline u8 dComIfGp_event_getTactFreeCStick(int which) {
return g_dComIfG_gameInfo.play.getEvent().getTactFreeCStick(which);
return g_dComIfG_gameInfo.play.getEvent()->getTactFreeCStick(which);
}
inline bool dComIfGp_getMetronome() {
+1 -1
View File
@@ -6667,7 +6667,7 @@ u32 daNpcPeople_c::getMsg() {
m734 = NULL;
if(g_dComIfG_gameInfo.play.getEvent().chkPhoto()) {
if(g_dComIfG_gameInfo.play.getEvent()->chkPhoto()) {
switch(mNpcType) {
case 2:
if(dComIfGp_getPictureResult() == 1) {
+1 -1
View File
@@ -1714,7 +1714,7 @@ u32 daNpcPhoto_c::getMsg() {
field_0x980 = 0;
field_0x9D0 = 0;
if(g_dComIfG_gameInfo.play.getEvent().chkPhoto()) {
if(g_dComIfG_gameInfo.play.getEvent()->chkPhoto()) {
if (eventReg < 1) {
msgNo = 0x2A5C;
} else if (eventReg < 3) {
+2 -15
View File
@@ -919,27 +919,14 @@ BOOL daTbox_c::actionWait() {
/* 000024B4-000025A4 .text actionDemo__8daTbox_cFv */
BOOL daTbox_c::actionDemo() {
/* Fakematch - the temp variable for play is definitely not right. */
s16 eventId = eventInfo.getEventId();
dComIfG_play_c* play = &g_dComIfG_gameInfo.play;
if (dComIfGp_evmng_endCheck(eventId)) {
// if (dComIfGp_evmng_endCheck(eventInfo.getEventId())) {
if (dComIfGp_evmng_endCheck(eventInfo.getEventId())) {
setAction(&daTbox_c::actionWait);
// Fakematch:
// When dComIfGp_event_reset is used here, the way gameInfo is loaded matches the demo
// binary, but not the release binary. So the demo's debug map may be misleading here?
// But daTbox_c::actionDemo in TP debug still calls dComIfGp_event_reset, so maybe not?
// Also, putting a cast like (void) on dComIfGp_event_reset() slightly improves the
// codegen, but it's still slightly wrong.
// dComIfGp_event_reset();
play->getEvent().reset();
dComIfGp_event_reset();
dKy_set_allcol_ratio(1.0f);
flagOff(daTboxFlg_UNK_08 | daTboxFlg_OPENING_e);
// The fakematch also might be related to dComIfGp_event_setItemPartner? Removing this
// call fixes the load above.
dComIfGp_event_setItemPartner(NULL);
if (mSmokeEmitter != NULL) {
+1 -1
View File
@@ -674,7 +674,7 @@ fopAc_ac_c* dEvent_manager_c::specialCast_Shutter(s16 profName, int flag) {
goal.x += cM_ssin(angle) * 100.0f;
goal.z += cM_scos(angle) * 100.0f;
dComIfGp_evmng_setGoal(&goal);
g_dComIfG_gameInfo.play.getEvent().setPt2(shutter);
g_dComIfG_gameInfo.play.getEvent()->setPt2(shutter);
}
return shutter;