Document board/com files

Also did various cleanups
This commit is contained in:
gamemasterplc 2024-03-06 20:22:54 -06:00
parent 6f46d026ca
commit 83000dbb16
13 changed files with 645 additions and 673 deletions

View file

@ -1339,7 +1339,7 @@ ExecComKey = .text:0x80071410; // type:function size:0xE8 scope:local
BoardComPreferItemGet = .text:0x800714F8; // type:function size:0x100 BoardComPreferItemGet = .text:0x800714F8; // type:function size:0x100
BoardComPreferItemCheck = .text:0x800715F8; // type:function size:0x120 BoardComPreferItemCheck = .text:0x800715F8; // type:function size:0x120
BoardComItemWeightGet = .text:0x80071718; // type:function size:0x74 BoardComItemWeightGet = .text:0x80071718; // type:function size:0x74
BoardComTutorialItemGet = .text:0x8007178C; // type:function size:0xD0 BoardComUseItemSlotGet = .text:0x8007178C; // type:function size:0xD0
BoardComUseItemSet = .text:0x8007185C; // type:function size:0x6C BoardComUseItemSet = .text:0x8007185C; // type:function size:0x6C
BoardComUseItemCheck = .text:0x800718C8; // type:function size:0x68 BoardComUseItemCheck = .text:0x800718C8; // type:function size:0x68
ChooseUseItem = .text:0x80071930; // type:function size:0x16C scope:local ChooseUseItem = .text:0x80071930; // type:function size:0x16C scope:local
@ -1351,7 +1351,7 @@ CheckSwapUse = .text:0x80072370; // type:function size:0x198 scope:local
CheckBooUse = .text:0x80072508; // type:function size:0x7C scope:local CheckBooUse = .text:0x80072508; // type:function size:0x7C scope:local
CheckLampUse = .text:0x80072584; // type:function size:0x74 scope:local CheckLampUse = .text:0x80072584; // type:function size:0x74 scope:local
BoardComJunctionInputGet = .text:0x800725F8; // type:function size:0x304 BoardComJunctionInputGet = .text:0x800725F8; // type:function size:0x304
BoardComBestPlayerFind = .text:0x800728FC; // type:function size:0xA8 BoardComFarPlayerFind = .text:0x800728FC; // type:function size:0xA8
BoardViewOverheadExec = .text:0x800729A4; // type:function size:0x134 BoardViewOverheadExec = .text:0x800729A4; // type:function size:0x134
BoardViewFocusGetPos = .text:0x80072AD8; // type:function size:0x3C BoardViewFocusGetPos = .text:0x80072AD8; // type:function size:0x3C
BoardViewFocusSet = .text:0x80072B14; // type:function size:0xF0 BoardViewFocusSet = .text:0x80072B14; // type:function size:0xF0
@ -1517,7 +1517,7 @@ ShrinkCharWheel = .text:0x80082688; // type:function size:0x10C scope:local
KillCharWheelSpr = .text:0x80082794; // type:function size:0x38 scope:local KillCharWheelSpr = .text:0x80082794; // type:function size:0x38 scope:local
SetCharWheelChars = .text:0x800827CC; // type:function size:0xBC scope:local SetCharWheelChars = .text:0x800827CC; // type:function size:0xBC scope:local
GetInput = .text:0x80082888; // type:function size:0x224 scope:local GetInput = .text:0x80082888; // type:function size:0x224 scope:local
BoardCharWheelSetTarget = .text:0x80082AAC; // type:function size:0x10 BoardCharWheelTargetSet = .text:0x80082AAC; // type:function size:0x10
GetComDelay = .text:0x80082ABC; // type:function size:0x148 scope:local GetComDelay = .text:0x80082ABC; // type:function size:0x148 scope:local
GetComInput = .text:0x80082C04; // type:function size:0x8C scope:local GetComInput = .text:0x80082C04; // type:function size:0x8C scope:local
BoardMushroomExec = .text:0x80082C90; // type:function size:0xA4 BoardMushroomExec = .text:0x80082C90; // type:function size:0xA4
@ -1915,7 +1915,7 @@ BoardLast5Exec = .text:0x800A9708; // type:function size:0x84
DestroyLast5 = .text:0x800A978C; // type:function size:0x30 scope:local DestroyLast5 = .text:0x800A978C; // type:function size:0x30 scope:local
ExecLast5 = .text:0x800A97BC; // type:function size:0x1D4 scope:local ExecLast5 = .text:0x800A97BC; // type:function size:0x1D4 scope:local
CreateLast5 = .text:0x800A9990; // type:function size:0x184 scope:local CreateLast5 = .text:0x800A9990; // type:function size:0x184 scope:local
DestroyLast5 = .text:0x800A9B14; // type:function size:0x48 scope:local KillLast5 = .text:0x800A9B14; // type:function size:0x48 scope:local
InitHost = .text:0x800A9B5C; // type:function size:0x10C scope:local InitHost = .text:0x800A9B5C; // type:function size:0x10C scope:local
KillHost = .text:0x800A9C68; // type:function size:0xA4 scope:local KillHost = .text:0x800A9C68; // type:function size:0xA4 scope:local
Last5Main = .text:0x800A9D0C; // type:function size:0xCC0 scope:local Last5Main = .text:0x800A9D0C; // type:function size:0xCC0 scope:local
@ -1991,12 +1991,12 @@ AddValidLinks = .text:0x800B1CEC; // type:function size:0xD0 scope:local
CheckPathSpace = .text:0x800B1DBC; // type:function size:0x30 scope:local CheckPathSpace = .text:0x800B1DBC; // type:function size:0x30 scope:local
FindValidLink = .text:0x800B1DEC; // type:function size:0xAC scope:local FindValidLink = .text:0x800B1DEC; // type:function size:0xAC scope:local
CheckEndSpace = .text:0x800B1E98; // type:function size:0xF0 scope:local CheckEndSpace = .text:0x800B1E98; // type:function size:0xF0 scope:local
BoardComPathReachCheck = .text:0x800B1F88; // type:function size:0x74C BoardComPathShortcutLenGet = .text:0x800B1F88; // type:function size:0x74C
BoardComPathBestGet = .text:0x800B26D4; // type:function size:0x3E4 BoardComPathBestGet = .text:0x800B26D4; // type:function size:0x3E4
BoardComPathLenGet = .text:0x800B2AB8; // type:function size:0x65C BoardComPathLenGet = .text:0x800B2AB8; // type:function size:0x65C
CheckPath = .text:0x800B3114; // type:function size:0x488 scope:local CheckPath = .text:0x800B3114; // type:function size:0x488 scope:local
BoardComPathW20BestGet = .text:0x800B359C; // type:function size:0x45C BoardComPathBestGetFlag = .text:0x800B359C; // type:function size:0x45C
CheckW20Path = .text:0x800B39F8; // type:function size:0x4E0 scope:local CheckPathFlag = .text:0x800B39F8; // type:function size:0x4E0 scope:local
TutorialProcFunc = .text:0x800B3ED8; // type:function size:0x34 scope:local TutorialProcFunc = .text:0x800B3ED8; // type:function size:0x34 scope:local
BoardTutorialInit = .text:0x800B3F0C; // type:function size:0x80 BoardTutorialInit = .text:0x800B3F0C; // type:function size:0x80
BoardTutorialKill = .text:0x800B3F8C; // type:function size:0x4C BoardTutorialKill = .text:0x800B3F8C; // type:function size:0x4C
@ -5192,7 +5192,7 @@ megaSquishSfxTbl = .data:0x80139A80; // type:object size:0x20 scope:local
PortraitTbl = .data:0x80139AA0; // type:object size:0x24 scope:local PortraitTbl = .data:0x80139AA0; // type:object size:0x24 scope:local
StarPortraitTbl = .data:0x80139AC4; // type:object size:0x24 scope:local StarPortraitTbl = .data:0x80139AC4; // type:object size:0x24 scope:local
boardMusTbl = .data:0x80139AE8; // type:object size:0x12 scope:local boardMusTbl = .data:0x80139AE8; // type:object size:0x12 scope:local
comItemWeightTbl = .data:0x80139B00; // type:object size:0x60 scope:local comItemPreferTbl = .data:0x80139B00; // type:object size:0x60 scope:local
comItemUseCheckFuncTbl = .data:0x80139B60; // type:object size:0x38 scope:local comItemUseCheckFuncTbl = .data:0x80139B60; // type:object size:0x38 scope:local
comJunctionDirTbl = .data:0x80139B98; // type:object size:0x30 scope:local comJunctionDirTbl = .data:0x80139B98; // type:object size:0x30 scope:local
overhead2DPos = .data:0x80139BC8; // type:object size:0x28 scope:local overhead2DPos = .data:0x80139BC8; // type:object size:0x28 scope:local

View file

@ -16,7 +16,7 @@ s32 BoardSpacePosGet(s32, s32, Vec*);
void BoardShopTutorialExec(s32); void BoardShopTutorialExec(s32);
void BoardMGSetupTutorialExec(void); void BoardMGSetupTutorialExec(void);
void BoardBooHouseTutorialExec(void); void BoardBooHouseTutorialExec(void);
void BoardCharWheelSetTarget(s32); void BoardCharWheelTargetSet(s32);
void BoardSpaceStarSetIndex(s32); void BoardSpaceStarSetIndex(s32);
void BoardLightHookSet(BoardLightHook set, BoardLightHook reset); void BoardLightHookSet(BoardLightHook set, BoardLightHook reset);
s32 fn_8006DDE8(s16, f32); s32 fn_8006DDE8(s16, f32);

View file

@ -10,7 +10,7 @@ void BoardComKeySetDown(void);
s8 BoardComPreferItemGet(s32 arg0, s8 *arg1, s8 arg2); s8 BoardComPreferItemGet(s32 arg0, s8 *arg1, s8 arg2);
s8 BoardComPreferItemCheck(s32 arg0, s8 arg1, s8 arg2, s8 arg3); s8 BoardComPreferItemCheck(s32 arg0, s8 arg1, s8 arg2, s8 arg3);
s32 BoardComItemWeightGet(s32 arg0, s32 arg1); s32 BoardComItemWeightGet(s32 arg0, s32 arg1);
s32 BoardComTutorialItemGet(s32 arg0); s32 BoardComUseItemSlotGet(s32 arg0);
s32 BoardComUseItemSet(s32 arg0, s32 arg1); s32 BoardComUseItemSet(s32 arg0, s32 arg1);
BOOL BoardComUseItemCheck(s32 arg0); BOOL BoardComUseItemCheck(s32 arg0);
s32 BoardComJunctionInputGet(s32 arg0, Vec *arg1, s32 arg2, float *arg3); s32 BoardComJunctionInputGet(s32 arg0, Vec *arg1, s32 arg2, float *arg3);

View file

@ -3,9 +3,9 @@
#include "dolphin/types.h" #include "dolphin/types.h"
s16 BoardComPathReachCheck(s16 arg0, u32 arg1, s32 arg2); s16 BoardComPathShortcutLenGet(s16 space, u32 type, s32 block_pipe);
s16 BoardComPathBestGet(s16 arg0); s16 BoardComPathBestGet(s16 space);
s16 BoardComPathLenGet(s16 arg0, s16 arg1); s16 BoardComPathLenGet(s16 space, s16 space_other);
s16 BoardComPathW20BestGet(s16 arg0, u32 arg1, s16 arg2); s16 BoardComPathBestGetFlag(s16 space, u32 flag, s16 len);
#endif #endif

View file

@ -180,14 +180,28 @@ static inline s32 GWMGShowComGet(void)
static inline s32 GWMGListGet(void) static inline s32 GWMGListGet(void)
{ {
if (GWSystem.mg_list == 3) {
GWSystem.mg_list = 0;
}
return GWSystem.mg_list; return GWSystem.mg_list;
} }
static inline s32 GWMessSpeedGet(void) static inline s32 GWMessSpeedGet(void)
{ {
if (GWSystem.mess_speed == 3) {
GWSystem.mess_speed = 1;
}
return GWSystem.mess_speed; return GWSystem.mess_speed;
} }
static inline s32 GWSaveModeGet(void)
{
if (GWSystem.save_mode == 3) {
GWSystem.save_mode = 1;
}
return GWSystem.save_mode;
}
static inline s32 GWTurnGet(void) static inline s32 GWTurnGet(void)
{ {
return GWSystem.turn; return GWSystem.turn;

View file

@ -5,6 +5,7 @@
#include "game/board/model.h" #include "game/board/model.h"
#include "game/board/star.h" #include "game/board/star.h"
#include "game/board/tutorial.h" #include "game/board/tutorial.h"
#include "game/board/main.h"
#include "math.h" #include "math.h"
@ -78,9 +79,9 @@ void BoardCreate(void) {
s32 i; s32 i;
unkw10Dll* temp_r30; unkw10Dll* temp_r30;
s32 temp; s32 temp;
s32 temp2; s32 board;
temp2 = get_current_board(); board = BoardCurrGet();
lbl_1_bss_0 = (W10State *)&GWSystem.board_data; lbl_1_bss_0 = (W10State *)&GWSystem.board_data;
lbl_1_bss_0->unk0 = 0; lbl_1_bss_0->unk0 = 0;
lbl_1_bss_0->unk4 = 0; lbl_1_bss_0->unk4 = 0;

View file

@ -113,7 +113,7 @@ void fn_1_1134(void) {
fn_1_1E3C(7, 0x122, 0x8C); fn_1_1E3C(7, 0x122, 0x8C);
fn_1_BA0(0x2E0017); fn_1_BA0(0x2E0017);
fn_1_1FB0(); fn_1_1FB0();
BoardCharWheelSetTarget(1); BoardCharWheelTargetSet(1);
} }
void fn_1_1178(void) { void fn_1_1178(void) {

View file

@ -7,28 +7,29 @@
#include "game/board/space.h" #include "game/board/space.h"
#include "game/board/tutorial.h" #include "game/board/tutorial.h"
#include "game/board/window.h" #include "game/board/window.h"
#include "game/board/boo.h"
#include "math.h" #include "math.h"
s32 BoardBooComUseCheck(s32); typedef BOOL (*UseCheckFunc)(s32 player, s32 item);
static void ExecComKeyLeft(void); static void ExecComKeyLeft(void);
static void ExecComKeyRight(void); static void ExecComKeyRight(void);
static void ExecComKeyUp(void); static void ExecComKeyUp(void);
static void ExecComKeyDown(void); static void ExecComKeyDown(void);
static void ExecComKey(s32 arg0, s32 arg1, s32 arg2); static void ExecComKey(s32 player, s32 move, s32 vertical);
static s32 ChooseUseItem(s32 arg0); static s32 ChooseUseItem(s32 player);
static BOOL CheckMiniUse(s32 arg0, s32 arg1); static BOOL CheckMiniUse(s32 player, s32 item);
static BOOL CheckMegaUse(s32 arg0, s32 arg1); static BOOL CheckMegaUse(s32 player, s32 item);
static BOOL CheckSparkUse(s32 arg0, s32 arg1); static BOOL CheckSparkUse(s32 player, s32 item);
static BOOL CheckBoardChangeUse(s32 arg0, s32 arg1); static BOOL CheckBoardChangeUse(s32 player, s32 item);
static BOOL CheckSwapUse(s32 arg0, s32 arg1); static BOOL CheckSwapUse(s32 player, s32 item);
static BOOL CheckBooUse(s32 arg0, s32 arg1); static BOOL CheckBooUse(s32 player, s32 item);
static BOOL CheckLampUse(s32 arg0, s32 arg1); static BOOL CheckLampUse(s32 player, s32 item);
static s8 itemUse = -1; static s8 itemUse = -1;
static s8 comItemWeightTbl[8][12] = { static s8 comItemPreferTbl[8][12] = {
{ 0x0C, 0x0B, 0x05, 0x03, 0x01, 0x02, 0x06, 0x04, 0x00, 0x07, 0x09, 0x0A }, { 0x0C, 0x0B, 0x05, 0x03, 0x01, 0x02, 0x06, 0x04, 0x00, 0x07, 0x09, 0x0A },
{ 0x0C, 0x0B, 0x05, 0x0A, 0x03, 0x01, 0x02, 0x00, 0x06, 0x04, 0x07, 0x09 }, { 0x0C, 0x0B, 0x05, 0x0A, 0x03, 0x01, 0x02, 0x00, 0x06, 0x04, 0x07, 0x09 },
{ 0x0C, 0x0B, 0x05, 0x06, 0x03, 0x01, 0x02, 0x0A, 0x07, 0x09, 0x00, 0x04 }, { 0x0C, 0x0B, 0x05, 0x06, 0x03, 0x01, 0x02, 0x0A, 0x07, 0x09, 0x00, 0x04 },
@ -39,7 +40,7 @@ static s8 comItemWeightTbl[8][12] = {
{ 0x0C, 0x05, 0x07, 0x0B, 0x0A, 0x09, 0x04, 0x06, 0x03, 0x01, 0x02, 0x00 } { 0x0C, 0x05, 0x07, 0x0B, 0x0A, 0x09, 0x04, 0x06, 0x03, 0x01, 0x02, 0x00 }
}; };
static BOOL (*comItemUseCheckFuncTbl[])(s32, s32) = { static UseCheckFunc comItemUseCheckFuncTbl[] = {
CheckMiniUse, CheckMiniUse,
CheckMegaUse, CheckMegaUse,
CheckMiniUse, CheckMiniUse,
@ -95,322 +96,322 @@ void BoardComKeySetDown(void) {
BoardWinComKeyFuncSet(ExecComKeyDown); BoardWinComKeyFuncSet(ExecComKeyDown);
} }
static void ExecComKey(s32 arg0, s32 arg1, s32 arg2) { static void ExecComKey(s32 player, s32 move, s32 vertical) {
s32 sp14[4]; s32 comkey[4];
s32 temp_r31; s32 port;
s16 temp_r30; s16 delay;
s32 var_r29; s32 dpad;
sp14[0] = sp14[1] = sp14[2] = sp14[3] = 0; comkey[0] = comkey[1] = comkey[2] = comkey[3] = 0;
temp_r31 = GWPlayer[arg0].port; port = GWPlayer[player].port;
temp_r30 = GWMessDelayGet(); delay = GWMessDelayGet();
if (arg2 == 0) { if (vertical == 0) {
var_r29 = 4; dpad = PAD_BUTTON_DOWN;
} else { } else {
var_r29 = 2; dpad = PAD_BUTTON_RIGHT;
} }
if (arg1 == 1) { if (move == 1) {
sp14[temp_r31] = var_r29; comkey[port] = dpad;
HuWinComKeyWait(sp14[0], sp14[1], sp14[2], sp14[3], temp_r30); HuWinComKeyWait(comkey[0], comkey[1], comkey[2], comkey[3], delay);
} }
sp14[temp_r31] = 0x100; comkey[port] = 0x100;
HuWinComKeyWait(sp14[0], sp14[1], sp14[2], sp14[3], temp_r30); HuWinComKeyWait(comkey[0], comkey[1], comkey[2], comkey[3], delay);
} }
s8 BoardComPreferItemGet(s32 arg0, s8 *arg1, s8 arg2) { s8 BoardComPreferItemGet(s32 player, s8 *items, s8 num_items) {
s32 temp_r26; s32 character;
s32 var_r28; s32 weight;
s32 temp_r29; s32 item;
s32 var_r27; s32 prefer;
s32 i; s32 i;
s32 j; s32 j;
temp_r26 = GWPlayer[arg0].character; character = GWPlayer[player].character;
var_r27 = -1; prefer = -1;
var_r28 = 0x64; weight = 100;
for (i = 0; i < arg2; i++) { for (i = 0; i < num_items; i++) {
temp_r29 = arg1[i]; item = items[i];
for (j = 0; j < 0xC; j++) { for (j = 0; j < 12; j++) {
if (temp_r29 == comItemWeightTbl[temp_r26][j]) { if (item == comItemPreferTbl[character][j]) {
if (j < var_r28 && (BoardPlayerItemFind(arg0, temp_r29) == -1 || temp_r29 == 0xC || temp_r29 == 0xB)) { if (j < weight && (BoardPlayerItemFind(player, item) == -1 || item == 0xC || item == 0xB)) {
var_r28 = j; weight = j;
var_r27 = i; prefer = i;
} }
break; break;
} }
} }
} }
if (var_r28 == 0x64) { if (weight == 100) {
return -1; return -1;
} }
return var_r27; return prefer;
} }
s8 BoardComPreferItemCheck(s32 arg0, s8 arg1, s8 arg2, s8 arg3) { s8 BoardComPreferItemCheck(s32 player, s8 item1, s8 item2, s8 item3) {
s8 spB[3]; s8 items[3];
s8 temp_r25; s8 prefer;
spB[0] = arg1; items[0] = item1;
spB[1] = arg2; items[1] = item2;
spB[2] = arg3; items[2] = item3;
temp_r25 = BoardComPreferItemGet(arg0, spB, 3); prefer = BoardComPreferItemGet(player, items, 3);
return temp_r25; return prefer;
} }
s32 BoardComItemWeightGet(s32 arg0, s32 arg1) { s32 BoardComItemWeightGet(s32 player, s32 item) {
s32 var_r30; s32 weight;
s32 i; s32 i;
for (i = 0; i < 0xC; i++) { for (i = 0; i < 12; i++) {
if (arg1 == comItemWeightTbl[GWPlayer[arg0].character][i]) { if (item == comItemPreferTbl[GWPlayer[player].character][i]) {
break; break;
} }
} }
var_r30 = 0xB - i; weight = 12-1-i;
return var_r30; return weight;
} }
s32 BoardComTutorialItemGet(s32 arg0) { s32 BoardComUseItemSlotGet(s32 player) {
s32 var_r30; s32 slot;
s32 var_r31; s32 item;
if (!GWPlayer[arg0].com) { if (!GWPlayer[player].com) {
return -1; return -1;
} }
if (itemUse != -1) { if (itemUse != -1) {
var_r31 = itemUse; item = itemUse;
} }
if (boardTutorialUseItem >= 0 && boardTutorialUseItem <= 0xD) { if (boardTutorialUseItem >= 0 && boardTutorialUseItem <= 13) {
var_r31 = boardTutorialUseItem; item = boardTutorialUseItem;
boardTutorialUseItem = -1; boardTutorialUseItem = -1;
} }
if (var_r31 != -1) { if (item != -1) {
var_r30 = BoardPlayerItemFind(arg0, var_r31); slot = BoardPlayerItemFind(player, item);
} else { } else {
var_r30 = -1; slot = -1;
} }
return var_r30; return slot;
} }
s32 BoardComUseItemSet(s32 arg0, s32 arg1) { s32 BoardComUseItemSet(s32 player, s32 item) {
if (arg1 == -1) { if (item == -1) {
itemUse = -1; itemUse = -1;
return 1; return 1;
} }
if (BoardPlayerItemFind(arg0, arg1) != -1) { if (BoardPlayerItemFind(player, item) != -1) {
itemUse = arg1; itemUse = item;
return 1; return 1;
} }
return 0; return 0;
} }
BOOL BoardComUseItemCheck(s32 arg0) { BOOL BoardComUseItemCheck(s32 player) {
s32 var_r31; s32 count;
var_r31 = BoardPlayerItemCount(arg0); count = BoardPlayerItemCount(player);
if (var_r31 <= 0) { if (count <= 0) {
return FALSE; return FALSE;
} }
if (ChooseUseItem(arg0) != -1) { if (ChooseUseItem(player) != -1) {
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
} }
static s32 ChooseUseItem(s32 arg0) { static s32 ChooseUseItem(s32 player) {
s32 i; s32 i;
s32 j; s32 j;
s32 temp_r29; s32 useItem;
s32 var_r28; s32 weight;
s32 temp_r27; s32 item;
s32 temp_r25; s32 character;
BOOL (*temp_r24)(s32, s32); UseCheckFunc func;
s8 temp_r23; s8 result;
temp_r29 = -1; useItem = -1;
temp_r25 = GWPlayer[arg0].character; character = GWPlayer[player].character;
var_r28 = 0x64; weight = 0x64;
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
temp_r27 = GWPlayer[arg0].items[i]; item = GWPlayer[player].items[i];
if (temp_r27 == -1) { if (item == -1) {
continue; continue;
} }
temp_r24 = comItemUseCheckFuncTbl[temp_r27]; func = comItemUseCheckFuncTbl[item];
if (!temp_r24) { if (!func) {
continue; continue;
} }
temp_r23 = temp_r24(arg0, temp_r27); result = func(player, item);
if (temp_r23) { if (result) {
for (j = 0; j < 0xC; j++) { for (j = 0; j < 0xC; j++) {
if (temp_r27 == comItemWeightTbl[temp_r25][j]) { if (item == comItemPreferTbl[character][j]) {
if (j < var_r28) { if (j < weight) {
var_r28 = j; weight = j;
} }
break; break;
} }
} }
} }
} }
if (var_r28 == 0x64) { if (weight == 0x64) {
return -1; return -1;
} }
temp_r29 = comItemWeightTbl[temp_r25][var_r28]; useItem = comItemPreferTbl[character][weight];
if (temp_r29 == -1) { if (useItem == -1) {
itemUse = -1; itemUse = -1;
} else if (BoardPlayerItemFind(arg0, temp_r29) != -1) { } else if (BoardPlayerItemFind(player, useItem) != -1) {
itemUse = temp_r29; itemUse = useItem;
} }
return temp_r29; return useItem;
} }
static BOOL CheckMiniUse(s32 arg0, s32 arg1) { static BOOL CheckMiniUse(s32 player, s32 item) {
s32 temp_r29; s32 space;
s32 var_r26; s32 star_dist_pipe;
s32 var_r25; s32 star_dist_no_pipe;
s32 temp_r28; s32 diff;
s32 temp_r23; s32 character;
s32 var_r24; s32 force_use_mini;
s32 var_r31; s32 max_dist;
s32 var_r30; s32 chance;
var_r24 = 0; force_use_mini = 0;
temp_r29 = GWPlayer[arg0].space_curr; space = GWPlayer[player].space_curr;
temp_r28 = GWPlayer[arg0].diff; diff = GWPlayer[player].diff;
temp_r23 = GWPlayer[arg0].character; character = GWPlayer[player].character;
switch (temp_r28) { switch (diff) {
case 0: case 0:
var_r30 = 0x32; chance = 50;
break; break;
case 1: case 1:
var_r30 = 0x19; chance = 25;
break; break;
case 2: case 2:
var_r30 = 5; chance = 5;
break; break;
case 3: case 3:
var_r30 = 0; chance = 0;
break; break;
} }
if ((temp_r28 == 0 || temp_r28 == 1) && temp_r23 == 1) { if ((diff == 0 || diff == 1) && character == 1) {
var_r30 = 7; chance = 7;
} }
if (GWBoardGet() != 7 && GWBoardGet() != 8) { if (GWBoardGet() != 7 && GWBoardGet() != 8) {
var_r26 = BoardComPathReachCheck(temp_r29, 8, 0); star_dist_pipe = BoardComPathShortcutLenGet(space, 8, 0);
var_r25 = BoardComPathReachCheck(temp_r29, 8, 1); star_dist_no_pipe = BoardComPathShortcutLenGet(space, 8, 1);
} else { } else {
var_r26 = 0x3E7; star_dist_pipe = 0x3E7;
var_r25 = BoardComPathW20BestGet(temp_r29, 0x10000000, 0xA); star_dist_no_pipe = BoardComPathBestGetFlag(space, 0x10000000, 10);
if ((GWBoardGet() == 8 || GWBoardGet() == 7) && BoardRandMod(0x64) < 0x3C) { if ((GWBoardGet() == 8 || GWBoardGet() == 7) && BoardRandMod(0x64) < 0x3C) {
var_r24 = 1; force_use_mini = 1;
} }
} }
switch (GWPlayer[arg0].diff) { switch (GWPlayer[player].diff) {
case 0: case 0:
var_r31 = 5; max_dist = 5;
break; break;
case 1: case 1:
var_r31 = 7; max_dist = 7;
break; break;
case 2: case 2:
var_r31 = 9; max_dist = 9;
break; break;
case 3: case 3:
var_r31 = 0xA; max_dist = 10;
break; break;
} }
if ((var_r25 < var_r31 || var_r26 < var_r31 || var_r24 != 0) && BoardRandMod(0x64) >= var_r30) { if ((star_dist_no_pipe < max_dist || star_dist_pipe < max_dist || force_use_mini != 0) && BoardRandMod(0x64) >= chance) {
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
} }
static BOOL CheckMegaUse(s32 arg0, s32 arg1) { static BOOL CheckMegaUse(s32 player, s32 item) {
s32 temp_r27; s32 short_len;
s32 temp_r26; s32 character;
s32 temp_r24; s32 space;
s32 temp_r29; s32 diff;
s16 temp_r25; s16 path_len;
s16 var_r28; s16 max_len;
s16 temp_r23; s16 space_search;
s16 temp_r22; s16 space_other;
s16 i; s16 i;
temp_r29 = GWPlayer[arg0].diff; diff = GWPlayer[player].diff;
temp_r26 = GWPlayer[arg0].character; character = GWPlayer[player].character;
switch (temp_r29) { switch (diff) {
case 0: case 0:
var_r28 = 5; max_len = 5;
break; break;
case 1: case 1:
var_r28 = 7; max_len = 7;
break; break;
case 2: case 2:
var_r28 = 9; max_len = 9;
break; break;
case 3: case 3:
var_r28 = 0xA; max_len = 10;
break; break;
} }
if (((temp_r29 == 0 || temp_r29 == 1) && temp_r26 == 0) || ((temp_r29 == 0 || temp_r29 == 1) && temp_r26 == 5)) { if (((diff == 0 || diff == 1) && character == 0) || ((diff == 0 || diff == 1) && character == 5)) {
var_r28 = 8; max_len = 8;
} }
if (GWBoardGet() != 7 || BoardRandMod(0x64) >= 0x3C) { if (GWBoardGet() != 7 || BoardRandMod(0x64) >= 60) {
temp_r24 = GWPlayer[arg0].space_curr; space = GWPlayer[player].space_curr;
temp_r27 = BoardComPathReachCheck(temp_r24, 8, 0); short_len = BoardComPathShortcutLenGet(space, 8, 0);
temp_r23 = GWPlayer[arg0].space_curr; space_search = GWPlayer[player].space_curr;
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
if (i != arg0) { if (i != player) {
temp_r22 = GWPlayer[i].space_curr; space_other = GWPlayer[i].space_curr;
temp_r25 = BoardComPathLenGet(temp_r23, temp_r22); path_len = BoardComPathLenGet(space_search, space_other);
if (temp_r25 < var_r28 + 0x14 && temp_r25 > 0 && GWTeamGet() && i == BoardPlayerSameTeamFind(arg0)) { if (path_len < max_len + 20 && path_len > 0 && GWTeamGet() && i == BoardPlayerSameTeamFind(player)) {
return FALSE; return FALSE;
} }
} }
} }
if (GWBoardGet() != 7 && GWBoardGet() != 8 && temp_r27 < 0xA && temp_r27 > 0) { if (GWBoardGet() != 7 && GWBoardGet() != 8 && short_len < 10 && short_len > 0) {
return FALSE; return FALSE;
} }
} }
if (BoardPlayerItemFind(arg0, arg1) != -1) { if (BoardPlayerItemFind(player, item) != -1) {
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
} }
static BOOL CheckSparkUse(s32 arg0, s32 arg1) { static BOOL CheckSparkUse(s32 player, s32 item) {
s32 temp_r27; s32 length;
s32 temp_r28; s32 diff;
s32 temp_r26; s32 space_other;
s32 temp_r25; s32 space;
s32 temp_r24; s32 character;
s32 i; s32 i;
s32 var_r30; s32 chance;
temp_r25 = GWPlayer[arg0].space_curr; space = GWPlayer[player].space_curr;
temp_r28 = GWPlayer[arg0].diff; diff = GWPlayer[player].diff;
temp_r24 = GWPlayer[arg0].character; character = GWPlayer[player].character;
switch (temp_r28) { switch (diff) {
case 0: case 0:
var_r30 = 0x32; chance = 50;
break; break;
case 1: case 1:
var_r30 = 0x19; chance = 25;
break; break;
case 2: case 2:
var_r30 = 5; chance = 5;
break; break;
case 3: case 3:
var_r30 = 0; chance = 0;
break; break;
} }
if ((temp_r28 == 0 || temp_r28 == 1) && temp_r24 == 7) { if ((diff == 0 || diff == 1) && character == 7) {
var_r30 = 7; chance = 7;
} }
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
if (i != arg0) { if (i != player) {
temp_r26 = GWPlayer[i].space_curr; space_other = GWPlayer[i].space_curr;
temp_r27 = BoardComPathLenGet(temp_r26, temp_r25); length = BoardComPathLenGet(space_other, space);
if (temp_r27 > 0 && temp_r27 <= 0xF && BoardPlayerItemFind(arg0, arg1) != -1 && BoardRandMod(0x64) >= var_r30) { if (length > 0 && length <= 15 && BoardPlayerItemFind(player, item) != -1 && BoardRandMod(0x64) >= chance) {
return TRUE; return TRUE;
} }
} }
@ -418,260 +419,260 @@ static BOOL CheckSparkUse(s32 arg0, s32 arg1) {
return FALSE; return FALSE;
} }
static BOOL CheckBoardChangeUse(s32 arg0, s32 arg1) { static BOOL CheckBoardChangeUse(s32 player, s32 item) {
s32 temp_r25; s32 diff;
s32 temp_r24; s32 character;
s32 temp_r23; s32 mini_len;
s32 temp_r22; s32 non_mini_len;
s32 temp_r21; s32 search_space;
s32 temp_r26; s32 space;
s32 var_r30; s32 length_min;
s32 var_r29; s32 length;
s32 var_r27; s32 chance;
s32 i; s32 i;
temp_r25 = GWPlayer[arg0].diff; diff = GWPlayer[player].diff;
temp_r24 = GWPlayer[arg0].character; character = GWPlayer[player].character;
switch (temp_r25) { switch (diff) {
case 0: case 0:
var_r27 = 0x32; chance = 0x32;
break; break;
case 1: case 1:
var_r27 = 0x19; chance = 0x19;
break; break;
case 2: case 2:
var_r27 = 5; chance = 5;
break; break;
case 3: case 3:
var_r27 = 0; chance = 0;
break; break;
} }
if (((arg1 == 4 && temp_r24 == 4) || (arg1 == 5 && (temp_r24 == 6 || temp_r24 == 3))) && (temp_r25 == 0 || temp_r25 == 1)) { if (((item == 4 && character == 4) || (item == 5 && (character == 6 || character == 3))) && (diff == 0 || diff == 1)) {
var_r27 = 7; chance = 7;
} }
var_r30 = 0x3E7; length_min = 999;
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
if (arg0 == i) { if (player == i) {
continue; continue;
} }
temp_r21 = GWPlayer[i].space_curr; search_space = GWPlayer[i].space_curr;
if (!GWTeamGet() || i != BoardPlayerSameTeamFind(arg0)) { if (!GWTeamGet() || i != BoardPlayerSameTeamFind(player)) {
temp_r26 = GWPlayer[i].space_curr; space = GWPlayer[i].space_curr;
if (GWBoardGet() == 7) { if (GWBoardGet() == 7) {
if (BoardComPathW20BestGet(temp_r21, 0x10000000, 0xA) != -1) { if (BoardComPathBestGetFlag(search_space, 0x10000000, 10) != -1) {
var_r29 = 0xA; length = 10;
} else { } else {
var_r29 = 0; length = 0;
} }
} else if (GWBoardGet() == 8) { } else if (GWBoardGet() == 8) {
if (BoardComPathW20BestGet(temp_r21, 0x200000, 0xA) != -1 || BoardComPathW20BestGet(temp_r21, 0x400000, 0xA) != -1) { if (BoardComPathBestGetFlag(search_space, 0x200000, 10) != -1 || BoardComPathBestGetFlag(search_space, 0x400000, 10) != -1) {
var_r29 = 0xA; length = 10;
} else { } else {
var_r29 = 0; length = 0;
} }
} else { } else {
var_r29 = BoardComPathReachCheck(temp_r26, 8, 0); length = BoardComPathShortcutLenGet(space, 8, 0);
} }
if (var_r29 != 0 && var_r29 < var_r30) { if (length != 0 && length < length_min) {
var_r30 = var_r29; length_min = length;
} }
} }
} }
if ((var_r30 > 0xF && var_r30 != 0x3E7) || (GWTeamGet() && i == BoardPlayerSameTeamFind(arg0))) { if ((length_min > 0xF && length_min != 999) || (GWTeamGet() && i == BoardPlayerSameTeamFind(player))) {
return FALSE; return FALSE;
} }
temp_r26 = GWPlayer[arg0].space_curr; space = GWPlayer[player].space_curr;
temp_r23 = BoardComPathReachCheck(temp_r26, 8, 0); mini_len = BoardComPathShortcutLenGet(space, 8, 0);
temp_r22 = BoardComPathReachCheck(temp_r26, 8, 1); non_mini_len = BoardComPathShortcutLenGet(space, 8, 1);
if (BoardPlayerItemFind(arg0, arg1) != -1 && BoardRandMod(0x64) >= var_r27) { if (BoardPlayerItemFind(player, item) != -1 && BoardRandMod(0x64) >= chance) {
if ((temp_r23 == 0 || temp_r22 == 0) && var_r30 == 0x3E7) { if ((mini_len == 0 || non_mini_len == 0) && length_min == 999) {
return TRUE; return TRUE;
} }
if (temp_r23 > var_r30 || temp_r22 > var_r30) { if (mini_len > length_min || non_mini_len > length_min) {
return TRUE; return TRUE;
} }
if (temp_r23 > 0xA || temp_r22 > 0xA) { if (mini_len > 10 || non_mini_len > 10) {
return TRUE; return TRUE;
} }
} }
return FALSE; return FALSE;
} }
BOOL CheckSwapUse(s32 arg0, s32 arg1) { static BOOL CheckSwapUse(s32 player, s32 item) {
s32 temp_r27; s32 diff;
s32 temp_r26; s32 team_player;
s32 temp_r25; s32 character;
s32 var_r30; s32 item_count;
s32 var_r29; s32 chance;
s32 i; s32 i;
temp_r27 = GWPlayer[arg0].diff; diff = GWPlayer[player].diff;
temp_r25 = GWPlayer[arg0].character; character = GWPlayer[player].character;
switch (temp_r27) { switch (diff) {
case 0: case 0:
var_r29 = 0x32; chance = 0x32;
break; break;
case 1: case 1:
var_r29 = 0x19; chance = 0x19;
break; break;
case 2: case 2:
var_r29 = 5; chance = 5;
break; break;
case 3: case 3:
var_r29 = 0; chance = 0;
break; break;
} }
if ((temp_r27 == 0 || temp_r27 == 1) && temp_r25 == 2) { if ((diff == 0 || diff == 1) && character == 2) {
var_r29 = 7; chance = 7;
} }
for (var_r30 = i = 0; i < 4; i++) { for (item_count = i = 0; i < 4; i++) {
if (i != arg0) { if (i != player) {
var_r30 += BoardPlayerItemCount(i); item_count += BoardPlayerItemCount(i);
} }
} }
if (var_r30 == 0) { if (item_count == 0) {
return FALSE; return FALSE;
} }
if (GWTeamGet()) { if (GWTeamGet()) {
temp_r26 = BoardPlayerSameTeamFind(arg0); team_player = BoardPlayerSameTeamFind(player);
for (var_r30 = i = 0; i < 4; i++) { for (item_count = i = 0; i < 4; i++) {
if (temp_r26 != i && i != arg0) { if (team_player != i && i != player) {
var_r30 += BoardPlayerItemCount(i); item_count += BoardPlayerItemCount(i);
} }
} }
if (var_r30 == 0) { if (item_count == 0) {
return FALSE; return FALSE;
} }
} }
if (BoardPlayerItemFind(arg0, arg1) != -1 && BoardRandMod(0x64) >= var_r29) { if (BoardPlayerItemFind(player, item) != -1 && BoardRandMod(0x64) >= chance) {
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
} }
static BOOL CheckBooUse(s32 arg0, s32 arg1) { static BOOL CheckBooUse(s32 player, s32 item) {
if (BoardPlayerCoinsGet(arg0) < 5) { if (BoardPlayerCoinsGet(player) < 5) {
return FALSE; return FALSE;
} }
if (BoardBooComUseCheck(arg0) == 0) { if (BoardBooComUseCheck(player) == 0) {
return FALSE; return FALSE;
} }
if (BoardPlayerItemFind(arg0, arg1) == -1) { if (BoardPlayerItemFind(player, item) == -1) {
return FALSE; return FALSE;
} }
return TRUE; return TRUE;
} }
static BOOL CheckLampUse(s32 arg0, s32 arg1) { static BOOL CheckLampUse(s32 player, s32 item) {
if ((BoardPlayerCoinsGet(arg0) >= 0x14 || GWSystem.last5_effect == 4) && BoardPlayerItemFind(arg0, arg1) != -1) { if ((BoardPlayerCoinsGet(player) >= 0x14 || GWSystem.last5_effect == 4) && BoardPlayerItemFind(player, item) != -1) {
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
} }
s32 BoardComJunctionInputGet(s32 arg0, Vec *arg1, s32 arg2, float *arg3) { s32 BoardComJunctionInputGet(s32 item, Vec *input, s32 num_dirs, float *dirs) {
Vec sp28; Vec pos_next;
Vec sp1C; Vec pos_junction;
Vec sp10; Vec dir;
float var_f30; float dist_min;
float var_f29; float dist;
float var_f31; float angle;
s32 var_r29; s32 chance_random;
s32 var_r27; s32 best_dir;
s32 temp_r26; s32 board;
s32 var_r24; s32 path_unknown;
s32 var_r23; s32 choose_path;
s32 var_r21; s32 dir_random;
s32 i; s32 i;
s16 var_r28; s16 space_next;
s16 temp_r25; s16 space;
s16 spC; s16 roll;
temp_r26 = GWBoardGet(); board = GWBoardGet();
var_r24 = 0; path_unknown = 0;
temp_r25 = GWPlayer[arg0].space_curr; space = GWPlayer[item].space_curr;
var_r28 = -1; space_next = -1;
spC = GWPlayer[arg0].roll; roll = GWPlayer[item].roll;
switch (GWPlayer[arg0].diff) { switch (GWPlayer[item].diff) {
case 3: case 3:
var_r29 = 0; chance_random = 0;
break; break;
case 2: case 2:
var_r29 = 0; chance_random = 0;
break; break;
case 1: case 1:
var_r29 = 0xA; chance_random = 10;
break; break;
default: default:
case 0: case 0:
var_r29 = 0x1E; chance_random = 0x1E;
break; break;
} }
if (BoardRandMod(0x64) >= var_r29) { if (BoardRandMod(0x64) >= chance_random) {
var_r23 = 1; choose_path = 1;
} else { } else {
var_r23 = 0; choose_path = 0;
} }
if (var_r23 != 0) { if (choose_path != 0) {
if (temp_r26 >= 0 && temp_r26 <= 5) { if (board >= 0 && board <= 5) {
var_r28 = BoardComPathBestGet(temp_r25); space_next = BoardComPathBestGet(space);
} else if (temp_r26 == 7) { } else if (board == 7) {
var_r28 = BoardComPathW20BestGet(temp_r25, 0x10000000, 0xA); space_next = BoardComPathBestGetFlag(space, 0x10000000, 10);
} }
if (var_r28 == -1) { if (space_next == -1) {
var_r24 = 1; path_unknown = 1;
} else { } else {
BoardSpacePosGet(0, temp_r25, &sp1C); BoardSpacePosGet(0, space, &pos_junction);
BoardSpacePosGet(0, var_r28, &sp28); BoardSpacePosGet(0, space_next, &pos_next);
PSVECSubtract(&sp28, &sp1C, &sp10); PSVECSubtract(&pos_next, &pos_junction, &dir);
var_f31 = BoardDAngleCalc(90.0 - 180.0 * (atan2(sp10.z, sp10.x) / M_PI)); angle = BoardDAngleCalc(90.0 - 180.0 * (atan2(dir.z, dir.x) / M_PI));
if (var_f31 < 0.0f) { if (angle < 0.0f) {
var_f31 += 360.0f; angle += 360.0f;
} }
if (var_f31 > 360.0f) { if (angle > 360.0f) {
var_f31 -= 360.0f; angle -= 360.0f;
} }
} }
} }
if (var_r24 != 0) { if (path_unknown != 0) {
var_r21 = BoardRandMod(arg2); dir_random = BoardRandMod(num_dirs);
var_f31 = arg3[var_r21]; angle = dirs[dir_random];
} }
var_f30 = 999.0f; dist_min = 999.0f;
for (var_r27 = i = 0; i < 4; i++) { for (best_dir = i = 0; i < 4; i++) {
var_f29 = (comJunctionDirTbl[i].x - var_f31 < 0.0f) dist = (comJunctionDirTbl[i].x - angle < 0.0f)
? -(comJunctionDirTbl[i].x - var_f31) ? -(comJunctionDirTbl[i].x - angle)
: (comJunctionDirTbl[i].x - var_f31); : (comJunctionDirTbl[i].x - angle);
if (var_f29 < var_f30) { if (dist < dist_min) {
var_r27 = i; best_dir = i;
var_f30 = var_f29; dist_min = dist;
} }
} }
arg1->x = comJunctionDirTbl[var_r27].y; input->x = comJunctionDirTbl[best_dir].y;
arg1->z = comJunctionDirTbl[var_r27].z; input->z = comJunctionDirTbl[best_dir].z;
arg1->y = 0.0f; input->y = 0.0f;
return 0; return 0;
} }
s32 BoardComBestPlayerFind(void) { s32 BoardComFarPlayerFind(void) {
s32 temp_r30; s32 len;
s32 var_r29; s32 max_len;
s32 var_r28; s32 far_player;
s32 var_r27; s32 space;
s32 i; s32 i;
if (_CheckFlag(0x1000B) != 0) { if (_CheckFlag(0x1000B) != 0) {
return -1; return -1;
} }
var_r28 = -1; far_player = -1;
var_r29 = -1; max_len = -1;
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
var_r27 = GWPlayer[i].space_curr; space = GWPlayer[i].space_curr;
temp_r30 = BoardComPathReachCheck(var_r27, 8, 0); len = BoardComPathShortcutLenGet(space, 8, 0);
if (temp_r30 > 0 && temp_r30 > var_r29) { if (len > 0 && len > max_len) {
var_r29 = temp_r30; max_len = len;
var_r28 = i; far_player = i;
} }
} }
return var_r28; return far_player;
} }

View file

@ -5,20 +5,19 @@
typedef struct { typedef struct {
/* 0x00 */ struct { /* 0x00 */ struct {
u8 unk00_field0 : 1; u8 used : 1;
u8 unk00_field1 : 1; u8 star : 1;
s8 unk00_field2 : 1; u8 pipe : 1;
s8 unk00_field3 : 1; u8 shop : 1;
u8 unk00_field4 : 1; u8 boo : 1;
u8 unk00_field5 : 1; u8 lottery : 1;
}; };
/* 0x01 */ s8 unk01; /* 0x01 */ s8 num_links;
/* 0x02 */ s8 unk02; /* 0x02 */ s8 num_children;
/* 0x03 */ s8 unk03; /* 0x03 */ s8 max_len;
/* 0x04 */ s16 unk04; /* 0x04 */ s16 start;
/* 0x06 */ s16 unk06[2]; // array size unknown /* 0x06 */ s16 children[32];
/* 0x0A */ char unk0A[0x3C]; /* 0x46 */ s16 links[BOARD_SPACE_LINKMAX+1];
/* 0x46 */ s16 unk46[5];
} PathNode; // Size 0x50 } PathNode; // Size 0x50
static PathNode *SearchPathNodeSpace(s16 arg0); static PathNode *SearchPathNodeSpace(s16 arg0);
@ -30,7 +29,7 @@ static BOOL CheckPathSpace(BoardSpace *arg0);
static s16 FindValidLink(BoardSpace *arg0); static s16 FindValidLink(BoardSpace *arg0);
static BOOL CheckEndSpace(BoardSpace *arg0, PathNode *arg1); static BOOL CheckEndSpace(BoardSpace *arg0, PathNode *arg1);
static BOOL CheckPath(PathNode *arg0); static BOOL CheckPath(PathNode *arg0);
static BOOL CheckW20Path(PathNode *arg0, u32 arg1); static BOOL CheckPathFlag(PathNode *arg0, u32 arg1);
static PathNode pathNodeData[16]; static PathNode pathNodeData[16];
static PathNode *candidateNodes[16]; static PathNode *candidateNodes[16];
@ -40,89 +39,89 @@ static s16 startPathSpace[16];
static s16 numCandidates; static s16 numCandidates;
static s16 childNodeCnt; static s16 childNodeCnt;
static PathNode *SearchPathNodeSpace(s16 arg0) { static PathNode *SearchPathNodeSpace(s16 space) {
PathNode *var_r31; PathNode *node;
s32 i; s32 i;
for (var_r31 = pathNodeData, i = 0; i < 16; i++, var_r31++) { for (node = pathNodeData, i = 0; i < 16; i++, node++) {
if (var_r31->unk04 == arg0) { if (node->start == space) {
break; break;
} }
} }
if (i == 16) { if (i == 16) {
var_r31 = NULL; node = NULL;
} }
return var_r31; return node;
} }
static s16 InitPathNode(PathNode *arg0) { static s16 InitPathNode(PathNode *node) {
BoardSpace *temp_r30; BoardSpace *space_ptr;
PathNode *var_r23; PathNode *child;
s32 var_r29; s32 done;
s16 i; s16 i;
s16 var_r27; s16 space;
s16 var_r26; s16 num_links;
s16 var_r25; s16 path_len;
s16 var_r24; s16 space_link;
var_r24 = arg0->unk04; space_link = node->start;
var_r29 = 0; done = 0;
arg0->unk02 = var_r25 = 0; node->num_children = path_len = 0;
do { do {
var_r27 = var_r24; space = space_link;
temp_r30 = BoardSpaceGet(0, var_r27); space_ptr = BoardSpaceGet(0, space);
arg0->unk06[arg0->unk02] = var_r27; node->children[node->num_children] = space;
var_r23 = FindChildNode(var_r27, arg0); child = FindChildNode(space, node);
if (var_r23) { if (child) {
AddValidLinks(temp_r30, arg0); AddValidLinks(space_ptr, node);
arg0->unk01 = 1; node->num_links = 1;
arg0->unk46[0] = var_r27; node->links[0] = space;
for (i = 1; i < 5; i++) { for (i = 1; i < 5; i++) {
arg0->unk46[i] = 0; node->links[i] = 0;
} }
return 0; return 0;
} }
if (temp_r30->link_cnt == 0) { if (space_ptr->link_cnt == 0) {
var_r26 = 0; num_links = 0;
var_r29 = 1; done = 1;
} else { } else {
var_r26 = GetNumValidLinks(temp_r30, arg0); num_links = GetNumValidLinks(space_ptr, node);
if (var_r26 == 1) { if (num_links == 1) {
var_r24 = FindValidLink(temp_r30); space_link = FindValidLink(space_ptr);
} else { } else {
var_r29 = 1; done = 1;
} }
} }
if (CheckEndSpace(temp_r30, arg0)) { if (CheckEndSpace(space_ptr, node)) {
var_r25++; path_len++;
if (var_r25 >= arg0->unk03) { if (path_len >= node->max_len) {
var_r26 = 0; num_links = 0;
var_r29 = 1; done = 1;
} }
} }
arg0->unk02++; node->num_children++;
} while (var_r29 == 0); } while (done == 0);
AddValidLinks(temp_r30, arg0); AddValidLinks(space_ptr, node);
arg0->unk01 = var_r26; node->num_links = num_links;
return arg0->unk03 - var_r25; return node->max_len - path_len;
} }
static PathNode *FindChildNode(s16 arg0, PathNode *arg1) { static PathNode *FindChildNode(s16 arg0, PathNode *arg1) {
PathNode *temp_r31; PathNode *node;
s32 var_r28; s32 node_idx;
s32 i; s32 i;
s32 j; s32 j;
var_r28 = NODE_INDEX(arg1); node_idx = NODE_INDEX(arg1);
if (var_r28 == -1) { if (node_idx == -1) {
return NULL; return NULL;
} }
for (i = 0; i < childNodeCnt; i++) { for (i = 0; i < childNodeCnt; i++) {
temp_r31 = &pathNodeData[i]; node = &pathNodeData[i];
if (temp_r31 != arg1) { if (node != arg1) {
for (j = 0; j < temp_r31->unk02; j++) { for (j = 0; j < node->num_children; j++) {
if (arg0 == temp_r31->unk06[j]) { if (arg0 == node->children[j]) {
return temp_r31; return node;
} }
} }
} }
@ -130,85 +129,85 @@ static PathNode *FindChildNode(s16 arg0, PathNode *arg1) {
return NULL; return NULL;
} }
static s32 GetNumValidLinks(BoardSpace *arg0, PathNode *arg1) { static s32 GetNumValidLinks(BoardSpace *space, PathNode *node) {
BoardSpace *var_r28; BoardSpace *link_space;
s16 i; s16 i;
s16 var_r29; s16 invalid_links;
for (var_r29 = i = 0; i < arg0->link_cnt; i++) { for (invalid_links = i = 0; i < space->link_cnt; i++) {
var_r28 = BoardSpaceGet(0, arg0->link[i]); link_space = BoardSpaceGet(0, space->link[i]);
if (!CheckPathSpace(var_r28)) { if (!CheckPathSpace(link_space)) {
var_r29++; invalid_links++;
} }
} }
if (var_r29 >= arg0->link_cnt) { if (invalid_links >= space->link_cnt) {
return 0; return 0;
} }
return arg0->link_cnt - var_r29; return space->link_cnt - invalid_links;
} }
static void AddValidLinks(BoardSpace *arg0, PathNode *arg1) { static void AddValidLinks(BoardSpace *space, PathNode *node) {
BoardSpace *var_r27; BoardSpace *link_space;
s16 var_r30; s16 i;
s16 var_r31; s16 link;
for (var_r31 = var_r30 = 0; var_r30 < arg0->link_cnt; var_r30++) { for (link = i = 0; i < space->link_cnt; i++) {
var_r27 = BoardSpaceGet(0, arg0->link[var_r30]); link_space = BoardSpaceGet(0, space->link[i]);
if (CheckPathSpace(var_r27)) { if (CheckPathSpace(link_space)) {
arg1->unk46[var_r31] = arg0->link[var_r30]; node->links[link] = space->link[i];
var_r31++; link++;
} }
} }
for (; var_r31 < 5; var_r31++) { for (; link < BOARD_SPACE_LINKMAX+1; link++) {
arg1->unk46[var_r31] = 0; node->links[link] = 0;
} }
} }
static BOOL CheckPathSpace(BoardSpace *arg0) { static BOOL CheckPathSpace(BoardSpace *space) {
if ((arg0->flag & 0x02000000) || (arg0->flag & 0x04000000)) { if ((space->flag & 0x02000000) || (space->flag & 0x04000000)) {
return FALSE; return FALSE;
} else { } else {
return TRUE; return TRUE;
} }
} }
static s16 FindValidLink(BoardSpace *arg0) { static s16 FindValidLink(BoardSpace *space) {
s16 var_r29; s16 space_link;
s16 i; s16 i;
BoardSpace *temp_r30; BoardSpace *space_ptr;
for (var_r29 = i = 0; i < arg0->link_cnt; i++) { for (space_link = i = 0; i < space->link_cnt; i++) {
var_r29 = arg0->link[i]; space_link = space->link[i];
temp_r30 = BoardSpaceGet(0, var_r29); space_ptr = BoardSpaceGet(0, space_link);
if (CheckPathSpace(temp_r30)) { if (CheckPathSpace(space_ptr)) {
break; break;
} }
} }
return var_r29; return space_link;
} }
static BOOL CheckEndSpace(BoardSpace *arg0, PathNode *arg1) { static BOOL CheckEndSpace(BoardSpace *space, PathNode *node) {
if (arg0->flag & 0x80000000) { if (space->flag & 0x80000000) {
} }
if (arg0->flag & 0x4000000) { if (space->flag & 0x4000000) {
} }
if (arg0->flag & 0x2000000) { if (space->flag & 0x2000000) {
} }
if (arg0->flag & 0x180000) { if (space->flag & 0x180000) {
arg1->unk00_field3 = 1; node->shop = 1;
} }
if (arg0->flag & 0x48000000) { if (space->flag & 0x48000000) {
arg1->unk00_field4 = 1; node->boo = 1;
} }
if (arg0->flag & 0x20000000) { if (space->flag & 0x20000000) {
arg1->unk00_field2 = 1; node->pipe = 1;
} }
if (arg0->flag & 0x10000000) { if (space->flag & 0x10000000) {
arg1->unk00_field5 = 1; node->lottery = 1;
} }
switch (arg0->type) { switch (space->type) {
case 8: case 8:
arg1->unk00_field1 = 1; node->star = 1;
return FALSE; return FALSE;
case 10: case 10:
return FALSE; return FALSE;
@ -218,151 +217,151 @@ static BOOL CheckEndSpace(BoardSpace *arg0, PathNode *arg1) {
return TRUE; return TRUE;
} }
static inline void ComPathInlineFunc02(PathNode *arg0) { static inline void PushCandidate(PathNode *node) {
if (numCandidates < 16) { if (numCandidates < 16) {
candidateNodes[numCandidates] = arg0; candidateNodes[numCandidates] = node;
numCandidates++; numCandidates++;
} }
} }
static inline PathNode *ComPathInlineFunc03(void) { static inline PathNode *PopCandidate(void) {
PathNode *ret; PathNode *node;
numCandidates--; numCandidates--;
if (numCandidates < 0) { if (numCandidates < 0) {
return NULL; return NULL;
} else { } else {
ret = candidateNodes[numCandidates]; node = candidateNodes[numCandidates];
candidateNodes[numCandidates] = NULL; candidateNodes[numCandidates] = NULL;
return ret; return node;
} }
} }
static inline PathNode *ComPathInlineFunc04(s16 arg0, s16 arg1) { static inline PathNode *CreateNode(s16 start, s16 len) {
PathNode *var_r26; PathNode *node;
s32 i; s32 i;
var_r26 = pathNodeData; node = pathNodeData;
for (i = 0; i < 16; i++, var_r26++) { for (i = 0; i < 16; i++, node++) {
if (var_r26->unk00_field0 == 0) { if (node->used == 0) {
break; break;
} }
} }
if (i == 16) { if (i == 16) {
return NULL; return NULL;
} else { } else {
var_r26->unk00_field0 = 1; node->used = 1;
var_r26->unk04 = arg0; node->start = start;
var_r26->unk03 = arg1; node->max_len = len;
childNodeCnt++; childNodeCnt++;
return var_r26; return node;
} }
} }
static inline void ComPathInlineFunc05(s16 arg0, s16 arg1) { static inline void PopulateCandidates(s16 start, s16 len) {
PathNode *var_r28; PathNode *node;
s32 var_r24; s32 num_paths;
s32 temp_r17; s32 lookahead;
s32 i; s32 i;
PathNode *var_r23; PathNode *new_node;
memset(pathNodeData, 0, sizeof(pathNodeData)); memset(pathNodeData, 0, sizeof(pathNodeData));
memset(candidateNodes, 0, sizeof(candidateNodes)); memset(candidateNodes, 0, sizeof(candidateNodes));
numCandidates = 0; numCandidates = 0;
childNodeCnt = 0; childNodeCnt = 0;
var_r23 = ComPathInlineFunc04(arg0, arg1); new_node = CreateNode(start, len);
ComPathInlineFunc02(var_r23); PushCandidate(new_node);
var_r24 = 1; num_paths = 1;
temp_r17 = arg1; lookahead = len;
while (1) { while (1) {
if (var_r24 <= 0) { if (num_paths <= 0) {
break; break;
} }
var_r28 = ComPathInlineFunc03(); node = PopCandidate();
if (!var_r28) { if (!node) {
break; break;
} }
var_r24--; num_paths--;
temp_r17 = InitPathNode(var_r28); lookahead = InitPathNode(node);
if (temp_r17 != 0) { if (lookahead != 0) {
if (var_r28->unk01 <= 1) { if (node->num_links <= 1) {
break; break;
} }
for (i = 0; i < var_r28->unk01; var_r24++, i++) { for (i = 0; i < node->num_links; num_paths++, i++) {
var_r23 = ComPathInlineFunc04(var_r28->unk46[i], temp_r17); new_node = CreateNode(node->links[i], lookahead);
if (!var_r23) { if (!new_node) {
break; break;
} }
ComPathInlineFunc02(var_r23); PushCandidate(new_node);
} }
} }
} }
} }
s16 BoardComPathReachCheck(s16 arg0, u32 arg1, s32 arg2) { s16 BoardComPathShortcutLenGet(s16 space, u32 type, s32 block_pipe) {
s16 sp80[10]; s16 len_tbl[10];
s16 sp6C[10]; s16 node_tbl[10];
PathNode *sp68; PathNode *node_link;
PathNode *var_r29; PathNode *node;
s16 sp1C; s16 node_idx;
s16 sp1A; s16 node_start_idx;
s16 temp_r20; s16 node_idx_link;
s16 var_r22; s16 num_nodes;
s16 var_r28; s16 len;
s16 i; s16 i;
s32 var_r19; s32 search_child;
if (_CheckFlag(0x1000B)) { if (_CheckFlag(0x1000B)) {
return 0; return 0;
} }
ComPathInlineFunc05(arg0, 0x1E); PopulateCandidates(space, 30);
memset(startPathSpaceSearch, 0, sizeof(startPathSpaceSearch)); memset(startPathSpaceSearch, 0, sizeof(startPathSpaceSearch));
memset(sp80, 0, sizeof(sp80)); memset(len_tbl, 0, sizeof(len_tbl));
memset(candidateNodes, 0, sizeof(candidateNodes)); memset(candidateNodes, 0, sizeof(candidateNodes));
numCandidates = 0; numCandidates = 0;
var_r29 = SearchPathNodeSpace(arg0); node = SearchPathNodeSpace(space);
sp1A = NODE_INDEX(var_r29); node_start_idx = NODE_INDEX(node);
ComPathInlineFunc02(var_r29); PushCandidate(node);
var_r28 = 0; len = 0;
var_r22 = 0; num_nodes = 0;
startPathSpaceSearch[sp1A] = var_r28; startPathSpaceSearch[node_start_idx] = len;
var_r19 = 0; search_child = 0;
while (1) { while (1) {
var_r29 = ComPathInlineFunc03(); node = PopCandidate();
sp1C = NODE_INDEX(var_r29); node_idx = NODE_INDEX(node);
if (sp1C == -1) { if (node_idx == -1) {
if (var_r22 != 0) { if (num_nodes != 0) {
break; break;
} }
} else { } else {
var_r19 = 0; search_child = 0;
var_r28 = startPathSpaceSearch[sp1C]; len = startPathSpaceSearch[node_idx];
for (i = 0; i < var_r29->unk02; i++) { for (i = 0; i < node->num_children; i++) {
if (arg2 == 0 && (BoardSpaceFlagGet(0, var_r29->unk06[i]) & 0x20000000)) { if (block_pipe == 0 && (BoardSpaceFlagGet(0, node->children[i]) & 0x20000000)) {
break; break;
} }
if (arg1 == BoardSpaceTypeGet(0, var_r29->unk06[i])) { if (type == BoardSpaceTypeGet(0, node->children[i])) {
sp80[var_r22] = var_r28; len_tbl[num_nodes] = len;
sp6C[var_r22] = sp1C; node_tbl[num_nodes] = node_idx;
if (++var_r22 < 0xA) { if (++num_nodes < 10) {
var_r19 = 1; search_child = 1;
break; break;
} else { } else {
goto return_r28; goto done;
} }
} }
if (var_r28++ >= 0x1E) { if (len++ >= 30) {
var_r19 = 1; search_child = 1;
break; break;
} }
} }
if (var_r19 == 0) { if (search_child == 0) {
for (i = 0; i < var_r29->unk01; i++) { for (i = 0; i < node->num_links; i++) {
sp68 = SearchPathNodeSpace(var_r29->unk46[i]); node_link = SearchPathNodeSpace(node->links[i]);
temp_r20 = NODE_INDEX(sp68); node_idx_link = NODE_INDEX(node_link);
if (temp_r20 != -1 && temp_r20 >= 0 && temp_r20 < 16) { if (node_idx_link != -1 && node_idx_link >= 0 && node_idx_link < 16) {
startPathSpaceSearch[temp_r20] = var_r28; startPathSpaceSearch[node_idx_link] = len;
ComPathInlineFunc02(sp68); PushCandidate(node_link);
} }
} }
} }
@ -370,89 +369,89 @@ s16 BoardComPathReachCheck(s16 arg0, u32 arg1, s32 arg2) {
} }
return 0; return 0;
} }
return_r28: done:
var_r28 = 10000; len = 10000;
for (i = 0; i < 10; i++) { for (i = 0; i < 10; i++) {
if (var_r28 > sp80[i] && sp80[i] != 0) { if (len > len_tbl[i] && len_tbl[i] != 0) {
var_r28 = sp80[i]; len = len_tbl[i];
} }
} }
return var_r28; return len;
} }
s16 BoardComPathBestGet(s16 arg0) { s16 BoardComPathBestGet(s16 space) {
PathNode *sp30; PathNode *link_node;
PathNode *sp2C; PathNode *node;
s32 i; s32 i;
ComPathInlineFunc05(arg0, 0x1E); PopulateCandidates(space, 30);
sp2C = SearchPathNodeSpace(arg0); node = SearchPathNodeSpace(space);
if (sp2C->unk00_field1 != 0) { if (node->star != 0) {
return -1; return -1;
} }
if (sp2C->unk01 <= 1) { if (node->num_links <= 1) {
return -1; return -1;
} }
for (i = 0; i < sp2C->unk01; i++) { for (i = 0; i < node->num_links; i++) {
sp30 = SearchPathNodeSpace(sp2C->unk46[i]); link_node = SearchPathNodeSpace(node->links[i]);
if (sp30 && CheckPath(sp30)) { if (link_node && CheckPath(link_node)) {
return sp2C->unk46[i]; return node->links[i];
} }
} }
return -1; return -1;
} }
s16 BoardComPathLenGet(s16 arg0, s16 arg1) { s16 BoardComPathLenGet(s16 space, s16 space_other) {
PathNode *var_r30; PathNode *node;
s16 temp_r21; s16 link_node_idx;
s16 var_r25; s16 len;
s16 sp16; s16 sp16;
s16 sp14; s16 node_idx;
s16 sp12; s16 node_start_idx;
s16 i; s16 i;
s32 sp5C; s32 search_child;
PathNode *sp58; PathNode *link_node;
ComPathInlineFunc05(arg0, 0x1E); PopulateCandidates(space, 30);
memset(startPathSpace, 0, sizeof(startPathSpace)); memset(startPathSpace, 0, sizeof(startPathSpace));
memset(candidateNodes, 0, sizeof(candidateNodes)); memset(candidateNodes, 0, sizeof(candidateNodes));
numCandidates = 0; numCandidates = 0;
var_r30 = SearchPathNodeSpace(arg0); node = SearchPathNodeSpace(space);
sp12 = NODE_INDEX(var_r30); node_start_idx = NODE_INDEX(node);
ComPathInlineFunc02(var_r30); PushCandidate(node);
var_r25 = 0; len = 0;
sp16 = 0; sp16 = 0;
startPathSpace[sp12] = var_r25; startPathSpace[node_start_idx] = len;
sp5C = 0; search_child = 0;
while (1) { while (1) {
var_r30 = ComPathInlineFunc03(); node = PopCandidate();
sp14 = NODE_INDEX(var_r30); node_idx = NODE_INDEX(node);
if (sp14 == -1) { if (node_idx == -1) {
if (sp16 != 0) { if (sp16 != 0) {
break; break;
} }
} else { } else {
sp5C = 0; search_child = 0;
var_r25 = startPathSpace[sp14]; len = startPathSpace[node_idx];
for (i = 0; i < var_r30->unk02; i++) { for (i = 0; i < node->num_children; i++) {
if (BoardSpaceFlagGet(0, var_r30->unk06[i]) & 0x20000000) { if (BoardSpaceFlagGet(0, node->children[i]) & 0x20000000) {
break; break;
} }
if (var_r30->unk06[i] == arg1) { if (node->children[i] == space_other) {
goto return_r25; goto done;
} }
if (var_r25++ >= 0x1E) { if (len++ >= 30) {
sp5C = 1; search_child = 1;
break; break;
} }
} }
if (sp5C == 0) { if (search_child == 0) {
for (i = 0; i < var_r30->unk01; i++) { for (i = 0; i < node->num_links; i++) {
sp58 = SearchPathNodeSpace(var_r30->unk46[i]); link_node = SearchPathNodeSpace(node->links[i]);
temp_r21 = NODE_INDEX(sp58); link_node_idx = NODE_INDEX(link_node);
if (temp_r21 != -1 && temp_r21 >= 0 && temp_r21 < 16) { if (link_node_idx != -1 && link_node_idx >= 0 && link_node_idx < 16) {
startPathSpace[temp_r21] = var_r25; startPathSpace[link_node_idx] = len;
ComPathInlineFunc02(sp58); PushCandidate(link_node);
} }
} }
} }
@ -460,84 +459,84 @@ s16 BoardComPathLenGet(s16 arg0, s16 arg1) {
} }
return 0; return 0;
} }
return_r25: done:
return var_r25; return len;
} }
static BOOL CheckPath(PathNode *arg0) { static BOOL CheckPath(PathNode *node) {
s32 i; s32 i;
PathNode *sp1C; PathNode *link;
if (arg0->unk00_field1 != 0) { if (node->star != 0) {
return TRUE; return TRUE;
} }
if (arg0->unk01 <= 1) { if (node->num_links <= 1) {
return FALSE; return FALSE;
} }
for (i = 0; i < arg0->unk01; i++) { for (i = 0; i < node->num_links; i++) {
sp1C = SearchPathNodeSpace(arg0->unk46[i]); link = SearchPathNodeSpace(node->links[i]);
if (sp1C && CheckPath(sp1C)) { if (link && CheckPath(link)) {
return TRUE; return TRUE;
} }
} }
return FALSE; return FALSE;
} }
s16 BoardComPathW20BestGet(s16 arg0, u32 arg1, s16 arg2) { s16 BoardComPathBestGetFlag(s16 space, u32 flag, s16 len) {
PathNode *var_r31; PathNode *node;
PathNode *sp38; PathNode *node_link;
s32 i; s32 i;
ComPathInlineFunc05(arg0, arg2); PopulateCandidates(space, len);
var_r31 = SearchPathNodeSpace(arg0); node = SearchPathNodeSpace(space);
if (arg1 & 0x180000) { if (flag & 0x180000) {
if (var_r31->unk00_field1 != 0) { if (node->star != 0) {
return -1; return -1;
} }
} else if (arg1 & 0x08000000) { } else if (flag & 0x08000000) {
if (var_r31->unk00_field4 != 0) { if (node->boo != 0) {
return -1; return -1;
} }
} else if (arg1 & 0x10000000) { } else if (flag & 0x10000000) {
if (var_r31->unk00_field5 != 0) { if (node->lottery != 0) {
return -1; return -1;
} }
} }
if (var_r31->unk01 <= 1) { if (node->num_links <= 1) {
return -1; return -1;
} }
for (i = 0; i < var_r31->unk01; i++) { for (i = 0; i < node->num_links; i++) {
sp38 = SearchPathNodeSpace(var_r31->unk46[i]); node_link = SearchPathNodeSpace(node->links[i]);
if (sp38 && CheckW20Path(sp38, arg1)) { if (node_link && CheckPathFlag(node_link, flag)) {
return var_r31->unk46[i]; return node->links[i];
} }
} }
return -1; return -1;
} }
static BOOL CheckW20Path(PathNode *arg0, u32 arg1) { static BOOL CheckPathFlag(PathNode *node, u32 flag) {
s32 i; s32 i;
PathNode *sp1C; PathNode *link_node;
if (arg1 & 0x180000) { if (flag & 0x180000) {
if (arg0->unk00_field1 != 0) { if (node->star != 0) {
return TRUE; return TRUE;
} }
} else if (arg1 & 0x08000000) { } else if (flag & 0x08000000) {
if (arg0->unk00_field4 != 0) { if (node->boo != 0) {
return TRUE; return TRUE;
} }
} else if (arg1 & 0x10000000) { } else if (flag & 0x10000000) {
if (arg0->unk00_field5 != 0) { if (node->lottery != 0) {
return TRUE; return TRUE;
} }
} }
if (arg0->unk01 <= 1) { if (node->num_links <= 1) {
return FALSE; return FALSE;
} }
for (i = 0; i < arg0->unk01; i++) { for (i = 0; i < node->num_links; i++) {
sp1C = SearchPathNodeSpace(arg0->unk46[i]); link_node = SearchPathNodeSpace(node->links[i]);
if (sp1C && CheckW20Path(sp1C, arg1)) { if (link_node && CheckPathFlag(link_node, flag)) {
return TRUE; return TRUE;
} }
} }

View file

@ -24,7 +24,6 @@ typedef struct camera_view {
s16 fov; s16 fov;
} CameraView; } CameraView;
omObjData *boardMainObj; omObjData *boardMainObj;
u32 boardRandSeed; u32 boardRandSeed;
static omObjData *last5GfxObj; static omObjData *last5GfxObj;
@ -619,16 +618,10 @@ static void CreateBoard(void)
GWSystem.mg_next = -1; GWSystem.mg_next = -1;
if(!GWGameStat.field10E_bit5) { if(!GWGameStat.field10E_bit5) {
s32 type_temp; s32 type_temp;
if(GWSystem.mg_list == 3) {
GWSystem.mg_list = 0;
}
if(GWMGListGet() == 2) { if(GWMGListGet() == 2) {
GWSystem.mg_list = 0; GWSystem.mg_list = 0;
} }
} }
if(GWSystem.mess_speed == 3) {
GWSystem.mess_speed = 1;
}
mess_speed = GWMessSpeedGet(); mess_speed = GWMessSpeedGet();
GWSystem.mess_speed = mess_speed; GWSystem.mess_speed = mess_speed;
switch(mess_speed) { switch(mess_speed) {

View file

@ -151,27 +151,6 @@ void BoardPauseStart(void) {
HuPrcDestructorSet2(mainProcess, PauseExit); HuPrcDestructorSet2(mainProcess, PauseExit);
} }
static inline s32 PauseExitInlineFunc01(void) {
if (GWSystem.mg_list == 3) {
GWSystem.mg_list = 0;
}
return GWSystem.mg_list;
}
static inline s32 PauseExitInlineFunc02(void) {
if (GWSystem.mess_speed == 3) {
GWSystem.mess_speed = 1;
}
return GWSystem.mess_speed;
}
static inline s32 PauseExitInlineFunc03(void) {
if (GWSystem.save_mode == 3) {
GWSystem.save_mode = 1;
}
return GWSystem.save_mode;
}
static void PauseExit(void) { static void PauseExit(void) {
if (pauseQuitF == 0) { if (pauseQuitF == 0) {
BoardRollWinDispSet(1); BoardRollWinDispSet(1);
@ -200,15 +179,15 @@ static void PauseExit(void) {
if (GWPartyGet() == 0) { if (GWPartyGet() == 0) {
GWGameStat.field10F_bit0 = GWMGExplainGet(); GWGameStat.field10F_bit0 = GWMGExplainGet();
GWGameStat.field10F_bit1 = GWMGShowComGet(); GWGameStat.field10F_bit1 = GWMGShowComGet();
GWGameStat.field10F_bit2 = PauseExitInlineFunc01(); GWGameStat.field10F_bit2 = GWMGListGet();
GWGameStat.field10F_bit4 = PauseExitInlineFunc02(); GWGameStat.field10F_bit4 = GWMessSpeedGet();
GWGameStat.field10F_bit6 = PauseExitInlineFunc03(); GWGameStat.field10F_bit6 = GWSaveModeGet();
} else { } else {
GWGameStat.field110_bit0 = GWMGExplainGet(); GWGameStat.field110_bit0 = GWMGExplainGet();
GWGameStat.field110_bit1 = GWMGShowComGet(); GWGameStat.field110_bit1 = GWMGShowComGet();
GWGameStat.field110_bit2 = PauseExitInlineFunc01(); GWGameStat.field110_bit2 = GWMGListGet();
GWGameStat.field110_bit4 = PauseExitInlineFunc02(); GWGameStat.field110_bit4 = GWMessSpeedGet();
GWGameStat.field110_bit6 = PauseExitInlineFunc03(); GWGameStat.field110_bit6 = GWSaveModeGet();
} }
mainProcess = NULL; mainProcess = NULL;
} }
@ -390,7 +369,7 @@ void CreatePauseScreen(void) {
var_f31 = (var_r28 != 0) ? 0.0f : -90.0f; var_f31 = (var_r28 != 0) ? 0.0f : -90.0f;
break; break;
case 3: case 3:
var_r28 = PauseExitInlineFunc01(); var_r28 = GWMGListGet();
switch (var_r28) { switch (var_r28) {
case 1: case 1:
var_r28 = 0; var_r28 = 0;
@ -411,7 +390,7 @@ void CreatePauseScreen(void) {
var_f31 = (var_r28 != 0) ? 0.0f : -90.0f; var_f31 = (var_r28 != 0) ? 0.0f : -90.0f;
break; break;
case 5: case 5:
var_r28 = PauseExitInlineFunc02(); var_r28 = GWMessSpeedGet();
switch (var_r28) { switch (var_r28) {
case 2: case 2:
var_r28 = 0; var_r28 = 0;
@ -431,7 +410,7 @@ void CreatePauseScreen(void) {
if (temp_r29->unk00_field4 != 0) { if (temp_r29->unk00_field4 != 0) {
GWSystem.save_mode = 1; GWSystem.save_mode = 1;
} }
var_r28 = PauseExitInlineFunc03(); var_r28 = GWSaveModeGet();
switch (var_r28) { switch (var_r28) {
case 1: case 1:
var_r28 = 0; var_r28 = 0;

View file

@ -1339,7 +1339,7 @@ static void ExecItemPick(void) {
itemPosTemp[j].x -= 8.0f; itemPosTemp[j].x -= 8.0f;
itemPosTemp[j].y += 16.0f; itemPosTemp[j].y += 16.0f;
} }
sp18 = BoardComTutorialItemGet(itemPlayer); sp18 = BoardComUseItemSlotGet(itemPlayer);
ExecItemPickInlineFunc02(itemPlayer, var_r23, sp18); ExecItemPickInlineFunc02(itemPlayer, var_r23, sp18);
} }

View file

@ -182,7 +182,6 @@ void BoardWinPause(void) {
void BoardWinCreateChoice(s32 pos, u32 mess, s32 portrait, s32 choice) { void BoardWinCreateChoice(s32 pos, u32 mess, s32 portrait, s32 choice) {
s32 i; s32 i;
winPosIdx = pos; winPosIdx = pos;
winChoice = 0; winChoice = 0;
@ -209,9 +208,6 @@ void BoardWinCreateChoice(s32 pos, u32 mess, s32 portrait, s32 choice) {
HuPrcDestructorSet2(winProc, &BoardWinDestroy); HuPrcDestructorSet2(winProc, &BoardWinDestroy);
} }
winMess = mess; winMess = mess;
if (GWSystem.mess_speed == 3) {
GWSystem.mess_speed = 1;
}
BoardWinSpeedSet(GWMessSpeedGet()); BoardWinSpeedSet(GWMessSpeedGet());
BoardWinPlayerSet(GWSystem.player_curr); BoardWinPlayerSet(GWSystem.player_curr);
} }
@ -244,9 +240,6 @@ void BoardWinCreate(s32 pos, u32 mess, s32 portrait) {
HuPrcDestructorSet2(winProc, &BoardWinDestroy); HuPrcDestructorSet2(winProc, &BoardWinDestroy);
} }
winMess = mess; winMess = mess;
if (GWSystem.mess_speed == 3) {
GWSystem.mess_speed = 1;
}
BoardWinSpeedSet(GWMessSpeedGet()); BoardWinSpeedSet(GWMessSpeedGet());
BoardWinPlayerSet(GWSystem.player_curr); BoardWinPlayerSet(GWSystem.player_curr);
autoPickF = 0; autoPickF = 0;
@ -300,13 +293,7 @@ void BoardWinKeyWait(void) {
} }
int BoardWinSpeedGet(void) { int BoardWinSpeedGet(void) {
s32 speed; return winSpeedTbl[GWMessSpeedGet()];
if (GWSystem.mess_speed == 3) {
GWSystem.mess_speed = 1;
}
speed = GWSystem.mess_speed;
return winSpeedTbl[speed];
} }
void BoardWinSpeedSet(s32 value) { void BoardWinSpeedSet(s32 value) {
@ -348,12 +335,10 @@ s32 BoardWinPortraitGetStar(void) {
} }
void BoardWinPlayerSet(s32 player) { void BoardWinPlayerSet(s32 player) {
s32 temp;
s32 i; s32 i;
if (player == -1) { if (player == -1) {
temp = GWSystem.party; if (GWPartyGet() != 1) {
if (temp != 1) {
for (i = 0, disablePlayer = i; i < 4; i++) { for (i = 0, disablePlayer = i; i < 4; i++) {
if (GWPlayer[i].com != 0) { if (GWPlayer[i].com != 0) {
disablePlayer |= 1 << GWPlayer[i].port; disablePlayer |= 1 << GWPlayer[i].port;