diff --git a/src/game/game_0c79f0.c b/src/game/game_0c79f0.c index db12610f2..4bcde723a 100644 --- a/src/game/game_0c79f0.c +++ b/src/game/game_0c79f0.c @@ -1406,7 +1406,7 @@ glabel func0f0c8aa8 /* f0c8b3c: 8dcea248 */ lw $t6,-0x5db8($t6) /* f0c8b40: 00802825 */ or $a1,$a0,$zero /* f0c8b44: 8dc40070 */ lw $a0,0x70($t6) -/* f0c8b48: 0fc549e0 */ jal func0f152780 +/* f0c8b48: 0fc549e0 */ jal optionsGetForwardPitch /* f0c8b4c: afa50018 */ sw $a1,0x18($sp) /* f0c8b50: 8fa50018 */ lw $a1,0x18($sp) /* f0c8b54: 2c4f0001 */ sltiu $t7,$v0,0x1 diff --git a/src/game/game_0dcdb0.c b/src/game/game_0dcdb0.c index 5acb953a8..ebe97049e 100644 --- a/src/game/game_0dcdb0.c +++ b/src/game/game_0dcdb0.c @@ -25059,7 +25059,7 @@ glabel func0f0efa90 /* f0efb34: 01495023 */ subu $t2,$t2,$t1 /* f0efb38: 000a5100 */ sll $t2,$t2,0x4 /* f0efb3c: 008a2021 */ addu $a0,$a0,$t2 -/* f0efb40: 0fc549e0 */ jal func0f152780 +/* f0efb40: 0fc549e0 */ jal optionsGetForwardPitch /* f0efb44: 8c84ee24 */ lw $a0,-0x11dc($a0) /* f0efb48: 14400002 */ bnez $v0,.L0f0efb54 /* f0efb4c: 8fa3001c */ lw $v1,0x1c($sp) @@ -25079,7 +25079,7 @@ glabel func0f0efa90 /* f0efb80: 018b6023 */ subu $t4,$t4,$t3 /* f0efb84: 000c6100 */ sll $t4,$t4,0x4 /* f0efb88: 008c2021 */ addu $a0,$a0,$t4 -/* f0efb8c: 0fc549e0 */ jal func0f152780 +/* f0efb8c: 0fc549e0 */ jal optionsGetForwardPitch /* f0efb90: 8c84ee24 */ lw $a0,-0x11dc($a0) /* f0efb94: 14400002 */ bnez $v0,.L0f0efba0 /* f0efb98: 8fa3001c */ lw $v1,0x1c($sp) diff --git a/src/game/game_102240.c b/src/game/game_102240.c index 7d1dc18df..2087d4a6d 100644 --- a/src/game/game_102240.c +++ b/src/game/game_102240.c @@ -342,51 +342,26 @@ glabel menuhandler001024fc /* f102518: 00000000 */ sll $zero,$zero,0x0 ); -GLOBAL_ASM( -glabel menuhandlerReversePitch -/* f10251c: 3c02800a */ lui $v0,%hi(g_Vars) -/* f102520: 24429fc0 */ addiu $v0,$v0,%lo(g_Vars) -/* f102524: 8c4e0298 */ lw $t6,0x298($v0) -/* f102528: 27bdffe8 */ addiu $sp,$sp,-24 -/* f10252c: afbf0014 */ sw $ra,0x14($sp) -/* f102530: 05c10004 */ bgez $t6,.L0f102544 -/* f102534: 00803825 */ or $a3,$a0,$zero -/* f102538: 8c4f029c */ lw $t7,0x29c($v0) -/* f10253c: 05e20005 */ bltzl $t7,.L0f102554 -/* f102540: 8ca4000c */ lw $a0,0xc($a1) -.L0f102544: -/* f102544: 8c580288 */ lw $t8,0x288($v0) -/* f102548: 10000002 */ beqz $zero,.L0f102554 -/* f10254c: 8f040070 */ lw $a0,0x70($t8) -/* f102550: 8ca4000c */ lw $a0,0xc($a1) -.L0f102554: -/* f102554: 24010006 */ addiu $at,$zero,0x6 -/* f102558: 10e10008 */ beq $a3,$at,.L0f10257c -/* f10255c: 24010008 */ addiu $at,$zero,0x8 -/* f102560: 54e10010 */ bnel $a3,$at,.L0f1025a4 -/* f102564: 00001025 */ or $v0,$zero,$zero -/* f102568: 0fc549e0 */ jal func0f152780 -/* f10256c: 00000000 */ sll $zero,$zero,0x0 -/* f102570: 2c590001 */ sltiu $t9,$v0,0x1 -/* f102574: 1000000b */ beqz $zero,.L0f1025a4 -/* f102578: 03201025 */ or $v0,$t9,$zero -.L0f10257c: -/* f10257c: 8cc50000 */ lw $a1,0x0($a2) -/* f102580: 2ca80001 */ sltiu $t0,$a1,0x1 -/* f102584: 0fc54a52 */ jal func0f152948 -/* f102588: 01002825 */ or $a1,$t0,$zero -/* f10258c: 3c02800a */ lui $v0,%hi(g_Vars) -/* f102590: 24429fc0 */ addiu $v0,$v0,%lo(g_Vars) -/* f102594: 8c490458 */ lw $t1,0x458($v0) -/* f102598: 352a0001 */ ori $t2,$t1,0x1 -/* f10259c: ac4a0458 */ sw $t2,0x458($v0) -/* f1025a0: 00001025 */ or $v0,$zero,$zero -.L0f1025a4: -/* f1025a4: 8fbf0014 */ lw $ra,0x14($sp) -/* f1025a8: 27bd0018 */ addiu $sp,$sp,0x18 -/* f1025ac: 03e00008 */ jr $ra -/* f1025b0: 00000000 */ sll $zero,$zero,0x0 -); +s32 menuhandlerReversePitch(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 !optionsGetForwardPitch(optionsindex); + case MENUOP_SET: + optionsSetForwardPitch(optionsindex, *enable == false); + g_Vars.unk000458 |= 1; + } + + return 0; +} GLOBAL_ASM( glabel menuhandlerAimControl diff --git a/src/game/game_10ccd0.c b/src/game/game_10ccd0.c index bcc463ffd..ac66b0004 100644 --- a/src/game/game_10ccd0.c +++ b/src/game/game_10ccd0.c @@ -2783,7 +2783,7 @@ glabel func0f10f204 /* f10f268: 0fc47961 */ jal func0f11e584 /* f10f26c: 02002825 */ or $a1,$s0,$zero /* f10f270: 8fa40024 */ lw $a0,0x24($sp) -/* f10f274: 0fc54a52 */ jal func0f152948 +/* f10f274: 0fc54a52 */ jal optionsSetForwardPitch /* f10f278: 00402825 */ or $a1,$v0,$zero /* f10f27c: 24040001 */ addiu $a0,$zero,0x1 /* f10f280: 0fc47961 */ jal func0f11e584 @@ -2855,7 +2855,7 @@ glabel func0f10f204 /* f10f388: 0fc47961 */ jal func0f11e584 /* f10f38c: 02002825 */ or $a1,$s0,$zero /* f10f390: 8fa40020 */ lw $a0,0x20($sp) -/* f10f394: 0fc54a52 */ jal func0f152948 +/* f10f394: 0fc54a52 */ jal optionsSetForwardPitch /* f10f398: 00402825 */ or $a1,$v0,$zero /* f10f39c: 2404000d */ addiu $a0,$zero,0xd /* f10f3a0: 0fc47961 */ jal func0f11e584 @@ -3659,7 +3659,7 @@ glabel func0f10feac .L0f10ff20: /* f10ff20: 3c018007 */ lui $at,0x8007 /* f10ff24: ac325bd0 */ sw $s2,0x5bd0($at) -/* f10ff28: 0fc549e0 */ jal func0f152780 +/* f10ff28: 0fc549e0 */ jal optionsGetForwardPitch /* f10ff2c: 02602025 */ or $a0,$s3,$zero /* f10ff30: 3c10800a */ lui $s0,0x800a /* f10ff34: 26102214 */ addiu $s0,$s0,0x2214 @@ -3733,7 +3733,7 @@ glabel func0f10feac /* f110044: 02002825 */ or $a1,$s0,$zero /* f110048: 0fc4794c */ jal func0f11e530 /* f11004c: 00403025 */ or $a2,$v0,$zero -/* f110050: 0fc549e0 */ jal func0f152780 +/* f110050: 0fc549e0 */ jal optionsGetForwardPitch /* f110054: 02202025 */ or $a0,$s1,$zero /* f110058: 2404000c */ addiu $a0,$zero,0xc /* f11005c: 02002825 */ or $a1,$s0,$zero diff --git a/src/game/game_152710.c b/src/game/game_152710.c index 61e861365..a218b0263 100644 --- a/src/game/game_152710.c +++ b/src/game/game_152710.c @@ -51,18 +51,10 @@ glabel func0f152764 /* f15277c: 8042c7fe */ lb $v0,-0x3802($v0) ); -GLOBAL_ASM( -glabel func0f152780 -/* f152780: 00047080 */ sll $t6,$a0,0x2 -/* f152784: 01c47021 */ addu $t6,$t6,$a0 -/* f152788: 000e7140 */ sll $t6,$t6,0x5 -/* f15278c: 3c02800b */ lui $v0,0x800b -/* f152790: 004e1021 */ addu $v0,$v0,$t6 -/* f152794: 9442c800 */ lhu $v0,-0x3800($v0) -/* f152798: 304f0001 */ andi $t7,$v0,0x1 -/* f15279c: 03e00008 */ jr $ra -/* f1527a0: 000f102b */ sltu $v0,$zero,$t7 -); +s32 optionsGetForwardPitch(s32 optionsindex) +{ + return (g_Options[optionsindex].unk48 & OPTION_FORWARDPITCH) != 0; +} GLOBAL_ASM( glabel func0f1527a4 @@ -157,32 +149,14 @@ s32 optionsGetHeadRoll(s32 optionsindex) return (g_Options[optionsindex].unk48 & OPTION_HEADROLL) != 0; } -GLOBAL_ASM( -glabel func0f152948 -/* f152948: 10a0000b */ beqz $a1,.L0f152978 -/* f15294c: 00044080 */ sll $t0,$a0,0x2 -/* f152950: 00047080 */ sll $t6,$a0,0x2 -/* f152954: 01c47021 */ addu $t6,$t6,$a0 -/* f152958: 3c0f800b */ lui $t7,%hi(g_Options) -/* f15295c: 25efc7b8 */ addiu $t7,$t7,%lo(g_Options) -/* f152960: 000e7140 */ sll $t6,$t6,0x5 -/* f152964: 01cf1021 */ addu $v0,$t6,$t7 -/* f152968: 94580048 */ lhu $t8,0x48($v0) -/* f15296c: 37190001 */ ori $t9,$t8,0x1 -/* f152970: 03e00008 */ jr $ra -/* f152974: a4590048 */ sh $t9,0x48($v0) -.L0f152978: -/* f152978: 01044021 */ addu $t0,$t0,$a0 -/* f15297c: 3c09800b */ lui $t1,%hi(g_Options) -/* f152980: 2529c7b8 */ addiu $t1,$t1,%lo(g_Options) -/* f152984: 00084140 */ sll $t0,$t0,0x5 -/* f152988: 01091021 */ addu $v0,$t0,$t1 -/* f15298c: 944a0048 */ lhu $t2,0x48($v0) -/* f152990: 314bfffe */ andi $t3,$t2,0xfffe -/* f152994: a44b0048 */ sh $t3,0x48($v0) -/* f152998: 03e00008 */ jr $ra -/* f15299c: 00000000 */ sll $zero,$zero,0x0 -); +void optionsSetForwardPitch(s32 optionsindex, bool enable) +{ + if (enable) { + g_Options[optionsindex].unk48 |= OPTION_FORWARDPITCH; + } else { + g_Options[optionsindex].unk48 &= ~OPTION_FORWARDPITCH; + } +} GLOBAL_ASM( glabel func0f1529a0 diff --git a/src/include/constants.h b/src/include/constants.h index ed20cd655..54d4c0cc7 100644 --- a/src/include/constants.h +++ b/src/include/constants.h @@ -658,6 +658,7 @@ #define OPERATOR_LESS_THAN 0 #define OPERATOR_GREATER_THAN 1 +#define OPTION_FORWARDPITCH 0x0001 #define OPTION_LOOKAHEAD 0x0002 #define OPTION_AMMOONSCREEN 0x0020 #define OPTION_SHOWGUNFUNCTION 0x0040 diff --git a/src/include/game/game_152710.h b/src/include/game/game_152710.h index 397c68e9e..83298779b 100644 --- a/src/include/game/game_152710.h +++ b/src/include/game/game_152710.h @@ -7,7 +7,7 @@ u32 func0f152710(void); u32 func0f15272c(void); u32 func0f152748(void); u32 func0f152764(void); -u32 func0f152780(void); +s32 optionsGetForwardPitch(s32 optionsindex); u32 func0f1527a4(void); s32 optionsGetLookAhead(s32 optionsindex); u32 func0f1527ec(void); @@ -21,7 +21,8 @@ s32 optionsGetShowMissionTime(s32 optionsindex); u32 func0f15290c(void); u32 func0f152918(void); s32 optionsGetHeadRoll(s32 optionsindex); -u32 func0f152948(void); + +void optionsSetForwardPitch(s32 optionsindex, bool enable); u32 func0f1529a0(void); void optionsSetLookAhead(s32 optionsindex, bool enable); u32 func0f152a50(void);