diff --git a/config/GMPE01_00/symbols.txt b/config/GMPE01_00/symbols.txt index 40a78089..447770c7 100644 --- a/config/GMPE01_00/symbols.txt +++ b/config/GMPE01_00/symbols.txt @@ -1404,8 +1404,8 @@ BoardSpaceStarGetCurr = .text:0x800759A4; // type:function size:0x3C BoardSpaceStarCheck = .text:0x800759E0; // type:function size:0x110 BoardSpaceLandExec = .text:0x80075AF0; // type:function size:0x474 BoardSpaceWalkExec = .text:0x80075F64; // type:function size:0x2A4 -BoardSpaceHiddenBlockExec = .text:0x80076208; // type:function size:0x180 -BoardSpacePipeJumpExec = .text:0x80076388; // type:function size:0x268 +BoardSpaceBlockExec = .text:0x80076208; // type:function size:0x180 +BoardSpacePipeExec = .text:0x80076388; // type:function size:0x268 BoardSpaceTypeForce = .text:0x800765F0; // type:function size:0x5C BoardSpaceHide = .text:0x8007664C; // type:function size:0x48 DrawSpaces = .text:0x80076694; // type:function size:0x9E8 scope:local @@ -1418,7 +1418,7 @@ fn_80077AAC = .text:0x80077AAC; // type:function size:0x8 fn_80077AB4 = .text:0x80077AB4; // type:function size:0x8 fn_80077ABC = .text:0x80077ABC; // type:function size:0xD4 fn_80077B90 = .text:0x80077B90; // type:function size:0xA0 -fn_80077C30 = .text:0x80077C30; // type:function size:0x9C +BoardShopExec = .text:0x80077C30; // type:function size:0x9C fn_80077CCC = .text:0x80077CCC; // type:function size:0x800 fn_800784CC = .text:0x800784CC; // type:function size:0xD4 fn_800785A0 = .text:0x800785A0; // type:function size:0x1B4 @@ -1448,7 +1448,7 @@ fn_8007A330 = .text:0x8007A330; // type:function size:0x30 fn_8007A360 = .text:0x8007A360; // type:function size:0x4DC fn_8007A83C = .text:0x8007A83C; // type:function size:0x8 fn_8007A844 = .text:0x8007A844; // type:function size:0x8 -fn_8007A84C = .text:0x8007A84C; // type:function size:0x8C +BoardLotteryExec = .text:0x8007A84C; // type:function size:0x8C fn_8007A8D8 = .text:0x8007A8D8; // type:function size:0x16C fn_8007AA44 = .text:0x8007AA44; // type:function size:0x3B4 fn_8007ADF8 = .text:0x8007ADF8; // type:function size:0x1FC @@ -1520,7 +1520,7 @@ fn_80082888 = .text:0x80082888; // type:function size:0x224 fn_80082AAC = .text:0x80082AAC; // type:function size:0x10 fn_80082ABC = .text:0x80082ABC; // type:function size:0x148 fn_80082C04 = .text:0x80082C04; // type:function size:0x8C -fn_80082C90 = .text:0x80082C90; // type:function size:0xA4 +BoardMushroomExec = .text:0x80082C90; // type:function size:0xA4 fn_80082D34 = .text:0x80082D34; // type:function size:0x38C fn_800830C0 = .text:0x800830C0; // type:function size:0x58 fn_80083118 = .text:0x80083118; // type:function size:0x118 @@ -1542,8 +1542,8 @@ fn_80083E14 = .text:0x80083E14; // type:function size:0x38 fn_80083E4C = .text:0x80083E4C; // type:function size:0x48 fn_80083E94 = .text:0x80083E94; // type:function size:0x48 fn_80083EDC = .text:0x80083EDC; // type:function size:0xA8 -fn_80083F84 = .text:0x80083F84; // type:function size:0x8 -fn_80083F8C = .text:0x80083F8C; // type:function size:0xCC +BoardStarHostMdlGet = .text:0x80083F84; // type:function size:0x8 +BoardStarExec = .text:0x80083F8C; // type:function size:0xCC fn_80084058 = .text:0x80084058; // type:function size:0x8F4 fn_8008494C = .text:0x8008494C; // type:function size:0x84 fn_800849D0 = .text:0x800849D0; // type:function size:0x160 @@ -1653,7 +1653,7 @@ SetItemWindowCurr = .text:0x8008D9E8; // type:function size:0xA4 scope:local UpdateItemWindow = .text:0x8008DA8C; // type:function size:0x350 scope:local CreatePickerWindow = .text:0x8008DDDC; // type:function size:0x148 scope:local KillPickerWindow = .text:0x8008DF24; // type:function size:0x44 scope:local -fn_8008DF68 = .text:0x8008DF68; // type:function size:0x84 +BoardBlockExec = .text:0x8008DF68; // type:function size:0x84 fn_8008DFEC = .text:0x8008DFEC; // type:function size:0x358 fn_8008E344 = .text:0x8008E344; // type:function size:0x54 fn_8008E398 = .text:0x8008E398; // type:function size:0x1F4 @@ -1709,7 +1709,7 @@ fn_800972A4 = .text:0x800972A4; // type:function size:0x2C fn_800972D0 = .text:0x800972D0; // type:function size:0x2C fn_800972FC = .text:0x800972FC; // type:function size:0x2C fn_80097328 = .text:0x80097328; // type:function size:0x284 -fn_800975AC = .text:0x800975AC; // type:function size:0x144 +BoardBowserExec = .text:0x800975AC; // type:function size:0x144 fn_800976F0 = .text:0x800976F0; // type:function size:0x28C fn_8009797C = .text:0x8009797C; // type:function size:0x208 fn_80097B84 = .text:0x80097B84; // type:function size:0x1DC @@ -1764,7 +1764,7 @@ fn_8009B2B0 = .text:0x8009B2B0; // type:function size:0x80 fn_8009B330 = .text:0x8009B330; // type:function size:0xD8 fn_8009B408 = .text:0x8009B408; // type:function size:0x6C fn_8009B474 = .text:0x8009B474; // type:function size:0x60 -fn_8009B4D4 = .text:0x8009B4D4; // type:function size:0x124 +BoardBattleExec = .text:0x8009B4D4; // type:function size:0x124 fn_8009B5F8 = .text:0x8009B5F8; // type:function size:0x2C fn_8009B624 = .text:0x8009B624; // type:function size:0x708 fn_8009BD2C = .text:0x8009BD2C; // type:function size:0x1D4 @@ -1786,7 +1786,7 @@ fn_8009CF84 = .text:0x8009CF84; // type:function size:0x24 fn_8009CFA8 = .text:0x8009CFA8; // type:function size:0x10 fn_8009CFB8 = .text:0x8009CFB8; // type:function size:0x34 fn_8009CFEC = .text:0x8009CFEC; // type:function size:0x15C -fn_8009D148 = .text:0x8009D148; // type:function size:0x124 +BoardFortuneExec = .text:0x8009D148; // type:function size:0x124 fn_8009D26C = .text:0x8009D26C; // type:function size:0x74 fn_8009D2E0 = .text:0x8009D2E0; // type:function size:0xC fn_8009D2EC = .text:0x8009D2EC; // type:function size:0x340 @@ -1873,7 +1873,7 @@ fn_800A4F6C = .text:0x800A4F6C; // type:function size:0x8 fn_800A4F74 = .text:0x800A4F74; // type:function size:0x8 fn_800A4F7C = .text:0x800A4F7C; // type:function size:0xB4 fn_800A5030 = .text:0x800A5030; // type:function size:0x50 -fn_800A5080 = .text:0x800A5080; // type:function size:0x94 +BoardBooHouseExec = .text:0x800A5080; // type:function size:0x94 fn_800A5114 = .text:0x800A5114; // type:function size:0x538 fn_800A564C = .text:0x800A564C; // type:function size:0xF0 fn_800A573C = .text:0x800A573C; // type:function size:0xFC diff --git a/include/board_unsplit.h b/include/board_unsplit.h index a8aa1322..5f16e89e 100644 --- a/include/board_unsplit.h +++ b/include/board_unsplit.h @@ -9,7 +9,7 @@ void BoardCameraMotionWait(void); void BoardSpacePosGet(s32, s32, Vec*); void fn_8007A360(s32); void fn_8007F894(void); -s16 fn_80083F84(void); +s16 BoardStarHostMdlGet(void); void BoardStatusShowSetAll(s32); void fn_800A4C88(void); void fn_800A6B10(void); diff --git a/include/game/board/basic_space.h b/include/game/board/basic_space.h index 4b9eb529..38924130 100644 --- a/include/game/board/basic_space.h +++ b/include/game/board/basic_space.h @@ -2,9 +2,6 @@ #define _BOARD_BASIC_SPACE_H #include "dolphin.h" -#include "game/process.h" - -extern Process *boardObjMan; void BoardEventLandBlue(s32, s16); void BoardEventLandRed(s32, s16); diff --git a/include/game/board/space.h b/include/game/board/space.h new file mode 100644 index 00000000..911507de --- /dev/null +++ b/include/game/board/space.h @@ -0,0 +1,52 @@ +#ifndef _BOARD_SPACE_H +#define _BOARD_SPACE_H + +#include "dolphin.h" + +#define BOARD_SPACE_LINKMAX 4 + +typedef s32 (*BoardSpaceEventFunc)(void); + +typedef struct board_space { + Vec pos; + u32 flag; + Vec scale; + Vec rot; + u16 type; + u16 link_cnt; + u16 link[BOARD_SPACE_LINKMAX+1]; +} BoardSpace; + +void BoardSpaceWalkEventFuncSet(BoardSpaceEventFunc func); +void BoardSpaceWalkMiniEventFuncSet(BoardSpaceEventFunc func); +void BoardSpaceLandEventFuncSet(BoardSpaceEventFunc func); +s32 BoardSpaceWalkEventExec(void); +s32 BoardSpaceWalkMiniEventExec(void); +s16 BoardSpaceCountGet(s32 layer); +s16 BoardSpaceCountGet(s32 layer); +BoardSpace *BoardSpaceGet(s32 layer, s32 index); +void BoardSpaceAttrSet(s32 layer, u32 attr); +void BoardSpaceAttrReset(s32 layer, u32 attr); +u32 BoardSpaceFlagGet(s32 layer, s32 index); +s32 BoardSpaceTypeGet(s32 layer, s32 index); +void BoardSpaceTypeSet(s32 layer, s32 index, s32 type); +s32 BoardSpacePosGet(s32 layer, s32 index, Vec *pos); +void BoardSpaceCornerPosGet(s32 index, s32 corner, Vec *pos); +s32 BoardSpaceFlagSearch(s32 layer, u32 flag); +s32 BoardSpaceFlagPosGet(s32 layer, u32 flag, Vec *pos); +s32 BoardSpaceLinkFlagSearch(s32 layer, s32 index, u32 flag); +s32 BoardSpaceLinkTypeListGet(s32 layer, s32 index, s32 type, s16 *list); +s32 BoardSpaceLinkTargetListGet(s32 layer, s32 target, s16 *list); +s32 BoardSpaceLinkTypeSearch(s32 layer, s32 target, u16 type); +s32 BoardSpaceLinkTransformGet(s32 flag, Vec *pos, Vec *rot, Vec *scale); +void BoardSpaceStarSet(s32 space); +void BoardSpaceStarSetIndex(s32 index); +s32 BoardSpaceStarGetNext(void); +s32 BoardSpaceStarGetRandom(s32 excl_pos); +void BoardSpaceStarMove(void); +s32 BoardSpaceStarGet(s32 index); +s32 BoardSpaceStarGetCurr(void); +s32 BoardSpaceStarCheck(s32 index); +void BoardSpaceLandExec(s32 player, s32 space); + +#endif diff --git a/include/game/gamework_data.h b/include/game/gamework_data.h index 5a16cdd6..d86c21c1 100644 --- a/include/game/gamework_data.h +++ b/include/game/gamework_data.h @@ -83,14 +83,14 @@ typedef struct player_state { /* 0x0E */ s16 space_prev; /* 0x10 */ s16 space_next; /* 0x12 */ s16 space_shock; -/* 0x14 */ u8 blue_count; -/* 0x15 */ u8 red_count; -/* 0x16 */ u8 question_count; -/* 0x17 */ u8 fortune_count; -/* 0x18 */ u8 bowser_count; -/* 0x19 */ u8 battle_count; -/* 0x1A */ u8 mushroom_count; -/* 0x1B */ u8 warp_count; +/* 0x14 */ s8 blue_count; +/* 0x15 */ s8 red_count; +/* 0x16 */ s8 question_count; +/* 0x17 */ s8 fortune_count; +/* 0x18 */ s8 bowser_count; +/* 0x19 */ s8 battle_count; +/* 0x1A */ s8 mushroom_count; +/* 0x1B */ s8 warp_count; /* 0x1C */ s16 coins; /* 0x1E */ s16 coins_mg; /* 0x20 */ s16 coins_total; diff --git a/src/REL/w10Dll/scene.c b/src/REL/w10Dll/scene.c index b400f41e..43b09f0a 100644 --- a/src/REL/w10Dll/scene.c +++ b/src/REL/w10Dll/scene.c @@ -210,7 +210,7 @@ void fn_1_13A4(void) { BoardCameraMotionStartEx(lbl_1_bss_0->unk8, &sp8, NULL, 3200.0f, -1.0f, 30); BoardCameraMotionWait(); fn_1_BA0(0x2E0032); - BoardCameraTargetModelSet(fn_80083F84()); + BoardCameraTargetModelSet(BoardStarHostMdlGet()); BoardCameraMotionWait(); fn_1_BA0(0x2E0033); fn_1_BA0(0x2E0034); diff --git a/src/game/board/basic_space.c b/src/game/board/basic_space.c index ff565d27..3fbb9bfb 100644 --- a/src/game/board/basic_space.c +++ b/src/game/board/basic_space.c @@ -1,4 +1,5 @@ #include "game/board/basic_space.h" +#include "game/board/main.h" #include "game/data.h" #include "game/flag.h" #include "game/object.h" diff --git a/src/game/board/space.c b/src/game/board/space.c index 0943cb03..ff4a96a2 100644 --- a/src/game/board/space.c +++ b/src/game/board/space.c @@ -1,23 +1,13 @@ #include "game/gamework_data.h" #include "game/flag.h" #include "game/board/main.h" +#include "game/board/space.h" #include "math.h" -extern s16 fn_80083F84(void); +extern s16 BoardStarHostMdlGet(void); extern void BoardModelPosSetV(s16 model, Vec *pos); -typedef s32 (*BoardSpaceEventFunc)(void); - -typedef struct board_space { - Vec pos; - u32 flag; - Vec scale; - Vec rot; - u16 type; - u16 link_cnt; - u16 link[5]; -} BoardSpace; static GXTexObj spaceHiliteTex; static GXTexObj spaceTex; @@ -112,7 +102,7 @@ u32 BoardSpaceFlagGet(s32 layer, s32 index) } } -int BoardSpaceTypeGet(s32 layer, s32 index) +s32 BoardSpaceTypeGet(s32 layer, s32 index) { if(index <= 0 || index > spaceCnt[layer]) { return 0; @@ -121,7 +111,7 @@ int BoardSpaceTypeGet(s32 layer, s32 index) } } -void BoardSpaceTypeSet(s32 layer, s32 index, int type) +void BoardSpaceTypeSet(s32 layer, s32 index, s32 type) { if(index <= 0 || index > spaceCnt[layer]) { return; @@ -213,7 +203,7 @@ s32 BoardSpaceLinkFlagSearch(s32 layer, s32 index, u32 flag) return -1; } -s32 BoardSpaceLinkTypeListGet(s32 layer, s32 index, int type, s16 *list) +s32 BoardSpaceLinkTypeListGet(s32 layer, s32 index, s32 type, s16 *list) { s32 count; BoardSpace *space = BoardSpaceGet(layer, index); @@ -223,7 +213,7 @@ s32 BoardSpaceLinkTypeListGet(s32 layer, s32 index, int type, s16 *list) } for(count=i=0; ilink_cnt; i++) { BoardSpace *link_space = BoardSpaceGet(layer, space->link[i]); - if(link_space->type == type && count < 4) { + if(link_space->type == type && count < BOARD_SPACE_LINKMAX) { list[count] = link_space-&spaceData[layer][0]+1; count++; } @@ -236,11 +226,11 @@ s32 BoardSpaceLinkTargetListGet(s32 layer, s32 target, s16 *list) s32 i, j; s32 count; BoardSpace *space; - memset(list, 0, 4*sizeof(s16)); + memset(list, 0, BOARD_SPACE_LINKMAX*sizeof(s16)); space = &spaceData[layer][0]; for(count=i=0; ilink_cnt; j++) { - if(space->link[j] == target && count < 4) { + if(space->link[j] == target && count < BOARD_SPACE_LINKMAX) { list[count++] = space-&spaceData[layer][0]+1; } } @@ -293,13 +283,13 @@ s32 BoardSpaceLinkTransformGet(s32 flag, Vec *pos, Vec *rot, Vec *scale) void BoardSpaceStarSet(s32 space) { - s16 space_platid; + s16 host_space; Vec pos; BoardSpace *space_plat; BoardSpaceTypeSet(0, space, 8); - space_platid = BoardSpaceLinkFlagSearch(0, space, 0x04000000); - BoardSpacePosGet(0, space_platid, &pos); - BoardModelPosSetV(fn_80083F84(), &pos); + host_space = BoardSpaceLinkFlagSearch(0, space, 0x04000000); + BoardSpacePosGet(0, host_space, &pos); + BoardModelPosSetV(BoardStarHostMdlGet(), &pos); } static inline s16 BoardStarMdlGet(void) @@ -457,7 +447,6 @@ s32 BoardSpaceStarGetRandom(s32 excl_pos) return new_pos; } -//Fix GWSystem.star_total truncation and double GWSystem load void BoardSpaceStarMove(void) { u8 star_total; @@ -473,8 +462,7 @@ void BoardSpaceStarMove(void) star_total = 99; GWSystem.star_total = star_total; } else { - star_total = GWSystem.star_total; - GWSystem.star_total = (u8)(1+star_total); + star_total = GWSystem.star_total++; } } star_next = BoardSpaceStarGetNext(); @@ -508,4 +496,94 @@ s32 BoardSpaceStarCheck(s32 index) } end: return ret; +} + +void BoardSpaceLandExec(s32 player, s32 space) +{ + BoardSpace *space_ptr = BoardSpaceGet(0, space); + switch(space_ptr->type) { + case 1: + GWPlayer[player].blue_count++; + if(GWPlayer[player].blue_count > 99) { + GWPlayer[player].blue_count = 99; + } + BoardLandBlueExec(player, space); + break; + + case 2: + GWPlayer[player].red_count++; + if(GWPlayer[player].red_count > 99) { + GWPlayer[player].red_count = 99; + } + BoardLandRedExec(player, space); + break; + + case 3: + GWPlayer[player].bowser_count++; + if(GWPlayer[player].bowser_count > 99) { + GWPlayer[player].bowser_count = 99; + } + BoardBowserExec(player, space); + break; + + case 4: + GWPlayer[player].mushroom_count++; + if(GWPlayer[player].mushroom_count > 99) { + GWPlayer[player].mushroom_count = 99; + } + BoardMushroomExec(player, space); + break; + + case 5: + GWPlayer[player].battle_count++; + if(GWPlayer[player].battle_count > 99) { + GWPlayer[player].battle_count = 99; + } + BoardBattleExec(player, space); + break; + + case 6: + GWPlayer[player].question_count++; + if(GWPlayer[player].question_count > 99) { + GWPlayer[player].question_count = 99; + } + if(_CheckFlag(FLAG_ID_MAKE(1, 11))) { + HuAudFXPlay(842); + BoardCameraViewSet(2); + BoardPlayerAnimBlendSet(player, 0, 15); + while(!BoardPlayerAnimBlendCheck(player)) { + HuPrcVSleep(); + } + BoardCameraMotionWait(); + BoardTutorialHookExec(16, 0); + } else { + if(landEventFunc) { + HuAudFXPlay(842); + omVibrate(player, 12, 4, 2); + landEventFunc(); + } + } + GWPlayer[player].color = 3; + break; + + case 7: + GWPlayer[player].fortune_count++; + if(GWPlayer[player].fortune_count > 99) { + GWPlayer[player].fortune_count = 99; + } + BoardFortuneExec(player, space); + break; + + case 9: + GWPlayer[player].warp_count++; + if(GWPlayer[player].warp_count > 99) { + GWPlayer[player].warp_count = 99; + } + BoardWarpExec(player, space); + break; + + case 8: + BoardStarExec(player, space); + break; + } } \ No newline at end of file