diff --git a/config/GALE01/splits.txt b/config/GALE01/splits.txt index 018f6d769f..3737adc824 100644 --- a/config/GALE01/splits.txt +++ b/config/GALE01/splits.txt @@ -2193,14 +2193,35 @@ melee/gm/gmregcommon.c: .data start:0x803D79F0 end:0x803D7A50 .sdata start:0x804D4050 end:0x804D4058 +melee/gm/gm_17C0.c: + .text start:0x8017C0C8 end:0x8017C984 + .data start:0x803D7A50 end:0x803D8B88 + .bss start:0x804706C0 end:0x804706D8 + .sdata2 start:0x804DA428 end:0x804DA43C + +melee/gm/gm_17C9.c: + .text start:0x8017C984 end:0x8017E424 + .bss start:0x804706D8 end:0x80472C30 + .sdata2 start:0x804DA43C end:0x804DA444 + +melee/gm/gm_17E4.c: + .text start:0x8017E424 end:0x8017EB30 + .bss start:0x80472C30 end:0x80472CB0 + .sdata2 start:0x804DA448 end:0x804DA458 + +melee/gm/gm_17EB.c: + .text start:0x8017EB30 end:0x8017F008 + .bss start:0x80472CB0 end:0x80472D28 + .sdata2 start:0x804DA458 end:0x804DA468 + melee/gm/gmregclear.c: - .text start:0x8017C0C8 end:0x8018325C + .text start:0x8017F008 end:0x8018325C .rodata start:0x803B7C08 end:0x803B7C28 - .data start:0x803D7A50 end:0x803D9248 - .bss start:0x804706C0 end:0x804735A8 + .data start:0x803D8B88 end:0x803D9248 + .bss start:0x80472D28 end:0x804735A8 .sdata start:0x804D4058 end:0x804D4090 .sbss start:0x804D65B8 end:0x804D65F0 - .sdata2 start:0x804DA428 end:0x804DA538 + .sdata2 start:0x804DA468 end:0x804DA538 melee/gm/gm_1832.c: .text start:0x8018325C end:0x8018A514 diff --git a/configure.py b/configure.py index f3d3d21644..c0d2dc2304 100755 --- a/configure.py +++ b/configure.py @@ -1035,6 +1035,10 @@ def MatchingFor(*versions): Object(Matching, "melee/gm/gm_17AD.c"), Object(Matching, "melee/gm/gm_17BA.c"), Object(Matching, "melee/gm/gmregcommon.c"), + Object(NonMatching, "melee/gm/gm_17C0.c"), + Object(NonMatching, "melee/gm/gm_17C9.c"), + Object(NonMatching, "melee/gm/gm_17E4.c"), + Object(NonMatching, "melee/gm/gm_17EB.c"), Object(NonMatching, "melee/gm/gmregclear.c"), Object(NonMatching, "melee/gm/gm_1832.c"), Object(NonMatching, "melee/gm/gmtoulib.c"), diff --git a/src/melee/gm/forward.h b/src/melee/gm/forward.h index 89a52feabc..e1803b1e64 100644 --- a/src/melee/gm/forward.h +++ b/src/melee/gm/forward.h @@ -131,6 +131,10 @@ typedef enum MatchOutcome { struct gm_801677C0_s; struct lbl_8046B488_t; +typedef struct AdventureStageEntry AdventureStageEntry; +typedef struct AdventureStageTable AdventureStageTable; +typedef struct AllstarStageEntry AllstarStageEntry; +typedef struct AllstarStageTable AllstarStageTable; typedef struct CameraVsData CameraVsData; typedef struct datetime datetime; typedef struct DebugGameOverData DebugGameOverData; diff --git a/src/melee/gm/gm_1736.c b/src/melee/gm/gm_1736.c index aa3fc7026f..0f0baeba26 100644 --- a/src/melee/gm/gm_1736.c +++ b/src/melee/gm/gm_1736.c @@ -1,9 +1,11 @@ #include "gm_1601.h" #include "gm_16F1.h" +#include "gm_17C9.h" +#include "gm_17E4.h" +#include "gm_17EB.h" #include "gm_1A3F.h" #include "gm_1BA8.h" #include "gmmain_lib.h" -#include "gmregclear.h" #include "types.h" #include "ft/forward.h" diff --git a/src/melee/gm/gm_17C0.c b/src/melee/gm/gm_17C0.c new file mode 100644 index 0000000000..27e74805d0 --- /dev/null +++ b/src/melee/gm/gm_17C0.c @@ -0,0 +1,1156 @@ +#include "gm_17C0.h" + +#include "gm_17C9.h" +#include "gm_17E4.h" +#include "gm_17EB.h" +#include "platform.h" + +#include "baselib/forward.h" + +#include "dolphin/pad.h" + +#include "gm/forward.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static struct lbl_804706C0_t { + int x0; + int x4; + int x8; + int xC; // HP (stamina) + int x10; + int x14; +} lbl_804706C0; + +void fn_8017C0C8(void) +{ + PlayerInitData sp8; + gm_8016795C(&sp8); + sp8.slot_type = Gm_PKind_Cpu; + sp8.stocks = 1; + sp8.xE = 4; + sp8.cpu_level = Player_GetCpuLevel(2); + sp8.xE = Player_GetCpuType(2); + sp8.x18 = Player_GetAttackRatio(2); + sp8.x1C = Player_GetUnk50(2); + sp8.color = 0; + sp8.c_kind = CKIND_CREZYH; + sp8.team = 4; + sp8.xC_b7 = true; + sp8.hp = lbl_804706C0.xC; + sp8.xD_b2 = true; + sp8.xD_b0 = true; + sp8.xD_b2 = true; + sp8.spawn_dir = 1; + gm_8016EDDC(1, &sp8); +} + +// Volatile reads keep MWCC from duplicating these shared constants. +const f32 lbl_804DA428 = 0.5F; +const f32 lbl_804DA42C = 1.0F; + +void fn_8017C1A4(HSD_GObj* unused) +{ + struct lbl_804706C0_t* tmp = &lbl_804706C0; + int temp_r29; + int temp_r29_2; + int temp_r28; + int temp_r27; + int temp_r27_2; + int temp_r31; + int temp_r3; + int temp_r3_3; + lbl_8046B6A0_t* temp_r3_2; + lbl_8046B6A0_t* temp_r3_4; + PAD_STACK(8); + + temp_r31 = ftBossLib_8015C74C(); + temp_r29 = ftBossLib_8015C7EC(); + temp_r27 = ftBossLib_8015C88C(); + temp_r3 = ftBossLib_8015C9CC(); + switch (tmp->x0) { + case 0: + if (tmp->x8 == 0) { + temp_r3_2 = gm_16AE_GetUnkData_0(); + temp_r3_2->x24C8.disable_pausing = false; + temp_r3_2->hud_enabled = 0; + lbAudioAx_800237A8(0x81650, 0x7F, 0x40); + ftLib_80086824(); + tmp->x8 = 1; + } else if (ftBossLib_8015C270() == 0) { + tmp->x0 = 2; + } + break; + case 1: + if (tmp->x8 == 0) { + gm_16AE_GetUnkData_0(); + lbAudioAx_800236DC(); + ftBossLib_8015CA6C(0x1D9); + Player_SetMoreFlagsBit4(0, 1); + Player_SetMoreFlagsBit3(0, 1); + tmp->x10 = ft_80087C58(Player_GetEntity(0)); + ft_80087C64(Player_GetEntity(0), 2); + tmp->x14 = ft_80087C58(Player_GetEntity(2)); + ft_80087C64(Player_GetEntity(2), 2); + tmp->x8 = 1; + } else if (tmp->x8 == 1) { + lbAudioAx_800237A8(0x81651, 0x7F, 0x40); + fn_8017C0C8(); + tmp->x8 = 2; + } else if (ftBossLib_8015C2A8() == 0) { + gm_16AE_GetUnkData_0(); + Stage_80225074(0); + ftBossLib_8015CB7C(); + Player_SetMoreFlagsBit4(0, 0); + Player_SetMoreFlagsBit3(0, 0); + ft_80087C64(Player_GetEntity(0), tmp->x10); + ft_80087C64(Player_GetEntity(2), tmp->x14); + ftBossLib_8015CC14(); + tmp->x0 = 4U; + } + break; + case 2: + temp_r3_4 = gm_16AE_GetUnkData_0(); + temp_r3_4->hud_enabled = 1; + Stage_80225074(0); + ftLib_800868A4(); + ftBossLib_8015CC14(); + tmp->x0 = 3; + break; + case 3: + if (Player_GetRemainingHP(2) <= 0) { + tmp->x0 = 7; + tmp->x8 = 0; + } else if (Player_GetRemainingHP(2) <= + *(volatile const f32*) &lbl_804DA428 * tmp->xC && + fn_8017EDDC()) + { + tmp->x0 = 1; + tmp->x8 = 0; + } + break; + case 4: + if (Player_GetRemainingHP(2) <= 0 && Player_GetRemainingHP(1) <= 0) { + tmp->x0 = 7; + tmp->x8 = 0; + } else if (Player_GetRemainingHP(2) <= 0 || + Player_GetRemainingHP(1) <= 0) + { + tmp->x0 = 6; + tmp->x8 = 0; + } + break; + case 5: + if (Player_GetRemainingHP(2) <= 0 && Player_GetRemainingHP(1) <= 0) { + tmp->x0 = 7; + tmp->x8 = 0; + } + break; + case 6: + if (Player_GetRemainingHP(2) <= 0) { + tmp->x4 = 2; + } else { + tmp->x4 = 1; + } + temp_r27_2 = temp_r31 + temp_r29; + if (tmp->x8 == 0) { + ftBossLib_8015CB9C(tmp->x4); + gm_801A4634(6); + } else if (tmp->x8 == temp_r31) { + lbAudioAx_8002438C(0x4E200); + ftBossLib_8015CC14(); + gm_801A4674(6); + gm_SetGameSpeed(*(volatile const f32*) &lbl_804DA428); + } else if (tmp->x8 >= temp_r27_2) { + gm_SetGameSpeed(*(volatile const f32*) &lbl_804DA42C); + tmp->x0 = 5; + } + if (Player_GetRemainingHP(2) <= 0 && Player_GetRemainingHP(1) <= 0) { + tmp->x0 = 7; + tmp->x8 = 0; + } else if (tmp->x8 <= temp_r27_2) { + tmp->x8++; + } + break; + case 7: + temp_r28 = temp_r31 + temp_r27; + temp_r29_2 = temp_r3 + temp_r28; + if (tmp->x8 == 0) { + temp_r3_4 = gm_16AE_GetUnkData_0(); + temp_r3_4->hud_enabled = 0; + if (tmp->x4 == 2) { + tmp->x4 = 1; + } else { + tmp->x4 = 2; + } + ftBossLib_8015CB9C(tmp->x4); + gm_801A4634(6); + Player_80031790(0); + Player_80036844(0, 1); + temp_r3_4 = gm_16AE_GetUnkData_0(); + temp_r3_4->x24C8.x0_6 = false; + } else if (tmp->x8 == temp_r31) { + lbAudioAx_8002438C(0x4E200); + ftBossLib_8015CC14(); + gm_801A4674(6); + gm_SetGameSpeed(*(volatile const f32*) &lbl_804DA428); + lbBgFlash_80020688(temp_r27); + } else if (tmp->x8 == temp_r28) { + lbBgFlash_800205F0(temp_r3); + } else if (tmp->x8 >= temp_r29_2) { + lbAudioAx_80028B90(); + gm_SetGameSpeed(*(volatile const f32*) &lbl_804DA42C); + gm_8016B33C(8); + gm_8016B328(); + break; + } + if (tmp->x8 >= temp_r31) { + lbAudioAx_80028B6C(); + } + if (tmp->x8 <= temp_r28 && tmp->x8 % 30 == 0) { + gm_80167858(Player_GetPlayerId(0), Player_GetNametagSlotID(0), 2, + 0x1E); + Camera_80030E44(3, NULL); + } + if (tmp->x8 <= temp_r29_2) { + tmp->x8++; + } + break; + } +} + +void fn_8017C71C(void) +{ + struct lbl_804706C0_t* tmp = &lbl_804706C0; + HSD_GObj_SetupProc(GObj_Create(0xF, 0x11, 0), fn_8017C1A4, 0x15); + tmp->x0 = 0; + tmp->x4 = 1; + tmp->x8 = 0; + tmp->xC = ftBossLib_8015C530(gm_8017E068()); + Player_SetOtherStamina(2, tmp->xC); + ftLib_80087508(FTKIND_CREZYH, 0); +} + +void fn_8017C7A0(void) +{ + lbBgFlash_8002063C(0x30); + if (Ground_801C1DAC()) { + gm_8016B350(0x7C85E); + return; + } + gm_8016B350(0x9C48); +} + +void fn_8017C7EC(void) +{ + lbl_8046B6A0_t* temp_r31; + Unk1PData* temp_r30; + + temp_r30 = fn_8017DF28(); + temp_r31 = gm_16AE_GetUnkData_1(); + temp_r31->timer_seconds = grPushOn_80219230(temp_r30->ckind); +} + +void gm_8017C838(void) +{ + s8 sp10[3]; + + lbl_8046B6A0_t* temp_r3; + int i; + s8 var_r3; + s8* var_r31; + UnkAdventureData* temp_r30; + + PAD_STACK(8); + + temp_r30 = gm_GetAdventureData(); + temp_r3 = gm_16AE_GetUnkData_0(); + var_r31 = sp10; + sp10[0] = FTKIND_NONE; + sp10[1] = FTKIND_NONE; + sp10[2] = FTKIND_NONE; + switch (temp_r3->x24C8.xE) { + case 0x3B: + sp10[0] = FTKIND_YOSHI; + break; + case 0x3F: + sp10[0] = FTKIND_LINK; + break; + case 0x44: + sp10[0] = FTKIND_KIRBY; + if (temp_r30->x0.ckind == CKIND_KIRBY && temp_r30->x0.color == 0) { + var_r3 = 1; + } else { + var_r3 = 0; + } + ftLib_80087610(var_r3); + break; + case 0x48: + sp10[0] = 0xC; + if (gm_IsCKindUnlocked(CKIND_PICHU) != 0) { + sp10[1] = FTKIND_PICHU; + } + if (gm_IsCKindUnlocked(CKIND_PURIN) != 0) { + sp10[2] = FTKIND_PURIN; + } + break; + case 0x4C: + sp10[0] = FTKIND_POPO; + sp10[1] = FTKIND_NANA; + break; + case 0x4E: + sp10[0] = FTKIND_BOY; + sp10[1] = FTKIND_GIRL; + break; + } + + for (i = 0; i < 3; i++) { + if (*var_r31 != FTKIND_MAX) { + ftLib_80087574(*var_r31); + } + var_r31++; + } + Camera_80030E34(0.2f); +} + +/// Trailing pad keeps #lbl_803D85F0 at its retail offset. +struct AdventureStageTable lbl_803D7AC0 = { { + { 0x04, 0x00, 40, 450, { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x03, 0x00, 50, 400, { 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x03, 0x00, 60, 320, { 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, 0x00, 70, 240, { 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x01, 0x00, 80, 170, { 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x04, 0x00, 80, 140, { 0x00, 0x00, 0x10, 0x00, 0x00, 0x04, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x03, 0x00, 94, 112, { 0x03, 0x00, 0x10, 0x03, 0x00, 0x04, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x03, 0x00, 100, 107, { 0x05, 0x00, 0x10, 0x04, 0x00, 0x04, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x03, 0x00, 110, 105, { 0x07, 0x00, 0x10, 0x07, 0x00, 0x04, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, 0x00, 120, 95, { 0x08, 0x00, 0x10, 0x08, 0x00, 0x04, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x04, 0x00, 80, 140, { 0x01, 0x00, 0x04, 0x01, 0x01, 0x08, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x04, 0x00, 100, 90, { 0x02, 0x00, 0x04, 0x02, 0x01, 0x08, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x03, 0x00, 110, 70, { 0x04, 0x00, 0x04, 0x03, 0x01, 0x08, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, 0x00, 120, 50, { 0x07, 0x00, 0x04, 0x06, 0x01, 0x08, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x01, 0x00, 130, 40, { 0x09, 0x00, 0x04, 0x09, 0x01, 0x08, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x04, 0x00, 60, 380, { 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x64, 0x00, 0x64, + 0x00, 0x00, 0x04, 0x00, 0x00, 0x04 } }, + { 0x04, 0x00, 80, 250, { 0x03, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x64, 0x00, 0x64, + 0x00, 0x00, 0x04, 0x00, 0x00, 0x04 } }, + { 0x03, 0x00, 90, 200, { 0x05, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x64, 0x00, 0x64, + 0x00, 0x00, 0x04, 0x00, 0x00, 0x04 } }, + { 0x02, 0x00, 95, 160, { 0x07, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x64, 0x00, 0x64, + 0x00, 0x00, 0x04, 0x00, 0x00, 0x04 } }, + { 0x01, 0x00, 110, 120, { 0x08, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x64, 0x00, 0x64, + 0x00, 0x00, 0x04, 0x00, 0x00, 0x04 } }, + { 0x03, 0x00, 70, 160, { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, 0x00, 80, 140, { 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, 0x00, 90, 120, { 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x01, 0x00, 100, 105, { 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x01, 0x00, 108, 95, { 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x04, 0x00, 80, 125, { 0x02, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x04, 0x00, 90, 110, { 0x06, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x03, 0x00, 100, 100, { 0x08, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x03, 0x00, 118, 95, { 0x09, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, 0x00, 130, 90, { 0x09, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x03, 0x00, 80, 130, { 0x02, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x03, 0x00, 90, 110, { 0x05, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, 0x00, 100, 100, { 0x07, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, 0x00, 115, 88, { 0x08, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x01, 0x00, 130, 74, { 0x09, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0xFF, 0x00, 0, 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0xFF, 0x00, 0, 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0xFF, 0x00, 0, 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0xFF, 0x00, 0, 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0xFF, 0x00, 0, 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x03, 0x00, 80, 170, { 0x02, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, 0x00, 100, 130, { 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, 0x00, 120, 110, { 0x06, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x01, 0x00, 130, 100, { 0x08, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0xFF, 0x00, 140, 90, { 0x09, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x03, 0x00, 60, 500, { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, 0x00, 70, 400, { 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, 0x00, 80, 300, { 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x01, 0x00, 90, 200, { 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0xFF, 0x00, 100, 175, { 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x03, 0x00, 70, 240, { 0x02, 0x00, 0x1B, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, 0x00, 75, 180, { 0x04, 0x00, 0x1B, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, 0x00, 80, 130, { 0x06, 0x00, 0x1B, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x01, 0x00, 100, 100, { 0x07, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x01, 0x00, 120, 90, { 0x09, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, 0x00, 80, 180, { 0x02, 0x00, 0x1B, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, 0x00, 90, 150, { 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, 0x00, 100, 130, { 0x05, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, 0x00, 118, 110, { 0x06, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, 0x00, 130, 100, { 0x07, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, 0x00, 60, 210, { 0x02, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, 0x00, 70, 180, { 0x04, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, 0x00, 90, 140, { 0x06, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, 0x00, 105, 120, { 0x08, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, 0x00, 117, 100, { 0x09, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x04, 0x00, 60, 420, { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x04, 0x00, 78, 320, { 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x04, 0x00, 88, 200, { 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x03, 0x00, 98, 170, { 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, 0x00, 109, 150, { 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0xFF, 0x00, 0, 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0xFF, 0x00, 0, 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0xFF, 0x00, 0, 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0xFF, 0x00, 0, 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0xFF, 0x00, 0, 0, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, 0x00, 80, 150, { 0x03, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, 0x00, 100, 110, { 0x06, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, 0x00, 110, 100, { 0x08, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, 0x00, 120, 90, { 0x09, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, 0x00, 130, 70, { 0x09, 0x02, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x04, 0x00, 70, 190, { 0x01, 0x00, 0x1D, 0x01, 0x02, 0x1D, 0x01, + 0x01, 0x1B, 0x00, 0x00, 0x64, 0x00, 0x64, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x04, 0x00, 80, 150, { 0x03, 0x00, 0x1D, 0x03, 0x02, 0x1D, 0x02, + 0x01, 0x1D, 0x00, 0x00, 0x64, 0x00, 0x64, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x04, 0x00, 90, 130, { 0x05, 0x00, 0x1D, 0x04, 0x02, 0x1D, 0x04, + 0x01, 0x1D, 0x00, 0x00, 0x64, 0x00, 0x64, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x04, 0x00, 100, 110, { 0x07, 0x00, 0x1D, 0x06, 0x02, 0x1D, 0x05, + 0x01, 0x1D, 0x00, 0x00, 0x64, 0x00, 0x64, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x04, 0x00, 130, 100, { 0x08, 0x00, 0x1D, 0x08, 0x02, 0x1D, 0x08, + 0x01, 0x1D, 0x00, 0x00, 0x64, 0x00, 0x64, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, 0x00, 80, 190, { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, 0x00, 85, 140, { 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, 0x00, 90, 130, { 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, 0x00, 95, 120, { 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, 0x00, 100, 100, { 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, 0x00, 50, 420, { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, 0x00, 60, 370, { 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, 0x00, 70, 280, { 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, 0x00, 80, 200, { 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, 0x00, 90, 150, { 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, 0x00, 70, 190, { 0x01, 0x00, 0x1B, 0x01, 0x00, 0x1B, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, 0x00, 90, 150, { 0x03, 0x00, 0x1B, 0x02, 0x00, 0x1B, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, 0x00, 100, 130, { 0x05, 0x00, 0x1B, 0x03, 0x00, 0x1B, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, 0x00, 110, 110, { 0x06, 0x00, 0x1B, 0x05, 0x00, 0x1B, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, 0x00, 120, 90, { 0x08, 0x00, 0x1B, 0x07, 0x00, 0x1B, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x03, 0x00, 70, 130, { 0x02, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, 0x00, 93, 115, { 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, 0x00, 100, 105, { 0x06, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x01, 0x00, 110, 88, { 0x08, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0xFF, 0x00, 120, 75, { 0x09, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, 0x00, 1, 1, { 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, 0x00, 1, 1, { 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x01, 0x00, 135, 58, { 0x07, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x01, 0x00, 148, 50, { 0x08, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0xFF, 0x00, 160, 38, { 0x09, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, +} }; + +/// Trailing pad keeps #lbl_803D8B88 at its retail offset. +struct AllstarStageTable lbl_803D85F0 = { { + { 0x04, + 0x00, + 60, + 175, + { 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + 0, + 0, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x03, + 0x00, + 85, + 120, + { 0x02, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + 0, + 0, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x03, + 0x00, + 100, + 100, + { 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + 0, + 0, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, + 0x00, + 100, + 100, + { 0x07, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + 0, + 0, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x01, + 0x00, + 120, + 90, + { 0x09, 0x03, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + 0, + 0, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x04, + 0x00, + 70, + 160, + { 0x01, 0x00, 0x04, 0x02, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00 }, + 80, + 90, + { 0x08, 0x01, 0x04, 0x00, 0x00, 0x00 } }, + { 0x04, + 0x00, + 85, + 120, + { 0x03, 0x00, 0x04, 0x03, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00 }, + 80, + 100, + { 0x07, 0x01, 0x04, 0x00, 0x00, 0x00 } }, + { 0x03, + 0x00, + 100, + 100, + { 0x05, 0x00, 0x04, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00 }, + 80, + 115, + { 0x06, 0x01, 0x04, 0x00, 0x00, 0x00 } }, + { 0x03, + 0x00, + 100, + 90, + { 0x06, 0x00, 0x04, 0x06, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 }, + 80, + 130, + { 0x04, 0x01, 0x04, 0x00, 0x00, 0x00 } }, + { 0x01, + 0x00, + 115, + 80, + { 0x08, 0x03, 0x04, 0x08, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 }, + 80, + 150, + { 0x03, 0x01, 0x04, 0x00, 0x00, 0x00 } }, + { 0xFF, + 0x00, + 0, + 0, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + 0, + 0, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0xFF, + 0x00, + 0, + 0, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + 0, + 0, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0xFF, + 0x00, + 0, + 0, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + 0, + 0, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0xFF, + 0x00, + 0, + 0, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + 0, + 0, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0xFF, + 0x00, + 0, + 0, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + 0, + 0, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x04, + 0x00, + 75, + 140, + { 0x02, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + 0, + 0, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x04, + 0x00, + 90, + 110, + { 0x05, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + 0, + 0, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x04, + 0x00, + 100, + 100, + { 0x08, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + 0, + 0, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x04, + 0x00, + 115, + 85, + { 0x09, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + 0, + 0, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x04, + 0x00, + 134, + 70, + { 0x09, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + 0, + 0, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x03, + 0x00, + 70, + 360, + { 0x02, 0x00, 0x1B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + 100, + 100, + { 0x06, 0x02, 0x04, 0x06, 0x01, 0x04 } }, + { 0x03, + 0x00, + 80, + 240, + { 0x03, 0x00, 0x1B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + 100, + 90, + { 0x05, 0x02, 0x04, 0x05, 0x01, 0x04 } }, + { 0x02, + 0x00, + 90, + 180, + { 0x05, 0x00, 0x1B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + 100, + 80, + { 0x02, 0x02, 0x04, 0x02, 0x01, 0x09 } }, + { 0x02, + 0x00, + 100, + 140, + { 0x07, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + 100, + 80, + { 0x01, 0x02, 0x04, 0x01, 0x01, 0x09 } }, + { 0x01, + 0x00, + 120, + 100, + { 0x08, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + 100, + 80, + { 0x00, 0x02, 0x04, 0x00, 0x01, 0x09 } }, + { 0xFF, + 0x00, + 0, + 0, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + 0, + 0, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0xFF, + 0x00, + 0, + 0, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + 0, + 0, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0xFF, + 0x00, + 0, + 0, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + 0, + 0, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0xFF, + 0x00, + 0, + 0, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + 0, + 0, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0xFF, + 0x00, + 0, + 0, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + 0, + 0, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, + 0x00, + 85, + 130, + { 0x03, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + 0, + 0, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, + 0x00, + 100, + 110, + { 0x06, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + 0, + 0, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, + 0x00, + 90, + 130, + { 0x05, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + 0, + 0, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, + 0x00, + 100, + 110, + { 0x06, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + 0, + 0, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x01, + 0x00, + 110, + 90, + { 0x08, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + 0, + 0, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x03, + 0x00, + 60, + 400, + { 0x01, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + 0, + 0, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x03, + 0x00, + 70, + 260, + { 0x03, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + 0, + 0, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, + 0x00, + 80, + 200, + { 0x04, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + 0, + 0, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, + 0x00, + 90, + 155, + { 0x05, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + 0, + 0, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x01, + 0x00, + 110, + 120, + { 0x07, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + 0, + 0, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, + 0x00, + 100, + 100, + { 0x01, 0x00, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x04, 0x00 }, + 100, + 100, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, + 0x00, + 100, + 100, + { 0x01, 0x00, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x04, 0x00 }, + 100, + 100, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, + 0x00, + 100, + 100, + { 0x01, 0x00, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x04, 0x00 }, + 100, + 100, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, + 0x00, + 100, + 100, + { 0x01, 0x00, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x04, 0x00 }, + 100, + 100, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, + 0x00, + 100, + 100, + { 0x01, 0x00, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x04, 0x00 }, + 100, + 100, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, + 0x00, + 80, + 180, + { 0x01, 0x00, 0x1B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + 0, + 0, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, + 0x00, + 90, + 130, + { 0x03, 0x00, 0x1B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + 0, + 0, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, + 0x00, + 100, + 100, + { 0x05, 0x00, 0x1B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + 0, + 0, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x01, + 0x00, + 110, + 85, + { 0x08, 0x00, 0x1B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + 0, + 0, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0xFF, + 0x00, + 125, + 68, + { 0x09, 0x00, 0x1B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + 0, + 0, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, + 0x00, + 50, + 100, + { 0x05, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + 0, + 0, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, + 0x00, + 75, + 100, + { 0x06, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + 0, + 0, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, + 0x00, + 100, + 100, + { 0x07, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + 0, + 0, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0x02, + 0x00, + 150, + 100, + { 0x08, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + 0, + 0, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, + { 0xFF, + 0x00, + 200, + 100, + { 0x09, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + 0, + 0, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, +} }; diff --git a/src/melee/gm/gm_17C0.h b/src/melee/gm/gm_17C0.h new file mode 100644 index 0000000000..32f26a7899 --- /dev/null +++ b/src/melee/gm/gm_17C0.h @@ -0,0 +1,20 @@ +#ifndef MELEE_GM_GM_17C0_H +#define MELEE_GM_GM_17C0_H + +#include +#include + +/* 17C0C8 */ void fn_8017C0C8(void); +/* 17C1A4 */ void fn_8017C1A4(HSD_GObj*); +/* 17C71C */ void fn_8017C71C(void); +/* 17C7A0 */ void fn_8017C7A0(void); +/* 17C7EC */ void fn_8017C7EC(void); +/* 17C838 */ void gm_8017C838(void); + +/* 3D7AC0 */ extern AdventureStageTable lbl_803D7AC0; +/* 3D85F0 */ extern AllstarStageTable lbl_803D85F0; + +/* 4DA428 */ extern const f32 lbl_804DA428; +/* 4DA42C */ extern const f32 lbl_804DA42C; + +#endif diff --git a/src/melee/gm/gm_17C9.c b/src/melee/gm/gm_17C9.c new file mode 100644 index 0000000000..dd0e9c4369 --- /dev/null +++ b/src/melee/gm/gm_17C9.c @@ -0,0 +1,1007 @@ +#include "gm_17C9.h" + +#include "gm_17C0.h" +#include "gm_17E4.h" +#include "gm_17EB.h" +#include "gmregclear.h" +#include "platform.h" + +#include "baselib/forward.h" + +#include "dolphin/pad.h" + +#include "gm/forward.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +typedef struct lbl_804706D8_t { + s16 x0; + u8 x2; + u8 x3; +} lbl_804706D8_t; + +lbl_804706D8_t lbl_804706D8[12]; + +typedef struct RegClearCharEntry { + /* 0x00 */ u8 x0; + /* 0x01 */ u8 x1; + /* 0x02 */ u8 x2; + /* 0x03 */ u8 x3; + /* 0x04 */ f32 x4; + /* 0x08 */ f32 x8; +} RegClearCharEntry; + +void gm_8017C984(UNK_T arg0) +{ + memzero(arg0, 0x74); +} + +extern u8 lbl_803B7C08[][5]; + +void gm_8017C9A8(DebugGameOverData* arg0, Unk1PData* arg1, u8 arg2) +{ + PAD_STACK(8); + arg0->x0 = arg1->xC.x18; + arg0->x8 = arg2; + arg0->ckind = arg1->ckind; + arg0->slot = arg1->slot; + arg0->x15 = arg1->x4; + arg0->x18 = gm_801623D8(); + arg0->x16 = lbl_803B7C08[arg2][arg1->cpu_level]; +} + +void gm_8017CA38(DebugGameOverData* arg0, Unk1PData* arg1, gmm_x0_528_t* arg2, + u8 arg3) +{ + u8 temp_r31; + + arg1->xC.x14 = arg0->x18; + gm_801623FC(arg1->xC.x14); + if (arg0->xC == 0) { + temp_r31 = gm_80173224(arg3, 0); + switch (gm_GetCurrentGameMode()) { + case GM_CLASSIC: + fn_80162BFC(arg1->ckind, arg0->x4); + break; + case GM_ADVENTURE: + fn_80162DF8(arg1->ckind, arg0->x4); + break; + case GM_ALLSTAR: + fn_80162FF4(arg1->ckind, arg0->x4); + break; + } + Ground_801C5A60(); + gm_8017390C(fn_8017DF90(), 0); + gm_80173EEC(); + gm_80172898(0x40); + if (temp_r31 == CHKIND_NONE) { + if (gm_80173754(1, arg1->slot) == 0) { + gm_ChangeGameModeAfterCurrentScene(GM_MENU); + } + } else { + gm_801736E8(arg1->ckind, arg1->color, arg1->slot, arg1->x4, + temp_r31, 1U); + gm_ChangeGameModeAfterCurrentScene(GM_CHALLENGER_APPROACH); + } + } else { + arg1->xC.x18 = lbTime_8000AEC8((u32) arg0->x4, 1U); + arg1->stocks = arg2->stocks; + arg1->xC.xD = lbTime_8000AF74((u32) arg1->xC.xD, 1); + gm_SetPendingSceneIndex(arg1->x7); + } +} + +void gm_8017CBAC(UnkAdventureData* arg0, gmm_x0_528_t* arg1, u8 arg2) +{ + s32 temp_r3_2; + u8 temp_r31; + u8* temp_r3; + + temp_r31 = gm_CKindToSelKind(arg0->x0.ckind); + Ground_801C5A60(); + switch (arg2) { + case 21: + gmMainLib_8015D134(temp_r31); + fn_80162BFC(arg0->x0.ckind, arg0->x0.xC.x18); + temp_r3 = gmMainLib_8015D194(temp_r31); + if (*temp_r3 < arg0->x0.cpu_level) { + *temp_r3 = arg0->x0.cpu_level; + } + temp_r3_2 = gmMainLib_8015D1AC(temp_r31); + if ((arg0->x0.cpu_level == 4) && + ((temp_r3_2 == 0) || (arg1->stocks < temp_r3_2))) + { + gmMainLib_8015D1C8(temp_r31, arg1->stocks); + } + break; + case 22: + gmMainLib_8015D25C(temp_r31); + fn_80162DF8(arg0->x0.ckind, arg0->x0.xC.x18); + temp_r3 = gmMainLib_8015D2BC(temp_r31); + if (*temp_r3 < arg0->x0.cpu_level) { + *temp_r3 = arg0->x0.cpu_level; + } + temp_r3_2 = gmMainLib_8015D2D4(temp_r31); + if ((arg0->x0.cpu_level == 4) && + ((temp_r3_2 == 0) || (arg1->stocks < temp_r3_2))) + { + gmMainLib_8015D2F0(temp_r31, arg1->stocks); + } + break; + case 23: + gmMainLib_8015D384(temp_r31); + fn_80162FF4(arg0->x0.ckind, arg0->x0.xC.x18); + if (!gm_80164430(0x1F)) { + gm_80164504(0x1F); + } + temp_r3 = gmMainLib_8015D3E4(temp_r31); + if (*temp_r3 < arg0->x0.cpu_level) { + *temp_r3 = arg0->x0.cpu_level; + } + temp_r3_2 = gmMainLib_8015D3FC(temp_r31); + if ((arg0->x0.cpu_level == 4) && + (temp_r3_2 == 0 || arg1->stocks < temp_r3_2)) + { + gmMainLib_8015D418(temp_r31, arg1->stocks); + } + break; + } + lb_8001C550(); + lb_8001D164(0); + lb_8001CE00(); + gm_SetPendingGameMode(arg2); + gm_SetNewGameModePending(); +} + +u8 gm_8017CD94(UnkAdventureData* arg0, int arg1, int arg2, int arg3) +{ + u8 num_colors; + u8 result; + + num_colors = gm_80169238(arg1); + if (arg0->x54 != NULL) { + result = arg0->x54(arg2, arg0->x0.cpu_level, arg3); + if (num_colors != 0) { + return result % num_colors; + } + return 0; + } + return 0; +} + +static inline s32 gm_8017CE34_CountEnemies(s8* arg0) +{ + s32 count = 0; + + if ((s32) (u8) arg0[0] != 0x21) { + count = 1; + } + { + s8* p = &arg0[1]; + if ((s32) *p != 0x21) { + count += 1; + } + if ((s32) p[1] != 0x21) { + count += 1; + } + } + return count; +} + +static inline void gm_8017CE34_SetupColors(UnkAdventureData* arg1, s32 count, + s8* arg2, u8* colors) +{ + s32 color_idx; + + { + u8* out_color = colors; + s8* kind_iter = arg2; + for (color_idx = 0; color_idx < 3; color_idx++) { + u8 kind = (u8) *kind_iter; + u8 num_colors = gm_80169238(kind); + u8 color_id; + if (arg1->x54 != NULL) { + u8 requested_color; + requested_color = + arg1->x54((u8) count, arg1->x0.cpu_level, (u8) color_idx); + if (num_colors != 0) { + color_id = requested_color % num_colors; + } else { + color_id = 0; + } + } else { + color_id = 0; + } + *out_color = color_id; + out_color += 1; + kind_iter += 1; + } + } +} + +s32 gm_8017CE34(StartMeleeData* arg0, UnkAdventureData* arg1, s8* arg2, + u8 arg3, u8 arg4, u8 arg5, s32 arg6, InternalStageId arg7, + s32 count, s32 arg9) +{ + u8 colors[16]; + u8 enemy_level; + s32 boss_count; + u8 enemy_cpu_type; + s32 player_idx; + f32 attack_ratio; + u8 player_stocks; + u8 player_ckind; + u8 flags; + s8* enemy_kind; + f32 defense_ratio; + u8 enemy_ckind; + s32 enemy_count; + s32 enemy_idx; + s32 sp8; + u8* color_iter; + f32 one; + + PAD_STACK(4); + + boss_count = 0; + enemy_level = 0; + enemy_cpu_type = 0; + arg1->x0.xC.xC = 1; + fn_8017E21C(); + fn_8016F030(arg0); + one = lbl_804DA42C; + arg0->rules.x30 = one; + arg0->rules.x4_4 = 1; + + switch (arg9) { + case 0: + arg0->rules.xA = 0; + break; + case 1: + arg0->rules.xA = 3; + break; + case 2: + arg0->rules.xA = 2; + break; + } + + arg0->rules.x1_1 = 1; + arg0->rules.x4_2 = 1; + arg0->rules.x4_3 = 1; + arg0->rules.x2_5 = 0; + arg0->rules.x0_3 = arg1->x0.xB; + + if (arg6 != 0) { + arg0->rules.x10 = (u32) arg6; + arg0->rules.x0_6 = 1; + } else { + arg0->rules.x0_6 = 0; + } + + arg0->rules.x18 = (u32) arg1->x0.xC.x18; + arg0->rules.xE = (u16) arg7; + arg0->rules.xB = arg1->x48((u8) count, arg1->x0.cpu_level); + + arg0->rules.x20 = (u64) -1; + + enemy_count = gm_8017CE34_CountEnemies(arg2); + if (enemy_count == 0) { + arg0->rules.x5_1 = 1; + } + if (arg1->x0.x8 & 1) { + arg0->rules.x2_7 = 1; + } + if (arg1->x0.x8 & 0x20) { + arg0->rules.x4_5 = 1; + } + if (arg1->x0.x8 & 0x80) { + arg1->x0.xC.xC = 5; + switch ((s32) arg1->x0.x9) { + case 1: + arg0->rules.on_pause_override = gm_80165290; + arg0->rules.x9 = 1; + arg0->rules.x3_1 = 0; + arg0->players[0].xC_b1 = 0; + break; + case 2: + arg0->rules.x9 = 3; + arg0->rules.x44 = fn_8017C7EC; + break; + case 3: + arg0->rules.x9 = 2; + arg0->rules.x7 = 9; + arg0->rules.x4_4 = 0; + arg0->rules.x50 = (void (*)(u8)) fn_8017C7A0; + arg0->rules.xD = 0x30; + break; + } + } + + if ((arg1->x0.x8 & 0x80) != 0) { + player_stocks = 1; + } else { + player_stocks = arg1->x0.stocks; + } + + player_ckind = (u8) arg1->x0.ckind; + if ((player_ckind == 0x12) && ((u8) arg1->x0.xC.x12 != 0)) { + player_ckind = 0x13; + } else if (((arg1->x0.x8 & 0x80) != 0) && ((u8) arg1->x0.x9 == 1) && + ((s8) player_ckind == 0xE)) + { + player_ckind = 0x20; + } + + gm_801B0620(arg0->players, player_ckind, arg1->x0.color, player_stocks, + arg1->x0.slot); + arg0->players[0].xA = arg1->x0.x4; + arg0->players[0].spawn_dir = (s8) arg1->x0.xA; + + { + u8 team_color; + if (arg1->x58 != NULL) { + team_color = arg1->x58((u8) count, arg1->x0.cpu_level, 0); + } else { + team_color = 0; + } + + { + player_idx = + fn_8017DD7C(arg0->players, arg1->x0.xC.x24, team_color) + 1; + arg0->rules.is_teams = 1; + } + } + + attack_ratio = arg1->x64((u8) count, arg1->x0.cpu_level); + defense_ratio = arg1->x68((u8) count, arg1->x0.cpu_level); + + color_iter = colors; + gm_8017CE34_SetupColors(arg1, count, arg2, color_iter); + + { + s32 temp_r3_4 = arg1->x0.x8 & 8; + if ((temp_r3_4 != 0) && ((u8) arg1->x0.xC.x11 == 0)) { + s32 base_enemy_count; + s32 event_enemy_count; + s32 special_stage; + s32 special_enemy_mode; + u8 first_enemy; + u32 stage_flags; + + base_enemy_count = gm_8017CE34_CountEnemies(arg2); + arg1->x0.xC.xC = 3; + event_enemy_count = base_enemy_count; + special_stage = 0; + special_enemy_mode = 0; + sp8 = 0; + if (arg1->x4C != NULL) { + enemy_level = arg1->x4C((u8) count, arg1->x0.cpu_level, 0U); + } + + first_enemy = (u8) arg2[0]; + if ((s8) first_enemy != 4) { + if ((u8) (first_enemy - 0x1B) <= 1U) { + arg0->rules.x0_3 = 6; + event_enemy_count = 5; + colors[0] = 0; + special_stage = 1; + special_enemy_mode = 1; + } else if (((s8) first_enemy == 0xD) && + (((s32) arg2[1] != 0xD) || ((s32) arg2[2] != 0xD))) + { + special_enemy_mode = 2; + } + } + + { + s32 stage_id = Stage_8022519C(arg7); + stage_flags = Ground_801C5AD0(stage_id); + } + + { + u8 player_ckind = (u8) arg1->x0.ckind; + gm_8016A22C((s8) (u8) arg2[0], (s8) arg2[1], (s8) arg2[2], + colors[0], colors[1], (s32) colors[2], + special_stage, special_enemy_mode, sp8, + player_ckind, arg1->x0.color, (s32) enemy_level, + (s32) arg3, event_enemy_count, (s32) stage_flags, + (s32) arg5, (s32) arg4, attack_ratio, + defense_ratio); + } + gm_8016A21C(&arg0->rules); + arg1->x0.xC.x11 = 0; + if (arg1->x0.x8 & 4) { + fn_8016A450(); + } + if ((u8) special_enemy_mode == 1) { + fn_8016A46C(); + arg0->players[0].xC_b5 = 1; + } + } else if (temp_r3_4 != 0) { + gm_8016A21C(&arg0->rules); + arg1->x0.xC.x11 = 0; + } + } + + gmRegSetupEnemyColorTable((s8) (u8) arg1->x0.ckind, arg1->x0.color, arg2, + colors); + + enemy_idx = 0; + for (;;) { + enemy_kind = &arg2[enemy_idx]; + if ((s32) (u8) enemy_kind[0] != 0x21) { + if (arg1->x0.x8 & 8) { + if (arg1->x4C != NULL) { + enemy_level = + arg1->x4C((u8) count, arg1->x0.cpu_level, 0U); + } + if (arg1->x50 != NULL) { + enemy_cpu_type = + arg1->x50((u8) count, arg1->x0.cpu_level, 0U); + } + } else { + if (arg1->x4C != NULL) { + u8 selected_enemy_level = + arg1->x4C((u8) count, arg1->x0.cpu_level, enemy_idx); + enemy_level = selected_enemy_level; + } + if (arg1->x50 != NULL) { + enemy_cpu_type = + arg1->x50((u8) count, arg1->x0.cpu_level, enemy_idx); + } + } + gm_8016795C(&arg0->players[player_idx]); + arg0->players[player_idx].slot_type = 1; + arg0->players[player_idx].c_kind = (s8) (u8) enemy_kind[0]; + arg0->players[player_idx].stocks = 1; + arg0->players[player_idx].cpu_level = enemy_level; + arg0->players[player_idx].xE = enemy_cpu_type; + arg0->players[player_idx].x18 = attack_ratio; + arg0->players[player_idx].x1C = defense_ratio; + arg0->players[player_idx].color = *color_iter; + if (arg1->x0.x8 & 2) { + arg0->players[player_idx].x20 = 2.0f; + arg0->players[player_idx].xB = 2; + } else { + arg0->players[player_idx].x20 = one; + arg0->players[player_idx].xB = 0; + } + if (arg1->x0.x8 & 4) { + arg0->players[player_idx].xC_b2 = 1; + arg0->players[player_idx].xE = 0x1B; + } + if ((s32) arg0->players[player_idx].c_kind == 0x1D) { + arg0->players[player_idx].xC_b1 = 0; + } + enemy_ckind = (u8) arg0->players[player_idx].c_kind; + if (((s8) enemy_ckind == 0x1A) || ((s8) enemy_ckind == 0x1E)) { + arg0->players[player_idx].xC_b7 = 1; + arg0->players[player_idx].hp = 0x12C; + arg0->players[player_idx].xD_b2 = 1; + arg0->players[player_idx].xD_b0 = 1; + arg0->players[player_idx].xD_b2 = 1; + arg0->players[player_idx].spawn_dir = -1; + if ((s32) arg0->players[player_idx].c_kind == 0x1E) { + arg0->players[player_idx].slot_type = 3; + } + boss_count += 1; + } + if ((u8) arg0->rules.is_teams == 1) { + arg0->players[player_idx].team = 4; + } + player_idx += 1; + if (player_idx >= 6) { + break; + } + } else { + if (((s32) enemy_idx == 0) && ((s32) enemy_kind[1] == 0x1A)) { + arg0->players[player_idx].slot_type = 3; + player_idx += 1; + } + } + enemy_idx += 1; + color_iter += 1; + if ((s32) enemy_idx >= 3) { + break; + } + } + + { + s32 i; + for (i = player_idx; i < 6; i++) { + arg0->players[i].slot_type = 3; + } + } + + flags = arg1->x0.x8; + if (flags & 0x40) { + arg1->x0.xC.xC = 7; + } else if (flags & 1) { + if ((flags & 8) && (arg3 > 1U)) { + arg1->x0.xC.xC = 4; + } else { + arg1->x0.xC.xC = 2; + } + } + if (boss_count != 0) { + arg0->rules.x1_2 = 1; + arg0->rules.x1_3 = 1; + arg0->rules.x1_4 = 1; + arg0->rules.x0_3 = 3; + arg0->rules.disable_pausing = 1; + arg0->rules.x7 = 0; + arg0->rules.x44 = (void (*)(void)) fn_8017C71C; + arg1->x0.xC.xC = 6; + } + if (arg7 == 0x49) { + arg1->x0.xC.xC = 8; + } + return (s32) flags; +} + +bool gm_8017D7AC(MatchExitInfo* arg0, Unk1PData* arg1, u8 arg2) +{ + u8 temp_r0; + + arg1->xC.x14 = + lbTime_8000AEC8(arg1->xC.x14, arg0->match_end.player_standings[0].xE); + gm_8016247C(arg0->match_end.player_standings[0].xE); + arg1->xC.x1C = + lbTime_8000AEC8(arg1->xC.x1C, arg0->match_end.player_standings[0].x44); + gm_80162968(arg0->match_end.frame_count / 60); + if (!(arg1->x8 & 0x80)) { + arg1->xC.x20 = + lbTime_8000AEC8(arg1->xC.x20, arg0->match_end.frame_count); + } + if (arg0->match_end.player_standings[0].character_id == 7) { + arg1->xC.x12 = 1; + } else { + arg1->xC.x12 = 0; + } + if (fn_8016B510() != 0) { + arg1->xC.xF = 1; + } + if (fn_8016B4BC() != 0) { + arg1->xC.xE = 1; + } + temp_r0 = arg0->match_end.result; + if ((temp_r0 == 7 || temp_r0 == 8) && DbLevel <= 2) { + switch (gm_GetCurrentGameMode()) { + case GM_CLASSIC: + fn_80162BFC(arg1->ckind, arg1->xC.x18); + break; + case GM_ADVENTURE: + fn_80162DF8(arg1->ckind, arg1->xC.x18); + break; + case GM_ALLSTAR: + fn_80162FF4(arg1->ckind, arg1->xC.x18); + break; + } + gm_ChangeGameModeAfterCurrentScene(GM_MENU); + return 0; + } + fn_8017E3C8(); + if (!(arg1->x8 & 0x80)) { + arg1->stocks = arg0->match_end.player_standings[0].stocks; + if (arg1->stocks != 0) { + if (arg0->match_end.result == 1) { + arg1->stocks--; + if (arg1->stocks == 0) { + gm_SetPendingSceneIndex(arg2); + return 0; + } + if (!(arg1->x8 & 0x40)) { + arg1->xC.x10++; + gm_SetPendingSceneIndex(gm_GetCurrentSceneIndex()); + return 0; + } + } + } else { + arg1->xC.x10 = 0; + gm_SetPendingSceneIndex(arg2); + return 0; + } + } + arg1->xC.x18 = arg0->x0; + arg1->xC.x10 = 0; + return 1; +} + +s32 fn_8017D9C0(u8* arg0, u8* arg1) +{ + u8* base; + u8* p; + s32 i; + s32 j; + u8 temp; + u8* dst; + u8 ch; + s32 excluded_idx; + s32 rejected_idx; + s32 len; + + p = base = lbl_803D79F0; + len = 0; + while ((s32) *p != 0x21) { + p++; + len++; + } + + p = base; + for (j = 0; j < len; j++) { + temp = *p; + dst = &base[HSD_Randi(len)]; + *p = *dst; + p++; + *dst = temp; + } + + p = base; + for (i = 0; i < len; i++) { + if (gm_IsCKindUnlocked(*p) != 0) { + ch = *p; + for (excluded_idx = 0; excluded_idx < 4; excluded_idx++) { + if ((s8) ch == (s8) arg0[excluded_idx]) { + excluded_idx = -1; + break; + } + } + if (excluded_idx != -1) { + for (rejected_idx = 0; rejected_idx < 3; rejected_idx++) { + if ((s8) ch == (s8) arg1[rejected_idx]) { + rejected_idx = -1; + break; + } + } + if (rejected_idx != -1) { + return (s32) base[i]; + } + } + } + p++; + } + + return 0x21; + PAD_STACK(8); +} + +void gm_8017DB58(struct Unk1PData_x24* arg0) +{ + int i; + for (i = 0; i < 3; i++) { + arg0[i].ckind = CHKIND_NONE; + } +} + +u8 gm_8017DB6C(gm_8017DB6C_arg0_t* arg0, int index) +{ + return arg0[index].x0; +} + +u8 gm_8017DB78(gm_8017DB6C_arg0_t* arg0, int index) +{ + return arg0[index].x1; +} + +s32 gm_8017DB88(void* arg0, u8 arg1, s32 arg2, s32 arg3, u8* arg4, u8 arg5, + u8 (*arg6)(s32, s32, u8), u8 (*arg7)(s32, s32, u8), + u8 (*arg8)(s32, s32, u8), f32 (*arg9)(s32, s32), + f32 (*arg10)(s32, s32)) +{ + u8 chars[4]; + s32 val; + f32 fval; + + { + u8* p; + RegClearCharEntry* out; + s32 i; + s32 count; + + count = fn_8017DE54(arg1, arg4); + chars[1] = 0x21; + out = arg0; + chars[2] = 0x21; + p = chars; + i = 0; + chars[3] = 0x21; + chars[0] = arg5; + for (; i < count; i++) { + p[1] = fn_8017D9C0(chars, arg4); + out->x0 = p[1]; + if (arg8 != NULL) { + val = arg8(arg3, arg2, (u8) i); + } else { + val = 0; + } + out->x1 = val; + if (arg6 != NULL) { + val = arg6(arg3, arg2, (u8) i); + } else { + val = 0; + } + out->x2 = val; + if (arg7 != NULL) { + val = arg7(arg3, arg2, (u8) i); + } else { + val = 0; + } + out->x3 = val; + if (arg9 != NULL) { + fval = arg9(arg3, arg2); + } else { + fval = 0.0f; + } + out->x4 = fval; + if (arg10 != NULL) { + fval = arg10(arg3, arg2); + } else { + fval = 0.0f; + } + out->x8 = fval; + p++; + out++; + } + for (; i < 3; i++) { + ((RegClearCharEntry*) arg0)[i].x0 = 0x21; + } + return count; + } +} + +s32 fn_8017DD7C(PlayerInitData* arg0, Unk1PData_x24* arg1, u8 arg2) +{ + s32 index = 1; + int i; + for (i = 0; i < 3; i++) { + if (arg1[i].ckind != CHKIND_NONE) { + gm_8016795C(&arg0[index]); + arg0[index].c_kind = arg1[i].ckind; + arg0[index].slot_type = 1; + arg0[index].stocks = 1; + arg0[index].team = arg0->team; + arg0[index].color = arg1[i].x1; + arg0[index].xE = arg1[i].x3; + arg0[index].cpu_level = arg1[i].x2; + arg0[index].x18 = arg1[i].x4; + arg0[index].x1C = arg1[i].x8; + arg0[index].xD_b1 = 1; + if (arg0[index].c_kind == CKIND_GKOOPS) { + arg0[index].xC_b1 = 0; + } + index++; + } + } + return index - 1; +} + +s32 fn_8017DE54(u8 arg0, u8* arg1) +{ + u8* p; + s32 count; + + if (arg0 & 0x20) { + return 0; + } + if (arg0 & 0x10) { + count = 0; + if ((s32) arg1[0] != 0x21) { + count = 1; + } + p = &arg1[1]; + if ((s32) *p != 0x21) { + count += 1; + } + if ((s32) p[1] != 0x21) { + count += 1; + } + return 3 - count; + } + if (arg0 & 2) { + return 2; + } + return 0; +} + +Unk1PData* fn_8017DEC8(int arg0) +{ + switch (arg0) { + case 0: + return &gm_GetAdventureData()->x0; + case 1: + return &gm_GetAllStarData()->x0; + case 2: + return &gm_80473A18.x0; + default: + return NULL; + } +} + +Unk1PData* fn_8017DF28(void) +{ + switch (gm_GetCurrentGameMode()) { + case GM_CLASSIC: + return &gm_GetAllStarData()->x0; + case GM_ADVENTURE: + return &gm_GetAdventureData()->x0; + case GM_ALLSTAR: + return &gm_80473A18.x0; + default: + return NULL; + } +} + +u8 fn_8017DF90(void) +{ + switch (gm_GetCurrentGameMode()) { + case GM_CLASSIC: + return 1; + case GM_ADVENTURE: + return 0; + case GM_ALLSTAR: + return 2; + default: + return 3; + } +} + +int gm_8017DFF4(int arg0) +{ + Unk1PData* var_r3 = fn_8017DEC8(arg0); + if (var_r3 != NULL) { + return var_r3->cpu_level; + } + return -1; +} + +int gm_8017E068(void) +{ + Unk1PData* var_r3 = fn_8017DF28(); + if (var_r3 != NULL) { + return var_r3->cpu_level; + } + return -1; +} + +int fn_8017E0E4(void) +{ + Unk1PData* var_r3 = fn_8017DF28(); + if (var_r3 != NULL) { + return var_r3->xC.xC; + } + return -1; +} + +bool fn_8017E160(void) +{ + Unk1PData* var_r3 = fn_8017DF28(); + struct Unk1PData_xC* temp_r3_2; + + if (var_r3 != NULL) { + int i; + for (i = 0; i < 3; i++) { + if (var_r3->xC.x24[i].ckind != CHKIND_NONE) { + return true; + } + } + return false; + } + return false; +} + +void fn_8017E21C(void) +{ + int i; + for (i = 0; i < 12; i++) { + lbl_804706D8[i].x0 = -1; + } +} + +s8 gm_8017E280(u16 arg0, u32 arg1) +{ + lbl_804706D8_t* var_r7 = lbl_804706D8; + s32 index; + index = 0; + for (index = 0; index < 12; index++) { + if (arg0 == var_r7[index].x0) { + var_r7[index].x2 += arg1; + return var_r7[index].x2; + } + } + index = 0; + for (index = 0; index < 12; index++) { + if (var_r7[index].x0 == -1) { + var_r7[index].x0 = arg0; + var_r7[index].x2 = arg1; + return (u8) arg1; + } + } + return -1; +} + +int fn_8017E318(void) +{ + int i; + int sum = 0; + for (i = 0; i < 12; i++) { + if (lbl_804706D8[i].x0 != -1) { + sum += lbl_804706D8[i].x2; + } + } + return sum; +} + +void fn_8017E3C8(void) +{ + int i = 0; + PAD_STACK(8); + for (i = 0; i < 12; i++) { + if (lbl_804706D8[i].x0 != -1) { + Toy_SetUnlockState(lbl_804706D8[i].x0, lbl_804706D8[i].x2); + } + } +} diff --git a/src/melee/gm/gm_17C9.h b/src/melee/gm/gm_17C9.h new file mode 100644 index 0000000000..b92ff355e8 --- /dev/null +++ b/src/melee/gm/gm_17C9.h @@ -0,0 +1,42 @@ +#ifndef MELEE_GM_GM_17C9_H +#define MELEE_GM_GM_17C9_H + +#include +#include + +#include +#include +#include + +/* 17C984 */ void gm_8017C984(UNK_T); +/* 17C9A8 */ void gm_8017C9A8(DebugGameOverData*, Unk1PData*, u8); +/* 17CA38 */ UNK_RET gm_8017CA38(DebugGameOverData*, Unk1PData*, + struct gmm_x0_528_t*, u8); +/* 17CBAC */ UNK_RET gm_8017CBAC(UnkAdventureData*, struct gmm_x0_528_t*, u8); +/* 17CD94 */ u8 gm_8017CD94(UnkAdventureData*, int, int, int); +/* 17CE34 */ s32 gm_8017CE34(StartMeleeData*, UnkAdventureData*, s8*, u8, u8, + u8, s32, InternalStageId, s32 count, s32); +/* 17D7AC */ bool gm_8017D7AC(MatchExitInfo*, Unk1PData*, u8); +/* 17D9C0 */ s32 fn_8017D9C0(u8*, u8*); +/* 17DB58 */ void gm_8017DB58(struct Unk1PData_x24*); +/* 17DB6C */ u8 gm_8017DB6C(gm_8017DB6C_arg0_t*, int); +/* 17DB78 */ u8 gm_8017DB78(gm_8017DB6C_arg0_t*, int); +/* 17DB88 */ s32 gm_8017DB88(void*, u8, s32, s32, u8*, u8, + u8 (*)(s32, s32, u8), u8 (*)(s32, s32, u8), + u8 (*)(s32, s32, u8), f32 (*)(s32, s32), + f32 (*)(s32, s32)); +/* 17DD7C */ s32 fn_8017DD7C(PlayerInitData*, Unk1PData_x24*, u8); +/* 17DE54 */ s32 fn_8017DE54(u8, u8*); +/* 17DEC8 */ Unk1PData* fn_8017DEC8(int); +/* 17DF28 */ Unk1PData* fn_8017DF28(void); +/* 17DF90 */ u8 fn_8017DF90(void); +/* 17DFF4 */ int gm_8017DFF4(int); +/* 17E068 */ bool gm_8017E068(void); +/* 17E0E4 */ int fn_8017E0E4(void); +/* 17E160 */ bool fn_8017E160(void); +/* 17E21C */ void fn_8017E21C(void); +/* 17E280 */ s8 gm_8017E280(u16, u32); +/* 17E318 */ int fn_8017E318(void); +/* 17E3C8 */ void fn_8017E3C8(void); + +#endif diff --git a/src/melee/gm/gm_17E4.c b/src/melee/gm/gm_17E4.c new file mode 100644 index 0000000000..5aec8cfa51 --- /dev/null +++ b/src/melee/gm/gm_17E4.c @@ -0,0 +1,324 @@ +#include "gm_17E4.h" + +#include "gm_17C0.h" +#include "gm_17C9.h" +#include "platform.h" + +#include "baselib/forward.h" + +#include "dolphin/pad.h" + +#include "gm/forward.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static UnkAdventureData lbl_80472C30; + +UnkAdventureData* gm_GetAdventureData(void) +{ + return &lbl_80472C30; +} + +u8 gm_8017E430(void) +{ + return gm_GetAdventureData()->x0.slot; +} + +u8 gm_8017E440(void) +{ + UnkAdventureData* r31 = gm_GetAdventureData(); + if (gm_801677F8(r31->x0.slot, r31->x0.x4) == false) { + return 4; + } + return r31->x0.slot; +} + +u8 gm_8017E48C(GameScene* scene) +{ + u8 count = 0; + int i; + for (i = 0; scene->idx != gm_803DE1B8_Scenes[i].idx; i++) { + if (gm_803DE1B8_Scenes[i].info.class_id == GS_VS) { + count++; + } + } + return count; +} + +struct gm_803DE650_t* gm_8017E4C4(u8 arg0) +{ + struct gm_803DE650_t* ptr; + for (ptr = gm_803DE650; ptr->x0 != 0xFF; ptr++) { + if (ptr->x0 == arg0) { + return ptr; + } + } + return NULL; +} + +/// Get adventure stage kind for given difficulty and stage slot. +/// The (u8) cast on difficulty is required - these functions are called +/// via function pointers typed as f32(*)(int, u8) in UnkAdventureData. +u8 gm_8017E500(u8 difficulty, u8 stage_slot) +{ + return lbl_803D7AC0.entries[stage_slot + difficulty * 5].stage_kind; +} + +f32 gm_8017E528(u8 difficulty, u8 stage_slot) +{ + return lbl_803D7AC0.entries[stage_slot + difficulty * 5].scale0_pct / + 100.0F; +} + +f32 gm_8017E578(u8 difficulty, u8 stage_slot) +{ + return lbl_803D7AC0.entries[stage_slot + difficulty * 5].scale1_pct / + 100.0F; +} + +u8 gm_8017E5C8(u8 difficulty, u8 stage_slot, u8 arg2) +{ + return lbl_803D7AC0.entries[stage_slot + difficulty * 5].pad_6[arg2 * 3]; +} + +u8 gm_8017E5FC(u8 difficulty, u8 stage_slot, u8 arg2) +{ + return lbl_803D7AC0.entries[stage_slot + difficulty * 5] + .pad_6[1 + arg2 * 3]; +} + +u8 gm_8017E630(u8 difficulty, u8 stage_slot, u8 arg2) +{ + return lbl_803D7AC0.entries[stage_slot + (u8) difficulty * 5] + .pad_6[arg2 * 3 + 2]; +} + +f32 gm_8017E664(u8 difficulty, u8 stage_slot) +{ + return lbl_803D7AC0.entries[stage_slot + difficulty * 5].scale0_pct / + 100.0F; +} + +f32 gm_8017E6B4(u8 difficulty, u8 stage_slot) +{ + return lbl_803D7AC0.entries[stage_slot + difficulty * 5].scale1_pct / + 100.0F; +} + +u8 gm_8017E704(u8 difficulty, u8 stage_slot, u8 arg2) +{ + return lbl_803D7AC0.entries[stage_slot + difficulty * 5] + .pad_6[0x0E + arg2 * 3]; +} + +u8 gm_8017E738(u8 difficulty, u8 stage_slot, u8 arg2) +{ + return lbl_803D7AC0.entries[stage_slot + difficulty * 5] + .pad_6[0xF + arg2 * 3]; +} + +u8 gm_8017E76C(u8 difficulty, u8 stage_slot, u8 arg2) +{ + return lbl_803D7AC0.entries[stage_slot + difficulty * 5] + .pad_6[0x10 + (arg2 * 3)]; +} + +void gm_8017E7A0(u8 matchResult) +{ + if (matchResult == OUTCOME_TIMEOUT) { + Player_LoseStock(0); + ifStatus_802F6948(0); + ifStatus_802F6E3C(0); + } +} + +bool gm_8017E7E0(void) +{ + return gm_GetAdventureData()->x7C == 0x14; +} + +void gm_8017E7FC(u8 matchResult) +{ + UnkAdventureData* r31 = gm_GetAdventureData(); + bool cond; + + if (gm_GetCurrentGameMode() == GM_ADVENTURE && r31->x0.cpu_level >= 2 && + r31->x0.xC.x20 + gm_8016AEDC() < 0xFD20U) + { + cond = true; + } else { + cond = false; + } + + if (!cond) { + struct StartMeleeRules* rules = gm_GetRules(); + rules->x4_5 = 1; + r31->x77 = 0; + gm_SetPendingSceneIndex(0x5A); + } else { + r31->x77 = 1; + gm_SetPendingSceneIndex(0x5A); + } +} + +typedef struct { + u8 b7 : 1, b6 : 1, b5 : 1, b4 : 1, b3 : 1, b2 : 1, b1 : 1, b0 : 1; +} u8_bits; + +#pragma dont_inline on +void fn_8017E8A4(int arg0_int) +{ + MatchEnd* arg0 = (MatchEnd*) arg0_int; + lbl_8046B6A0_t* gm = gm_16AE_GetUnkData_0(); + struct gm_803DE650_t* stage = gm_8017E4C4(gm_GetCurrentSceneIndex()); + UnkAdventureData* adv = &lbl_80472C30; + u8* flags = arg0->_x448; + gmm_x0_528_t* main_data; + u32 total_time; + int i; + + if (fn_8017E318() > 0) { + ((u8_bits*) &flags[2])->b3 = 1; + } + + if (gm->x24C8.x4_5) { + main_data = gmMainLib_8015CDD4(); + total_time = adv->x0.xC.x20 + gm_8016AEDC(); + ((u8_bits*) &flags[0])->b6 = 1; + + if ((u8) adv->x0.cpu_level == 4) { + ((u8_bits*) &flags[0])->b3 = 1; + } + + if (total_time < 0xC4E0U) { + ((u8_bits*) &flags[2])->b6 = 1; + } else if (total_time < 0x13560U) { + ((u8_bits*) &flags[2])->b7 = 1; + } + + if ((u32) adv->x0.xC.x1C == 0U && + (u32) arg0->player_standings[0].x44 == 0U) + { + ((u8_bits*) &flags[1])->b1 = 1; + } + + if ((u8) adv->x0.xC.xE != 0) { + ((u8_bits*) &flags[2])->b5 = 1; + } + + if ((u8) adv->x0.xC.xF != 0) { + ((u8_bits*) &flags[2])->b4 = 1; + } + + if ((u8) adv->x0.xC.xD != 0) { + ((u8_bits*) &flags[1])->b0 = 1; + } else if ((s8) arg0->player_standings[0].stocks == + (s32) main_data->stocks) + { + ((u8_bits*) &arg0->_x448[1])->b2 = 1; + } + } + + if (stage->x0 == 3) { + for (i = 0; i < 6; i++) { + if (Player_GetPlayerSlotType(i) == Gm_PKind_Cpu && + Player_GetPlayerCharacter(i) == CKIND_LUIGI) + { + ((u8_bits*) &flags[1])->b7 = 1; + return; + } + } + } + + if (stage->x0 == 0x11) { + if (gm->unk_C >= 5) { + ((u8_bits*) &flags[1])->b6 = 1; + return; + } + } + + if (stage->x0 == 0x25) { + ((u8_bits*) &flags[1])->b5 = 1; + return; + } else if (stage->x0 == 0x53) { + for (i = 0; i < 6; i++) { + if (Player_GetPlayerSlotType(i) == Gm_PKind_Cpu && + Player_GetPlayerCharacter(i) == CKIND_LUIGI) + { + ((u8_bits*) &flags[1])->b4 = 1; + return; + } + } + } + + if (stage->x0 == 0x5C) { + ((u8_bits*) &flags[1])->b3 = 1; + } + + PAD_STACK(8); +} +#pragma dont_inline reset diff --git a/src/melee/gm/gm_17E4.h b/src/melee/gm/gm_17E4.h new file mode 100644 index 0000000000..194c83174f --- /dev/null +++ b/src/melee/gm/gm_17E4.h @@ -0,0 +1,29 @@ +#ifndef MELEE_GM_GM_17E4_H +#define MELEE_GM_GM_17E4_H + +#include + +#include + +/* 17E424 */ UnkAdventureData* gm_GetAdventureData(void); +/* 17E430 */ u8 gm_8017E430(void); ///< returns a player slot +/* 17E440 */ u8 gm_8017E440(void); +/* 17E48C */ u8 gm_8017E48C(GameScene*); +/* 17E4C4 */ struct gm_803DE650_t* gm_8017E4C4(u8); +/* 17E500 */ u8 gm_8017E500(u8, u8); +/* 17E528 */ f32 gm_8017E528(u8, u8); +/* 17E578 */ f32 gm_8017E578(u8, u8); +/* 17E5C8 */ u8 gm_8017E5C8(u8, u8, u8); +/* 17E5FC */ u8 gm_8017E5FC(u8, u8, u8); +/* 17E630 */ u8 gm_8017E630(u8, u8, u8); +/* 17E664 */ f32 gm_8017E664(u8, u8); +/* 17E6B4 */ f32 gm_8017E6B4(u8, u8); +/* 17E704 */ u8 gm_8017E704(u8, u8, u8); +/* 17E738 */ u8 gm_8017E738(u8, u8, u8); +/* 17E76C */ u8 gm_8017E76C(u8, u8, u8); +/* 17E7A0 */ void gm_8017E7A0(u8); +/* 17E7E0 */ bool gm_8017E7E0(void); +/* 17E7FC */ void gm_8017E7FC(u8); +/* 17E8A4 */ void fn_8017E8A4(int); + +#endif diff --git a/src/melee/gm/gm_17EB.c b/src/melee/gm/gm_17EB.c new file mode 100644 index 0000000000..5703fbd206 --- /dev/null +++ b/src/melee/gm/gm_17EB.c @@ -0,0 +1,248 @@ +#include "gm_17EB.h" + +#include "gm_17C0.h" +#include "gm_17C9.h" +#include "platform.h" + +#include "baselib/forward.h" + +#include "dolphin/pad.h" + +#include "gm/forward.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +typedef struct { + u8 b7 : 1, b6 : 1, b5 : 1, b4 : 1, b3 : 1, b2 : 1, b1 : 1, b0 : 1; +} u8_bits; + +typedef struct { + Unk1PData x0; + u8 (*x48)(u8, u8); + u8 (*x4C)(u8, u8, u8); + u8 (*x50)(u8, u8, u8); + u8 (*x54)(u8, u8, u8); + u8 (*x58)(u8, u8, u8); + u8 (*x5C)(u8, u8, u8); + u8 (*x60)(u8, u8, u8); + float (*x64)(u8, u8); + float (*x68)(u8, u8); + float (*x6C)(u8, u8); + float (*x70)(u8, u8); + u16 x74; +} RegClearAllstarData; +STATIC_ASSERT(sizeof(RegClearAllstarData) == 0x78); + +static RegClearAllstarData lbl_80472CB0; + +UnkAllstarData* gm_GetAllStarData(void) +{ + return (UnkAllstarData*) &lbl_80472CB0; +} + +u8 gm_8017EB3C(u8 difficulty, u8 stage_slot) +{ + return lbl_803D85F0.entries[stage_slot + difficulty * 5].stage_kind; +} + +u8 gm_8017EB64(u8 difficulty, u8 stage_slot, u8 arg2) +{ + return lbl_803D85F0.entries[stage_slot + difficulty * 5].pad_6[arg2 * 3]; +} + +u8 gm_8017EB98(u8 difficulty, u8 stage_slot, u8 arg2) +{ + return lbl_803D85F0.entries[stage_slot + difficulty * 5] + .pad_6[arg2 * 3 + 1]; +} + +u8 gm_8017EBCC(u8 difficulty, u8 stage_slot, u8 arg2) +{ + return lbl_803D85F0.entries[stage_slot + difficulty * 5] + .pad_6[arg2 * 3 + 2]; +} + +f32 gm_8017EC00(u8 difficulty, u8 stage_slot) +{ + return lbl_803D85F0.entries[stage_slot + difficulty * 5].scale2_pct / + 100.0F; +} + +f32 gm_8017EC50(u8 difficulty, u8 stage_slot) +{ + return lbl_803D85F0.entries[stage_slot + difficulty * 5].scale3_pct / + 100.0F; +} + +u8 gm_8017ECA0(u8 difficulty, u8 stage_slot, u8 arg2) +{ + return lbl_803D85F0.entries[stage_slot + difficulty * 5].pad_14[arg2 * 3]; +} + +u8 gm_8017ECD4(u8 difficulty, u8 stage_slot, u8 arg2) +{ + return lbl_803D85F0.entries[stage_slot + ((u8) difficulty * 5)] + .pad_14[arg2 * 3 + 1]; +} + +u8 gm_8017ED08(u8 difficulty, u8 stage_slot, u8 arg2) +{ + return lbl_803D85F0.entries[stage_slot + ((u8) difficulty * 5)] + .pad_14[arg2 * 3 + 2]; +} + +f32 gm_8017ED3C(u8 difficulty, u8 stage_slot) +{ + return lbl_803D85F0.entries[stage_slot + difficulty * 5].scale0_pct / + 100.0F; +} + +f32 gm_8017ED8C(u8 difficulty, u8 stage_slot) +{ + return lbl_803D85F0.entries[stage_slot + difficulty * 5].scale1_pct / + 100.0F; +} + +bool fn_8017EDDC(void) +{ + UnkAllstarData* p; + + if (gm_GetCurrentGameMode() == GM_CLASSIC) { + p = gm_GetAllStarData(); + if (p->x0.xC.xD == 0 && p->x0.cpu_level >= 2 && p->x0.xC.x20 < 0x5208) + { + return true; + } + } + return false; +} + +#pragma dont_inline on +void fn_8017EE40(int arg0_int) +{ + MatchEnd* arg0 = (MatchEnd*) arg0_int; + struct StartMeleeRules* rules; + RegClearAllstarData* allstar; + gmm_x0_528_t* main_data; + u32 total_time; + int i; + + rules = gm_GetRules(); + allstar = &lbl_80472CB0; + + if (fn_8017E318() > 0) { + ((u8_bits*) &arg0->_x448[2])->b3 = 1; + } + + if (rules->x4_5) { + main_data = gmMainLib_8015CDC8(); + total_time = allstar->x0.xC.x20 + gm_8016AEDC(); + ((u8_bits*) &arg0->_x448[0])->b7 = 1; + + if ((u8) allstar->x0.cpu_level == 4) { + ((u8_bits*) &arg0->_x448[0])->b4 = 1; + } + + if (total_time < 0x3840U) { + ((u8_bits*) &arg0->_x448[2])->b6 = 1; + } else if (total_time < 0x5460U) { + ((u8_bits*) &arg0->_x448[2])->b7 = 1; + } + + if ((u32) allstar->x0.xC.x1C == 0U && + (u32) arg0->player_standings[0].x44 == 0U) + { + ((u8_bits*) &arg0->_x448[1])->b1 = 1; + } + + if ((u8) allstar->x0.xC.xE != 0) { + ((u8_bits*) &arg0->_x448[2])->b5 = 1; + } + + if ((u8) allstar->x0.xC.xF != 0) { + ((u8_bits*) &arg0->_x448[2])->b4 = 1; + } + + if ((u8) allstar->x0.xC.xD != 0) { + ((u8_bits*) &arg0->_x448[1])->b0 = 1; + } else if ((s8) arg0->player_standings[0].stocks == + (s32) main_data->stocks) + { + ((u8_bits*) &arg0->_x448[1])->b2 = 1; + } + } + + for (i = 0; i < 6; i++) { + if (Player_GetPlayerSlotType(i) == Gm_PKind_Cpu && + Player_GetPlayerCharacter(i) == CKIND_CREZYH) + { + ((u8_bits*) &arg0->_x448[0])->b0 = 1; + return; + } + } +} +#pragma dont_inline reset diff --git a/src/melee/gm/gm_17EB.h b/src/melee/gm/gm_17EB.h new file mode 100644 index 0000000000..03df06a5d8 --- /dev/null +++ b/src/melee/gm/gm_17EB.h @@ -0,0 +1,23 @@ +#ifndef MELEE_GM_GM_17EB_H +#define MELEE_GM_GM_17EB_H + +#include + +#include + +/* 17EB30 */ UnkAllstarData* gm_GetAllStarData(void); +/* 17EB3C */ u8 gm_8017EB3C(u8, u8); +/* 17EB64 */ u8 gm_8017EB64(u8, u8, u8); +/* 17EB98 */ u8 gm_8017EB98(u8, u8, u8); +/* 17EBCC */ u8 gm_8017EBCC(u8, u8, u8); +/* 17EC00 */ f32 gm_8017EC00(u8, u8); +/* 17EC50 */ f32 gm_8017EC50(u8, u8); +/* 17ECA0 */ u8 gm_8017ECA0(u8, u8, u8); +/* 17ECD4 */ u8 gm_8017ECD4(u8, u8, u8); +/* 17ED08 */ u8 gm_8017ED08(u8, u8, u8); +/* 17ED3C */ f32 gm_8017ED3C(u8, u8); +/* 17ED8C */ f32 gm_8017ED8C(u8, u8); +/* 17EDDC */ bool fn_8017EDDC(void); +/* 17EE40 */ void fn_8017EE40(int); + +#endif diff --git a/src/melee/gm/gm_1832.h b/src/melee/gm/gm_1832.h index b632a55132..17ddcc0732 100644 --- a/src/melee/gm/gm_1832.h +++ b/src/melee/gm/gm_1832.h @@ -7,6 +7,8 @@ #include +/* 18325C */ void fn_8018325C(HSD_GObj*, int); +/* 184138 */ void fn_80184138(HSD_GObj*, int); /* 1849E0 */ void fn_801849E0(HSD_GObj*); /* 184A04 */ void fn_80184A04(HSD_GObj*); /* 184A28 */ void fn_80184A28(HSD_GObj*); diff --git a/src/melee/gm/gm_unsplit.h b/src/melee/gm/gm_unsplit.h index b907fdf2c2..77f9599981 100644 --- a/src/melee/gm/gm_unsplit.h +++ b/src/melee/gm/gm_unsplit.h @@ -16,6 +16,9 @@ #include // IWYU pragma: export #include // IWYU pragma: export #include // IWYU pragma: export +#include // IWYU pragma: export +#include // IWYU pragma: export +#include // IWYU pragma: export #include // IWYU pragma: export #include // IWYU pragma: export #include // IWYU pragma: export diff --git a/src/melee/gm/gmadventure.c b/src/melee/gm/gmadventure.c index 75116afc46..406fc3e024 100644 --- a/src/melee/gm/gmadventure.c +++ b/src/melee/gm/gmadventure.c @@ -1,5 +1,6 @@ #include "gmadventure.h" +#include "gm_17C0.h" #include "gm_unsplit.h" #include diff --git a/src/melee/gm/gmregclear.c b/src/melee/gm/gmregclear.c index c262fe7569..8aae8c07f5 100644 --- a/src/melee/gm/gmregclear.c +++ b/src/melee/gm/gmregclear.c @@ -1,5 +1,7 @@ #include "gmregclear.h" +#include "gm_17C0.h" +#include "gm_17C9.h" #include "platform.h" #include "baselib/forward.h" @@ -74,14 +76,6 @@ #include #include -typedef struct lbl_804706D8_t { - s16 x0; - u8 x2; - u8 x3; -} lbl_804706D8_t; - -lbl_804706D8_t lbl_804706D8[12]; - struct lbl_80472D28_t { /* +0 */ char pad_0[0x20]; /* +20 */ HSD_JObj* x20; @@ -146,69 +140,12 @@ struct lbl_80472E48_t { }; /* size = 0x80 */ STATIC_ASSERT(sizeof(struct lbl_80472E48_t) == 0x80); -/// Adventure mode stage data table entry (size 0x1A) -/// Table has 110 entries: 22 stages × 5 difficulty levels -/// Indexed as: difficulty * 5 + stage_slot -typedef struct AdventureStageEntry { - /* 0x00 */ u8 stage_kind; - /* 0x01 */ u8 pad_1; - /* 0x02 */ u16 scale0_pct; ///< Divided by 100 to get ratio - /* 0x04 */ u16 scale1_pct; ///< Divided by 100 to get ratio - /* 0x06 */ u8 pad_6[0x14]; -} AdventureStageEntry; -STATIC_ASSERT(sizeof(AdventureStageEntry) == 0x1A); - -/// Allstar mode stage data table entry (size 0x1A) -/// Table has 55 entries: 11 stages × 5 difficulty levels -typedef struct AllstarStageEntry { - /* 0x00 */ u8 stage_kind; - /* 0x01 */ u8 pad_1; - /* 0x02 */ u16 scale0_pct; ///< Divided by 100 to get ratio - /* 0x04 */ u16 scale1_pct; ///< Divided by 100 to get ratio - /* 0x06 */ u8 pad_6[0xA]; - /* 0x10 */ u16 scale2_pct; ///< Divided by 100 to get ratio - /* 0x12 */ u16 scale3_pct; ///< Divided by 100 to get ratio - /* 0x14 */ u8 pad_14[0x6]; -} AllstarStageEntry; -STATIC_ASSERT(sizeof(AllstarStageEntry) == 0x1A); - -extern AdventureStageEntry lbl_803D7AC0[110]; -extern AllstarStageEntry lbl_803D85F0[55]; -u16 lbl_803D8B88[] = { 0x18, 0x16, 0x12, 0x3, 0x5, 0x4, 0x6, 0x1a, 0x19, 0x7 }; - -/// @todo .data order hack -static void order_data(void) -{ - (void) "GmRegClr"; - (void) "ScGamRegClear_scene_data"; - (void) "Error : Cannot open archive file (File Name : %s)."; - (void) "SdDec.usd"; - (void) "SIS_DecisionData"; - (void) "SdDec.dat"; - (void) " "; - (void) " "; - (void) "Error : gobj don\'t get (gmRegClearAddModel)\n"; - (void) "gmregclear.c"; - (void) "Error : jobj don\'t get (gmRegClearAddModel)\n"; -} - typedef struct RegClearEv { /* 0x00 */ char pad_0[0x1C]; /* 0x1C */ HSD_ImageDesc* x1C; /* 0x20 */ f32 x20; } RegClearEv; -static struct lbl_804706C0_t { - int x0; - int x4; - int x8; - int xC; // HP (stamina) - int x10; - int x14; -} lbl_804706C0; - -static UnkAdventureData lbl_80472C30; -static UnkAllstarData lbl_80472CB0; static struct lbl_80472D28_t lbl_80472D28; static struct lbl_80472E48_t lbl_80472E48; static int lbl_80472EC8[4]; @@ -222,15 +159,6 @@ typedef struct RegClearSpawnEntry { /* 0x0C */ f32 xC; } RegClearSpawnEntry; -typedef struct RegClearCharEntry { - /* 0x00 */ u8 x0; - /* 0x01 */ u8 x1; - /* 0x02 */ u8 x2; - /* 0x03 */ u8 x3; - /* 0x04 */ f32 x4; - /* 0x08 */ f32 x8; -} RegClearCharEntry; - typedef struct RegClearRecordState { /* 0x00 */ u8 x0; /* 0x01 */ u8 pad_1; @@ -268,1577 +196,22 @@ STATIC_ASSERT(sizeof(lbl_80472ED8_t) == 0x6BC); lbl_80472ED8_t lbl_80472ED8; -void fn_8017C0C8(void) -{ - PlayerInitData sp8; - gm_8016795C(&sp8); - sp8.slot_type = Gm_PKind_Cpu; - sp8.stocks = 1; - sp8.xE = 4; - sp8.cpu_level = Player_GetCpuLevel(2); - sp8.xE = Player_GetCpuType(2); - sp8.x18 = Player_GetAttackRatio(2); - sp8.x1C = Player_GetUnk50(2); - sp8.color = 0; - sp8.c_kind = CKIND_CREZYH; - sp8.team = 4; - sp8.xC_b7 = true; - sp8.hp = lbl_804706C0.xC; - sp8.xD_b2 = true; - sp8.xD_b0 = true; - sp8.xD_b2 = true; - sp8.spawn_dir = 1; - gm_8016EDDC(1, &sp8); -} - -void fn_8017C1A4(HSD_GObj* unused) -{ - struct lbl_804706C0_t* tmp = &lbl_804706C0; - int temp_r29; - int temp_r29_2; - int temp_r28; - int temp_r27; - int temp_r27_2; - int temp_r31; - int temp_r3; - int temp_r3_3; - lbl_8046B6A0_t* temp_r3_2; - lbl_8046B6A0_t* temp_r3_4; - PAD_STACK(8); - - temp_r31 = ftBossLib_8015C74C(); - temp_r29 = ftBossLib_8015C7EC(); - temp_r27 = ftBossLib_8015C88C(); - temp_r3 = ftBossLib_8015C9CC(); - switch (tmp->x0) { - case 0: - if (tmp->x8 == 0) { - temp_r3_2 = gm_16AE_GetUnkData_0(); - temp_r3_2->x24C8.disable_pausing = false; - temp_r3_2->hud_enabled = 0; - lbAudioAx_800237A8(0x81650, 0x7F, 0x40); - ftLib_80086824(); - tmp->x8 = 1; - } else if (ftBossLib_8015C270() == 0) { - tmp->x0 = 2; - } - break; - case 1: - if (tmp->x8 == 0) { - gm_16AE_GetUnkData_0(); - lbAudioAx_800236DC(); - ftBossLib_8015CA6C(0x1D9); - Player_SetMoreFlagsBit4(0, 1); - Player_SetMoreFlagsBit3(0, 1); - tmp->x10 = ft_80087C58(Player_GetEntity(0)); - ft_80087C64(Player_GetEntity(0), 2); - tmp->x14 = ft_80087C58(Player_GetEntity(2)); - ft_80087C64(Player_GetEntity(2), 2); - tmp->x8 = 1; - } else if (tmp->x8 == 1) { - lbAudioAx_800237A8(0x81651, 0x7F, 0x40); - fn_8017C0C8(); - tmp->x8 = 2; - } else if (ftBossLib_8015C2A8() == 0) { - gm_16AE_GetUnkData_0(); - Stage_80225074(0); - ftBossLib_8015CB7C(); - Player_SetMoreFlagsBit4(0, 0); - Player_SetMoreFlagsBit3(0, 0); - ft_80087C64(Player_GetEntity(0), tmp->x10); - ft_80087C64(Player_GetEntity(2), tmp->x14); - ftBossLib_8015CC14(); - tmp->x0 = 4U; - } - break; - case 2: - temp_r3_4 = gm_16AE_GetUnkData_0(); - temp_r3_4->hud_enabled = 1; - Stage_80225074(0); - ftLib_800868A4(); - ftBossLib_8015CC14(); - tmp->x0 = 3; - break; - case 3: - if (Player_GetRemainingHP(2) <= 0) { - tmp->x0 = 7; - tmp->x8 = 0; - } else if (Player_GetRemainingHP(2) <= 0.5F * tmp->xC && fn_8017EDDC()) - { - tmp->x0 = 1; - tmp->x8 = 0; - } - break; - case 4: - if (Player_GetRemainingHP(2) <= 0 && Player_GetRemainingHP(1) <= 0) { - tmp->x0 = 7; - tmp->x8 = 0; - } else if (Player_GetRemainingHP(2) <= 0 || - Player_GetRemainingHP(1) <= 0) - { - tmp->x0 = 6; - tmp->x8 = 0; - } - break; - case 5: - if (Player_GetRemainingHP(2) <= 0 && Player_GetRemainingHP(1) <= 0) { - tmp->x0 = 7; - tmp->x8 = 0; - } - break; - case 6: - if (Player_GetRemainingHP(2) <= 0) { - tmp->x4 = 2; - } else { - tmp->x4 = 1; - } - temp_r27_2 = temp_r31 + temp_r29; - if (tmp->x8 == 0) { - ftBossLib_8015CB9C(tmp->x4); - gm_801A4634(6); - } else if (tmp->x8 == temp_r31) { - lbAudioAx_8002438C(0x4E200); - ftBossLib_8015CC14(); - gm_801A4674(6); - gm_SetGameSpeed(0.5f); - } else if (tmp->x8 >= temp_r27_2) { - gm_SetGameSpeed(1.0f); - tmp->x0 = 5; - } - if (Player_GetRemainingHP(2) <= 0 && Player_GetRemainingHP(1) <= 0) { - tmp->x0 = 7; - tmp->x8 = 0; - } else if (tmp->x8 <= temp_r27_2) { - tmp->x8++; - } - break; - case 7: - temp_r28 = temp_r31 + temp_r27; - temp_r29_2 = temp_r3 + temp_r28; - if (tmp->x8 == 0) { - temp_r3_4 = gm_16AE_GetUnkData_0(); - temp_r3_4->hud_enabled = 0; - if (tmp->x4 == 2) { - tmp->x4 = 1; - } else { - tmp->x4 = 2; - } - ftBossLib_8015CB9C(tmp->x4); - gm_801A4634(6); - Player_80031790(0); - Player_80036844(0, 1); - temp_r3_4 = gm_16AE_GetUnkData_0(); - temp_r3_4->x24C8.x0_6 = false; - } else if (tmp->x8 == temp_r31) { - lbAudioAx_8002438C(0x4E200); - ftBossLib_8015CC14(); - gm_801A4674(6); - gm_SetGameSpeed(0.5f); - lbBgFlash_80020688(temp_r27); - } else if (tmp->x8 == temp_r28) { - lbBgFlash_800205F0(temp_r3); - } else if (tmp->x8 >= temp_r29_2) { - lbAudioAx_80028B90(); - gm_SetGameSpeed(1.0f); - gm_8016B33C(8); - gm_8016B328(); - break; - } - if (tmp->x8 >= temp_r31) { - lbAudioAx_80028B6C(); - } - if (tmp->x8 <= temp_r28 && tmp->x8 % 30 == 0) { - gm_80167858(Player_GetPlayerId(0), Player_GetNametagSlotID(0), 2, - 0x1E); - Camera_80030E44(3, NULL); - } - if (tmp->x8 <= temp_r29_2) { - tmp->x8++; - } - break; - } -} - -void fn_8017C71C(void) -{ - struct lbl_804706C0_t* tmp = &lbl_804706C0; - HSD_GObj_SetupProc(GObj_Create(0xF, 0x11, 0), fn_8017C1A4, 0x15); - tmp->x0 = 0; - tmp->x4 = 1; - tmp->x8 = 0; - tmp->xC = ftBossLib_8015C530(gm_8017E068()); - Player_SetOtherStamina(2, tmp->xC); - ftLib_80087508(FTKIND_CREZYH, 0); -} - -void fn_8017C7A0(void) -{ - lbBgFlash_8002063C(0x30); - if (Ground_801C1DAC()) { - gm_8016B350(0x7C85E); - return; - } - gm_8016B350(0x9C48); -} - -void fn_8017C7EC(void) -{ - lbl_8046B6A0_t* temp_r31; - Unk1PData* temp_r30; - - temp_r30 = fn_8017DF28(); - temp_r31 = gm_16AE_GetUnkData_1(); - temp_r31->timer_seconds = grPushOn_80219230(temp_r30->ckind); -} - -void gm_8017C838(void) -{ - s8 sp10[3]; - - lbl_8046B6A0_t* temp_r3; - int i; - s8 var_r3; - s8* var_r31; - UnkAdventureData* temp_r30; - - PAD_STACK(8); - - temp_r30 = gm_GetAdventureData(); - temp_r3 = gm_16AE_GetUnkData_0(); - var_r31 = sp10; - sp10[0] = FTKIND_NONE; - sp10[1] = FTKIND_NONE; - sp10[2] = FTKIND_NONE; - switch (temp_r3->x24C8.xE) { - case 0x3B: - sp10[0] = FTKIND_YOSHI; - break; - case 0x3F: - sp10[0] = FTKIND_LINK; - break; - case 0x44: - sp10[0] = FTKIND_KIRBY; - if (temp_r30->x0.ckind == CKIND_KIRBY && temp_r30->x0.color == 0) { - var_r3 = 1; - } else { - var_r3 = 0; - } - ftLib_80087610(var_r3); - break; - case 0x48: - sp10[0] = 0xC; - if (gm_IsCKindUnlocked(CKIND_PICHU) != 0) { - sp10[1] = FTKIND_PICHU; - } - if (gm_IsCKindUnlocked(CKIND_PURIN) != 0) { - sp10[2] = FTKIND_PURIN; - } - break; - case 0x4C: - sp10[0] = FTKIND_POPO; - sp10[1] = FTKIND_NANA; - break; - case 0x4E: - sp10[0] = FTKIND_BOY; - sp10[1] = FTKIND_GIRL; - break; - } - - for (i = 0; i < 3; i++) { - if (*var_r31 != FTKIND_MAX) { - ftLib_80087574(*var_r31); - } - var_r31++; - } - Camera_80030E34(0.2f); -} - -void gm_8017C984(UNK_T arg0) -{ - memzero(arg0, 0x74); -} - -extern u8 lbl_803B7C08[][5]; - -void gm_8017C9A8(DebugGameOverData* arg0, Unk1PData* arg1, u8 arg2) -{ - PAD_STACK(8); - arg0->x0 = arg1->xC.x18; - arg0->x8 = arg2; - arg0->ckind = arg1->ckind; - arg0->slot = arg1->slot; - arg0->x15 = arg1->x4; - arg0->x18 = gm_801623D8(); - arg0->x16 = lbl_803B7C08[arg2][arg1->cpu_level]; -} - -void gm_8017CA38(DebugGameOverData* arg0, Unk1PData* arg1, gmm_x0_528_t* arg2, - u8 arg3) -{ - u8 temp_r31; - - arg1->xC.x14 = arg0->x18; - gm_801623FC(arg1->xC.x14); - if (arg0->xC == 0) { - temp_r31 = gm_80173224(arg3, 0); - switch (gm_GetCurrentGameMode()) { - case GM_CLASSIC: - fn_80162BFC(arg1->ckind, arg0->x4); - break; - case GM_ADVENTURE: - fn_80162DF8(arg1->ckind, arg0->x4); - break; - case GM_ALLSTAR: - fn_80162FF4(arg1->ckind, arg0->x4); - break; - } - Ground_801C5A60(); - gm_8017390C(fn_8017DF90(), 0); - gm_80173EEC(); - gm_80172898(0x40); - if (temp_r31 == CHKIND_NONE) { - if (gm_80173754(1, arg1->slot) == 0) { - gm_ChangeGameModeAfterCurrentScene(GM_MENU); - } - } else { - gm_801736E8(arg1->ckind, arg1->color, arg1->slot, arg1->x4, - temp_r31, 1U); - gm_ChangeGameModeAfterCurrentScene(GM_CHALLENGER_APPROACH); - } - } else { - arg1->xC.x18 = lbTime_8000AEC8((u32) arg0->x4, 1U); - arg1->stocks = arg2->stocks; - arg1->xC.xD = lbTime_8000AF74((u32) arg1->xC.xD, 1); - gm_SetPendingSceneIndex(arg1->x7); - } -} - -void gm_8017CBAC(UnkAdventureData* arg0, gmm_x0_528_t* arg1, u8 arg2) -{ - s32 temp_r3_2; - u8 temp_r31; - u8* temp_r3; - - temp_r31 = gm_CKindToSelKind(arg0->x0.ckind); - Ground_801C5A60(); - switch (arg2) { - case 21: - gmMainLib_8015D134(temp_r31); - fn_80162BFC(arg0->x0.ckind, arg0->x0.xC.x18); - temp_r3 = gmMainLib_8015D194(temp_r31); - if (*temp_r3 < arg0->x0.cpu_level) { - *temp_r3 = arg0->x0.cpu_level; - } - temp_r3_2 = gmMainLib_8015D1AC(temp_r31); - if ((arg0->x0.cpu_level == 4) && - ((temp_r3_2 == 0) || (arg1->stocks < temp_r3_2))) - { - gmMainLib_8015D1C8(temp_r31, arg1->stocks); - } - break; - case 22: - gmMainLib_8015D25C(temp_r31); - fn_80162DF8(arg0->x0.ckind, arg0->x0.xC.x18); - temp_r3 = gmMainLib_8015D2BC(temp_r31); - if (*temp_r3 < arg0->x0.cpu_level) { - *temp_r3 = arg0->x0.cpu_level; - } - temp_r3_2 = gmMainLib_8015D2D4(temp_r31); - if ((arg0->x0.cpu_level == 4) && - ((temp_r3_2 == 0) || (arg1->stocks < temp_r3_2))) - { - gmMainLib_8015D2F0(temp_r31, arg1->stocks); - } - break; - case 23: - gmMainLib_8015D384(temp_r31); - fn_80162FF4(arg0->x0.ckind, arg0->x0.xC.x18); - if (!gm_80164430(0x1F)) { - gm_80164504(0x1F); - } - temp_r3 = gmMainLib_8015D3E4(temp_r31); - if (*temp_r3 < arg0->x0.cpu_level) { - *temp_r3 = arg0->x0.cpu_level; - } - temp_r3_2 = gmMainLib_8015D3FC(temp_r31); - if ((arg0->x0.cpu_level == 4) && - (temp_r3_2 == 0 || arg1->stocks < temp_r3_2)) - { - gmMainLib_8015D418(temp_r31, arg1->stocks); - } - break; - } - lb_8001C550(); - lb_8001D164(0); - lb_8001CE00(); - gm_SetPendingGameMode(arg2); - gm_SetNewGameModePending(); -} - -u8 gm_8017CD94(UnkAdventureData* arg0, int arg1, int arg2, int arg3) -{ - u8 num_colors; - u8 result; - - num_colors = gm_80169238(arg1); - if (arg0->x54 != NULL) { - result = arg0->x54(arg2, arg0->x0.cpu_level, arg3); - if (num_colors != 0) { - return result % num_colors; - } - return 0; - } - return 0; -} - -static inline s32 gm_8017CE34_CountEnemies(s8* arg0) -{ - s32 count = 0; - - if ((s32) (u8) arg0[0] != 0x21) { - count = 1; - } - { - s8* p = &arg0[1]; - if ((s32) *p != 0x21) { - count += 1; - } - if ((s32) p[1] != 0x21) { - count += 1; - } - } - return count; -} - -static inline void gm_8017CE34_SetupColors(UnkAdventureData* arg1, s32 count, - s8* arg2, u8* colors) -{ - s32 color_idx; - - { - u8* out_color = colors; - s8* kind_iter = arg2; - for (color_idx = 0; color_idx < 3; color_idx++) { - u8 kind = (u8) *kind_iter; - u8 num_colors = gm_80169238(kind); - u8 color_id; - if (arg1->x54 != NULL) { - u8 requested_color; - requested_color = - arg1->x54((u8) count, arg1->x0.cpu_level, (u8) color_idx); - if (num_colors != 0) { - color_id = requested_color % num_colors; - } else { - color_id = 0; - } - } else { - color_id = 0; - } - *out_color = color_id; - out_color += 1; - kind_iter += 1; - } - } -} - -s32 gm_8017CE34(StartMeleeData* arg0, UnkAdventureData* arg1, s8* arg2, - u8 arg3, u8 arg4, u8 arg5, s32 arg6, InternalStageId arg7, - s32 count, s32 arg9) -{ - u8 colors[16]; - u8 enemy_level; - s32 boss_count; - u8 enemy_cpu_type; - s32 player_idx; - f32 attack_ratio; - u8 player_stocks; - u8 player_ckind; - u8 flags; - s8* enemy_kind; - f32 defense_ratio; - u8 enemy_ckind; - s32 enemy_count; - s32 enemy_idx; - s32 sp8; - u8* color_iter; - - PAD_STACK(4); - - boss_count = 0; - enemy_level = 0; - enemy_cpu_type = 0; - arg1->x0.xC.xC = 1; - fn_8017E21C(); - fn_8016F030(arg0); - arg0->rules.x30 = 1.0f; - arg0->rules.x4_4 = 1; - - switch (arg9) { - case 0: - arg0->rules.xA = 0; - break; - case 1: - arg0->rules.xA = 3; - break; - case 2: - arg0->rules.xA = 2; - break; - } - - arg0->rules.x1_1 = 1; - arg0->rules.x4_2 = 1; - arg0->rules.x4_3 = 1; - arg0->rules.x2_5 = 0; - arg0->rules.x0_3 = arg1->x0.xB; - - if (arg6 != 0) { - arg0->rules.x10 = (u32) arg6; - arg0->rules.x0_6 = 1; - } else { - arg0->rules.x0_6 = 0; - } - - arg0->rules.x18 = (u32) arg1->x0.xC.x18; - arg0->rules.xE = (u16) arg7; - arg0->rules.xB = arg1->x48((u8) count, arg1->x0.cpu_level); - - arg0->rules.x20 = (u64) -1; - - enemy_count = gm_8017CE34_CountEnemies(arg2); - if (enemy_count == 0) { - arg0->rules.x5_1 = 1; - } - if (arg1->x0.x8 & 1) { - arg0->rules.x2_7 = 1; - } - if (arg1->x0.x8 & 0x20) { - arg0->rules.x4_5 = 1; - } - if (arg1->x0.x8 & 0x80) { - arg1->x0.xC.xC = 5; - switch ((s32) arg1->x0.x9) { - case 1: - arg0->rules.on_pause_override = gm_80165290; - arg0->rules.x9 = 1; - arg0->rules.x3_1 = 0; - arg0->players[0].xC_b1 = 0; - break; - case 2: - arg0->rules.x9 = 3; - arg0->rules.x44 = fn_8017C7EC; - break; - case 3: - arg0->rules.x9 = 2; - arg0->rules.x7 = 9; - arg0->rules.x4_4 = 0; - arg0->rules.x50 = (void (*)(u8)) fn_8017C7A0; - arg0->rules.xD = 0x30; - break; - } - } - - if ((arg1->x0.x8 & 0x80) != 0) { - player_stocks = 1; - } else { - player_stocks = arg1->x0.stocks; - } - - player_ckind = (u8) arg1->x0.ckind; - if ((player_ckind == 0x12) && ((u8) arg1->x0.xC.x12 != 0)) { - player_ckind = 0x13; - } else if (((arg1->x0.x8 & 0x80) != 0) && ((u8) arg1->x0.x9 == 1) && - ((s8) player_ckind == 0xE)) - { - player_ckind = 0x20; - } - - gm_801B0620(arg0->players, player_ckind, arg1->x0.color, player_stocks, - arg1->x0.slot); - arg0->players[0].xA = arg1->x0.x4; - arg0->players[0].spawn_dir = (s8) arg1->x0.xA; - - { - u8 team_color; - if (arg1->x58 != NULL) { - team_color = arg1->x58((u8) count, arg1->x0.cpu_level, 0); - } else { - team_color = 0; - } - - { - player_idx = - fn_8017DD7C(arg0->players, arg1->x0.xC.x24, team_color) + 1; - arg0->rules.is_teams = 1; - } - } - - attack_ratio = arg1->x64((u8) count, arg1->x0.cpu_level); - defense_ratio = arg1->x68((u8) count, arg1->x0.cpu_level); - - color_iter = colors; - gm_8017CE34_SetupColors(arg1, count, arg2, color_iter); - - { - s32 temp_r3_4 = arg1->x0.x8 & 8; - if ((temp_r3_4 != 0) && ((u8) arg1->x0.xC.x11 == 0)) { - s32 base_enemy_count; - s32 event_enemy_count; - s32 special_stage; - s32 special_enemy_mode; - u8 first_enemy; - u32 stage_flags; - - base_enemy_count = gm_8017CE34_CountEnemies(arg2); - arg1->x0.xC.xC = 3; - event_enemy_count = base_enemy_count; - special_stage = 0; - special_enemy_mode = 0; - sp8 = 0; - if (arg1->x4C != NULL) { - enemy_level = arg1->x4C((u8) count, arg1->x0.cpu_level, 0U); - } - - first_enemy = (u8) arg2[0]; - if ((s8) first_enemy != 4) { - if ((u8) (first_enemy - 0x1B) <= 1U) { - arg0->rules.x0_3 = 6; - event_enemy_count = 5; - colors[0] = 0; - special_stage = 1; - special_enemy_mode = 1; - } else if (((s8) first_enemy == 0xD) && - (((s32) arg2[1] != 0xD) || ((s32) arg2[2] != 0xD))) - { - special_enemy_mode = 2; - } - } - - { - s32 stage_id = Stage_8022519C(arg7); - stage_flags = Ground_801C5AD0(stage_id); - } - - { - u8 player_ckind = (u8) arg1->x0.ckind; - gm_8016A22C((s8) (u8) arg2[0], (s8) arg2[1], (s8) arg2[2], - colors[0], colors[1], (s32) colors[2], - special_stage, special_enemy_mode, sp8, - player_ckind, arg1->x0.color, (s32) enemy_level, - (s32) arg3, event_enemy_count, (s32) stage_flags, - (s32) arg5, (s32) arg4, attack_ratio, - defense_ratio); - } - gm_8016A21C(&arg0->rules); - arg1->x0.xC.x11 = 0; - if (arg1->x0.x8 & 4) { - fn_8016A450(); - } - if ((u8) special_enemy_mode == 1) { - fn_8016A46C(); - arg0->players[0].xC_b5 = 1; - } - } else if (temp_r3_4 != 0) { - gm_8016A21C(&arg0->rules); - arg1->x0.xC.x11 = 0; - } - } - - gmRegSetupEnemyColorTable((s8) (u8) arg1->x0.ckind, arg1->x0.color, arg2, - colors); - - enemy_idx = 0; - for (;;) { - enemy_kind = &arg2[enemy_idx]; - if ((s32) (u8) enemy_kind[0] != 0x21) { - if (arg1->x0.x8 & 8) { - if (arg1->x4C != NULL) { - enemy_level = - arg1->x4C((u8) count, arg1->x0.cpu_level, 0U); - } - if (arg1->x50 != NULL) { - enemy_cpu_type = - arg1->x50((u8) count, arg1->x0.cpu_level, 0U); - } - } else { - if (arg1->x4C != NULL) { - u8 selected_enemy_level = - arg1->x4C((u8) count, arg1->x0.cpu_level, enemy_idx); - enemy_level = selected_enemy_level; - } - if (arg1->x50 != NULL) { - enemy_cpu_type = - arg1->x50((u8) count, arg1->x0.cpu_level, enemy_idx); - } - } - gm_8016795C(&arg0->players[player_idx]); - arg0->players[player_idx].slot_type = 1; - arg0->players[player_idx].c_kind = (s8) (u8) enemy_kind[0]; - arg0->players[player_idx].stocks = 1; - arg0->players[player_idx].cpu_level = enemy_level; - arg0->players[player_idx].xE = enemy_cpu_type; - arg0->players[player_idx].x18 = attack_ratio; - arg0->players[player_idx].x1C = defense_ratio; - arg0->players[player_idx].color = *color_iter; - if (arg1->x0.x8 & 2) { - arg0->players[player_idx].x20 = 2.0f; - arg0->players[player_idx].xB = 2; - } else { - arg0->players[player_idx].x20 = 1.0f; - arg0->players[player_idx].xB = 0; - } - if (arg1->x0.x8 & 4) { - arg0->players[player_idx].xC_b2 = 1; - arg0->players[player_idx].xE = 0x1B; - } - if ((s32) arg0->players[player_idx].c_kind == 0x1D) { - arg0->players[player_idx].xC_b1 = 0; - } - enemy_ckind = (u8) arg0->players[player_idx].c_kind; - if (((s8) enemy_ckind == 0x1A) || ((s8) enemy_ckind == 0x1E)) { - arg0->players[player_idx].xC_b7 = 1; - arg0->players[player_idx].hp = 0x12C; - arg0->players[player_idx].xD_b2 = 1; - arg0->players[player_idx].xD_b0 = 1; - arg0->players[player_idx].xD_b2 = 1; - arg0->players[player_idx].spawn_dir = -1; - if ((s32) arg0->players[player_idx].c_kind == 0x1E) { - arg0->players[player_idx].slot_type = 3; - } - boss_count += 1; - } - if ((u8) arg0->rules.is_teams == 1) { - arg0->players[player_idx].team = 4; - } - player_idx += 1; - if (player_idx >= 6) { - break; - } - } else { - if (((s32) enemy_idx == 0) && ((s32) enemy_kind[1] == 0x1A)) { - arg0->players[player_idx].slot_type = 3; - player_idx += 1; - } - } - enemy_idx += 1; - color_iter += 1; - if ((s32) enemy_idx >= 3) { - break; - } - } - - { - s32 i; - for (i = player_idx; i < 6; i++) { - arg0->players[i].slot_type = 3; - } - } - - flags = arg1->x0.x8; - if (flags & 0x40) { - arg1->x0.xC.xC = 7; - } else if (flags & 1) { - if ((flags & 8) && (arg3 > 1U)) { - arg1->x0.xC.xC = 4; - } else { - arg1->x0.xC.xC = 2; - } - } - if (boss_count != 0) { - arg0->rules.x1_2 = 1; - arg0->rules.x1_3 = 1; - arg0->rules.x1_4 = 1; - arg0->rules.x0_3 = 3; - arg0->rules.disable_pausing = 1; - arg0->rules.x7 = 0; - arg0->rules.x44 = (void (*)(void)) fn_8017C71C; - arg1->x0.xC.xC = 6; - } - if (arg7 == 0x49) { - arg1->x0.xC.xC = 8; - } - return (s32) flags; -} +u16 lbl_803D8B88[] = { 0x18, 0x16, 0x12, 0x3, 0x5, 0x4, 0x6, 0x1a, 0x19, 0x7 }; -bool gm_8017D7AC(MatchExitInfo* arg0, Unk1PData* arg1, u8 arg2) -{ - u8 temp_r0; - - arg1->xC.x14 = - lbTime_8000AEC8(arg1->xC.x14, arg0->match_end.player_standings[0].xE); - gm_8016247C(arg0->match_end.player_standings[0].xE); - arg1->xC.x1C = - lbTime_8000AEC8(arg1->xC.x1C, arg0->match_end.player_standings[0].x44); - gm_80162968(arg0->match_end.frame_count / 60); - if (!(arg1->x8 & 0x80)) { - arg1->xC.x20 = - lbTime_8000AEC8(arg1->xC.x20, arg0->match_end.frame_count); - } - if (arg0->match_end.player_standings[0].character_id == 7) { - arg1->xC.x12 = 1; - } else { - arg1->xC.x12 = 0; - } - if (fn_8016B510() != 0) { - arg1->xC.xF = 1; - } - if (fn_8016B4BC() != 0) { - arg1->xC.xE = 1; - } - temp_r0 = arg0->match_end.result; - if ((temp_r0 == 7 || temp_r0 == 8) && DbLevel <= 2) { - switch (gm_GetCurrentGameMode()) { - case GM_CLASSIC: - fn_80162BFC(arg1->ckind, arg1->xC.x18); - break; - case GM_ADVENTURE: - fn_80162DF8(arg1->ckind, arg1->xC.x18); - break; - case GM_ALLSTAR: - fn_80162FF4(arg1->ckind, arg1->xC.x18); - break; - } - gm_ChangeGameModeAfterCurrentScene(GM_MENU); - return 0; - } - fn_8017E3C8(); - if (!(arg1->x8 & 0x80)) { - arg1->stocks = arg0->match_end.player_standings[0].stocks; - if (arg1->stocks != 0) { - if (arg0->match_end.result == 1) { - arg1->stocks--; - if (arg1->stocks == 0) { - gm_SetPendingSceneIndex(arg2); - return 0; - } - if (!(arg1->x8 & 0x40)) { - arg1->xC.x10++; - gm_SetPendingSceneIndex(gm_GetCurrentSceneIndex()); - return 0; - } - } - } else { - arg1->xC.x10 = 0; - gm_SetPendingSceneIndex(arg2); - return 0; - } - } - arg1->xC.x18 = arg0->x0; - arg1->xC.x10 = 0; - return 1; -} - -s32 fn_8017D9C0(u8* arg0, u8* arg1) -{ - u8* base; - u8* p; - s32 i; - s32 j; - u8 temp; - u8* dst; - u8 ch; - s32 excluded_idx; - s32 rejected_idx; - s32 len; - - p = base = lbl_803D79F0; - len = 0; - while ((s32) *p != 0x21) { - p++; - len++; - } - - p = base; - for (j = 0; j < len; j++) { - temp = *p; - dst = &base[HSD_Randi(len)]; - *p = *dst; - p++; - *dst = temp; - } - - p = base; - for (i = 0; i < len; i++) { - if (gm_IsCKindUnlocked(*p) != 0) { - ch = *p; - for (excluded_idx = 0; excluded_idx < 4; excluded_idx++) { - if ((s8) ch == (s8) arg0[excluded_idx]) { - excluded_idx = -1; - break; - } - } - if (excluded_idx != -1) { - for (rejected_idx = 0; rejected_idx < 3; rejected_idx++) { - if ((s8) ch == (s8) arg1[rejected_idx]) { - rejected_idx = -1; - break; - } - } - if (rejected_idx != -1) { - return (s32) base[i]; - } - } - } - p++; - } - - return 0x21; - PAD_STACK(8); -} - -void gm_8017DB58(struct Unk1PData_x24* arg0) -{ - int i; - for (i = 0; i < 3; i++) { - arg0[i].ckind = CHKIND_NONE; - } -} - -u8 gm_8017DB6C(gm_8017DB6C_arg0_t* arg0, int index) -{ - return arg0[index].x0; -} - -u8 gm_8017DB78(gm_8017DB6C_arg0_t* arg0, int index) -{ - return arg0[index].x1; -} - -s32 gm_8017DB88(void* arg0, u8 arg1, s32 arg2, s32 arg3, u8* arg4, u8 arg5, - u8 (*arg6)(s32, s32, u8), u8 (*arg7)(s32, s32, u8), - u8 (*arg8)(s32, s32, u8), f32 (*arg9)(s32, s32), - f32 (*arg10)(s32, s32)) -{ - u8 chars[4]; - s32 val; - f32 fval; - - { - u8* p; - RegClearCharEntry* out; - s32 i; - s32 count; - - count = fn_8017DE54(arg1, arg4); - chars[1] = 0x21; - out = arg0; - chars[2] = 0x21; - p = chars; - i = 0; - chars[3] = 0x21; - chars[0] = arg5; - for (; i < count; i++) { - p[1] = fn_8017D9C0(chars, arg4); - out->x0 = p[1]; - if (arg8 != NULL) { - val = arg8(arg3, arg2, (u8) i); - } else { - val = 0; - } - out->x1 = val; - if (arg6 != NULL) { - val = arg6(arg3, arg2, (u8) i); - } else { - val = 0; - } - out->x2 = val; - if (arg7 != NULL) { - val = arg7(arg3, arg2, (u8) i); - } else { - val = 0; - } - out->x3 = val; - if (arg9 != NULL) { - fval = arg9(arg3, arg2); - } else { - fval = 0.0f; - } - out->x4 = fval; - if (arg10 != NULL) { - fval = arg10(arg3, arg2); - } else { - fval = 0.0f; - } - out->x8 = fval; - p++; - out++; - } - for (; i < 3; i++) { - ((RegClearCharEntry*) arg0)[i].x0 = 0x21; - } - return count; - } -} - -s32 fn_8017DD7C(PlayerInitData* arg0, Unk1PData_x24* arg1, u8 arg2) -{ - s32 index = 1; - int i; - for (i = 0; i < 3; i++) { - if (arg1[i].ckind != CHKIND_NONE) { - gm_8016795C(&arg0[index]); - arg0[index].c_kind = arg1[i].ckind; - arg0[index].slot_type = 1; - arg0[index].stocks = 1; - arg0[index].team = arg0->team; - arg0[index].color = arg1[i].x1; - arg0[index].xE = arg1[i].x3; - arg0[index].cpu_level = arg1[i].x2; - arg0[index].x18 = arg1[i].x4; - arg0[index].x1C = arg1[i].x8; - arg0[index].xD_b1 = 1; - if (arg0[index].c_kind == CKIND_GKOOPS) { - arg0[index].xC_b1 = 0; - } - index++; - } - } - return index - 1; -} - -s32 fn_8017DE54(u8 arg0, u8* arg1) -{ - u8* p; - s32 count; - - if (arg0 & 0x20) { - return 0; - } - if (arg0 & 0x10) { - count = 0; - if ((s32) arg1[0] != 0x21) { - count = 1; - } - p = &arg1[1]; - if ((s32) *p != 0x21) { - count += 1; - } - if ((s32) p[1] != 0x21) { - count += 1; - } - return 3 - count; - } - if (arg0 & 2) { - return 2; - } - return 0; -} - -Unk1PData* fn_8017DEC8(int arg0) -{ - switch (arg0) { - case 0: - return &gm_GetAdventureData()->x0; - case 1: - return &gm_GetAllStarData()->x0; - case 2: - return &gm_80473A18.x0; - default: - return NULL; - } -} - -Unk1PData* fn_8017DF28(void) -{ - switch (gm_GetCurrentGameMode()) { - case GM_CLASSIC: - return &gm_GetAllStarData()->x0; - case GM_ADVENTURE: - return &gm_GetAdventureData()->x0; - case GM_ALLSTAR: - return &gm_80473A18.x0; - default: - return NULL; - } -} - -u8 fn_8017DF90(void) -{ - switch (gm_GetCurrentGameMode()) { - case GM_CLASSIC: - return 1; - case GM_ADVENTURE: - return 0; - case GM_ALLSTAR: - return 2; - default: - return 3; - } -} - -int gm_8017DFF4(int arg0) -{ - Unk1PData* var_r3 = fn_8017DEC8(arg0); - if (var_r3 != NULL) { - return var_r3->cpu_level; - } - return -1; -} - -int gm_8017E068(void) -{ - Unk1PData* var_r3 = fn_8017DF28(); - if (var_r3 != NULL) { - return var_r3->cpu_level; - } - return -1; -} - -int fn_8017E0E4(void) -{ - Unk1PData* var_r3 = fn_8017DF28(); - if (var_r3 != NULL) { - return var_r3->xC.xC; - } - return -1; -} - -bool fn_8017E160(void) -{ - Unk1PData* var_r3 = fn_8017DF28(); - struct Unk1PData_xC* temp_r3_2; - - if (var_r3 != NULL) { - int i; - for (i = 0; i < 3; i++) { - if (var_r3->xC.x24[i].ckind != CHKIND_NONE) { - return true; - } - } - return false; - } - return false; -} - -void fn_8017E21C(void) -{ - int i; - for (i = 0; i < 12; i++) { - lbl_804706D8[i].x0 = -1; - } -} - -s8 gm_8017E280(u16 arg0, u32 arg1) -{ - lbl_804706D8_t* var_r7 = lbl_804706D8; - s32 index; - index = 0; - for (index = 0; index < 12; index++) { - if (arg0 == var_r7[index].x0) { - var_r7[index].x2 += arg1; - return var_r7[index].x2; - } - } - index = 0; - for (index = 0; index < 12; index++) { - if (var_r7[index].x0 == -1) { - var_r7[index].x0 = arg0; - var_r7[index].x2 = arg1; - return (u8) arg1; - } - } - return -1; -} - -int fn_8017E318(void) -{ - int i; - int sum = 0; - for (i = 0; i < 12; i++) { - if (lbl_804706D8[i].x0 != -1) { - sum += lbl_804706D8[i].x2; - } - } - return sum; -} - -void fn_8017E3C8(void) -{ - int i = 0; - PAD_STACK(8); - for (i = 0; i < 12; i++) { - if (lbl_804706D8[i].x0 != -1) { - Toy_SetUnlockState(lbl_804706D8[i].x0, lbl_804706D8[i].x2); - } - } -} - -UnkAdventureData* gm_GetAdventureData(void) -{ - return &lbl_80472C30; -} - -u8 gm_8017E430(void) -{ - return gm_GetAdventureData()->x0.slot; -} - -u8 gm_8017E440(void) -{ - UnkAdventureData* r31 = gm_GetAdventureData(); - if (gm_801677F8(r31->x0.slot, r31->x0.x4) == false) { - return 4; - } - return r31->x0.slot; -} - -u8 gm_8017E48C(GameScene* scene) -{ - u8 count = 0; - int i; - for (i = 0; scene->idx != gm_803DE1B8_Scenes[i].idx; i++) { - if (gm_803DE1B8_Scenes[i].info.class_id == GS_VS) { - count++; - } - } - return count; -} - -struct gm_803DE650_t* gm_8017E4C4(u8 arg0) -{ - struct gm_803DE650_t* ptr; - for (ptr = gm_803DE650; ptr->x0 != 0xFF; ptr++) { - if (ptr->x0 == arg0) { - return ptr; - } - } - return NULL; -} - -/// Get adventure stage kind for given difficulty and stage slot. -/// The (u8) cast on difficulty is required - these functions are called -/// via function pointers typed as f32(*)(int, u8) in UnkAdventureData. -u8 gm_8017E500(u8 difficulty, u8 stage_slot) -{ - return lbl_803D7AC0[stage_slot + difficulty * 5].stage_kind; -} - -f32 gm_8017E528(u8 difficulty, u8 stage_slot) -{ - return lbl_803D7AC0[stage_slot + difficulty * 5].scale0_pct / 100.0F; -} - -f32 gm_8017E578(u8 difficulty, u8 stage_slot) -{ - return lbl_803D7AC0[stage_slot + difficulty * 5].scale1_pct / 100.0F; -} - -u8 gm_8017E5C8(u8 difficulty, u8 stage_slot, u8 arg2) -{ - return lbl_803D7AC0[stage_slot + difficulty * 5].pad_6[arg2 * 3]; -} - -u8 gm_8017E5FC(u8 difficulty, u8 stage_slot, u8 arg2) -{ - return lbl_803D7AC0[stage_slot + difficulty * 5].pad_6[1 + arg2 * 3]; -} - -u8 gm_8017E630(u8 difficulty, u8 stage_slot, u8 arg2) -{ - return lbl_803D7AC0[stage_slot + (u8) difficulty * 5].pad_6[arg2 * 3 + 2]; -} - -f32 gm_8017E664(u8 difficulty, u8 stage_slot) -{ - return lbl_803D7AC0[stage_slot + difficulty * 5].scale0_pct / 100.0F; -} - -f32 gm_8017E6B4(u8 difficulty, u8 stage_slot) -{ - return lbl_803D7AC0[stage_slot + difficulty * 5].scale1_pct / 100.0F; -} - -u8 gm_8017E704(u8 difficulty, u8 stage_slot, u8 arg2) -{ - return lbl_803D7AC0[stage_slot + difficulty * 5].pad_6[0x0E + arg2 * 3]; -} - -u8 gm_8017E738(u8 difficulty, u8 stage_slot, u8 arg2) -{ - return lbl_803D7AC0[stage_slot + difficulty * 5].pad_6[0xF + arg2 * 3]; -} - -u8 gm_8017E76C(u8 difficulty, u8 stage_slot, u8 arg2) -{ - return lbl_803D7AC0[stage_slot + difficulty * 5].pad_6[0x10 + (arg2 * 3)]; -} - -void gm_8017E7A0(u8 matchResult) -{ - if (matchResult == OUTCOME_TIMEOUT) { - Player_LoseStock(0); - ifStatus_802F6948(0); - ifStatus_802F6E3C(0); - } -} - -bool gm_8017E7E0(void) -{ - return gm_GetAdventureData()->x7C == 0x14; -} - -void gm_8017E7FC(u8 matchResult) -{ - UnkAdventureData* r31 = gm_GetAdventureData(); - bool cond; - - if (gm_GetCurrentGameMode() == GM_ADVENTURE && r31->x0.cpu_level >= 2 && - r31->x0.xC.x20 + gm_8016AEDC() < 0xFD20U) - { - cond = true; - } else { - cond = false; - } - - if (!cond) { - struct StartMeleeRules* rules = gm_GetRules(); - rules->x4_5 = 1; - r31->x77 = 0; - gm_SetPendingSceneIndex(0x5A); - } else { - r31->x77 = 1; - gm_SetPendingSceneIndex(0x5A); - } -} - -typedef struct { - u8 b7 : 1, b6 : 1, b5 : 1, b4 : 1, b3 : 1, b2 : 1, b1 : 1, b0 : 1; -} u8_bits; - -#pragma dont_inline on -void fn_8017E8A4(int arg0_int) -{ - MatchEnd* arg0 = (MatchEnd*) arg0_int; - lbl_8046B6A0_t* gm = gm_16AE_GetUnkData_0(); - struct gm_803DE650_t* stage = gm_8017E4C4(gm_GetCurrentSceneIndex()); - UnkAdventureData* adv = &lbl_80472C30; - u8* flags = arg0->_x448; - gmm_x0_528_t* main_data; - u32 total_time; - int i; - - if (fn_8017E318() > 0) { - ((u8_bits*) &flags[2])->b3 = 1; - } - - if (gm->x24C8.x4_5) { - main_data = gmMainLib_8015CDD4(); - total_time = adv->x0.xC.x20 + gm_8016AEDC(); - ((u8_bits*) &flags[0])->b6 = 1; - - if ((u8) adv->x0.cpu_level == 4) { - ((u8_bits*) &flags[0])->b3 = 1; - } - - if (total_time < 0xC4E0U) { - ((u8_bits*) &flags[2])->b6 = 1; - } else if (total_time < 0x13560U) { - ((u8_bits*) &flags[2])->b7 = 1; - } - - if ((u32) adv->x0.xC.x1C == 0U && - (u32) arg0->player_standings[0].x44 == 0U) - { - ((u8_bits*) &flags[1])->b1 = 1; - } - - if ((u8) adv->x0.xC.xE != 0) { - ((u8_bits*) &flags[2])->b5 = 1; - } - - if ((u8) adv->x0.xC.xF != 0) { - ((u8_bits*) &flags[2])->b4 = 1; - } - - if ((u8) adv->x0.xC.xD != 0) { - ((u8_bits*) &flags[1])->b0 = 1; - } else if ((s8) arg0->player_standings[0].stocks == - (s32) main_data->stocks) - { - ((u8_bits*) &arg0->_x448[1])->b2 = 1; - } - } - - if (stage->x0 == 3) { - for (i = 0; i < 6; i++) { - if (Player_GetPlayerSlotType(i) == Gm_PKind_Cpu && - Player_GetPlayerCharacter(i) == CKIND_LUIGI) - { - ((u8_bits*) &flags[1])->b7 = 1; - return; - } - } - } - - if (stage->x0 == 0x11) { - if (gm->unk_C >= 5) { - ((u8_bits*) &flags[1])->b6 = 1; - return; - } - } - - if (stage->x0 == 0x25) { - ((u8_bits*) &flags[1])->b5 = 1; - return; - } else if (stage->x0 == 0x53) { - for (i = 0; i < 6; i++) { - if (Player_GetPlayerSlotType(i) == Gm_PKind_Cpu && - Player_GetPlayerCharacter(i) == CKIND_LUIGI) - { - ((u8_bits*) &flags[1])->b4 = 1; - return; - } - } - } - - if (stage->x0 == 0x5C) { - ((u8_bits*) &flags[1])->b3 = 1; - } - - PAD_STACK(8); -} -#pragma dont_inline reset - -UnkAllstarData* gm_GetAllStarData(void) -{ - return &lbl_80472CB0; -} - -u8 gm_8017EB3C(u8 difficulty, u8 stage_slot) -{ - return lbl_803D85F0[stage_slot + difficulty * 5].stage_kind; -} - -u8 gm_8017EB64(u8 difficulty, u8 stage_slot, u8 arg2) -{ - return lbl_803D85F0[stage_slot + difficulty * 5].pad_6[arg2 * 3]; -} - -u8 gm_8017EB98(u8 difficulty, u8 stage_slot, u8 arg2) -{ - return lbl_803D85F0[stage_slot + difficulty * 5].pad_6[arg2 * 3 + 1]; -} - -u8 gm_8017EBCC(u8 difficulty, u8 stage_slot, u8 arg2) -{ - return lbl_803D85F0[stage_slot + difficulty * 5].pad_6[arg2 * 3 + 2]; -} - -f32 gm_8017EC00(u8 difficulty, u8 stage_slot) -{ - return lbl_803D85F0[stage_slot + difficulty * 5].scale2_pct / 100.0F; -} - -f32 gm_8017EC50(u8 difficulty, u8 stage_slot) -{ - return lbl_803D85F0[stage_slot + difficulty * 5].scale3_pct / 100.0F; -} - -u8 gm_8017ECA0(u8 difficulty, u8 stage_slot, u8 arg2) -{ - return lbl_803D85F0[stage_slot + difficulty * 5].pad_14[arg2 * 3]; -} - -u8 gm_8017ECD4(u8 difficulty, u8 stage_slot, u8 arg2) -{ - return lbl_803D85F0[stage_slot + ((u8) difficulty * 5)] - .pad_14[arg2 * 3 + 1]; -} - -u8 gm_8017ED08(u8 difficulty, u8 stage_slot, u8 arg2) -{ - return lbl_803D85F0[stage_slot + ((u8) difficulty * 5)] - .pad_14[arg2 * 3 + 2]; -} - -f32 gm_8017ED3C(u8 difficulty, u8 stage_slot) -{ - return lbl_803D85F0[stage_slot + difficulty * 5].scale0_pct / 100.0F; -} - -f32 gm_8017ED8C(u8 difficulty, u8 stage_slot) -{ - return lbl_803D85F0[stage_slot + difficulty * 5].scale1_pct / 100.0F; -} - -bool fn_8017EDDC(void) -{ - UnkAllstarData* p; - - if (gm_GetCurrentGameMode() == GM_CLASSIC) { - p = gm_GetAllStarData(); - if (p->x0.xC.xD == 0 && p->x0.cpu_level >= 2 && p->x0.xC.x20 < 0x5208) - { - return true; - } - } - return false; -} - -#pragma dont_inline on -void fn_8017EE40(int arg0_int) -{ - MatchEnd* arg0 = (MatchEnd*) arg0_int; - struct StartMeleeRules* rules; - UnkAllstarData* allstar; - gmm_x0_528_t* main_data; - u32 total_time; - int i; - - rules = gm_GetRules(); - allstar = &lbl_80472CB0; - - if (fn_8017E318() > 0) { - ((u8_bits*) &arg0->_x448[2])->b3 = 1; - } - - if (rules->x4_5) { - main_data = gmMainLib_8015CDC8(); - total_time = allstar->x0.xC.x20 + gm_8016AEDC(); - ((u8_bits*) &arg0->_x448[0])->b7 = 1; - - if ((u8) allstar->x0.cpu_level == 4) { - ((u8_bits*) &arg0->_x448[0])->b4 = 1; - } - - if (total_time < 0x3840U) { - ((u8_bits*) &arg0->_x448[2])->b6 = 1; - } else if (total_time < 0x5460U) { - ((u8_bits*) &arg0->_x448[2])->b7 = 1; - } - - if ((u32) allstar->x0.xC.x1C == 0U && - (u32) arg0->player_standings[0].x44 == 0U) - { - ((u8_bits*) &arg0->_x448[1])->b1 = 1; - } - - if ((u8) allstar->x0.xC.xE != 0) { - ((u8_bits*) &arg0->_x448[2])->b5 = 1; - } - - if ((u8) allstar->x0.xC.xF != 0) { - ((u8_bits*) &arg0->_x448[2])->b4 = 1; - } - - if ((u8) allstar->x0.xC.xD != 0) { - ((u8_bits*) &arg0->_x448[1])->b0 = 1; - } else if ((s8) arg0->player_standings[0].stocks == - (s32) main_data->stocks) - { - ((u8_bits*) &arg0->_x448[1])->b2 = 1; - } - } - - for (i = 0; i < 6; i++) { - if (Player_GetPlayerSlotType(i) == Gm_PKind_Cpu && - Player_GetPlayerCharacter(i) == CKIND_CREZYH) - { - ((u8_bits*) &arg0->_x448[0])->b0 = 1; - return; - } - } -} -#pragma dont_inline reset +static char gmRegClearArchiveName[] = "GmRegClr"; +static char gmRegClearSceneData[] = "ScGamRegClear_scene_data"; +static char gmRegClearArchiveError[] = + "Error : Cannot open archive file (File Name : %s)."; +static char gmRegClearDecisionUsd[] = "SdDec.usd"; +static char gmRegClearDecisionData[] = "SIS_DecisionData"; +static char gmRegClearDecisionDat[] = "SdDec.dat"; +static char gmRegClearShortBlank[] = " "; +static char gmRegClearLongBlank[] = " "; +static char gmRegClearGObjError[] = + "Error : gobj don\'t get (gmRegClearAddModel)\n"; +static char gmRegClearFilename[] = "gmregclear.c"; +static char gmRegClearJObjError[] = + "Error : jobj don\'t get (gmRegClearAddModel)\n"; int fn_8017F008(void) { @@ -1957,9 +330,9 @@ s32 fn_8017F2A4(HSD_Text** arg0, f32 farg0, f32 farg1) temp = HSD_SisLib_803A611C(3, NULL, 9U, 0xDU, 0U, 0x14U, 0U, 0x13U); if (lbLang_IsSavedLanguageUS()) { - HSD_SisLib_803A62A0(3, "SdDec.usd", "SIS_DecisionData"); + HSD_SisLib_803A62A0(3, gmRegClearDecisionUsd, gmRegClearDecisionData); } else { - HSD_SisLib_803A62A0(3, "SdDec.dat", "SIS_DecisionData"); + HSD_SisLib_803A62A0(3, gmRegClearDecisionDat, gmRegClearDecisionData); } *arg0 = HSD_SisLib_803A6754(3, temp); ptr = arg0; @@ -1977,11 +350,11 @@ s32 fn_8017F2A4(HSD_Text** arg0, f32 farg0, f32 farg1) text->x34.x = 0.56f; text->x34.y = 0.6f; ptr[1]->default_kerning = 1; - HSD_SisLib_803A6B98(*arg0, x_end, -12.0f + y, " "); + HSD_SisLib_803A6B98(*arg0, x_end, -12.0f + y, gmRegClearShortBlank); ptr++; } return HSD_SisLib_803A6B98(*arg0, x_end, 9.0f + (134.40001f + farg1), - " "); + gmRegClearLongBlank); PAD_STACK(8); } @@ -2535,13 +908,13 @@ s32 fn_801803FC(void* arg0) p->x0 = gobj; if (gobj == NULL) { HSD_JObjAnimAll((HSD_JObj*) gobj->hsd_obj); - OSReport("Error : gobj don\'t get (gmRegClearAddModel)\n"); - OSPanic(__FILE__, 0x42C, ""); + OSReport(gmRegClearGObjError); + OSPanic(gmRegClearFilename, 0x42C, ""); } jobj = HSD_JObjLoadJoint(mdl->joint); if (jobj == NULL) { - OSReport("Error : jobj don\'t get (gmRegClearAddModel)\n"); - OSPanic(__FILE__, 0x432, ""); + OSReport(gmRegClearJObjError); + OSPanic(gmRegClearFilename, 0x432, ""); } HSD_GObjObject_80390A70(gobj, HSD_GObj_804D7849, jobj); GObj_SetupGXLink(gobj, HSD_GObj_JObjCallback, 0xBU, 0U); @@ -2590,8 +963,7 @@ static inline void fn_80180630_CheckArchive(HSD_Archive* archive, void* sp38) struct lbl_80472D28_t* state = &lbl_80472D28; state->x48 = archive; if (sp38 == NULL) { - OSReport("Error : Cannot open archive file (File Name : %s).", - "GmRegClr"); + OSReport(gmRegClearArchiveError, gmRegClearArchiveName); } } @@ -2725,12 +1097,11 @@ void fn_80180630(int arg0, int arg1, int arg2, bool arg3, state->x104 = var_r4; lbl_804D65C0 = (var_r4 - (arg0 + arg1)) / 10; - archive = - lbArchive_80016DBC("GmRegClr", &sp38, "ScGamRegClear_scene_data", 0); + archive = lbArchive_80016DBC(gmRegClearArchiveName, &sp38, + gmRegClearSceneData, 0); state->x48 = archive; if (sp38 == NULL) { - OSReport("Error : Cannot open archive file (File Name : %s).", - "GmRegClr"); + OSReport(gmRegClearArchiveError, gmRegClearArchiveName); } fn_80168A6C(sp38, &state->x4C, 0); diff --git a/src/melee/gm/gmregclear.h b/src/melee/gm/gmregclear.h index 8b70dd6d3b..43d693faad 100644 --- a/src/melee/gm/gmregclear.h +++ b/src/melee/gm/gmregclear.h @@ -10,81 +10,9 @@ #include #include -/* 17C0C8 */ void fn_8017C0C8(void); -/* 17C1A4 */ void fn_8017C1A4(HSD_GObj*); -/* 17C71C */ void fn_8017C71C(void); -/* 17C7A0 */ void fn_8017C7A0(void); -/* 17C7EC */ void fn_8017C7EC(void); -/* 17C838 */ void gm_8017C838(void); -/* 17C984 */ void gm_8017C984(UNK_T); -/* 17C9A8 */ void gm_8017C9A8(DebugGameOverData*, Unk1PData*, u8); -/* 17CA38 */ UNK_RET gm_8017CA38(DebugGameOverData*, Unk1PData*, - struct gmm_x0_528_t*, u8); -/* 17CBAC */ UNK_RET gm_8017CBAC(UnkAdventureData*, struct gmm_x0_528_t*, u8); -/* 17CD94 */ u8 gm_8017CD94(UnkAdventureData*, int, int, int); -/* 17CE34 */ s32 gm_8017CE34(StartMeleeData*, UnkAdventureData*, s8*, u8, u8, - u8, s32, InternalStageId, s32 count, s32); -/* 17D7AC */ bool gm_8017D7AC(MatchExitInfo*, Unk1PData*, u8); -/* 17D9C0 */ s32 fn_8017D9C0(u8* arg0, u8* arg1); -/* 17DB58 */ void gm_8017DB58(struct Unk1PData_x24* arg0); -/* 17DB6C */ u8 gm_8017DB6C(gm_8017DB6C_arg0_t* arg0, int index); -/* 17DB78 */ u8 gm_8017DB78(gm_8017DB6C_arg0_t* arg0, int index); -/* 17DB88 */ s32 gm_8017DB88(void* arg0, u8 arg1, s32 arg2, s32 arg3, u8* arg4, - u8 arg5, u8 (*arg6)(s32, s32, u8), - u8 (*arg7)(s32, s32, u8), - u8 (*arg8)(s32, s32, u8), f32 (*arg9)(s32, s32), - f32 (*arg10)(s32, s32)); -/* 17DD7C */ s32 fn_8017DD7C(PlayerInitData* arg0, Unk1PData_x24* arg1, - u8 arg2); -/* 17DE54 */ s32 fn_8017DE54(u8, u8*); -/* 17DEC8 */ Unk1PData* fn_8017DEC8(int); -/* 17DF28 */ Unk1PData* fn_8017DF28(void); -/* 17DF90 */ u8 fn_8017DF90(void); -/* 17DFF4 */ int gm_8017DFF4(int); -/* 17E068 */ bool gm_8017E068(void); -/* 17E0E4 */ int fn_8017E0E4(void); -/* 17E160 */ bool fn_8017E160(void); -/* 17E21C */ void fn_8017E21C(void); -/* 17E280 */ s8 gm_8017E280(u16, u32); -/* 17E318 */ int fn_8017E318(void); -/* 17E3C8 */ void fn_8017E3C8(void); -/* 17E424 */ UnkAdventureData* gm_GetAdventureData(void); -/* 17E430 */ u8 gm_8017E430(void); ///< returns a player slot -/* 17E440 */ u8 gm_8017E440(void); -/* 17E48C */ u8 gm_8017E48C(GameScene*); -/* 17E4C4 */ struct gm_803DE650_t* gm_8017E4C4(u8); -/* 17E500 */ u8 gm_8017E500(u8, u8); -/* 17E528 */ f32 gm_8017E528(u8, u8); -/* 17E578 */ f32 gm_8017E578(u8, u8); -/* 17E5C8 */ u8 gm_8017E5C8(u8, u8, u8); -/* 17E5FC */ u8 gm_8017E5FC(u8, u8, u8); -/* 17E630 */ u8 gm_8017E630(u8 difficulty, u8 stage_slot, u8 arg2); -/* 17E664 */ f32 gm_8017E664(u8, u8); -/* 17E6B4 */ f32 gm_8017E6B4(u8, u8); -/* 17E704 */ u8 gm_8017E704(u8 difficulty, u8 stage_slot, u8 arg2); -/* 17E738 */ u8 gm_8017E738(u8 difficulty, u8 stage_slot, u8 arg2); -/* 17E76C */ u8 gm_8017E76C(u8 difficulty, u8 stage_slot, u8 arg2); -/* 17E7A0 */ void gm_8017E7A0(u8); -/* 17E7E0 */ bool gm_8017E7E0(void); -/* 17E7FC */ void gm_8017E7FC(u8); -/* 17E8A4 */ void fn_8017E8A4(int); -/* 17EB30 */ UnkAllstarData* gm_GetAllStarData(void); -/* 17EB3C */ u8 gm_8017EB3C(u8, u8); -/* 17EB64 */ u8 gm_8017EB64(u8 difficulty, u8 stage_slot, u8 arg2); -/* 17EB98 */ u8 gm_8017EB98(u8 difficulty, u8 stage_slot, u8 arg2); -/* 17EBCC */ u8 gm_8017EBCC(u8 difficulty, u8 stage_slot, u8 arg2); -/* 17EC00 */ f32 gm_8017EC00(u8, u8); -/* 17EC50 */ f32 gm_8017EC50(u8, u8); -/* 17ECA0 */ u8 gm_8017ECA0(u8 difficulty, u8 stage_slot, u8 arg2); -/* 17ECD4 */ u8 gm_8017ECD4(u8 difficulty, u8 stage_slot, u8 arg2); -/* 17ED08 */ u8 gm_8017ED08(u8 difficulty, u8 stage_slot, u8 arg2); -/* 17ED3C */ f32 gm_8017ED3C(u8, u8); -/* 17ED8C */ f32 gm_8017ED8C(u8, u8); -/* 17EDDC */ bool fn_8017EDDC(void); -/* 17EE40 */ void fn_8017EE40(int); /* 17F008 */ int fn_8017F008(void); /* 17F09C */ s32 fn_8017F09C(void); -/* 17F14C */ s32 fn_8017F14C(void* arg0); +/* 17F14C */ s32 fn_8017F14C(void*); /* 17F1B8 */ s32 fn_8017F1B8(void); /* 17F2A4 */ s32 fn_8017F2A4(HSD_Text** arg0, f32 farg0, f32 farg1); /* 17F47C */ s32 fn_8017F47C(HSD_Text** arg0, int arg1); @@ -123,7 +51,7 @@ /* 182DF0 */ UnkMultimanData* gm_80182DF0(int c_kind, int); /* 182F40 */ void fn_80182F40(HSD_GObj*); /* 183218 */ UNK_RET gm_80183218(UNK_PARAMS); -/* 18325C */ void fn_8018325C(HSD_GObj*, int); -/* 184138 */ void fn_80184138(HSD_GObj*, int); + +/* 3D8B88 */ extern u16 lbl_803D8B88[]; #endif diff --git a/src/melee/gm/types.h b/src/melee/gm/types.h index 986ff93f15..7d10fe2eac 100644 --- a/src/melee/gm/types.h +++ b/src/melee/gm/types.h @@ -739,6 +739,37 @@ struct Unk1PData { } xC; }; +struct AdventureStageEntry { + /* 0x00 */ u8 stage_kind; + /* 0x01 */ u8 pad_1; + /* 0x02 */ u16 scale0_pct; + /* 0x04 */ u16 scale1_pct; + /* 0x06 */ u8 pad_6[0x14]; +}; +STATIC_ASSERT(sizeof(AdventureStageEntry) == 0x1A); + +struct AdventureStageTable { + /* 0x000 */ AdventureStageEntry entries[110]; + /* 0xB2C */ u8 pad[4]; +}; + +struct AllstarStageEntry { + /* 0x00 */ u8 stage_kind; + /* 0x01 */ u8 pad_1; + /* 0x02 */ u16 scale0_pct; + /* 0x04 */ u16 scale1_pct; + /* 0x06 */ u8 pad_6[0xA]; + /* 0x10 */ u16 scale2_pct; + /* 0x12 */ u16 scale3_pct; + /* 0x14 */ u8 pad_14[0x6]; +}; +STATIC_ASSERT(sizeof(AllstarStageEntry) == 0x1A); + +struct AllstarStageTable { + /* 0x000 */ AllstarStageEntry entries[55]; + /* 0x596 */ u8 pad[2]; +}; + struct UnkAdventureData { /* 00 */ Unk1PData x0; /* 48 */ u8 (*x48)(u8, u8);