diff --git a/src/game/game_0dcdb0.c b/src/game/game_0dcdb0.c index 3338015d2..16a8000d0 100644 --- a/src/game/game_0dcdb0.c +++ b/src/game/game_0dcdb0.c @@ -8286,7 +8286,7 @@ glabel func0f0dfad0 /* f0e062c: 11200028 */ beqz $t1,.L0f0e06d0 /* f0e0630: 00000000 */ sll $zero,$zero,0x0 /* f0e0634: 8d8ca248 */ lw $t4,-0x5db8($t4) -/* f0e0638: 0fc54a3a */ jal func0f1528e8 +/* f0e0638: 0fc54a3a */ jal optionsGetShowMissionTime /* f0e063c: 8d840070 */ lw $a0,0x70($t4) /* f0e0640: 10400019 */ beqz $v0,.L0f0e06a8 /* f0e0644: 3c188007 */ lui $t8,0x8007 diff --git a/src/game/game_102240.c b/src/game/game_102240.c index 8dcc684b1..ca8f18bf7 100644 --- a/src/game/game_102240.c +++ b/src/game/game_102240.c @@ -1071,49 +1071,26 @@ s32 menuhandlerShowGunFunction(u32 operation, struct menu_item *item, bool *enab return 0; } -GLOBAL_ASM( -glabel menuhandlerShowMissionTime -/* f102f08: 3c02800a */ lui $v0,%hi(g_Vars) -/* f102f0c: 24429fc0 */ addiu $v0,$v0,%lo(g_Vars) -/* f102f10: 8c4e0298 */ lw $t6,0x298($v0) -/* f102f14: 27bdffe8 */ addiu $sp,$sp,-24 -/* f102f18: afbf0014 */ sw $ra,0x14($sp) -/* f102f1c: 05c10004 */ bgez $t6,.L0f102f30 -/* f102f20: 00803825 */ or $a3,$a0,$zero -/* f102f24: 8c4f029c */ lw $t7,0x29c($v0) -/* f102f28: 05e20005 */ bltzl $t7,.L0f102f40 -/* f102f2c: 8ca4000c */ lw $a0,0xc($a1) -.L0f102f30: -/* f102f30: 8c580288 */ lw $t8,0x288($v0) -/* f102f34: 10000002 */ beqz $zero,.L0f102f40 -/* f102f38: 8f040070 */ lw $a0,0x70($t8) -/* f102f3c: 8ca4000c */ lw $a0,0xc($a1) -.L0f102f40: -/* f102f40: 24010006 */ addiu $at,$zero,0x6 -/* f102f44: 10e10007 */ beq $a3,$at,.L0f102f64 -/* f102f48: 24010008 */ addiu $at,$zero,0x8 -/* f102f4c: 54e1000d */ bnel $a3,$at,.L0f102f84 -/* f102f50: 00001025 */ or $v0,$zero,$zero -/* f102f54: 0fc54a3a */ jal func0f1528e8 -/* f102f58: 00000000 */ sll $zero,$zero,0x0 -/* f102f5c: 1000000a */ beqz $zero,.L0f102f88 -/* f102f60: 8fbf0014 */ lw $ra,0x14($sp) -.L0f102f64: -/* f102f64: 0fc54b2e */ jal func0f152cb8 -/* f102f68: 8cc50000 */ lw $a1,0x0($a2) -/* f102f6c: 3c02800a */ lui $v0,%hi(g_Vars) -/* f102f70: 24429fc0 */ addiu $v0,$v0,%lo(g_Vars) -/* f102f74: 8c590458 */ lw $t9,0x458($v0) -/* f102f78: 37280001 */ ori $t0,$t9,0x1 -/* f102f7c: ac480458 */ sw $t0,0x458($v0) -/* f102f80: 00001025 */ or $v0,$zero,$zero -.L0f102f84: -/* f102f84: 8fbf0014 */ lw $ra,0x14($sp) -.L0f102f88: -/* f102f88: 27bd0018 */ addiu $sp,$sp,0x18 -/* f102f8c: 03e00008 */ jr $ra -/* f102f90: 00000000 */ sll $zero,$zero,0x0 -); +s32 menuhandlerShowMissionTime(u32 operation, struct menu_item *item, bool *enable) +{ + u32 optionsindex; + + if (g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) { + optionsindex = g_Vars.unk000288->optionsindex; + } else { + optionsindex = item->right; + } + + switch (operation) { + case MENUOP_GET: + return optionsGetShowMissionTime(optionsindex); + case MENUOP_SET: + optionsSetShowMissionTime(optionsindex, *enable); + g_Vars.unk000458 |= 1; + } + + return 0; +} GLOBAL_ASM( glabel menuhandlerAlwaysShowTarget diff --git a/src/game/game_10ccd0.c b/src/game/game_10ccd0.c index 8efddd0e2..8580102e6 100644 --- a/src/game/game_10ccd0.c +++ b/src/game/game_10ccd0.c @@ -2843,7 +2843,7 @@ glabel func0f10f204 /* f10f358: 0fc47961 */ jal func0f11e584 /* f10f35c: 02002825 */ or $a1,$s0,$zero /* f10f360: 8fa40024 */ lw $a0,0x24($sp) -/* f10f364: 0fc54b2e */ jal func0f152cb8 +/* f10f364: 0fc54b2e */ jal optionsSetShowMissionTime /* f10f368: 00402825 */ or $a1,$v0,$zero /* f10f36c: 24040020 */ addiu $a0,$zero,0x20 /* f10f370: 0fc47961 */ jal func0f11e584 @@ -2915,7 +2915,7 @@ glabel func0f10f204 /* f10f478: 0fc47961 */ jal func0f11e584 /* f10f47c: 02002825 */ or $a1,$s0,$zero /* f10f480: 8fa40020 */ lw $a0,0x20($sp) -/* f10f484: 0fc54b2e */ jal func0f152cb8 +/* f10f484: 0fc54b2e */ jal optionsSetShowMissionTime /* f10f488: 00402825 */ or $a1,$v0,$zero /* f10f48c: 24040021 */ addiu $a0,$zero,0x21 /* f10f490: 0fc47961 */ jal func0f11e584 @@ -3721,7 +3721,7 @@ glabel func0f10feac /* f110014: 02002825 */ or $a1,$s0,$zero /* f110018: 0fc4794c */ jal func0f11e530 /* f11001c: 00403025 */ or $a2,$v0,$zero -/* f110020: 0fc54a3a */ jal func0f1528e8 +/* f110020: 0fc54a3a */ jal optionsGetShowMissionTime /* f110024: 02602025 */ or $a0,$s3,$zero /* f110028: 2404001a */ addiu $a0,$zero,0x1a /* f11002c: 02002825 */ or $a1,$s0,$zero @@ -3793,7 +3793,7 @@ glabel func0f10feac /* f110134: 02002825 */ or $a1,$s0,$zero /* f110138: 0fc4794c */ jal func0f11e530 /* f11013c: 00403025 */ or $a2,$v0,$zero -/* f110140: 0fc54a3a */ jal func0f1528e8 +/* f110140: 0fc54a3a */ jal optionsGetShowMissionTime /* f110144: 02202025 */ or $a0,$s1,$zero /* f110148: 2404001b */ addiu $a0,$zero,0x1b /* f11014c: 02002825 */ or $a1,$s0,$zero diff --git a/src/game/game_152710.c b/src/game/game_152710.c index 70bb0ed6b..badcabeb7 100644 --- a/src/game/game_152710.c +++ b/src/game/game_152710.c @@ -165,18 +165,10 @@ glabel func0f1528c4 /* f1528e4: 000f102b */ sltu $v0,$zero,$t7 ); -GLOBAL_ASM( -glabel func0f1528e8 -/* f1528e8: 00047080 */ sll $t6,$a0,0x2 -/* f1528ec: 01c47021 */ addu $t6,$t6,$a0 -/* f1528f0: 000e7140 */ sll $t6,$t6,0x5 -/* f1528f4: 3c02800b */ lui $v0,0x800b -/* f1528f8: 004e1021 */ addu $v0,$v0,$t6 -/* f1528fc: 9442c800 */ lhu $v0,-0x3800($v0) -/* f152900: 304f8000 */ andi $t7,$v0,0x8000 -/* f152904: 03e00008 */ jr $ra -/* f152908: 000f102b */ sltu $v0,$zero,$t7 -); +s32 optionsGetShowMissionTime(s32 optionsindex) +{ + return (g_Options[optionsindex].unk48 & OPTION_SHOWMISSIONTIME) != 0; +} GLOBAL_ASM( glabel func0f15290c @@ -439,32 +431,14 @@ glabel func0f152c60 /* f152cb4: 00000000 */ sll $zero,$zero,0x0 ); -GLOBAL_ASM( -glabel func0f152cb8 -/* f152cb8: 10a0000b */ beqz $a1,.L0f152ce8 -/* f152cbc: 00044080 */ sll $t0,$a0,0x2 -/* f152cc0: 00047080 */ sll $t6,$a0,0x2 -/* f152cc4: 01c47021 */ addu $t6,$t6,$a0 -/* f152cc8: 3c0f800b */ lui $t7,%hi(g_Options) -/* f152ccc: 25efc7b8 */ addiu $t7,$t7,%lo(g_Options) -/* f152cd0: 000e7140 */ sll $t6,$t6,0x5 -/* f152cd4: 01cf1021 */ addu $v0,$t6,$t7 -/* f152cd8: 94580048 */ lhu $t8,0x48($v0) -/* f152cdc: 37198000 */ ori $t9,$t8,0x8000 -/* f152ce0: 03e00008 */ jr $ra -/* f152ce4: a4590048 */ sh $t9,0x48($v0) -.L0f152ce8: -/* f152ce8: 01044021 */ addu $t0,$t0,$a0 -/* f152cec: 3c09800b */ lui $t1,%hi(g_Options) -/* f152cf0: 2529c7b8 */ addiu $t1,$t1,%lo(g_Options) -/* f152cf4: 00084140 */ sll $t0,$t0,0x5 -/* f152cf8: 01091021 */ addu $v0,$t0,$t1 -/* f152cfc: 944a0048 */ lhu $t2,0x48($v0) -/* f152d00: 314b7fff */ andi $t3,$t2,0x7fff -/* f152d04: a44b0048 */ sh $t3,0x48($v0) -/* f152d08: 03e00008 */ jr $ra -/* f152d0c: 00000000 */ sll $zero,$zero,0x0 -); +void optionsSetShowMissionTime(s32 optionsindex, bool enable) +{ + if (enable) { + g_Options[optionsindex].unk48 |= OPTION_SHOWMISSIONTIME; + } else { + g_Options[optionsindex].unk48 &= ~OPTION_SHOWMISSIONTIME; + } +} GLOBAL_ASM( glabel func0f152d10 diff --git a/src/include/constants.h b/src/include/constants.h index 7793f09b4..25487a119 100644 --- a/src/include/constants.h +++ b/src/include/constants.h @@ -660,6 +660,7 @@ #define OPTION_AMMOONSCREEN 0x0020 #define OPTION_SHOWGUNFUNCTION 0x0040 +#define OPTION_SHOWMISSIONTIME 0x8000 #define OUTFIT_DEFAULT 0x00 #define OUTFIT_ELVIS 0x01 diff --git a/src/include/game/game_102240.h b/src/include/game/game_102240.h index 2fde5cbe3..e4617077d 100644 --- a/src/include/game/game_102240.h +++ b/src/include/game/game_102240.h @@ -77,7 +77,7 @@ s32 menuhandlerScreenSize(u32, u32, u32 *); s32 menuhandlerScreenSplit(u32, u32, u32 *); s32 menuhandlerSfxVolume(u32, u32, u32 *); s32 menuhandlerShowGunFunction(u32 operation, struct menu_item *item, bool *enable); -s32 menuhandlerShowMissionTime(u32, u32, u32 *); +s32 menuhandlerShowMissionTime(u32 operation, struct menu_item *item, bool *enable); s32 menuhandlerShowZoomRange(u32, u32, u32 *); s32 menuhandlerSightOnScreen(u32, u32, u32 *); s32 menuhandlerSoloDifficulty(u32, u32, u32 *); diff --git a/src/include/game/game_152710.h b/src/include/game/game_152710.h index 1a39b5c59..facc35d0f 100644 --- a/src/include/game/game_152710.h +++ b/src/include/game/game_152710.h @@ -17,7 +17,7 @@ s32 optionsGetShowGunFunction(s32 optionsindex); u32 func0f15287c(void); u32 func0f1528a0(void); u32 func0f1528c4(void); -u32 func0f1528e8(void); +s32 optionsGetShowMissionTime(s32 optionsindex); u32 func0f15290c(void); u32 func0f152918(void); u32 func0f152924(void); @@ -31,7 +31,7 @@ void optionsSetShowGunFunction(s32 optionsindex, bool enable); u32 func0f152bb0(void); u32 func0f152c08(void); u32 func0f152c60(void); -u32 func0f152cb8(void); +void optionsSetShowMissionTime(s32 optionsindex, bool enable); u32 func0f152d10(void); u32 func0f152d1c(void); u32 func0f152d28(void);