Merge branch 'main' into main

This commit is contained in:
CreateSource 2024-01-01 23:38:06 -05:00 committed by GitHub
commit d2f3c2e762
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 792 additions and 161 deletions

View file

@ -1,7 +1,7 @@
InitBoard = .text:0x00000000; // type:function size:0x30 scope:local InitBoard = .text:0x00000000; // type:function size:0x30 scope:local
_prolog = .text:0x00000030; // type:function size:0x64 scope:global _prolog = .text:0x00000030; // type:function size:0x64 scope:global
_epilog = .text:0x00000094; // type:function size:0x4C scope:global _epilog = .text:0x00000094; // type:function size:0x4C scope:global
BoardInit = .text:0x000000E0; // type:function size:0x4BC BoardCreate = .text:0x000000E0; // type:function size:0x4BC
BoardDestroy = .text:0x0000059C; // type:function size:0x194 BoardDestroy = .text:0x0000059C; // type:function size:0x194
fn_1_730 = .text:0x00000730; // type:function size:0x44 fn_1_730 = .text:0x00000730; // type:function size:0x44
fn_1_774 = .text:0x00000774; // type:function size:0x4 fn_1_774 = .text:0x00000774; // type:function size:0x4

View file

@ -1,7 +1,7 @@
InitBoard = .text:0x00000000; // type:function size:0x30 scope:local InitBoard = .text:0x00000000; // type:function size:0x30 scope:local
_prolog = .text:0x00000030; // type:function size:0x64 scope:global _prolog = .text:0x00000030; // type:function size:0x64 scope:global
_epilog = .text:0x00000094; // type:function size:0x4C scope:global _epilog = .text:0x00000094; // type:function size:0x4C scope:global
BoardInit = .text:0x000000E0; // type:function size:0x4F4 BoardCreate = .text:0x000000E0; // type:function size:0x4F4
BoardDestroy = .text:0x000005D4; // type:function size:0x158 BoardDestroy = .text:0x000005D4; // type:function size:0x158
fn_1_72C = .text:0x0000072C; // type:function size:0x44 fn_1_72C = .text:0x0000072C; // type:function size:0x44
fn_1_770 = .text:0x00000770; // type:function size:0x4 fn_1_770 = .text:0x00000770; // type:function size:0x4

View file

@ -1,7 +1,7 @@
InitBoard = .text:0x00000000; // type:function size:0x30 scope:local InitBoard = .text:0x00000000; // type:function size:0x30 scope:local
_prolog = .text:0x00000030; // type:function size:0x64 scope:global _prolog = .text:0x00000030; // type:function size:0x64 scope:global
_epilog = .text:0x00000094; // type:function size:0x4C scope:global _epilog = .text:0x00000094; // type:function size:0x4C scope:global
BoardInit = .text:0x000000E0; // type:function size:0x660 BoardCreate = .text:0x000000E0; // type:function size:0x660
BoardDestroy = .text:0x00000740; // type:function size:0x144 BoardDestroy = .text:0x00000740; // type:function size:0x144
fn_1_884 = .text:0x00000884; // type:function size:0x6C fn_1_884 = .text:0x00000884; // type:function size:0x6C
fn_1_8F0 = .text:0x000008F0; // type:function size:0x20 fn_1_8F0 = .text:0x000008F0; // type:function size:0x20

View file

@ -22,9 +22,9 @@ REL/w10Dll/host.c:
REL/w10Dll/scene.c: REL/w10Dll/scene.c:
.text start:0x00000D2C end:0x0000176C .text start:0x00000D2C end:0x0000176C
.rodata start:0x00000048 end:0x00000050 .rodata start:0x00000048 end:0x00000058
REL/w10Dll/tutorial.c: REL/w10Dll/tutorial.c:
.text start:0x0000176C end:0x0000206C .text start:0x0000176C end:0x0000206C
.rodata start:0x00000050 end:0x00000070 .rodata start:0x00000058 end:0x00000070
.data start:0x00000098 end:0x000002D4 .data start:0x00000098 end:0x000002D4

View file

@ -1,7 +1,7 @@
InitBoard = .text:0x00000000; // type:function size:0x30 scope:local InitBoard = .text:0x00000000; // type:function size:0x30 scope:local
_prolog = .text:0x00000030; // type:function size:0x64 scope:global _prolog = .text:0x00000030; // type:function size:0x64 scope:global
_epilog = .text:0x00000094; // type:function size:0x4C scope:global _epilog = .text:0x00000094; // type:function size:0x4C scope:global
BoardInit = .text:0x000000E0; // type:function size:0x5F8 BoardCreate = .text:0x000000E0; // type:function size:0x5F8
BoardDestroy = .text:0x000006D8; // type:function size:0x1E8 BoardDestroy = .text:0x000006D8; // type:function size:0x1E8
fn_1_8C0 = .text:0x000008C0; // type:function size:0x44 fn_1_8C0 = .text:0x000008C0; // type:function size:0x44
fn_1_904 = .text:0x00000904; // type:function size:0x4 fn_1_904 = .text:0x00000904; // type:function size:0x4

View file

@ -1009,11 +1009,11 @@ BoardPauseEnableSet = .text:0x8005B6F0; // type:function size:0x74
BoardPauseEnableGet = .text:0x8005B764; // type:function size:0x48 BoardPauseEnableGet = .text:0x8005B764; // type:function size:0x48
BoardSaveInit = .text:0x8005B7AC; // type:function size:0x524 BoardSaveInit = .text:0x8005B7AC; // type:function size:0x524
BoardStoryConfigSet = .text:0x8005BCD0; // type:function size:0x160 BoardStoryConfigSet = .text:0x8005BCD0; // type:function size:0x160
BoardConfigSet = .text:0x8005BE30; // type:function size:0x160 BoardPartyConfigSet = .text:0x8005BE30; // type:function size:0x160
DestroyMainFunc = .text:0x8005BF90; // type:function size:0xC scope:local DestroyMainFunc = .text:0x8005BF90; // type:function size:0xC scope:local
MainFunc = .text:0x8005BF9C; // type:function size:0x7D0 scope:local MainFunc = .text:0x8005BF9C; // type:function size:0x7D0 scope:local
BoardTurnNext = .text:0x8005C76C; // type:function size:0x8C BoardTurnNext = .text:0x8005C76C; // type:function size:0x8C
BoardIsTurnCont = .text:0x8005C7F8; // type:function size:0x28C BoardTurnStartExec = .text:0x8005C7F8; // type:function size:0x28C
BoardNextOvlSet = .text:0x8005CA84; // type:function size:0xC4 BoardNextOvlSet = .text:0x8005CA84; // type:function size:0xC4
BoardIsStarted = .text:0x8005CB48; // type:function size:0x8C BoardIsStarted = .text:0x8005CB48; // type:function size:0x8C
CreateBoard = .text:0x8005CBD4; // type:function size:0x410 scope:local CreateBoard = .text:0x8005CBD4; // type:function size:0x410 scope:local
@ -1034,9 +1034,9 @@ BoardCameraPointDirGet = .text:0x8005D6D0; // type:function size:0xBC
BoardCameraSet = .text:0x8005D78C; // type:function size:0x28 BoardCameraSet = .text:0x8005D78C; // type:function size:0x28
BoardCameraVisibleSet = .text:0x8005D7B4; // type:function size:0x50 BoardCameraVisibleSet = .text:0x8005D7B4; // type:function size:0x50
BoardCameraOffsetSet = .text:0x8005D804; // type:function size:0x30 BoardCameraOffsetSet = .text:0x8005D804; // type:function size:0x30
BoardCameraTargetSetPlayer = .text:0x8005D834; // type:function size:0xB4 BoardCameraTargetPlayerSet = .text:0x8005D834; // type:function size:0xB4
BoardCameraTargetSetModel = .text:0x8005D8E8; // type:function size:0x40 BoardCameraTargetModelSet = .text:0x8005D8E8; // type:function size:0x40
BoardCameraSTargetetSpace = .text:0x8005D928; // type:function size:0x44 BoardCameraTargetSpaceSet = .text:0x8005D928; // type:function size:0x44
BoardCameraVecCalcFuncSet = .text:0x8005D96C; // type:function size:0x28 BoardCameraVecCalcFuncSet = .text:0x8005D96C; // type:function size:0x28
BoardCameraQuakeSet = .text:0x8005D994; // type:function size:0x3C BoardCameraQuakeSet = .text:0x8005D994; // type:function size:0x3C
BoardCameraQuakeReset = .text:0x8005D9D0; // type:function size:0x3C BoardCameraQuakeReset = .text:0x8005D9D0; // type:function size:0x3C
@ -1073,12 +1073,12 @@ BoardRandInit = .text:0x8005FAF8; // type:function size:0x24
BoardRand = .text:0x8005FB1C; // type:function size:0x24 BoardRand = .text:0x8005FB1C; // type:function size:0x24
BoardRandMod = .text:0x8005FB40; // type:function size:0x50 BoardRandMod = .text:0x8005FB40; // type:function size:0x50
BoardRandFloat = .text:0x8005FB90; // type:function size:0x58 BoardRandFloat = .text:0x8005FB90; // type:function size:0x58
BoardVecMagXZCalc = .text:0x8005FBE8; // type:function size:0x134 BoardVecDistXZCalc = .text:0x8005FBE8; // type:function size:0x134
BoardVecMagXZCheck = .text:0x8005FD1C; // type:function size:0x15C BoardVecMaxDistXZCheck = .text:0x8005FD1C; // type:function size:0x15C
BoardVecCalcDAngleVec = .text:0x8005FE78; // type:function size:0x7C BoardVecCalcDAngleVec = .text:0x8005FE78; // type:function size:0x7C
BoardVecCalcDAngle = .text:0x8005FEF4; // type:function size:0x34 BoardVecCalcDAngle = .text:0x8005FEF4; // type:function size:0x34
BoardVecCalcDAngleMod = .text:0x8005FF28; // type:function size:0x1C0 BoardVecCalcDAngleMod = .text:0x8005FF28; // type:function size:0x1C0
BoardVecMag2Check = .text:0x800600E8; // type:function size:0x6C BoardVecMinDistCheck = .text:0x800600E8; // type:function size:0x6C
BoardFilterFadeOut = .text:0x80060154; // type:function size:0xD4 BoardFilterFadeOut = .text:0x80060154; // type:function size:0xD4
BoardFilterFadeIn = .text:0x80060228; // type:function size:0x174 BoardFilterFadeIn = .text:0x80060228; // type:function size:0x174
BoardFilterFadeIsDone = .text:0x8006039C; // type:function size:0x5C BoardFilterFadeIsDone = .text:0x8006039C; // type:function size:0x5C
@ -1193,10 +1193,10 @@ UpdateDiceDigit2D = .text:0x80068B88; // type:function size:0x278 scope:local
BoardPlayerBtnDownWait = .text:0x80068E00; // type:function size:0x6C BoardPlayerBtnDownWait = .text:0x80068E00; // type:function size:0x6C
BoardPlayerAutoSizeSet = .text:0x80068E6C; // type:function size:0x9C BoardPlayerAutoSizeSet = .text:0x80068E6C; // type:function size:0x9C
BoardPlayerAutoSizeGet = .text:0x80068F08; // type:function size:0x40 BoardPlayerAutoSizeGet = .text:0x80068F08; // type:function size:0x40
fn_80068F48 = .text:0x80068F48; // type:function size:0x1C BoardPlayerMoveAwayIsDone = .text:0x80068F48; // type:function size:0x1C
fn_80068F64 = .text:0x80068F64; // type:function size:0x224 BoardPlayerMoveAwayStart = .text:0x80068F64; // type:function size:0x224
fn_80069188 = .text:0x80069188; // type:function size:0x40 BoardPlayerCurrMoveAwayStart = .text:0x80069188; // type:function size:0x40
fn_800691C8 = .text:0x800691C8; // type:function size:0x100 MoveAwayObjFunc = .text:0x800691C8; // type:function size:0x100 scope:local
BoardBowserSuitInit = .text:0x800692C8; // type:function size:0x1A4 BoardBowserSuitInit = .text:0x800692C8; // type:function size:0x1A4
BoardBowserSuitKill = .text:0x8006946C; // type:function size:0x128 BoardBowserSuitKill = .text:0x8006946C; // type:function size:0x128
BoardBowserSuitModelGet = .text:0x80069594; // type:function size:0x8 BoardBowserSuitModelGet = .text:0x80069594; // type:function size:0x8
@ -1293,7 +1293,7 @@ BoardWinInit = .text:0x8006FD7C; // type:function size:0x24
BoardWinUnusedArraySet = .text:0x8006FDA0; // type:function size:0x34 BoardWinUnusedArraySet = .text:0x8006FDA0; // type:function size:0x34
BoardWinKillAll = .text:0x8006FDD4; // type:function size:0x24 BoardWinKillAll = .text:0x8006FDD4; // type:function size:0x24
BoardWinDestroy = .text:0x8006FDF8; // type:function size:0x6C BoardWinDestroy = .text:0x8006FDF8; // type:function size:0x6C
BoardWinProc = .text:0x8006FE64; // type:function size:0x514 ExecBoardWindow = .text:0x8006FE64; // type:function size:0x514 scope:local
BoardWinChoiceGet = .text:0x80070378; // type:function size:0xC BoardWinChoiceGet = .text:0x80070378; // type:function size:0xC
BoardWinPause = .text:0x80070384; // type:function size:0xC BoardWinPause = .text:0x80070384; // type:function size:0xC
BoardWinCreateChoice = .text:0x80070390; // type:function size:0x1A0 BoardWinCreateChoice = .text:0x80070390; // type:function size:0x1A0
@ -5806,7 +5806,7 @@ saveMessWin = .sdata:0x801D3650; // type:object size:0x4 scope:local data:4byte
SR_PushTime = .sdata:0x801D3658; // type:object size:0x8 scope:local data:2byte SR_PushTime = .sdata:0x801D3658; // type:object size:0x8 scope:local data:2byte
SR_ResetPad = .sdata:0x801D3660; // type:object size:0x1 scope:local data:byte SR_ResetPad = .sdata:0x801D3660; // type:object size:0x1 scope:local data:byte
Xfb = .sdata:0x801D3664; // type:object size:0x8 scope:local data:4byte Xfb = .sdata:0x801D3664; // type:object size:0x8 scope:local data:4byte
boardNextScene = .sdata:0x801D3670; // type:object size:0x4 scope:local data:4byte nextOvl = .sdata:0x801D3670; // type:object size:0x4 scope:local data:4byte
filterColor = .sdata:0x801D3674; // type:object size:0x4 scope:local data:byte filterColor = .sdata:0x801D3674; // type:object size:0x4 scope:local data:byte
lbl_801D3678 = .sdata:0x801D3678; // type:object size:0x8 lbl_801D3678 = .sdata:0x801D3678; // type:object size:0x8
suitMdl = .sdata:0x801D3680; // type:object size:0x2 scope:local data:2byte suitMdl = .sdata:0x801D3680; // type:object size:0x2 scope:local data:2byte
@ -6305,9 +6305,9 @@ bowserSuitObj = .sbss:0x801D3F24; // type:object size:0x4 scope:local data:4byte
junctionMask = .sbss:0x801D3F28; // type:object size:0x4 scope:local data:4byte junctionMask = .sbss:0x801D3F28; // type:object size:0x4 scope:local data:4byte
junctionObj = .sbss:0x801D3F2C; // type:object size:0x4 scope:local data:4byte junctionObj = .sbss:0x801D3F2C; // type:object size:0x4 scope:local data:4byte
diceDigit2DObj = .sbss:0x801D3F30; // type:object size:0x4 scope:local data:4byte diceDigit2DObj = .sbss:0x801D3F30; // type:object size:0x4 scope:local data:4byte
lbl_801D3F34 = .sbss:0x801D3F34; // type:object size:0x4 data:4byte moveAwayObj = .sbss:0x801D3F34; // type:object size:0x4 scope:local data:4byte
junctionArrowRot = .sbss:0x801D3F38; // type:object size:0x8 scope:local junctionArrowRot = .sbss:0x801D3F38; // type:object size:0x8 scope:local
lbl_801D3F40 = .sbss:0x801D3F40; // type:object size:0x4 data:byte moveAwayPlayer = .sbss:0x801D3F40; // type:object size:0x4 scope:local data:byte
rollType = .sbss:0x801D3F44; // type:object size:0x1 scope:local data:byte rollType = .sbss:0x801D3F44; // type:object size:0x1 scope:local data:byte
playerMot = .sbss:0x801D3F46; // type:object size:0x8 scope:local playerMot = .sbss:0x801D3F46; // type:object size:0x8 scope:local
boardPlayerMdl = .sbss:0x801D3F4E; // type:object size:0x8 boardPlayerMdl = .sbss:0x801D3F4E; // type:object size:0x8
@ -7353,7 +7353,7 @@ lbl_801D5304 = .sdata2:0x801D5304; // type:object size:0x4 data:float
lbl_801D5308 = .sdata2:0x801D5308; // type:object size:0x4 data:float lbl_801D5308 = .sdata2:0x801D5308; // type:object size:0x4 data:float
lbl_801D530C = .sdata2:0x801D530C; // type:object size:0x4 data:float lbl_801D530C = .sdata2:0x801D530C; // type:object size:0x4 data:float
lbl_801D5310 = .sdata2:0x801D5310; // type:object size:0x8 data:float lbl_801D5310 = .sdata2:0x801D5310; // type:object size:0x8 data:float
lbl_801D5318 = .sdata2:0x801D5318; // type:object size:0x4 winSpeedTbl = .sdata2:0x801D5318; // type:object size:0x4 scope:local
lbl_801D531C = .sdata2:0x801D531C; // type:object size:0x4 data:float lbl_801D531C = .sdata2:0x801D531C; // type:object size:0x4 data:float
lbl_801D5320 = .sdata2:0x801D5320; // type:object size:0x4 data:float lbl_801D5320 = .sdata2:0x801D5320; // type:object size:0x4 data:float
lbl_801D5328 = .sdata2:0x801D5328; // type:object size:0x8 data:double lbl_801D5328 = .sdata2:0x801D5328; // type:object size:0x8 data:double

View file

@ -12,9 +12,9 @@ typedef void (*VoidFunc)(void);
extern const VoidFunc _ctors[]; extern const VoidFunc _ctors[];
extern const VoidFunc _dtors[]; extern const VoidFunc _dtors[];
extern void BoardCommonInit(VoidFunc init, VoidFunc destroy); extern void BoardCommonInit(VoidFunc create, VoidFunc destroy);
extern void BoardInit(void); extern void BoardCreate(void);
extern void BoardDestroy(void); extern void BoardDestroy(void);
#ifdef __cplusplus #ifdef __cplusplus

View file

@ -14,10 +14,10 @@ typedef struct player_config {
typedef struct system_state { typedef struct system_state {
/* 0x00 */ struct { /* 0x00 */ struct {
u8 story : 1; u8 party : 1;
u8 team : 1; u8 team : 1;
}; };
/* 0x01 */ s8 diff_story; /* 0x01 */ u8 diff_story;
/* 0x02 */ struct { /* 0x02 */ struct {
u16 bonus_star : 1; u16 bonus_star : 1;
u16 explain_mg : 1; u16 explain_mg : 1;
@ -26,8 +26,8 @@ typedef struct system_state {
u16 mess_speed : 2; u16 mess_speed : 2;
u16 save_mode : 2; u16 save_mode : 2;
}; };
/* 0x04 */ s8 turn; /* 0x04 */ u8 turn;
/* 0x05 */ s8 max_turn; /* 0x05 */ u8 max_turn;
/* 0x06 */ u8 star_flag; /* 0x06 */ u8 star_flag;
/* 0x07 */ u8 star_total; /* 0x07 */ u8 star_total;
/* 0x08 */ struct { /* 0x08 */ struct {
@ -37,13 +37,14 @@ typedef struct system_state {
/* 0x09 */ s8 last5_effect; /* 0x09 */ s8 last5_effect;
/* 0x0A */ s8 player_curr; /* 0x0A */ s8 player_curr;
/* 0x0B */ char unk0B[3]; /* 0x0B */ char unk0B[3];
/* 0x0E */ s16 hidden_block_pos; /* 0x0E */ s16 block_pos;
/* 0x10 */ u8 ATTRIBUTE_ALIGN(4) board_data[32]; /* 0x10 */ u8 ATTRIBUTE_ALIGN(4) board_data[32];
/* 0x30 */ u8 mess_delay; /* 0x30 */ u8 mess_delay;
/* 0x31 */ struct { /* 0x31 */ struct {
u8 field31_bit0 : 4; u8 field31_bit0 : 4;
u8 field31_bit4 : 4;
}; };
/* 0x32 */ char unk_32[0x2]; /* 0x32 */ s8 unk_32;
/* 0x34 */ u16 mg_next; /* 0x34 */ u16 mg_next;
/* 0x36 */ s16 mg_next_extra; /* 0x36 */ s16 mg_next_extra;
/* 0x38 */ s16 unk_38; /* 0x38 */ s16 unk_38;
@ -53,10 +54,11 @@ typedef struct system_state {
typedef struct player_state { typedef struct player_state {
/* 0x00 */ struct { /* 0x00 */ struct {
u8 diff : 2; u16 diff : 2;
u8 com : 1; u16 com : 1;
u8 character : 4; u16 character : 4;
u8 auto_size : 2; u16 auto_size : 2;
u16 field00_bit9 : 1;
}; };
/* 0x02 */ struct { /* 0x02 */ struct {
u8 team : 1; u8 team : 1;
@ -67,14 +69,14 @@ typedef struct player_state {
/* 0x04 */ s8 port; /* 0x04 */ s8 port;
/* 0x05 */ s8 items[3]; /* 0x05 */ s8 items[3];
/* 0x08 */ struct { /* 0x08 */ struct {
u8 color : 2; u16 color : 2;
u8 moving : 1; u16 moving : 1;
u8 field08_bit3 : 1; u16 field08_bit3 : 1;
u8 show_next : 1; u16 show_next : 1;
u8 size : 2; u16 size : 2;
u8 field08_bit7 : 2; u16 field08_bit7 : 2;
u8 rank : 2; u16 rank : 2;
u8 bowser_suit : 1; u16 bowser_suit : 1;
}; };
/* 0x0A */ s8 roll; /* 0x0A */ s8 roll;
/* 0x0C */ s16 space_curr; /* 0x0C */ s16 space_curr;

View file

@ -203,7 +203,7 @@ f32 PSVECDistance(const Vec* a, const Vec* b);
#endif #endif
// TODO // TODO
#if defined( MTX_USE_PS) && 0 #if defined( MTX_USE_PS)
#define VECAdd PSVECAdd #define VECAdd PSVECAdd
#define VECSubtract PSVECSubtract #define VECSubtract PSVECSubtract
#define VECScale PSVECScale #define VECScale PSVECScale

View file

@ -45,7 +45,7 @@ void fn_8004D6F4(s16 arg);
s32 rand8(void); s32 rand8(void);
void BoardCameraTargetSetModel(s16 model); void BoardCameraTargetModelSet(s16 model);
void BoardCameraStartMotion2(s16, Vec*, s32, f32, f32, s32); void BoardCameraStartMotion2(s16, Vec*, s32, f32, f32, s32);
void BoardCameraMotionWait(void); void BoardCameraMotionWait(void);
void BoardSpacePosGet(s32, s32, Vec*); void BoardSpacePosGet(s32, s32, Vec*);

View file

@ -6,30 +6,32 @@
#include "game/process.h" #include "game/process.h"
#include "game/gamework.h" #include "game/gamework.h"
typedef void (*BoardWinComKeyFunc)();
void BoardWinInit(void); void BoardWinInit(void);
void BoardWinUnusedArraySet(f32*); void BoardWinUnusedArraySet(f32*);
void BoardWinKillAll(void); void BoardWinKillAll(void);
void BoardWinDestroy(void); void BoardWinDestroy(void);
void BoardWinProc(void); void BoardWinProc(void);
int BoardWinChoiceGet(void); int BoardWinChoiceGet(void);
void BoardWinCreateChoice(s32, s32, s32, s32); void BoardWinCreateChoice(s32 pos, u32 mess, s32 portrait, s32 choice);
void BoardWinCreate(s32, s32, s32); void BoardWinCreate(s32 pos, u32 mess, s32 portrait);
void BoardWinInsertMesSet(s32, s32); void BoardWinInsertMesSet(u32 value, s32 index);
void BoardWinWait(void); void BoardWinWait(void);
void BoardWinKill(void); void BoardWinKill(void);
void BoardWinSetAttr(s32); void BoardWinSetAttr(s32 attr);
void BoardWinResetAttr(s32); void BoardWinResetAttr(s32 attr);
void BoardWinChoiceDisable(s32); void BoardWinChoiceDisable(s32 choice);
void BoardWinKeyWait(void); void BoardWinKeyWait(void);
int BoardWinSpeedGet(void); int BoardWinSpeedGet(void);
void BoardWinSpeedSet(s32); void BoardWinSpeedSet(s32 value);
s16 BoardWinChoiceNowGet(void); s16 BoardWinChoiceNowGet(void);
void BoardWinPriSet(s16); void BoardWinPriSet(s16 prio);
s16 BoardWinChoiceNowGet2(void); s16 BoardWinChoiceNowGet2(void);
s32 BoardWinPortraitGet(void); s32 BoardWinPortraitGet(void);
s32 BoardWinPortraitGetStar(void); s32 BoardWinPortraitGetStar(void);
void BoardWinPlayerSet(s32); void BoardWinPlayerSet(s32 player);
void BoardWinStartComKeySet(void); void BoardWinStartComKeySet(void);
void BoardWinComKeyFuncSet(void (*)); void BoardWinComKeyFuncSet(BoardWinComKeyFunc func);
#endif #endif

View file

@ -5,7 +5,7 @@
void GWInit(void); void GWInit(void);
void GWGameStatReset(void); void GWGameStatReset(void);
s16 GWMessSpeedGet(void); s32 GWMessSpeedGet(void);
void GWMGRecordSet(int index, s32 value); void GWMGRecordSet(int index, s32 value);
s32 GWMGRecordGet(int index); s32 GWMGRecordGet(int index);
void GWCharColorGet(int character, GXColor *color); void GWCharColorGet(int character, GXColor *color);

View file

@ -85,6 +85,8 @@ void omDLLNumEnd(s16 ovl, s16 arg2);
void omSysPauseEnable(BOOL flag); void omSysPauseEnable(BOOL flag);
void omSystemKeyCheckSetup(Process *objman_process);
extern omObjData *omDBGSysKeyObj; extern omObjData *omDBGSysKeyObj;
extern Process *omwatchproc; extern Process *omwatchproc;
extern OverlayID omnextovl; extern OverlayID omnextovl;

View file

@ -1,7 +1,7 @@
#include "REL/board_executor.h" #include "REL/board_executor.h"
static void InitBoard(void) { static void InitBoard(void) {
BoardCommonInit(BoardInit, BoardDestroy); BoardCommonInit(BoardCreate, BoardDestroy);
} }
int _prolog(void) { int _prolog(void) {

View file

@ -66,7 +66,7 @@ inline s32 get_current_board(void) {
return GWSystem.board; return GWSystem.board;
} }
void BoardInit(void) { void BoardCreate(void) {
f32 sp10; f32 sp10;
f32 spC[2]; f32 spC[2];
s32 sp8; s32 sp8;

View file

@ -210,7 +210,7 @@ void fn_1_13A4(void) {
BoardCameraStartMotion2(lbl_1_bss_0->unk8, &sp8, 0, 3200.0f, -1.0f, 0x1E); BoardCameraStartMotion2(lbl_1_bss_0->unk8, &sp8, 0, 3200.0f, -1.0f, 0x1E);
BoardCameraMotionWait(); BoardCameraMotionWait();
fn_1_BA0(0x2E0032); fn_1_BA0(0x2E0032);
BoardCameraTargetSetModel(fn_80083F84()); BoardCameraTargetModelSet(fn_80083F84());
BoardCameraMotionWait(); BoardCameraMotionWait();
fn_1_BA0(0x2E0033); fn_1_BA0(0x2E0033);
fn_1_BA0(0x2E0034); fn_1_BA0(0x2E0034);

628
src/game/board/main.c Normal file
View file

@ -0,0 +1,628 @@
#include "common.h"
#include "math.h"
#include "game/object.h"
#include "game/flag.h"
#include "game/data.h"
#include "game/wipe.h"
typedef void (*VoidFunc)(void);
omObjData *boardMainObj;
u32 boardRandSeed;
static omObjData *last5GfxObj;
static omObjData *confettiObj;
static omObjData *filterObj;
void *boardTurnStartFunc;
u32 lbl_801D3F00;
u32 lbl_801D3EFC;
u32 lbl_801D3EF8;
VoidFunc boardTurnFunc;
void *boardLightSetHook;
void *boardLightResetHook;
static VoidFunc destroyFunc;
static VoidFunc createFunc;
static BOOL cameraUseBackup;
static omObjData *tauntObj;
static omObjData *cameraObj;
Process *boardObjMan;
Process *boardMainProc;
static OverlayID nextOvl = OVL_INVALID;
extern void BoardPlayerCoinsSet(s32 player, s32 value);
extern void BoardPlayerAutoSizeSet(s32 player, s32 value);
extern void fn_800A4A7C(void);
extern void fn_800A6EE4(void);
extern s8 boardTutorialF;
void BoardKill(void);
static void InitBoardFunc(omObjData *object);
static void ExecBoardFunc(omObjData *object);
static void KillBoardFunc(omObjData *object);
static void MainFunc(void);
static void DestroyMainFunc(void);
static void CreateBoard(void);
static void DestroyBoard(void);
static inline s32 BoardCurrGet()
{
return GWSystem.board;
}
static inline s32 BoardPartyFlagGet()
{
s32 value = GWSystem.party;
return value;
}
static inline s16 BoardHandicapGet(s32 player)
{
return GWPlayer[player].handicap;
}
void BoardCommonInit(VoidFunc create, VoidFunc destroy)
{
omSysPauseEnable(FALSE);
if(!_CheckFlag(FLAG_ID_MAKE(1, 0))) {
_SetFlag(FLAG_ID_MAKE(1, 0));
_ClearFlag(FLAG_ID_MAKE(2, 1));
_ClearFlag(FLAG_ID_MAKE(2, 3));
_ClearFlag(FLAG_ID_MAKE(2, 0));
_ClearFlag(FLAG_ID_MAKE(2, 2));
_ClearFlag(FLAG_ID_MAKE(2, 4));
_ClearFlag(FLAG_ID_MAKE(2, 5));
_ClearFlag(FLAG_ID_MAKE(1, 6));
_ClearFlag(FLAG_ID_MAKE(1, 9));
_ClearFlag(FLAG_ID_MAKE(0, 8));
_ClearFlag(FLAG_ID_MAKE(0, 10));
fn_800A4A7C();
}
nextOvl = OVL_INVALID;
_SetFlag(FLAG_ID_MAKE(1, 28));
_SetFlag(FLAG_ID_MAKE(1, 14));
_ClearFlag(FLAG_ID_MAKE(1, 16));
_ClearFlag(FLAG_ID_MAKE(1, 17));
_ClearFlag(FLAG_ID_MAKE(1, 18));
_ClearFlag(FLAG_ID_MAKE(1, 19));
_ClearFlag(FLAG_ID_MAKE(1, 20));
_ClearFlag(FLAG_ID_MAKE(1, 21));
_ClearFlag(FLAG_ID_MAKE(1, 23));
_ClearFlag(FLAG_ID_MAKE(1, 24));
_ClearFlag(FLAG_ID_MAKE(1, 25));
_ClearFlag(FLAG_ID_MAKE(1, 27));
createFunc = create;
destroyFunc = destroy;
boardTurnFunc = NULL;
lbl_801D3EFC = 0;
lbl_801D3F00 = 0;
lbl_801D3EF8 = 0;
boardTurnStartFunc = NULL;
boardObjMan = omInitObjMan(64, 8192);
omSystemKeyCheckSetup(boardObjMan);
boardMainObj = omAddObjEx(boardObjMan, 0, 0, 0, 1, InitBoardFunc);
switch(omcurovl) {
case OVL_W01:
GWSystem.board = 0;
break;
case OVL_W02:
GWSystem.board = 1;
break;
case OVL_W03:
GWSystem.board = 2;
break;
case OVL_W04:
GWSystem.board = 3;
break;
case OVL_W05:
GWSystem.board = 4;
break;
case OVL_W06:
GWSystem.board = 5;
break;
case OVL_W10:
GWSystem.board = 6;
break;
case OVL_W20:
GWSystem.board = 7;
break;
case OVL_W21:
GWSystem.board = 8;
break;
}
}
static void InitBoardFunc(omObjData *object)
{
boardMainProc = HuPrcChildCreate(MainFunc, 8194, 0x6000, 0, boardObjMan);
HuPrcDestructorSet2(boardMainProc, DestroyMainFunc);
object->func = ExecBoardFunc;
}
static void ExecBoardFunc(omObjData *object)
{
if(!_CheckFlag(FLAG_ID_MAKE(1, 16))) {
return;
}
if(!_CheckFlag(FLAG_ID_MAKE(1, 17))) {
if(omSysExitReq) {
BoardKill();
} else {
if(BoardPauseReqCheck()) {
BoardPauseStart();
} else {
return;
}
}
} else {
if(boardMainProc) {
HuPrcKill(boardMainProc);
}
object->func = KillBoardFunc;
}
}
static void KillBoardFunc(omObjData *object)
{
if(boardMainProc) {
return;
}
if(WipeStatGet()) {
return;
return_alt:
return;
} else {
if(HuARDMACheck()) {
goto return_alt;
}
if(nextOvl != OVL_INVALID) {
omOvlCallEx(nextOvl, 1, 0, 0);
} else {
if(_CheckFlag(FLAG_ID_MAKE(1, 11))) {
BoardTutorialKill();
BoardTutorialWorkRestore();
}
_ClearFlag(FLAG_ID_MAKE(1, 0));
HuARDirFree(MAKE_DIR_NUM(DATADIR_BOARD));
if(_CheckFlag(FLAG_ID_MAKE(1, 27))) {
omOvlReturnEx(2, 1);
} else {
omOvlReturnEx(1, 1);
}
}
}
}
void BoardKill(void)
{
_SetFlag(FLAG_ID_MAKE(1, 28));
_SetFlag(FLAG_ID_MAKE(1, 14));
if(_CheckFlag(FLAG_ID_MAKE(1, 11))) {
BoardTutorialHookExec(29, 0);
}
HuAudFXAllStop();
if(!BoardIsStarted()) {
WipeCreate(WIPE_MODE_OUT, WIPE_TYPE_NORMAL, -1);
boardTutorialF = 1;
while(WipeStatGet()) {
HuPrcVSleep();
}
}
_SetFlag(FLAG_ID_MAKE(1, 17));
HuPrcKill(boardMainProc);
DestroyBoard();
}
s32 BoardIsKill(void)
{
return (_CheckFlag(FLAG_ID_MAKE(1, 17))) ? 1 : 0;
}
void BoardPauseEnableSet(s32 value)
{
if(_CheckFlag(FLAG_ID_MAKE(1, 11))) {
_SetFlag(FLAG_ID_MAKE(1, 25));
omSysPauseEnable(FALSE);
} else {
if(value) {
_SetFlag(FLAG_ID_MAKE(1, 25));
} else {
_ClearFlag(FLAG_ID_MAKE(1, 25));
}
}
}
s32 BoardPauseEnableGet()
{
return (_CheckFlag(FLAG_ID_MAKE(1, 25))) ? 1 : 0;
}
void BoardSaveInit(s32 board)
{
int i;
GWSystem.board = board;
_ClearFlag(FLAG_ID_MAKE(1, 0));
_ClearFlag(FLAG_ID_MAKE(1, 1));
_ClearFlag(FLAG_ID_MAKE(1, 5));
_ClearFlag(FLAG_ID_MAKE(1, 4));
_ClearFlag(FLAG_ID_MAKE(1, 6));
_ClearFlag(FLAG_ID_MAKE(1, 2));
_ClearFlag(FLAG_ID_MAKE(1, 9));
_ClearFlag(FLAG_ID_MAKE(1, 7));
_ClearFlag(FLAG_ID_MAKE(1, 8));
_ClearFlag(FLAG_ID_MAKE(0, 8));
_ClearFlag(FLAG_ID_MAKE(1, 12));
_ClearFlag(FLAG_ID_MAKE(1, 3));
GWSystem.turn = 1;
GWSystem.star_flag = 0;
GWSystem.star_pos = 0;
GWSystem.star_total = 1;
GWSystem.last5_effect = 0;
GWSystem.player_curr = -1;
GWSystem.field31_bit0 = 0;
GWSystem.field31_bit4 = 0;
GWSystem.unk_32 = 1;
GWSystem.mg_next = 0;
GWSystem.mg_next_extra = 0;
GWSystem.unk_38 = 0;
GWSystem.block_pos = 0;
memset(GWSystem.board_data, 0, 32);
for(i=0; i<4; i++) {
BoardPlayerAutoSizeSet(i, 0);
GWPlayer[i].field00_bit9 = 0;
GWPlayer[i].color = 0;
GWPlayer[i].bowser_suit = 0;
GWPlayer[i].field08_bit3 = 0;
GWPlayer[i].space_shock = 0;
GWPlayer[i].field02_bit1 = 0;
GWPlayer[i].show_next = 1;
BoardPlayerCoinsSet(i, 0);
if(_CheckFlag(FLAG_ID_MAKE(1, 11))) {
GWSystem.team = 0;
}
GWPlayer[i].blue_count = 0;
GWPlayer[i].red_count = 0;
GWPlayer[i].question_count = 0;
GWPlayer[i].fortune_count = 0;
GWPlayer[i].bowser_count = 0;
GWPlayer[i].battle_count = 0;
GWPlayer[i].mushroom_count = 0;
GWPlayer[i].warp_count = 0;
GWPlayer[i].coins_mg = 0;
GWPlayer[i].coins_total = 0;
GWPlayer[i].coins_max = 0;
GWPlayer[i].stars_max = 0;
GWPlayer[i].coins_battle = 0;
GWPlayer[i].unk_26 = 0;
GWPlayer[i].coins_mg_gain = 0;
GWPlayer[i].items[0] = -1;
GWPlayer[i].items[1] = -1;
GWPlayer[i].items[2] = -1;
if(!BoardPartyFlagGet() || _CheckFlag(FLAG_ID_MAKE(1, 11))) {
GWStarsSet(i, 0);
} else {
GWStarsSet(i, BoardHandicapGet(i));
}
}
}
void BoardStoryConfigSet(s32 mg_type, s32 diff_story)
{
GWSystem.party = 0;
GWSystem.team = 0;
GWSystem.diff_story = diff_story;
GWSystem.bonus_star = 0;
GWSystem.mg_type = mg_type;
GWPlayer[0].handicap = 0;
GWPlayer[1].handicap = 0;
GWPlayer[2].handicap = 0;
GWPlayer[3].handicap = 0;
GWSystem.max_turn = 15;
memset(GWPlayer, 0, 4*sizeof(PlayerState));
_ClearFlag(FLAG_ID_MAKE(0, 2));
_ClearFlag(FLAG_ID_MAKE(0, 3));
_ClearFlag(FLAG_ID_MAKE(0, 4));
_ClearFlag(FLAG_ID_MAKE(0, 5));
_ClearFlag(FLAG_ID_MAKE(0, 6));
_ClearFlag(FLAG_ID_MAKE(0, 7));
_ClearFlag(FLAG_ID_MAKE(1, 11));
_SetFlag(FLAG_ID_MAKE(0, 11));
_SetFlag(FLAG_ID_MAKE(1, 10));
}
void BoardPartyConfigSet(s32 team, s32 bonus_star, s32 mg_type, s32 max_turn, s32 p1_handicap, s32 p2_handicap, s32 p3_handicap, s32 p4_handicap)
{
GWSystem.party = 1;
GWSystem.team = team;
GWSystem.diff_story = 0;
GWSystem.bonus_star = bonus_star;
GWSystem.mg_type = mg_type;
GWSystem.max_turn = max_turn;
memset(GWPlayer, 0, 4*sizeof(PlayerState));
GWPlayer[0].handicap = p1_handicap;
GWPlayer[1].handicap = p2_handicap;
GWPlayer[2].handicap = p3_handicap;
GWPlayer[3].handicap = p4_handicap;
_ClearFlag(FLAG_ID_MAKE(1, 11));
_SetFlag(FLAG_ID_MAKE(0, 11));
_SetFlag(FLAG_ID_MAKE(1, 10));
}
static void DestroyMainFunc(void)
{
boardMainProc = NULL;
}
static void MainFunc(void)
{
s32 i;
s32 fade_enable, turn_cont, fade_type;
fade_enable = 0;
turn_cont = 0;
BoardPauseEnableSet(1);
if(_CheckFlag(FLAG_ID_MAKE(0, 10))) {
_ClearFlag(FLAG_ID_MAKE(0, 10));
_SetFlag(FLAG_ID_MAKE(1, 16));
BoardKill();
HuPrcSleep(-1);
}
_ClearFlag(FLAG_ID_MAKE(0, 10));
BoardTutorialInit();
if(_CheckFlag(FLAG_ID_MAKE(1, 11))) {
BoardTutorialWorkSave();
BoardTutorialPlayerInit();
GWSystem.mess_speed = 1;
GWSystem.mess_delay = 32;
}
CreateBoard();
if(!_CheckFlag(FLAG_ID_MAKE(1, 1))) {
GWSystem.player_curr = -1;
fn_800A6EE4();
GWSystem.player_curr = 0;
fade_enable = 1;
_SetFlag(FLAG_ID_MAKE(1, 1));
} else {
fade_enable = 0;
}
if(BoardIsTurnCont()) {
turn_cont = 1;
}
if((int)(GWSystem.max_turn-GWSystem.turn) < 5 && GWSystem.player_curr == 0 && !turn_cont) {
if(!_CheckFlag(FLAG_ID_MAKE(0, 8))) {
fn_800A9708();
_SetFlag(FLAG_ID_MAKE(0, 8));
} else {
BoardLast5GfxInit();
}
}
if(!turn_cont) {
fade_type = 1;
} else {
fade_type = 0;
}
_ClearFlag(FLAG_ID_MAKE(1, 28));
do {
BoardStatusShowSetAll(1);
if(BoardCurrGet() == 5 && GWSystem.player_curr == 0 && !turn_cont && boardTurnFunc) {
GWSystem.player_curr = -1;
boardTurnFunc();
GWSystem.player_curr = 0;
}
fn_80070D84();
for(i=GWSystem.player_curr; i<4; i++) {
if(BoardCurrGet() == 7 || BoardCurrGet() == 8) {
if((int)(GWSystem.max_turn-GWSystem.turn) < 5 && i == 0 && !turn_cont) {
BoardLast5GfxInit();
_SetFlag(FLAG_ID_MAKE(0, 8));
}
}
if(_CheckFlag(FLAG_ID_MAKE(1, 6))) {
BoardPlayerTurnExec(i);
} else {
if(!turn_cont) {
BoardCameraVisibleSet(0);
GWSystem.player_curr = i;
BoardCameraTargetModelSet(i);
BoardCameraMotionWait();
{
Vec pos;
BoardSpacePosGet(0, GWPlayer[i].space_curr, &pos);
BoardPlayerPosSetV(i, &pos);
}
while(WipeStatGet()) {
HuPrcVSleep();
}
if(!fade_enable) {
if(!fade_type) {
WipeCreate(WIPE_MODE_IN, WIPE_TYPE_CROSS, 30);
while(WipeStatGet()) {
HuPrcVSleep();
}
} else {
fade_type = 0;
WipeCreate(WIPE_MODE_IN, WIPE_TYPE_NORMAL, 21);
while(WipeStatGet()) {
HuPrcVSleep();
}
}
} else {
fade_enable = 0;
}
BoardPlayerTurnExec(i);
}
}
turn_cont = 0;
if(_CheckFlag(FLAG_ID_MAKE(1, 11))) {
BoardTutorialHookExec(9, 0);
}
if(i != 3 || _CheckFlag(FLAG_ID_MAKE(1, 11))) {
WipeColorSet(255, 255, 255);
WipeCreate(WIPE_MODE_OUT, WIPE_TYPE_CROSS, 1);
while(WipeStatGet()) {
HuPrcVSleep();
}
BoardPlayerCurrMoveAwayStart(GWPlayer[i].space_curr, 1);
fade_type = 0;
} else {
if(BoardCurrGet() == 7 || BoardCurrGet() == 8) {
if(GWSystem.turn != GWSystem.max_turn) {
WipeColorSet(255, 255, 255);
WipeCreate(WIPE_MODE_OUT, WIPE_TYPE_CROSS, 1);
while(WipeStatGet()) {
HuPrcVSleep();
}
BoardPlayerCurrMoveAwayStart(GWPlayer[i].space_curr, 1);
fade_type = 0;
}
} else {
WipeColorSet(0, 0, 0);
WipeCreate(WIPE_MODE_OUT, WIPE_TYPE_NORMAL, 21);
while(WipeStatGet()) {
HuPrcVSleep();
}
}
}
BoardPlayerPostTurnHookExec(i);
}
if(BoardCurrGet() == 7 || BoardCurrGet() == 8) {
GWSystem.player_curr = 0;
if(BoardTurnNext()) {
fn_80070EE8(0, 500);
BoardKill();
HuPrcEnd();
HuPrcSleep(-1);
}
} else {
_SetFlag(FLAG_ID_MAKE(1, 28));
_SetFlag(FLAG_ID_MAKE(1, 14));
BoardPauseEnableSet(1);
_CheckFlag(FLAG_ID_MAKE(1, 9));
if(_CheckFlag(FLAG_ID_MAKE(2, 0)) || _CheckFlag(FLAG_ID_MAKE(1, 11)) ) {
for(i=0; i<4; i++) {
GWPlayer[i].color = 0;
}
GWSystem.player_curr = (GWSystem.player_curr+1)&3;
} else {
fn_800A1A34();
HuPrcSleep(-1);
}
}
} while(1);
}
BOOL BoardTurnNext(void)
{
s32 i;
for(i=0; i<4; i++) {
GWPlayer[i].color = 0;
}
GWSystem.turn++;
if(GWSystem.turn > GWSystem.max_turn) {
return 1;
} else {
return 0;
}
}
void BoardNextOvlSet(OverlayID overlay)
{
nextOvl = overlay;
fn_80070EE8(0, 1000);
BoardKill();
}
BOOL BoardIsStarted(void)
{
if(_CheckFlag(FLAG_ID_MAKE(1, 2)) || _CheckFlag(FLAG_ID_MAKE(1, 3)) || _CheckFlag(FLAG_ID_MAKE(1, 4)) || _CheckFlag(FLAG_ID_MAKE(1, 5)) || _CheckFlag(FLAG_ID_MAKE(1, 6))) {
return 1;
} else {
return 0;
}
}
static void CreateBoard(void)
{
}
static void DestroyBoard(void)
{
}
u32 BoardRand(void)
{
boardRandSeed = (boardRandSeed*0x19660D)+(0x3C6EF35F);
return boardRandSeed;
}
u32 BoardRandMod(u32 value)
{
return (BoardRand() & 0x7FFFFFFF)%value;
}
float BoardRandFloat(void)
{
float value;
*((u32 *)&value) = (BoardRand() & 0x7FFFFF)|0x3F800000;
return value-1.0f;
}
float BoardVecDistXZCalc(Vec *vec1, Vec *vec2)
{
float x = vec1->x-vec2->x;
float z = vec1->z-vec2->z;
return sqrtf((x*x)+(z*z));
}
s32 BoardVecMaxDistXZCheck(Vec *vec1, Vec *vec2, float max_dist)
{
float z = vec1->z-vec2->z;
float x = vec1->x-vec2->x;
float dist = sqrtf((x*x)+(z*z));
if(dist <= max_dist) {
return 1;
} else {
return 0;
}
}
s32 BoardVecMinDistCheck(Vec *vec1, Vec *vec2, float min_dist)
{
Vec temp;
Mtx temp_mtx;
VECSubtract(vec1, vec2, &temp);
if(VECSquareMag(&temp) >= (min_dist*min_dist)) {
return 0;
} else {
return 1;
}
}
s32 BoardDataDirReadAsync(s32 data_num)
{
s32 status = HuDataDirReadAsync(data_num);
return status;
}
void BoardDataAsyncWait(s32 status)
{
if(status == -1) {
return;
}
while(!HuDataGetAsyncStat(status)) {
HuPrcVSleep();
}
}

View file

@ -16,7 +16,7 @@ static s16 defaultChoice;
static s32 winMess; static s32 winMess;
static s32 winAttr; static s32 winAttr;
f32 lbl_801D3F70[2]; f32 lbl_801D3F70[2];
static void (*comKeyFunc)(); static BoardWinComKeyFunc comKeyFunc;
static Process* winProc; static Process* winProc;
static s32 choiceDisableTbl[0x10]; static s32 choiceDisableTbl[0x10];
static u32 winInsertMesTbl[8]; static u32 winInsertMesTbl[8];
@ -33,7 +33,7 @@ static s32 StarPortraitTbl[] = {
}; };
static s16 windowID = -1; static s16 windowID = -1;
const s8 lbl_801D5318[4] = {0, 1, 4, 0}; static const s8 winSpeedTbl[4] = {0, 1, 4, 0};
void BoardWinInit(void) { void BoardWinInit(void) {
HuWinInit(1); HuWinInit(1);
@ -67,13 +67,13 @@ void BoardWinDestroy(void) {
winProc = 0; winProc = 0;
} }
void BoardWinProc(void) { static void ExecBoardWindow(void) {
f32 sp10[2]; f32 size[2];
f32 sp8[2]; f32 pos[2];
s32 var_r31; s32 i;
f32* temp_r29; f32 *pos_win;
f32* temp_r30; f32 *size_win;
WindowData *var_r28 = NULL; WindowData *win_curr = NULL;
f32 var_50[7][2] = { f32 var_50[7][2] = {
{384.0f, 64.0f}, {432.0f, 192.0f}, {384.0f, 64.0f}, {432.0f, 192.0f},
@ -89,26 +89,26 @@ void BoardWinProc(void) {
}; };
if (windowID < 0) { if (windowID < 0) {
temp_r30 = var_50[winPosIdx]; size_win = var_50[winPosIdx];
temp_r29 = var_18[winPosIdx]; pos_win = var_18[winPosIdx];
HuWinMesMaxSizeGet(1, sp10, winMess); HuWinMesMaxSizeGet(1, size, winMess);
if (sp10[0] <= temp_r30[0]) { if (size[0] <= size_win[0]) {
sp10[0] = temp_r30[0]; size[0] = size_win[0];
sp8[0] = temp_r29[0]; pos[0] = pos_win[0];
} else { } else {
sp8[0] = -10000.0f; pos[0] = -10000.0f;
} }
if (sp10[1] <= temp_r30[1]) { if (size[1] <= size_win[1]) {
sp10[1] = temp_r30[1]; size[1] = size_win[1];
} }
sp8[1] = temp_r29[1]; pos[1] = pos_win[1];
if ((winPosIdx == 5) || (winPosIdx == 6)) { if ((winPosIdx == 5) || (winPosIdx == 6)) {
windowID = HuWinExCreateStyled(sp8[0], sp8[1], sp10[0], sp10[1], -1, 1); windowID = HuWinExCreateStyled(pos[0], pos[1], size[0], size[1], -1, 1);
HuWinMesPalSet(windowID, 7, 0, 0, 0); HuWinMesPalSet(windowID, 7, 0, 0, 0);
} else if (winPortrait == -1) { } else if (winPortrait == -1) {
windowID = HuWinExCreate(sp8[0], sp8[1], sp10[0], sp10[1], -1); windowID = HuWinExCreate(pos[0], pos[1], size[0], size[1], -1);
} else { } else {
windowID = HuWinExCreate(sp8[0], sp8[1], sp10[0], sp10[1], winPortrait); windowID = HuWinExCreate(pos[0], pos[1], size[0], size[1], winPortrait);
} }
if (windowID == -1) { if (windowID == -1) {
HuPrcEnd(); HuPrcEnd();
@ -131,26 +131,26 @@ void BoardWinProc(void) {
HuWinMesSpeedSet(windowID, messSpeed); HuWinMesSpeedSet(windowID, messSpeed);
HuWinMesSet(windowID, winMess); HuWinMesSet(windowID, winMess);
for (var_r31 = 0; var_r31 < 8; var_r31++) { for (i = 0; i < 8; i++) {
if (winInsertMesTbl[var_r31] != -1) { if (winInsertMesTbl[i] != -1) {
HuWinInsertMesSet(windowID, winInsertMesTbl[var_r31], var_r31); HuWinInsertMesSet(windowID, winInsertMesTbl[i], i);
} }
} }
HuWinAttrSet(windowID, winAttr); HuWinAttrSet(windowID, winAttr);
for (var_r31 = 0; var_r31 < 0x10; var_r31++) { for (i = 0; i < 16; i++) {
if (choiceDisableTbl[var_r31] != 0) { if (choiceDisableTbl[i] != 0) {
HuWinChoiceDisable(windowID, var_r31); HuWinChoiceDisable(windowID, i);
} }
} }
if (autoPickF != 0) { if (autoPickF != 0) {
BoardWinStartComKeySet(); BoardWinStartComKeySet();
if (comKeyFunc != 0) { if (comKeyFunc) {
comKeyFunc(); comKeyFunc();
} }
} else if ((_CheckFlag(0x1000B) != 0) && ((winPosIdx == 5) || (winPosIdx == 6))) { } else if ((_CheckFlag(0x1000B) != 0) && ((winPosIdx == 5) || (winPosIdx == 6))) {
var_r28 = &winData[windowID]; win_curr = &winData[windowID];
var_r28->active_pad = 0xF; win_curr->active_pad = 0xF;
HuWinComKeyWait(-1, -1, -1, -1, 0); HuWinComKeyWait(-1, -1, -1, -1, 0);
} else { } else {
BoardWinStartComKeySet(); BoardWinStartComKeySet();
@ -180,16 +180,15 @@ void BoardWinPause(void) {
winPause = 1; winPause = 1;
} }
void BoardWinCreateChoice(s32 arg0, s32 arg1, s32 arg2, s32 arg3) { void BoardWinCreateChoice(s32 pos, u32 mess, s32 portrait, s32 choice) {
s32 var_r31; s32 i;
SystemState* temp_r3; s32 speed;
s32 var_r30;
winPosIdx = arg0; winPosIdx = pos;
winChoice = 0; winChoice = 0;
defaultChoice = arg3; defaultChoice = choice;
winPortrait = arg2; winPortrait = portrait;
winAttr = 0; winAttr = 0;
autoPickF = 1; autoPickF = 1;
winWait = 0; winWait = 0;
@ -199,35 +198,34 @@ void BoardWinCreateChoice(s32 arg0, s32 arg1, s32 arg2, s32 arg3) {
winPause = 0; winPause = 0;
HuWinComKeyReset(); HuWinComKeyReset();
for (var_r31 = 0; var_r31 < 0x10; var_r31++) { for (i = 0; i < 16; i++) {
choiceDisableTbl[var_r31] = 0; choiceDisableTbl[i] = 0;
} }
for (var_r31 = 0; var_r31 < 8; var_r31++) { for (i = 0; i < 8; i++) {
winInsertMesTbl[var_r31] = -1; winInsertMesTbl[i] = -1;
} }
if (winProc == 0) { if (winProc == 0) {
winProc = HuPrcChildCreate(&BoardWinProc, 0x2009, 0x4000, 0, boardMainProc); winProc = HuPrcChildCreate(&ExecBoardWindow, 0x2009, 0x4000, 0, boardMainProc);
HuPrcDestructorSet2(winProc, &BoardWinDestroy); HuPrcDestructorSet2(winProc, &BoardWinDestroy);
} }
winMess = arg1; winMess = mess;
if (GWSystem.mess_speed == 3) { if (GWSystem.mess_speed == 3) {
GWSystem.mess_speed = 1; GWSystem.mess_speed = 1;
} }
var_r30 = GWSystem.mess_speed; speed = GWSystem.mess_speed;
BoardWinSpeedSet(var_r30); BoardWinSpeedSet(speed);
BoardWinPlayerSet(GWSystem.player_curr); BoardWinPlayerSet(GWSystem.player_curr);
} }
void BoardWinCreate(s32 arg0, s32 arg1, s32 arg2) { void BoardWinCreate(s32 pos, u32 mess, s32 portrait) {
s32 var_r30; s32 speed;
s32 var_r31; s32 i;
void* temp_r3;
winPosIdx = arg0; winPosIdx = pos;
winChoice = 0; winChoice = 0;
defaultChoice = -1; defaultChoice = -1;
winPortrait = arg2; winPortrait = portrait;
winAttr = 0; winAttr = 0;
autoPickF = 1; autoPickF = 1;
winWait = 0; winWait = 0;
@ -237,28 +235,28 @@ void BoardWinCreate(s32 arg0, s32 arg1, s32 arg2) {
winPause = 0; winPause = 0;
HuWinComKeyReset(); HuWinComKeyReset();
for (var_r31 = 0; var_r31 < 0x10; var_r31++) { for (i = 0; i < 0x10; i++) {
choiceDisableTbl[var_r31] = 0; choiceDisableTbl[i] = 0;
} }
for (var_r31 = 0; var_r31 < 8; var_r31++) { for (i = 0; i < 8; i++) {
winInsertMesTbl[var_r31] = -1; winInsertMesTbl[i] = -1;
} }
if (winProc == 0) { if (winProc == 0) {
winProc = HuPrcChildCreate(&BoardWinProc, 0x2009U, 0x4000U, 0, boardMainProc); winProc = HuPrcChildCreate(&ExecBoardWindow, 0x2009U, 0x4000U, 0, boardMainProc);
HuPrcDestructorSet2(winProc, &BoardWinDestroy); HuPrcDestructorSet2(winProc, &BoardWinDestroy);
} }
winMess = arg1; winMess = mess;
if (GWSystem.mess_speed == 3) { if (GWSystem.mess_speed == 3) {
GWSystem.mess_speed = 1; GWSystem.mess_speed = 1;
} }
var_r30 = GWSystem.mess_speed; speed = GWSystem.mess_speed;
BoardWinSpeedSet(var_r30); BoardWinSpeedSet(speed);
BoardWinPlayerSet(GWSystem.player_curr); BoardWinPlayerSet(GWSystem.player_curr);
autoPickF = 0; autoPickF = 0;
} }
void BoardWinInsertMesSet(s32 value, s32 index) { void BoardWinInsertMesSet(u32 value, s32 index) {
winInsertMesTbl[index] = value; winInsertMesTbl[index] = value;
} }
@ -283,22 +281,22 @@ void BoardWinKill(void) {
} }
} }
void BoardWinSetAttr(s32 arg0) { void BoardWinSetAttr(s32 attr) {
winAttr |= arg0; winAttr |= attr;
if (windowID >= 0) { if (windowID >= 0) {
HuWinAttrSet(windowID, winAttr); HuWinAttrSet(windowID, winAttr);
} }
} }
void BoardWinResetAttr(s32 arg0) { void BoardWinResetAttr(s32 attr) {
winAttr &= ~arg0; winAttr &= ~attr;
if (windowID >= 0) { if (windowID >= 0) {
HuWinAttrSet(windowID, winAttr); HuWinAttrSet(windowID, winAttr);
} }
} }
void BoardWinChoiceDisable(s32 index) { void BoardWinChoiceDisable(s32 choice) {
choiceDisableTbl[index] = 1; choiceDisableTbl[choice] = 1;
} }
void BoardWinKeyWait(void) { void BoardWinKeyWait(void) {
@ -306,17 +304,17 @@ void BoardWinKeyWait(void) {
} }
int BoardWinSpeedGet(void) { int BoardWinSpeedGet(void) {
s32 temp_r31; s32 speed;
if (GWSystem.mess_speed == 3) { if (GWSystem.mess_speed == 3) {
GWSystem.mess_speed = 1; GWSystem.mess_speed = 1;
} }
temp_r31 = GWSystem.mess_speed; speed = GWSystem.mess_speed;
return lbl_801D5318[temp_r31]; return winSpeedTbl[speed];
} }
void BoardWinSpeedSet(s32 arg0) { void BoardWinSpeedSet(s32 value) {
messSpeed = lbl_801D5318[arg0]; messSpeed = winSpeedTbl[value];
if (windowID != -1) { if (windowID != -1) {
HuWinMesSpeedSet(windowID, messSpeed); HuWinMesSpeedSet(windowID, messSpeed);
} }
@ -329,10 +327,10 @@ s16 BoardWinChoiceNowGet(void) {
return HuWinChoiceNowGet(windowID); return HuWinChoiceNowGet(windowID);
} }
void BoardWinPriSet(s16 arg0) { void BoardWinPriSet(s16 prio) {
winPrio = arg0; winPrio = prio;
if (windowID != -1) { if (windowID != -1) {
HuWinPriSet(windowID, arg0); HuWinPriSet(windowID, prio);
} }
} }
@ -353,13 +351,13 @@ s32 BoardWinPortraitGetStar(void) {
return StarPortraitTbl[temp]; return StarPortraitTbl[temp];
} }
void BoardWinPlayerSet(s32 arg0) { void BoardWinPlayerSet(s32 player) {
s32 temp_r0; s32 temp;
s32 i; s32 i;
if (arg0 == -1) { if (player == -1) {
temp_r0 = GWSystem.story; temp = GWSystem.party;
if (temp_r0 != 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;
@ -368,10 +366,10 @@ void BoardWinPlayerSet(s32 arg0) {
} else { } else {
disablePlayer = 0; disablePlayer = 0;
} }
} else if (GWPlayer[arg0].com != 0) { } else if (GWPlayer[player].com != 0) {
disablePlayer = 0xF; disablePlayer = 0xF;
} else { } else {
disablePlayer = ~(1 << GWPlayer[arg0].port); disablePlayer = ~(1 << GWPlayer[player].port);
} }
if (_CheckFlag(0x1000BU) != 0) { if (_CheckFlag(0x1000BU) != 0) {
disablePlayer = 0; disablePlayer = 0;
@ -382,14 +380,13 @@ void BoardWinPlayerSet(s32 arg0) {
} }
void BoardWinStartComKeySet(void) { void BoardWinStartComKeySet(void) {
s32 sp8[4]; s32 comkey[4];
s16 temp_r28; s32 speed;
s32 temp_r30; s32 waitnum;
s32 var_r31; s32 i;
s32 temp_r29;
if (BoardPlayerIsAllCom() != 0) { if (BoardPlayerIsAllCom() != 0) {
sp8[0] = sp8[1] = sp8[2] = sp8[3] = 0x100; comkey[0] = comkey[1] = comkey[2] = comkey[3] = 0x100;
} else { } else {
if (GWSystem.player_curr == -1) { if (GWSystem.player_curr == -1) {
if ((GWPlayer[0].com == 0) || (GWPlayer[1].com == 0) || (GWPlayer[2].com == 0) || (GWPlayer[3].com == 0)) { if ((GWPlayer[0].com == 0) || (GWPlayer[1].com == 0) || (GWPlayer[2].com == 0) || (GWPlayer[3].com == 0)) {
@ -399,30 +396,30 @@ void BoardWinStartComKeySet(void) {
return; return;
} }
if (GWSystem.player_curr != -1) { if (GWSystem.player_curr != -1) {
for (var_r31 = 0; var_r31 < 4; var_r31++) { for (i = 0; i < 4; i++) {
temp_r29 = GWPlayer[var_r31].port; s32 port = GWPlayer[i].port;
if (GWSystem.player_curr == var_r31) { if (GWSystem.player_curr == i) {
sp8[temp_r29] = 0x100; comkey[port] = 0x100;
} else { } else {
sp8[temp_r29] = 0; comkey[port] = 0;
} }
} }
} else { } else {
for (var_r31 = 0; var_r31 < 4; var_r31++) { for (i = 0; i < 4; i++) {
sp8[var_r31] = 0x100; comkey[i] = 0x100;
} }
} }
} }
temp_r28 = GWMessSpeedGet(); speed = GWMessSpeedGet();
temp_r30 = HuWinKeyWaitNumGet(winMess); waitnum = HuWinKeyWaitNumGet(winMess);
if (temp_r30 != 0) { if (waitnum != 0) {
HuWinComKeyReset(); HuWinComKeyReset();
for (var_r31 = 0; var_r31 < temp_r30; var_r31++) { for (i = 0; i < waitnum; i++) {
HuWinComKeyWait(sp8[0], sp8[1], sp8[2], sp8[3], (s32)temp_r28); HuWinComKeyWait(comkey[0], comkey[1], comkey[2], comkey[3], speed);
} }
} }
} }
void BoardWinComKeyFuncSet(void (*func)) { void BoardWinComKeyFuncSet(BoardWinComKeyFunc func) {
comKeyFunc = func; comKeyFunc = func;
} }

View file

@ -134,7 +134,7 @@ void GWGameStatReset(void)
ResetBoardSettings(); ResetBoardSettings();
} }
s16 GWMessSpeedGet(void) s32 GWMessSpeedGet(void)
{ {
if(GWSystem.mess_delay > 48) { if(GWSystem.mess_delay > 48) {
GWSystem.mess_speed = 1; GWSystem.mess_speed = 1;