summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Hajjar <33489389+DanTGL@users.noreply.github.com>2024-06-02 19:48:53 +0200
committerGitHub <noreply@github.com>2024-06-02 10:48:53 -0700
commited7a50cd86f787c5023f3eae19101a2abfb359aa (patch)
treeb6c1892967e0c4c06366c522730a9f9b6d138860 /src
parent14200323fbbde5343cddb582638a42289920305a (diff)
d_a_auction (#654)
* Started working on d_a_auction * daAuction_c Updated member variables * daAuction_c Refactored class * daAuction_c::getRand matching * daAuction_c constructor matching * d_a_auction CheckCreateHeap matching * daAuction_c::_create matching * d_a_auction l_item_dat matching * daAuction_c::createHeap matching * d_a_auction Added HIO classes * daAuction_c::createInit WIP * daAuction_c::_delete matching * daAuction_c::_draw matching * daAuction_c::_execute matching * d_a_auction Fixed procfunc arrays * daAuction_c moveProc funcs matching * daAuction_c::checkOrder matching * daAuction_c::eventOrder WIP * daAuction_c::eventMove matching * daAuction_c::privateCut WIP * daAuction_c::eventTalkInit matching * daAuction_c::eventMesSet matching * daAuction_c::eventMesEnd matching * daAuction_c::eventStartInit matching * daAuction_c::eventStart matching * daAuction_c::eventMainInit matching * daAuction_c::eventMain matching * daAuction_c::eventMainKai matching * daAuction_c::eventMainKai Fixed formatting * daAuction_c::eventMainUri matching * d_a_auction matching fixes * daAuction_c::eventMainMsgSet matching * daAuction_c::eventMainMsgEnd matching * daAuction_c::setMtx matching * daAuction_c::getItemNo matching * daAuction_c::setLinkAnm matching * d_a_auction matched some functions * d_a_auction matched SetMessage functions * daAuction_c::getNpcActorP matching * daAuction_c::eventMainMsgBikonC matching * daAuction_c::eventMainMsgBikonW matching * daAuction_c::eventGetItemInit matching * daAuction_c::eventGetItemNpcInit matching * daAuction_c::eventGetItemMesInit matching * d_a_auction matched some functions * daAuction_c::setCameraNpc matching * daAuction_c::nextBet matching * daAuction_c::privateCut Fixed matching * d_a_auction .data section matching * daAuction_c::next_msgStatus WIP * daAuction_c::next_msgStatus matching * Fixed variable names * d_a_auction cleanup * d_a_auction more cleanup * d_a_auction non-matching * d_a_auction minor tweak
Diffstat (limited to 'src')
-rw-r--r--src/d/actor/d_a_auction.cpp1525
-rw-r--r--src/d/actor/d_a_npc_auction.cpp4
-rw-r--r--src/d/d_auction_screen.cpp2
-rw-r--r--src/d/d_com_inf_game.cpp4
4 files changed, 1444 insertions, 91 deletions
diff --git a/src/d/actor/d_a_auction.cpp b/src/d/actor/d_a_auction.cpp
index 048b0a7b..451a4f9a 100644
--- a/src/d/actor/d_a_auction.cpp
+++ b/src/d/actor/d_a_auction.cpp
@@ -4,276 +4,1627 @@
//
#include "d/actor/d_a_auction.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"
+
+struct NpcDatStruct {
+ /* 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 {
+ /* 0x00 */ s16 field_0x00;
+ /* 0x02 */ s16 field_0x02;
+ /* 0x04 */ s16 field_0x04;
+ /* 0x06 */ s16 field_0x06;
+ /* 0x08 */ s16 field_0x08;
+};
+
+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};
+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},
+};
+
+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] = {
+ {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] = {
+ {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] = {
+ { 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,
+ 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,
+};
+
+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_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,
+};
+
+static daAuction_c::ProcFunc_t moveProc[] = {
+ daAuction_c::executeWait,
+ daAuction_c::executeNormal,
+ daAuction_c::executeStart,
+};
+
+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();
+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();
/* 000000EC-000002FC .text __ct__11daAuction_cFv */
daAuction_c::daAuction_c() {
- /* Nonmatching */
+ for (int i = 0; i < 8; i++) {
+ m738[i] = -1;
+ m80C[i] = i;
+ mAucMdlNo[i] = 0xFF;
+ }
+
+ 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;
+ }
+
+ mMoveState = 0;
+ m820 = 1;
+ m821 = 0;
+ m7EC = 0;
+ m7F0 = 0;
+ m81C = 0xFF;
+ m81D = 0xFF;
+ mpEmitter = NULL;
+ m836 = 0;
+
+ eyePos = current.pos;
+ m832 = 0;
}
/* 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<daAuction_c*>(i_this)->createHeap();
}
/* 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 */
-void daAuction_c::createHeap() {
- /* Nonmatching */
+BOOL daAuction_c::createHeap() {
+ J3DModelData* modelData = static_cast<J3DModelData*>(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 */
-void daAuction_c::createInit() {
- /* Nonmatching */
+s32 daAuction_c::createInit() {
+ 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[getAucMdlNo(m824)].field_0x00);
+
+ mCurrAuctionItemIndex = 0;
+
+ s16 nameMsgID = l_item_dat[mCurrAuctionItemIndex].mNameMsgID;
+ mCurrBid = l_item_dat[mCurrAuctionItemIndex].mStartingBid;
+
+ dComIfGp_setItemNameMessageID(nameMsgID);
+ dComIfGp_setMessageCountNumber(mCurrBid);
+
+ setMtx();
+
+ return cPhs_COMPLEATE_e;
}
/* 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 */
BOOL daAuction_c::_draw() {
- /* Nonmatching */
+ g_env_light.settingTevStruct(TEV_TYPE_BG2, &current.pos, &tevStr);
+ g_env_light.setLightTevColorType(mpModel, &tevStr);
+
+ if (mFlags & 4) {
+ mDoExt_modelUpdateDL(mpModel);
+ }
+
+ return TRUE;
}
/* 00000998-00000B10 .text _execute__11daAuction_cFv */
BOOL daAuction_c::_execute() {
- /* Nonmatching */
+ checkOrder();
+
+ if (!dComIfGp_event_runCheck() || eventInfo.checkCommandTalk()) {
+ (this->*moveProc[mMoveState])();
+ } 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 */
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() {
- /* Nonmatching */
+ if (eventInfo.checkCommandDemoAccrpt()) {
+ 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 */
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);
+ mCurrBid += 10;
+ } else {
+ mCurrAuctionItemIndex = getItemNo();
+ }
+
+ dComIfGp_setItemNameMessageID(l_item_dat[mCurrAuctionItemIndex].mNameMsgID);
+ mCurrBid = l_item_dat[mCurrAuctionItemIndex].mStartingBid;
+ dComIfGp_setMessageCountNumber(mCurrBid);
+
+ fopAcM_orderChangeEventId(dComIfGp_getPlayer(0), this, 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;
+
+ s16 nameMsgID = l_item_dat2[mCurrAuctionItemIndex].mNameMsgID;
+ mCurrBid = l_item_dat2[mCurrAuctionItemIndex].mStartingBid;
+
+ dComIfGp_setItemNameMessageID(nameMsgID);
+ dComIfGp_setMessageCountNumber(mCurrBid);
+ fopAcM_orderChangeEventId(dComIfGp_getPlayer(0), this, mEvtStart2Idx, 0, 0xFF7F);
+ dComIfGp_startMiniGame(5);
+ } else if (m838 == 7) {
+ fopAcM_orderOtherEventId(this, mEvtEnd2Idx, 0xFF, 0xFF7F);
+ }
}
/* 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 */
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;
+ }
+ }
+
+ bool 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 = &eventMesSet != NULL;
+ break;
+ case 8:
+ evtRes = eventCameraOffNpc();
+ break;
+ case 9:
+ evtRes = eventEnd();
+ break;
+ case 10:
+ evtRes = eventCameraTest();
+ break;
+ default:
+ evtRes = true;
+ }
+
+ 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 */
-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 */
-void daAuction_c::eventMesSet() {
- /* Nonmatching */
+bool daAuction_c::eventMesSet() {
+ talk(0);
+
+ return mCurrMsgBsPcId != fpcM_ERROR_PROCESS_ID_e;
}
/* 00001400-00001434 .text eventMesEnd__11daAuction_cFv */
-void daAuction_c::eventMesEnd() {
- /* Nonmatching */
+bool daAuction_c::eventMesEnd() {
+ return talk(0) == fopMsgStts_BOX_CLOSED_e;
}
/* 00001434-00001634 .text eventStartInit__11daAuction_cFv */
void daAuction_c::eventStartInit() {
- /* Nonmatching */
+ m820 = ~1;
+
+ if (m822 == 2) {
+ mTimerID = dTimer_createTimer(4, 30, 1, 0, 221.0f, 439.0f, 32.0f, 419.0f);
+ } else {
+ mTimerID = dTimer_createTimer(4, 60, 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, &current.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 */
-void daAuction_c::eventStart() {
- /* Nonmatching */
+bool daAuction_c::eventStart() {
+ 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 */
void daAuction_c::eventMainInit() {
- /* Nonmatching */
+ m804 = 3600;
+
+ 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[] = {
+ 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() {
- /* Nonmatching */
+bool daAuction_c::eventMain() {
+ 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[getAucMdlNo(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 */
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 && mCurrBid < l_npc_dat[idx].mSpendingLimit) {
+ break;
+ }
+ }
+
+ if (idx < end) {
+ m828 = idx;
+
+ s16 prevItemNameMsgNo = mCurrBid;
+
+ if (idx != 0) {
+ f32 f = 1.0f;
+ if (dComIfG_getTimerRestTimeMs() < 30000) {
+ f = 2.0f;
+ } else if (dComIfG_getTimerRestTimeMs() < 60000) {
+ f = 1.5f;
+ }
+
+ 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;
+
+ m82C = 4;
+ m7C4[idx] = 0.0f;
+
+ nextBet();
+ } else {
+ m800 = mCurrBid + 1;
+ dComIfGp_setMessageSetNumber(mCurrBid + 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 (mCurrBid <= 100) {
+ msgParam = 0x1CFD;
+ } else if (mCurrBid <= 150) {
+ msgParam = 0x1CFE;
+ } else if (mCurrBid <= 200) {
+ msgParam = 0x1CFF;
+ } else {
+ msgParam = 0x1D00;
+ }
+
+ // onCameraOld might be used somewhere here?
+ dComIfGp_setMessageCountNumber(prevItemNameMsgNo);
+ dComIfGp_setNpcNameMessageID(l_npc_msg_dat[getAucMdlNo(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[getAucMdlNo(m827)].field_0x00);
+ }
+
+ m835 |= 9;
+ m835 &= ~2;
+ } else if (dComIfG_getTimerRestTimeMs() < l_rest_msg_time1[m82A]) {
+ setMessage2(l_rest_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 */
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 * (l_npc_dat[i].field_0x00 + cM_rndF(l_npc_dat[i].field_0x04 - l_npc_dat[i].field_0x00));
+ }
+ }
+
+ int idx;
+ for (idx = 1; idx < 7; idx++) {
+ if (m7C4[idx] >= 100.0f) {
+ m7C4[idx] = 0.0f;
+ if (mCurrBid < l_npc_dat[idx].mSpendingLimit) {
+ 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;
+ }
+
+ 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;
+ 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 (mCurrBid <= 100) {
+ msgParam = 0x1CFD;
+ } else if (mCurrBid <= 150) {
+ msgParam = 0x1CFE;
+ } else if (mCurrBid <= 200) {
+ msgParam = 0x1CFF;
+ } else {
+ msgParam = 0x1D00;
+ }
+
+ dComIfGp_setNpcNameMessageID(l_npc_msg_dat[getAucMdlNo(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[getAucMdlNo(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 */
void daAuction_c::eventMainMsgSet() {
- /* Nonmatching */
+ if (eventMesSet()) {
+ m81F = 3;
+ }
}
/* 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 */
void daAuction_c::eventMainMsgBikonC() {
- /* Nonmatching */
+ u8 tmp = m828;
+ m829 = tmp;
+ m827 = tmp;
+
+ dComIfGp_setMessageCountNumber(m800);
+ dComIfGp_setNpcNameMessageID(l_npc_msg_dat[getAucMdlNo(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 */
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 */
void daAuction_c::eventGetItemInit() {
- /* Nonmatching */
+ if (m822 == 2) {
+ uint itemID = fopAcM_createItemForPresentDemo(&current.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(&current.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 */
-void daAuction_c::eventGetItem() {
- /* Nonmatching */
+bool daAuction_c::eventGetItem() {
+ return true;
}
/* 00002D54-00002D70 .text eventCameraOffInit__11daAuction_cFv */
void daAuction_c::eventCameraOffInit() {
- /* Nonmatching */
+ offCamera();
}
/* 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 */
void daAuction_c::eventGetItemMesInit() {
- /* Nonmatching */
+ setMessage(l_npc_msg_dat[getAucMdlNo(m824)].field_0x08);
}
/* 00002E40-00002EA0 .text eventCameraOffNpc__11daAuction_cFv */
-void daAuction_c::eventCameraOffNpc() {
- /* Nonmatching */
+bool daAuction_c::eventCameraOffNpc() {
+ 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 */
-void daAuction_c::eventEnd() {
- /* Nonmatching */
+bool daAuction_c::eventEnd() {
+ 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 */
-void daAuction_c::eventCameraTestInit() {
- /* Nonmatching */
-}
+void daAuction_c::eventCameraTestInit() {}
/* 00002F64-00002F6C .text eventCameraTest__11daAuction_cFv */
-void daAuction_c::eventCameraTest() {
- /* Nonmatching */
+bool daAuction_c::eventCameraTest() {
+ return true;
}
/* 00002F6C-0000369C .text next_msgStatus__11daAuction_cFPUl */
-void daAuction_c::next_msgStatus(unsigned long*) {
- /* Nonmatching */
+u16 daAuction_c::next_msgStatus(u32* pMsgNo) {
+ u16 ret = 0xF;
+
+ 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(mCurrBid);
+ dComIfGp_setAuctionRupee(mCurrBid);
+ dAuction_screen_slotShow();
+ *pMsgNo = 0x1CF8;
+ break;
+ case 0x1CF9:
+ 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) {
+ 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 <= mCurrBid) {
+ 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)(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;
+ }
+ }
+ }
+
+ mCurrBid = msgSetNo;
+ dComIfGp_setMessageCountNumber(mCurrBid);
+ }
+ 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;
+
+ 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;
+
+ 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(mCurrBid);
+ ret = 0x10;
+ break;
+ case 0x1D07:
+ dComIfGp_setItemRupeeCount(-mCurrBid);
+ *pMsgNo = 0x1D08;
+ break;
+ case 0x1D1D:
+ case 0x1D08:
+ *pMsgNo = 0x1D09;
+ break;
+
+ default:
+ ret = 0x10;
+ break;
+ }
+
+ if (ret == 0xF) {
+ m7EC = *pMsgNo;
+ } else {
+ m7EC = 0;
+ }
+
+ return ret;
}
/* 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 */
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 */
-void daAuction_c::getItemNo() {
- /* Nonmatching */
+u8 daAuction_c::getItemNo() {
+ 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 */
-void 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 */
-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 */
-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 */
-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 */
void daAuction_c::nextBet() {
- /* Nonmatching */
+ if (m831 != 0) {
+ m831 -= 1;
+ return;
+ }
+
+ for (int i = 1; i < 7; i++) {
+ f32 rnd = getRand(60 - (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 */
-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 */
-static s32 daAuctionCreate(void*) {
- /* Nonmatching */
+static s32 daAuctionCreate(void* i_this) {
+ return static_cast<daAuction_c*>(i_this)->_create();
}
/* 00003C28-00003C48 .text daAuctionDelete__FPv */
-static BOOL daAuctionDelete(void*) {
- /* Nonmatching */
+static BOOL daAuctionDelete(void* i_this) {
+ return static_cast<daAuction_c*>(i_this)->_delete();
}
/* 00003C48-00003C68 .text daAuctionExecute__FPv */
-static BOOL daAuctionExecute(void*) {
- /* Nonmatching */
+static BOOL daAuctionExecute(void* i_this) {
+ return static_cast<daAuction_c*>(i_this)->_execute();
}
/* 00003C68-00003C88 .text daAuctionDraw__FPv */
-static BOOL daAuctionDraw(void*) {
- /* Nonmatching */
+static BOOL daAuctionDraw(void* i_this) {
+ return static_cast<daAuction_c*>(i_this)->_draw();
}
/* 00003C88-00003C90 .text daAuctionIsDelete__FPv */
static BOOL daAuctionIsDelete(void*) {
- /* Nonmatching */
+ return TRUE;
}
static actor_method_class daAuctionMethodTable = {
@@ -300,3 +1651,5 @@ actor_process_profile_definition g_profile_AUCTION = {
/* Group */ fopAc_ACTOR_e,
/* CullType */ fopAc_CULLBOX_CUSTOM_e,
};
+
+#undef RAND_RANGE
diff --git a/src/d/actor/d_a_npc_auction.cpp b/src/d/actor/d_a_npc_auction.cpp
index 63e08d9a..800559ee 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 */
}
diff --git a/src/d/d_auction_screen.cpp b/src/d/d_auction_screen.cpp
index db457f61..73e2c646 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 */
}
diff --git a/src/d/d_com_inf_game.cpp b/src/d/d_com_inf_game.cpp
index a3148d21..cd99eb94 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;