diff --git a/config/GMPE01_00/symbols.txt b/config/GMPE01_00/symbols.txt index 26c4756e..619f7c39 100644 --- a/config/GMPE01_00/symbols.txt +++ b/config/GMPE01_00/symbols.txt @@ -5207,11 +5207,11 @@ spaceImgIdx = .data:0x80139CC8; // type:object size:0xC scope:local spaceHiliteImgIdx = .data:0x80139CD4; // type:object size:0xC scope:local jumptable_80139CE0 = .data:0x80139CE0; // type:object size:0x28 scope:local hostMessTbl = .data:0x80139D08; // type:object size:0x24 scope:local -itemPriceTbl = .data:0x80139D2C; // type:object size:0x10 scope:local +itemPriceTbl = .data:0x80139D2C; // type:object size:0x10 scope:local data:byte shopMotTbl = .data:0x80139D3C; // type:object size:0x6C scope:local lbl_80139DA8 = .data:0x80139DA8; // type:object size:0xA data:string -itemPrioTbl = .data:0x80139DB2; // type:object size:0x8C scope:local -rankItemGroupTbl = .data:0x80139E3E; // type:object size:0x18 scope:local +itemPrioTbl = .data:0x80139DB2; // type:object size:0x8C scope:local data:byte +rankItemGroupTbl = .data:0x80139E3E; // type:object size:0x18 scope:local data:byte cursorPosTbl = .data:0x80139E58; // type:object size:0x30 scope:local data:float comInputDraw1 = .data:0x80139E88; // type:object size:0xEE scope:local data:2byte comInputDraw2 = .data:0x80139F76; // type:object size:0xBA scope:local data:2byte @@ -5897,7 +5897,7 @@ shopMdlParam = .sdata:0x801D370C; // type:object size:0x8 scope:local hostMdl = .sdata:0x801D3714; // type:object size:0x2 scope:local data:2byte shopMot = .sdata:0x801D3716; // type:object size:0x6 scope:local data:2byte itemCurChoice = .sdata:0x801D371C; // type:object size:0x1 scope:local data:byte -defaultItemTbl = .sdata:0x801D371D; // type:object size:0x5 scope:local +defaultItemTbl = .sdata:0x801D371D; // type:object size:0x5 scope:local data:byte hostMdl = .sdata:0x801D3728; // type:object size:0x2 scope:local data:2byte lotteryMot = .sdata:0x801D372A; // type:object size:0x8 scope:local data:2byte lotterySpr = .sdata:0x801D3732; // type:object size:0x2 scope:local data:2byte diff --git a/configure.py b/configure.py index aaed6588..51f63497 100644 --- a/configure.py +++ b/configure.py @@ -375,7 +375,7 @@ config.libs = [ Object(Matching, "game/board/com.c"), Object(Matching, "game/board/view.c"), Object(Matching, "game/board/space.c"), - Object(NonMatching, "game/board/shop.c"), + Object(Matching, "game/board/shop.c"), Object(Matching, "game/board/lottery.c"), Object(Matching, "game/board/basic_space.c"), Object(Matching, "game/board/warp.c"), diff --git a/include/board_unsplit.h b/include/board_unsplit.h index 941d3d53..d6ca8de1 100644 --- a/include/board_unsplit.h +++ b/include/board_unsplit.h @@ -7,12 +7,10 @@ typedef void (*BoardLightHook)(void); #endif -void BoardShopTutorialExec(s32); void BoardMGSetupTutorialExec(void); void BoardBooHouseTutorialExec(void); void BoardLightHookSet(BoardLightHook set, BoardLightHook reset); s32 fn_8006DDE8(s16, f32); -void BoardShopHostSet(s16); void BoardBooHouseHostSet(s16); s32 BoardCameraRotGet(Vec*); s32 BoardIsKill(void); diff --git a/include/game/board/model.h b/include/game/board/model.h index 6945ef9c..c967db5d 100644 --- a/include/game/board/model.h +++ b/include/game/board/model.h @@ -12,7 +12,7 @@ typedef struct board_model_param { u8 link : 1; u8 start_mot : 1; u8 pause : 1; - }; + } unk4; s16 unk6; } BoardModelParam; diff --git a/include/game/board/shop.h b/include/game/board/shop.h new file mode 100755 index 00000000..a0ddde25 --- /dev/null +++ b/include/game/board/shop.h @@ -0,0 +1,13 @@ +#ifndef _BOARD_SHOP_H +#define _BOARD_SHOP_H + +#include "dolphin/types.h" + +void BoardShopHostSet(s16 arg0); +s16 BoardShopHostGet(void); +void BoardShopInit(void); +void BoardShopKill(void); +void BoardShopExec(s32 player, s32 space); +void BoardShopTutorialExec(s32 arg0); + +#endif diff --git a/src/REL/modeltestDll/main.c b/src/REL/modeltestDll/main.c index 6bad041c..fd594c48 100644 --- a/src/REL/modeltestDll/main.c +++ b/src/REL/modeltestDll/main.c @@ -17,13 +17,13 @@ s32 lbl_1_data_0[8] = { 0x005F001B, - 0x005F0015, - 0x005F0016, - 0x005F0006, - 0x005F0000, - 0x005F0000, - 0x005F0000, - 0x005F0004, + 0x005F0015, + 0x005F0016, + 0x005F0006, + 0x005F0000, + 0x005F0000, + 0x005F0000, + 0x005F0004, }; const f64 unk_rodata_0 = 0.5; @@ -33,14 +33,14 @@ omObjData * lbl_1_bss_9A0; // -------------------------------------------------------------------------- // -void fn_1_A0(void) +void fn_1_A0(void) { Process * prc; OSReport("******* MODELTESTObjectSetup *********\n"); - + prc = omInitObjMan(0x32, 0x2000); omGameSysInit(prc); - + CRot.x = -30.0f; CRot.y = 0.0f; CRot.z = 0.0f; @@ -48,14 +48,14 @@ void fn_1_A0(void) Center.y = 0.0f; Center.z = 0.0f; CZoom = 800.0f; - + Hu3DCameraCreate(1); Hu3DCameraPerspectiveSet(1, 45.0f, 20.0f, 20000.0f, 1.2f); Hu3DCameraViewportSet(1, 0.0f, 0.0f, 640.0f, 480.0f, 0.0f, 1.0f); - + lbl_1_bss_9A4 = omAddObjEx(prc, 0, 0x20, 0x20, -1, fn_1_29C); lbl_1_bss_9A0 = omAddObjEx(prc, 0x7FDA, 0, 0, -1, omOutView); - + Hu3DBGColorSet(0x20U, 0x80U, 0x80U); WipeCreate(1, 0, 0x1E); } @@ -83,83 +83,83 @@ char * lbl_1_data_D8[16] = { HsfanimStruct00 lbl_1_data_118 = { - /* unk00 */ 40, - /* unk02 */ {0, 0}, - /* unk04 */ 50.0f, - /* unk08 */ 0.0f, - /* unk0C */ 90.0f, - /* unk10 */ { /* x */ 0.0f, /* y */ -0.05000000074505806f, /* z */ 0.0f}, - /* unk1C */ 50.0f, - /* unk20 */ 0.800000011920929f, - /* unk24 */ 20.0f, - /* unk28 */ 0.9900000095367432f, - /* unk2C */ 4, - /* unk2E */ {{ /* r */ 255, /* g */ 255, /* b */ 32, /* a */ 255}, { /* r */ 255, /* g */ 255, /* b */ 0, /* a */ 255}, { /* r */ 255, /* g */ 255, /* b */ 128, /* a */ 255}, { /* r */ 255, /* g */ 255, /* b */ 255, /* a */ 255}}, - /* unk3E */ {{ /* r */ 255, /* g */ 255, /* b */ 255, /* a */ 0}, { /* r */ 255, /* g */ 255, /* b */ 255, /* a */ 0}, { /* r */ 255, /* g */ 255, /* b */ 255, /* a */ 0}, { /* r */ 255, /* g */ 255, /* b */ 255, /* a */ 0}}, + /* unk00 */ 40, + /* unk02 */ {0, 0}, + /* unk04 */ 50.0f, + /* unk08 */ 0.0f, + /* unk0C */ 90.0f, + /* unk10 */ { /* x */ 0.0f, /* y */ -0.05000000074505806f, /* z */ 0.0f}, + /* unk1C */ 50.0f, + /* unk20 */ 0.800000011920929f, + /* unk24 */ 20.0f, + /* unk28 */ 0.9900000095367432f, + /* unk2C */ 4, + /* unk2E */ {{ /* r */ 255, /* g */ 255, /* b */ 32, /* a */ 255}, { /* r */ 255, /* g */ 255, /* b */ 0, /* a */ 255}, { /* r */ 255, /* g */ 255, /* b */ 128, /* a */ 255}, { /* r */ 255, /* g */ 255, /* b */ 255, /* a */ 255}}, + /* unk3E */ {{ /* r */ 255, /* g */ 255, /* b */ 255, /* a */ 0}, { /* r */ 255, /* g */ 255, /* b */ 255, /* a */ 0}, { /* r */ 255, /* g */ 255, /* b */ 255, /* a */ 0}, { /* r */ 255, /* g */ 255, /* b */ 255, /* a */ 0}}, }; HsfanimStruct00 lbl_1_data_168[2] = { { - /* unk00 */ 50, - /* unk02 */ {0, 0}, - /* unk04 */ 5.0f, - /* unk08 */ 10.0f, - /* unk0C */ 10.0f, - /* unk10 */ { /* x */ 0.0f, /* y */ 0.0f, /* z */ 0.0f}, - /* unk1C */ 2.0f, - /* unk20 */ 1.0099999904632568f, - /* unk24 */ 30.0f, - /* unk28 */ 0.9900000095367432f, - /* unk2C */ 2, - /* unk2E */ {{ /* r */ 48, /* g */ 48, /* b */ 8, /* a */ 255}, { /* r */ 64, /* g */ 48, /* b */ 8, /* a */ 255}, { /* r */ 0, /* g */ 0, /* b */ 0, /* a */ 0}, { /* r */ 0, /* g */ 0, /* b */ 0, /* a */ 0}}, - /* unk3E */ {{ /* r */ 0, /* g */ 0, /* b */ 0, /* a */ 0}, { /* r */ 0, /* g */ 0, /* b */ 0, /* a */ 0}, { /* r */ 0, /* g */ 0, /* b */ 0, /* a */ 0}, { /* r */ 0, /* g */ 0, /* b */ 0, /* a */ 0}}, + /* unk00 */ 50, + /* unk02 */ {0, 0}, + /* unk04 */ 5.0f, + /* unk08 */ 10.0f, + /* unk0C */ 10.0f, + /* unk10 */ { /* x */ 0.0f, /* y */ 0.0f, /* z */ 0.0f}, + /* unk1C */ 2.0f, + /* unk20 */ 1.0099999904632568f, + /* unk24 */ 30.0f, + /* unk28 */ 0.9900000095367432f, + /* unk2C */ 2, + /* unk2E */ {{ /* r */ 48, /* g */ 48, /* b */ 8, /* a */ 255}, { /* r */ 64, /* g */ 48, /* b */ 8, /* a */ 255}, { /* r */ 0, /* g */ 0, /* b */ 0, /* a */ 0}, { /* r */ 0, /* g */ 0, /* b */ 0, /* a */ 0}}, + /* unk3E */ {{ /* r */ 0, /* g */ 0, /* b */ 0, /* a */ 0}, { /* r */ 0, /* g */ 0, /* b */ 0, /* a */ 0}, { /* r */ 0, /* g */ 0, /* b */ 0, /* a */ 0}, { /* r */ 0, /* g */ 0, /* b */ 0, /* a */ 0}}, }, -{ - /* unk00 */ 30, - /* unk02 */ {0, 0}, - /* unk04 */ 3.299999952316284f, - /* unk08 */ 10.0f, - /* unk0C */ 0.0f, - /* unk10 */ { /* x */ 0.0f, /* y */ -0.05000000074505806f, /* z */ 0.0f}, - /* unk1C */ 2.0f, - /* unk20 */ 1.0f, - /* unk24 */ 20.0f, - /* unk28 */ 0.9800000190734863f, - /* unk2C */ 2, - /* unk2E */ {{ /* r */ 255, /* g */ 255, /* b */ 255, /* a */ 255}, { /* r */ 255, /* g */ 255, /* b */ 64, /* a */ 255}, { /* r */ 0, /* g */ 0, /* b */ 0, /* a */ 0}, { /* r */ 0, /* g */ 0, /* b */ 0, /* a */ 0}}, - /* unk3E */ {{ /* r */ 255, /* g */ 128, /* b */ 128, /* a */ 0}, { /* r */ 255, /* g */ 64, /* b */ 32, /* a */ 0}, { /* r */ 0, /* g */ 0, /* b */ 0, /* a */ 0}, { /* r */ 0, /* g */ 0, /* b */ 0, /* a */ 0}}, +{ + /* unk00 */ 30, + /* unk02 */ {0, 0}, + /* unk04 */ 3.299999952316284f, + /* unk08 */ 10.0f, + /* unk0C */ 0.0f, + /* unk10 */ { /* x */ 0.0f, /* y */ -0.05000000074505806f, /* z */ 0.0f}, + /* unk1C */ 2.0f, + /* unk20 */ 1.0f, + /* unk24 */ 20.0f, + /* unk28 */ 0.9800000190734863f, + /* unk2C */ 2, + /* unk2E */ {{ /* r */ 255, /* g */ 255, /* b */ 255, /* a */ 255}, { /* r */ 255, /* g */ 255, /* b */ 64, /* a */ 255}, { /* r */ 0, /* g */ 0, /* b */ 0, /* a */ 0}, { /* r */ 0, /* g */ 0, /* b */ 0, /* a */ 0}}, + /* unk3E */ {{ /* r */ 255, /* g */ 128, /* b */ 128, /* a */ 0}, { /* r */ 255, /* g */ 64, /* b */ 32, /* a */ 0}, { /* r */ 0, /* g */ 0, /* b */ 0, /* a */ 0}, { /* r */ 0, /* g */ 0, /* b */ 0, /* a */ 0}}, }}; HsfanimStruct00 lbl_1_data_208 = { - /* unk00 */ 40, - /* unk02 */ {0, 0}, - /* unk04 */ 50.0f, - /* unk08 */ 0.0f, - /* unk0C */ 180.0f, - /* unk10 */ { /* x */ 0.0f, /* y */ 0.0f, /* z */ 0.0f}, - /* unk1C */ 30.0f, - /* unk20 */ 0.8999999761581421f, - /* unk24 */ 20.0f, - /* unk28 */ 0.9900000095367432f, - /* unk2C */ 4, - /* unk2E */ {{ /* r */ 255, /* g */ 255, /* b */ 32, /* a */ 255}, { /* r */ 255, /* g */ 255, /* b */ 0, /* a */ 255}, { /* r */ 255, /* g */ 255, /* b */ 128, /* a */ 255}, { /* r */ 255, /* g */ 255, /* b */ 255, /* a */ 255}}, - /* unk3E */ {{ /* r */ 0, /* g */ 0, /* b */ 0, /* a */ 0}, { /* r */ 0, /* g */ 0, /* b */ 0, /* a */ 0}, { /* r */ 0, /* g */ 0, /* b */ 0, /* a */ 0}, { /* r */ 0, /* g */ 0, /* b */ 0, /* a */ 0}}, + /* unk00 */ 40, + /* unk02 */ {0, 0}, + /* unk04 */ 50.0f, + /* unk08 */ 0.0f, + /* unk0C */ 180.0f, + /* unk10 */ { /* x */ 0.0f, /* y */ 0.0f, /* z */ 0.0f}, + /* unk1C */ 30.0f, + /* unk20 */ 0.8999999761581421f, + /* unk24 */ 20.0f, + /* unk28 */ 0.9900000095367432f, + /* unk2C */ 4, + /* unk2E */ {{ /* r */ 255, /* g */ 255, /* b */ 32, /* a */ 255}, { /* r */ 255, /* g */ 255, /* b */ 0, /* a */ 255}, { /* r */ 255, /* g */ 255, /* b */ 128, /* a */ 255}, { /* r */ 255, /* g */ 255, /* b */ 255, /* a */ 255}}, + /* unk3E */ {{ /* r */ 0, /* g */ 0, /* b */ 0, /* a */ 0}, { /* r */ 0, /* g */ 0, /* b */ 0, /* a */ 0}, { /* r */ 0, /* g */ 0, /* b */ 0, /* a */ 0}, { /* r */ 0, /* g */ 0, /* b */ 0, /* a */ 0}}, }; HsfanimStruct00 lbl_1_data_258 = { - /* unk00 */ 30, - /* unk02 */ {0, 0}, - /* unk04 */ 50.0f, - /* unk08 */ 0.0f, - /* unk0C */ 90.0f, - /* unk10 */ { /* x */ 0.0f, /* y */ 0.0f, /* z */ 0.0f}, - /* unk1C */ 30.0f, - /* unk20 */ 0.949999988079071f, - /* unk24 */ 20.0f, - /* unk28 */ 0.9900000095367432f, - /* unk2C */ 2, - /* unk2E */ {{ /* r */ 255, /* g */ 16, /* b */ 16, /* a */ 255}, { /* r */ 255, /* g */ 255, /* b */ 16, /* a */ 255}, { /* r */ 0, /* g */ 0, /* b */ 0, /* a */ 0}, { /* r */ 0, /* g */ 0, /* b */ 0, /* a */ 0}}, - /* unk3E */ {{ /* r */ 255, /* g */ 16, /* b */ 16, /* a */ 255}, { /* r */ 255, /* g */ 255, /* b */ 16, /* a */ 255}, { /* r */ 0, /* g */ 0, /* b */ 0, /* a */ 0}, { /* r */ 0, /* g */ 0, /* b */ 0, /* a */ 0}}, + /* unk00 */ 30, + /* unk02 */ {0, 0}, + /* unk04 */ 50.0f, + /* unk08 */ 0.0f, + /* unk0C */ 90.0f, + /* unk10 */ { /* x */ 0.0f, /* y */ 0.0f, /* z */ 0.0f}, + /* unk1C */ 30.0f, + /* unk20 */ 0.949999988079071f, + /* unk24 */ 20.0f, + /* unk28 */ 0.9900000095367432f, + /* unk2C */ 2, + /* unk2E */ {{ /* r */ 255, /* g */ 16, /* b */ 16, /* a */ 255}, { /* r */ 255, /* g */ 255, /* b */ 16, /* a */ 255}, { /* r */ 0, /* g */ 0, /* b */ 0, /* a */ 0}, { /* r */ 0, /* g */ 0, /* b */ 0, /* a */ 0}}, + /* unk3E */ {{ /* r */ 255, /* g */ 16, /* b */ 16, /* a */ 255}, { /* r */ 255, /* g */ 255, /* b */ 16, /* a */ 255}, { /* r */ 0, /* g */ 0, /* b */ 0, /* a */ 0}, { /* r */ 0, /* g */ 0, /* b */ 0, /* a */ 0}}, }; const Point3d lbl_1_rodata_38 = {0.0f, 0.0f, 0.0f}; @@ -209,29 +209,29 @@ void fn_1_29C(omObjData * arg0) f32 temp_f30; s16 chrIdx; s32 temp_r0; - + sp14 = lbl_1_rodata_38; sp8 = lbl_1_rodata_44; - + var_r31 = Hu3DGLightCreate(0.0f, 500.0f, 1000.0f, 0.0f, -0.5f, -1.0f, 0xFFU, 0xFFU, 0xFFU); Hu3DGLightInfinitytSet(var_r31); Hu3DShadowCreate(45.0f, 500.0f, 8000.0f); Hu3DShadowTPLvlSet(0.5f); - + Hu3DShadowSizeSet(0xC0U); sp20.x = -500.0f; sp20.y = 1000.0f; sp20.z = 1000.0f; Hu3DShadowPosSet(&sp20, &sp8, &sp14); - for (var_r31 = 0; var_r31 < 1; ++var_r31) + for (var_r31 = 0; var_r31 < 1; ++var_r31) { chrIdx = 0; lbl_1_bss_98A[var_r31] = CharModelCreate(chrIdx, 2); if (var_r31 == 1) { Hu3DModelLayerSet(lbl_1_bss_98A[var_r31], 1); } - + lbl_1_bss_88A[var_r31][0] = CharModelMotionCreate(chrIdx, lbl_1_data_0[0]); lbl_1_bss_88A[var_r31][1] = CharModelMotionCreate(chrIdx, lbl_1_data_0[1]); lbl_1_bss_88A[var_r31][2] = CharModelMotionCreate(chrIdx, lbl_1_data_0[2]); @@ -247,7 +247,7 @@ void fn_1_29C(omObjData * arg0) CharModelMotionDataClose(chrIdx); } temp_r26 = OSGetTick(); - + for (var_r31 = 0; var_r31 < 8; ++var_r31) { Hu3DModelObjMtxGet(lbl_1_bss_98A[0], "test11_tex_we-ske_R_shoe1", sp2C); } @@ -328,7 +328,7 @@ void fn_1_F38(void) { f32 var_f31; var_f31 = 0.0f; - + while(TRUE) { Hu3DModelRotSet(lbl_1_bss_460[0], 0.0f, var_f31, 0.0f); var_f31 += 1.0f; @@ -374,7 +374,7 @@ void fn_1_F9C(struct om_obj_data * omData) s32 var_r31; s16 var_r30; HuUnkF9C2 teropPatterns; - + if (omSysExitReq != 0) { if (lbl_1_bss_10 != 0) { HuPrcKill(lbl_1_bss_10); @@ -455,7 +455,7 @@ void fn_1_F9C(struct om_obj_data * omData) (void) var_fake; } } - + if (lbl_1_bss_458 > 0) { MGSeqParamSet(lbl_1_bss_45A[0], 1, lbl_1_bss_458 / 60); --lbl_1_bss_458; @@ -474,7 +474,7 @@ void fn_1_F9C(struct om_obj_data * omData) sp24.y = cos((M_PI * CRot.x) / 180.0); sp24.z = (cos((M_PI * CRot.y) / 180.0) * sin((M_PI * CRot.x) / 180.0)); temp_f31 = CRot.z; - + sp18.x = sp24.x * (sp30.x * sp30.x + (1.0f - sp30.x * sp30.x) * cos((M_PI * temp_f31) / 180.0)) + sp24.y * (sp30.x * sp30.y * (1.0f - cos((M_PI * temp_f31) / 180.0)) - sp30.z * sin((M_PI * temp_f31) / 180.0)) + sp24.z * (sp30.x * sp30.z * (1.0f - cos((M_PI * temp_f31) / 180.0)) + sp30.y * sin((M_PI * temp_f31) / 180.0)); @@ -482,7 +482,7 @@ void fn_1_F9C(struct om_obj_data * omData) sp18.y = sp24.y * (sp30.y * sp30.y + (1.0f - sp30.y * sp30.y) * cos((M_PI * temp_f31) / 180.0)) + sp24.x * (sp30.x * sp30.y * (1.0f - cos((M_PI * temp_f31) / 180.0)) + sp30.z * sin((M_PI * temp_f31) / 180.0)) + sp24.z * (sp30.y * sp30.z * (1.0f - cos((M_PI * temp_f31) / 180.0)) - sp30.x * sin((M_PI * temp_f31) / 180.0)); - + sp18.z = sp24.z * (sp30.z * sp30.z + (1.0f - sp30.z * sp30.z) * cos((M_PI * temp_f31) / 180.0)) + (sp24.x * (sp30.x * sp30.z * (1.0 - cos((M_PI * temp_f31) / 180.0)) - sp30.y * sin((M_PI * temp_f31) / 180.0)) + sp24.y * (sp30.y * sp30.z * (1.0 - cos((M_PI * temp_f31) / 180.0)) + sp30.x * sin((M_PI * temp_f31) / 180.0))); @@ -495,7 +495,7 @@ void fn_1_F9C(struct om_obj_data * omData) } teropPatterns = lbl_1_rodata_B8; - + if ((HuPadBtnDown[0] & PAD_BUTTON_X) != 0) { ++lbl_1_bss_24; if (lbl_1_bss_24 >= 7) { @@ -512,7 +512,7 @@ void fn_1_F9C(struct om_obj_data * omData) if ((HuPadBtnDown[0] & PAD_BUTTON_Y) != 0) { var_r30 = MGSeqCreate(0xE, 0x3B); } - + if ((HuPadBtnDown[0] & (PAD_BUTTON_LEFT | PAD_BUTTON_RIGHT | PAD_BUTTON_UP | PAD_BUTTON_DOWN)) != 0) { if ((HuPadBtnDown[0] & PAD_BUTTON_UP) != 0) { MGSeqCreate(0xC, 5, GWPlayerCfg[0].character, -1, -1, -1); @@ -536,7 +536,7 @@ void fn_1_F9C(struct om_obj_data * omData) } // -------------------------------------------------------------------------- // - + void fn_1_20F4(void) { s16 temp_r3; @@ -564,7 +564,7 @@ void fn_1_20F4(void) OSReport("%s\n", lbl_1_data_D8[var_r29]); temp_r3_2 = Hu3DModelObjPtrGet(temp_r3, lbl_1_data_D8[var_r29]); lbl_1_bss_40[var_r29].obj = temp_r3_2; - + Hu3DMotionNoMotSet(temp_r3, lbl_1_data_D8[var_r29], 0x380); lbl_1_bss_40[var_r29].pos.x = temp_r3_2->data.base.pos.x; @@ -578,13 +578,13 @@ void fn_1_20F4(void) lbl_1_bss_40[var_r29].scale.z = temp_r3_2->data.base.scale.z; OSReport( - "%d:(%3.2f,%3.2f,%3.2f),(%3.2f,%3.2f,%3.2f)\n", - var_r29, - temp_r3_2->data.base.pos.x, - temp_r3_2->data.base.pos.y, - temp_r3_2->data.base.pos.z, - temp_r3_2->data.base.rot.x, - temp_r3_2->data.base.rot.y, + "%d:(%3.2f,%3.2f,%3.2f),(%3.2f,%3.2f,%3.2f)\n", + var_r29, + temp_r3_2->data.base.pos.x, + temp_r3_2->data.base.pos.y, + temp_r3_2->data.base.pos.z, + temp_r3_2->data.base.rot.x, + temp_r3_2->data.base.rot.y, temp_r3_2->data.base.rot.z ); } @@ -636,7 +636,7 @@ void fn_1_20F4(void) var_r26 = HuPadSubStkX[1]; } - + if (var_r26 < 0xA && ABS(HuPadSubStkY[1]) < 0xA) { var_r27 = 0x168; var_f29 = 0.0f; @@ -648,7 +648,7 @@ void fn_1_20F4(void) var_f29 = 80.0f; } } - + HuPrcVSleep(); } } @@ -666,7 +666,7 @@ void fn_1_28F8(Point3d * arg0, Point3d * arg1) cam = &Hu3DCamera[0]; C_MTXLookAt(sp18, &cam->pos, &cam->up, &cam->target); PSMTXMultVec(sp18, arg0, &spC); - + temp_f31 = (1.2f * (spC.z * (sin((M_PI * (cam->fov / 2)) / 180.0) / (cos((M_PI * (cam->fov / 2)) / 180.0))))); temp_f30 = (spC.z * (sin((M_PI * (cam->fov / 2)) / 180.0) / (cos((M_PI * (cam->fov / 2)) / 180.0)))); arg1->x = 288.0f + (spC.x * (288.0f / -temp_f31)); @@ -679,7 +679,7 @@ void fn_1_2AFC(void) { HuWinInit(1); temp_r3 = HuWinCreate(-10000.0f, -10000.0f, 480, 0x80, 0); HuWinMesSpeedSet(temp_r3, 3); - + while (TRUE) { HuWinMesSet(temp_r3, 0x200011); HuWinMesWait(temp_r3); @@ -712,7 +712,7 @@ void fn_1_2B68(ModelData * mdl, Mtx arg1) f32 var_f29; // ! - uninitialized f32 var_f28; // ! - uninitialized f32 var_f27; // ! - uninitialized - + if (!lbl_1_bss_30[0]) { lbl_1_bss_30[0] = HuMemDirectMallocNum(HEAP_SYSTEM, FB_SIZE(640, 480), 0x10000000); } @@ -739,14 +739,14 @@ void fn_1_2B68(ModelData * mdl, Mtx arg1) GXSetTexCoordGen2(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, 0x3CU, 0U, 0x7DU); GXSetNumTevStages(1); - sp17.r = - sp17.g = - sp17.b = + sp17.r = + sp17.g = + sp17.b = sp17.a = 255; GXSetChanMatColor(GX_COLOR0A0, sp17); sp17.r = - sp17.g = + sp17.g = sp17.b = 128; sp17.a = 255; GXSetChanAmbColor(GX_COLOR0A0, sp17); @@ -767,7 +767,7 @@ void fn_1_2B68(ModelData * mdl, Mtx arg1) sp10 = lbl_1_bss_454->bmp; lbl_1_bss_2C += 1; HuSprTexLoad(lbl_1_bss_454, 0, 1, GX_REPEAT, GX_REPEAT, GX_LINEAR); - + PPCSync(); GXInitTexObj(&sp30, lbl_1_bss_30[0], 0x280U, 0x1E0U, 4U, GX_CLAMP, GX_CLAMP, 0U); GXInitTexObjLOD(&sp30, GX_LINEAR, GX_LINEAR, 0.0f, 0.0f, 0.0f, 0U, 0U, GX_ANISO_1); @@ -781,7 +781,7 @@ void fn_1_2B68(ModelData * mdl, Mtx arg1) sp18[1][0] = sp150[1][0]; sp18[1][1] = sp150[1][1]; sp18[1][2] = 0.0f; - + PSMTXRotRad(spF0, 0x58, -1.5707964f); mtxRot(spF0, 0.0f, 0.0f, 0.0f); temp_f31 = 0.0015625f; @@ -794,18 +794,18 @@ void fn_1_2B68(ModelData * mdl, Mtx arg1) GXSetIndTexCoordScale(GX_INDTEXSTAGE0, GX_ITS_4, GX_ITS_4); GXSetIndTexMtx(GX_ITM_0, sp18, 0); GXSetTevIndWarp(GX_TEVSTAGE0, GX_INDTEXSTAGE0, 1, 0, GX_ITM_0); - + lbl_1_bss_28 += 5.0f; if (lbl_1_bss_28 > 360.0f) { lbl_1_bss_28 -= 360.0f; } GXBegin(GX_QUADS, GX_VTXFMT0, 4); - + GXPosition3f32(0.0f, 0.0f, 0.0f); GXTexCoord2f32(0.0f, 1.0f); GXNormal3f32(0.0f, var_f30 / 640.0f, var_f29 / 480.0f); - + GXPosition3f32(640.0f, 0.0f, 0.0f); GXTexCoord2f32(0.0f, 1.0f); GXNormal3f32(0.0f, var_f28 / 640.0f, var_f29 / 480.0f); diff --git a/src/REL/w03Dll/main.c b/src/REL/w03Dll/main.c index 8671684d..2bd2656b 100644 --- a/src/REL/w03Dll/main.c +++ b/src/REL/w03Dll/main.c @@ -7,7 +7,9 @@ #include "game/wipe.h" #include "REL/w03Dll.h" #include "game/board/lottery.h" +#include "game/board/main.h" #include "game/board/model.h" +#include "game/board/shop.h" #include "game/board/space.h" #include "game/board/star.h" #include "game/object.h" @@ -30,7 +32,6 @@ void fn_1_10B0(void); s32 fn_1_12C8(void); s32 fn_8006DDE8(s16, f32); void fn_1_10E4(omObjData* arg0); -extern Process *boardObjMan; typedef void (*VoidFunc)(void); extern const VoidFunc _ctors[]; extern const VoidFunc _dtors[]; diff --git a/src/REL/w10Dll/main.c b/src/REL/w10Dll/main.c index 0f3dd29d..14e63a01 100644 --- a/src/REL/w10Dll/main.c +++ b/src/REL/w10Dll/main.c @@ -3,6 +3,7 @@ #include "game/hsfman.h" #include "game/board/lottery.h" #include "game/board/model.h" +#include "game/board/shop.h" #include "game/board/space.h" #include "game/board/star.h" #include "game/board/tutorial.h" diff --git a/src/REL/w10Dll/scene.c b/src/REL/w10Dll/scene.c index 6d5b6783..270f6e41 100644 --- a/src/REL/w10Dll/scene.c +++ b/src/REL/w10Dll/scene.c @@ -3,6 +3,7 @@ #include "game/board/lottery.h" #include "game/board/main.h" #include "game/board/model.h" +#include "game/board/shop.h" #include "game/board/space.h" #include "game/board/star.h" #include "game/board/tutorial.h" diff --git a/src/game/board/lottery.c b/src/game/board/lottery.c index 9c57220a..b10a9f25 100755 --- a/src/game/board/lottery.c +++ b/src/game/board/lottery.c @@ -51,8 +51,6 @@ typedef struct { s16 unk08; } LotteryTicketPickWork; -extern s32 BoardShopHostGet(void); - static void CreateModel(void); static void KillModel(void); static void DestroyLottery(void); diff --git a/src/game/board/main.c b/src/game/board/main.c index e6f6d717..5db7bf48 100644 --- a/src/game/board/main.c +++ b/src/game/board/main.c @@ -14,6 +14,7 @@ #include "game/board/model.h" #include "game/board/pause.h" #include "game/board/player.h" +#include "game/board/shop.h" #include "game/board/space.h" #include "game/board/tutorial.h" #include "game/board/ui.h" diff --git a/src/game/board/model.c b/src/game/board/model.c index 18b67186..cfffff7e 100644 --- a/src/game/board/model.c +++ b/src/game/board/model.c @@ -249,16 +249,16 @@ s16 BoardModelCreateCharacter(s32 character, s32 data_num, s32 *mot_list, s32 li s16 BoardModelCreateParam(BoardModelParam *param, Vec *pos, Vec *rot) { float unk_param; - s16 model = BoardModelCreate(param->data_num, NULL, param->link); + s16 model = BoardModelCreate(param->data_num, NULL, param->unk4.link); if(model == -1) { return -1; } - BoardModelMotionStart(model, 0, (param->pause) ? 0x40000001 : 0); - if(!param->start_mot) { + BoardModelMotionStart(model, 0, (param->unk4.pause) ? 0x40000001 : 0); + if(!param->unk4.start_mot) { BoardModelMotionSpeedSet(model, 0.0f); } - BoardModelExistDupe(model, param->field04_bit0); - BoardModelVisibilitySet(model, param->visible); + BoardModelExistDupe(model, param->unk4.field04_bit0); + BoardModelVisibilitySet(model, param->unk4.visible); if(pos) { BoardModelPosSetV(model, pos); } diff --git a/src/game/board/shop.c b/src/game/board/shop.c new file mode 100755 index 00000000..c5e6ebe6 --- /dev/null +++ b/src/game/board/shop.c @@ -0,0 +1,1175 @@ +#include "game/board/shop.h" +#include "game/audio.h" +#include "game/gamework.h" +#include "game/gamework_data.h" +#include "game/object.h" +#include "game/objsub.h" +#include "game/pad.h" +#include "game/process.h" +#include "game/board/audio.h" +#include "game/board/com.h" +#include "game/board/com_path.h" +#include "game/board/item.h" +#include "game/board/main.h" +#include "game/board/model.h" +#include "game/board/player.h" +#include "game/board/space.h" +#include "game/board/tutorial.h" +#include "game/board/ui.h" +#include "game/board/view.h" +#include "game/board/window.h" + +#include "dolphin.h" +#include "math.h" + +typedef struct { + struct { + u8 unk00_field0 : 1; + u8 unk00_field1 : 4; + }; + u8 unk01; + s8 unk02; + s8 unk03; + s8 unk04; + char unk05[1]; + s16 unk06; +} ShopWinWork; + +typedef struct { + struct { + u8 unk00_field0 : 1; + u8 unk00_field1 : 3; + }; + char unk01[1]; + s16 unk02; + u16 unk04; +} ItemGiveWork; + +typedef struct { + struct { + u8 unk00_field0 : 1; + u8 unk00_field1 : 2; + }; + u8 unk01; + s8 unk02; + s8 unk03; + u8 unk04; + u8 unk05; + s16 unk06; +} ItemChoiceWork; + +static void ExecShop(void); +static void DestroyShop(void); +static void PopupShop(void); +static void CloseShop(void); +static void CreateShopWin(void); +static void UpdateShopWin(omObjData *arg0); +static void SetShopWinItem(ShopWinWork *arg0, omObjData *arg1); +static void PauseShopWin(void); +static void StartItemGive(void); +static void ExecItemGive(omObjData *arg0); +static void MoveItemGive(omObjData *arg0, ItemGiveWork *arg1); +static void ShrinkItemGive(omObjData *arg0, ItemGiveWork *arg1); +static void WaitItemGive(omObjData *arg0, ItemGiveWork *arg1); +static void GetShopItems(s32 arg0); +static void GetDefaultShopItems(s32 arg0); +static void SortShopItems(void); +static void DecideComEnter(s32 arg0); +static void DecideComBuy(s32 arg0); +static s32 GetComItemChoice(s32 arg0); +static void WaitItemChoice(void); +static void CreateShopItemChoice(s32 arg0, s32 arg1); +static s32 GetShopItemChoice(void); +static s32 GetShopItemWinChoice(void); +static void MoveShopItemChoice(omObjData *arg0, ItemChoiceWork *arg1); +static void UpdateShopItemChoice(omObjData *arg0); +static void GetShopItemChoiceInput(ItemChoiceWork *arg0, omObjData *arg1, u32 *arg2); + +static s32 activeItemTbl[5]; +static s32 choiceEnableTbl[6]; + +static s16 shopMdlIdx[2][1]; +static s16 *shopMdlPtr; +static s8 shopPlayer; +static s16 angleVal; +static s32 comF; +static omObjData *itemChoiceObj; +static omObjData *itemGiveObj; +static omObjData *shopWinObj; +static Process *shopProc; + +static s16 itemMdl = -1; +static s8 itemChoice = -1; + +static BoardModelParam shopMdlParam[1] = { + { 0x00070094, { 0, 1, 0, 0, 0 }, -1 } +}; + +static s16 hostMdl = -1; +static s16 shopMot[3] = { -1, -1, -1 }; +static s8 itemCurChoice = -1; + +static s8 defaultItemTbl[5] = { + 0x05, 0x07, 0x02, 0x03, 0x00 +}; + +static s32 hostMessTbl[] = { + 0x000F0004, + 0x000F0007, + 0x000F000A, + 0x000F000D, + 0x000F0010, + 0x000F0013, + 0x000F0004, + 0x000F0024, + 0x000F0024 +}; + +static s8 itemPriceTbl[] = { + 5, 5, 15, 15, + 10, 10, 15, 15, + 15, 15, 0, 25, + 30, 30, 0, 0 +}; + +static s32 shopMotTbl[9][3] = { + { 0x00020001, 0x00020003, 0x00020004 }, + { 0x00020009, 0x0002000B, 0x0002000C }, + { 0x0002000E, 0x00020010, 0x00020011 }, + { 0x00020018, 0x0002001A, 0x0002001B }, + { 0x0002001D, 0x0002001F, 0x00020020 }, + { 0x00020022, 0x00020024, 0x00020025 }, + { 0x00020009, 0x0002000B, 0x0002000C }, + { 0x0002002A, 0x0002002C, 0x0002002D }, + { 0x0002002A, 0x0002002C, 0x0002002D } +}; + +void BoardShopHostSet(s16 arg0) { + hostMdl = arg0; +} + +s16 BoardShopHostGet(void) { + return hostMdl; +} + +void BoardShopInit(void) { + BoardModelParam *var_r29; + Vec sp1C; + Vec sp10; + s32 j; + s32 i; + s32 sp8[2] = { + 0x00080000, + 0x00100000 + }; + + for (i = 0; i < 2; i++) { + BoardSpaceLinkTransformGet(sp8[i], &sp1C, &sp10, 0); + sp1C.y -= 5.0f; + for (j = 0; j < 1; j++) { + var_r29 = &shopMdlParam[j]; + shopMdlIdx[i][j] = BoardModelCreateParam(var_r29, &sp1C, &sp10); + } + } + BoardModelVisibilitySet(hostMdl, 0); +} + +void BoardShopKill(void) { + s32 i; + s32 j; + + for (i = 0; i < 2; i++) { + for (j = 0; j < 1; j++) { + if (shopMdlIdx[i][j] != -1) { + BoardModelKill(shopMdlIdx[i][j]); + shopMdlIdx[i][j] = -1; + } + } + } +} + +void BoardShopExec(s32 player, s32 space) { + if (BoardPlayerSizeGet(GWSystem.player_curr) == 2) { + return; + } + shopPlayer = player; + BoardDiceDigit2DShowSet(0); + shopProc = HuPrcChildCreate(ExecShop, 0x2003, 0x3800, 0, boardMainProc); + HuPrcDestructorSet2(shopProc, DestroyShop); + while (shopProc) { + HuPrcVSleep(); + } + BoardDiceDigit2DShowSet(1); +} + +static void ExecShop(void) { + Vec sp38; + Vec sp2C; + Vec sp20; + Vec sp14; + Vec sp8; + float var_f30; + float temp_f31; + s16 temp_r25; + s16 temp_r28; + u32 var_r30; + s32 var_r29; + s32 temp_r27; + s32 temp_r26; + s32 temp_r24; + s32 var_r23; + s32 i; + + itemCurChoice = -1; + temp_r27 = GWBoardGet(); + temp_r26 = BoardWinPortraitGet(); + comF = 0; + temp_r28 = GWPlayer[shopPlayer].space_curr; + if (BoardSpaceFlagGet(0, temp_r28) & 0x80000) { + shopMdlPtr = shopMdlIdx[0]; + } else { + shopMdlPtr = shopMdlIdx[1]; + } + BoardPlayerIdleSet(shopPlayer); + var_r30 = 0; + if (BoardPlayerCoinsGet(shopPlayer) < 5) { + var_r30 = 0xF0003; + } + if (BoardPlayerItemCount(shopPlayer) == 3) { + var_r30 = 0xF0002; + } + if (GWSystem.turn == GWSystem.max_turn) { + var_r30 = 0xF0001; + } + if (var_r30 != 0) { + BoardWinCreate(0, var_r30, -1); + BoardWinWait(); + BoardWinKill(); + HuPrcEnd(); + } + BoardWinCreateChoice(0, 0xF0000, -1, 0); + DecideComEnter(shopPlayer); + BoardWinWait(); + if (BoardWinChoiceGet() != 0) { + HuPrcEnd(); + } + BoardWinKill(); + BoardAudSeqPause(0, 1, 1000); + BoardStatusShowSetAll(0); + temp_r25 = BoardSpaceLinkFlagSearch(0, temp_r28, 0x02000000); + BoardSpacePosGet(0, temp_r28, &sp38); + BoardSpacePosGet(0, temp_r25, &sp2C); + PSVECSubtract(&sp2C, &sp38, &sp20); + PSVECNormalize(&sp20, &sp20); + temp_f31 = 180.0 * (atan2(-sp20.x, -sp20.z) / M_PI); + sp14.x = -10.0f; + sp14.y = temp_f31; + sp14.z = 0.0f; + sp8.x = 0.0f; + sp8.y = 170.0f; + sp8.z = 0.0f; + BoardCameraMotionStartEx(shopMdlPtr[0], &sp14, &sp8, 1360.0f, -1.0f, 0x1B); + HuAudFXPlay(0x330); + HuAudFXPlay(0x32D); + PopupShop(); + BoardModelMotionShiftSet(BoardShopHostGet(), shopMot[2], 0.0f, 4.0f, 0); + HuPrcSleep(4); + BoardPlayerRotSet(shopPlayer, 0.0f, temp_f31, 0.0f); + BoardPlayerMoveBetween(shopPlayer, temp_r28, temp_r25); + BoardPlayerIdleSet(shopPlayer); + BoardMusStart(1, 3, 0x7F, 0); + while (!BoardModelMotionEndCheck(BoardShopHostGet())) { + HuPrcVSleep(); + } + BoardModelMotionStart(BoardShopHostGet(), shopMot[0], 0x40000001); + BoardStatusShowSetForce(shopPlayer); + BoardStatusShowSet(shopPlayer, 1); + GetShopItems(shopPlayer); + SortShopItems(); + while (1) { + BoardWinCreateChoice(1, hostMessTbl[temp_r27], temp_r26, 0); + BoardWinAttrSet(0x10); + DecideComBuy(shopPlayer); + BoardWinWait(); + var_r29 = BoardWinChoiceGet(); + if (var_r29 == 1) { + BoardWinCreate(2, hostMessTbl[temp_r27] + 1, temp_r26); + BoardWinWait(); + BoardWinKill(); + break; + } + if (var_r29 != 0) { + BoardViewMapExec(shopPlayer); + continue; + } + CreateShopWin(); + BoardWinCreate(1, hostMessTbl[temp_r27] + 2, temp_r26); + BoardWinPriSet(1000); + for (i = 0; i < 5; i++) { + var_r30 = activeItemTbl[i] + 0xF0000; + var_r30 += 0x16; + BoardWinInsertMesSet(var_r30, i); + var_r29 = itemPriceTbl[activeItemTbl[i]]; + if (var_r29 > BoardPlayerCoinsGet(shopPlayer)) { + BoardWinChoiceDisable(i); + choiceEnableTbl[i] = 0; + } else { + choiceEnableTbl[i] = 1; + } + } + choiceEnableTbl[5] = 1; + BoardWinSpeedSet(0); + BoardWinPause(); + BoardWinAttrSet(0x10); + HuPrcSleep(0xF); + var_r29 = GetComItemChoice(shopPlayer); + CreateShopItemChoice(shopPlayer, var_r29); + WaitItemChoice(); + itemCurChoice = GetShopItemChoice(); + BoardWinKill(); + HuPrcSleep(0xF); + if (itemCurChoice == -1 || itemCurChoice == 5 || itemCurChoice == 0x7F) { + PauseShopWin(); + } else { + PauseShopWin(); + while (!BoardStatusStopCheck(shopPlayer)) { + HuPrcVSleep(); + } + if (itemCurChoice == 5) { + BoardWinCreate(2, hostMessTbl[temp_r27] + 1, temp_r26); + BoardWinWait(); + BoardWinKill(); + break; + } + temp_r24 = itemPriceTbl[activeItemTbl[itemCurChoice]]; + if (temp_r24 >= 20) { + var_r23 = 3; + } else { + var_r23 = 6; + } + var_f30 = BoardDAngleCalc(180.0f + BoardPlayerRotYGet(shopPlayer)); + BoardPlayerMotBlendSet(shopPlayer, var_f30, 0xF); + for (i = 0; i < temp_r24; i++) { + BoardPlayerCoinsAdd(shopPlayer, -1); + HuAudFXPlay(0xE); + HuPrcSleep(var_r23); + } + HuAudFXPlay(0xF); + StartItemGive(); + while (!BoardPlayerMotBlendCheck(shopPlayer)) { + HuPrcVSleep(); + } + while (itemGiveObj) { + HuPrcVSleep(); + } + if (activeItemTbl[itemCurChoice] != 0xD) { + BoardPlayerItemAdd(shopPlayer, activeItemTbl[itemCurChoice]); + } + BoardPlayerMotionShiftSet(shopPlayer, 0xC, 0.0f, 4.0f, 0); + HuPrcSleep(5); + BoardPlayerMotionEndWait(shopPlayer); + HuPrcSleep(15); + break; + } + } + BoardAudSeqFadeOut(1, 1000); + BoardModelVisibilitySet(itemMdl, 0); + BoardModelMotionShiftSet(BoardShopHostGet(), shopMot[1], 0.0f, 10.0f, 0x40000001); + BoardStatusShowSet(shopPlayer, 0); + BoardCameraTargetPlayerSet(shopPlayer); + BoardCameraMotionWait(); + BoardCameraViewSet(1); + BoardPlayerRotSet(shopPlayer, 0.0f, temp_f31, 0.0f); + BoardPlayerMoveBetween(shopPlayer, temp_r25, temp_r28); + BoardPlayerIdleSet(shopPlayer); + BoardStatusShowSetAll(1); + BoardCameraMotionWait(); + BoardAudSeqPause(0, 0, 1000); + CloseShop(); + HuPrcEnd(); +} + +static void DestroyShop(void) { + s16 temp_r30; + s32 i; + + for (i = 0; i < 2; i++) { + BoardModelHookReset(shopMdlIdx[0][i]); + } + temp_r30 = BoardShopHostGet(); + for (i = 0; i < 3; i++) { + if (shopMot[i] != -1) { + BoardModelMotionKill(temp_r30, shopMot[i]); + shopMot[i] = -1; + } + } + PauseShopWin(); + if (itemMdl != -1) { + BoardModelKill(itemMdl); + itemMdl = -1; + } + shopProc = NULL; +} + +static void PopupShop(void) { + s32 i; + + for (i = 0; i < 2; i++) { + BoardModelHookSet(shopMdlIdx[i][0], "shop_noko", BoardShopHostGet()); + } + for (i = 0; i < 3; i++) { + shopMot[i] = BoardModelMotionCreate(BoardShopHostGet(), shopMotTbl[GWBoardGet()][i]); + } + BoardModelMotionStart(BoardShopHostGet(), shopMot[0], 0x40000001); + BoardModelVisibilitySet(BoardShopHostGet(), 1); + BoardModelMotionStart(BoardShopHostGet(), 1, 0x40000001); + BoardModelMotionStart(shopMdlPtr[0], 0, 0); + BoardModelMotionSpeedSet(shopMdlPtr[0], 1.0f); + omVibrate(shopPlayer, 0xC, 6, 6); + HuAudFXPlay(0x32D); + HuAudFXPlay(0x344); + while (BoardModelMotionTimeGet(shopMdlPtr[0]) < 14.0f) { + HuPrcVSleep(); + } + HuAudFXPlay(0x32E); + while (BoardModelMotionTimeGet(shopMdlPtr[0]) < 28.0f) { + HuPrcVSleep(); + } + HuAudFXPlay(0x32F); + while (!BoardModelMotionEndCheck(shopMdlPtr[0])) { + HuPrcVSleep(); + } +} + +static void CloseShop(void) { + BoardModelMotionStart(shopMdlPtr[0], 0, 0x40000004); + while (BoardModelMotionTimeGet(shopMdlPtr[0]) > 28.0f) { + HuPrcVSleep(); + } + HuAudFXPlay(0x32F); + while (BoardModelMotionEndCheck(shopMdlPtr[0]) == 0) { + HuPrcVSleep(); + } + HuAudFXPlay(0x32E); + BoardModelAttrReset(shopMdlPtr[0], 0x40000004); + BoardModelMotionSpeedSet(shopMdlPtr[0], 0.0f); + BoardModelVisibilitySet(BoardShopHostGet(), 0); +} + +static void CreateShopWin(void) { + Vec sp8; + omObjData *var_r31; + ShopWinWork *var_r30; + + var_r31 = omAddObjEx(boardObjMan, 0x109, 0, 0, -1, UpdateShopWin); + var_r30 = OM_GET_WORK_PTR(var_r31, ShopWinWork); + var_r30->unk00_field0 = 0; + var_r30->unk06 = -1; + var_r30->unk00_field1 = 0xFF; + var_r30->unk02 = -1; + var_r30->unk03 = -1; + var_r30->unk01 = 0xC; + var_r30->unk04 = 0; + shopWinObj = var_r31; + var_r30->unk06 = HuWinCreate(36.0f, 344.0f, 0x1F8, 0x60, 0); + HuWinMesSpeedSet(var_r30->unk06, 0); + HuWinDrawNoSet(var_r30->unk06, 0x40); + HuWinExAnimIn(var_r30->unk06); + sp8.x = 84.0f; + sp8.y = 392.0f; + sp8.z = 400.0f; + var_r31->scale.x = var_r31->scale.y = var_r31->scale.z = 0.25f; + Hu3D2Dto3D(&sp8, 1, &sp8); + var_r31->trans.x = sp8.x; + var_r31->trans.y = sp8.y; + var_r31->trans.z = sp8.z; + var_r31->scale.x = var_r31->scale.y = var_r31->scale.z = 1.0f; +} + +static void UpdateShopWin(omObjData *arg0) { + Vec spC; + float var_f29; + float var_f28; + ShopWinWork *temp_r28; + Mtx sp48; + Mtx sp18; + + temp_r28 = OM_GET_WORK_PTR(arg0, ShopWinWork); + if (temp_r28->unk00_field0 != 0 || BoardIsKill()) { + if (temp_r28->unk06 != -1) { + HuWinKill(temp_r28->unk06); + } + shopWinObj = NULL; + omDelObjEx(HuPrcCurrentGet(), arg0); + return; + } + if (temp_r28->unk01 != 0) { + temp_r28->unk01--; + return; + } + temp_r28->unk02 = GetShopItemWinChoice(); + if (temp_r28->unk02 != -1) { + if (temp_r28->unk04 == 90 && temp_r28->unk03 != temp_r28->unk02) { + if (temp_r28->unk02 == 5) { + HuWinDispOff(temp_r28->unk06); + if (temp_r28->unk00_field0 == 0) { + BoardModelVisibilitySet(itemMdl, 0); + } + } else { + HuWinDispOn(temp_r28->unk06); + SetShopWinItem(temp_r28, arg0); + BoardModelVisibilitySet(itemMdl, 1); + temp_r28->unk04 = 0; + } + temp_r28->unk03 = temp_r28->unk02; + } + if (itemChoice == 0x7F) { + BoardModelVisibilitySet(itemMdl, 0); + HuWinDispOff(temp_r28->unk06); + } + var_f29 = 0.0f; + if (temp_r28->unk04 < 90) { + temp_r28->unk04 += 15; + if (temp_r28->unk04 > 90) { + temp_r28->unk04 = 90; + } + OSs8tof32(&temp_r28->unk04, &var_f28); + arg0->scale.x = arg0->scale.y = arg0->scale.z = 0.25 * sin(var_f28 * M_PI / 180.0); + } + if (temp_r28->unk00_field1 == 5) { + var_f29 = -12.5f; + } + arg0->rot.y = BoardDAngleCalc(arg0->rot.y + 2.0f); + BoardCameraRotGet(&spC); + PSMTXRotRad(sp48, 'y', MTXDegToRad(arg0->rot.y)); + PSMTXRotRad(sp18, 'x', MTXDegToRad(spC.x + 10.0f)); + PSMTXConcat(sp18, sp48, sp48); + BoardModelMtxSet(itemMdl, &sp48); + BoardModelRotSet(itemMdl, 0.0f, 0.0f, 0.0f); + BoardModelPosSet(itemMdl, arg0->trans.x, arg0->trans.y + var_f29, arg0->trans.z); + BoardModelScaleSet(itemMdl, arg0->scale.x, arg0->scale.y, arg0->scale.z); + OSf32tos16(&arg0->rot.y, &angleVal); + } +} + +static void SetShopWinItem(ShopWinWork *arg0, omObjData *arg1) { + Vec spC; + s32 var_r26; + s8 temp_r28; + + temp_r28 = activeItemTbl[arg0->unk02]; + if (arg0->unk00_field1 != temp_r28) { + if (itemMdl != -1) { + BoardModelKill(itemMdl); + itemMdl = -1; + } + var_r26 = BoardItemModelGet(temp_r28); + itemMdl = BoardModelCreate(var_r26, NULL, 0); + BoardModelLayerSet(itemMdl, 6); + HuWinMesSet(arg0->unk06, BoardItemNameGet(temp_r28)); + arg0->unk04 = 0; + arg0->unk00_field1 = temp_r28; + if (temp_r28 == 4) { + BoardModelMotionStart(itemMdl, 0, 0x40000001); + BoardModelMotionSpeedSet(itemMdl, 0.033333335f); + } + BoardCameraDirGet(&spC); + arg1->rot.y = BoardDAngleCalc(180.0 * (atan2(-spC.x, -spC.z) / M_PI)); + OSf32tos16(&arg1->rot.y, &angleVal); + } +} + +static void PauseShopWin(void) { + if (shopWinObj) { + OM_GET_WORK_PTR(shopWinObj, ShopWinWork)->unk00_field0 = 1; + shopWinObj = NULL; + } +} + +void StartItemGive(void) { + Vec sp14; + Vec sp8; + omObjData *temp_r30; + ItemGiveWork *temp_r29; + Mtx sp20; + + temp_r30 = omAddObjEx(boardObjMan, 0x109, 0, 0, -1, ExecItemGive); + itemGiveObj = temp_r30; + temp_r29 = OM_GET_WORK_PTR(temp_r30, ItemGiveWork); + temp_r29->unk00_field0 = 0; + temp_r29->unk00_field1 = 0; + temp_r29->unk04 = 0; + temp_r29->unk02 = 0; + BoardModelMotionStart(itemMdl, 0, 0); + BoardModelMotionSpeedSet(itemMdl, 0.0f); + BoardModelPosGet(itemMdl, &sp14); + PSMTXIdentity(sp20); + BoardModelMtxSet(itemMdl, &sp20); + OSs16tof32(&angleVal, &temp_r30->scale.z); + temp_r30->scale.z = -temp_r30->scale.z / 40.0f; + temp_r30->scale.x = 0.25f; + temp_r30->scale.y = 0.015f; + BoardPlayerPosGet(shopPlayer, &sp8); + temp_r30->trans.x = sp14.x; + temp_r30->trans.y = sp14.y; + temp_r30->trans.z = sp14.z; + temp_r30->rot.y = sp8.y + 250.0f; + temp_r30->rot.x = (sp8.x - sp14.x) / 50.0f; + temp_r30->rot.z = (sp8.z - sp14.z) / 50.0f; + itemGiveObj = temp_r30; +} + +static void ExecItemGive(omObjData *arg0) { + ItemGiveWork *temp_r29; + float var_f30; + + temp_r29 = OM_GET_WORK_PTR(arg0, ItemGiveWork); + if (temp_r29->unk00_field0 != 0 || BoardIsKill()) { + itemGiveObj = NULL; + BoardModelVisibilitySet(itemMdl, 0); + omDelObjEx(HuPrcCurrentGet(), arg0); + return; + } + if (temp_r29->unk04 != 0) { + temp_r29->unk04--; + return; + } + switch (temp_r29->unk00_field1) { + case 0: + MoveItemGive(arg0, temp_r29); + break; + case 1: + ShrinkItemGive(arg0, temp_r29); + break; + case 2: + WaitItemGive(arg0, temp_r29); + break; + } + OSs16tof32(&angleVal, &var_f30); + BoardModelPosSet(itemMdl, arg0->trans.x, arg0->trans.y, arg0->trans.z); + BoardModelScaleSet(itemMdl, arg0->scale.x, arg0->scale.x, arg0->scale.x); + BoardModelRotYSet(itemMdl, var_f30); +} + +static void MoveItemGive(omObjData *arg0, ItemGiveWork *arg1) { + Vec sp1C; + Vec sp10; + float temp_f27; + float var_f26; + + if (arg1->unk02 >= 50.0f) { + arg1->unk02 = 0; + if (activeItemTbl[itemCurChoice] == 0xD) { + arg1->unk00_field1 = 2; + BoardMakeRandomItem(); + BoardItemStart(GWSystem.player_curr, 0xD); + } else { + arg1->unk00_field1 = 1; + arg1->unk04 = 0xF; + BoardPlayerPosGet(shopPlayer, &sp1C); + if (BoardPlayerSizeGet(shopPlayer) == 1) { + arg0->rot.x = (sp1C.y + 30.0f - arg0->trans.y) / 22.5f; + } else { + arg0->rot.x = (sp1C.y + 70.0f - arg0->trans.y) / 22.5f; + } + arg0->trans.y = arg0->rot.y; + arg0->scale.x = 1.0f; + } + return; + } + OSs16tof32(&arg1->unk02, &temp_f27); + arg0->trans.y += 12.0f; + if (arg1->unk02 >= 40.0f) { + BoardPlayerPosGet(shopPlayer, &sp1C); + arg0->scale.x = 1.0f; + arg0->trans.x = sp1C.x; + arg0->trans.z = sp1C.z; + temp_f27 = 40.0f - (50.0f - temp_f27); + temp_f27 = -0.08166667f * temp_f27 * temp_f27; + arg0->trans.y += temp_f27; + BoardCameraDirGet(&sp10); + var_f26 = BoardDAngleCalc(180.0 * (atan2(-sp10.x, -sp10.z) / M_PI)); + OSf32tos16(&var_f26, &angleVal); + } else { + arg0->scale.x += arg0->scale.y; + arg0->trans.x += arg0->rot.x; + arg0->trans.z += arg0->rot.z; + OSs16tof32(&angleVal, &var_f26); + var_f26 += arg0->scale.z; + OSf32tos16(&var_f26, &angleVal); + } + if (arg0->trans.y < arg0->rot.y) { + arg0->trans.y = arg0->rot.y; + } + arg1->unk02++; +} + +static void ShrinkItemGive(omObjData *arg0, ItemGiveWork *arg1) { + float var_f30; + + if (arg1->unk02 == 0) { + HuAudFXPlay(0x30D); + } + if (arg1->unk02 >= 90) { + arg1->unk00_field0 = 1; + BoardModelVisibilitySet(itemMdl, 0); + return; + } + OSs16tof32(&arg1->unk02, &var_f30); + if (BoardPlayerSizeGet(shopPlayer) != 1) { + var_f30 *= 1.5f; + } + if (var_f30 > 90.0f) { + var_f30 = 90.0f; + } + arg0->scale.x = cos(var_f30 * M_PI / 180.0); + arg0->trans.y += arg0->rot.x; + angleVal += 8; + if (angleVal > 360) { + angleVal -= 360; + } + arg1->unk02 += 4; +} + +static void WaitItemGive(omObjData *arg0, ItemGiveWork *arg1) { + if (arg1->unk02 > 20) { + BoardModelVisibilitySet(itemMdl, 0); + } else { + arg1->unk02++; + } + if (BoardItemDoneCheck()) { + arg1->unk00_field0 = 1; + } +} + +static s8 itemPrioTbl[2][5][14] = { + { + { 0x14, 0x14, 0x0F, 0x0F, 0x05, 0x07, 0x05, 0x05, 0x00, 0x05, 0x00, 0x03, 0x00, 0x00 }, + { 0x0F, 0x0F, 0x0D, 0x0A, 0x0A, 0x0A, 0x0A, 0x05, 0x00, 0x07, 0x00, 0x05, 0x00, 0x00 }, + { 0x07, 0x07, 0x0E, 0x0C, 0x0A, 0x0A, 0x0A, 0x08, 0x05, 0x09, 0x00, 0x08, 0x00, 0x00 }, + { 0x0A, 0x0A, 0x0D, 0x0C, 0x0A, 0x0A, 0x07, 0x0A, 0x05, 0x05, 0x00, 0x08, 0x00, 0x00 }, + { 0x07, 0x07, 0x0D, 0x0A, 0x0D, 0x07, 0x0A, 0x0A, 0x07, 0x08, 0x00, 0x08, 0x00, 0x00 } + }, + { + { 0x0F, 0x0F, 0x12, 0x0F, 0x05, 0x05, 0x05, 0x05, 0x00, 0x05, 0x00, 0x02, 0x05, 0x05 }, + { 0x0F, 0x0F, 0x0D, 0x0A, 0x07, 0x0A, 0x07, 0x03, 0x00, 0x07, 0x00, 0x00, 0x05, 0x08 }, + { 0x05, 0x04, 0x0D, 0x0C, 0x0A, 0x05, 0x0A, 0x08, 0x05, 0x05, 0x00, 0x05, 0x08, 0x0A }, + { 0x07, 0x04, 0x0D, 0x0C, 0x08, 0x08, 0x07, 0x0A, 0x05, 0x05, 0x00, 0x05, 0x08, 0x08 }, + { 0x03, 0x02, 0x0D, 0x0A, 0x0D, 0x03, 0x08, 0x08, 0x07, 0x07, 0x00, 0x08, 0x08, 0x0A } + } +}; + +static s8 rankItemGroupTbl[2][4][3] = { + { + { 0x00, 0x01, 0x03 }, { 0x00, 0x02, 0x04 }, + { 0x00, 0x02, 0x04 }, { 0x00, 0x02, 0x04 } + }, + { + { 0x00, 0x01, 0x03 }, { 0x00, 0x02, 0x04 }, + { 0x00, 0x02, 0x04 }, { 0x00, 0x02, 0x04 } + } +}; + +static float cursorPosTbl[6][2] = { + { 190.0f, 182.0f }, + { 190.0f, 208.0f }, + { 190.0f, 234.0f }, + { 190.0f, 260.0f }, + { 190.0f, 286.0f }, + { 190.0f, 312.0f } +}; + +static void GetShopItems(s32 arg0) { + s32 temp_r25; + s32 temp_r20; + s32 temp_r19; + s32 temp_r18; + s32 var_r24; + s32 var_r23; + s32 temp_r22; + s32 var_r27; + s32 var_r26; + s32 var_r28; + s32 var_r29; + s32 var_r30; + + temp_r22 = 3.0f * ((float) GWSystem.turn / GWSystem.max_turn); + if (BoardPlayerCoinsGet(arg0) < 30) { + var_r27 = 0; + } else { + var_r27 = 1; + } + temp_r19 = rankItemGroupTbl[var_r27][GWPlayer[arg0].rank][temp_r22]; + activeItemTbl[0] = activeItemTbl[1] = activeItemTbl[2] = activeItemTbl[3] = activeItemTbl[4] = -1; + temp_r20 = BoardPlayerCoinsGet(shopPlayer); + if (GWBoardGet() == 7 || GWBoardGet() == 8) { + GetDefaultShopItems(arg0); + return; + } + var_r23 = 0; + var_r29 = 0; + while (var_r29 < 5) { + temp_r18 = BoardRandMod(100); + var_r26 = 0; + for (var_r30 = 13; var_r30 >= 0; var_r30--) { + temp_r25 = itemPrioTbl[var_r27][temp_r19][var_r30]; + if (temp_r25 != 0) { + var_r26 += temp_r25; + if (temp_r18 <= var_r26) { + var_r24 = 0; + for (var_r28 = 0; var_r28 < var_r29; var_r28++) { + if (var_r30 == activeItemTbl[var_r28]) { + var_r24 = 1; + break; + } + } + if (var_r24 == 0 && (temp_r20 >= itemPriceTbl[var_r30] || var_r23 != 0)) { + var_r23 = 1; + activeItemTbl[var_r29] = var_r30; + break; + } + } + } + } + if (activeItemTbl[var_r29] != -1) { + var_r29++; + } + } +} + +static void GetDefaultShopItems(s32 arg0) { + s32 temp_r29; + s32 var_r31; + s32 var_r30; + + temp_r29 = BoardRandMod(100); + if (temp_r29 > 90) { + var_r30 = 3; + } else if (temp_r29 > 40) { + var_r30 = BoardRandMod(2) + 1; + } else { + var_r30 = 0; + } + for (var_r31 = 0; var_r31 < 5; var_r31++) { + activeItemTbl[var_r31] = defaultItemTbl[var_r30]; + } +} + +static void SortShopItems(void) { + s32 sp8[5]; + s32 var_r29; + s32 i; + s32 j; + + for (i = 0; i < 5; i++) { + sp8[i] = itemPriceTbl[activeItemTbl[i]]; + } + for (i = 0; i < 4; i++) { + for (j = 4; j >= i + 1; j--) { + if (sp8[j] < sp8[j - 1]) { + var_r29 = activeItemTbl[j]; + activeItemTbl[j] = activeItemTbl[j - 1]; + activeItemTbl[j - 1] = var_r29; + var_r29 = sp8[j]; + sp8[j] = sp8[j - 1]; + sp8[j - 1] = var_r29; + } + } + } +} + +static void DecideComEnter(s32 arg0) { + s32 temp_r27; + s32 temp_r30; + s32 temp_r29; + s32 temp_r26; + u32 var_r28; + + if (!GWPlayer[arg0].com) { + return; + } + temp_r26 = GWPlayer[arg0].roll; + switch (GWPlayer[arg0].diff) { + case 0: + var_r28 = 40; + break; + case 1: + var_r28 = 20; + break; + case 2: + var_r28 = 4; + break; + case 3: + var_r28 = 0; + break; + } + if (GWBoardGet() == 7 || GWBoardGet() == 8) { + if (BoardPlayerCoinsGet(arg0) < 15) { + BoardComKeySetRight(); + return; + } + } else { + temp_r27 = GWPlayer[arg0].space_curr; + temp_r30 = BoardComPathShortcutLenGet(temp_r27, 8, 0); + temp_r29 = BoardComPathShortcutLenGet(temp_r27, 8, 1); + if ((temp_r30 != 0 || temp_r29 != 0) + && (BoardPlayerCoinsGet(arg0) >= 17 || (temp_r29 >= temp_r26 && temp_r30 >= temp_r26)) + && BoardPlayerCoinsGet(arg0) < 40 + && ((temp_r30 < 20 && temp_r30 > 0) || (temp_r29 < 10 && temp_r29 > 0)) + && BoardRandMod(100) > var_r28) { + BoardComKeySetRight(); + return; + } + } + BoardComKeySetLeft(); +} + +static void DecideComBuy(s32 arg0) { + if (!GWPlayer[arg0].com) { + return; + } + if (comF != 0) { + BoardComKeySetDown(); + } else { + BoardComKeySetUp(); + } +} + +static s32 GetComItemChoice(s32 arg0) { + s16 sp8; + s32 temp_r26; + s32 var_r28 = 0; + s8 var_r25; + s8 var_r27; + s8 var_r30; + s32 i; + + if (!GWPlayer[arg0].com) { + return 0; + } + sp8 = GWPlayer[arg0].space_curr; + temp_r26 = BoardPlayerCoinsGet(arg0); + for (var_r27 = i = 0; i < 5; i++) { + if (temp_r26 >= itemPriceTbl[activeItemTbl[i]]) { + var_r30 = BoardComItemWeightGet(arg0, activeItemTbl[i]); + } else { + var_r30 = 0; + } + if (BoardPlayerItemFind(arg0, activeItemTbl[i]) != -1) { + var_r30 = 0; + } + if (var_r30 > var_r27) { + var_r27 = var_r30; + var_r25 = i; + } + } + if (var_r27 == 0) { + comF = 1; + var_r28 = 5; + } else { + var_r28 = var_r25; + } + return var_r28; +} + +static void WaitItemChoice(void) { + while (itemChoiceObj) { + HuPrcVSleep(); + } +} + +static void CreateShopItemChoice(s32 arg0, s32 arg1) { + omObjData *temp_r30; + ItemChoiceWork *var_r31; + s16 spC; + + temp_r30 = omAddObjEx(boardObjMan, 0x7E01, 0, 0, -1, UpdateShopItemChoice); + itemChoiceObj = temp_r30; + itemChoice = -1; + var_r31 = OM_GET_WORK_PTR(temp_r30, ItemChoiceWork); + var_r31->unk00_field0 = 0; + var_r31->unk00_field1 = arg0; + var_r31->unk01 = 0xA; + var_r31->unk05 = 0; + var_r31->unk02 = 0; + var_r31->unk03 = arg1; + var_r31->unk06 = HuSprGrpCreate(1); + temp_r30->trans.x = cursorPosTbl[0][0]; + temp_r30->trans.y = cursorPosTbl[0][1]; + if (GWLanguageGet() != 0) { + temp_r30->trans.x -= 24.0f; + } + if (GWPlayer[arg0].com) { + var_r31->unk01 = GWMessDelayGet(); + } + BoardSpriteCreate(0x70055, 0x3DE, NULL, &spC); + HuSprGrpMemberSet(var_r31->unk06, 0, spC); + HuSprAttrSet(var_r31->unk06, 0, 8); + HuSprPosSet(var_r31->unk06, 0, temp_r30->trans.x, temp_r30->trans.y); +} + +static s32 GetShopItemChoice(void) { + return itemChoice; +} + +static s32 GetShopItemWinChoice(void) { + ItemChoiceWork *var_r31; + + if (!itemChoiceObj) { + return -1; + } + var_r31 = OM_GET_WORK_PTR(itemChoiceObj, ItemChoiceWork); + return var_r31->unk02; +} + +static void MoveShopItemChoice(omObjData *arg0, ItemChoiceWork *arg1) { + u32 sp8; + s32 temp_r28; + s32 temp_r29; + + temp_r28 = arg1->unk02; + arg0->trans.x = cursorPosTbl[arg1->unk02][0]; + arg0->trans.y = cursorPosTbl[arg1->unk02][1]; + if (GWLanguageGet() != 0) { + arg0->trans.x -= 24.0f; + } + if (GWPlayer[arg1->unk00_field1].com) { + GetShopItemChoiceInput(arg1, arg0, &sp8); + } else { + temp_r29 = GWPlayer[arg1->unk00_field1].port; + sp8 = HuPadDStkRep[temp_r29] | HuPadBtnDown[temp_r29]; + } + if (sp8 == 0x100) { + if (choiceEnableTbl[arg1->unk02] == 0) { + HuAudFXPlay(4); + return; + } + if (arg1->unk02 != 5) { + itemChoice = arg1->unk02; + } + HuAudFXPlay(2); + if (GWPlayer[arg1->unk00_field1].com) { + arg1->unk05 = 0x32; + } else { + arg1->unk05 = 5; + } + return; + } + if (sp8 == 0x200) { + itemChoice = 0x7F; + arg1->unk05 = 5; + HuAudFXPlay(3); + } + if (sp8 == 4) { + arg1->unk02++; + } + if (sp8 == 8) { + arg1->unk02--; + } + if (arg1->unk02 < 0) { + arg1->unk02 = 0; + } + if (arg1->unk02 >= 6) { + arg1->unk02 = 5; + } + if (arg1->unk02 != temp_r28) { + HuAudFXPlay(0); + arg1->unk04 = 4; + } +} + +static void UpdateShopItemChoice(omObjData *arg0) { + ItemChoiceWork *temp_r31; + + temp_r31 = OM_GET_WORK_PTR(arg0, ItemChoiceWork); + if (temp_r31->unk00_field0 != 0 || BoardIsKill()) { + HuSprGrpKill(temp_r31->unk06); + itemChoiceObj = NULL; + omDelObjEx(HuPrcCurrentGet(), arg0); + return; + } + if (temp_r31->unk05 != 0) { + temp_r31->unk05--; + if (temp_r31->unk05 == 0) { + temp_r31->unk00_field0 = 1; + } + } else if (temp_r31->unk01 != 0) { + temp_r31->unk01--; + } else if (temp_r31->unk04 != 0) { + temp_r31->unk04--; + } else { + MoveShopItemChoice(arg0, temp_r31); + } + HuSprPosSet(temp_r31->unk06, 0, arg0->trans.x, arg0->trans.y); +} + +static void GetShopItemChoiceInput(ItemChoiceWork *arg0, omObjData *arg1, u32 *arg2) { + if (arg0->unk02 == arg0->unk03) { + *arg2 = 0x100; + } else { + *arg2 = 4; + } +} + +void BoardShopTutorialExec(s32 arg0) { + Vec sp48; + Vec sp3C; + Vec sp30; + Vec sp24; + Vec sp18; + s32 sp14; + s32 sp10; + s16 sp8; + float temp_f31; + s16 temp_r27; + s32 i; + + sp14 = GWBoardGet(); + sp10 = BoardWinPortraitGet(); + if (BoardSpaceFlagGet(0, arg0) & 0x80000) { + shopMdlPtr = shopMdlIdx[0]; + } else { + shopMdlPtr = shopMdlIdx[1]; + } + temp_r27 = BoardSpaceLinkFlagSearch(0, arg0, 0x02000000); + BoardSpacePosGet(0, arg0, &sp48); + BoardSpacePosGet(0, temp_r27, &sp3C); + PSVECSubtract(&sp3C, &sp48, &sp30); + PSVECNormalize(&sp30, &sp30); + temp_f31 = 180.0 * (atan2(-sp30.x, -sp30.z) / M_PI); + sp24.x = -10.0f; + sp24.y = temp_f31; + sp24.z = 0.0f; + sp18.x = 0.0f; + sp18.y = 170.0f; + sp18.z = 0.0f; + BoardCameraMotionStartEx(shopMdlPtr[0], &sp24, &sp18, 1360.0f, -1.0f, 0x15); + HuAudFXPlay(0x330); + HuAudFXPlay(0x32D); + PopupShop(); + BoardModelMotionShiftSet(BoardShopHostGet(), shopMot[2], 0.0f, 4.0f, 0); + HuPrcSleep(4); + while (!BoardModelMotionEndCheck(BoardShopHostGet())) { + HuPrcVSleep(); + } + BoardModelMotionStart(BoardShopHostGet(), shopMot[0], 0x40000001); + BoardTutorialHookExec(0x1C, 0); + BoardModelMotionShiftSet(BoardShopHostGet(), shopMot[1], 0.0f, 10.0f, 0x40000001); + HuPrcSleep(30); + CloseShop(); + for (i = 0; i < 2; i++) { + BoardModelHookReset(shopMdlIdx[0][i]); + } + sp8 = BoardShopHostGet(); + for (i = 0; i < 3; i++) { + if (shopMot[i] != -1) { + BoardModelMotionKill(sp8, shopMot[i]); + shopMot[i] = -1; + } + } + PauseShopWin(); + if (itemMdl != -1) { + BoardModelKill(itemMdl); + itemMdl = -1; + } +} diff --git a/src/game/board/space.c b/src/game/board/space.c index acd4ee9a..a5cd7670 100644 --- a/src/game/board/space.c +++ b/src/game/board/space.c @@ -5,6 +5,7 @@ #include "game/board/main.h" #include "game/board/model.h" #include "game/board/player.h" +#include "game/board/shop.h" #include "game/board/space.h" #include "game/board/star.h" #include "game/board/tutorial.h"