From d0e7487de477334522c560b32570141bf116aea9 Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Mon, 29 Apr 2024 15:30:37 +0200 Subject: [PATCH 01/56] Started working on d_a_auction --- src/d/actor/d_a_auction.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index 048b0a7be..963d79fa8 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -252,28 +252,28 @@ void daAuction_c::getRand(int) { } /* 00003C08-00003C28 .text daAuctionCreate__FPv */ -static s32 daAuctionCreate(void*) { - /* Nonmatching */ +static s32 daAuctionCreate(void* i_this) { + return static_cast(i_this)->_create(); } /* 00003C28-00003C48 .text daAuctionDelete__FPv */ -static BOOL daAuctionDelete(void*) { - /* Nonmatching */ +static BOOL daAuctionDelete(void* i_this) { + return static_cast(i_this)->_delete(); } /* 00003C48-00003C68 .text daAuctionExecute__FPv */ -static BOOL daAuctionExecute(void*) { - /* Nonmatching */ +static BOOL daAuctionExecute(void* i_this) { + return static_cast(i_this)->_execute(); } /* 00003C68-00003C88 .text daAuctionDraw__FPv */ -static BOOL daAuctionDraw(void*) { - /* Nonmatching */ +static BOOL daAuctionDraw(void* i_this) { + return static_cast(i_this)->_draw(); } /* 00003C88-00003C90 .text daAuctionIsDelete__FPv */ static BOOL daAuctionIsDelete(void*) { - /* Nonmatching */ + return TRUE; } static actor_method_class daAuctionMethodTable = { From 6a9ce346f81bb109b3f8f1caf49f9411352f155f Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Mon, 13 May 2024 12:23:21 +0200 Subject: [PATCH 02/56] daAuction_c Updated member variables --- include/d/actor/d_a_auction.h | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/include/d/actor/d_a_auction.h b/include/d/actor/d_a_auction.h index 10a0d1572..37cf1113f 100644 --- a/include/d/actor/d_a_auction.h +++ b/include/d/actor/d_a_auction.h @@ -79,7 +79,28 @@ class daAuction_c : public fopAc_ac_c { void getRand(int); public: - /* 0x290 */ u8 m290[0x6C4 - 0x290]; + /* 0x290 */ u8 pad290[0x0B]; + /* 0x29B */ s8 unk29B; /* inferred */ + /* 0x29C */ s8 unk29C; /* inferred */ + /* 0x29D */ char pad29D[0x2F]; /* maybe part of unk29C[0x30]? */ + /* 0x2CC */ s32 unk2CC; /* inferred */ + /* 0x2D0 */ s32 unk2D0; /* inferred */ + /* 0x2D4 */ char pad2D4[0x58]; /* maybe part of unk2D0[0x17]? */ + /* 0x32C */ s32 unk32C; /* inferred */ + /* 0x330 */ char pad330[4]; + /* 0x334 */ dBgS_Acch unk334; /* inferred */ + /* 0x4F8 */ dBgS_AcchCir unk4F8; /* inferred */ + /* 0x550 */ void *unk550; /* inferred */ + /* 0x554 */ dCcD_GStts unk554; /* inferred */ + /* 0x554 */ char pad554[0x20]; + /* 0x574 */ dCcD_GObjInf unk574; /* inferred */ + /* 0x574 */ char pad574[0x130]; + /* 0x6A4 */ u32 unk6A4; /* inferred */ + /* 0x6A8 */ char pad6A8[4]; + /* 0x6AC */ s32 unk6AC; /* inferred */ + /* 0x6B0 */ void *unk6B0; /* inferred */ + /* 0x6B4 */ char pad6B4[0xC]; /* maybe part of unk6B0[4]? */ + /* 0x6C0 */ void *unk6C0; /* inferred */ /* 0x6C4 */ request_of_phase_process_class mPhs; /* 0x6CC */ dNpc_EventCut_c mNpcEvtInfo; /* 0x730 */ u8 m730[0x788 - 0x730]; From 87700b84d13321bc47d901728754e383811e42c6 Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Wed, 15 May 2024 17:26:03 +0200 Subject: [PATCH 03/56] daAuction_c Refactored class --- include/d/actor/d_a_auction.h | 54 ++++++++++++++++------------------- src/d/actor/d_a_auction.cpp | 2 +- 2 files changed, 25 insertions(+), 31 deletions(-) diff --git a/include/d/actor/d_a_auction.h b/include/d/actor/d_a_auction.h index 37cf1113f..489d5aeec 100644 --- a/include/d/actor/d_a_auction.h +++ b/include/d/actor/d_a_auction.h @@ -3,9 +3,10 @@ #include "f_op/f_op_actor.h" #include "SSystem/SComponent/c_phase.h" +#include "d/d_com_inf_game.h" #include "d/d_npc.h" -class daAuction_c : public fopAc_ac_c { +class daAuction_c : public fopNpc_npc_c { public: daAuction_c(); @@ -66,7 +67,7 @@ class daAuction_c : public fopAc_ac_c { void eventEnd(); void eventCameraTestInit(); void eventCameraTest(); - void next_msgStatus(unsigned long*); + u16 next_msgStatus(u32* pMsgNo); void setMessage(unsigned long); void setMessage2(unsigned long); void setMtx(); @@ -79,35 +80,20 @@ class daAuction_c : public fopAc_ac_c { void getRand(int); public: - /* 0x290 */ u8 pad290[0x0B]; - /* 0x29B */ s8 unk29B; /* inferred */ - /* 0x29C */ s8 unk29C; /* inferred */ - /* 0x29D */ char pad29D[0x2F]; /* maybe part of unk29C[0x30]? */ - /* 0x2CC */ s32 unk2CC; /* inferred */ - /* 0x2D0 */ s32 unk2D0; /* inferred */ - /* 0x2D4 */ char pad2D4[0x58]; /* maybe part of unk2D0[0x17]? */ - /* 0x32C */ s32 unk32C; /* inferred */ - /* 0x330 */ char pad330[4]; - /* 0x334 */ dBgS_Acch unk334; /* inferred */ - /* 0x4F8 */ dBgS_AcchCir unk4F8; /* inferred */ - /* 0x550 */ void *unk550; /* inferred */ - /* 0x554 */ dCcD_GStts unk554; /* inferred */ - /* 0x554 */ char pad554[0x20]; - /* 0x574 */ dCcD_GObjInf unk574; /* inferred */ - /* 0x574 */ char pad574[0x130]; - /* 0x6A4 */ u32 unk6A4; /* inferred */ - /* 0x6A8 */ char pad6A8[4]; - /* 0x6AC */ s32 unk6AC; /* inferred */ - /* 0x6B0 */ void *unk6B0; /* inferred */ - /* 0x6B4 */ char pad6B4[0xC]; /* maybe part of unk6B0[4]? */ - /* 0x6C0 */ void *unk6C0; /* inferred */ /* 0x6C4 */ request_of_phase_process_class mPhs; /* 0x6CC */ dNpc_EventCut_c mNpcEvtInfo; - /* 0x730 */ u8 m730[0x788 - 0x730]; + /* 0x730 */ u8 m730[0x764 - 0x730]; + /* 0x764 */ dTimer_c* mpTimer; + /* 0x768 */ LIGHT_INFLUENCE mLight; /* 0x788 */ J3DModel* mpModel; - /* 0x78C */ u8 m78C[0x7A4 - 0x78C]; + /* 0x78C */ cXyz m78C; + /* 0x798 */ cXyz m798; /* 0x7A4 */ int m7A4; - /* 0x7A8 */ u8 m7A8[0x7EC - 0x7A8]; + /* 0x7A8 */ u8 m7A8[0x7BC - 0x7A8]; + /* 0x7BC */ f32 m7BC; + /* 0x7C0 */ f32 mBlend; + /* 0x7C4 */ f32 m7C4; + /* 0x7C8 */ u8 m7C8[0x7EC - 0x7C8]; /* 0x7EC */ int m7EC; /* 0x7F0 */ int m7F0; /* 0x7F4 */ u16 mEvtStartIdx; @@ -116,7 +102,11 @@ class daAuction_c : public fopAc_ac_c { /* 0x7FA */ u16 mEvtStart2Idx; /* 0x7FC */ u16 mEvtEnd2Idx; /* 0x7FE */ u16 mCurrItemNameMsgNo; - /* 0x800 */ u8 m800[0x81C - 0x800]; + /* 0x800 */ u8 m800[0x802 - 0x800]; + /* 0x802 */ s16 mTimer; + /* 0x804 */ u8 m804[0x808 - 0x804]; + /* 0x808 */ u16 m808; + /* 0x80A */ u8 m80A[0x81C - 0x80A]; /* 0x81C */ u8 m81C; /* 0x81D */ u8 m81D; /* 0x81E */ u8 m81E; @@ -128,7 +118,10 @@ class daAuction_c : public fopAc_ac_c { /* 0x824 */ u8 m824; /* 0x825 */ u8 m825[0x826 - 0x825]; /* 0x826 */ u8 m826; - /* 0x827 */ u8 m827[0x82D - 0x827]; + /* 0x827 */ u8 m827[0x82A - 0x827]; + /* 0x82A */ u8 m82A; + /* 0x82B */ u8 m82B[0x82C - 0x82B]; + /* 0x82C */ u8 m82C; /* 0x82D */ u8 mCurLinkAnm; /* 0x82E */ u8 m82E[0x832 - 0x82E]; /* 0x832 */ u8 m832; @@ -136,7 +129,8 @@ class daAuction_c : public fopAc_ac_c { /* 0x836 */ u8 m836; /* 0x837 */ u8 m837[0x838 - 0x837]; /* 0x838 */ u8 m838; - /* 0x839 */ u8 m839[0x83C - 0x839]; + /* 0x839 */ u8 mAction; + /* 0x83A */ u8 field_83A[0x83C - 0x83A]; }; #endif /* D_A_AUCTION_H */ diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index 963d79fa8..f19b70135 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -197,7 +197,7 @@ void daAuction_c::eventCameraTest() { } /* 00002F6C-0000369C .text next_msgStatus__11daAuction_cFPUl */ -void daAuction_c::next_msgStatus(unsigned long*) { +u16 daAuction_c::next_msgStatus(u32* pMsgNo) { /* Nonmatching */ } From 1436ff986414151ed24be6514fca3554a52a92fc Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Wed, 15 May 2024 17:49:29 +0200 Subject: [PATCH 04/56] daAuction_c::getRand matching --- include/d/actor/d_a_auction.h | 2 +- src/d/actor/d_a_auction.cpp | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/include/d/actor/d_a_auction.h b/include/d/actor/d_a_auction.h index 489d5aeec..810cdb29e 100644 --- a/include/d/actor/d_a_auction.h +++ b/include/d/actor/d_a_auction.h @@ -77,7 +77,7 @@ class daAuction_c : public fopNpc_npc_c { void setLinkAnm(unsigned char); void getPiconDispOfs(unsigned char); void nextBet(); - void getRand(int); + int getRand(int); public: /* 0x6C4 */ request_of_phase_process_class mPhs; diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index f19b70135..1a60a83b0 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -247,8 +247,14 @@ void daAuction_c::nextBet() { } /* 00003BA4-00003C08 .text getRand__11daAuction_cFi */ -void daAuction_c::getRand(int) { - /* Nonmatching */ +int daAuction_c::getRand(int max) { + int rnd = (int)cM_rndF(max); + + if (rnd == max) { + rnd = 0; + } + + return rnd; } /* 00003C08-00003C28 .text daAuctionCreate__FPv */ From 99ebbf186116f8ebf65392d0b17395efe263ceba Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Wed, 15 May 2024 21:03:16 +0200 Subject: [PATCH 05/56] daAuction_c constructor matching --- include/d/actor/d_a_auction.h | 10 +++++++--- src/d/actor/d_a_auction.cpp | 30 +++++++++++++++++++++++++++++- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/include/d/actor/d_a_auction.h b/include/d/actor/d_a_auction.h index 810cdb29e..8950bb766 100644 --- a/include/d/actor/d_a_auction.h +++ b/include/d/actor/d_a_auction.h @@ -82,7 +82,9 @@ class daAuction_c : public fopNpc_npc_c { public: /* 0x6C4 */ request_of_phase_process_class mPhs; /* 0x6CC */ dNpc_EventCut_c mNpcEvtInfo; - /* 0x730 */ u8 m730[0x764 - 0x730]; + //* 0x730 */ u8 m730[0x738 - 0x730]; + /* 0x738 */ int m738[8]; + /* 0x758 */ u8 m758[0x764 - 0x758]; /* 0x764 */ dTimer_c* mpTimer; /* 0x768 */ LIGHT_INFLUENCE mLight; /* 0x788 */ J3DModel* mpModel; @@ -106,7 +108,9 @@ class daAuction_c : public fopNpc_npc_c { /* 0x802 */ s16 mTimer; /* 0x804 */ u8 m804[0x808 - 0x804]; /* 0x808 */ u16 m808; - /* 0x80A */ u8 m80A[0x81C - 0x80A]; + /* 0x80A */ u8 m80A[0x80C - 0x80A]; + /* 0x80C */ u8 m80C[8]; + /* 0x814 */ u8 m814[8]; /* 0x81C */ u8 m81C; /* 0x81D */ u8 m81D; /* 0x81E */ u8 m81E; @@ -124,7 +128,7 @@ class daAuction_c : public fopNpc_npc_c { /* 0x82C */ u8 m82C; /* 0x82D */ u8 mCurLinkAnm; /* 0x82E */ u8 m82E[0x832 - 0x82E]; - /* 0x832 */ u8 m832; + /* 0x832 */ u8 m832; /* Might be mode index */ /* 0x833 */ u8 m833[0x836 - 0x833]; /* 0x836 */ u8 m836; /* 0x837 */ u8 m837[0x838 - 0x837]; diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index 1a60a83b0..40f196069 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -8,7 +8,35 @@ /* 000000EC-000002FC .text __ct__11daAuction_cFv */ daAuction_c::daAuction_c() { - /* Nonmatching */ + // TODO: Refactor this + for (int i = 0; i < 8; i++) { + m738[i] = -1; + m80C[i] = i; + m814[i] = 0xFF; + } + + // Shuffles lists randomly (I think) + for (int i = 0; i < 100; i++) { + int rnd1 = getRand(6); + int rnd2 = getRand(6); + + u8 tmp = m80C[rnd1 + 1]; + m80C[rnd1 + 1] = m80C[rnd2 + 1]; + m80C[rnd2 + 1] = tmp; + } + + m81E = 0; + m820 = 1; + m821 = 0; + m7EC = 0; + m7F0 = 0; + m81C = 0xFF; + m81D = 0xFF; + m7A4 = 0; + m836 = 0; + + eyePos = current.pos; + m832 = 0; } /* 00000644-00000664 .text CheckCreateHeap__FP10fopAc_ac_c */ From 3c1b745894d901f62a14f3c0086123cb9c051816 Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Wed, 15 May 2024 21:05:46 +0200 Subject: [PATCH 06/56] d_a_auction CheckCreateHeap matching --- include/d/actor/d_a_auction.h | 2 +- src/d/actor/d_a_auction.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/d/actor/d_a_auction.h b/include/d/actor/d_a_auction.h index 8950bb766..47421a998 100644 --- a/include/d/actor/d_a_auction.h +++ b/include/d/actor/d_a_auction.h @@ -32,7 +32,7 @@ class daAuction_c : public fopNpc_npc_c { void setStart(unsigned char) {} s32 _create(); - void createHeap(); + BOOL createHeap(); void createInit(); BOOL _delete(); BOOL _draw(); diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index 40f196069..05dac8fd5 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -40,8 +40,8 @@ daAuction_c::daAuction_c() { } /* 00000644-00000664 .text CheckCreateHeap__FP10fopAc_ac_c */ -static BOOL CheckCreateHeap(fopAc_ac_c*) { - /* Nonmatching */ +static BOOL CheckCreateHeap(fopAc_ac_c* i_this) { + return static_cast(i_this)->createHeap(); } /* 00000664-000006F4 .text _create__11daAuction_cFv */ @@ -50,7 +50,7 @@ s32 daAuction_c::_create() { } /* 000006F4-00000770 .text createHeap__11daAuction_cFv */ -void daAuction_c::createHeap() { +BOOL daAuction_c::createHeap() { /* Nonmatching */ } From c7077debb537517c8491fade9839bc7304799bdc Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Wed, 15 May 2024 23:19:01 +0200 Subject: [PATCH 07/56] daAuction_c::_create matching --- include/d/actor/d_a_auction.h | 2 +- src/d/actor/d_a_auction.cpp | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/include/d/actor/d_a_auction.h b/include/d/actor/d_a_auction.h index 47421a998..d3eabba91 100644 --- a/include/d/actor/d_a_auction.h +++ b/include/d/actor/d_a_auction.h @@ -33,7 +33,7 @@ class daAuction_c : public fopNpc_npc_c { s32 _create(); BOOL createHeap(); - void createInit(); + s32 createInit(); BOOL _delete(); BOOL _draw(); BOOL _execute(); diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index 05dac8fd5..5beb23b48 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -46,7 +46,19 @@ static BOOL CheckCreateHeap(fopAc_ac_c* i_this) { /* 00000664-000006F4 .text _create__11daAuction_cFv */ s32 daAuction_c::_create() { - /* Nonmatching */ + fopAcM_SetupActor(this, daAuction_c); + + s32 phase_state = dComIfG_resLoad(&mPhs, "Pspl"); + + if (phase_state == cPhs_COMPLEATE_e) { + if (!fopAcM_entrySolidHeap(this, CheckCreateHeap, 0x2400)) { + return cPhs_ERROR_e; + } + + return createInit(); + } + + return phase_state; } /* 000006F4-00000770 .text createHeap__11daAuction_cFv */ @@ -55,7 +67,7 @@ BOOL daAuction_c::createHeap() { } /* 00000770-000008C4 .text createInit__11daAuction_cFv */ -void daAuction_c::createInit() { +s32 daAuction_c::createInit() { /* Nonmatching */ } From ffd4566b01f619469f5b0e9974a2ce4d53283462 Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Thu, 16 May 2024 13:41:33 +0200 Subject: [PATCH 08/56] d_a_auction l_item_dat matching --- include/d/actor/d_a_auction.h | 7 +++++++ src/d/actor/d_a_auction.cpp | 22 ++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/include/d/actor/d_a_auction.h b/include/d/actor/d_a_auction.h index d3eabba91..1933fd989 100644 --- a/include/d/actor/d_a_auction.h +++ b/include/d/actor/d_a_auction.h @@ -8,6 +8,13 @@ class daAuction_c : public fopNpc_npc_c { public: + struct ItemData { + /* 0x00 */ u16 mItemID; + /* 0x02 */ u16 mNameMsgID; + /* 0x04 */ u16 mStartingBid; + /* 0x06 */ u16 mObtainedEventBit; + }; // Size: 0x08 + daAuction_c(); void chkNpcExec(int) {} diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index 5beb23b48..65eb2f7dd 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -6,6 +6,28 @@ #include "d/actor/d_a_auction.h" #include "d/d_procname.h" +// Needed for the .data section 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.0f, 0.5f}; + +static daAuction_c::ItemData l_item_dat[] = { + {dItem_JOY_PENDANT_e, 0x1D10, 40, 0x0F01}, + {COLLECT_MAP_27, 0x1D11, 5, 0x1080}, + {COLLECT_MAP_18, 0x1D12, 60, 0x1040}, + {KAKERA_HEART, 0x1D13, 80, 0x1020}, +}; + +// Items obtained through the auction at some point during dev? +static daAuction_c::ItemData l_item_dat2[] = { + {POSTMAN_STATUE, 0x1D14, 30, 0x1008}, + {PRESIDENT_STATUE, 0x1D15, 40, 0x1004}, +}; + +// TODO: Figure out what these are +static char l_item_dat22[] = {0x00, 0x2A, 0x00, 0xF9}; + /* 000000EC-000002FC .text __ct__11daAuction_cFv */ daAuction_c::daAuction_c() { // TODO: Refactor this From e35946aa785897d0fd993d50d91f9edea12b95db Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Thu, 16 May 2024 15:33:11 +0200 Subject: [PATCH 09/56] daAuction_c::createHeap matching --- src/d/actor/d_a_auction.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index 65eb2f7dd..b1c771ca1 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -5,6 +5,7 @@ #include "d/actor/d_a_auction.h" #include "d/d_procname.h" +#include "d/res/res_auction.h" // Needed for the .data section to match. static f32 dummy1[3] = {1.0f, 1.0f, 1.0f}; @@ -85,7 +86,19 @@ s32 daAuction_c::_create() { /* 000006F4-00000770 .text createHeap__11daAuction_cFv */ BOOL daAuction_c::createHeap() { - /* Nonmatching */ + J3DModelData* modelData = static_cast(dComIfG_getObjectIDRes("Pspl", 0)); + + if (modelData == NULL) { + return FALSE; + } + + mpModel = mDoExt_J3DModel__create(modelData, 0, 0x11020203); + + if (mpModel == NULL) { + return FALSE; + } + + return TRUE; } /* 00000770-000008C4 .text createInit__11daAuction_cFv */ From fb8108ce6086ace62c28293b093cea32d609ed52 Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Thu, 16 May 2024 16:19:08 +0200 Subject: [PATCH 10/56] d_a_auction Added HIO classes --- include/d/actor/d_a_auction.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/include/d/actor/d_a_auction.h b/include/d/actor/d_a_auction.h index 1933fd989..fb58c194c 100644 --- a/include/d/actor/d_a_auction.h +++ b/include/d/actor/d_a_auction.h @@ -5,6 +5,7 @@ #include "SSystem/SComponent/c_phase.h" #include "d/d_com_inf_game.h" #include "d/d_npc.h" +#include "m_Do/m_Do_hostIO.h" class daAuction_c : public fopNpc_npc_c { public: @@ -144,4 +145,22 @@ class daAuction_c : public fopNpc_npc_c { /* 0x83A */ u8 field_83A[0x83C - 0x83A]; }; +/* Inferred from debug map */ +class daAuction_HIO_c : public JORReflexible { +public: + daAuction_HIO_c() {} + +public: + /* Place member variables here */ +}; + +/* Inferred from debug map */ +class daAuction_Npc_HIO_c { +public: + daAuction_Npc_HIO_c() {} + +public: + /* Place member variables here */ +}; + #endif /* D_A_AUCTION_H */ From 4dd0d30bf21af4a49d2b16d0a80abb731211fcbc Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Fri, 17 May 2024 16:56:50 +0200 Subject: [PATCH 11/56] daAuction_c::createInit WIP --- include/d/d_com_inf_game.h | 15 +++++++++-- src/d/actor/d_a_auction.cpp | 50 +++++++++++++++++++++++++++++++++++-- 2 files changed, 61 insertions(+), 4 deletions(-) diff --git a/include/d/d_com_inf_game.h b/include/d/d_com_inf_game.h index 7c001360d..5240d2d95 100644 --- a/include/d/d_com_inf_game.h +++ b/include/d/d_com_inf_game.h @@ -352,6 +352,9 @@ class dComIfG_play_c { s16 getItemArrowNumCount() { return mItemArrowNumCount; } void setItemArrowNumCount(s16 num) { mItemArrowNumCount += num; } + void setNpcNameMessageID(u32 id) { mNpcNameMessageID = id; } + void setItemNameMessageID(u32 id) { mItemNameMessageID = id; } + void setItemKeyNumCount(s16 num) { mItemKeyNumCount += num; } void setItemBeastNumCount(int i_idx, s16 num) { mItemBeastNumCounts[i_idx] += num; } @@ -574,8 +577,8 @@ class dComIfG_play_c { /* 0x48C0 */ int mItemRupeeCount; /* 0x48C4 */ int mAirMeter; /* 0x48C8 */ int field_0x48c8; - /* 0x48CC */ int mNpcNameMessageID; - /* 0x48D0 */ int mItemNameMessageID; + /* 0x48CC */ u32 mNpcNameMessageID; + /* 0x48D0 */ u32 mItemNameMessageID; /* 0x48D4 */ s16 mItemKeyNumCount; /* 0x48D6 */ s16 mItemMaxLifeCount; /* 0x48D8 */ s16 mItemMagicCount; @@ -2167,6 +2170,14 @@ inline void dComIfGp_setItemMaxLifeCount(s16 num) { g_dComIfG_gameInfo.play.setItemMaxLifeCount(num); } +inline void dComIfGp_setNpcNameMessageID(u32 id) { + g_dComIfG_gameInfo.play.setNpcNameMessageID(id); +} + +inline void dComIfGp_setItemNameMessageID(u32 id) { + g_dComIfG_gameInfo.play.setItemNameMessageID(id); +} + inline void dComIfGp_setItemKeyNumCount(s16 num) { g_dComIfG_gameInfo.play.setItemKeyNumCount(num); } diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index b1c771ca1..b53359279 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -7,6 +7,23 @@ #include "d/d_procname.h" #include "d/res/res_auction.h" +/* Structs are almost definitely not accurate */ +struct NpcDatStruct { + /* 0x00 */ s32 field_0x00; + /* 0x04 */ s32 field_0x04; + /* 0x08 */ s16 field_0x08; + /* 0x0A */ s16 field_0x0A; + /* 0x0C */ s16 field_0x0C; +}; + +struct NpcMsgDatStruct { + /* 0x00 */ s16 field_0x00; + /* 0x02 */ s16 field_0x02; + /* 0x04 */ s16 field_0x04; + /* 0x06 */ s16 field_0x06; + /* 0x08 */ s16 field_0x08; +}; + // Needed for the .data section to match. static f32 dummy1[3] = {1.0f, 1.0f, 1.0f}; static f32 dummy2[3] = {1.0f, 1.0f, 1.0f}; @@ -25,9 +42,18 @@ static daAuction_c::ItemData l_item_dat2[] = { {POSTMAN_STATUE, 0x1D14, 30, 0x1008}, {PRESIDENT_STATUE, 0x1D15, 40, 0x1004}, }; +static char l_item_dat22[] = {0x00, 0x2A, 0x00, 0xF9}; + +static NpcDatStruct l_npc_dat[7] = { + NULL, +}; + +static NpcMsgDatStruct l_npc_msg_dat[12] = { + NULL, +}; // TODO: Figure out what these are -static char l_item_dat22[] = {0x00, 0x2A, 0x00, 0xF9}; +static daAuction_HIO_c l_HIO; /* 000000EC-000002FC .text __ct__11daAuction_cFv */ daAuction_c::daAuction_c() { @@ -103,7 +129,27 @@ BOOL daAuction_c::createHeap() { /* 00000770-000008C4 .text createInit__11daAuction_cFv */ s32 daAuction_c::createInit() { - /* Nonmatching */ + + mEvtStartIdx = dComIfGp_evmng_getEventIdx("AUCTION_START"); + mEvtGetItemIdx = dComIfGp_evmng_getEventIdx("AUCTION_GET_ITEM"); + mEvtNoItemIdx = dComIfGp_evmng_getEventIdx("AUCTION_NO_ITEM"); + mEvtStart2Idx = dComIfGp_evmng_getEventIdx("AUCTION_START2"); + mEvtEnd2Idx = dComIfGp_evmng_getEventIdx("AUCTION_END2"); + + mNpcEvtInfo.setActorInfo("Auction", this); + m824 = 0; + m826 = 0xFF; + dComIfGp_setNpcNameMessageID(l_npc_msg_dat[m814[m824]].field_0x00); + + mCurrAuctionItemIndex = 0; + + dComIfGp_setItemNameMessageID(l_item_dat[mCurrAuctionItemIndex].mItemID); + mCurrItemNameMsgNo = l_item_dat[mCurrAuctionItemIndex].mNameMsgID; + + dComIfGp_setMessageCountNumber(mCurrItemNameMsgNo); + setMtx(); + + return cPhs_COMPLEATE_e; } /* 000008C4-0000092C .text _delete__11daAuction_cFv */ From f8d49e29425a014c44b28a5fd36ac64337da63a1 Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Fri, 17 May 2024 18:24:08 +0200 Subject: [PATCH 12/56] daAuction_c::_delete matching --- include/d/actor/d_a_auction.h | 2 +- src/d/actor/d_a_auction.cpp | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/include/d/actor/d_a_auction.h b/include/d/actor/d_a_auction.h index fb58c194c..bdc8bbbca 100644 --- a/include/d/actor/d_a_auction.h +++ b/include/d/actor/d_a_auction.h @@ -98,7 +98,7 @@ class daAuction_c : public fopNpc_npc_c { /* 0x788 */ J3DModel* mpModel; /* 0x78C */ cXyz m78C; /* 0x798 */ cXyz m798; - /* 0x7A4 */ int m7A4; + /* 0x7A4 */ JPABaseEmitter* mpEmitter; /* 0x7A8 */ u8 m7A8[0x7BC - 0x7A8]; /* 0x7BC */ f32 m7BC; /* 0x7C0 */ f32 mBlend; diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index b53359279..e88dea3fa 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -81,7 +81,7 @@ daAuction_c::daAuction_c() { m7F0 = 0; m81C = 0xFF; m81D = 0xFF; - m7A4 = 0; + mpEmitter = NULL; m836 = 0; eyePos = current.pos; @@ -154,7 +154,13 @@ s32 daAuction_c::createInit() { /* 000008C4-0000092C .text _delete__11daAuction_cFv */ BOOL daAuction_c::_delete() { - /* Nonmatching */ + dComIfG_resDelete(&mPhs, "Pspl"); + + if (heap != NULL && mpEmitter != NULL) { + mpEmitter->becomeInvalidEmitter(); + } + + return TRUE; } /* 0000092C-00000998 .text _draw__11daAuction_cFv */ From 035eb513490d7cde82188313e10aa559920cb0d9 Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Fri, 17 May 2024 20:39:36 +0200 Subject: [PATCH 13/56] daAuction_c::_draw matching --- include/d/actor/d_a_auction.h | 2 +- src/d/actor/d_a_auction.cpp | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/include/d/actor/d_a_auction.h b/include/d/actor/d_a_auction.h index bdc8bbbca..7e46c8686 100644 --- a/include/d/actor/d_a_auction.h +++ b/include/d/actor/d_a_auction.h @@ -139,7 +139,7 @@ class daAuction_c : public fopNpc_npc_c { /* 0x832 */ u8 m832; /* Might be mode index */ /* 0x833 */ u8 m833[0x836 - 0x833]; /* 0x836 */ u8 m836; - /* 0x837 */ u8 m837[0x838 - 0x837]; + /* 0x837 */ u8 mFlags; /* Just a guess */ /* 0x838 */ u8 m838; /* 0x839 */ u8 mAction; /* 0x83A */ u8 field_83A[0x83C - 0x83A]; diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index e88dea3fa..3a6ad4cdb 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -165,7 +165,14 @@ BOOL daAuction_c::_delete() { /* 0000092C-00000998 .text _draw__11daAuction_cFv */ BOOL daAuction_c::_draw() { - /* Nonmatching */ + g_env_light.settingTevStruct(TEV_TYPE_BG2, ¤t.pos, &tevStr); + g_env_light.setLightTevColorType(mpModel, &tevStr); + + if (mFlags & 4) { + mDoExt_modelUpdateDL(mpModel); + } + + return TRUE; } /* 00000998-00000B10 .text _execute__11daAuction_cFv */ From 2d5324c9d17668c52a74314dfceef0c20929cc1c Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Fri, 17 May 2024 21:27:52 +0200 Subject: [PATCH 14/56] daAuction_c::_execute matching --- include/d/actor/d_a_auction.h | 8 +++--- src/d/actor/d_a_auction.cpp | 46 +++++++++++++++++++++++++++++++++-- 2 files changed, 49 insertions(+), 5 deletions(-) diff --git a/include/d/actor/d_a_auction.h b/include/d/actor/d_a_auction.h index 7e46c8686..b349f4d5d 100644 --- a/include/d/actor/d_a_auction.h +++ b/include/d/actor/d_a_auction.h @@ -9,6 +9,8 @@ class daAuction_c : public fopNpc_npc_c { public: + typedef void(daAuction_c::*MoveFunc_t)(); + struct ItemData { /* 0x00 */ u16 mItemID; /* 0x02 */ u16 mNameMsgID; @@ -100,7 +102,7 @@ class daAuction_c : public fopNpc_npc_c { /* 0x798 */ cXyz m798; /* 0x7A4 */ JPABaseEmitter* mpEmitter; /* 0x7A8 */ u8 m7A8[0x7BC - 0x7A8]; - /* 0x7BC */ f32 m7BC; + /* 0x7BC */ f32 mAlpha; /* 0x7C0 */ f32 mBlend; /* 0x7C4 */ f32 m7C4; /* 0x7C8 */ u8 m7C8[0x7EC - 0x7C8]; @@ -116,12 +118,12 @@ class daAuction_c : public fopNpc_npc_c { /* 0x802 */ s16 mTimer; /* 0x804 */ u8 m804[0x808 - 0x804]; /* 0x808 */ u16 m808; - /* 0x80A */ u8 m80A[0x80C - 0x80A]; + /* 0x80A */ s16 m80A; /* 0x80C */ u8 m80C[8]; /* 0x814 */ u8 m814[8]; /* 0x81C */ u8 m81C; /* 0x81D */ u8 m81D; - /* 0x81E */ u8 m81E; + /* 0x81E */ u8 mMoveIdx; /* 0x81F */ u8 m81F[0x820 - 0x81F]; /* 0x820 */ u8 m820; /* 0x821 */ u8 m821; diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index 3a6ad4cdb..dd23888be 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -55,6 +55,11 @@ static NpcMsgDatStruct l_npc_msg_dat[12] = { // TODO: Figure out what these are static daAuction_HIO_c l_HIO; +/* TODO: Add the rest of the functions */ +static daAuction_c::MoveFunc_t moveProc[] = { + daAuction_c::eventMainKai +}; + /* 000000EC-000002FC .text __ct__11daAuction_cFv */ daAuction_c::daAuction_c() { // TODO: Refactor this @@ -74,7 +79,7 @@ daAuction_c::daAuction_c() { m80C[rnd2 + 1] = tmp; } - m81E = 0; + mMoveIdx = 0; m820 = 1; m821 = 0; m7EC = 0; @@ -177,7 +182,44 @@ BOOL daAuction_c::_draw() { /* 00000998-00000B10 .text _execute__11daAuction_cFv */ BOOL daAuction_c::_execute() { - /* Nonmatching */ + checkOrder(); + + if (!dComIfGp_event_runCheck() || eventInfo.checkCommandTalk()) { + (this->*moveProc[mMoveIdx])(); + } else { + eventMove(); + } + + eventOrder(); + + if (mpEmitter != NULL) { + if (m836 & 1) { // Increase alpha + if (m80A != 0) { + m80A -= 1; + } else { + mAlpha += 4.0f; + + if (mAlpha > 255.0f) { + mAlpha = 255.0f; + m836 &= ~1; + } + + mpEmitter->setGlobalAlpha(mAlpha); + } + } else if (m836 & 2) { // Decrease alpha + mAlpha -= 4.0f; + + if (mAlpha < 0.0f) { + mpEmitter->becomeInvalidEmitter(); + mpEmitter = NULL; + } else { + mpEmitter->setGlobalAlpha(mAlpha); + } + } + } + + setMtx(); + return TRUE; } /* 00000B10-00000B44 .text executeWait__11daAuction_cFv */ From bda3c1dab19fef37b541ea50ebb6ed7812c5b61e Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Sat, 18 May 2024 12:08:50 +0200 Subject: [PATCH 15/56] d_a_auction Fixed procfunc arrays --- include/d/actor/d_a_auction.h | 4 ++-- src/d/actor/d_a_auction.cpp | 20 +++++++++++++++----- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/include/d/actor/d_a_auction.h b/include/d/actor/d_a_auction.h index b349f4d5d..a9aabf67e 100644 --- a/include/d/actor/d_a_auction.h +++ b/include/d/actor/d_a_auction.h @@ -9,7 +9,7 @@ class daAuction_c : public fopNpc_npc_c { public: - typedef void(daAuction_c::*MoveFunc_t)(); + typedef void(daAuction_c::*ProcFunc_t)(); struct ItemData { /* 0x00 */ u16 mItemID; @@ -123,7 +123,7 @@ class daAuction_c : public fopNpc_npc_c { /* 0x814 */ u8 m814[8]; /* 0x81C */ u8 m81C; /* 0x81D */ u8 m81D; - /* 0x81E */ u8 mMoveIdx; + /* 0x81E */ u8 mMoveState; /* 0x81F */ u8 m81F[0x820 - 0x81F]; /* 0x820 */ u8 m820; /* 0x821 */ u8 m821; diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index dd23888be..dc88e498f 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -55,9 +55,19 @@ static NpcMsgDatStruct l_npc_msg_dat[12] = { // TODO: Figure out what these are static daAuction_HIO_c l_HIO; -/* TODO: Add the rest of the functions */ -static daAuction_c::MoveFunc_t moveProc[] = { - daAuction_c::eventMainKai +static daAuction_c::ProcFunc_t moveProc[] = { + daAuction_c::executeWait, + daAuction_c::executeNormal, + daAuction_c::executeStart, +}; + +static daAuction_c::ProcFunc_t eventProc[] = { + daAuction_c::eventMainKai, + daAuction_c::eventMainUri, + daAuction_c::eventMainMsgSet, + daAuction_c::eventMainMsgEnd, + daAuction_c::eventMainMsgBikonC, + daAuction_c::eventMainMsgBikonW, }; /* 000000EC-000002FC .text __ct__11daAuction_cFv */ @@ -79,7 +89,7 @@ daAuction_c::daAuction_c() { m80C[rnd2 + 1] = tmp; } - mMoveIdx = 0; + mMoveState = 0; m820 = 1; m821 = 0; m7EC = 0; @@ -185,7 +195,7 @@ BOOL daAuction_c::_execute() { checkOrder(); if (!dComIfGp_event_runCheck() || eventInfo.checkCommandTalk()) { - (this->*moveProc[mMoveIdx])(); + (this->*moveProc[mMoveState])(); } else { eventMove(); } From 49843271ecbea8cd7adf339b27ee66a4a4632bca Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Sat, 18 May 2024 12:23:03 +0200 Subject: [PATCH 16/56] daAuction_c moveProc funcs matching --- include/d/actor/d_a_auction.h | 2 +- src/d/actor/d_a_auction.cpp | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/include/d/actor/d_a_auction.h b/include/d/actor/d_a_auction.h index a9aabf67e..cee4246a5 100644 --- a/include/d/actor/d_a_auction.h +++ b/include/d/actor/d_a_auction.h @@ -93,7 +93,7 @@ class daAuction_c : public fopNpc_npc_c { /* 0x6C4 */ request_of_phase_process_class mPhs; /* 0x6CC */ dNpc_EventCut_c mNpcEvtInfo; //* 0x730 */ u8 m730[0x738 - 0x730]; - /* 0x738 */ int m738[8]; + /* 0x738 */ u32 m738[8]; /* 0x758 */ u8 m758[0x764 - 0x758]; /* 0x764 */ dTimer_c* mpTimer; /* 0x768 */ LIGHT_INFLUENCE mLight; diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index dc88e498f..99fe7c509 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -234,18 +234,20 @@ BOOL daAuction_c::_execute() { /* 00000B10-00000B44 .text executeWait__11daAuction_cFv */ void daAuction_c::executeWait() { - /* Nonmatching */ + for (int i = 0; i < 8; i++) { + if (m738[i] == -1) { + return; + } + } + + mMoveState = 1; } /* 00000B44-00000B48 .text executeNormal__11daAuction_cFv */ -void daAuction_c::executeNormal() { - /* Nonmatching */ -} +void daAuction_c::executeNormal() {} /* 00000B48-00000B4C .text executeStart__11daAuction_cFv */ -void daAuction_c::executeStart() { - /* Nonmatching */ -} +void daAuction_c::executeStart() {} /* 00000B4C-00000C68 .text checkOrder__11daAuction_cFv */ void daAuction_c::checkOrder() { From bb643dd27fa8779344405739b412ad00c5608388 Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Sat, 18 May 2024 12:35:40 +0200 Subject: [PATCH 17/56] daAuction_c::checkOrder matching --- include/d/actor/d_a_auction.h | 12 ++++++------ src/d/actor/d_a_auction.cpp | 17 ++++++++++++++++- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/include/d/actor/d_a_auction.h b/include/d/actor/d_a_auction.h index cee4246a5..a178dcf26 100644 --- a/include/d/actor/d_a_auction.h +++ b/include/d/actor/d_a_auction.h @@ -108,11 +108,11 @@ class daAuction_c : public fopNpc_npc_c { /* 0x7C8 */ u8 m7C8[0x7EC - 0x7C8]; /* 0x7EC */ int m7EC; /* 0x7F0 */ int m7F0; - /* 0x7F4 */ u16 mEvtStartIdx; - /* 0x7F6 */ u16 mEvtGetItemIdx; - /* 0x7F8 */ u16 mEvtNoItemIdx; - /* 0x7FA */ u16 mEvtStart2Idx; - /* 0x7FC */ u16 mEvtEnd2Idx; + /* 0x7F4 */ s16 mEvtStartIdx; + /* 0x7F6 */ s16 mEvtGetItemIdx; + /* 0x7F8 */ s16 mEvtNoItemIdx; + /* 0x7FA */ s16 mEvtStart2Idx; + /* 0x7FC */ s16 mEvtEnd2Idx; /* 0x7FE */ u16 mCurrItemNameMsgNo; /* 0x800 */ u8 m800[0x802 - 0x800]; /* 0x802 */ s16 mTimer; @@ -142,7 +142,7 @@ class daAuction_c : public fopNpc_npc_c { /* 0x833 */ u8 m833[0x836 - 0x833]; /* 0x836 */ u8 m836; /* 0x837 */ u8 mFlags; /* Just a guess */ - /* 0x838 */ u8 m838; + /* 0x838 */ s8 m838; /* 0x839 */ u8 mAction; /* 0x83A */ u8 field_83A[0x83C - 0x83A]; }; diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index 99fe7c509..e24c9661f 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -251,7 +251,22 @@ void daAuction_c::executeStart() {} /* 00000B4C-00000C68 .text checkOrder__11daAuction_cFv */ void daAuction_c::checkOrder() { - /* Nonmatching */ + if (eventInfo.checkCommandDemoAccrpt()) { + // Might be unrolled loop? + if (dComIfGp_evmng_startCheck(mEvtStartIdx) && m838 == 3) { + m838 = 0; + } else if (dComIfGp_evmng_startCheck(mEvtGetItemIdx) && m838 == 4) { + m838 = 0; + } else if (dComIfGp_evmng_startCheck(mEvtNoItemIdx) && m838 == 5) { + m838 = 0; + } + + if (dComIfGp_evmng_startCheck(mEvtStart2Idx) && m838 == 6) { + m838 = 0; + } else if (dComIfGp_evmng_startCheck(mEvtEnd2Idx) && m838 == 7) { + m838 = 0; + } + } } /* 00000C68-00000EF8 .text eventOrder__11daAuction_cFv */ From 05cda63042934f08dce3e1f9b2af47237d24f098 Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Sat, 18 May 2024 15:43:15 +0200 Subject: [PATCH 18/56] daAuction_c::eventOrder WIP --- include/d/actor/d_a_auction.h | 8 +++--- include/d/d_com_inf_game.h | 9 +++++++ src/d/actor/d_a_auction.cpp | 48 +++++++++++++++++++++++++++++++++-- 3 files changed, 59 insertions(+), 6 deletions(-) diff --git a/include/d/actor/d_a_auction.h b/include/d/actor/d_a_auction.h index a178dcf26..f02cc3c5e 100644 --- a/include/d/actor/d_a_auction.h +++ b/include/d/actor/d_a_auction.h @@ -12,8 +12,8 @@ class daAuction_c : public fopNpc_npc_c { typedef void(daAuction_c::*ProcFunc_t)(); struct ItemData { - /* 0x00 */ u16 mItemID; - /* 0x02 */ u16 mNameMsgID; + /* 0x00 */ s16 mItemID; + /* 0x02 */ s16 mNameMsgID; /* 0x04 */ u16 mStartingBid; /* 0x06 */ u16 mObtainedEventBit; }; // Size: 0x08 @@ -81,7 +81,7 @@ class daAuction_c : public fopNpc_npc_c { void setMessage(unsigned long); void setMessage2(unsigned long); void setMtx(); - void getItemNo(); + u8 getItemNo(); void getNpcActorP(int); void setCameraNpc(int, short); void setLinkAnm(unsigned char); @@ -113,7 +113,7 @@ class daAuction_c : public fopNpc_npc_c { /* 0x7F8 */ s16 mEvtNoItemIdx; /* 0x7FA */ s16 mEvtStart2Idx; /* 0x7FC */ s16 mEvtEnd2Idx; - /* 0x7FE */ u16 mCurrItemNameMsgNo; + /* 0x7FE */ s16 mCurrItemNameMsgNo; /* 0x800 */ u8 m800[0x802 - 0x800]; /* 0x802 */ s16 mTimer; /* 0x804 */ u8 m804[0x808 - 0x804]; diff --git a/include/d/d_com_inf_game.h b/include/d/d_com_inf_game.h index 5240d2d95..f6f2bf3b1 100644 --- a/include/d/d_com_inf_game.h +++ b/include/d/d_com_inf_game.h @@ -482,6 +482,11 @@ class dComIfG_play_c { u8 getMiniGameType() { return mMiniGameType; } + void startMiniGame(u8 param_1) { + mMiniGameType = param_1; + field_0x4A38 |= 1 << (param_1 - 1); // Sets Nth bit + } + void endMiniGame(u16 param_1) { mMiniGameType = 0; field_0x4A38 ^= 1 << (param_1 - 1); // toggle Nth bit @@ -2323,6 +2328,10 @@ inline u8 dComIfGp_getMiniGameType() { return g_dComIfG_gameInfo.play.getMiniGameType(); } +inline void dComIfGp_startMiniGame(u8 param_1) { + g_dComIfG_gameInfo.play.startMiniGame(param_1); +} + inline void dComIfGp_endMiniGame(u16 param_1) { g_dComIfG_gameInfo.play.endMiniGame(param_1); } diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index e24c9661f..c0538a2d8 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -271,7 +271,51 @@ void daAuction_c::checkOrder() { /* 00000C68-00000EF8 .text eventOrder__11daAuction_cFv */ void daAuction_c::eventOrder() { - /* Nonmatching */ + if (m821 == 1) { + mMoveState = 2; + m838 = 3; + m822 = m821; + m821 = 0; + } else if (m821 == 2) { + mMoveState = 2; + m838 = 6; + m822 = m821; + m821 = 0; + } + + if (m838 == 1 || m838 == 2) { + eventInfo.onCondition(dEvtCnd_CANTALK_e); + if (m838 == 1) { + fopAcM_orderSpeakEvent(this); + } + } else if (m838 == 3) { + if (dComIfGs_isEventBit(0x4008)) { + mCurrAuctionItemIndex = dComIfGs_getEventReg(0xCD03); + mCurrItemNameMsgNo += 0xA; + } else { + mCurrAuctionItemIndex = getItemNo(); + } + + dComIfGp_setItemNameMessageID(l_item_dat[mCurrAuctionItemIndex].mItemID); + mCurrItemNameMsgNo = l_item_dat[mCurrAuctionItemIndex].mNameMsgID; + dComIfGp_setMessageCountNumber(mCurrItemNameMsgNo); + + fopAcM_orderChangeEventId(dComIfGp_getPlayer(0), mEvtStartIdx, 0, 0xFF7F); + dComIfGp_startMiniGame(5); + } else if (m838 == 4) { + fopAcM_orderOtherEventId(this, mEvtGetItemIdx, 0xFF, 0xFF7F); + } else if (m838 == 5) { + fopAcM_orderOtherEventId(this, mEvtNoItemIdx, 0xFF, 0xFF7F); + } else if (m838 == 6) { + mCurrAuctionItemIndex &= 1; + mCurrItemNameMsgNo = l_item_dat2[mCurrAuctionItemIndex].mNameMsgID; + dComIfGp_setItemNameMessageID(l_item_dat2[mCurrAuctionItemIndex].mItemID); + dComIfGp_setMessageCountNumber(mCurrItemNameMsgNo); + fopAcM_orderChangeEventId(dComIfGp_getPlayer(0), mEvtStart2Idx, 0, 0xFF7F); + dComIfGp_startMiniGame(5); + } else if (m838 == 7) { + fopAcM_orderOtherEventId(this, mEvtEnd2Idx, 0xFF, 0xFF7F); + } } /* 00000EF8-0000104C .text eventMove__11daAuction_cFv */ @@ -420,7 +464,7 @@ void daAuction_c::setMtx() { } /* 00003754-00003828 .text getItemNo__11daAuction_cFv */ -void daAuction_c::getItemNo() { +u8 daAuction_c::getItemNo() { /* Nonmatching */ } From 6171c5b3f4c65bc803b0ec3ab1670b8f6062e360 Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Sat, 18 May 2024 17:12:27 +0200 Subject: [PATCH 19/56] daAuction_c::eventMove matching --- src/d/actor/d_a_auction.cpp | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index c0538a2d8..870674063 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -70,6 +70,8 @@ static daAuction_c::ProcFunc_t eventProc[] = { daAuction_c::eventMainMsgBikonW, }; +extern void dAuction_screen_delete(); + /* 000000EC-000002FC .text __ct__11daAuction_cFv */ daAuction_c::daAuction_c() { // TODO: Refactor this @@ -320,7 +322,32 @@ void daAuction_c::eventOrder() { /* 00000EF8-0000104C .text eventMove__11daAuction_cFv */ void daAuction_c::eventMove() { - /* Nonmatching */ + if (dComIfGp_evmng_endCheck(mEvtStartIdx)) { + dComIfGp_event_reset(); + + if (m824 != 0) { + m838 = 5; + } else { + m838 = 4; + } + } else if (dComIfGp_evmng_endCheck(mEvtGetItemIdx) || dComIfGp_evmng_endCheck(mEvtNoItemIdx) || dComIfGp_evmng_endCheck(mEvtEnd2Idx)) { + dComIfGp_event_reset(); + dComIfGp_endMiniGame(5); + fopAcM_delete((fopAc_ac_c*)mpTimer); + dAuction_screen_delete(); + } else if (dComIfGp_evmng_endCheck(mEvtStart2Idx)) { + dComIfGp_event_reset(); + m838 = 7; + } else { + bool attn = mNpcEvtInfo.getAttnFlag(); + if (mNpcEvtInfo.cutProc()) { + if (!mNpcEvtInfo.getAttnFlag()) { + mNpcEvtInfo.setAttnFlag(attn); + } + } else { + privateCut(); + } + } } /* 0000104C-00001300 .text privateCut__11daAuction_cFv */ From 320d55a44374cc8f05d01752d28e29241d5c5faa Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Sun, 19 May 2024 17:37:42 +0200 Subject: [PATCH 20/56] daAuction_c::privateCut WIP --- include/d/actor/d_a_auction.h | 21 ++--- src/d/actor/d_a_auction.cpp | 161 ++++++++++++++++++++++++++++++---- 2 files changed, 154 insertions(+), 28 deletions(-) diff --git a/include/d/actor/d_a_auction.h b/include/d/actor/d_a_auction.h index f02cc3c5e..4a5dd1729 100644 --- a/include/d/actor/d_a_auction.h +++ b/include/d/actor/d_a_auction.h @@ -55,12 +55,12 @@ class daAuction_c : public fopNpc_npc_c { void eventMove(); void privateCut(); void eventTalkInit(int); - void eventMesSet(); - void eventMesEnd(); + u8 eventMesSet(); + u8 eventMesEnd(); void eventStartInit(); - void eventStart(); + u8 eventStart(); void eventMainInit(); - void eventMain(); + u8 eventMain(); void eventMainKai(); void eventMainUri(); void eventMainMsgSet(); @@ -68,15 +68,15 @@ class daAuction_c : public fopNpc_npc_c { void eventMainMsgBikonC(); void eventMainMsgBikonW(); void eventGetItemInit(); - void eventGetItem(); + u8 eventGetItem(); void eventCameraOffInit(); void eventGetItemNpcInit(int); void eventGetItemMesInit(); - void eventCameraOffNpc(); + u8 eventCameraOffNpc(); void eventEndInit(); - void eventEnd(); + u8 eventEnd(); void eventCameraTestInit(); - void eventCameraTest(); + u8 eventCameraTest(); u16 next_msgStatus(u32* pMsgNo); void setMessage(unsigned long); void setMessage2(unsigned long); @@ -139,11 +139,12 @@ class daAuction_c : public fopNpc_npc_c { /* 0x82D */ u8 mCurLinkAnm; /* 0x82E */ u8 m82E[0x832 - 0x82E]; /* 0x832 */ u8 m832; /* Might be mode index */ - /* 0x833 */ u8 m833[0x836 - 0x833]; + /* 0x833 */ u8 m833[0x835 - 0x833]; + /* 0x835 */ u8 m835; /* 0x836 */ u8 m836; /* 0x837 */ u8 mFlags; /* Just a guess */ /* 0x838 */ s8 m838; - /* 0x839 */ u8 mAction; + /* 0x839 */ s8 mAction; /* 0x83A */ u8 field_83A[0x83C - 0x83A]; }; diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index 870674063..0c6ee98cb 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -6,6 +6,7 @@ #include "d/actor/d_a_auction.h" #include "d/d_procname.h" #include "d/res/res_auction.h" +#include "d/d_camera.h" /* Structs are almost definitely not accurate */ struct NpcDatStruct { @@ -23,6 +24,14 @@ struct NpcMsgDatStruct { /* 0x06 */ s16 field_0x06; /* 0x08 */ s16 field_0x08; }; +static cXyz l_camera_pos[6] = { + cXyz(-265.0f, 48.0f, -631.0f), + cXyz(332.0f, 232.0f, 286.0f), + cXyz(-50.0f, 202.0f, 137.0f), + cXyz(-87.0f, 239.0f, 330.0f), + cXyz(-216.0f, 205.0f, 5.0f), + cXyz(-379.0f, 238.0f, 115.0f), +}; // Needed for the .data section to match. static f32 dummy1[3] = {1.0f, 1.0f, 1.0f}; @@ -30,6 +39,7 @@ static f32 dummy2[3] = {1.0f, 1.0f, 1.0f}; static u8 dummy3[4] = {0x02, 0x00, 0x02, 0x01}; static f64 dummy4[2] = {3.0f, 0.5f}; + static daAuction_c::ItemData l_item_dat[] = { {dItem_JOY_PENDANT_e, 0x1D10, 40, 0x0F01}, {COLLECT_MAP_27, 0x1D11, 5, 0x1080}, @@ -52,8 +62,10 @@ static NpcMsgDatStruct l_npc_msg_dat[12] = { NULL, }; +#ifdef DEBUG // TODO: Figure out what these are static daAuction_HIO_c l_HIO; +#endif static daAuction_c::ProcFunc_t moveProc[] = { daAuction_c::executeWait, @@ -61,15 +73,6 @@ static daAuction_c::ProcFunc_t moveProc[] = { daAuction_c::executeStart, }; -static daAuction_c::ProcFunc_t eventProc[] = { - daAuction_c::eventMainKai, - daAuction_c::eventMainUri, - daAuction_c::eventMainMsgSet, - daAuction_c::eventMainMsgEnd, - daAuction_c::eventMainMsgBikonC, - daAuction_c::eventMainMsgBikonW, -}; - extern void dAuction_screen_delete(); /* 000000EC-000002FC .text __ct__11daAuction_cFv */ @@ -352,7 +355,120 @@ void daAuction_c::eventMove() { /* 0000104C-00001300 .text privateCut__11daAuction_cFv */ void daAuction_c::privateCut() { - /* Nonmatching */ + static char* cut_name_tbl[] = { + "MES_SET", + "MES_END", + "START", + "MAIN", + "GET_ITEM", + "CAMERA_OFF", + "GET_ITEM_NPC", + "GET_ITEM_MES", + "CAMERA_OFF_NPC", + "END", + "CAMERA_TEST", + }; + + int staffIdx = dComIfGp_evmng_getMyStaffId("Auction"); + + if (staffIdx == -1) { + return; + } + + mAction = dComIfGp_evmng_getMyActIdx(staffIdx, cut_name_tbl, ARRAY_SIZE(cut_name_tbl), TRUE, 0); + + if (mAction == -1) { + dComIfGp_evmng_cutEnd(staffIdx); + return; + } + + if (dComIfGp_evmng_getIsAddvance(staffIdx)) { + switch (mAction) { + case 0: + eventTalkInit(staffIdx); + break; + case 2: + eventStartInit(); + break; + case 3: + eventMainInit(); + break; + case 4: + eventGetItemInit(); + break; + case 5: + eventCameraOffInit(); + break; + case 6: + eventGetItemNpcInit(staffIdx); + break; + case 7: + eventGetItemMesInit(); + break; + case 9: + eventEndInit(); + break; + case 10: + eventCameraTestInit(); + break; + } + } + + u8 evtRes; + switch (mAction) { + case 0: + evtRes = eventMesSet(); + break; + case 1: + evtRes = eventMesEnd(); + break; + case 2: + evtRes = eventStart(); + break; + case 3: + evtRes = eventMain(); + break; + case 4: + evtRes = eventGetItem(); + break; + case 7: + evtRes = 0; // TODO: __ptmf_test + break; + case 8: + evtRes = eventCameraOffNpc(); + break; + case 9: + evtRes = eventEnd(); + break; + case 10: + evtRes = eventCameraTest(); + break; + default: + evtRes = 1; + } + + if (evtRes) { + dComIfGp_evmng_cutEnd(staffIdx); + } + + dCamera_c* pCam = dCam_getBody(); + + // This could probably be simplified + if (m835 & 1) { + pCam->Stop(); + m835 &= ~1; + m835 |= 4; + } + + if (m835 & 2) { + pCam->Start(); + m835 &= ~0xE; + } + + if (m835 & 4 && m835 & 8) { + pCam->Set(m78C, m798); + } + } /* 00001300-000013C0 .text eventTalkInit__11daAuction_cFi */ @@ -361,12 +477,12 @@ void daAuction_c::eventTalkInit(int) { } /* 000013C0-00001400 .text eventMesSet__11daAuction_cFv */ -void daAuction_c::eventMesSet() { +u8 daAuction_c::eventMesSet() { /* Nonmatching */ } /* 00001400-00001434 .text eventMesEnd__11daAuction_cFv */ -void daAuction_c::eventMesEnd() { +u8 daAuction_c::eventMesEnd() { /* Nonmatching */ } @@ -376,7 +492,7 @@ void daAuction_c::eventStartInit() { } /* 00001634-000016AC .text eventStart__11daAuction_cFv */ -void daAuction_c::eventStart() { +u8 daAuction_c::eventStart() { /* Nonmatching */ } @@ -385,8 +501,17 @@ void daAuction_c::eventMainInit() { /* Nonmatching */ } +static daAuction_c::ProcFunc_t eventProc[] = { + daAuction_c::eventMainKai, + daAuction_c::eventMainUri, + daAuction_c::eventMainMsgSet, + daAuction_c::eventMainMsgEnd, + daAuction_c::eventMainMsgBikonC, + daAuction_c::eventMainMsgBikonW, +}; + /* 0000188C-00001A98 .text eventMain__11daAuction_cFv */ -void daAuction_c::eventMain() { +u8 daAuction_c::eventMain() { /* Nonmatching */ } @@ -426,7 +551,7 @@ void daAuction_c::eventGetItemInit() { } /* 00002D4C-00002D54 .text eventGetItem__11daAuction_cFv */ -void daAuction_c::eventGetItem() { +u8 daAuction_c::eventGetItem() { /* Nonmatching */ } @@ -446,7 +571,7 @@ void daAuction_c::eventGetItemMesInit() { } /* 00002E40-00002EA0 .text eventCameraOffNpc__11daAuction_cFv */ -void daAuction_c::eventCameraOffNpc() { +u8 daAuction_c::eventCameraOffNpc() { /* Nonmatching */ } @@ -456,7 +581,7 @@ void daAuction_c::eventEndInit() { } /* 00002EDC-00002F60 .text eventEnd__11daAuction_cFv */ -void daAuction_c::eventEnd() { +u8 daAuction_c::eventEnd() { /* Nonmatching */ } @@ -466,7 +591,7 @@ void daAuction_c::eventCameraTestInit() { } /* 00002F64-00002F6C .text eventCameraTest__11daAuction_cFv */ -void daAuction_c::eventCameraTest() { +u8 daAuction_c::eventCameraTest() { /* Nonmatching */ } From 93f07624bc91ead554df25817d34e9309bfa6cca Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Sun, 19 May 2024 19:01:36 +0200 Subject: [PATCH 21/56] daAuction_c::eventTalkInit matching --- src/d/actor/d_a_auction.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index 0c6ee98cb..bfb1fa1b0 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -472,8 +472,19 @@ void daAuction_c::privateCut() { } /* 00001300-000013C0 .text eventTalkInit__11daAuction_cFi */ -void daAuction_c::eventTalkInit(int) { - /* Nonmatching */ +void daAuction_c::eventTalkInit(int staffIdx) { + s32* pMsg = (s32*)dComIfGp_evmng_getMyIntegerP(staffIdx, "MsgNo"); + + if (pMsg != NULL) { + switch (*pMsg) { + case 0x1CF4: + mDoAud_seStart(JA_SE_AUC_ITEM_SHOW); + default: + setMessage(*pMsg); + } + } else { + setMessage(0); + } } /* 000013C0-00001400 .text eventMesSet__11daAuction_cFv */ From b0ef2f717d22e94c8138699904eebba890f3d6e6 Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Sun, 19 May 2024 19:14:34 +0200 Subject: [PATCH 22/56] daAuction_c::eventMesSet matching --- include/d/actor/d_a_auction.h | 16 ++++++++-------- src/d/actor/d_a_auction.cpp | 26 ++++++++++++++------------ 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/include/d/actor/d_a_auction.h b/include/d/actor/d_a_auction.h index 4a5dd1729..9d99d4d76 100644 --- a/include/d/actor/d_a_auction.h +++ b/include/d/actor/d_a_auction.h @@ -55,12 +55,12 @@ class daAuction_c : public fopNpc_npc_c { void eventMove(); void privateCut(); void eventTalkInit(int); - u8 eventMesSet(); - u8 eventMesEnd(); + bool eventMesSet(); + bool eventMesEnd(); void eventStartInit(); - u8 eventStart(); + bool eventStart(); void eventMainInit(); - u8 eventMain(); + bool eventMain(); void eventMainKai(); void eventMainUri(); void eventMainMsgSet(); @@ -68,15 +68,15 @@ class daAuction_c : public fopNpc_npc_c { void eventMainMsgBikonC(); void eventMainMsgBikonW(); void eventGetItemInit(); - u8 eventGetItem(); + bool eventGetItem(); void eventCameraOffInit(); void eventGetItemNpcInit(int); void eventGetItemMesInit(); - u8 eventCameraOffNpc(); + bool eventCameraOffNpc(); void eventEndInit(); - u8 eventEnd(); + bool eventEnd(); void eventCameraTestInit(); - u8 eventCameraTest(); + bool eventCameraTest(); u16 next_msgStatus(u32* pMsgNo); void setMessage(unsigned long); void setMessage2(unsigned long); diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index bfb1fa1b0..4383ed53a 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -414,7 +414,7 @@ void daAuction_c::privateCut() { } } - u8 evtRes; + bool evtRes; switch (mAction) { case 0: evtRes = eventMesSet(); @@ -432,7 +432,7 @@ void daAuction_c::privateCut() { evtRes = eventGetItem(); break; case 7: - evtRes = 0; // TODO: __ptmf_test + evtRes = false; // TODO: __ptmf_test break; case 8: evtRes = eventCameraOffNpc(); @@ -444,7 +444,7 @@ void daAuction_c::privateCut() { evtRes = eventCameraTest(); break; default: - evtRes = 1; + evtRes = true; } if (evtRes) { @@ -488,12 +488,14 @@ void daAuction_c::eventTalkInit(int staffIdx) { } /* 000013C0-00001400 .text eventMesSet__11daAuction_cFv */ -u8 daAuction_c::eventMesSet() { - /* Nonmatching */ +bool daAuction_c::eventMesSet() { + talk(0); + + return mCurrMsgBsPcId != fpcM_ERROR_PROCESS_ID_e; } /* 00001400-00001434 .text eventMesEnd__11daAuction_cFv */ -u8 daAuction_c::eventMesEnd() { +bool daAuction_c::eventMesEnd() { /* Nonmatching */ } @@ -503,7 +505,7 @@ void daAuction_c::eventStartInit() { } /* 00001634-000016AC .text eventStart__11daAuction_cFv */ -u8 daAuction_c::eventStart() { +bool daAuction_c::eventStart() { /* Nonmatching */ } @@ -522,7 +524,7 @@ static daAuction_c::ProcFunc_t eventProc[] = { }; /* 0000188C-00001A98 .text eventMain__11daAuction_cFv */ -u8 daAuction_c::eventMain() { +bool daAuction_c::eventMain() { /* Nonmatching */ } @@ -562,7 +564,7 @@ void daAuction_c::eventGetItemInit() { } /* 00002D4C-00002D54 .text eventGetItem__11daAuction_cFv */ -u8 daAuction_c::eventGetItem() { +bool daAuction_c::eventGetItem() { /* Nonmatching */ } @@ -582,7 +584,7 @@ void daAuction_c::eventGetItemMesInit() { } /* 00002E40-00002EA0 .text eventCameraOffNpc__11daAuction_cFv */ -u8 daAuction_c::eventCameraOffNpc() { +bool daAuction_c::eventCameraOffNpc() { /* Nonmatching */ } @@ -592,7 +594,7 @@ void daAuction_c::eventEndInit() { } /* 00002EDC-00002F60 .text eventEnd__11daAuction_cFv */ -u8 daAuction_c::eventEnd() { +bool daAuction_c::eventEnd() { /* Nonmatching */ } @@ -602,7 +604,7 @@ void daAuction_c::eventCameraTestInit() { } /* 00002F64-00002F6C .text eventCameraTest__11daAuction_cFv */ -u8 daAuction_c::eventCameraTest() { +bool daAuction_c::eventCameraTest() { /* Nonmatching */ } From 0ee78517414096b24c4486ce4152ddf5d84f924b Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Sun, 19 May 2024 19:19:32 +0200 Subject: [PATCH 23/56] daAuction_c::eventMesEnd matching --- src/d/actor/d_a_auction.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index 4383ed53a..cea214302 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -496,7 +496,7 @@ bool daAuction_c::eventMesSet() { /* 00001400-00001434 .text eventMesEnd__11daAuction_cFv */ bool daAuction_c::eventMesEnd() { - /* Nonmatching */ + return talk(0) == fopMsgStts_BOX_CLOSED_e; } /* 00001434-00001634 .text eventStartInit__11daAuction_cFv */ From 7999ffe171cfc96df899503de142934353276c8f Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Mon, 20 May 2024 01:13:47 +0200 Subject: [PATCH 24/56] daAuction_c::eventStartInit matching --- include/d/actor/d_a_auction.h | 8 +++++-- include/d/d_com_inf_game.h | 8 ++++++- src/d/actor/d_a_auction.cpp | 45 ++++++++++++++++++++++++++++++++++- src/d/d_auction_screen.cpp | 2 +- 4 files changed, 58 insertions(+), 5 deletions(-) diff --git a/include/d/actor/d_a_auction.h b/include/d/actor/d_a_auction.h index 9d99d4d76..5bf392672 100644 --- a/include/d/actor/d_a_auction.h +++ b/include/d/actor/d_a_auction.h @@ -94,7 +94,9 @@ class daAuction_c : public fopNpc_npc_c { /* 0x6CC */ dNpc_EventCut_c mNpcEvtInfo; //* 0x730 */ u8 m730[0x738 - 0x730]; /* 0x738 */ u32 m738[8]; - /* 0x758 */ u8 m758[0x764 - 0x758]; + /* 0x758 */ uint mCurrAuctionItemPID; + /* 0x75C */ uint mTimerID; + /* 0x760 */ uint mGaugeID; /* 0x764 */ dTimer_c* mpTimer; /* 0x768 */ LIGHT_INFLUENCE mLight; /* 0x788 */ J3DModel* mpModel; @@ -137,7 +139,9 @@ class daAuction_c : public fopNpc_npc_c { /* 0x82B */ u8 m82B[0x82C - 0x82B]; /* 0x82C */ u8 m82C; /* 0x82D */ u8 mCurLinkAnm; - /* 0x82E */ u8 m82E[0x832 - 0x82E]; + /* 0x82E */ u8 m82E[0x830 - 0x82E]; + /* 0x830 */ u8 m830; + /* 0x831 */ u8 m831; /* 0x832 */ u8 m832; /* Might be mode index */ /* 0x833 */ u8 m833[0x835 - 0x833]; /* 0x835 */ u8 m835; diff --git a/include/d/d_com_inf_game.h b/include/d/d_com_inf_game.h index f6f2bf3b1..8fd1556dd 100644 --- a/include/d/d_com_inf_game.h +++ b/include/d/d_com_inf_game.h @@ -281,6 +281,8 @@ class dComIfG_play_c { int getMessageRupee() { return mMessageRupee; } + void setAuctionRupee(s16 count) { mAuctionRupee = count; } + int getItemRupeeCount() { return mItemRupeeCount; } void setItemRupeeCount(s32 count) { mItemRupeeCount += count; } void setMessageCountNumber(s16 num) { mMsgCountNumber = num; } @@ -599,7 +601,7 @@ class dComIfG_play_c { /* 0x4918 */ u16 mMsgCountNumber; /* 0x491A */ s16 mMsgSetNumber; /* 0x491C */ s16 mMessageRupee; - /* 0x491E */ s16 field_0x491e; + /* 0x491E */ s16 mAuctionRupee; /* 0x4920 */ s16 field_0x4920; /* 0x4922 */ s16 field_0x4922; /* 0x4924 */ s16 mCurrHP; @@ -765,6 +767,10 @@ inline int dComIfGp_getMessageRupee() { return g_dComIfG_gameInfo.play.getMessageRupee(); } +inline void dComIfGp_setAuctionRupee(s16 count) { + g_dComIfG_gameInfo.play.setAuctionRupee(count); +} + inline void dComIfGs_setRupee(u16 rupee) { g_dComIfG_gameInfo.save.getPlayer().getPlayerStatusA().setRupee(rupee); } diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index cea214302..f70863d15 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -74,6 +74,10 @@ static daAuction_c::ProcFunc_t moveProc[] = { }; extern void dAuction_screen_delete(); +extern void dAuction_screen_slotHide(); +extern void dAuction_screen_gaugeHide(); +extern void dAuction_screen_talkEnd(); +extern uint dAuction_screen_create(); /* 000000EC-000002FC .text __ct__11daAuction_cFv */ daAuction_c::daAuction_c() { @@ -501,7 +505,46 @@ bool daAuction_c::eventMesEnd() { /* 00001434-00001634 .text eventStartInit__11daAuction_cFv */ void daAuction_c::eventStartInit() { - /* Nonmatching */ + m820 = ~1; + + if (m822 == 2) { + mTimerID = dTimer_createTimer(4, 0x1E, 1, 0, 221.0f, 439.0f, 32.0f, 419.0f); + } else { + mTimerID = dTimer_createTimer(4, 0x3C, 1, 0, 221.0f, 439.0f, 32.0f, 419.0f); + } + + JUT_ASSERT(0x861, mTimerID != fpcM_ERROR_PROCESS_ID_e); + + mGaugeID = dAuction_screen_create(); + + JUT_ASSERT(0x863, mGaugeID != fpcM_ERROR_PROCESS_ID_e); + + mpTimer = NULL; + m830 = 1; + + dComIfGp_setMiniGameRupee(0); + dComIfGp_setAuctionRupee(0); + + dAuction_screen_slotHide(); + dAuction_screen_gaugeHide(); + dAuction_screen_talkEnd(); + + mCurrAuctionItemPID = fopAcM_create(PROC_ShopItem, l_item_dat[mCurrAuctionItemIndex].mItemID, ¤t.pos); + dKy_custom_colset(0, 4, 1.0f); + + mLight.mPos.x = 0.0f; + mLight.mPos.y = 50.0f; + mLight.mPos.z = -200.0f; + mLight.mColor.r = 0x96; + mLight.mColor.g = 0x64; + mLight.mColor.b = 0x3C; + mLight.mPower = 450.0f; + mLight.mFluctuation = 0.0f; + + dKy_efplight_set(&mLight); + mFlags |= 4; + + dAuction_screen_talkEnd(); } /* 00001634-000016AC .text eventStart__11daAuction_cFv */ diff --git a/src/d/d_auction_screen.cpp b/src/d/d_auction_screen.cpp index db457f610..73e2c646a 100644 --- a/src/d/d_auction_screen.cpp +++ b/src/d/d_auction_screen.cpp @@ -142,7 +142,7 @@ static void dAs_Create(msg_class*) { } /* 80160D20-80160D70 .text dAuction_screen_create__Fv */ -void dAuction_screen_create() { +uint dAuction_screen_create() { /* Nonmatching */ } From 1f1a17ff1e098e671ad3bc0398c19df4be1a2d97 Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Mon, 20 May 2024 11:12:04 +0200 Subject: [PATCH 25/56] daAuction_c::eventStart matching --- src/d/actor/d_a_auction.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index f70863d15..c5e4b9248 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -549,7 +549,18 @@ void daAuction_c::eventStartInit() { /* 00001634-000016AC .text eventStart__11daAuction_cFv */ bool daAuction_c::eventStart() { - /* Nonmatching */ + if (mpTimer == NULL) { + mpTimer = (dTimer_c*)fopMsgM_SearchByID(mTimerID); + + if (mpTimer != NULL) { + mpTimer->mpScrnDraw->setShowType(0); + } + } + + dComIfGp_setDoStatusForce(0x3E); + dComIfGp_setAStatusForce(0x3E); + + return mpTimer != NULL; } /* 000016AC-0000188C .text eventMainInit__11daAuction_cFv */ From 2dcc6e4e7c16d646471dfabe9f06f704e9ccdc19 Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Mon, 20 May 2024 19:06:23 +0200 Subject: [PATCH 26/56] daAuction_c::eventMainInit matching --- include/d/actor/d_a_auction.h | 19 +++--- src/d/actor/d_a_auction.cpp | 114 +++++++++++++++++++++++++++++++++- 2 files changed, 124 insertions(+), 9 deletions(-) diff --git a/include/d/actor/d_a_auction.h b/include/d/actor/d_a_auction.h index 5bf392672..afc9fe12c 100644 --- a/include/d/actor/d_a_auction.h +++ b/include/d/actor/d_a_auction.h @@ -106,8 +106,10 @@ class daAuction_c : public fopNpc_npc_c { /* 0x7A8 */ u8 m7A8[0x7BC - 0x7A8]; /* 0x7BC */ f32 mAlpha; /* 0x7C0 */ f32 mBlend; - /* 0x7C4 */ f32 m7C4; - /* 0x7C8 */ u8 m7C8[0x7EC - 0x7C8]; + /* 0x7C4 */ f32 m7C4[7]; + /* 0x7E0 */ f32 m7E0; + /* 0x7E4 */ f32 m7E4; + /* 0x7E8 */ u8 m7E8[0x7EC - 0x7E8]; /* 0x7EC */ int m7EC; /* 0x7F0 */ int m7F0; /* 0x7F4 */ s16 mEvtStartIdx; @@ -118,7 +120,8 @@ class daAuction_c : public fopNpc_npc_c { /* 0x7FE */ s16 mCurrItemNameMsgNo; /* 0x800 */ u8 m800[0x802 - 0x800]; /* 0x802 */ s16 mTimer; - /* 0x804 */ u8 m804[0x808 - 0x804]; + /* 0x804 */ u16 m804; + /* 0x806 */ u8 m806[0x808 - 0x806]; /* 0x808 */ u16 m808; /* 0x80A */ s16 m80A; /* 0x80C */ u8 m80C[8]; @@ -126,7 +129,7 @@ class daAuction_c : public fopNpc_npc_c { /* 0x81C */ u8 m81C; /* 0x81D */ u8 m81D; /* 0x81E */ u8 mMoveState; - /* 0x81F */ u8 m81F[0x820 - 0x81F]; + /* 0x81F */ u8 m81F; /* 0x820 */ u8 m820; /* 0x821 */ u8 m821; /* 0x822 */ u8 m822; @@ -136,14 +139,16 @@ class daAuction_c : public fopNpc_npc_c { /* 0x826 */ u8 m826; /* 0x827 */ u8 m827[0x82A - 0x827]; /* 0x82A */ u8 m82A; - /* 0x82B */ u8 m82B[0x82C - 0x82B]; + /* 0x82B */ u8 m82B; /* 0x82C */ u8 m82C; /* 0x82D */ u8 mCurLinkAnm; - /* 0x82E */ u8 m82E[0x830 - 0x82E]; + /* 0x82E */ u8 m82E; + /* 0x82F */ u8 m82F; /* 0x830 */ u8 m830; /* 0x831 */ u8 m831; /* 0x832 */ u8 m832; /* Might be mode index */ - /* 0x833 */ u8 m833[0x835 - 0x833]; + /* 0x833 */ u8 m833; + /* 0x834 */ u8 m834; /* 0x835 */ u8 m835; /* 0x836 */ u8 m836; /* 0x837 */ u8 mFlags; /* Just a guess */ diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index c5e4b9248..0a7f70c36 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -7,6 +7,7 @@ #include "d/d_procname.h" #include "d/res/res_auction.h" #include "d/d_camera.h" +#include "d/actor/d_a_player.h" /* Structs are almost definitely not accurate */ struct NpcDatStruct { @@ -24,11 +25,22 @@ struct NpcMsgDatStruct { /* 0x06 */ s16 field_0x06; /* 0x08 */ s16 field_0x08; }; -static cXyz l_camera_pos[6] = { + +struct NpcCameraDatStruct { // Probably wrong + /* 0x00 */ f32 field_0x00; + /* 0x04 */ f32 field_0x04; + /* 0x08 */ s16 field_0x08; +}; + +static cXyz l_camera_pos[3][2] = { cXyz(-265.0f, 48.0f, -631.0f), cXyz(332.0f, 232.0f, 286.0f), + + cXyz(-50.0f, 202.0f, 137.0f), cXyz(-87.0f, 239.0f, 330.0f), + + cXyz(-216.0f, 205.0f, 5.0f), cXyz(-379.0f, 238.0f, 115.0f), }; @@ -62,6 +74,51 @@ static NpcMsgDatStruct l_npc_msg_dat[12] = { NULL, }; +static NpcCameraDatStruct l_npc_camera_dat[7] = { + { 150.0f, 70.0f, -500 }, + { 200.0f, 100.0f, 0 }, + { 200.0f, 100.0f, 0 }, + { 200.0f, 100.0f, 0 }, + { 200.0f, 100.0f, 0 }, + { 200.0f, 100.0f, 0 }, + { 200.0f, 150.0f, 0 }, +}; + +static f32 l_npc_emitter_ofsy[8] = { + 120.0f, + 180.0f, + 180.0f, + 180.0f, + 180.0f, + 210.0f, + 180.0f, +}; + +static f32 l_npc_camera_ofsy[8] = { + 150.0f, + 210.0f, + 210.0f, + 210.0f, + 210.0f, + 210.0f, + 240.0f, + 210.0f, +}; + +static s16 l_rest_msg_time1[4] = { + 30000, + 10000, + 5000, + -1000, +}; + +static s16 l_rest_msg_time2[4] = { + 15000, + 10000, + 5000, + -1000, +}; + #ifdef DEBUG // TODO: Figure out what these are static daAuction_HIO_c l_HIO; @@ -76,6 +133,7 @@ static daAuction_c::ProcFunc_t moveProc[] = { extern void dAuction_screen_delete(); extern void dAuction_screen_slotHide(); extern void dAuction_screen_gaugeHide(); +extern void dAuction_screen_gaugeShow(); extern void dAuction_screen_talkEnd(); extern uint dAuction_screen_create(); @@ -565,7 +623,59 @@ bool daAuction_c::eventStart() { /* 000016AC-0000188C .text eventMainInit__11daAuction_cFv */ void daAuction_c::eventMainInit() { - /* Nonmatching */ + m804 = 0xE10; + + for (int i = 0; i < 7; i++) { + m7C4[i] = 0.0f; + } + + if (m822 == 2) { + m81F = 1; + } else { + m81F = 0; + } + + m7E0 = 0.0f; + m7E4 = 1.0f; + m82A = 0; + + for (int i = 0; i < 3; i++) { + s16 restMsgTime; + if (m822 == 2) { + restMsgTime = l_rest_msg_time2[i]; + } else { + restMsgTime = l_rest_msg_time1[i]; + } + + if (60000 > restMsgTime) break; + + m82A += 1; + } + + m82B = 0; + m835 = 0; + m834 = 0; + m82E = 0; + + dComIfG_TimerStart(0, 4); + + if (m822 == 1) { + dAuction_screen_gaugeShow(); + } + + m836 |= 1; + + daPy_py_c* pLink = (daPy_py_c*)dComIfGp_getLinkPlayer(); + + pLink->changeOriginalDemo(); + mCurLinkAnm = 1; + dComIfGp_event_setTalkPartner(this); + m82F = 0; + + m78C = l_camera_pos[m82F][0]; + m798 = l_camera_pos[m82F][1]; + + dAuction_screen_talkEnd(); } static daAuction_c::ProcFunc_t eventProc[] = { From b7eb11d0a2ceb7ac2befc7c843ed2ac88cd843fa Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Tue, 21 May 2024 12:53:39 +0200 Subject: [PATCH 27/56] daAuction_c::eventMain matching --- include/d/actor/d_a_auction.h | 2 +- include/d/actor/d_a_player.h | 5 +++- include/d/d_com_inf_game.h | 7 ++++- src/d/actor/d_a_auction.cpp | 52 ++++++++++++++++++++++++++++++++++- 4 files changed, 62 insertions(+), 4 deletions(-) diff --git a/include/d/actor/d_a_auction.h b/include/d/actor/d_a_auction.h index afc9fe12c..1b8095ce6 100644 --- a/include/d/actor/d_a_auction.h +++ b/include/d/actor/d_a_auction.h @@ -147,7 +147,7 @@ class daAuction_c : public fopNpc_npc_c { /* 0x830 */ u8 m830; /* 0x831 */ u8 m831; /* 0x832 */ u8 m832; /* Might be mode index */ - /* 0x833 */ u8 m833; + /* 0x833 */ u8 mFace; /* 0x834 */ u8 m834; /* 0x835 */ u8 m835; /* 0x836 */ u8 m836; diff --git a/include/d/actor/d_a_player.h b/include/d/actor/d_a_player.h index f3e5d3b5d..6fb7fae43 100644 --- a/include/d/actor/d_a_player.h +++ b/include/d/actor/d_a_player.h @@ -381,7 +381,10 @@ class daPy_py_c : public fopAc_ac_c { mDemo.setOriginalDemoType(); mDemo.setParam0(0); } - void cancelOriginalDemo() {} + void cancelOriginalDemo() { + mDemo.setSystemDemoType(); + mDemo.setDemoMode(1); + } void onNoResetFlg0(daPy_FLG0 flag) { mNoResetFlg0 |= flag; } void offNoResetFlg0(daPy_FLG0 flag) { mNoResetFlg0 &= ~flag; } diff --git a/include/d/d_com_inf_game.h b/include/d/d_com_inf_game.h index 8fd1556dd..c9def92b5 100644 --- a/include/d/d_com_inf_game.h +++ b/include/d/d_com_inf_game.h @@ -282,6 +282,7 @@ class dComIfG_play_c { int getMessageRupee() { return mMessageRupee; } void setAuctionRupee(s16 count) { mAuctionRupee = count; } + void setAuctionGauge(s16 gauge) { mAuctionGauge = gauge; } int getItemRupeeCount() { return mItemRupeeCount; } void setItemRupeeCount(s32 count) { mItemRupeeCount += count; } @@ -602,7 +603,7 @@ class dComIfG_play_c { /* 0x491A */ s16 mMsgSetNumber; /* 0x491C */ s16 mMessageRupee; /* 0x491E */ s16 mAuctionRupee; - /* 0x4920 */ s16 field_0x4920; + /* 0x4920 */ s16 mAuctionGauge; /* 0x4922 */ s16 field_0x4922; /* 0x4924 */ s16 mCurrHP; /* 0x4926 */ s16 mRupyCountDisplay; @@ -771,6 +772,10 @@ inline void dComIfGp_setAuctionRupee(s16 count) { g_dComIfG_gameInfo.play.setAuctionRupee(count); } +inline void dComIfGp_setAuctionGauge(s16 gauge) { + g_dComIfG_gameInfo.play.setAuctionGauge(gauge); +} + inline void dComIfGs_setRupee(u16 rupee) { g_dComIfG_gameInfo.save.getPlayer().getPlayerStatusA().setRupee(rupee); } diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index 0a7f70c36..c4f5c10c3 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -8,6 +8,7 @@ #include "d/res/res_auction.h" #include "d/d_camera.h" #include "d/actor/d_a_player.h" +#include "d/actor/d_a_player_main.h" /* Structs are almost definitely not accurate */ struct NpcDatStruct { @@ -689,7 +690,56 @@ static daAuction_c::ProcFunc_t eventProc[] = { /* 0000188C-00001A98 .text eventMain__11daAuction_cFv */ bool daAuction_c::eventMain() { - /* Nonmatching */ + daPy_lk_c* pLink = (daPy_lk_c*)dComIfGp_getLinkPlayer(); + + if (pLink->getBaseAnimeFrameRate() == 0.0f && mCurLinkAnm != 1 && mCurLinkAnm != 0x1D && mCurLinkAnm != 0x25) { + setLinkAnm(1); + } + + mFlags &= 4; + + if (dComIfG_getTimerMode() == 4) { + dComIfG_TimerStop(2); + } + + (this->*eventProc[m81F])(); + + if (m832 != 0) { + pLink->setFace((daPy_py_c::daPy_FACE)mFace); + } + + if (m822 == 1) { + dComIfGp_setAuctionGauge((s16)m7C4[0]); + } + + if (m81F <= 1 && m82B != 0) { + dComIfGp_setNpcNameMessageID(l_npc_msg_dat[m814[m824]].field_0x00); + + if (dComIfG_getTimerMode() == 4) { + dComIfG_TimerStop(2); + } + + dAuction_screen_slotHide(); + dAuction_screen_gaugeHide(); + + m82B = 1; + m834 = 0; + m836 |= 2; + + // Might be incorrect + pLink->cancelOriginalDemo(); + + if (m835 & 4) { + m835 |= 2; + m835 &= ~1; + } + + mDoAud_seStart(JA_SE_AUC_END); + + return true; + } + + return false; } /* 00001A98-000022A8 .text eventMainKai__11daAuction_cFv */ From 1f3543950fd4656e8eca4eff90f121902c96b64c Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Wed, 22 May 2024 23:22:46 +0200 Subject: [PATCH 28/56] daAuction_c::eventMainKai matching --- include/d/actor/d_a_auction.h | 12 ++- src/d/actor/d_a_auction.cpp | 181 +++++++++++++++++++++++++++++++++- 2 files changed, 184 insertions(+), 9 deletions(-) diff --git a/include/d/actor/d_a_auction.h b/include/d/actor/d_a_auction.h index 1b8095ce6..a2dea6aff 100644 --- a/include/d/actor/d_a_auction.h +++ b/include/d/actor/d_a_auction.h @@ -82,7 +82,7 @@ class daAuction_c : public fopNpc_npc_c { void setMessage2(unsigned long); void setMtx(); u8 getItemNo(); - void getNpcActorP(int); + fopNpc_npc_c* getNpcActorP(int); void setCameraNpc(int, short); void setLinkAnm(unsigned char); void getPiconDispOfs(unsigned char); @@ -118,11 +118,11 @@ class daAuction_c : public fopNpc_npc_c { /* 0x7FA */ s16 mEvtStart2Idx; /* 0x7FC */ s16 mEvtEnd2Idx; /* 0x7FE */ s16 mCurrItemNameMsgNo; - /* 0x800 */ u8 m800[0x802 - 0x800]; + /* 0x800 */ s16 m800; /* 0x802 */ s16 mTimer; /* 0x804 */ u16 m804; - /* 0x806 */ u8 m806[0x808 - 0x806]; - /* 0x808 */ u16 m808; + /* 0x806 */ s16 m806; + /* 0x808 */ s16 m808; /* 0x80A */ s16 m80A; /* 0x80C */ u8 m80C[8]; /* 0x814 */ u8 m814[8]; @@ -137,7 +137,9 @@ class daAuction_c : public fopNpc_npc_c { /* 0x824 */ u8 m824; /* 0x825 */ u8 m825[0x826 - 0x825]; /* 0x826 */ u8 m826; - /* 0x827 */ u8 m827[0x82A - 0x827]; + /* 0x827 */ u8 m827; + /* 0x828 */ u8 m828; + /* 0x829 */ u8 m829; /* 0x82A */ u8 m82A; /* 0x82B */ u8 m82B; /* 0x82C */ u8 m82C; diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index c4f5c10c3..ac0208c75 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -9,11 +9,12 @@ #include "d/d_camera.h" #include "d/actor/d_a_player.h" #include "d/actor/d_a_player_main.h" +#include "m_Do/m_Do_controller_pad.h" /* Structs are almost definitely not accurate */ struct NpcDatStruct { - /* 0x00 */ s32 field_0x00; - /* 0x04 */ s32 field_0x04; + /* 0x00 */ f32 field_0x00; + /* 0x04 */ f32 field_0x04; /* 0x08 */ s16 field_0x08; /* 0x0A */ s16 field_0x0A; /* 0x0C */ s16 field_0x0C; @@ -120,6 +121,13 @@ static s16 l_rest_msg_time2[4] = { -1000, }; +static u32 l_msg_no[3] = { +}; + +static u32 l_rest_se_no[3] = { + +}; + #ifdef DEBUG // TODO: Figure out what these are static daAuction_HIO_c l_HIO; @@ -135,6 +143,7 @@ extern void dAuction_screen_delete(); extern void dAuction_screen_slotHide(); extern void dAuction_screen_gaugeHide(); extern void dAuction_screen_gaugeShow(); +extern void dAuction_screen_gaugeUp(); extern void dAuction_screen_talkEnd(); extern uint dAuction_screen_create(); @@ -744,7 +753,171 @@ bool daAuction_c::eventMain() { /* 00001A98-000022A8 .text eventMainKai__11daAuction_cFv */ void daAuction_c::eventMainKai() { - /* Nonmatching */ + if (dComIfG_getTimerMode() == 4) { + dComIfG_TimerReStart(2); + } + + if (dComIfG_getTimerRestTimeMs() <= 0) { + m82B = 1; + } else { + if (g_mDoCPd_cpadInfo[0].mButtonTrig.b) { + setMessage2(0x1CFC); + mDoAud_seStart(JA_SE_AUC_QUIT); + } else { + // I think this uses std::abs in kiosk build? + m7E0 = m7E0 + m7E4; + if (m7E0 >= 1.0f) { + m7E0 = 1.0f; + m7E4 = -1.0f; + } else if (m7E0 <= -1.0f) { + m7E0 = -1.0f; + m7E4 = 1.0f; + } + + if (m7C4[0] < 100.0f) { + m7C4[0] += 0.02f; + } + + if (g_mDoCPd_cpadInfo[0].mButtonTrig.a) { + + m7C4[0] += l_npc_dat[0].field_0x00 + cM_rndF(l_npc_dat[0].field_0x04 - l_npc_dat[0].field_0x00); + + mDoAud_seStart(JA_SE_AUC_BID_GAUGE, NULL, m7C4[0]); + } + + if (m7C4[0] > 100.0f) { + m7C4[0] = 100.0f; + } + + if (m806 != 0) { + m806 -= 1; + + if (m806 == 0) { + if (m834 & 2) { + m82F = getRand(3); + m78C = l_camera_pos[m82F][0]; + m798 = l_camera_pos[m82F][1]; + } + + m834 &= ~6; + } + } else { + for (int i = 1; i < 7; i++) { + m7C4[i] += cM_rndF(l_npc_dat[i].field_0x04 - l_npc_dat[i].field_0x00) + l_npc_dat[i].field_0x00; + } + } + + int idx; + int end = 7; + + if ((m834 & 2)) { + end = 1; + } + + for (idx = 0; idx < end; idx++) { + if (m7C4[idx] >= 100.0f && mCurrItemNameMsgNo < l_npc_dat[idx].field_0x0C) { + break; + } + } + + if (idx < end) { + m828 = idx; + + s16 prevItemNameMsgNo = mCurrItemNameMsgNo; + + if (idx != 0) { + f32 f = 1.0f; + if (dComIfG_getTimerRestTimeMs() < 30000) { + f = 2.0f; + } else if (dComIfG_getTimerRestTimeMs() < 60000) { + f = 1.5f; + } + + mCurrItemNameMsgNo += (s16)(f * (s16)(l_npc_dat[idx].field_0x08 + cM_rndF(l_npc_dat[idx].field_0x0A - l_npc_dat[idx].field_0x08))); + m800 = mCurrItemNameMsgNo; + + end = 0x1CF9; + + m82C = 4; + m7C4[idx] = 0.0f; + + nextBet(); + } else { + m800 = mCurrItemNameMsgNo + 1; + dComIfGp_setMessageSetNumber(mCurrItemNameMsgNo + 1); + end = 0x1CFA; + setLinkAnm(0x48); + mpTimer->mpScrnDraw->setShowType(1); + + dAuction_screen_gaugeUp(); + dComIfGp_getVibration().StartShock(5, 1, cXyz(0.0f, 1.0f, 0.0f)); + dComIfGp_getVibration().StartShock(4, 0x3E, cXyz(0.0f, 1.0f, 0.0f)); + + } + + m806 = (cM_rndF(0.0f) + 1.0f) * 60.0f; + m7F0 = end; + m81F = 4; + + if (m830 != 0) { + m830 = 0; + } else if (m826 != 0xFF && idx != 0 && dComIfG_getTimerRestTimeMs() > l_rest_msg_time1[0] && getRand(3) == 0) { + u32 msgParam; + + if (mCurrItemNameMsgNo <= 0x64) { + msgParam = 0x1CFD; + } else if (mCurrItemNameMsgNo <= 0x96) { + msgParam = 0x1CFE; + } else if (mCurrItemNameMsgNo <= 0xC8) { + msgParam = 0x1CFF; + } else { + msgParam = 0x1D00; + } + + // onCameraOld might be used somewhere here? + dComIfGp_setMessageCountNumber(prevItemNameMsgNo); + dComIfGp_setNpcNameMessageID(l_npc_msg_dat[m814[m824]].field_0x00); + setMessage2(msgParam); + setCameraNpc(m824, 0); + if (m824 == 0 && mCurLinkAnm != 0x1D) { + setLinkAnm(0x14); + } + + m834 |= 0x20; + m829 = m827; + m830 = 1; + } + + if (m81F == 4) { + u8 tmp = m828; + m829 = tmp; + m827 = tmp; + dComIfGp_setMessageCountNumber(m800); + dComIfGp_setNpcNameMessageID(l_npc_msg_dat[m814[m827]].field_0x00); + } + + m835 |= 9; + m835 &= ~2; + } else if (dComIfG_getTimerRestTimeMs() < l_rest_msg_time1[m82A]) { + setMessage2(l_msg_no[m82A]); + mDoAud_seStart(l_rest_se_no[m82A]); + m82A += 1; + } + } + if (m834 & 2) { + m834 |= 4; + m798.set(0.0f, 50.0f, -210.0f); + m78C.set(getNpcActorP(0)->current.pos); + + m78C.x += cM_ssin(m808) * 256.0f; + m78C.y += 100.0f; + m808 += 200; + mDoAud_seStart(JA_SE_CM_AUC_PARALYZED); + } + } + + dComIfGp_setDoStatusForce(0x25); + dComIfGp_setAStatusForce(0x27); } /* 000022A8-00002760 .text eventMainUri__11daAuction_cFv */ @@ -848,7 +1021,7 @@ u8 daAuction_c::getItemNo() { } /* 00003828-0000387C .text getNpcActorP__11daAuction_cFi */ -void daAuction_c::getNpcActorP(int) { +fopNpc_npc_c* daAuction_c::getNpcActorP(int) { /* Nonmatching */ } From 0b73be94aa7788eb9ca67b677c9cd6d914b74ef2 Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Thu, 23 May 2024 11:01:51 +0200 Subject: [PATCH 29/56] daAuction_c::eventMainKai Fixed formatting --- src/d/actor/d_a_auction.cpp | 94 ++++++++++++++++++------------------- 1 file changed, 46 insertions(+), 48 deletions(-) diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index ac0208c75..19eb5a785 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -779,7 +779,6 @@ void daAuction_c::eventMainKai() { } if (g_mDoCPd_cpadInfo[0].mButtonTrig.a) { - m7C4[0] += l_npc_dat[0].field_0x00 + cM_rndF(l_npc_dat[0].field_0x04 - l_npc_dat[0].field_0x00); mDoAud_seStart(JA_SE_AUC_BID_GAUGE, NULL, m7C4[0]); @@ -852,7 +851,6 @@ void daAuction_c::eventMainKai() { dAuction_screen_gaugeUp(); dComIfGp_getVibration().StartShock(5, 1, cXyz(0.0f, 1.0f, 0.0f)); dComIfGp_getVibration().StartShock(4, 0x3E, cXyz(0.0f, 1.0f, 0.0f)); - } m806 = (cM_rndF(0.0f) + 1.0f) * 60.0f; @@ -862,59 +860,59 @@ void daAuction_c::eventMainKai() { if (m830 != 0) { m830 = 0; } else if (m826 != 0xFF && idx != 0 && dComIfG_getTimerRestTimeMs() > l_rest_msg_time1[0] && getRand(3) == 0) { - u32 msgParam; - - if (mCurrItemNameMsgNo <= 0x64) { - msgParam = 0x1CFD; - } else if (mCurrItemNameMsgNo <= 0x96) { - msgParam = 0x1CFE; - } else if (mCurrItemNameMsgNo <= 0xC8) { - msgParam = 0x1CFF; - } else { - msgParam = 0x1D00; - } - - // onCameraOld might be used somewhere here? - dComIfGp_setMessageCountNumber(prevItemNameMsgNo); - dComIfGp_setNpcNameMessageID(l_npc_msg_dat[m814[m824]].field_0x00); - setMessage2(msgParam); - setCameraNpc(m824, 0); - if (m824 == 0 && mCurLinkAnm != 0x1D) { - setLinkAnm(0x14); - } - - m834 |= 0x20; - m829 = m827; - m830 = 1; + u32 msgParam; + + if (mCurrItemNameMsgNo <= 0x64) { + msgParam = 0x1CFD; + } else if (mCurrItemNameMsgNo <= 0x96) { + msgParam = 0x1CFE; + } else if (mCurrItemNameMsgNo <= 0xC8) { + msgParam = 0x1CFF; + } else { + msgParam = 0x1D00; } - if (m81F == 4) { - u8 tmp = m828; - m829 = tmp; - m827 = tmp; - dComIfGp_setMessageCountNumber(m800); - dComIfGp_setNpcNameMessageID(l_npc_msg_dat[m814[m827]].field_0x00); + // onCameraOld might be used somewhere here? + dComIfGp_setMessageCountNumber(prevItemNameMsgNo); + dComIfGp_setNpcNameMessageID(l_npc_msg_dat[m814[m824]].field_0x00); + setMessage2(msgParam); + setCameraNpc(m824, 0); + if (m824 == 0 && mCurLinkAnm != 0x1D) { + setLinkAnm(0x14); } - m835 |= 9; - m835 &= ~2; - } else if (dComIfG_getTimerRestTimeMs() < l_rest_msg_time1[m82A]) { - setMessage2(l_msg_no[m82A]); - mDoAud_seStart(l_rest_se_no[m82A]); - m82A += 1; + m834 |= 0x20; + m829 = m827; + m830 = 1; } + + if (m81F == 4) { + u8 tmp = m828; + m829 = tmp; + m827 = tmp; + dComIfGp_setMessageCountNumber(m800); + dComIfGp_setNpcNameMessageID(l_npc_msg_dat[m814[m827]].field_0x00); + } + + m835 |= 9; + m835 &= ~2; + } else if (dComIfG_getTimerRestTimeMs() < l_rest_msg_time1[m82A]) { + setMessage2(l_msg_no[m82A]); + mDoAud_seStart(l_rest_se_no[m82A]); + m82A += 1; } - if (m834 & 2) { - m834 |= 4; - m798.set(0.0f, 50.0f, -210.0f); - m78C.set(getNpcActorP(0)->current.pos); - - m78C.x += cM_ssin(m808) * 256.0f; - m78C.y += 100.0f; - m808 += 200; - mDoAud_seStart(JA_SE_CM_AUC_PARALYZED); - } } + if (m834 & 2) { + m834 |= 4; + m798.set(0.0f, 50.0f, -210.0f); + m78C.set(getNpcActorP(0)->current.pos); + + m78C.x += cM_ssin(m808) * 256.0f; + m78C.y += 100.0f; + m808 += 200; + mDoAud_seStart(JA_SE_CM_AUC_PARALYZED); + } + } dComIfGp_setDoStatusForce(0x25); dComIfGp_setAStatusForce(0x27); From 08b56cc23bc9401e6670ab0a578f86c34dccbc38 Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Fri, 24 May 2024 13:40:27 +0200 Subject: [PATCH 30/56] daAuction_c::eventMainUri matching --- src/d/actor/d_a_auction.cpp | 107 +++++++++++++++++++++++++++++++++++- 1 file changed, 104 insertions(+), 3 deletions(-) diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index 19eb5a785..ed6cd6bb2 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -11,6 +11,9 @@ #include "d/actor/d_a_player_main.h" #include "m_Do/m_Do_controller_pad.h" +// TODO: Remove this. It's just here to make the code more readable. +#define RAND_RANGE(a, b) (a + cM_rndF(b - a)) + /* Structs are almost definitely not accurate */ struct NpcDatStruct { /* 0x00 */ f32 field_0x00; @@ -121,7 +124,7 @@ static s16 l_rest_msg_time2[4] = { -1000, }; -static u32 l_msg_no[3] = { +static u32 l_rest_msg_no[3] = { }; static u32 l_rest_se_no[3] = { @@ -897,7 +900,7 @@ void daAuction_c::eventMainKai() { m835 |= 9; m835 &= ~2; } else if (dComIfG_getTimerRestTimeMs() < l_rest_msg_time1[m82A]) { - setMessage2(l_msg_no[m82A]); + setMessage2(l_rest_msg_no[m82A]); mDoAud_seStart(l_rest_se_no[m82A]); m82A += 1; } @@ -920,7 +923,103 @@ void daAuction_c::eventMainKai() { /* 000022A8-00002760 .text eventMainUri__11daAuction_cFv */ void daAuction_c::eventMainUri() { - /* Nonmatching */ + if (dComIfG_getTimerMode() == 4) { + dComIfG_TimerReStart(2); + } + + if (dComIfG_getTimerRestTimeMs() <= 0) { + m82B = 1; + } else if (m82E != 0 && g_mDoCPd_cpadInfo[0].mButtonTrig.a) { + setMessage2(0x1D1A); + } else { + if (m806 != 0) { + m806 -= 1; + } else { + for (int i = 1; i < 7; i++) { + m7C4[i] += 2.0f * RAND_RANGE(l_npc_dat[i].field_0x00, l_npc_dat[i].field_0x04); + } + } + + int idx; + for (idx = 1; idx < 7; idx++) { + if (m7C4[idx] >= 100.0f) { + m7C4[idx] = 0.0f; + if (mCurrItemNameMsgNo < l_npc_dat[idx].field_0x0C) { + break; + } + } + } + + if (idx < 7) { + m828 = idx; + + if (idx != 0) { + float multiplier = 1.0f; + + if (dComIfG_getTimerRestTimeMs() < 30000) { + multiplier = 2.0f; + } else if (dComIfG_getTimerRestTimeMs() < 60000) { + multiplier = 1.5f; + } + + mCurrItemNameMsgNo += (s16)(multiplier * (2 * (s16)RAND_RANGE(l_npc_dat[idx].field_0x08, l_npc_dat[idx].field_0x0A))); + m800 = mCurrItemNameMsgNo; + m7F0 = 0x1CF9; + m82C = 4; + m82E = 1; + m806 = cM_rndF(1.0) * 60.0f; + m81F = 4; + + // onCameraOld might be used here + if (m830 != 0) { + m830 = 0; + } else if (dComIfG_getTimerRestTimeMs() > l_rest_msg_time1[0] && getRand(3) == 0) { + u32 msgParam; + + if (mCurrItemNameMsgNo <= 0x64) { + msgParam = 0x1CFD; + } else if (mCurrItemNameMsgNo <= 0x96) { + msgParam = 0x1CFE; + } else if (mCurrItemNameMsgNo <= 0xC8) { + msgParam = 0x1CFF; + } else { + msgParam = 0x1D00; + } + + dComIfGp_setNpcNameMessageID(l_npc_msg_dat[m814[m824]].field_0x00); + setMessage2(msgParam); + setCameraNpc(m824, 0); + + if (m824 == 0) { + setLinkAnm(0x14); + } + + m834 |= 0x20; + m829 = m827; + m830 = 1; + } + + if (m81F == 4) { + u8 m828_val = m828; + m829 = m828_val; + m827 = m828_val; + dComIfGp_setMessageCountNumber(m800); + dComIfGp_setNpcNameMessageID(l_npc_msg_dat[m814[m827]].field_0x00); + } + + m835 |= 9; + m835 &= ~2; + } + } else if (dComIfG_getTimerRestTimeMs() < l_rest_msg_time2[m82A]) { + setMessage2(l_rest_msg_no[m82A]); + mDoAud_seStart(l_rest_se_no[m82A]); + m82A += 1; + } + } + + if (m82E != 0) { + dComIfGp_setDoStatusForce(0x25); + } } /* 00002760-0000279C .text eventMainMsgSet__11daAuction_cFv */ @@ -1103,3 +1202,5 @@ actor_process_profile_definition g_profile_AUCTION = { /* Group */ fopAc_ACTOR_e, /* CullType */ fopAc_CULLBOX_CUSTOM_e, }; + +#undef RAND_RANGE From f55a106756827a345632a491847b1a55d587f97a Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Fri, 24 May 2024 16:39:07 +0200 Subject: [PATCH 31/56] d_a_auction matching fixes --- include/d/actor/d_a_auction.h | 4 ++-- src/d/actor/d_a_auction.cpp | 22 +++++++++++++--------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/include/d/actor/d_a_auction.h b/include/d/actor/d_a_auction.h index a2dea6aff..c5f4d8ed2 100644 --- a/include/d/actor/d_a_auction.h +++ b/include/d/actor/d_a_auction.h @@ -14,8 +14,8 @@ class daAuction_c : public fopNpc_npc_c { struct ItemData { /* 0x00 */ s16 mItemID; /* 0x02 */ s16 mNameMsgID; - /* 0x04 */ u16 mStartingBid; - /* 0x06 */ u16 mObtainedEventBit; + /* 0x04 */ s16 mStartingBid; + /* 0x06 */ s16 mObtainedEventBit; }; // Size: 0x08 daAuction_c(); diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index ed6cd6bb2..4e9d40865 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -224,7 +224,6 @@ BOOL daAuction_c::createHeap() { /* 00000770-000008C4 .text createInit__11daAuction_cFv */ s32 daAuction_c::createInit() { - mEvtStartIdx = dComIfGp_evmng_getEventIdx("AUCTION_START"); mEvtGetItemIdx = dComIfGp_evmng_getEventIdx("AUCTION_GET_ITEM"); mEvtNoItemIdx = dComIfGp_evmng_getEventIdx("AUCTION_NO_ITEM"); @@ -238,10 +237,12 @@ s32 daAuction_c::createInit() { mCurrAuctionItemIndex = 0; - dComIfGp_setItemNameMessageID(l_item_dat[mCurrAuctionItemIndex].mItemID); - mCurrItemNameMsgNo = l_item_dat[mCurrAuctionItemIndex].mNameMsgID; + s16 nameMsgID = l_item_dat[mCurrAuctionItemIndex].mNameMsgID; + mCurrItemNameMsgNo = l_item_dat[mCurrAuctionItemIndex].mStartingBid; // Not sure why this is set to the starting bid + dComIfGp_setItemNameMessageID(nameMsgID); dComIfGp_setMessageCountNumber(mCurrItemNameMsgNo); + setMtx(); return cPhs_COMPLEATE_e; @@ -376,11 +377,11 @@ void daAuction_c::eventOrder() { mCurrAuctionItemIndex = getItemNo(); } - dComIfGp_setItemNameMessageID(l_item_dat[mCurrAuctionItemIndex].mItemID); - mCurrItemNameMsgNo = l_item_dat[mCurrAuctionItemIndex].mNameMsgID; + dComIfGp_setItemNameMessageID(l_item_dat[mCurrAuctionItemIndex].mNameMsgID); + mCurrItemNameMsgNo = l_item_dat[mCurrAuctionItemIndex].mStartingBid; dComIfGp_setMessageCountNumber(mCurrItemNameMsgNo); - fopAcM_orderChangeEventId(dComIfGp_getPlayer(0), mEvtStartIdx, 0, 0xFF7F); + fopAcM_orderChangeEventId(dComIfGp_getPlayer(0), this, mEvtStartIdx, 0, 0xFF7F); dComIfGp_startMiniGame(5); } else if (m838 == 4) { fopAcM_orderOtherEventId(this, mEvtGetItemIdx, 0xFF, 0xFF7F); @@ -388,10 +389,13 @@ void daAuction_c::eventOrder() { fopAcM_orderOtherEventId(this, mEvtNoItemIdx, 0xFF, 0xFF7F); } else if (m838 == 6) { mCurrAuctionItemIndex &= 1; - mCurrItemNameMsgNo = l_item_dat2[mCurrAuctionItemIndex].mNameMsgID; - dComIfGp_setItemNameMessageID(l_item_dat2[mCurrAuctionItemIndex].mItemID); + + s16 nameMsgID = l_item_dat2[mCurrAuctionItemIndex].mNameMsgID; + mCurrItemNameMsgNo = l_item_dat2[mCurrAuctionItemIndex].mStartingBid; + + dComIfGp_setItemNameMessageID(nameMsgID); dComIfGp_setMessageCountNumber(mCurrItemNameMsgNo); - fopAcM_orderChangeEventId(dComIfGp_getPlayer(0), mEvtStart2Idx, 0, 0xFF7F); + fopAcM_orderChangeEventId(dComIfGp_getPlayer(0), this, mEvtStart2Idx, 0, 0xFF7F); dComIfGp_startMiniGame(5); } else if (m838 == 7) { fopAcM_orderOtherEventId(this, mEvtEnd2Idx, 0xFF, 0xFF7F); From 7f0157743c4cd2373cdffd5730109da1fd509963 Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Fri, 24 May 2024 16:49:00 +0200 Subject: [PATCH 32/56] daAuction_c::eventMainMsgSet matching --- src/d/actor/d_a_auction.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index 4e9d40865..828d9f2bd 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -1028,7 +1028,9 @@ void daAuction_c::eventMainUri() { /* 00002760-0000279C .text eventMainMsgSet__11daAuction_cFv */ void daAuction_c::eventMainMsgSet() { - /* Nonmatching */ + if (eventMesSet()) { + m81F = 3; + } } /* 0000279C-0000294C .text eventMainMsgEnd__11daAuction_cFv */ From 5097f67519b6aeca6d420ff0e9edffe9e1a956f6 Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Fri, 24 May 2024 17:19:41 +0200 Subject: [PATCH 33/56] daAuction_c::eventMainMsgEnd matching --- include/d/actor/d_a_auction.h | 2 +- src/d/actor/d_a_auction.cpp | 42 ++++++++++++++++++++++++++++++++++- 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/include/d/actor/d_a_auction.h b/include/d/actor/d_a_auction.h index c5f4d8ed2..111944931 100644 --- a/include/d/actor/d_a_auction.h +++ b/include/d/actor/d_a_auction.h @@ -135,7 +135,7 @@ class daAuction_c : public fopNpc_npc_c { /* 0x822 */ u8 m822; /* 0x823 */ u8 mCurrAuctionItemIndex; /* 0x824 */ u8 m824; - /* 0x825 */ u8 m825[0x826 - 0x825]; + /* 0x825 */ u8 m825; /* 0x826 */ u8 m826; /* 0x827 */ u8 m827; /* 0x828 */ u8 m828; diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index 828d9f2bd..ce5b7e74a 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -147,6 +147,7 @@ extern void dAuction_screen_slotHide(); extern void dAuction_screen_gaugeHide(); extern void dAuction_screen_gaugeShow(); extern void dAuction_screen_gaugeUp(); +extern void dAuction_screen_gaugeDown(); extern void dAuction_screen_talkEnd(); extern uint dAuction_screen_create(); @@ -1035,7 +1036,46 @@ void daAuction_c::eventMainMsgSet() { /* 0000279C-0000294C .text eventMainMsgEnd__11daAuction_cFv */ void daAuction_c::eventMainMsgEnd() { - /* Nonmatching */ + if (eventMesEnd()) { + if (mCurLinkAnm != 1 && mCurLinkAnm != 0x1D) { + setLinkAnm(1); + } + + if (m834 & 0x20) { + m81F = 4; + } else { + if (m822 == 2) { + m81F = 1; + } else { + m81F = 0; + } + + eyePos = current.pos; + m832 = 0; + } + + m7E0 = 0.0f; + + if ((m834 & 2) == 0) { + m82F = getRand(3); + m78C = l_camera_pos[m82F][0]; + m798 = l_camera_pos[m82F][1]; + } + + mpTimer->mpScrnDraw->setShowType(0); + dAuction_screen_gaugeDown(); + m834 &= ~0x29; + dAuction_screen_talkEnd(); + dAuction_screen_gaugeShow(); + + return; + } + + if (dComIfGp_checkMesgSendButton() && ((m7EC >= 0x1D3AU && m7EC <= 0x1D4BU) || (m7EC >= 0x339DU && m7EC <= 0x33A8U))) { + setCameraNpc(m825, 0); + m834 |= 8; + m829 = m825; + } } /* 0000294C-00002B90 .text eventMainMsgBikonC__11daAuction_cFv */ From bddb37b29bf97ef0d287766b65822998cf1ac9ac Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Fri, 24 May 2024 23:35:21 +0200 Subject: [PATCH 34/56] daAuction_c::setMtx matching --- src/d/actor/d_a_auction.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index ce5b7e74a..89c2b8b4f 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -1155,7 +1155,10 @@ void daAuction_c::setMessage2(unsigned long) { /* 000036E4-00003754 .text setMtx__11daAuction_cFv */ void daAuction_c::setMtx() { - /* Nonmatching */ + mpModel->setBaseScale(scale); + mDoMtx_stack_c::transS(current.pos); + + mpModel->setBaseTRMtx(mDoMtx_stack_c::get()); } /* 00003754-00003828 .text getItemNo__11daAuction_cFv */ From 11f8e4ab576c97d1761350b2e5cb28ec63a31676 Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Sat, 25 May 2024 00:01:48 +0200 Subject: [PATCH 35/56] daAuction_c::getItemNo matching --- include/d/actor/d_a_auction.h | 2 +- src/d/actor/d_a_auction.cpp | 21 ++++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/include/d/actor/d_a_auction.h b/include/d/actor/d_a_auction.h index 111944931..75bf28002 100644 --- a/include/d/actor/d_a_auction.h +++ b/include/d/actor/d_a_auction.h @@ -15,7 +15,7 @@ class daAuction_c : public fopNpc_npc_c { /* 0x00 */ s16 mItemID; /* 0x02 */ s16 mNameMsgID; /* 0x04 */ s16 mStartingBid; - /* 0x06 */ s16 mObtainedEventBit; + /* 0x06 */ u16 mObtainedEventBit; }; // Size: 0x08 daAuction_c(); diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index 89c2b8b4f..f2f6b010f 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -1163,7 +1163,26 @@ void daAuction_c::setMtx() { /* 00003754-00003828 .text getItemNo__11daAuction_cFv */ u8 daAuction_c::getItemNo() { - /* Nonmatching */ + int i; + int rand_max = 0; + + for (i = 0; i < 4; i++) { + if (!dComIfGs_isEventBit(l_item_dat[i].mObtainedEventBit)) { + rand_max += 1; + } + } + + int rand = getRand(rand_max); + + for (i = 0; i < 3; i++) { + if (!dComIfGs_isEventBit(l_item_dat[i].mObtainedEventBit)) { + if (rand == 0) break; + + rand -= 1; + } + } + + return i; } /* 00003828-0000387C .text getNpcActorP__11daAuction_cFi */ From 57d077a7329f472bd6abd83a2fae937b1967f4ed Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Sat, 25 May 2024 00:15:18 +0200 Subject: [PATCH 36/56] daAuction_c::setLinkAnm matching --- include/d/actor/d_a_auction.h | 2 +- include/d/actor/d_a_player.h | 4 ++-- src/d/actor/d_a_auction.cpp | 12 ++++++++++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/include/d/actor/d_a_auction.h b/include/d/actor/d_a_auction.h index 75bf28002..3e501499a 100644 --- a/include/d/actor/d_a_auction.h +++ b/include/d/actor/d_a_auction.h @@ -84,7 +84,7 @@ class daAuction_c : public fopNpc_npc_c { u8 getItemNo(); fopNpc_npc_c* getNpcActorP(int); void setCameraNpc(int, short); - void setLinkAnm(unsigned char); + void setLinkAnm(u8 linkAnm); void getPiconDispOfs(unsigned char); void nextBet(); int getRand(int); diff --git a/include/d/actor/d_a_player.h b/include/d/actor/d_a_player.h index 6fb7fae43..0e4ec97cf 100644 --- a/include/d/actor/d_a_player.h +++ b/include/d/actor/d_a_player.h @@ -374,9 +374,9 @@ class daPy_py_c : public fopAc_ac_c { cXyz getRopePos() const { return mRopePos; } void getYPos() const {} - void changeDemoMode(u32) {} + void changeDemoMode(u32 mode) { mDemo.setDemoMode(mode); } void changeDemoMoveAngle(s16 angle) { mDemo.setMoveAngle(angle); } - void changeDemoParam0(int) {} + void changeDemoParam0(int param0) { mDemo.setParam0(param0); } void changeOriginalDemo() { mDemo.setOriginalDemoType(); mDemo.setParam0(0); diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index f2f6b010f..e9e0b5967 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -1196,8 +1196,16 @@ void daAuction_c::setCameraNpc(int, short) { } /* 000039FC-00003A3C .text setLinkAnm__11daAuction_cFUc */ -void daAuction_c::setLinkAnm(unsigned char) { - /* Nonmatching */ +void daAuction_c::setLinkAnm(u8 linkAnm) { + if (linkAnm == 1 && m826 == 0) { + linkAnm = 0x1D; + } + + daPy_lk_c* pLink = (daPy_lk_c*)dComIfGp_getLinkPlayer(); + + pLink->changeDemoMode(linkAnm); + pLink->changeDemoParam0(3); + mCurLinkAnm = linkAnm; } /* 00003A3C-00003A74 .text getPiconDispOfs__11daAuction_cFUc */ From 3616e1f58080900404fac975cc48fd524cfe39b7 Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Sat, 25 May 2024 13:18:23 +0200 Subject: [PATCH 37/56] d_a_auction matched some functions --- include/d/actor/d_a_auction.h | 7 +++++-- include/d/actor/d_a_npc_auction.h | 31 ++++++++++++++++--------------- src/d/actor/d_a_auction.cpp | 24 +++++++++++++++--------- src/d/actor/d_a_npc_auction.cpp | 4 ++-- 4 files changed, 38 insertions(+), 28 deletions(-) diff --git a/include/d/actor/d_a_auction.h b/include/d/actor/d_a_auction.h index 3e501499a..401454f44 100644 --- a/include/d/actor/d_a_auction.h +++ b/include/d/actor/d_a_auction.h @@ -32,7 +32,10 @@ class daAuction_c : public fopNpc_npc_c { void isAucBetA() {} void isAucGet() {} void isAucJikkyou() {} - void offCamera() {} + void offCamera() { // Might be incorrect + m835 |= 2; + m835 &= 0xFE; + } void onCamera(unsigned char) {} void onCameraOld(unsigned char) {} void setAucMdlNo(unsigned char, unsigned char) {} @@ -85,7 +88,7 @@ class daAuction_c : public fopNpc_npc_c { fopNpc_npc_c* getNpcActorP(int); void setCameraNpc(int, short); void setLinkAnm(u8 linkAnm); - void getPiconDispOfs(unsigned char); + f32 getPiconDispOfs(u8 param); void nextBet(); int getRand(int); diff --git a/include/d/actor/d_a_npc_auction.h b/include/d/actor/d_a_npc_auction.h index 2da81e73e..e8edbf32c 100644 --- a/include/d/actor/d_a_npc_auction.h +++ b/include/d/actor/d_a_npc_auction.h @@ -2,12 +2,13 @@ #define D_A_NPC_AUCTION_H #include "f_op/f_op_actor.h" +#include "d/d_npc.h" struct sAnmDat { }; -class daNpcAuction_c : public fopAc_ac_c { +class daNpcAuction_c : public fopNpc_npc_c { public: daNpcAuction_c(); @@ -17,7 +18,7 @@ class daNpcAuction_c : public fopAc_ac_c { inline BOOL _execute(); void getMdlNo() {} void getPhaseP() {} - void getPiconOfsY() {} + f32 getPiconOfsY() { return mPiconOfsY; } void setAction(void (daNpcAuction_c::*)()) {} void setBmtNo(int) {} void setBtpNo(int) {} @@ -38,8 +39,8 @@ class daNpcAuction_c : public fopAc_ac_c { void eventMesSet(); void XyCheckCB(int); void XyEventCB(int); - void next_msgStatus(unsigned long*); - void getMsg(); + u16 next_msgStatus(u32*); + u32 getMsg(); void setAnmFromMsgTag(); void getPrmNpcNo(); void setMtx(); @@ -55,19 +56,19 @@ class daNpcAuction_c : public fopAc_ac_c { void clrEmitter(); public: - /* 0x290 */ u8 m290[0x6B0 - 0x290]; - /* 0x6B0 */ u8 m6B0; - /* 0x6B1 */ u8 m6B1[0x73C - 0x6B1]; + /* 0x6C4 */ u8 m6C4[0x724 - 0x6C4]; + /* 0x724 */ f32 mPiconOfsY; + /* 0x728 */ u8 m728[0x73B - 0x728]; + /* 0x73B */ u8 m73B; /* 0x73C */ u8 m73C; /* 0x73D */ u8 m73D; - /* 0x73E */ u8 m73E; - /* 0x73F */ u8 m73F[0x740 - 0x73F]; - /* 0x740 */ u8 m740; - /* 0x741 */ u8 m741[0x743 - 0x741]; - /* 0x743 */ u8 m743; - /* 0x744 */ u8 m744[0x745 - 0x744]; - /* 0x745 */ u8 m745; - /* 0x746 */ u8 m746[0x74C - 0x746]; + /* 0x73E */ u8 m73E[0x73F - 0x73E]; + /* 0x73F */ u8 m73F; + /* 0x740 */ u8 m740[0x742 - 0x740]; + /* 0x742 */ u8 m742; + /* 0x743 */ u8 m743[0x744 - 0x743]; + /* 0x744 */ u8 m744; + /* 0x745 */ u8 field_745[0x74B - 0x745]; }; #endif /* D_A_NPC_AUCTION_H */ diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index e9e0b5967..003fda73d 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -4,11 +4,12 @@ // #include "d/actor/d_a_auction.h" -#include "d/d_procname.h" -#include "d/res/res_auction.h" -#include "d/d_camera.h" +#include "d/actor/d_a_npc_auction.h" #include "d/actor/d_a_player.h" #include "d/actor/d_a_player_main.h" +#include "d/d_camera.h" +#include "d/d_procname.h" +#include "d/res/res_auction.h" #include "m_Do/m_Do_controller_pad.h" // TODO: Remove this. It's just here to make the code more readable. @@ -239,7 +240,7 @@ s32 daAuction_c::createInit() { mCurrAuctionItemIndex = 0; s16 nameMsgID = l_item_dat[mCurrAuctionItemIndex].mNameMsgID; - mCurrItemNameMsgNo = l_item_dat[mCurrAuctionItemIndex].mStartingBid; // Not sure why this is set to the starting bid + mCurrItemNameMsgNo = l_item_dat[mCurrAuctionItemIndex].mStartingBid; dComIfGp_setItemNameMessageID(nameMsgID); dComIfGp_setMessageCountNumber(mCurrItemNameMsgNo); @@ -1095,12 +1096,12 @@ void daAuction_c::eventGetItemInit() { /* 00002D4C-00002D54 .text eventGetItem__11daAuction_cFv */ bool daAuction_c::eventGetItem() { - /* Nonmatching */ + return true; } /* 00002D54-00002D70 .text eventCameraOffInit__11daAuction_cFv */ void daAuction_c::eventCameraOffInit() { - /* Nonmatching */ + offCamera(); } /* 00002D70-00002E00 .text eventGetItemNpcInit__11daAuction_cFi */ @@ -1135,7 +1136,7 @@ void daAuction_c::eventCameraTestInit() { /* 00002F64-00002F6C .text eventCameraTest__11daAuction_cFv */ bool daAuction_c::eventCameraTest() { - /* Nonmatching */ + return true; } /* 00002F6C-0000369C .text next_msgStatus__11daAuction_cFPUl */ @@ -1209,8 +1210,13 @@ void daAuction_c::setLinkAnm(u8 linkAnm) { } /* 00003A3C-00003A74 .text getPiconDispOfs__11daAuction_cFUc */ -void daAuction_c::getPiconDispOfs(unsigned char) { - /* Nonmatching */ +f32 daAuction_c::getPiconDispOfs(u8 param) { + if (param == 0) { + return l_npc_emitter_ofsy[0]; + } + + daNpcAuction_c* pNpcActor = (daNpcAuction_c*)getNpcActorP(param); + return pNpcActor->getPiconOfsY(); } /* 00003A74-00003BA4 .text nextBet__11daAuction_cFv */ diff --git a/src/d/actor/d_a_npc_auction.cpp b/src/d/actor/d_a_npc_auction.cpp index 63e08d9ae..800559eef 100644 --- a/src/d/actor/d_a_npc_auction.cpp +++ b/src/d/actor/d_a_npc_auction.cpp @@ -118,12 +118,12 @@ void daNpcAuction_c::XyEventCB(int) { } /* 000019F8-00001CD4 .text next_msgStatus__14daNpcAuction_cFPUl */ -void daNpcAuction_c::next_msgStatus(unsigned long*) { +u16 daNpcAuction_c::next_msgStatus(u32*) { /* Nonmatching */ } /* 00001CD4-00001F04 .text getMsg__14daNpcAuction_cFv */ -void daNpcAuction_c::getMsg() { +u32 daNpcAuction_c::getMsg() { /* Nonmatching */ } From 9f7b33a7593abd631abcd00dc94989924722b2e3 Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Sat, 25 May 2024 13:26:42 +0200 Subject: [PATCH 38/56] d_a_auction matched SetMessage functions --- include/d/actor/d_a_auction.h | 4 ++-- src/d/actor/d_a_auction.cpp | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/include/d/actor/d_a_auction.h b/include/d/actor/d_a_auction.h index 401454f44..e990f8188 100644 --- a/include/d/actor/d_a_auction.h +++ b/include/d/actor/d_a_auction.h @@ -81,8 +81,8 @@ class daAuction_c : public fopNpc_npc_c { void eventCameraTestInit(); bool eventCameraTest(); u16 next_msgStatus(u32* pMsgNo); - void setMessage(unsigned long); - void setMessage2(unsigned long); + void setMessage(u32); + void setMessage2(u32); void setMtx(); u8 getItemNo(); fopNpc_npc_c* getNpcActorP(int); diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index 003fda73d..e1c6e7657 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -1145,13 +1145,16 @@ u16 daAuction_c::next_msgStatus(u32* pMsgNo) { } /* 0000369C-000036AC .text setMessage__11daAuction_cFUl */ -void daAuction_c::setMessage(unsigned long) { - /* Nonmatching */ +void daAuction_c::setMessage(u32 msg) { + mCurrMsgBsPcId = fpcM_ERROR_PROCESS_ID_e; + mCurrMsgNo = msg; } /* 000036AC-000036E4 .text setMessage2__11daAuction_cFUl */ -void daAuction_c::setMessage2(unsigned long) { - /* Nonmatching */ +void daAuction_c::setMessage2(u32 msg) { + setMessage(msg); + m81F = 2; + dAuction_screen_gaugeHide(); } /* 000036E4-00003754 .text setMtx__11daAuction_cFv */ From 9102a3ef7f7247758f5909d32a7049d2d18c6ff0 Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Sat, 25 May 2024 14:40:09 +0200 Subject: [PATCH 39/56] daAuction_c::getNpcActorP matching --- include/d/actor/d_a_auction.h | 2 +- src/d/actor/d_a_auction.cpp | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/include/d/actor/d_a_auction.h b/include/d/actor/d_a_auction.h index e990f8188..c6e5834eb 100644 --- a/include/d/actor/d_a_auction.h +++ b/include/d/actor/d_a_auction.h @@ -85,7 +85,7 @@ class daAuction_c : public fopNpc_npc_c { void setMessage2(u32); void setMtx(); u8 getItemNo(); - fopNpc_npc_c* getNpcActorP(int); + fopAc_ac_c* getNpcActorP(int idx); void setCameraNpc(int, short); void setLinkAnm(u8 linkAnm); f32 getPiconDispOfs(u8 param); diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index e1c6e7657..1d43edd7b 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -1190,8 +1190,12 @@ u8 daAuction_c::getItemNo() { } /* 00003828-0000387C .text getNpcActorP__11daAuction_cFi */ -fopNpc_npc_c* daAuction_c::getNpcActorP(int) { - /* Nonmatching */ +fopAc_ac_c* daAuction_c::getNpcActorP(int idx) { + if (idx != 0) { + return fopAcM_SearchByID(m738[idx]); + } + + return dComIfGp_getPlayer(0); } /* 0000387C-000039FC .text setCameraNpc__11daAuction_cFis */ From f2df5d8d544e9dde7ae7660fe2a0de91def3e10a Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Sat, 25 May 2024 16:08:09 +0200 Subject: [PATCH 40/56] daAuction_c::eventMainMsgBikonC matching --- include/d/actor/d_a_auction.h | 3 ++- src/d/actor/d_a_auction.cpp | 33 ++++++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/include/d/actor/d_a_auction.h b/include/d/actor/d_a_auction.h index c6e5834eb..91bcd1436 100644 --- a/include/d/actor/d_a_auction.h +++ b/include/d/actor/d_a_auction.h @@ -106,7 +106,8 @@ class daAuction_c : public fopNpc_npc_c { /* 0x78C */ cXyz m78C; /* 0x798 */ cXyz m798; /* 0x7A4 */ JPABaseEmitter* mpEmitter; - /* 0x7A8 */ u8 m7A8[0x7BC - 0x7A8]; + /* 0x7A8 */ cXyz m7A8; + /* 0x7B4 */ u8 m7B4[0x7BC - 0x7B4]; /* 0x7BC */ f32 mAlpha; /* 0x7C0 */ f32 mBlend; /* 0x7C4 */ f32 m7C4[7]; diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index 1d43edd7b..3581666cf 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -132,6 +132,10 @@ static u32 l_rest_se_no[3] = { }; +static u32 l_link_face[8] = { + +}; + #ifdef DEBUG // TODO: Figure out what these are static daAuction_HIO_c l_HIO; @@ -1081,7 +1085,34 @@ void daAuction_c::eventMainMsgEnd() { /* 0000294C-00002B90 .text eventMainMsgBikonC__11daAuction_cFv */ void daAuction_c::eventMainMsgBikonC() { - /* Nonmatching */ + m827 = m829 = m828; + dComIfGp_setMessageCountNumber(m800); + dComIfGp_setNpcNameMessageID(l_npc_msg_dat[m814[m827]].field_0x00); + + cXyz npcPos = getNpcActorP(m827)->current.pos; + npcPos.y += getPiconDispOfs(m827) + 30.0f; + + if (cLib_addCalcPos(&m78C, npcPos, 0.4f, 700.0f, 0.1f) == 0.0f) { + m81F = 5; + m7A8 = getNpcActorP(m827)->current.pos; + m7A8.y += getPiconDispOfs(m827); + + dComIfGp_particle_set(0x8153, &m7A8, NULL, NULL, 0xFF, NULL, fopAcM_GetRoomNo(this)); + mTimer = 0x1E; + + if (m827 == 0) { + mDoAud_seStart(JA_SE_AUC_BID_GAUGE_MAX); + } else { + mDoAud_seStart(JA_SE_CM_AUC_CALL_BID); + m832 = 1; + mFace = l_link_face[getRand(8)]; + } + + eyePos = getNpcActorP(m827)->eyePos; + } + + dComIfGp_setDoStatusForce(0); + dComIfGp_setAStatusForce(0x3E); } /* 00002B90-00002C1C .text eventMainMsgBikonW__11daAuction_cFv */ From d84c2f3026d57c4611ee31dddd16a1426606e858 Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Sat, 25 May 2024 16:12:34 +0200 Subject: [PATCH 41/56] daAuction_c::eventMainMsgBikonW matching --- src/d/actor/d_a_auction.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index 3581666cf..97790633b 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -153,6 +153,7 @@ extern void dAuction_screen_gaugeHide(); extern void dAuction_screen_gaugeShow(); extern void dAuction_screen_gaugeUp(); extern void dAuction_screen_gaugeDown(); +extern void dAuction_screen_talkStart(); extern void dAuction_screen_talkEnd(); extern uint dAuction_screen_create(); @@ -1117,7 +1118,20 @@ void daAuction_c::eventMainMsgBikonC() { /* 00002B90-00002C1C .text eventMainMsgBikonW__11daAuction_cFv */ void daAuction_c::eventMainMsgBikonW() { - /* Nonmatching */ + if (mTimer != 0) { + mTimer -= 1; + } else { + setMessage2(m7F0); + setCameraNpc(m827, 0); + dAuction_screen_talkStart(); + + if (m827 != 0) { + m834 |= 1; + } + } + + dComIfGp_setDoStatusForce(0); + dComIfGp_setAStatusForce(0x3E); } /* 00002C1C-00002D4C .text eventGetItemInit__11daAuction_cFv */ From 22db65ed697bc3ef85a7a68acd46749a7e40715b Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Sat, 25 May 2024 16:34:41 +0200 Subject: [PATCH 42/56] daAuction_c::eventGetItemInit matching --- src/d/actor/d_a_auction.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index 97790633b..8cc8ffddd 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -70,7 +70,7 @@ static daAuction_c::ItemData l_item_dat2[] = { {POSTMAN_STATUE, 0x1D14, 30, 0x1008}, {PRESIDENT_STATUE, 0x1D15, 40, 0x1004}, }; -static char l_item_dat22[] = {0x00, 0x2A, 0x00, 0xF9}; +static s16 l_item_dat22[] = {0x002A, 0x00F9}; static NpcDatStruct l_npc_dat[7] = { NULL, @@ -1136,7 +1136,25 @@ void daAuction_c::eventMainMsgBikonW() { /* 00002C1C-00002D4C .text eventGetItemInit__11daAuction_cFv */ void daAuction_c::eventGetItemInit() { - /* Nonmatching */ + if (m822 == 2) { + uint itemID = fopAcM_createItemForPresentDemo(¤t.pos, l_item_dat22[mCurrAuctionItemIndex] & 0xFF); + + if (itemID != fpcM_ERROR_PROCESS_ID_e) { + dComIfGp_event_setItemPartnerId(itemID); + } + + dComIfGs_onEventBit(l_item_dat2[mCurrAuctionItemIndex].mObtainedEventBit); + } else { + uint itemID = fopAcM_createItemForPresentDemo(¤t.pos, l_item_dat[mCurrAuctionItemIndex].mItemID & 0xFF); + + if (itemID != fpcM_ERROR_PROCESS_ID_e) { + dComIfGp_event_setItemPartnerId(itemID); + } + + dComIfGs_onEventBit(l_item_dat[mCurrAuctionItemIndex].mObtainedEventBit); + } + + setCameraNpc(0, 0); } /* 00002D4C-00002D54 .text eventGetItem__11daAuction_cFv */ From 2f6452ea7ac7d12fc2313c634ceb545a8877329d Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Sat, 25 May 2024 16:40:33 +0200 Subject: [PATCH 43/56] daAuction_c::eventGetItemNpcInit matching --- include/d/actor/d_a_auction.h | 2 +- src/d/actor/d_a_auction.cpp | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/include/d/actor/d_a_auction.h b/include/d/actor/d_a_auction.h index 91bcd1436..6f91d1359 100644 --- a/include/d/actor/d_a_auction.h +++ b/include/d/actor/d_a_auction.h @@ -73,7 +73,7 @@ class daAuction_c : public fopNpc_npc_c { void eventGetItemInit(); bool eventGetItem(); void eventCameraOffInit(); - void eventGetItemNpcInit(int); + void eventGetItemNpcInit(int staffIdx); void eventGetItemMesInit(); bool eventCameraOffNpc(); void eventEndInit(); diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index 8cc8ffddd..cdd19524e 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -1168,8 +1168,19 @@ void daAuction_c::eventCameraOffInit() { } /* 00002D70-00002E00 .text eventGetItemNpcInit__11daAuction_cFi */ -void daAuction_c::eventGetItemNpcInit(int) { - /* Nonmatching */ +void daAuction_c::eventGetItemNpcInit(int staffIdx) { + setCameraNpc(m824, 0); + + u32* pTimerData = dComIfGp_evmng_getMyIntegerP(staffIdx, "Timer"); + + if (pTimerData != NULL) { + mTimer = *pTimerData; + } else { + mTimer = 0; + } + + m834 = 0x10; + m829 = m824; } /* 00002E00-00002E40 .text eventGetItemMesInit__11daAuction_cFv */ From e782399b9891dcc73998ad319228d6c12a1bda93 Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Sat, 25 May 2024 22:05:39 +0200 Subject: [PATCH 44/56] daAuction_c::eventGetItemMesInit matching --- include/d/actor/d_a_auction.h | 6 +++--- src/d/actor/d_a_auction.cpp | 18 +++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/d/actor/d_a_auction.h b/include/d/actor/d_a_auction.h index 6f91d1359..ce6ee30b0 100644 --- a/include/d/actor/d_a_auction.h +++ b/include/d/actor/d_a_auction.h @@ -22,7 +22,7 @@ class daAuction_c : public fopNpc_npc_c { void chkNpcExec(int) {} void getAnmNpcNo() {} - void getAucMdlNo(unsigned char) {} + u8 getAucMdlNo(u8 idx) { return mAucMdlNo[idx]; } void getAucNpcNo(unsigned char) {} void getBetNpcNo() {} void getKind(unsigned char) {} @@ -38,7 +38,7 @@ class daAuction_c : public fopNpc_npc_c { } void onCamera(unsigned char) {} void onCameraOld(unsigned char) {} - void setAucMdlNo(unsigned char, unsigned char) {} + void setAucMdlNo(u8 idx, u8 mdlNo) { mAucMdlNo[idx] = mdlNo; } void setItemNo(unsigned char) {} void setKind(unsigned char, unsigned char) {} void setNpcID(int, uint) {} @@ -129,7 +129,7 @@ class daAuction_c : public fopNpc_npc_c { /* 0x808 */ s16 m808; /* 0x80A */ s16 m80A; /* 0x80C */ u8 m80C[8]; - /* 0x814 */ u8 m814[8]; + /* 0x814 */ u8 mAucMdlNo[8]; /* 0x81C */ u8 m81C; /* 0x81D */ u8 m81D; /* 0x81E */ u8 mMoveState; diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index cdd19524e..86be6af2c 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -163,7 +163,7 @@ daAuction_c::daAuction_c() { for (int i = 0; i < 8; i++) { m738[i] = -1; m80C[i] = i; - m814[i] = 0xFF; + mAucMdlNo[i] = 0xFF; } // Shuffles lists randomly (I think) @@ -240,7 +240,7 @@ s32 daAuction_c::createInit() { mNpcEvtInfo.setActorInfo("Auction", this); m824 = 0; m826 = 0xFF; - dComIfGp_setNpcNameMessageID(l_npc_msg_dat[m814[m824]].field_0x00); + dComIfGp_setNpcNameMessageID(l_npc_msg_dat[getAucMdlNo(m824)].field_0x00); mCurrAuctionItemIndex = 0; @@ -736,7 +736,7 @@ bool daAuction_c::eventMain() { } if (m81F <= 1 && m82B != 0) { - dComIfGp_setNpcNameMessageID(l_npc_msg_dat[m814[m824]].field_0x00); + dComIfGp_setNpcNameMessageID(l_npc_msg_dat[getAucMdlNo(m824)].field_0x00); if (dComIfG_getTimerMode() == 4) { dComIfG_TimerStop(2); @@ -888,7 +888,7 @@ void daAuction_c::eventMainKai() { // onCameraOld might be used somewhere here? dComIfGp_setMessageCountNumber(prevItemNameMsgNo); - dComIfGp_setNpcNameMessageID(l_npc_msg_dat[m814[m824]].field_0x00); + dComIfGp_setNpcNameMessageID(l_npc_msg_dat[getAucMdlNo(m824)].field_0x00); setMessage2(msgParam); setCameraNpc(m824, 0); if (m824 == 0 && mCurLinkAnm != 0x1D) { @@ -905,7 +905,7 @@ void daAuction_c::eventMainKai() { m829 = tmp; m827 = tmp; dComIfGp_setMessageCountNumber(m800); - dComIfGp_setNpcNameMessageID(l_npc_msg_dat[m814[m827]].field_0x00); + dComIfGp_setNpcNameMessageID(l_npc_msg_dat[getAucMdlNo(m827)].field_0x00); } m835 |= 9; @@ -997,7 +997,7 @@ void daAuction_c::eventMainUri() { msgParam = 0x1D00; } - dComIfGp_setNpcNameMessageID(l_npc_msg_dat[m814[m824]].field_0x00); + dComIfGp_setNpcNameMessageID(l_npc_msg_dat[getAucMdlNo(m824)].field_0x00); setMessage2(msgParam); setCameraNpc(m824, 0); @@ -1015,7 +1015,7 @@ void daAuction_c::eventMainUri() { m829 = m828_val; m827 = m828_val; dComIfGp_setMessageCountNumber(m800); - dComIfGp_setNpcNameMessageID(l_npc_msg_dat[m814[m827]].field_0x00); + dComIfGp_setNpcNameMessageID(l_npc_msg_dat[getAucMdlNo(m827)].field_0x00); } m835 |= 9; @@ -1088,7 +1088,7 @@ void daAuction_c::eventMainMsgEnd() { void daAuction_c::eventMainMsgBikonC() { m827 = m829 = m828; dComIfGp_setMessageCountNumber(m800); - dComIfGp_setNpcNameMessageID(l_npc_msg_dat[m814[m827]].field_0x00); + dComIfGp_setNpcNameMessageID(l_npc_msg_dat[getAucMdlNo(m827)].field_0x00); cXyz npcPos = getNpcActorP(m827)->current.pos; npcPos.y += getPiconDispOfs(m827) + 30.0f; @@ -1185,7 +1185,7 @@ void daAuction_c::eventGetItemNpcInit(int staffIdx) { /* 00002E00-00002E40 .text eventGetItemMesInit__11daAuction_cFv */ void daAuction_c::eventGetItemMesInit() { - /* Nonmatching */ + setMessage(l_npc_msg_dat[getAucMdlNo(m824)].field_0x08); } /* 00002E40-00002EA0 .text eventCameraOffNpc__11daAuction_cFv */ From cafde19020937ed863890899ab78f043dbee5b5b Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Sun, 26 May 2024 11:32:47 +0200 Subject: [PATCH 45/56] d_a_auction matched some functions --- src/d/actor/d_a_auction.cpp | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index 86be6af2c..5680c5624 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -1190,17 +1190,34 @@ void daAuction_c::eventGetItemMesInit() { /* 00002E40-00002EA0 .text eventCameraOffNpc__11daAuction_cFv */ bool daAuction_c::eventCameraOffNpc() { - /* Nonmatching */ + if (eventMesEnd()) { + m834 = 0; + offCamera(); + return true; + } + + return false; } /* 00002EA0-00002EDC .text eventEndInit__11daAuction_cFv */ void daAuction_c::eventEndInit() { - /* Nonmatching */ + mBlend = 0.0f; + mFlags &= ~4; + + dKy_efplight_cut(&mLight); } /* 00002EDC-00002F60 .text eventEnd__11daAuction_cFv */ bool daAuction_c::eventEnd() { - /* Nonmatching */ + mBlend += 0.05f; + if (mBlend > 1.0f) { + mBlend = 1.0f; + } + + dKy_custom_colset(4, 0, mBlend); + + // "return mBlend == 1.0f" doesn't match for some reason + return mBlend == 1.0f ? true : false; } /* 00002F60-00002F64 .text eventCameraTestInit__11daAuction_cFv */ From 2bac7a82e30b946970d955f8fce01b387973ab86 Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Sun, 26 May 2024 12:24:00 +0200 Subject: [PATCH 46/56] daAuction_c::setCameraNpc matching --- src/d/actor/d_a_auction.cpp | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index 5680c5624..df644f7cc 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -36,6 +36,7 @@ struct NpcCameraDatStruct { // Probably wrong /* 0x00 */ f32 field_0x00; /* 0x04 */ f32 field_0x04; /* 0x08 */ s16 field_0x08; + /* 0x0A */ s16 field_0x0A; }; static cXyz l_camera_pos[3][2] = { @@ -1290,8 +1291,33 @@ fopAc_ac_c* daAuction_c::getNpcActorP(int idx) { } /* 0000387C-000039FC .text setCameraNpc__11daAuction_cFis */ -void daAuction_c::setCameraNpc(int, short) { - /* Nonmatching */ +void daAuction_c::setCameraNpc(int idx, s16 param_2) { + fopAc_ac_c* pActor = getNpcActorP(idx); + + m78C = pActor->current.pos; + m78C.y += l_npc_camera_dat[idx].field_0x04; + + m798.x = l_npc_camera_dat[idx].field_0x00 * cM_ssin(pActor->current.angle.y); + m798.y = 0.0f; + m798.z = l_npc_camera_dat[idx].field_0x00 * cM_scos(pActor->current.angle.y); + + s16 yRot = l_npc_camera_dat[idx].field_0x0A; + if (param_2 != 0) { + yRot += param_2; + } else { + s16 rnd = (s16)cM_rndFX(8000.0f); + yRot += rnd; + } + + mDoMtx_stack_c::YrotS(yRot); + mDoMtx_stack_c::XrotM(l_npc_camera_dat[idx].field_0x08); + + cMtx_multVec(mDoMtx_stack_c::get(), &m798, &m798); + m798 += m78C; + + // onCamera inline + m835 |= 9; + m835 &= ~2; } /* 000039FC-00003A3C .text setLinkAnm__11daAuction_cFUc */ From d5ac9358fdb95e0691776433ec4cb517a7715c72 Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Sun, 26 May 2024 12:35:49 +0200 Subject: [PATCH 47/56] daAuction_c::nextBet matching --- src/d/actor/d_a_auction.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index df644f7cc..3cead7b89 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -1345,7 +1345,25 @@ f32 daAuction_c::getPiconDispOfs(u8 param) { /* 00003A74-00003BA4 .text nextBet__11daAuction_cFv */ void daAuction_c::nextBet() { - /* Nonmatching */ + if (m831 != 0) { + m831 -= 1; + return; + } + + for (int i = 1; i < 7; i++) { + f32 rnd = getRand(60 - (int)(dComIfG_getTimerRestTimeMs() / 1000)); + if (rnd > 50.0f) { + rnd = 50.0f; + } + + m7C4[i] += rnd; + + if (m7C4[i] >= 100.0f) { + m831 += 1; + } + } + + m831 += 2; } /* 00003BA4-00003C08 .text getRand__11daAuction_cFi */ From 156b37bf0c2e286d33590d165f1d6576e7b4c253 Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Tue, 28 May 2024 12:58:34 +0200 Subject: [PATCH 48/56] daAuction_c::privateCut Fixed matching --- src/d/actor/d_a_auction.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index 3cead7b89..b3ea2b1ff 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -519,7 +519,7 @@ void daAuction_c::privateCut() { evtRes = eventGetItem(); break; case 7: - evtRes = false; // TODO: __ptmf_test + evtRes = &eventMesSet != NULL; break; case 8: evtRes = eventCameraOffNpc(); From 352ef96e720ecca5cbba051f0301bebeeda298c6 Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Tue, 28 May 2024 14:58:14 +0200 Subject: [PATCH 49/56] d_a_auction .data section matching --- src/d/actor/d_a_auction.cpp | 61 +++++++++++++++++++++++++++++++++++-- 1 file changed, 58 insertions(+), 3 deletions(-) diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index b3ea2b1ff..9310a9544 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -74,11 +74,30 @@ static daAuction_c::ItemData l_item_dat2[] = { static s16 l_item_dat22[] = {0x002A, 0x00F9}; static NpcDatStruct l_npc_dat[7] = { - NULL, + {2.0f, 2.1f, 0x0, 0x0, 0x3E8}, + {0.3f, 0.5f, 0x4, 0x6, 0x1C2}, + {0.3f, 0.6f, 0x3, 0x7, 0x1F4}, + {0.4f, 0.7f, 0x2, 0x4, 0x0FA}, + {0.5f, 1.0f, 0x2, 0x3, 0x3DE}, + {0.4f, 0.5f, 0x3, 0x4, 0x3DE}, + {0.7f, 1.2f, 0x2, 0x2, 0x096}, }; static NpcMsgDatStruct l_npc_msg_dat[12] = { - NULL, + {0x33AC, 0x1D3A, 0x1D3B, 0x1D3C, 0x33B6}, + {0x33AD, 0x1D3D, 0x1D3E, 0x1D3F, 0x33B7}, + {0x33AE, 0x1D40, 0x1D41, 0x1D42, 0x33B8}, + {0x33AF, 0x1D43, 0x1D44, 0x1D45, 0x33B9}, + {0x33B0, 0x1D46, 0x1D47, 0x1D48, 0x33BA}, + {0x33B1, 0x1D49, 0x1D4A, 0x1D4B, 0x33BB}, + + {0x33B2, 0x339D, 0x339E, 0x339F, 0x33BC}, + {0x33B3, 0x33A0, 0x33A1, 0x33A2, 0x33BD}, + {0x33B4, 0x33A3, 0x33A4, 0x33A5, 0x33BE}, + {0x33B5, 0x33A6, 0x33A7, 0x33A8, 0x33BF}, + + {0x1CE9, 0x0000, 0x0000, 0x0000, 0x0000}, + {0x1CE9, 0x0000, 0x0000, 0x0000, 0x0000}, }; static NpcCameraDatStruct l_npc_camera_dat[7] = { @@ -97,6 +116,7 @@ static f32 l_npc_emitter_ofsy[8] = { 180.0f, 180.0f, 180.0f, + 180.0f, 210.0f, 180.0f, }; @@ -127,14 +147,49 @@ static s16 l_rest_msg_time2[4] = { }; static u32 l_rest_msg_no[3] = { + 0x1D01, + 0x1D02, + 0x1D03, }; static u32 l_rest_se_no[3] = { + JA_SE_AUC_LAST_SPURT, + JA_SE_AUC_FEW_TIME, + JA_SE_AUC_5_SEC, +}; + +static f32 l_after_bet_rate[4] = {2.0f, 1.5f, 1.2f, 1.1f}; +static s16 l_after_bet_chk[4] = { + 0x0014, + 0x0014, + 0x0028, + 0x0028, }; -static u32 l_link_face[8] = { +static u32 l_after_bet_msg_no[4] = { + 0x1D23, + 0x1D22, + 0x1D21, + 0x1D20, +}; + +static s16 l_after_bet_wait[4][2] = { + {8, 10}, + {7, 10}, + {6, 9}, + {5, 8}, +}; +static daPy_py_c::daPy_FACE l_link_face[8] = { + daPy_py_c::daPyFace_TMABAA, + daPy_py_c::daPyFace_TMABAC, + daPy_py_c::daPyFace_TMABACB, + daPy_py_c::daPyFace_TMABAE, + daPy_py_c::daPyFace_TMABAF, + daPy_py_c::daPyFace_TMABAG, + daPy_py_c::daPyFace_TMABAH, + daPy_py_c::daPyFace_TMABAJ_TEYORIME, }; #ifdef DEBUG From 5aeeac8cd1d5ba8de084ac7ae9f290bafbec7e14 Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Tue, 28 May 2024 17:27:27 +0200 Subject: [PATCH 50/56] daAuction_c::next_msgStatus WIP --- src/d/actor/d_a_auction.cpp | 180 +++++++++++++++++++++++++++++++++++- 1 file changed, 179 insertions(+), 1 deletion(-) diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index 9310a9544..88c216752 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -204,6 +204,7 @@ static daAuction_c::ProcFunc_t moveProc[] = { }; extern void dAuction_screen_delete(); +extern void dAuction_screen_slotShow(); extern void dAuction_screen_slotHide(); extern void dAuction_screen_gaugeHide(); extern void dAuction_screen_gaugeShow(); @@ -1288,7 +1289,184 @@ bool daAuction_c::eventCameraTest() { /* 00002F6C-0000369C .text next_msgStatus__11daAuction_cFPUl */ u16 daAuction_c::next_msgStatus(u32* pMsgNo) { - /* Nonmatching */ + u16 ret = 0xF; + + //if (*pMsgNo != 0x1D1F) { + // if (*pMsgNo < 0x1D1F) { + switch (*pMsgNo) { + case 0x1CF2: + *pMsgNo = 0x1CF3; + break; + case 0x1CF4: + if (m822 == 2) { + *pMsgNo = 0x1D1B; + break; + } + + if (dComIfGs_isEventBit(0x4008)) { + dComIfGp_setNpcNameMessageID(l_npc_msg_dat[dComIfGs_getEventReg(0x790F)].field_0x00); + *pMsgNo = 0x1CF6; + } else { + *pMsgNo = 0x1CF5; + } + break; + case 0x1CF7: + dComIfGp_setMiniGameRupee(mCurrItemNameMsgNo); + dComIfGp_setAuctionRupee(mCurrItemNameMsgNo); + dAuction_screen_slotShow(); + *pMsgNo = 0x1CF8; + break; + case 0x1CF9: + dComIfGp_setMiniGameRupee(mCurrItemNameMsgNo); + dComIfGp_setAuctionRupee(mCurrItemNameMsgNo); + if (m82C < 4) { + *pMsgNo = l_after_bet_msg_no[m82C]; + } else if (m827 == 0 && l_npc_msg_dat[getAucMdlNo(m824)].field_0x02 != 0) { + if (dComIfG_getTimerRestTimeMs() < 60000) { + *pMsgNo = l_npc_msg_dat[getAucMdlNo(m824)].field_0x04; + } else { + *pMsgNo = l_npc_msg_dat[getAucMdlNo(m824)].field_0x02; + } + } else { + ret = 0x10; + } + + m825 = m824; + u8 tmp = m827; + m826 = tmp; + m824 = tmp; + if (m826 != 0) { + setLinkAnm(1); + } + break; + case 0x1CFA: + s16 msgSetNo = dComIfGp_getMessageSetNumber(); + + if (dComIfGs_getRupee() < msgSetNo) { + mDoAud_seStart(JA_SE_AUC_BID_NG); + setLinkAnm(0x4A); + *pMsgNo = 0x1CFB; + m7C4[0] = 50.0f; + } else if (msgSetNo <= mCurrItemNameMsgNo) { + mDoAud_seStart(JA_SE_AUC_BID_NG); + setLinkAnm(0x4A); + *pMsgNo = 0x1D1E; + m7C4[0] = 50.0f; + } else { + mDoAud_seStart(JA_SE_AUC_BID_OK); + + m7C4[0] = 0.0f; + if (msgSetNo == 999) { + *pMsgNo = 0x1D24; + m825 = m824; + u8 tmp = m827; + m826 = tmp; + m824 = tmp; + } else { + *pMsgNo = 0x1CF9; + m82C = 4; // ? + + for (m82C = 0; m82C < 4; m82C++) { + if (msgSetNo >= (s16)(mCurrItemNameMsgNo * l_after_bet_rate[m82C]) && msgSetNo >= l_after_bet_chk[m82C]) { + m806 = (s16)(60.0f * (RAND_RANGE(l_after_bet_wait[m82C][0], l_after_bet_wait[m82C][1]))); + break; + } + } + } + + mCurrItemNameMsgNo = msgSetNo; + dComIfGp_setMessageCountNumber(mCurrItemNameMsgNo); + } + break; + case 0x1CFC: + if (mpCurrMsg->mSelectNum == 0) { + *pMsgNo = 0x1D1F; + } else { + ret = 0x10; + } + break; + case 0x1D1A: + if (mpCurrMsg->mSelectNum == 0) { + m82B = 1; + } + + ret = 0x10; + break; + + case 0x1D1F: + dComIfGp_setNextStage("sea", 3, 11); + case 0x1D24: + m82B = 1; + ret = 0x10; + break; + + default: + setLinkAnm(0x14); + int rnd = getRand(6) + 1; + *pMsgNo = l_npc_msg_dat[getAucMdlNo(rnd)].field_0x06; + m825 = rnd; + break; + + case 0x1D48: + case 0x33A2: + case 0x33A8: + case 0x33A5: + case 0x339F: + case 0x1D4B: + case 0x1D3F: + case 0x1D45: + case 0x1D42: + case 0x1D3C: + this->m834 |= 2; + this->m808 = 0; + ret = 0x10; + break; + + case 0x1D05: + if (m822 == 2) { + *pMsgNo = 0x1D1C; + } else { + if (m824 != 0) { + dComIfGs_onEventBit(0x4008); + dComIfGs_setEventReg(0x790F, getAucMdlNo(m824)); + dComIfGs_setEventReg(0xCD03, mCurrAuctionItemIndex); + } else { + dComIfGs_offEventBit(0x4008); + } + + fopAcM_delete(mCurrAuctionItemPID); + ret = 0x10; + } + break; + case 0x1D1C: + dComIfGp_setItemRupeeCount(mCurrItemNameMsgNo); + ret = 0x10; + break; + case 0x1D07: + dComIfGp_setItemRupeeCount(-mCurrItemNameMsgNo); + *pMsgNo = 0x1D08; + break; + case 0x1D1D: + case 0x1D08: + *pMsgNo = 0x1D09; + break; + case 0x1CF3: + ret = 0x10; + break; + + //} + // } else { + //if (*pMsgNo == 0x1D48 || *pMsgNo == 0x33A2 || *pMsgNo == 0x33A8 || *pMsgNo == 0x33A5 ||) + // } + } + + if (ret == 0xF) { + m7EC = *pMsgNo; + } else { + m7EC = 0; + } + + return ret; } /* 0000369C-000036AC .text setMessage__11daAuction_cFUl */ From ce3fb4fc6c5b0459642d9cb990c36be6abda68d1 Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Tue, 28 May 2024 20:32:11 +0200 Subject: [PATCH 51/56] daAuction_c::next_msgStatus matching --- src/d/actor/d_a_auction.cpp | 306 ++++++++++++++++++------------------ 1 file changed, 153 insertions(+), 153 deletions(-) diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index 88c216752..f2bacf21b 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -1291,173 +1291,173 @@ bool daAuction_c::eventCameraTest() { u16 daAuction_c::next_msgStatus(u32* pMsgNo) { u16 ret = 0xF; - //if (*pMsgNo != 0x1D1F) { - // if (*pMsgNo < 0x1D1F) { - switch (*pMsgNo) { - case 0x1CF2: - *pMsgNo = 0x1CF3; - break; - case 0x1CF4: - if (m822 == 2) { - *pMsgNo = 0x1D1B; - break; - } + switch (*pMsgNo) { + case 0x1CF2: + *pMsgNo = 0x1CF3; + break; + case 0x1CF4: + if (m822 == 2) { + *pMsgNo = 0x1D1B; + break; + } - if (dComIfGs_isEventBit(0x4008)) { - dComIfGp_setNpcNameMessageID(l_npc_msg_dat[dComIfGs_getEventReg(0x790F)].field_0x00); - *pMsgNo = 0x1CF6; - } else { - *pMsgNo = 0x1CF5; - } - break; - case 0x1CF7: - dComIfGp_setMiniGameRupee(mCurrItemNameMsgNo); - dComIfGp_setAuctionRupee(mCurrItemNameMsgNo); - dAuction_screen_slotShow(); - *pMsgNo = 0x1CF8; - break; - case 0x1CF9: - dComIfGp_setMiniGameRupee(mCurrItemNameMsgNo); - dComIfGp_setAuctionRupee(mCurrItemNameMsgNo); - if (m82C < 4) { - *pMsgNo = l_after_bet_msg_no[m82C]; - } else if (m827 == 0 && l_npc_msg_dat[getAucMdlNo(m824)].field_0x02 != 0) { - if (dComIfG_getTimerRestTimeMs() < 60000) { - *pMsgNo = l_npc_msg_dat[getAucMdlNo(m824)].field_0x04; - } else { - *pMsgNo = l_npc_msg_dat[getAucMdlNo(m824)].field_0x02; - } - } else { - ret = 0x10; - } + if (dComIfGs_isEventBit(0x4008)) { + dComIfGp_setNpcNameMessageID(l_npc_msg_dat[dComIfGs_getEventReg(0x790F)].field_0x00); + *pMsgNo = 0x1CF6; + } else { + *pMsgNo = 0x1CF5; + } + break; + case 0x1CF7: + dComIfGp_setMiniGameRupee(mCurrItemNameMsgNo); + dComIfGp_setAuctionRupee(mCurrItemNameMsgNo); + dAuction_screen_slotShow(); + *pMsgNo = 0x1CF8; + break; + case 0x1CF9: + dComIfGp_setMiniGameRupee(mCurrItemNameMsgNo); + dComIfGp_setAuctionRupee(mCurrItemNameMsgNo); + if (m82C < 4) { + *pMsgNo = l_after_bet_msg_no[m82C]; + } else if (m827 == 0 && l_npc_msg_dat[getAucMdlNo(m824)].field_0x02 != 0) { + if (dComIfG_getTimerRestTimeMs() < 60000) { + *pMsgNo = l_npc_msg_dat[getAucMdlNo(m824)].field_0x04; + } else { + *pMsgNo = l_npc_msg_dat[getAucMdlNo(m824)].field_0x02; + } + } else { + ret = 0x10; + } + m825 = m824; + u8 tmp = m827; + m826 = tmp; + m824 = tmp; + if (m826 != 0) { + setLinkAnm(1); + } + break; + case 0x1CFA: + s16 msgSetNo = dComIfGp_getMessageSetNumber(); + + if (dComIfGs_getRupee() < msgSetNo) { + mDoAud_seStart(JA_SE_AUC_BID_NG); + setLinkAnm(0x4A); + *pMsgNo = 0x1CFB; + m7C4[0] = 50.0f; + } else if (msgSetNo <= mCurrItemNameMsgNo) { + mDoAud_seStart(JA_SE_AUC_BID_NG); + setLinkAnm(0x4A); + *pMsgNo = 0x1D1E; + m7C4[0] = 50.0f; + } else { + mDoAud_seStart(JA_SE_AUC_BID_OK); + + m7C4[0] = 0.0f; + if (msgSetNo == 999) { + *pMsgNo = 0x1D24; m825 = m824; u8 tmp = m827; m826 = tmp; m824 = tmp; - if (m826 != 0) { - setLinkAnm(1); - } - break; - case 0x1CFA: - s16 msgSetNo = dComIfGp_getMessageSetNumber(); - - if (dComIfGs_getRupee() < msgSetNo) { - mDoAud_seStart(JA_SE_AUC_BID_NG); - setLinkAnm(0x4A); - *pMsgNo = 0x1CFB; - m7C4[0] = 50.0f; - } else if (msgSetNo <= mCurrItemNameMsgNo) { - mDoAud_seStart(JA_SE_AUC_BID_NG); - setLinkAnm(0x4A); - *pMsgNo = 0x1D1E; - m7C4[0] = 50.0f; - } else { - mDoAud_seStart(JA_SE_AUC_BID_OK); - - m7C4[0] = 0.0f; - if (msgSetNo == 999) { - *pMsgNo = 0x1D24; - m825 = m824; - u8 tmp = m827; - m826 = tmp; - m824 = tmp; - } else { - *pMsgNo = 0x1CF9; - m82C = 4; // ? - - for (m82C = 0; m82C < 4; m82C++) { - if (msgSetNo >= (s16)(mCurrItemNameMsgNo * l_after_bet_rate[m82C]) && msgSetNo >= l_after_bet_chk[m82C]) { - m806 = (s16)(60.0f * (RAND_RANGE(l_after_bet_wait[m82C][0], l_after_bet_wait[m82C][1]))); - break; - } - } + } else { + *pMsgNo = 0x1CF9; + m82C = 4; // ? + + for (m82C = 0; m82C < 4; m82C++) { + if (msgSetNo >= (s16)(mCurrItemNameMsgNo * l_after_bet_rate[m82C]) && + mCurrItemNameMsgNo >= l_after_bet_chk[m82C]) + { + m806 = (s16)(60.0f * (RAND_RANGE(l_after_bet_wait[m82C][0], + l_after_bet_wait[m82C][1]))); + break; } - - mCurrItemNameMsgNo = msgSetNo; - dComIfGp_setMessageCountNumber(mCurrItemNameMsgNo); } - break; - case 0x1CFC: - if (mpCurrMsg->mSelectNum == 0) { - *pMsgNo = 0x1D1F; - } else { - ret = 0x10; - } - break; - case 0x1D1A: - if (mpCurrMsg->mSelectNum == 0) { - m82B = 1; - } - - ret = 0x10; - break; + } - case 0x1D1F: - dComIfGp_setNextStage("sea", 3, 11); - case 0x1D24: - m82B = 1; + mCurrItemNameMsgNo = msgSetNo; + dComIfGp_setMessageCountNumber(mCurrItemNameMsgNo); + } + break; + case 0x1CFC: + if (mpCurrMsg->mSelectNum == 0) { + *pMsgNo = 0x1D1F; + } else { ret = 0x10; - break; + } + break; + case 0x1D1A: + if (mpCurrMsg->mSelectNum == 0) { + m82B = 1; + } - default: - setLinkAnm(0x14); - int rnd = getRand(6) + 1; - *pMsgNo = l_npc_msg_dat[getAucMdlNo(rnd)].field_0x06; - m825 = rnd; - break; + ret = 0x10; + break; - case 0x1D48: - case 0x33A2: - case 0x33A8: - case 0x33A5: - case 0x339F: - case 0x1D4B: - case 0x1D3F: - case 0x1D45: - case 0x1D42: - case 0x1D3C: - this->m834 |= 2; - this->m808 = 0; - ret = 0x10; - break; + case 0x1D1F: + dComIfGp_setNextStage("sea", 3, 11); + case 0x1D24: + m82B = 1; + ret = 0x10; + break; - case 0x1D05: - if (m822 == 2) { - *pMsgNo = 0x1D1C; - } else { - if (m824 != 0) { - dComIfGs_onEventBit(0x4008); - dComIfGs_setEventReg(0x790F, getAucMdlNo(m824)); - dComIfGs_setEventReg(0xCD03, mCurrAuctionItemIndex); - } else { - dComIfGs_offEventBit(0x4008); - } + case 0x1D20: + case 0x1D21: + case 0x1D22: + case 0x1D23: + setLinkAnm(0x14); + int rnd = getRand(6) + 1; + *pMsgNo = l_npc_msg_dat[getAucMdlNo(rnd)].field_0x06; + m825 = rnd; + break; - fopAcM_delete(mCurrAuctionItemPID); - ret = 0x10; - } - break; - case 0x1D1C: - dComIfGp_setItemRupeeCount(mCurrItemNameMsgNo); - ret = 0x10; - break; - case 0x1D07: - dComIfGp_setItemRupeeCount(-mCurrItemNameMsgNo); - *pMsgNo = 0x1D08; - break; - case 0x1D1D: - case 0x1D08: - *pMsgNo = 0x1D09; - break; - case 0x1CF3: - ret = 0x10; - break; - - //} - // } else { - //if (*pMsgNo == 0x1D48 || *pMsgNo == 0x33A2 || *pMsgNo == 0x33A8 || *pMsgNo == 0x33A5 ||) - // } + case 0x1D48: + case 0x33A2: + case 0x33A8: + case 0x33A5: + case 0x339F: + case 0x1D4B: + case 0x1D3F: + case 0x1D45: + case 0x1D42: + case 0x1D3C: + this->m834 |= 2; + this->m808 = 0; + ret = 0x10; + break; + + case 0x1D05: + if (m822 == 2) { + *pMsgNo = 0x1D1C; + } else { + if (m824 != 0) { + dComIfGs_onEventBit(0x4008); + dComIfGs_setEventReg(0x790F, getAucMdlNo(m824)); + dComIfGs_setEventReg(0xCD03, mCurrAuctionItemIndex); + } else { + dComIfGs_offEventBit(0x4008); + } + + fopAcM_delete(mCurrAuctionItemPID); + ret = 0x10; + } + break; + case 0x1D1C: + dComIfGp_setItemRupeeCount(mCurrItemNameMsgNo); + ret = 0x10; + break; + case 0x1D07: + dComIfGp_setItemRupeeCount(-mCurrItemNameMsgNo); + *pMsgNo = 0x1D08; + break; + case 0x1D1D: + case 0x1D08: + *pMsgNo = 0x1D09; + break; + + default: + ret = 0x10; + break; } if (ret == 0xF) { From 6f4b2d4518ee29cb13887632d8131eac1d075686 Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Wed, 29 May 2024 18:02:50 +0200 Subject: [PATCH 52/56] Fixed variable names --- src/d/d_com_inf_game.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/d/d_com_inf_game.cpp b/src/d/d_com_inf_game.cpp index 697650ea3..2e737e706 100644 --- a/src/d/d_com_inf_game.cpp +++ b/src/d/d_com_inf_game.cpp @@ -93,8 +93,8 @@ void dComIfG_play_c::itemInit() { mMsgCountNumber = 0; mMsgSetNumber = 0; mMessageRupee = 0; - field_0x491e = 0; - field_0x4920 = 0; + mAuctionRupee = 0; + mAuctionGauge = 0; field_0x4922 = 0; mCurrHP = 0; mRupyCountDisplay = 0; From f22a1592a6a7c7334c09600503def9d0e69245c3 Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Fri, 31 May 2024 13:40:27 +0200 Subject: [PATCH 53/56] d_a_auction cleanup --- configure.py | 2 +- include/d/actor/d_a_auction.h | 9 ++-- src/d/actor/d_a_auction.cpp | 80 +++++++++++++++-------------------- 3 files changed, 40 insertions(+), 51 deletions(-) diff --git a/configure.py b/configure.py index a4cdf1414..deab7103b 100644 --- a/configure.py +++ b/configure.py @@ -1393,7 +1393,7 @@ def DolphinLib(lib_name, objects): ActorRel(NonMatching, "d_a_wind_tag"), ActorRel(NonMatching, "d_a_acorn_leaf"), ActorRel(NonMatching, "d_a_atdoor"), - ActorRel(NonMatching, "d_a_auction"), + ActorRel(Matching, "d_a_auction", extra_cflags=['-pragma "nosyminline on"']), ActorRel(NonMatching, "d_a_bb"), ActorRel(NonMatching, "d_a_bdk"), ActorRel(NonMatching, "d_a_bdkobj"), diff --git a/include/d/actor/d_a_auction.h b/include/d/actor/d_a_auction.h index ce6ee30b0..ea5fe0b33 100644 --- a/include/d/actor/d_a_auction.h +++ b/include/d/actor/d_a_auction.h @@ -86,7 +86,7 @@ class daAuction_c : public fopNpc_npc_c { void setMtx(); u8 getItemNo(); fopAc_ac_c* getNpcActorP(int idx); - void setCameraNpc(int, short); + void setCameraNpc(int, s16); void setLinkAnm(u8 linkAnm); f32 getPiconDispOfs(u8 param); void nextBet(); @@ -95,7 +95,6 @@ class daAuction_c : public fopNpc_npc_c { public: /* 0x6C4 */ request_of_phase_process_class mPhs; /* 0x6CC */ dNpc_EventCut_c mNpcEvtInfo; - //* 0x730 */ u8 m730[0x738 - 0x730]; /* 0x738 */ u32 m738[8]; /* 0x758 */ uint mCurrAuctionItemPID; /* 0x75C */ uint mTimerID; @@ -110,7 +109,7 @@ class daAuction_c : public fopNpc_npc_c { /* 0x7B4 */ u8 m7B4[0x7BC - 0x7B4]; /* 0x7BC */ f32 mAlpha; /* 0x7C0 */ f32 mBlend; - /* 0x7C4 */ f32 m7C4[7]; + /* 0x7C4 */ f32 m7C4[7]; // Npc wait timer? /* 0x7E0 */ f32 m7E0; /* 0x7E4 */ f32 m7E4; /* 0x7E8 */ u8 m7E8[0x7EC - 0x7E8]; @@ -121,7 +120,7 @@ class daAuction_c : public fopNpc_npc_c { /* 0x7F8 */ s16 mEvtNoItemIdx; /* 0x7FA */ s16 mEvtStart2Idx; /* 0x7FC */ s16 mEvtEnd2Idx; - /* 0x7FE */ s16 mCurrItemNameMsgNo; + /* 0x7FE */ s16 mCurrItemNameMsgNo; // Current bid? /* 0x800 */ s16 m800; /* 0x802 */ s16 mTimer; /* 0x804 */ u16 m804; @@ -152,7 +151,7 @@ class daAuction_c : public fopNpc_npc_c { /* 0x82F */ u8 m82F; /* 0x830 */ u8 m830; /* 0x831 */ u8 m831; - /* 0x832 */ u8 m832; /* Might be mode index */ + /* 0x832 */ u8 m832; /* 0x833 */ u8 mFace; /* 0x834 */ u8 m834; /* 0x835 */ u8 m835; diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index f2bacf21b..8317c5a95 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -12,16 +12,12 @@ #include "d/res/res_auction.h" #include "m_Do/m_Do_controller_pad.h" -// TODO: Remove this. It's just here to make the code more readable. -#define RAND_RANGE(a, b) (a + cM_rndF(b - a)) - -/* Structs are almost definitely not accurate */ struct NpcDatStruct { - /* 0x00 */ f32 field_0x00; - /* 0x04 */ f32 field_0x04; - /* 0x08 */ s16 field_0x08; - /* 0x0A */ s16 field_0x0A; - /* 0x0C */ s16 field_0x0C; + /* 0x00 */ f32 field_0x00; // Random float range min + /* 0x04 */ f32 field_0x04; // Random float range max + /* 0x08 */ s16 field_0x08; // Random short range min + /* 0x0A */ s16 field_0x0A; // Random short range max + /* 0x0C */ s16 field_0x0C; // Might be amount of rupees the npc has }; struct NpcMsgDatStruct { @@ -32,26 +28,30 @@ struct NpcMsgDatStruct { /* 0x08 */ s16 field_0x08; }; -struct NpcCameraDatStruct { // Probably wrong +struct NpcCameraDatStruct { /* 0x00 */ f32 field_0x00; /* 0x04 */ f32 field_0x04; /* 0x08 */ s16 field_0x08; /* 0x0A */ s16 field_0x0A; }; +static u8 dummy_bss[0x4C]; + static cXyz l_camera_pos[3][2] = { cXyz(-265.0f, 48.0f, -631.0f), cXyz(332.0f, 232.0f, 286.0f), - cXyz(-50.0f, 202.0f, 137.0f), cXyz(-87.0f, 239.0f, 330.0f), - cXyz(-216.0f, 205.0f, 5.0f), cXyz(-379.0f, 238.0f, 115.0f), }; +#ifdef DEBUG +static daAuction_HIO_c l_HIO; +#endif + // Needed for the .data section to match. static f32 dummy1[3] = {1.0f, 1.0f, 1.0f}; static f32 dummy2[3] = {1.0f, 1.0f, 1.0f}; @@ -74,13 +74,13 @@ static daAuction_c::ItemData l_item_dat2[] = { static s16 l_item_dat22[] = {0x002A, 0x00F9}; static NpcDatStruct l_npc_dat[7] = { - {2.0f, 2.1f, 0x0, 0x0, 0x3E8}, - {0.3f, 0.5f, 0x4, 0x6, 0x1C2}, - {0.3f, 0.6f, 0x3, 0x7, 0x1F4}, - {0.4f, 0.7f, 0x2, 0x4, 0x0FA}, - {0.5f, 1.0f, 0x2, 0x3, 0x3DE}, - {0.4f, 0.5f, 0x3, 0x4, 0x3DE}, - {0.7f, 1.2f, 0x2, 0x2, 0x096}, + {2.0f, 2.1f, 0x0, 0x0, 1000}, + {0.3f, 0.5f, 0x4, 0x6, 450 }, + {0.3f, 0.6f, 0x3, 0x7, 500 }, + {0.4f, 0.7f, 0x2, 0x4, 250 }, + {0.5f, 1.0f, 0x2, 0x3, 990 }, + {0.4f, 0.5f, 0x3, 0x4, 990 }, + {0.7f, 1.2f, 0x2, 0x2, 150 }, }; static NpcMsgDatStruct l_npc_msg_dat[12] = { @@ -192,11 +192,6 @@ static daPy_py_c::daPy_FACE l_link_face[8] = { daPy_py_c::daPyFace_TMABAJ_TEYORIME, }; -#ifdef DEBUG -// TODO: Figure out what these are -static daAuction_HIO_c l_HIO; -#endif - static daAuction_c::ProcFunc_t moveProc[] = { daAuction_c::executeWait, daAuction_c::executeNormal, @@ -216,14 +211,13 @@ extern uint dAuction_screen_create(); /* 000000EC-000002FC .text __ct__11daAuction_cFv */ daAuction_c::daAuction_c() { - // TODO: Refactor this for (int i = 0; i < 8; i++) { m738[i] = -1; m80C[i] = i; mAucMdlNo[i] = 0xFF; } - // Shuffles lists randomly (I think) + // Shuffles item order (I think) for (int i = 0; i < 100; i++) { int rnd1 = getRand(6); int rnd2 = getRand(6); @@ -397,7 +391,6 @@ void daAuction_c::executeStart() {} /* 00000B4C-00000C68 .text checkOrder__11daAuction_cFv */ void daAuction_c::checkOrder() { if (eventInfo.checkCommandDemoAccrpt()) { - // Might be unrolled loop? if (dComIfGp_evmng_startCheck(mEvtStartIdx) && m838 == 3) { m838 = 0; } else if (dComIfGp_evmng_startCheck(mEvtGetItemIdx) && m838 == 4) { @@ -647,9 +640,9 @@ void daAuction_c::eventStartInit() { m820 = ~1; if (m822 == 2) { - mTimerID = dTimer_createTimer(4, 0x1E, 1, 0, 221.0f, 439.0f, 32.0f, 419.0f); + mTimerID = dTimer_createTimer(4, 30, 1, 0, 221.0f, 439.0f, 32.0f, 419.0f); } else { - mTimerID = dTimer_createTimer(4, 0x3C, 1, 0, 221.0f, 439.0f, 32.0f, 419.0f); + mTimerID = dTimer_createTimer(4, 60, 1, 0, 221.0f, 439.0f, 32.0f, 419.0f); } JUT_ASSERT(0x861, mTimerID != fpcM_ERROR_PROCESS_ID_e); @@ -704,7 +697,7 @@ bool daAuction_c::eventStart() { /* 000016AC-0000188C .text eventMainInit__11daAuction_cFv */ void daAuction_c::eventMainInit() { - m804 = 0xE10; + m804 = 3600; for (int i = 0; i < 7; i++) { m7C4[i] = 0.0f; @@ -791,7 +784,7 @@ bool daAuction_c::eventMain() { if (m822 == 1) { dComIfGp_setAuctionGauge((s16)m7C4[0]); } - + if (m81F <= 1 && m82B != 0) { dComIfGp_setNpcNameMessageID(l_npc_msg_dat[getAucMdlNo(m824)].field_0x00); @@ -933,11 +926,11 @@ void daAuction_c::eventMainKai() { } else if (m826 != 0xFF && idx != 0 && dComIfG_getTimerRestTimeMs() > l_rest_msg_time1[0] && getRand(3) == 0) { u32 msgParam; - if (mCurrItemNameMsgNo <= 0x64) { + if (mCurrItemNameMsgNo <= 100) { msgParam = 0x1CFD; - } else if (mCurrItemNameMsgNo <= 0x96) { + } else if (mCurrItemNameMsgNo <= 150) { msgParam = 0x1CFE; - } else if (mCurrItemNameMsgNo <= 0xC8) { + } else if (mCurrItemNameMsgNo <= 200) { msgParam = 0x1CFF; } else { msgParam = 0x1D00; @@ -1004,7 +997,7 @@ void daAuction_c::eventMainUri() { m806 -= 1; } else { for (int i = 1; i < 7; i++) { - m7C4[i] += 2.0f * RAND_RANGE(l_npc_dat[i].field_0x00, l_npc_dat[i].field_0x04); + m7C4[i] += 2.0f * (l_npc_dat[i].field_0x00 + cM_rndF(l_npc_dat[i].field_0x04 - l_npc_dat[i].field_0x00)); } } @@ -1030,7 +1023,7 @@ void daAuction_c::eventMainUri() { multiplier = 1.5f; } - mCurrItemNameMsgNo += (s16)(multiplier * (2 * (s16)RAND_RANGE(l_npc_dat[idx].field_0x08, l_npc_dat[idx].field_0x0A))); + mCurrItemNameMsgNo += (s16)(multiplier * (2 * (s16)(l_npc_dat[idx].field_0x08 + cM_rndF(l_npc_dat[idx].field_0x0A - l_npc_dat[idx].field_0x08)))); m800 = mCurrItemNameMsgNo; m7F0 = 0x1CF9; m82C = 4; @@ -1044,11 +1037,11 @@ void daAuction_c::eventMainUri() { } else if (dComIfG_getTimerRestTimeMs() > l_rest_msg_time1[0] && getRand(3) == 0) { u32 msgParam; - if (mCurrItemNameMsgNo <= 0x64) { + if (mCurrItemNameMsgNo <= 100) { msgParam = 0x1CFD; - } else if (mCurrItemNameMsgNo <= 0x96) { + } else if (mCurrItemNameMsgNo <= 150) { msgParam = 0x1CFE; - } else if (mCurrItemNameMsgNo <= 0xC8) { + } else if (mCurrItemNameMsgNo <= 200) { msgParam = 0x1CFF; } else { msgParam = 0x1D00; @@ -1278,9 +1271,7 @@ bool daAuction_c::eventEnd() { } /* 00002F60-00002F64 .text eventCameraTestInit__11daAuction_cFv */ -void daAuction_c::eventCameraTestInit() { - /* Nonmatching */ -} +void daAuction_c::eventCameraTestInit() {} /* 00002F64-00002F6C .text eventCameraTest__11daAuction_cFv */ bool daAuction_c::eventCameraTest() { @@ -1368,8 +1359,7 @@ u16 daAuction_c::next_msgStatus(u32* pMsgNo) { if (msgSetNo >= (s16)(mCurrItemNameMsgNo * l_after_bet_rate[m82C]) && mCurrItemNameMsgNo >= l_after_bet_chk[m82C]) { - m806 = (s16)(60.0f * (RAND_RANGE(l_after_bet_wait[m82C][0], - l_after_bet_wait[m82C][1]))); + m806 = (s16)(60.0f * (l_after_bet_wait[m82C][0] + cM_rndF(l_after_bet_wait[m82C][1] - l_after_bet_wait[m82C][0]))); break; } } @@ -1584,7 +1574,7 @@ void daAuction_c::nextBet() { } for (int i = 1; i < 7; i++) { - f32 rnd = getRand(60 - (int)(dComIfG_getTimerRestTimeMs() / 1000)); + f32 rnd = getRand(60 - (dComIfG_getTimerRestTimeMs() / 1000)); if (rnd > 50.0f) { rnd = 50.0f; } From 02f6de4c51124b6543c67d531c3ad269bbbe4a50 Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Fri, 31 May 2024 18:24:59 +0200 Subject: [PATCH 54/56] d_a_auction more cleanup --- include/d/actor/d_a_auction.h | 2 +- src/d/actor/d_a_auction.cpp | 79 +++++++++++++++++------------------ 2 files changed, 40 insertions(+), 41 deletions(-) diff --git a/include/d/actor/d_a_auction.h b/include/d/actor/d_a_auction.h index ea5fe0b33..6095c3baa 100644 --- a/include/d/actor/d_a_auction.h +++ b/include/d/actor/d_a_auction.h @@ -120,7 +120,7 @@ class daAuction_c : public fopNpc_npc_c { /* 0x7F8 */ s16 mEvtNoItemIdx; /* 0x7FA */ s16 mEvtStart2Idx; /* 0x7FC */ s16 mEvtEnd2Idx; - /* 0x7FE */ s16 mCurrItemNameMsgNo; // Current bid? + /* 0x7FE */ s16 mCurrBid; /* 0x800 */ s16 m800; /* 0x802 */ s16 mTimer; /* 0x804 */ u16 m804; diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index 8317c5a95..56f187ec9 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -13,11 +13,11 @@ #include "m_Do/m_Do_controller_pad.h" struct NpcDatStruct { - /* 0x00 */ f32 field_0x00; // Random float range min - /* 0x04 */ f32 field_0x04; // Random float range max - /* 0x08 */ s16 field_0x08; // Random short range min - /* 0x0A */ s16 field_0x0A; // Random short range max - /* 0x0C */ s16 field_0x0C; // Might be amount of rupees the npc has + /* 0x00 */ f32 field_0x00; + /* 0x04 */ f32 field_0x04; + /* 0x08 */ s16 mBidIncMin; // Minimum bid increment + /* 0x0A */ s16 mBidIncMax; // Maximum bid increment + /* 0x0C */ s16 mSpendingLimit; }; struct NpcMsgDatStruct { @@ -66,11 +66,11 @@ static daAuction_c::ItemData l_item_dat[] = { {KAKERA_HEART, 0x1D13, 80, 0x1020}, }; -// Items obtained through the auction at some point during dev? static daAuction_c::ItemData l_item_dat2[] = { {POSTMAN_STATUE, 0x1D14, 30, 0x1008}, {PRESIDENT_STATUE, 0x1D15, 40, 0x1004}, }; + static s16 l_item_dat22[] = {0x002A, 0x00F9}; static NpcDatStruct l_npc_dat[7] = { @@ -217,7 +217,6 @@ daAuction_c::daAuction_c() { mAucMdlNo[i] = 0xFF; } - // Shuffles item order (I think) for (int i = 0; i < 100; i++) { int rnd1 = getRand(6); int rnd2 = getRand(6); @@ -296,10 +295,10 @@ s32 daAuction_c::createInit() { mCurrAuctionItemIndex = 0; s16 nameMsgID = l_item_dat[mCurrAuctionItemIndex].mNameMsgID; - mCurrItemNameMsgNo = l_item_dat[mCurrAuctionItemIndex].mStartingBid; + mCurrBid = l_item_dat[mCurrAuctionItemIndex].mStartingBid; dComIfGp_setItemNameMessageID(nameMsgID); - dComIfGp_setMessageCountNumber(mCurrItemNameMsgNo); + dComIfGp_setMessageCountNumber(mCurrBid); setMtx(); @@ -429,14 +428,14 @@ void daAuction_c::eventOrder() { } else if (m838 == 3) { if (dComIfGs_isEventBit(0x4008)) { mCurrAuctionItemIndex = dComIfGs_getEventReg(0xCD03); - mCurrItemNameMsgNo += 0xA; + mCurrBid += 10; } else { mCurrAuctionItemIndex = getItemNo(); } dComIfGp_setItemNameMessageID(l_item_dat[mCurrAuctionItemIndex].mNameMsgID); - mCurrItemNameMsgNo = l_item_dat[mCurrAuctionItemIndex].mStartingBid; - dComIfGp_setMessageCountNumber(mCurrItemNameMsgNo); + mCurrBid = l_item_dat[mCurrAuctionItemIndex].mStartingBid; + dComIfGp_setMessageCountNumber(mCurrBid); fopAcM_orderChangeEventId(dComIfGp_getPlayer(0), this, mEvtStartIdx, 0, 0xFF7F); dComIfGp_startMiniGame(5); @@ -448,10 +447,10 @@ void daAuction_c::eventOrder() { mCurrAuctionItemIndex &= 1; s16 nameMsgID = l_item_dat2[mCurrAuctionItemIndex].mNameMsgID; - mCurrItemNameMsgNo = l_item_dat2[mCurrAuctionItemIndex].mStartingBid; + mCurrBid = l_item_dat2[mCurrAuctionItemIndex].mStartingBid; dComIfGp_setItemNameMessageID(nameMsgID); - dComIfGp_setMessageCountNumber(mCurrItemNameMsgNo); + dComIfGp_setMessageCountNumber(mCurrBid); fopAcM_orderChangeEventId(dComIfGp_getPlayer(0), this, mEvtStart2Idx, 0, 0xFF7F); dComIfGp_startMiniGame(5); } else if (m838 == 7) { @@ -878,7 +877,7 @@ void daAuction_c::eventMainKai() { } for (idx = 0; idx < end; idx++) { - if (m7C4[idx] >= 100.0f && mCurrItemNameMsgNo < l_npc_dat[idx].field_0x0C) { + if (m7C4[idx] >= 100.0f && mCurrBid < l_npc_dat[idx].mSpendingLimit) { break; } } @@ -886,7 +885,7 @@ void daAuction_c::eventMainKai() { if (idx < end) { m828 = idx; - s16 prevItemNameMsgNo = mCurrItemNameMsgNo; + s16 prevItemNameMsgNo = mCurrBid; if (idx != 0) { f32 f = 1.0f; @@ -896,8 +895,8 @@ void daAuction_c::eventMainKai() { f = 1.5f; } - mCurrItemNameMsgNo += (s16)(f * (s16)(l_npc_dat[idx].field_0x08 + cM_rndF(l_npc_dat[idx].field_0x0A - l_npc_dat[idx].field_0x08))); - m800 = mCurrItemNameMsgNo; + mCurrBid += (s16)(f * (s16)(l_npc_dat[idx].mBidIncMin + cM_rndF(l_npc_dat[idx].mBidIncMax - l_npc_dat[idx].mBidIncMin))); + m800 = mCurrBid; end = 0x1CF9; @@ -906,8 +905,8 @@ void daAuction_c::eventMainKai() { nextBet(); } else { - m800 = mCurrItemNameMsgNo + 1; - dComIfGp_setMessageSetNumber(mCurrItemNameMsgNo + 1); + m800 = mCurrBid + 1; + dComIfGp_setMessageSetNumber(mCurrBid + 1); end = 0x1CFA; setLinkAnm(0x48); mpTimer->mpScrnDraw->setShowType(1); @@ -926,11 +925,11 @@ void daAuction_c::eventMainKai() { } else if (m826 != 0xFF && idx != 0 && dComIfG_getTimerRestTimeMs() > l_rest_msg_time1[0] && getRand(3) == 0) { u32 msgParam; - if (mCurrItemNameMsgNo <= 100) { + if (mCurrBid <= 100) { msgParam = 0x1CFD; - } else if (mCurrItemNameMsgNo <= 150) { + } else if (mCurrBid <= 150) { msgParam = 0x1CFE; - } else if (mCurrItemNameMsgNo <= 200) { + } else if (mCurrBid <= 200) { msgParam = 0x1CFF; } else { msgParam = 0x1D00; @@ -1005,7 +1004,7 @@ void daAuction_c::eventMainUri() { for (idx = 1; idx < 7; idx++) { if (m7C4[idx] >= 100.0f) { m7C4[idx] = 0.0f; - if (mCurrItemNameMsgNo < l_npc_dat[idx].field_0x0C) { + if (mCurrBid < l_npc_dat[idx].mSpendingLimit) { break; } } @@ -1023,8 +1022,8 @@ void daAuction_c::eventMainUri() { multiplier = 1.5f; } - mCurrItemNameMsgNo += (s16)(multiplier * (2 * (s16)(l_npc_dat[idx].field_0x08 + cM_rndF(l_npc_dat[idx].field_0x0A - l_npc_dat[idx].field_0x08)))); - m800 = mCurrItemNameMsgNo; + mCurrBid += (s16)(multiplier * (2 * (s16)(l_npc_dat[idx].mBidIncMin + cM_rndF(l_npc_dat[idx].mBidIncMax - l_npc_dat[idx].mBidIncMin)))); + m800 = mCurrBid; m7F0 = 0x1CF9; m82C = 4; m82E = 1; @@ -1037,11 +1036,11 @@ void daAuction_c::eventMainUri() { } else if (dComIfG_getTimerRestTimeMs() > l_rest_msg_time1[0] && getRand(3) == 0) { u32 msgParam; - if (mCurrItemNameMsgNo <= 100) { + if (mCurrBid <= 100) { msgParam = 0x1CFD; - } else if (mCurrItemNameMsgNo <= 150) { + } else if (mCurrBid <= 150) { msgParam = 0x1CFE; - } else if (mCurrItemNameMsgNo <= 200) { + } else if (mCurrBid <= 200) { msgParam = 0x1CFF; } else { msgParam = 0x1D00; @@ -1300,14 +1299,14 @@ u16 daAuction_c::next_msgStatus(u32* pMsgNo) { } break; case 0x1CF7: - dComIfGp_setMiniGameRupee(mCurrItemNameMsgNo); - dComIfGp_setAuctionRupee(mCurrItemNameMsgNo); + dComIfGp_setMiniGameRupee(mCurrBid); + dComIfGp_setAuctionRupee(mCurrBid); dAuction_screen_slotShow(); *pMsgNo = 0x1CF8; break; case 0x1CF9: - dComIfGp_setMiniGameRupee(mCurrItemNameMsgNo); - dComIfGp_setAuctionRupee(mCurrItemNameMsgNo); + dComIfGp_setMiniGameRupee(mCurrBid); + dComIfGp_setAuctionRupee(mCurrBid); if (m82C < 4) { *pMsgNo = l_after_bet_msg_no[m82C]; } else if (m827 == 0 && l_npc_msg_dat[getAucMdlNo(m824)].field_0x02 != 0) { @@ -1336,7 +1335,7 @@ u16 daAuction_c::next_msgStatus(u32* pMsgNo) { setLinkAnm(0x4A); *pMsgNo = 0x1CFB; m7C4[0] = 50.0f; - } else if (msgSetNo <= mCurrItemNameMsgNo) { + } else if (msgSetNo <= mCurrBid) { mDoAud_seStart(JA_SE_AUC_BID_NG); setLinkAnm(0x4A); *pMsgNo = 0x1D1E; @@ -1356,8 +1355,8 @@ u16 daAuction_c::next_msgStatus(u32* pMsgNo) { m82C = 4; // ? for (m82C = 0; m82C < 4; m82C++) { - if (msgSetNo >= (s16)(mCurrItemNameMsgNo * l_after_bet_rate[m82C]) && - mCurrItemNameMsgNo >= l_after_bet_chk[m82C]) + if (msgSetNo >= (s16)(mCurrBid * l_after_bet_rate[m82C]) && + mCurrBid >= l_after_bet_chk[m82C]) { m806 = (s16)(60.0f * (l_after_bet_wait[m82C][0] + cM_rndF(l_after_bet_wait[m82C][1] - l_after_bet_wait[m82C][0]))); break; @@ -1365,8 +1364,8 @@ u16 daAuction_c::next_msgStatus(u32* pMsgNo) { } } - mCurrItemNameMsgNo = msgSetNo; - dComIfGp_setMessageCountNumber(mCurrItemNameMsgNo); + mCurrBid = msgSetNo; + dComIfGp_setMessageCountNumber(mCurrBid); } break; case 0x1CFC: @@ -1433,11 +1432,11 @@ u16 daAuction_c::next_msgStatus(u32* pMsgNo) { } break; case 0x1D1C: - dComIfGp_setItemRupeeCount(mCurrItemNameMsgNo); + dComIfGp_setItemRupeeCount(mCurrBid); ret = 0x10; break; case 0x1D07: - dComIfGp_setItemRupeeCount(-mCurrItemNameMsgNo); + dComIfGp_setItemRupeeCount(-mCurrBid); *pMsgNo = 0x1D08; break; case 0x1D1D: From 934e9499146029945b2a7232ede83a998c0fdde5 Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Fri, 31 May 2024 18:52:41 +0200 Subject: [PATCH 55/56] d_a_auction non-matching --- configure.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.py b/configure.py index 2df94172c..69dc2dfe4 100644 --- a/configure.py +++ b/configure.py @@ -1393,7 +1393,7 @@ def DolphinLib(lib_name, objects): ActorRel(NonMatching, "d_a_wind_tag"), ActorRel(NonMatching, "d_a_acorn_leaf"), ActorRel(NonMatching, "d_a_atdoor"), - ActorRel(Matching, "d_a_auction", extra_cflags=['-pragma "nosyminline on"']), + ActorRel(NonMatching, "d_a_auction", extra_cflags=['-pragma "nosyminline on"']), ActorRel(NonMatching, "d_a_bb"), ActorRel(NonMatching, "d_a_bdk"), ActorRel(NonMatching, "d_a_bdkobj"), From ff36ec2541798b9f76991088824f8515a64663fa Mon Sep 17 00:00:00 2001 From: DanTGL <33489389+DanTGL@users.noreply.github.com> Date: Sat, 1 Jun 2024 20:12:47 +0200 Subject: [PATCH 56/56] d_a_auction minor tweak --- src/d/actor/d_a_auction.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp index 56f187ec9..451a4f9ac 100644 --- a/src/d/actor/d_a_auction.cpp +++ b/src/d/actor/d_a_auction.cpp @@ -1135,7 +1135,10 @@ void daAuction_c::eventMainMsgEnd() { /* 0000294C-00002B90 .text eventMainMsgBikonC__11daAuction_cFv */ void daAuction_c::eventMainMsgBikonC() { - m827 = m829 = m828; + u8 tmp = m828; + m829 = tmp; + m827 = tmp; + dComIfGp_setMessageCountNumber(m800); dComIfGp_setNpcNameMessageID(l_npc_msg_dat[getAucMdlNo(m827)].field_0x00);