diff --git a/src/game/data/data_020df0.c b/src/game/data/data_020df0.c index c1991cd44..164796e7d 100644 --- a/src/game/data/data_020df0.c +++ b/src/game/data/data_020df0.c @@ -10238,7 +10238,7 @@ struct menu_item g_MpGameOverMenuItems[] = { }; // 2aa18 -struct menu_dialog g_MpEndscreenChallengeGameOverMenuDialog = { +struct menu_dialog g_MpEndscreenIndividualGameOverMenuDialog = { MENUDIALOGTYPE_DEFAULT, L_MPMENU(260), // "Game Over" g_MpGameOverMenuItems, @@ -10248,7 +10248,7 @@ struct menu_dialog g_MpEndscreenChallengeGameOverMenuDialog = { }; // 2aa30 -struct menu_dialog g_MpEndscreenGameOverMenuDialog = { +struct menu_dialog g_MpEndscreenTeamGameOverMenuDialog = { MENUDIALOGTYPE_DEFAULT, L_MPMENU(260), // "Game Over" g_MpGameOverMenuItems, @@ -10264,7 +10264,7 @@ struct menu_dialog g_MpEndscreenChallengeCompletedMenuDialog = { g_MpTeamRankingMenuItems, NULL, 0x00000000, - &g_MpEndscreenChallengeGameOverMenuDialog, + &g_MpEndscreenIndividualGameOverMenuDialog, }; // 2aa60 @@ -10274,7 +10274,7 @@ struct menu_dialog g_MpEndscreenChallengeCheatedMenuDialog = { g_MpTeamRankingMenuItems, NULL, 0x00000000, - &g_MpEndscreenChallengeGameOverMenuDialog, + &g_MpEndscreenIndividualGameOverMenuDialog, }; // 2aa78 @@ -10284,7 +10284,7 @@ struct menu_dialog g_MpEndscreenChallengeFailedMenuDialog = { g_MpTeamRankingMenuItems, NULL, 0x00000000, - &g_MpEndscreenChallengeGameOverMenuDialog, + &g_MpEndscreenIndividualGameOverMenuDialog, }; // 2aa90 diff --git a/src/game/game_01bea0.c b/src/game/game_01bea0.c index 8b2d76734..b15518d1c 100644 --- a/src/game/game_01bea0.c +++ b/src/game/game_01bea0.c @@ -953,7 +953,7 @@ glabel var7f1a863c /* f01cad4: 10000004 */ beqz $zero,.L0f01cae8 /* f01cad8: 26310001 */ addiu $s1,$s1,0x1 .L0f01cadc: -/* f01cadc: 0fc5e3bc */ jal func0f178ef0 +/* f01cadc: 0fc5e3bc */ jal mpPushEndscreenDialog /* f01cae0: 02202825 */ or $a1,$s1,$zero .L0f01cae4: /* f01cae4: 26310001 */ addiu $s1,$s1,0x1 @@ -1203,7 +1203,7 @@ glabel var7f1a863c /* f01ce54: 000d6940 */ sll $t5,$t5,0x5 /* f01ce58: 01b91021 */ addu $v0,$t5,$t9 /* f01ce5c: afa20058 */ sw $v0,0x58($sp) -/* f01ce60: 0fc5e3bc */ jal func0f178ef0 +/* f01ce60: 0fc5e3bc */ jal mpPushEndscreenDialog /* f01ce64: 02202825 */ or $a1,$s1,$zero /* f01ce68: 8fa20058 */ lw $v0,0x58($sp) /* f01ce6c: 8c4f004c */ lw $t7,0x4c($v0) diff --git a/src/game/game_177e00.c b/src/game/game_177e00.c index 5fd8ba223..e06e6dfc8 100644 --- a/src/game/game_177e00.c +++ b/src/game/game_177e00.c @@ -980,106 +980,35 @@ glabel func0f178dbc /* f178eec: 00000000 */ sll $zero,$zero,0x0 ); -GLOBAL_ASM( -glabel func0f178ef0 -/* f178ef0: 3c028007 */ lui $v0,%hi(g_MpPlayerNum) -/* f178ef4: 0005c0c0 */ sll $t8,$a1,0x3 -/* f178ef8: 24421448 */ addiu $v0,$v0,%lo(g_MpPlayerNum) -/* f178efc: 0305c023 */ subu $t8,$t8,$a1 -/* f178f00: 8c4e0000 */ lw $t6,0x0($v0) -/* f178f04: 0018c080 */ sll $t8,$t8,0x2 -/* f178f08: ac450000 */ sw $a1,0x0($v0) -/* f178f0c: 0305c021 */ addu $t8,$t8,$a1 -/* f178f10: 3c19800b */ lui $t9,%hi(g_MpSetup+0xc) -/* f178f14: 8f39cb94 */ lw $t9,%lo(g_MpSetup+0xc)($t9) -/* f178f18: 0018c0c0 */ sll $t8,$t8,0x3 -/* f178f1c: 0305c023 */ subu $t8,$t8,$a1 -/* f178f20: 0018c100 */ sll $t8,$t8,0x4 -/* f178f24: 3c01800a */ lui $at,%hi(g_MenuStack+0x83b) -/* f178f28: 27bdffe0 */ addiu $sp,$sp,-32 -/* f178f2c: 00380821 */ addu $at,$at,$t8 -/* f178f30: 33280002 */ andi $t0,$t9,0x2 -/* f178f34: afbf0014 */ sw $ra,0x14($sp) -/* f178f38: a024e83b */ sb $a0,%lo(g_MenuStack+0x83b)($at) -/* f178f3c: 11000027 */ beqz $t0,.L0f178fdc -/* f178f40: afae001c */ sw $t6,0x1c($sp) -/* f178f44: 3c09800b */ lui $t1,%hi(g_MpSetup+0x88) -/* f178f48: 9129cc10 */ lbu $t1,%lo(g_MpSetup+0x88)($t1) -/* f178f4c: 24010005 */ addiu $at,$zero,0x5 -/* f178f50: 3c048008 */ lui $a0,%hi(g_MpEndscreenGameOverMenuDialog) -/* f178f54: 1521001d */ bne $t1,$at,.L0f178fcc -/* f178f58: 24844a10 */ addiu $a0,$a0,%lo(g_MpEndscreenGameOverMenuDialog) -/* f178f5c: 3c0a800a */ lui $t2,%hi(g_CheatsActiveBank0) -/* f178f60: 8d4a21d0 */ lw $t2,%lo(g_CheatsActiveBank0)($t2) -/* f178f64: 3c048008 */ lui $a0,%hi(g_MpEndscreenChallengeCheatedMenuDialog) -/* f178f68: 3c0b800a */ lui $t3,%hi(g_CheatsActiveBank1) -/* f178f6c: 15400004 */ bnez $t2,.L0f178f80 -/* f178f70: 24844a40 */ addiu $a0,$a0,%lo(g_MpEndscreenChallengeCheatedMenuDialog) -/* f178f74: 8d6b21d4 */ lw $t3,%lo(g_CheatsActiveBank1)($t3) -/* f178f78: 11600005 */ beqz $t3,.L0f178f90 -/* f178f7c: 00000000 */ sll $zero,$zero,0x0 -.L0f178f80: -/* f178f80: 0fc3e0cc */ jal menuPushRootDialog -/* f178f84: 24050005 */ addiu $a1,$zero,0x5 -/* f178f88: 10000018 */ beqz $zero,.L0f178fec -/* f178f8c: 00000000 */ sll $zero,$zero,0x0 -.L0f178f90: -/* f178f90: 0fc6714f */ jal func0f19c53c -/* f178f94: 00000000 */ sll $zero,$zero,0x0 -/* f178f98: 10400007 */ beqz $v0,.L0f178fb8 -/* f178f9c: 3c048008 */ lui $a0,%hi(g_MpEndscreenChallengeFailedMenuDialog) -/* f178fa0: 3c048008 */ lui $a0,%hi(g_MpEndscreenChallengeCompletedMenuDialog) -/* f178fa4: 24844a28 */ addiu $a0,$a0,%lo(g_MpEndscreenChallengeCompletedMenuDialog) -/* f178fa8: 0fc3e0cc */ jal menuPushRootDialog -/* f178fac: 24050005 */ addiu $a1,$zero,0x5 -/* f178fb0: 1000000e */ beqz $zero,.L0f178fec -/* f178fb4: 00000000 */ sll $zero,$zero,0x0 -.L0f178fb8: -/* f178fb8: 24844a58 */ addiu $a0,$a0,%lo(g_MpEndscreenChallengeFailedMenuDialog) -/* f178fbc: 0fc3e0cc */ jal menuPushRootDialog -/* f178fc0: 24050005 */ addiu $a1,$zero,0x5 -/* f178fc4: 10000009 */ beqz $zero,.L0f178fec -/* f178fc8: 00000000 */ sll $zero,$zero,0x0 -.L0f178fcc: -/* f178fcc: 0fc3e0cc */ jal menuPushRootDialog -/* f178fd0: 24050005 */ addiu $a1,$zero,0x5 -/* f178fd4: 10000005 */ beqz $zero,.L0f178fec -/* f178fd8: 00000000 */ sll $zero,$zero,0x0 -.L0f178fdc: -/* f178fdc: 3c048008 */ lui $a0,%hi(g_MpEndscreenChallengeGameOverMenuDialog) -/* f178fe0: 248449f8 */ addiu $a0,$a0,%lo(g_MpEndscreenChallengeGameOverMenuDialog) -/* f178fe4: 0fc3e0cc */ jal menuPushRootDialog -/* f178fe8: 24050005 */ addiu $a1,$zero,0x5 -.L0f178fec: -/* f178fec: 3c0c8007 */ lui $t4,%hi(g_MpPlayerNum) -/* f178ff0: 8d8c1448 */ lw $t4,%lo(g_MpPlayerNum)($t4) -/* f178ff4: 3c0e800b */ lui $t6,%hi(g_MpPlayers) -/* f178ff8: 25cec7b8 */ addiu $t6,$t6,%lo(g_MpPlayers) -/* f178ffc: 000c6880 */ sll $t5,$t4,0x2 -/* f179000: 01ac6821 */ addu $t5,$t5,$t4 -/* f179004: 000d6940 */ sll $t5,$t5,0x5 -/* f179008: 01ae1021 */ addu $v0,$t5,$t6 -/* f17900c: 94430048 */ lhu $v1,0x48($v0) -/* f179010: 306f4000 */ andi $t7,$v1,0x4000 -/* f179014: 55e0000c */ bnezl $t7,.L0f179048 -/* f179018: 8fbf0014 */ lw $ra,0x14($sp) -/* f17901c: 8c58004c */ lw $t8,0x4c($v0) -/* f179020: 57000009 */ bnezl $t8,.L0f179048 -/* f179024: 8fbf0014 */ lw $ra,0x14($sp) -/* f179028: 94590050 */ lhu $t9,0x50($v0) -/* f17902c: 3c048008 */ lui $a0,%hi(g_MpEndscreenSavePlayerMenuDialog) -/* f179030: 34684000 */ ori $t0,$v1,0x4000 -/* f179034: 17200003 */ bnez $t9,.L0f179044 -/* f179038: 24844b14 */ addiu $a0,$a0,%lo(g_MpEndscreenSavePlayerMenuDialog) -/* f17903c: 0fc3cbd3 */ jal menuPushDialog -/* f179040: a4480048 */ sh $t0,0x48($v0) -.L0f179044: -/* f179044: 8fbf0014 */ lw $ra,0x14($sp) -.L0f179048: -/* f179048: 8fa9001c */ lw $t1,0x1c($sp) -/* f17904c: 3c018007 */ lui $at,%hi(g_MpPlayerNum) -/* f179050: 27bd0020 */ addiu $sp,$sp,0x20 -/* f179054: 03e00008 */ jr $ra -/* f179058: ac291448 */ sw $t1,%lo(g_MpPlayerNum)($at) -/* f17905c: 00000000 */ sll $zero,$zero,0x0 -); +void mpPushEndscreenDialog(u32 arg0, u32 playernum) +{ + u32 prevplayernum = g_MpPlayerNum; + g_MpPlayerNum = playernum; + + g_MenuStack[g_MpPlayerNum].playernum = arg0; + + if (g_MpSetup.options & MPOPTION_TEAMSENABLED) { + if (g_MpSetupSaveFile.locktype == MPLOCKTYPE_CHALLENGE) { + if (g_CheatsActiveBank0 || g_CheatsActiveBank1) { + menuPushRootDialog(&g_MpEndscreenChallengeCheatedMenuDialog, MENUROOT_MPENDSCREEN); + } else if (mpIsChallengeCompleteForEndscreen()) { + menuPushRootDialog(&g_MpEndscreenChallengeCompletedMenuDialog, MENUROOT_MPENDSCREEN); + } else { + menuPushRootDialog(&g_MpEndscreenChallengeFailedMenuDialog, MENUROOT_MPENDSCREEN); + } + } else { + menuPushRootDialog(&g_MpEndscreenTeamGameOverMenuDialog, MENUROOT_MPENDSCREEN); + } + } else { + menuPushRootDialog(&g_MpEndscreenIndividualGameOverMenuDialog, MENUROOT_MPENDSCREEN); + } + + if ((g_MpPlayers[g_MpPlayerNum].options & OPTION_ASKEDSAVEPLAYER) == 0 + && g_MpPlayers[g_MpPlayerNum].saved == false + && g_MpPlayers[g_MpPlayerNum].unk50 == 0) { + g_MpPlayers[g_MpPlayerNum].options |= OPTION_ASKEDSAVEPLAYER; + menuPushDialog(&g_MpEndscreenSavePlayerMenuDialog); + } + + g_MpPlayerNum = prevplayernum; +} diff --git a/src/game/game_19aa80.c b/src/game/game_19aa80.c index 30c7e9a10..eb1a53ffc 100644 --- a/src/game/game_19aa80.c +++ b/src/game/game_19aa80.c @@ -1753,7 +1753,7 @@ void mpSetChallengeCompletedByChrWithNumPlayers(u32 mpchrnum, s32 index, s32 num } GLOBAL_ASM( -glabel func0f19c53c +glabel mpIsChallengeCompleteForEndscreen /* f19c53c: 27bdfec0 */ addiu $sp,$sp,-320 /* f19c540: afb00018 */ sw $s0,0x18($sp) /* f19c544: 3c10800a */ lui $s0,%hi(g_Vars) @@ -1869,7 +1869,7 @@ glabel func0f19c53c * This uses about 256 extra bytes of stack and passes it to func0f188a84. * Should decompile func0f188a84 first. */ -//bool func0f19c53c(void) +//bool mpIsChallengeCompleteForEndscreen(void) //{ // bool result = false; // bool aborting = false; @@ -1895,7 +1895,7 @@ glabel func0f19c53c void mpConsiderMarkingCurrentChallengeComplete(void) { - bool result = func0f19c53c(); + bool result = mpIsChallengeCompleteForEndscreen(); if (g_CheatsActiveBank0 == 0 && g_CheatsActiveBank1 == 0 && result) { u32 prevplayernum; diff --git a/src/include/constants.h b/src/include/constants.h index 71d2ff4de..65dddb541 100644 --- a/src/include/constants.h +++ b/src/include/constants.h @@ -1664,6 +1664,7 @@ #define OPTION_ALWAYSSHOWTARGET 0x0200 #define OPTION_SHOWZOOMRANGE 0x0400 #define OPTION_PAINTBALL 0x0800 +#define OPTION_ASKEDSAVEPLAYER 0x4000 #define OPTION_SHOWMISSIONTIME 0x8000 #define OUTFIT_DEFAULT 0x00 diff --git a/src/include/game/data/data_020df0.h b/src/include/game/data/data_020df0.h index 0a7c1eadf..b8eda5fe6 100644 --- a/src/include/game/data/data_020df0.h +++ b/src/include/game/data/data_020df0.h @@ -309,8 +309,8 @@ extern u32 var800845f4; extern struct menu_dialog g_MpPausePlayerRankingMenuDialog; extern struct menu_dialog g_MpPauseTeamRankingMenuDialog; extern u16 g_OrdinalSuffixes[12]; -extern struct menu_dialog g_MpEndscreenChallengeGameOverMenuDialog; -extern struct menu_dialog g_MpEndscreenGameOverMenuDialog; +extern struct menu_dialog g_MpEndscreenIndividualGameOverMenuDialog; +extern struct menu_dialog g_MpEndscreenTeamGameOverMenuDialog; extern struct menu_dialog g_MpEndscreenChallengeCompletedMenuDialog; extern struct menu_dialog g_MpEndscreenChallengeCheatedMenuDialog; extern struct menu_dialog g_MpEndscreenChallengeFailedMenuDialog; diff --git a/src/include/game/game_177e00.h b/src/include/game/game_177e00.h index 2d02ad2b2..55c5e2e14 100644 --- a/src/include/game/game_177e00.h +++ b/src/include/game/game_177e00.h @@ -19,7 +19,7 @@ s32 menuhandler00178a94(u32, u32, u32 *); char *mpMenuTextPlayerTitle(s32 arg0); s32 menuhandler00178bf4(u32, u32, u32 *); u32 func0f178dbc(void); -u32 func0f178ef0(void); +void mpPushEndscreenDialog(u32 arg0, u32 playernum); s32 menuhandlerMpEndGame(u32 operation, struct menu_item *item, s32 *value); s32 menuhandler00178018(u32 operation, struct menu_item *item, s32 *value); s32 menuhandlerMpInGameLimitLabel(u32 operation, struct menu_item *item, s32 *value); diff --git a/src/include/game/game_19aa80.h b/src/include/game/game_19aa80.h index a9a621862..116c7a95e 100644 --- a/src/include/game/game_19aa80.h +++ b/src/include/game/game_19aa80.h @@ -17,7 +17,7 @@ u32 func0f19bfa0(void); u32 func0f19c1cc(void); u32 func0f19c288(void); u32 func0f19c2b0(void); -bool func0f19c53c(void); +bool mpIsChallengeCompleteForEndscreen(void); bool aiMpInitSimulants(void); void func0f19ab40(void); bool func0f19af3c(s32 chrnum, s32 challengeindex);