diff --git a/src/game/game_01b0a0.c b/src/game/game_01b0a0.c index 431e2e799..6fb9bcd95 100644 --- a/src/game/game_01b0a0.c +++ b/src/game/game_01b0a0.c @@ -19,11 +19,6 @@ #include "lib/lib_13900.h" #include "types.h" -const u32 var7f1a85a0[] = {0x00000000}; -const u32 var7f1a85a4[] = {0x3e89374c}; -const u32 var7f1a85a8[] = {0x4196cbe4}; -const u32 var7f1a85ac[] = {0x4196cbe4}; - f32 pdmodeGetReaction(void) { return 0; @@ -68,960 +63,393 @@ void titleSetNextStage(s32 stagenum) g_TitleNextStage = stagenum; } -GLOBAL_ASM( -glabel activemenuTick -/* f01b160: 27bdff20 */ addiu $sp,$sp,-224 -/* f01b164: 3c06800a */ lui $a2,%hi(g_Vars) -/* f01b168: 24c69fc0 */ addiu $a2,$a2,%lo(g_Vars) -/* f01b16c: 8ccf006c */ lw $t7,0x6c($a2) -/* f01b170: 8cce028c */ lw $t6,0x28c($a2) -/* f01b174: afbf0044 */ sw $ra,0x44($sp) -/* f01b178: afbe0040 */ sw $s8,0x40($sp) -/* f01b17c: afb7003c */ sw $s7,0x3c($sp) -/* f01b180: afb60038 */ sw $s6,0x38($sp) -/* f01b184: afb50034 */ sw $s5,0x34($sp) -/* f01b188: afb40030 */ sw $s4,0x30($sp) -/* f01b18c: afb3002c */ sw $s3,0x2c($sp) -/* f01b190: afb20028 */ sw $s2,0x28($sp) -/* f01b194: afb10024 */ sw $s1,0x24($sp) -/* f01b198: afb00020 */ sw $s0,0x20($sp) -/* f01b19c: f7b40018 */ sdc1 $f20,0x18($sp) -/* f01b1a0: 00003825 */ or $a3,$zero,$zero -/* f01b1a4: 11e00003 */ beqz $t7,.L0f01b1b4 -/* f01b1a8: afae00dc */ sw $t6,0xdc($sp) -/* f01b1ac: 10000002 */ b .L0f01b1b8 -/* f01b1b0: 24050001 */ addiu $a1,$zero,0x1 -.L0f01b1b4: -/* f01b1b4: 00002825 */ or $a1,$zero,$zero -.L0f01b1b8: -/* f01b1b8: 8cd80068 */ lw $t8,0x68($a2) -/* f01b1bc: 00002025 */ or $a0,$zero,$zero -/* f01b1c0: 00001825 */ or $v1,$zero,$zero -/* f01b1c4: 13000003 */ beqz $t8,.L0f01b1d4 -/* f01b1c8: 00001025 */ or $v0,$zero,$zero -/* f01b1cc: 10000001 */ b .L0f01b1d4 -/* f01b1d0: 24040001 */ addiu $a0,$zero,0x1 -.L0f01b1d4: -/* f01b1d4: 8cd90064 */ lw $t9,0x64($a2) -/* f01b1d8: 3c017f1b */ lui $at,%hi(var7f1a85a4) -/* f01b1dc: 13200003 */ beqz $t9,.L0f01b1ec -/* f01b1e0: 00000000 */ nop -/* f01b1e4: 10000001 */ b .L0f01b1ec -/* f01b1e8: 24030001 */ addiu $v1,$zero,0x1 -.L0f01b1ec: -/* f01b1ec: 8cc80070 */ lw $t0,0x70($a2) -/* f01b1f0: 11000003 */ beqz $t0,.L0f01b200 -/* f01b1f4: 00000000 */ nop -/* f01b1f8: 10000001 */ b .L0f01b200 -/* f01b1fc: 24020001 */ addiu $v0,$zero,0x1 -.L0f01b200: -/* f01b200: 00434821 */ addu $t1,$v0,$v1 -/* f01b204: 01245021 */ addu $t2,$t1,$a0 -/* f01b208: 01455821 */ addu $t3,$t2,$a1 -/* f01b20c: 19600313 */ blez $t3,.L0f01be5c -/* f01b210: 00000000 */ nop -/* f01b214: afa700d8 */ sw $a3,0xd8($sp) -/* f01b218: c43485a4 */ lwc1 $f20,%lo(var7f1a85a4)($at) -.L0f01b21c: -/* f01b21c: 0fc4a24b */ jal setCurrentPlayerNum -/* f01b220: 8fa400d8 */ lw $a0,0xd8($sp) -/* f01b224: 3c07800a */ lui $a3,%hi(g_Vars) -/* f01b228: 24e79fc0 */ addiu $a3,$a3,%lo(g_Vars) -/* f01b22c: 8cec028c */ lw $t4,0x28c($a3) -/* f01b230: 3c01800a */ lui $at,%hi(g_ActiveMenuIndex) -/* f01b234: 3c0d800a */ lui $t5,%hi(g_ActiveMenuIndex) -/* f01b238: ac2c21b8 */ sw $t4,%lo(g_ActiveMenuIndex)($at) -/* f01b23c: 8dad21b8 */ lw $t5,%lo(g_ActiveMenuIndex)($t5) -/* f01b240: 3c0f800a */ lui $t7,%hi(g_ActiveMenus+0x30) -/* f01b244: 2404003c */ addiu $a0,$zero,0x3c -/* f01b248: 000d70c0 */ sll $t6,$t5,0x3 -/* f01b24c: 01cd7023 */ subu $t6,$t6,$t5 -/* f01b250: 000e70c0 */ sll $t6,$t6,0x3 -/* f01b254: 01ee7821 */ addu $t7,$t7,$t6 -/* f01b258: 91ef2100 */ lbu $t7,%lo(g_ActiveMenus+0x30)($t7) -/* f01b25c: 00002825 */ or $a1,$zero,$zero -/* f01b260: 51e0000f */ beqzl $t7,.L0f01b2a0 -/* f01b264: 8ce80318 */ lw $t0,0x318($a3) -/* f01b268: 0fc2a257 */ jal currentPlayerConsiderToggleGunFunction -/* f01b26c: 24060001 */ addiu $a2,$zero,0x1 -/* f01b270: 18400009 */ blez $v0,.L0f01b298 -/* f01b274: 3c07800a */ lui $a3,%hi(g_Vars) -/* f01b278: 3c18800a */ lui $t8,%hi(g_ActiveMenuIndex) -/* f01b27c: 8f1821b8 */ lw $t8,%lo(g_ActiveMenuIndex)($t8) -/* f01b280: 3c01800a */ lui $at,%hi(g_ActiveMenus+0x30) -/* f01b284: 0018c8c0 */ sll $t9,$t8,0x3 -/* f01b288: 0338c823 */ subu $t9,$t9,$t8 -/* f01b28c: 0019c8c0 */ sll $t9,$t9,0x3 -/* f01b290: 00390821 */ addu $at,$at,$t9 -/* f01b294: a0202100 */ sb $zero,%lo(g_ActiveMenus+0x30)($at) -.L0f01b298: -/* f01b298: 24e79fc0 */ addiu $a3,$a3,%lo(g_Vars) -/* f01b29c: 8ce80318 */ lw $t0,0x318($a3) -.L0f01b2a0: -/* f01b2a0: 1500000f */ bnez $t0,.L0f01b2e0 -/* f01b2a4: 00000000 */ nop -/* f01b2a8: 0fc44a54 */ jal currentPlayerGetNumInvItems -/* f01b2ac: 00000000 */ nop -/* f01b2b0: 3c09800a */ lui $t1,%hi(g_ActiveMenuIndex) -/* f01b2b4: 8d2921b8 */ lw $t1,%lo(g_ActiveMenuIndex)($t1) -/* f01b2b8: 3c0b800a */ lui $t3,%hi(g_ActiveMenus+0x31) -/* f01b2bc: 000950c0 */ sll $t2,$t1,0x3 -/* f01b2c0: 01495023 */ subu $t2,$t2,$t1 -/* f01b2c4: 000a50c0 */ sll $t2,$t2,0x3 -/* f01b2c8: 016a5821 */ addu $t3,$t3,$t2 -/* f01b2cc: 916b2101 */ lbu $t3,%lo(g_ActiveMenus+0x31)($t3) -/* f01b2d0: 104b0003 */ beq $v0,$t3,.L0f01b2e0 -/* f01b2d4: 00000000 */ nop -/* f01b2d8: 0fc3fb35 */ jal activemenuAssignWeaponSlots -/* f01b2dc: 00000000 */ nop -.L0f01b2e0: -/* f01b2e0: 3c07800a */ lui $a3,%hi(g_Vars) -/* f01b2e4: 24e79fc0 */ addiu $a3,$a3,%lo(g_Vars) -/* f01b2e8: 8cec0284 */ lw $t4,0x284($a3) -/* f01b2ec: 918d0250 */ lbu $t5,0x250($t4) -/* f01b2f0: 11a00244 */ beqz $t5,.L0f01bc04 -/* f01b2f4: 00000000 */ nop -/* f01b2f8: 8cee0288 */ lw $t6,0x288($a3) -/* f01b2fc: 0000f025 */ or $s8,$zero,$zero -/* f01b300: 0fc549c4 */ jal optionsGetControlMode -/* f01b304: 8dc40070 */ lw $a0,0x70($t6) -/* f01b308: 3c0f800a */ lui $t7,%hi(g_Vars+0x288) -/* f01b30c: 8defa248 */ lw $t7,%lo(g_Vars+0x288)($t7) -/* f01b310: afa200d4 */ sw $v0,0xd4($sp) -/* f01b314: 0fc549d2 */ jal optionsGetContpadNum1 -/* f01b318: 8de40070 */ lw $a0,0x70($t7) -/* f01b31c: 0c005207 */ jal contGetNumSamples -/* f01b320: a3a200d3 */ sb $v0,0xd3($sp) -/* f01b324: 18400237 */ blez $v0,.L0f01bc04 -/* f01b328: afa200cc */ sw $v0,0xcc($sp) -/* f01b32c: a3a000c7 */ sb $zero,0xc7($sp) -.L0f01b330: -/* f01b330: 03c02025 */ or $a0,$s8,$zero -/* f01b334: 83a500d3 */ lb $a1,0xd3($sp) -/* f01b338: afa000b8 */ sw $zero,0xb8($sp) -/* f01b33c: 24150001 */ addiu $s5,$zero,0x1 -/* f01b340: 24140001 */ addiu $s4,$zero,0x1 -/* f01b344: afa000b0 */ sw $zero,0xb0($sp) -/* f01b348: 0c005212 */ jal contGetStickXOnSample -/* f01b34c: afa000ac */ sw $zero,0xac($sp) -/* f01b350: 0002b600 */ sll $s6,$v0,0x18 -/* f01b354: 0016c603 */ sra $t8,$s6,0x18 -/* f01b358: 0300b025 */ or $s6,$t8,$zero -/* f01b35c: 03c02025 */ or $a0,$s8,$zero -/* f01b360: 0c005241 */ jal contGetStickYOnSample -/* f01b364: 83a500d3 */ lb $a1,0xd3($sp) -/* f01b368: 0002be00 */ sll $s7,$v0,0x18 -/* f01b36c: 0017ce03 */ sra $t9,$s7,0x18 -/* f01b370: 0320b825 */ or $s7,$t9,$zero -/* f01b374: 03c02025 */ or $a0,$s8,$zero -/* f01b378: 83a500d3 */ lb $a1,0xd3($sp) -/* f01b37c: 0c00529e */ jal contGetButtonsOnSample -/* f01b380: 3406ffff */ dli $a2,0xffff -/* f01b384: 3051ffff */ andi $s1,$v0,0xffff -/* f01b388: 03c02025 */ or $a0,$s8,$zero -/* f01b38c: 83a500d3 */ lb $a1,0xd3($sp) -/* f01b390: 0c0052d4 */ jal contGetButtonsPressedOnSample -/* f01b394: 3406ffff */ dli $a2,0xffff -/* f01b398: 3c08800a */ lui $t0,%hi(g_ActiveMenuIndex) -/* f01b39c: 8d0821b8 */ lw $t0,%lo(g_ActiveMenuIndex)($t0) -/* f01b3a0: 3c0a800a */ lui $t2,%hi(g_ActiveMenus) -/* f01b3a4: 254a20d0 */ addiu $t2,$t2,%lo(g_ActiveMenus) -/* f01b3a8: 000848c0 */ sll $t1,$t0,0x3 -/* f01b3ac: 01284823 */ subu $t1,$t1,$t0 -/* f01b3b0: 000948c0 */ sll $t1,$t1,0x3 -/* f01b3b4: 012a8021 */ addu $s0,$t1,$t2 -/* f01b3b8: a2000032 */ sb $zero,0x32($s0) -/* f01b3bc: 3c0b800a */ lui $t3,%hi(g_Vars+0x284) -/* f01b3c0: 8d6ba244 */ lw $t3,%lo(g_Vars+0x284)($t3) -/* f01b3c4: a7a200be */ sh $v0,0xbe($sp) -/* f01b3c8: 24010002 */ addiu $at,$zero,0x2 -/* f01b3cc: 916c0250 */ lbu $t4,0x250($t3) -/* f01b3d0: 02206825 */ or $t5,$s1,$zero -/* f01b3d4: 55810006 */ bnel $t4,$at,.L0f01b3f0 -/* f01b3d8: 8faf00d4 */ lw $t7,0xd4($sp) -/* f01b3dc: 31b18000 */ andi $s1,$t5,0x8000 -/* f01b3e0: 0000b025 */ or $s6,$zero,$zero -/* f01b3e4: 0000b825 */ or $s7,$zero,$zero -/* f01b3e8: a7a000be */ sh $zero,0xbe($sp) -/* f01b3ec: 8faf00d4 */ lw $t7,0xd4($sp) -.L0f01b3f0: -/* f01b3f0: 24010002 */ addiu $at,$zero,0x2 -/* f01b3f4: 32380010 */ andi $t8,$s1,0x10 -/* f01b3f8: 11e10003 */ beq $t7,$at,.L0f01b408 -/* f01b3fc: 24010003 */ addiu $at,$zero,0x3 -/* f01b400: 15e1000c */ bne $t7,$at,.L0f01b434 -/* f01b404: 322b8000 */ andi $t3,$s1,0x8000 -.L0f01b408: -/* f01b408: 17000003 */ bnez $t8,.L0f01b418 -/* f01b40c: 02209025 */ or $s2,$s1,$zero -/* f01b410: 32390020 */ andi $t9,$s1,0x20 -/* f01b414: 13200002 */ beqz $t9,.L0f01b420 -.L0f01b418: -/* f01b418: 24080001 */ addiu $t0,$zero,0x1 -/* f01b41c: afa800b0 */ sw $t0,0xb0($sp) -.L0f01b420: -/* f01b420: 32498000 */ andi $t1,$s2,0x8000 -/* f01b424: 1120000d */ beqz $t1,.L0f01b45c -/* f01b428: 240a0001 */ addiu $t2,$zero,0x1 -/* f01b42c: 1000000b */ b .L0f01b45c -/* f01b430: a20a0032 */ sb $t2,0x32($s0) -.L0f01b434: -/* f01b434: 11600003 */ beqz $t3,.L0f01b444 -/* f01b438: 02209025 */ or $s2,$s1,$zero -/* f01b43c: 240c0001 */ addiu $t4,$zero,0x1 -/* f01b440: afac00b0 */ sw $t4,0xb0($sp) -.L0f01b444: -/* f01b444: 324d0010 */ andi $t5,$s2,0x10 -/* f01b448: 15a00002 */ bnez $t5,.L0f01b454 -/* f01b44c: 324e0020 */ andi $t6,$s2,0x20 -/* f01b450: 11c00002 */ beqz $t6,.L0f01b45c -.L0f01b454: -/* f01b454: 240f0001 */ addiu $t7,$zero,0x1 -/* f01b458: a20f0032 */ sb $t7,0x32($s0) -.L0f01b45c: -/* f01b45c: 92020032 */ lbu $v0,0x32($s0) -/* f01b460: 10400016 */ beqz $v0,.L0f01b4bc -/* f01b464: 00000000 */ nop -/* f01b468: 82030000 */ lb $v1,0x0($s0) -/* f01b46c: 28610002 */ slti $at,$v1,0x2 -/* f01b470: 14200012 */ bnez $at,.L0f01b4bc -/* f01b474: 00000000 */ nop -/* f01b478: 82180034 */ lb $t8,0x34($s0) -/* f01b47c: 24190002 */ addiu $t9,$zero,0x2 -/* f01b480: 00002025 */ or $a0,$zero,$zero -/* f01b484: 1700000d */ bnez $t8,.L0f01b4bc -/* f01b488: 00000000 */ nop -/* f01b48c: a2030034 */ sb $v1,0x34($s0) -/* f01b490: 0fc3fade */ jal activemenuChangeScreen -/* f01b494: a2190000 */ sb $t9,0x0($s0) -/* f01b498: 3c08800a */ lui $t0,%hi(g_ActiveMenuIndex) -/* f01b49c: 8d0821b8 */ lw $t0,%lo(g_ActiveMenuIndex)($t0) -/* f01b4a0: 3c0a800a */ lui $t2,%hi(g_ActiveMenus) -/* f01b4a4: 254a20d0 */ addiu $t2,$t2,%lo(g_ActiveMenus) -/* f01b4a8: 000848c0 */ sll $t1,$t0,0x3 -/* f01b4ac: 01284823 */ subu $t1,$t1,$t0 -/* f01b4b0: 000948c0 */ sll $t1,$t1,0x3 -/* f01b4b4: 012a8021 */ addu $s0,$t1,$t2 -/* f01b4b8: 92020032 */ lbu $v0,0x32($s0) -.L0f01b4bc: -/* f01b4bc: 54400009 */ bnezl $v0,.L0f01b4e4 -/* f01b4c0: 324b0008 */ andi $t3,$s2,0x8 -/* f01b4c4: 82020034 */ lb $v0,0x34($s0) -/* f01b4c8: 00002025 */ or $a0,$zero,$zero -/* f01b4cc: 50400005 */ beqzl $v0,.L0f01b4e4 -/* f01b4d0: 324b0008 */ andi $t3,$s2,0x8 -/* f01b4d4: a2020000 */ sb $v0,0x0($s0) -/* f01b4d8: 0fc3fade */ jal activemenuChangeScreen -/* f01b4dc: a2000034 */ sb $zero,0x34($s0) -/* f01b4e0: 324b0008 */ andi $t3,$s2,0x8 -.L0f01b4e4: -/* f01b4e4: 11600002 */ beqz $t3,.L0f01b4f0 -/* f01b4e8: 324c0004 */ andi $t4,$s2,0x4 -/* f01b4ec: 0000a025 */ or $s4,$zero,$zero -.L0f01b4f0: -/* f01b4f0: 11800002 */ beqz $t4,.L0f01b4fc -/* f01b4f4: 324d0002 */ andi $t5,$s2,0x2 -/* f01b4f8: 24140002 */ addiu $s4,$zero,0x2 -.L0f01b4fc: -/* f01b4fc: 11a00002 */ beqz $t5,.L0f01b508 -/* f01b500: 324e0001 */ andi $t6,$s2,0x1 -/* f01b504: 0000a825 */ or $s5,$zero,$zero -.L0f01b508: -/* f01b508: 11c00002 */ beqz $t6,.L0f01b514 -/* f01b50c: 324f0800 */ andi $t7,$s2,0x800 -/* f01b510: 24150002 */ addiu $s5,$zero,0x2 -.L0f01b514: -/* f01b514: 11e00002 */ beqz $t7,.L0f01b520 -/* f01b518: 32580400 */ andi $t8,$s2,0x400 -/* f01b51c: 0000a025 */ or $s4,$zero,$zero -.L0f01b520: -/* f01b520: 13000002 */ beqz $t8,.L0f01b52c -/* f01b524: 32590200 */ andi $t9,$s2,0x200 -/* f01b528: 24140002 */ addiu $s4,$zero,0x2 -.L0f01b52c: -/* f01b52c: 13200002 */ beqz $t9,.L0f01b538 -/* f01b530: 32480100 */ andi $t0,$s2,0x100 -/* f01b534: 0000a825 */ or $s5,$zero,$zero -.L0f01b538: -/* f01b538: 11000002 */ beqz $t0,.L0f01b544 -/* f01b53c: 8fa900d4 */ lw $t1,0xd4($sp) -/* f01b540: 24150002 */ addiu $s5,$zero,0x2 -.L0f01b544: -/* f01b544: 24010006 */ addiu $at,$zero,0x6 -/* f01b548: 11210008 */ beq $t1,$at,.L0f01b56c -/* f01b54c: 3c0a800a */ lui $t2,%hi(g_Vars+0x288) -/* f01b550: 24010007 */ addiu $at,$zero,0x7 -/* f01b554: 11210005 */ beq $t1,$at,.L0f01b56c -/* f01b558: 24010005 */ addiu $at,$zero,0x5 -/* f01b55c: 11210003 */ beq $t1,$at,.L0f01b56c -/* f01b560: 24010004 */ addiu $at,$zero,0x4 -/* f01b564: 15210089 */ bne $t1,$at,.L0f01b78c -/* f01b568: 00000000 */ nop -.L0f01b56c: -/* f01b56c: 8d4aa248 */ lw $t2,%lo(g_Vars+0x288)($t2) -/* f01b570: 0fc549d9 */ jal optionsGetContpadNum2 -/* f01b574: 8d440070 */ lw $a0,0x70($t2) -/* f01b578: 00028600 */ sll $s0,$v0,0x18 -/* f01b57c: 00022e00 */ sll $a1,$v0,0x18 -/* f01b580: 00105e03 */ sra $t3,$s0,0x18 -/* f01b584: 00056603 */ sra $t4,$a1,0x18 -/* f01b588: 01608025 */ or $s0,$t3,$zero -/* f01b58c: 01802825 */ or $a1,$t4,$zero -/* f01b590: 0c005212 */ jal contGetStickXOnSample -/* f01b594: 03c02025 */ or $a0,$s8,$zero -/* f01b598: 00029600 */ sll $s2,$v0,0x18 -/* f01b59c: 00102e00 */ sll $a1,$s0,0x18 -/* f01b5a0: 00126e03 */ sra $t5,$s2,0x18 -/* f01b5a4: 00057603 */ sra $t6,$a1,0x18 -/* f01b5a8: 01a09025 */ or $s2,$t5,$zero -/* f01b5ac: 01c02825 */ or $a1,$t6,$zero -/* f01b5b0: 0c005241 */ jal contGetStickYOnSample -/* f01b5b4: 03c02025 */ or $a0,$s8,$zero -/* f01b5b8: 00029e00 */ sll $s3,$v0,0x18 -/* f01b5bc: 00102e00 */ sll $a1,$s0,0x18 -/* f01b5c0: 00137e03 */ sra $t7,$s3,0x18 -/* f01b5c4: 0005c603 */ sra $t8,$a1,0x18 -/* f01b5c8: 01e09825 */ or $s3,$t7,$zero -/* f01b5cc: 03002825 */ or $a1,$t8,$zero -/* f01b5d0: 03c02025 */ or $a0,$s8,$zero -/* f01b5d4: 0c00529e */ jal contGetButtonsOnSample -/* f01b5d8: 3406ffff */ dli $a2,0xffff -/* f01b5dc: 00102e00 */ sll $a1,$s0,0x18 -/* f01b5e0: 0005ce03 */ sra $t9,$a1,0x18 -/* f01b5e4: 3051ffff */ andi $s1,$v0,0xffff -/* f01b5e8: 03202825 */ or $a1,$t9,$zero -/* f01b5ec: 03c02025 */ or $a0,$s8,$zero -/* f01b5f0: 0c0052d4 */ jal contGetButtonsPressedOnSample -/* f01b5f4: 3406ffff */ dli $a2,0xffff -/* f01b5f8: 3c08800a */ lui $t0,%hi(g_Vars+0x284) -/* f01b5fc: 8d08a244 */ lw $t0,%lo(g_Vars+0x284)($t0) -/* f01b600: 24010002 */ addiu $at,$zero,0x2 -/* f01b604: 3043ffff */ andi $v1,$v0,0xffff -/* f01b608: 91090250 */ lbu $t1,0x250($t0) -/* f01b60c: 02205025 */ or $t2,$s1,$zero -/* f01b610: 240d0001 */ addiu $t5,$zero,0x1 -/* f01b614: 15210005 */ bne $t1,$at,.L0f01b62c -/* f01b618: 240f0001 */ addiu $t7,$zero,0x1 -/* f01b61c: 31518000 */ andi $s1,$t2,0x8000 -/* f01b620: 00009025 */ or $s2,$zero,$zero -/* f01b624: 00009825 */ or $s3,$zero,$zero -/* f01b628: 00001825 */ or $v1,$zero,$zero -.L0f01b62c: -/* f01b62c: 322c8000 */ andi $t4,$s1,0x8000 -/* f01b630: 11800002 */ beqz $t4,.L0f01b63c -/* f01b634: 02201025 */ or $v0,$s1,$zero -/* f01b638: afad00b0 */ sw $t5,0xb0($sp) -.L0f01b63c: -/* f01b63c: 306e2000 */ andi $t6,$v1,0x2000 -/* f01b640: 11c00002 */ beqz $t6,.L0f01b64c -/* f01b644: 30580008 */ andi $t8,$v0,0x8 -/* f01b648: afaf00ac */ sw $t7,0xac($sp) -.L0f01b64c: -/* f01b64c: 13000002 */ beqz $t8,.L0f01b658 -/* f01b650: 30590004 */ andi $t9,$v0,0x4 -/* f01b654: 0000a025 */ or $s4,$zero,$zero -.L0f01b658: -/* f01b658: 13200002 */ beqz $t9,.L0f01b664 -/* f01b65c: 30480002 */ andi $t0,$v0,0x2 -/* f01b660: 24140002 */ addiu $s4,$zero,0x2 -.L0f01b664: -/* f01b664: 11000002 */ beqz $t0,.L0f01b670 -/* f01b668: 30490001 */ andi $t1,$v0,0x1 -/* f01b66c: 0000a825 */ or $s5,$zero,$zero -.L0f01b670: -/* f01b670: 11200002 */ beqz $t1,.L0f01b67c -/* f01b674: 304a0800 */ andi $t2,$v0,0x800 -/* f01b678: 24150002 */ addiu $s5,$zero,0x2 -.L0f01b67c: -/* f01b67c: 11400002 */ beqz $t2,.L0f01b688 -/* f01b680: 304b0400 */ andi $t3,$v0,0x400 -/* f01b684: 0000a025 */ or $s4,$zero,$zero -.L0f01b688: -/* f01b688: 11600002 */ beqz $t3,.L0f01b694 -/* f01b68c: 304c0200 */ andi $t4,$v0,0x200 -/* f01b690: 24140002 */ addiu $s4,$zero,0x2 -.L0f01b694: -/* f01b694: 11800002 */ beqz $t4,.L0f01b6a0 -/* f01b698: 304d0100 */ andi $t5,$v0,0x100 -/* f01b69c: 0000a825 */ or $s5,$zero,$zero -.L0f01b6a0: -/* f01b6a0: 11a00002 */ beqz $t5,.L0f01b6ac -/* f01b6a4: 00121e00 */ sll $v1,$s2,0x18 -/* f01b6a8: 24150002 */ addiu $s5,$zero,0x2 -.L0f01b6ac: -/* f01b6ac: 06410005 */ bgez $s2,.L0f01b6c4 -/* f01b6b0: 0003c603 */ sra $t8,$v1,0x18 -/* f01b6b4: 00121823 */ negu $v1,$s2 -/* f01b6b8: 00037600 */ sll $t6,$v1,0x18 -/* f01b6bc: 10000002 */ b .L0f01b6c8 -/* f01b6c0: 000e1e03 */ sra $v1,$t6,0x18 -.L0f01b6c4: -/* f01b6c4: 03001825 */ or $v1,$t8,$zero -.L0f01b6c8: -/* f01b6c8: 06610005 */ bgez $s3,.L0f01b6e0 -/* f01b6cc: 28610015 */ slti $at,$v1,0x15 -/* f01b6d0: 00131023 */ negu $v0,$s3 -/* f01b6d4: 0002ce00 */ sll $t9,$v0,0x18 -/* f01b6d8: 10000004 */ b .L0f01b6ec -/* f01b6dc: 00191603 */ sra $v0,$t9,0x18 -.L0f01b6e0: -/* f01b6e0: 00131600 */ sll $v0,$s3,0x18 -/* f01b6e4: 00024e03 */ sra $t1,$v0,0x18 -/* f01b6e8: 01201025 */ or $v0,$t1,$zero -.L0f01b6ec: -/* f01b6ec: 10200004 */ beqz $at,.L0f01b700 -/* f01b6f0: 240a0001 */ addiu $t2,$zero,0x1 -/* f01b6f4: 28410015 */ slti $at,$v0,0x15 -/* f01b6f8: 14200024 */ bnez $at,.L0f01b78c -/* f01b6fc: 00000000 */ nop -.L0f01b700: -/* f01b700: 44822000 */ mtc1 $v0,$f4 -/* f01b704: 44833000 */ mtc1 $v1,$f6 -/* f01b708: 46802020 */ cvt.s.w $f0,$f4 -/* f01b70c: 468030a0 */ cvt.s.w $f2,$f6 -/* f01b710: 46020203 */ div.s $f8,$f0,$f2 -/* f01b714: 4614403c */ c.lt.s $f8,$f20 -/* f01b718: 00000000 */ nop -/* f01b71c: 45020008 */ bc1fl .L0f01b740 -/* f01b720: 46001283 */ div.s $f10,$f2,$f0 -/* f01b724: 06410003 */ bgez $s2,.L0f01b734 -/* f01b728: 24140001 */ addiu $s4,$zero,0x1 -/* f01b72c: 10000016 */ b .L0f01b788 -/* f01b730: 0000a825 */ or $s5,$zero,$zero -.L0f01b734: -/* f01b734: 10000014 */ b .L0f01b788 -/* f01b738: 24150002 */ addiu $s5,$zero,0x2 -/* f01b73c: 46001283 */ div.s $f10,$f2,$f0 -.L0f01b740: -/* f01b740: 4614503c */ c.lt.s $f10,$f20 -/* f01b744: 00000000 */ nop -/* f01b748: 45000007 */ bc1f .L0f01b768 -/* f01b74c: 00000000 */ nop -/* f01b750: 06610003 */ bgez $s3,.L0f01b760 -/* f01b754: 24150001 */ addiu $s5,$zero,0x1 -/* f01b758: 1000000b */ b .L0f01b788 -/* f01b75c: 24140002 */ addiu $s4,$zero,0x2 -.L0f01b760: -/* f01b760: 10000009 */ b .L0f01b788 -/* f01b764: 0000a025 */ or $s4,$zero,$zero -.L0f01b768: -/* f01b768: 06410003 */ bgez $s2,.L0f01b778 -/* f01b76c: 24150002 */ addiu $s5,$zero,0x2 -/* f01b770: 10000001 */ b .L0f01b778 -/* f01b774: 0000a825 */ or $s5,$zero,$zero -.L0f01b778: -/* f01b778: 06610003 */ bgez $s3,.L0f01b788 -/* f01b77c: 0000a025 */ or $s4,$zero,$zero -/* f01b780: 10000001 */ b .L0f01b788 -/* f01b784: 24140002 */ addiu $s4,$zero,0x2 -.L0f01b788: -/* f01b788: afaa00b8 */ sw $t2,0xb8($sp) -.L0f01b78c: -/* f01b78c: 3c04800a */ lui $a0,%hi(g_Vars+0x284) -/* f01b790: 06c10005 */ bgez $s6,.L0f01b7a8 -/* f01b794: 8c84a244 */ lw $a0,%lo(g_Vars+0x284)($a0) -/* f01b798: 00161823 */ negu $v1,$s6 -/* f01b79c: 00035e00 */ sll $t3,$v1,0x18 -/* f01b7a0: 10000004 */ b .L0f01b7b4 -/* f01b7a4: 000b1e03 */ sra $v1,$t3,0x18 -.L0f01b7a8: -/* f01b7a8: 00161e00 */ sll $v1,$s6,0x18 -/* f01b7ac: 00036e03 */ sra $t5,$v1,0x18 -/* f01b7b0: 01a01825 */ or $v1,$t5,$zero -.L0f01b7b4: -/* f01b7b4: 06e10005 */ bgez $s7,.L0f01b7cc -/* f01b7b8: 28610015 */ slti $at,$v1,0x15 -/* f01b7bc: 00171023 */ negu $v0,$s7 -/* f01b7c0: 00027600 */ sll $t6,$v0,0x18 -/* f01b7c4: 10000004 */ b .L0f01b7d8 -/* f01b7c8: 000e1603 */ sra $v0,$t6,0x18 -.L0f01b7cc: -/* f01b7cc: 00171600 */ sll $v0,$s7,0x18 -/* f01b7d0: 0002c603 */ sra $t8,$v0,0x18 -/* f01b7d4: 03001025 */ or $v0,$t8,$zero -.L0f01b7d8: -/* f01b7d8: 10200004 */ beqz $at,.L0f01b7ec -/* f01b7dc: 3c09800a */ lui $t1,%hi(g_Vars+0x34) -/* f01b7e0: 28410015 */ slti $at,$v0,0x15 -/* f01b7e4: 54200026 */ bnezl $at,.L0f01b880 -/* f01b7e8: 8c8800d8 */ lw $t0,0xd8($a0) -.L0f01b7ec: -/* f01b7ec: 44828000 */ mtc1 $v0,$f16 -/* f01b7f0: 44839000 */ mtc1 $v1,$f18 -/* f01b7f4: 24190001 */ addiu $t9,$zero,0x1 -/* f01b7f8: 46808020 */ cvt.s.w $f0,$f16 -/* f01b7fc: afb900b8 */ sw $t9,0xb8($sp) -/* f01b800: 468090a0 */ cvt.s.w $f2,$f18 -/* f01b804: 46020103 */ div.s $f4,$f0,$f2 -/* f01b808: 4614203c */ c.lt.s $f4,$f20 -/* f01b80c: 00000000 */ nop -/* f01b810: 45020008 */ bc1fl .L0f01b834 -/* f01b814: 46001183 */ div.s $f6,$f2,$f0 -/* f01b818: 06c10003 */ bgez $s6,.L0f01b828 -/* f01b81c: 24140001 */ addiu $s4,$zero,0x1 -/* f01b820: 10000016 */ b .L0f01b87c -/* f01b824: 0000a825 */ or $s5,$zero,$zero -.L0f01b828: -/* f01b828: 10000014 */ b .L0f01b87c -/* f01b82c: 24150002 */ addiu $s5,$zero,0x2 -/* f01b830: 46001183 */ div.s $f6,$f2,$f0 -.L0f01b834: -/* f01b834: 4614303c */ c.lt.s $f6,$f20 -/* f01b838: 00000000 */ nop -/* f01b83c: 45000007 */ bc1f .L0f01b85c -/* f01b840: 00000000 */ nop -/* f01b844: 06e10003 */ bgez $s7,.L0f01b854 -/* f01b848: 24150001 */ addiu $s5,$zero,0x1 -/* f01b84c: 1000000b */ b .L0f01b87c -/* f01b850: 24140002 */ addiu $s4,$zero,0x2 -.L0f01b854: -/* f01b854: 10000009 */ b .L0f01b87c -/* f01b858: 0000a025 */ or $s4,$zero,$zero -.L0f01b85c: -/* f01b85c: 06c10003 */ bgez $s6,.L0f01b86c -/* f01b860: 24150002 */ addiu $s5,$zero,0x2 -/* f01b864: 10000001 */ b .L0f01b86c -/* f01b868: 0000a825 */ or $s5,$zero,$zero -.L0f01b86c: -/* f01b86c: 06e10003 */ bgez $s7,.L0f01b87c -/* f01b870: 0000a025 */ or $s4,$zero,$zero -/* f01b874: 10000001 */ b .L0f01b87c -/* f01b878: 24140002 */ addiu $s4,$zero,0x2 -.L0f01b87c: -/* f01b87c: 8c8800d8 */ lw $t0,0xd8($a0) -.L0f01b880: -/* f01b880: 3c0c8007 */ lui $t4,%hi(g_MpPlayerNum) -/* f01b884: 11000002 */ beqz $t0,.L0f01b890 -/* f01b888: 00000000 */ nop -/* f01b88c: afa000b0 */ sw $zero,0xb0($sp) -.L0f01b890: -/* f01b890: 8d299ff4 */ lw $t1,%lo(g_Vars+0x34)($t1) -/* f01b894: 55200003 */ bnezl $t1,.L0f01b8a4 -/* f01b898: 8faa00b0 */ lw $t2,0xb0($sp) -/* f01b89c: afa000b0 */ sw $zero,0xb0($sp) -/* f01b8a0: 8faa00b0 */ lw $t2,0xb0($sp) -.L0f01b8a4: -/* f01b8a4: 97af00be */ lhu $t7,0xbe($sp) -/* f01b8a8: 15400016 */ bnez $t2,.L0f01b904 -/* f01b8ac: 31f82000 */ andi $t8,$t7,0x2000 -/* f01b8b0: 908b0250 */ lbu $t3,0x250($a0) -/* f01b8b4: 24010002 */ addiu $at,$zero,0x2 -/* f01b8b8: 1561000e */ bne $t3,$at,.L0f01b8f4 -/* f01b8bc: 00000000 */ nop -/* f01b8c0: 8d8c1448 */ lw $t4,%lo(g_MpPlayerNum)($t4) -/* f01b8c4: 3c0e800a */ lui $t6,%hi(g_Menus+0x4f8) -/* f01b8c8: 000c68c0 */ sll $t5,$t4,0x3 -/* f01b8cc: 01ac6823 */ subu $t5,$t5,$t4 -/* f01b8d0: 000d6880 */ sll $t5,$t5,0x2 -/* f01b8d4: 01ac6821 */ addu $t5,$t5,$t4 -/* f01b8d8: 000d68c0 */ sll $t5,$t5,0x3 -/* f01b8dc: 01ac6823 */ subu $t5,$t5,$t4 -/* f01b8e0: 000d6900 */ sll $t5,$t5,0x4 -/* f01b8e4: 01cd7021 */ addu $t6,$t6,$t5 -/* f01b8e8: 8dcee4f8 */ lw $t6,%lo(g_Menus+0x4f8)($t6) -/* f01b8ec: 15c00005 */ bnez $t6,.L0f01b904 -/* f01b8f0: 00000000 */ nop -.L0f01b8f4: -/* f01b8f4: 0fc3fc10 */ jal activemenuClose -/* f01b8f8: 00000000 */ nop -/* f01b8fc: 100000c1 */ b .L0f01bc04 -/* f01b900: 00000000 */ nop -.L0f01b904: -/* f01b904: 13000002 */ beqz $t8,.L0f01b910 -/* f01b908: 24190001 */ addiu $t9,$zero,0x1 -/* f01b90c: afb900ac */ sw $t9,0xac($sp) -.L0f01b910: -/* f01b910: 8fa800ac */ lw $t0,0xac($sp) -/* f01b914: 3c09800a */ lui $t1,%hi(g_ActiveMenuIndex) -/* f01b918: 51000047 */ beqzl $t0,.L0f01ba38 -/* f01b91c: 83ad00c7 */ lb $t5,0xc7($sp) -/* f01b920: 8d2921b8 */ lw $t1,%lo(g_ActiveMenuIndex)($t1) -/* f01b924: 3c0b800a */ lui $t3,%hi(g_ActiveMenus) -/* f01b928: 256b20d0 */ addiu $t3,$t3,%lo(g_ActiveMenus) -/* f01b92c: 000950c0 */ sll $t2,$t1,0x3 -/* f01b930: 01495023 */ subu $t2,$t2,$t1 -/* f01b934: 000a50c0 */ sll $t2,$t2,0x3 -/* f01b938: 014b8021 */ addu $s0,$t2,$t3 -/* f01b93c: 820c0000 */ lb $t4,0x0($s0) -/* f01b940: 3c0d800a */ lui $t5,%hi(g_Vars+0x474) -/* f01b944: 29810002 */ slti $at,$t4,0x2 -/* f01b948: 54200032 */ bnezl $at,.L0f01ba14 -/* f01b94c: 9204000e */ lbu $a0,0xe($s0) -/* f01b950: 8dada434 */ lw $t5,%lo(g_Vars+0x474)($t5) -/* f01b954: 3c0e800a */ lui $t6,%hi(g_MissionConfig+0x3) -/* f01b958: 51a00010 */ beqzl $t5,.L0f01b99c -/* f01b95c: 9202000e */ lbu $v0,0xe($s0) -/* f01b960: 81cfdfeb */ lb $t7,%lo(g_MissionConfig+0x3)($t6) -/* f01b964: 05e3000d */ bgezl $t7,.L0f01b99c -/* f01b968: 9202000e */ lbu $v0,0xe($s0) -/* f01b96c: 9204000e */ lbu $a0,0xe($s0) -/* f01b970: 24010004 */ addiu $at,$zero,0x4 -/* f01b974: 24180001 */ addiu $t8,$zero,0x1 -/* f01b978: 14810003 */ bne $a0,$at,.L0f01b988 -/* f01b97c: 00000000 */ nop -/* f01b980: 1000002c */ b .L0f01ba34 -/* f01b984: a3b800c7 */ sb $t8,0xc7($sp) -.L0f01b988: -/* f01b988: 0fc3f7c5 */ jal activemenuApply -/* f01b98c: 00000000 */ nop -/* f01b990: 10000029 */ b .L0f01ba38 -/* f01b994: 83ad00c7 */ lb $t5,0xc7($sp) -/* f01b998: 9202000e */ lbu $v0,0xe($s0) -.L0f01b99c: -/* f01b99c: 3c19800b */ lui $t9,%hi(g_ActiveMenuMpBotCommands) -/* f01b9a0: 24010001 */ addiu $at,$zero,0x1 -/* f01b9a4: 0322c821 */ addu $t9,$t9,$v0 -/* f01b9a8: 9339cb78 */ lbu $t9,%lo(g_ActiveMenuMpBotCommands)($t9) -/* f01b9ac: 5721000d */ bnel $t9,$at,.L0f01b9e4 -/* f01b9b0: 920a0032 */ lbu $t2,0x32($s0) -/* f01b9b4: 0fc3f598 */ jal mpOpenPickTarget -/* f01b9b8: 00000000 */ nop -/* f01b9bc: 3c08800a */ lui $t0,%hi(g_ActiveMenuIndex) -/* f01b9c0: 8d0821b8 */ lw $t0,%lo(g_ActiveMenuIndex)($t0) -/* f01b9c4: 3c02800a */ lui $v0,%hi(g_ActiveMenus+0xe) -/* f01b9c8: 000848c0 */ sll $t1,$t0,0x3 -/* f01b9cc: 01284823 */ subu $t1,$t1,$t0 -/* f01b9d0: 000948c0 */ sll $t1,$t1,0x3 -/* f01b9d4: 00491021 */ addu $v0,$v0,$t1 -/* f01b9d8: 10000006 */ b .L0f01b9f4 -/* f01b9dc: 904220de */ lbu $v0,%lo(g_ActiveMenus+0xe)($v0) -/* f01b9e0: 920a0032 */ lbu $t2,0x32($s0) -.L0f01b9e4: -/* f01b9e4: 240b0001 */ addiu $t3,$zero,0x1 -/* f01b9e8: 55400003 */ bnezl $t2,.L0f01b9f8 -/* f01b9ec: 24010004 */ addiu $at,$zero,0x4 -/* f01b9f0: a3ab00c7 */ sb $t3,0xc7($sp) -.L0f01b9f4: -/* f01b9f4: 24010004 */ addiu $at,$zero,0x4 -.L0f01b9f8: -/* f01b9f8: 1041000e */ beq $v0,$at,.L0f01ba34 -/* f01b9fc: 00402025 */ or $a0,$v0,$zero -/* f01ba00: 0fc3f7c5 */ jal activemenuApply -/* f01ba04: 00000000 */ nop -/* f01ba08: 1000000b */ b .L0f01ba38 -/* f01ba0c: 83ad00c7 */ lb $t5,0xc7($sp) -/* f01ba10: 9204000e */ lbu $a0,0xe($s0) -.L0f01ba14: -/* f01ba14: 24010004 */ addiu $at,$zero,0x4 -/* f01ba18: 240c0001 */ addiu $t4,$zero,0x1 -/* f01ba1c: 14810003 */ bne $a0,$at,.L0f01ba2c -/* f01ba20: 00000000 */ nop -/* f01ba24: 10000003 */ b .L0f01ba34 -/* f01ba28: a3ac00c7 */ sb $t4,0xc7($sp) -.L0f01ba2c: -/* f01ba2c: 0fc3f7c5 */ jal activemenuApply -/* f01ba30: 00000000 */ nop -.L0f01ba34: -/* f01ba34: 83ad00c7 */ lb $t5,0xc7($sp) -.L0f01ba38: -/* f01ba38: 11a0001f */ beqz $t5,.L0f01bab8 -/* f01ba3c: 00000000 */ nop -/* f01ba40: 0fc3fade */ jal activemenuChangeScreen -/* f01ba44: 01a02025 */ or $a0,$t5,$zero -/* f01ba48: 3c0e800a */ lui $t6,%hi(g_ActiveMenuIndex) -/* f01ba4c: 8dce21b8 */ lw $t6,%lo(g_ActiveMenuIndex)($t6) -/* f01ba50: 3c18800a */ lui $t8,%hi(g_ActiveMenus) -/* f01ba54: 24010001 */ addiu $at,$zero,0x1 -/* f01ba58: 000e78c0 */ sll $t7,$t6,0x3 -/* f01ba5c: 01ee7823 */ subu $t7,$t7,$t6 -/* f01ba60: 000f78c0 */ sll $t7,$t7,0x3 -/* f01ba64: 030fc021 */ addu $t8,$t8,$t7 -/* f01ba68: 831820d0 */ lb $t8,%lo(g_ActiveMenus)($t8) -/* f01ba6c: 3c04800a */ lui $a0,%hi(g_Vars+0x284) -/* f01ba70: 17010011 */ bne $t8,$at,.L0f01bab8 -/* f01ba74: 00000000 */ nop -/* f01ba78: 8c84a244 */ lw $a0,%lo(g_Vars+0x284)($a0) -/* f01ba7c: 00002825 */ or $a1,$zero,$zero -/* f01ba80: 0fc2c42e */ jal weaponGetFunction -/* f01ba84: 24840638 */ addiu $a0,$a0,1592 -/* f01ba88: 3c04800a */ lui $a0,%hi(g_Vars+0x284) -/* f01ba8c: 8c84a244 */ lw $a0,%lo(g_Vars+0x284)($a0) -/* f01ba90: 00408025 */ or $s0,$v0,$zero -/* f01ba94: 24050001 */ addiu $a1,$zero,0x1 -/* f01ba98: 0fc2c42e */ jal weaponGetFunction -/* f01ba9c: 24840638 */ addiu $a0,$a0,1592 -/* f01baa0: 16000005 */ bnez $s0,.L0f01bab8 -/* f01baa4: 00000000 */ nop -/* f01baa8: 14400003 */ bnez $v0,.L0f01bab8 -/* f01baac: 00000000 */ nop -/* f01bab0: 0fc3fade */ jal activemenuChangeScreen -/* f01bab4: 83a400c7 */ lb $a0,0xc7($sp) -.L0f01bab8: -/* f01bab8: 3c19800a */ lui $t9,%hi(g_Vars+0x284) -/* f01babc: 8f39a244 */ lw $t9,%lo(g_Vars+0x284)($t9) -/* f01bac0: 00144880 */ sll $t1,$s4,0x2 -/* f01bac4: 24010002 */ addiu $at,$zero,0x2 -/* f01bac8: 93280250 */ lbu $t0,0x250($t9) -/* f01bacc: 01344823 */ subu $t1,$t1,$s4 -/* f01bad0: 02a99021 */ addu $s2,$s5,$t1 -/* f01bad4: 11010046 */ beq $t0,$at,.L0f01bbf0 -/* f01bad8: 24010004 */ addiu $at,$zero,0x4 -/* f01badc: 16410011 */ bne $s2,$at,.L0f01bb24 -/* f01bae0: 24110001 */ addiu $s1,$zero,0x1 -/* f01bae4: 3c0a800a */ lui $t2,%hi(g_ActiveMenuIndex) -/* f01bae8: 8d4a21b8 */ lw $t2,%lo(g_ActiveMenuIndex)($t2) -/* f01baec: 3c0c800a */ lui $t4,%hi(g_ActiveMenus) -/* f01baf0: 258c20d0 */ addiu $t4,$t4,%lo(g_ActiveMenus) -/* f01baf4: 000a58c0 */ sll $t3,$t2,0x3 -/* f01baf8: 016a5823 */ subu $t3,$t3,$t2 -/* f01bafc: 000b58c0 */ sll $t3,$t3,0x3 -/* f01bb00: 016c8021 */ addu $s0,$t3,$t4 -/* f01bb04: 8e020014 */ lw $v0,0x14($s0) -/* f01bb08: 1c400004 */ bgtz $v0,.L0f01bb1c -/* f01bb0c: 244dffff */ addiu $t5,$v0,-1 -/* f01bb10: ae000014 */ sw $zero,0x14($s0) -/* f01bb14: 10000036 */ b .L0f01bbf0 -/* f01bb18: a212000e */ sb $s2,0xe($s0) -.L0f01bb1c: -/* f01bb1c: 10000034 */ b .L0f01bbf0 -/* f01bb20: ae0d0014 */ sw $t5,0x14($s0) -.L0f01bb24: -/* f01bb24: 02402025 */ or $a0,$s2,$zero -/* f01bb28: 27a50070 */ addiu $a1,$sp,0x70 -/* f01bb2c: 0fc3f8a0 */ jal activemenuGetSlotDetails -/* f01bb30: 27a60074 */ addiu $a2,$sp,0x74 -/* f01bb34: 3c057f1b */ lui $a1,%hi(var7f1a85a0) -/* f01bb38: 24a585a0 */ addiu $a1,$a1,%lo(var7f1a85a0) -/* f01bb3c: 0c004c9d */ jal strcmp -/* f01bb40: 27a40074 */ addiu $a0,$sp,0x74 -/* f01bb44: 14400002 */ bnez $v0,.L0f01bb50 -/* f01bb48: 3c0e800a */ lui $t6,%hi(g_ActiveMenuIndex) -/* f01bb4c: 00008825 */ or $s1,$zero,$zero -.L0f01bb50: -/* f01bb50: 8dce21b8 */ lw $t6,%lo(g_ActiveMenuIndex)($t6) -/* f01bb54: 3c18800a */ lui $t8,%hi(g_ActiveMenus) -/* f01bb58: 271820d0 */ addiu $t8,$t8,%lo(g_ActiveMenus) -/* f01bb5c: 000e78c0 */ sll $t7,$t6,0x3 -/* f01bb60: 01ee7823 */ subu $t7,$t7,$t6 -/* f01bb64: 000f78c0 */ sll $t7,$t7,0x3 -/* f01bb68: 01f88021 */ addu $s0,$t7,$t8 -/* f01bb6c: 9204000e */ lbu $a0,0xe($s0) -/* f01bb70: 24010004 */ addiu $at,$zero,0x4 -/* f01bb74: 8fb900b8 */ lw $t9,0xb8($sp) -/* f01bb78: 10810019 */ beq $a0,$at,.L0f01bbe0 -/* f01bb7c: 240b000f */ addiu $t3,$zero,0xf -/* f01bb80: 17200017 */ bnez $t9,.L0f01bbe0 -/* f01bb84: 00000000 */ nop -/* f01bb88: 10800007 */ beqz $a0,.L0f01bba8 -/* f01bb8c: 24010002 */ addiu $at,$zero,0x2 -/* f01bb90: 10810005 */ beq $a0,$at,.L0f01bba8 -/* f01bb94: 24010006 */ addiu $at,$zero,0x6 -/* f01bb98: 10810003 */ beq $a0,$at,.L0f01bba8 -/* f01bb9c: 24010008 */ addiu $at,$zero,0x8 -/* f01bba0: 1481000f */ bne $a0,$at,.L0f01bbe0 -/* f01bba4: 00000000 */ nop -.L0f01bba8: -/* f01bba8: 9208000f */ lbu $t0,0xf($s0) -/* f01bbac: 24090002 */ addiu $t1,$zero,0x2 -/* f01bbb0: 52480005 */ beql $s2,$t0,.L0f01bbc8 -/* f01bbb4: 8e020010 */ lw $v0,0x10($s0) -/* f01bbb8: ae090010 */ sw $t1,0x10($s0) -/* f01bbbc: a212000f */ sb $s2,0xf($s0) -/* f01bbc0: 00008825 */ or $s1,$zero,$zero -/* f01bbc4: 8e020010 */ lw $v0,0x10($s0) -.L0f01bbc8: -/* f01bbc8: 18400005 */ blez $v0,.L0f01bbe0 -/* f01bbcc: 00000000 */ nop -/* f01bbd0: 12200003 */ beqz $s1,.L0f01bbe0 -/* f01bbd4: 244affff */ addiu $t2,$v0,-1 -/* f01bbd8: 00008825 */ or $s1,$zero,$zero -/* f01bbdc: ae0a0010 */ sw $t2,0x10($s0) -.L0f01bbe0: -/* f01bbe0: 52200004 */ beqzl $s1,.L0f01bbf4 -/* f01bbe4: 8fac00cc */ lw $t4,0xcc($sp) -/* f01bbe8: ae0b0014 */ sw $t3,0x14($s0) -/* f01bbec: a212000e */ sb $s2,0xe($s0) -.L0f01bbf0: -/* f01bbf0: 8fac00cc */ lw $t4,0xcc($sp) -.L0f01bbf4: -/* f01bbf4: 27de0001 */ addiu $s8,$s8,0x1 -/* f01bbf8: 03cc082a */ slt $at,$s8,$t4 -/* f01bbfc: 5420fdcc */ bnezl $at,.L0f01b330 -/* f01bc00: a3a000c7 */ sb $zero,0xc7($sp) -.L0f01bc04: -/* f01bc04: 3c07800a */ lui $a3,%hi(g_Vars) -/* f01bc08: 24e79fc0 */ addiu $a3,$a3,%lo(g_Vars) -/* f01bc0c: 8ced0284 */ lw $t5,0x284($a3) -/* f01bc10: 24010002 */ addiu $at,$zero,0x2 -/* f01bc14: 3c07800a */ lui $a3,%hi(g_Vars) -/* f01bc18: 91ae0250 */ lbu $t6,0x250($t5) -/* f01bc1c: 00002825 */ or $a1,$zero,$zero -/* f01bc20: 3c0f800a */ lui $t7,%hi(g_ActiveMenuIndex) -/* f01bc24: 11c1006e */ beq $t6,$at,.L0f01bde0 -/* f01bc28: 24e79fc0 */ addiu $a3,$a3,%lo(g_Vars) -/* f01bc2c: 8def21b8 */ lw $t7,%lo(g_ActiveMenuIndex)($t7) -/* f01bc30: 3c19800a */ lui $t9,%hi(g_ActiveMenus) -/* f01bc34: 273920d0 */ addiu $t9,$t9,%lo(g_ActiveMenus) -/* f01bc38: 000fc0c0 */ sll $t8,$t7,0x3 -/* f01bc3c: 030fc023 */ subu $t8,$t8,$t7 -/* f01bc40: 0018c0c0 */ sll $t8,$t8,0x3 -/* f01bc44: 03198021 */ addu $s0,$t8,$t9 -/* f01bc48: 8603000a */ lh $v1,0xa($s0) -/* f01bc4c: 2401ff85 */ addiu $at,$zero,-123 -/* f01bc50: 50610026 */ beql $v1,$at,.L0f01bcec -/* f01bc54: 86020004 */ lh $v0,0x4($s0) -/* f01bc58: 86080006 */ lh $t0,0x6($s0) -/* f01bc5c: 8604000c */ lh $a0,0xc($s0) -/* f01bc60: 860b0008 */ lh $t3,0x8($s0) -/* f01bc64: 00684821 */ addu $t1,$v1,$t0 -/* f01bc68: 05210003 */ bgez $t1,.L0f01bc78 -/* f01bc6c: 00095043 */ sra $t2,$t1,0x1 -/* f01bc70: 25210001 */ addiu $at,$t1,0x1 -/* f01bc74: 00015043 */ sra $t2,$at,0x1 -.L0f01bc78: -/* f01bc78: a60a0006 */ sh $t2,0x6($s0) -/* f01bc7c: 860e0006 */ lh $t6,0x6($s0) -/* f01bc80: 008b6021 */ addu $t4,$a0,$t3 -/* f01bc84: 05810003 */ bgez $t4,.L0f01bc94 -/* f01bc88: 000c6843 */ sra $t5,$t4,0x1 -/* f01bc8c: 25810001 */ addiu $at,$t4,0x1 -/* f01bc90: 00016843 */ sra $t5,$at,0x1 -.L0f01bc94: -/* f01bc94: 01c31023 */ subu $v0,$t6,$v1 -/* f01bc98: 00027c00 */ sll $t7,$v0,0x10 -/* f01bc9c: 000fc403 */ sra $t8,$t7,0x10 -/* f01bca0: 2b010002 */ slti $at,$t8,0x2 -/* f01bca4: 10200006 */ beqz $at,.L0f01bcc0 -/* f01bca8: a60d0008 */ sh $t5,0x8($s0) -/* f01bcac: 2b01ffff */ slti $at,$t8,-1 -/* f01bcb0: 54200004 */ bnezl $at,.L0f01bcc4 -/* f01bcb4: 86190008 */ lh $t9,0x8($s0) -/* f01bcb8: a6030006 */ sh $v1,0x6($s0) -/* f01bcbc: 8604000c */ lh $a0,0xc($s0) -.L0f01bcc0: -/* f01bcc0: 86190008 */ lh $t9,0x8($s0) -.L0f01bcc4: -/* f01bcc4: 03241023 */ subu $v0,$t9,$a0 -/* f01bcc8: 00024400 */ sll $t0,$v0,0x10 -/* f01bccc: 00084c03 */ sra $t1,$t0,0x10 -/* f01bcd0: 29210002 */ slti $at,$t1,0x2 -/* f01bcd4: 10200004 */ beqz $at,.L0f01bce8 -/* f01bcd8: 2921ffff */ slti $at,$t1,-1 -/* f01bcdc: 54200003 */ bnezl $at,.L0f01bcec -/* f01bce0: 86020004 */ lh $v0,0x4($s0) -/* f01bce4: a6040008 */ sh $a0,0x8($s0) -.L0f01bce8: -/* f01bce8: 86020004 */ lh $v0,0x4($s0) -.L0f01bcec: -/* f01bcec: 860c0002 */ lh $t4,0x2($s0) -/* f01bcf0: 24420005 */ addiu $v0,$v0,0x5 -/* f01bcf4: 00025400 */ sll $t2,$v0,0x10 -/* f01bcf8: 000c6880 */ sll $t5,$t4,0x2 -/* f01bcfc: 000a5c03 */ sra $t3,$t2,0x10 -/* f01bd00: 01ac6823 */ subu $t5,$t5,$t4 -/* f01bd04: 01ab7021 */ addu $t6,$t5,$t3 -/* f01bd08: 01601025 */ or $v0,$t3,$zero -/* f01bd0c: 05c10003 */ bgez $t6,.L0f01bd1c -/* f01bd10: 000e7883 */ sra $t7,$t6,0x2 -/* f01bd14: 25c10003 */ addiu $at,$t6,0x3 -/* f01bd18: 00017883 */ sra $t7,$at,0x2 -.L0f01bd1c: -/* f01bd1c: a60f0002 */ sh $t7,0x2($s0) -/* f01bd20: 86180002 */ lh $t8,0x2($s0) -/* f01bd24: 03021823 */ subu $v1,$t8,$v0 -/* f01bd28: 0003cc00 */ sll $t9,$v1,0x10 -/* f01bd2c: 00194403 */ sra $t0,$t9,0x10 -/* f01bd30: 29010002 */ slti $at,$t0,0x2 -/* f01bd34: 10200004 */ beqz $at,.L0f01bd48 -/* f01bd38: 2901ffff */ slti $at,$t0,-1 -/* f01bd3c: 54200003 */ bnezl $at,.L0f01bd4c -/* f01bd40: 3c013f80 */ lui $at,0x3f80 -/* f01bd44: a6020002 */ sh $v0,0x2($s0) -.L0f01bd48: -/* f01bd48: 3c013f80 */ lui $at,0x3f80 -.L0f01bd4c: -/* f01bd4c: 44816000 */ mtc1 $at,$f12 -/* f01bd50: c6000018 */ lwc1 $f0,0x18($s0) -/* f01bd54: 3c01800a */ lui $at,%hi(g_Vars+0x44) -/* f01bd58: 460c003c */ c.lt.s $f0,$f12 -/* f01bd5c: 00000000 */ nop -/* f01bd60: 45000009 */ bc1f .L0f01bd88 -/* f01bd64: 00000000 */ nop -/* f01bd68: c428a004 */ lwc1 $f8,%lo(g_Vars+0x44)($at) -/* f01bd6c: 3c0141f0 */ lui $at,0x41f0 -/* f01bd70: 44815000 */ mtc1 $at,$f10 -/* f01bd74: 00000000 */ nop -/* f01bd78: 460a4403 */ div.s $f16,$f8,$f10 -/* f01bd7c: 46100480 */ add.s $f18,$f0,$f16 -/* f01bd80: e6120018 */ swc1 $f18,0x18($s0) -/* f01bd84: c6000018 */ lwc1 $f0,0x18($s0) -.L0f01bd88: -/* f01bd88: 3c01800a */ lui $at,%hi(g_Vars+0x44) -/* f01bd8c: 4600603c */ c.lt.s $f12,$f0 -/* f01bd90: c422a004 */ lwc1 $f2,%lo(g_Vars+0x44)($at) -/* f01bd94: 3c0140a0 */ lui $at,0x40a0 -/* f01bd98: 44813000 */ mtc1 $at,$f6 -/* f01bd9c: 45000002 */ bc1f .L0f01bda8 -/* f01bda0: 46061203 */ div.s $f8,$f2,$f6 -/* f01bda4: e60c0018 */ swc1 $f12,0x18($s0) -.L0f01bda8: -/* f01bda8: c604001c */ lwc1 $f4,0x1c($s0) -/* f01bdac: 3c017f1b */ lui $at,%hi(var7f1a85a8) -/* f01bdb0: 46082280 */ add.s $f10,$f4,$f8 -/* f01bdb4: e60a001c */ swc1 $f10,0x1c($s0) -/* f01bdb8: c43085a8 */ lwc1 $f16,%lo(var7f1a85a8)($at) -/* f01bdbc: c600001c */ lwc1 $f0,0x1c($s0) -/* f01bdc0: 3c017f1b */ lui $at,%hi(var7f1a85ac) -/* f01bdc4: 4600803c */ c.lt.s $f16,$f0 -/* f01bdc8: 00000000 */ nop -/* f01bdcc: 45020005 */ bc1fl .L0f01bde4 -/* f01bdd0: 8ce9006c */ lw $t1,0x6c($a3) -/* f01bdd4: c43285ac */ lwc1 $f18,%lo(var7f1a85ac)($at) -/* f01bdd8: 46120181 */ sub.s $f6,$f0,$f18 -/* f01bddc: e606001c */ swc1 $f6,0x1c($s0) -.L0f01bde0: -/* f01bde0: 8ce9006c */ lw $t1,0x6c($a3) -.L0f01bde4: -/* f01bde4: 8fa600d8 */ lw $a2,0xd8($sp) -/* f01bde8: 3c0b800a */ lui $t3,%hi(g_Vars+0x64) -/* f01bdec: 11200003 */ beqz $t1,.L0f01bdfc -/* f01bdf0: 24c60001 */ addiu $a2,$a2,0x1 -/* f01bdf4: 10000001 */ b .L0f01bdfc -/* f01bdf8: 24050001 */ addiu $a1,$zero,0x1 -.L0f01bdfc: -/* f01bdfc: 8cea0068 */ lw $t2,0x68($a3) -/* f01be00: 3c0c800a */ lui $t4,%hi(g_Vars+0x70) -/* f01be04: 00002025 */ or $a0,$zero,$zero -/* f01be08: 11400003 */ beqz $t2,.L0f01be18 -/* f01be0c: 00001825 */ or $v1,$zero,$zero -/* f01be10: 10000001 */ b .L0f01be18 -/* f01be14: 24040001 */ addiu $a0,$zero,0x1 -.L0f01be18: -/* f01be18: 8d6ba024 */ lw $t3,%lo(g_Vars+0x64)($t3) -/* f01be1c: 00001025 */ or $v0,$zero,$zero -/* f01be20: 11600003 */ beqz $t3,.L0f01be30 -/* f01be24: 00000000 */ nop -/* f01be28: 10000001 */ b .L0f01be30 -/* f01be2c: 24030001 */ addiu $v1,$zero,0x1 -.L0f01be30: -/* f01be30: 8d8ca030 */ lw $t4,%lo(g_Vars+0x70)($t4) -/* f01be34: 11800003 */ beqz $t4,.L0f01be44 -/* f01be38: 00000000 */ nop -/* f01be3c: 10000001 */ b .L0f01be44 -/* f01be40: 24020001 */ addiu $v0,$zero,0x1 -.L0f01be44: -/* f01be44: 00436821 */ addu $t5,$v0,$v1 -/* f01be48: 01a47021 */ addu $t6,$t5,$a0 -/* f01be4c: 01c57821 */ addu $t7,$t6,$a1 -/* f01be50: 00cf082a */ slt $at,$a2,$t7 -/* f01be54: 1420fcf1 */ bnez $at,.L0f01b21c -/* f01be58: afa600d8 */ sw $a2,0xd8($sp) -.L0f01be5c: -/* f01be5c: 0fc4a24b */ jal setCurrentPlayerNum -/* f01be60: 8fa400dc */ lw $a0,0xdc($sp) -/* f01be64: 8fbf0044 */ lw $ra,0x44($sp) -/* f01be68: d7b40018 */ ldc1 $f20,0x18($sp) -/* f01be6c: 8fb00020 */ lw $s0,0x20($sp) -/* f01be70: 8fb10024 */ lw $s1,0x24($sp) -/* f01be74: 8fb20028 */ lw $s2,0x28($sp) -/* f01be78: 8fb3002c */ lw $s3,0x2c($sp) -/* f01be7c: 8fb40030 */ lw $s4,0x30($sp) -/* f01be80: 8fb50034 */ lw $s5,0x34($sp) -/* f01be84: 8fb60038 */ lw $s6,0x38($sp) -/* f01be88: 8fb7003c */ lw $s7,0x3c($sp) -/* f01be8c: 8fbe0040 */ lw $s8,0x40($sp) -/* f01be90: 03e00008 */ jr $ra -/* f01be94: 27bd00e0 */ addiu $sp,$sp,0xe0 -/* f01be98: 00000000 */ nop -/* f01be9c: 00000000 */ nop -); +void activemenuTick(void) +{ + s32 prevplayernum = g_Vars.currentplayernum; + s32 i; + + for (i = 0; i < PLAYERCOUNT(); i++) { + setCurrentPlayerNum(i); + g_ActiveMenuIndex = g_Vars.currentplayernum; + + if (g_ActiveMenus[g_ActiveMenuIndex].togglefunc) { + if (currentPlayerConsiderToggleGunFunction(60, false, 1) > 0) { + g_ActiveMenus[g_ActiveMenuIndex].togglefunc = false; + } + } else { + // empty + } + + if (g_Vars.normmplayerisrunning == false + && currentPlayerGetNumInvItems() != g_ActiveMenus[g_ActiveMenuIndex].numitems) { + activemenuAssignWeaponSlots(); + } + + if (g_Vars.currentplayer->activemenumode != AMMODE_CLOSED) { + s32 controlmode = optionsGetControlMode(g_Vars.currentplayerstats->mpindex); + s8 contpadnum = optionsGetContpadNum1(g_Vars.currentplayerstats->mpindex); + s32 numsamples = contGetNumSamples(); + s32 j; + + for (j = 0; j < numsamples; j++) { + s8 gotonextscreen = false; + s8 cstickx = contGetStickXOnSample(j, contpadnum); + s8 csticky = contGetStickYOnSample(j, contpadnum); + s8 absstickx; + s8 abssticky; + u16 buttonsstate = contGetButtonsOnSample(j, contpadnum, 0xffff); + u16 buttonspressed = contGetButtonsPressedOnSample(j, contpadnum, 0xffff); + bool stickpushed = false; + s32 slotnum; + bool stayopen; + bool toggle; + s32 row; + s32 column; + + column = 1; + row = 1; + stayopen = false; + toggle = false; + + g_ActiveMenus[g_ActiveMenuIndex].allbots = false; + + if (g_Vars.currentplayer->activemenumode == AMMODE_EDIT) { + buttonsstate = buttonsstate & A_BUTTON; + cstickx = 0; + csticky = 0; + buttonspressed = 0; + } + + if (controlmode == CONTROLMODE_13 || controlmode == CONTROLMODE_14) { + if ((buttonsstate & R_TRIG) || (buttonsstate & L_TRIG)) { + stayopen = true; + } + + if (buttonsstate & A_BUTTON) { + g_ActiveMenus[g_ActiveMenuIndex].allbots = true; + } + } else { + if (buttonsstate & A_BUTTON) { + stayopen = true; + } + + if ((buttonsstate & R_TRIG) || (buttonsstate & L_TRIG)) { + g_ActiveMenus[g_ActiveMenuIndex].allbots = true; + } + } + + // If entering allbots mode, save current screen + if (g_ActiveMenus[g_ActiveMenuIndex].allbots + && g_ActiveMenus[g_ActiveMenuIndex].screenindex >= 2 + && g_ActiveMenus[g_ActiveMenuIndex].origscreennum == 0) { + g_ActiveMenus[g_ActiveMenuIndex].origscreennum = g_ActiveMenus[g_ActiveMenuIndex].screenindex; + g_ActiveMenus[g_ActiveMenuIndex].screenindex = 2; + activemenuChangeScreen(0); + } + + // If exiting allbots mode, return to original screen + if (!g_ActiveMenus[g_ActiveMenuIndex].allbots + && g_ActiveMenus[g_ActiveMenuIndex].origscreennum) { + g_ActiveMenus[g_ActiveMenuIndex].screenindex = g_ActiveMenus[g_ActiveMenuIndex].origscreennum; + g_ActiveMenus[g_ActiveMenuIndex].origscreennum = 0; + activemenuChangeScreen(0); + } + + if (buttonsstate & U_CBUTTONS) { + row = 0; + } + + if (buttonsstate & D_CBUTTONS) { + row = 2; + } + + if (buttonsstate & L_CBUTTONS) { + column = 0; + } + + if (buttonsstate & R_CBUTTONS) { + column = 2; + } + + if (buttonsstate & U_JPAD) { + row = 0; + } + + if (buttonsstate & D_JPAD) { + row = 2; + } + + if (buttonsstate & L_JPAD) { + column = 0; + } + + if (buttonsstate & R_JPAD) { + column = 2; + } + + if (controlmode == CONTROLMODE_23 + || controlmode == CONTROLMODE_24 + || controlmode == CONTROLMODE_22 + || controlmode == CONTROLMODE_21) { + s8 contpadnum2 = optionsGetContpadNum2(g_Vars.currentplayerstats->mpindex); + s8 cstickx2 = contGetStickXOnSample(j, contpadnum2); + s8 csticky2 = contGetStickYOnSample(j, contpadnum2); + u16 buttonsstate2 = contGetButtonsOnSample(j, contpadnum2, 0xffff); + u16 buttonspressed2 = contGetButtonsPressedOnSample(j, contpadnum2, 0xffff); + + if (g_Vars.currentplayer->activemenumode == AMMODE_EDIT) { + buttonsstate2 = buttonsstate2 & A_BUTTON; + cstickx2 = 0; + csticky2 = 0; + buttonspressed2 = 0; + } + + if (buttonsstate2 & A_BUTTON) { + stayopen = true; + } + + if (buttonspressed2 & Z_TRIG) { + toggle = true; + } + + if (buttonsstate2 & U_CBUTTONS) { + row = 0; + } + + if (buttonsstate2 & D_CBUTTONS) { + row = 2; + } + + if (buttonsstate2 & L_CBUTTONS) { + column = 0; + } + + if (buttonsstate2 & R_CBUTTONS) { + column = 2; + } + + if (buttonsstate2 & U_JPAD) { + row = 0; + } + + if (buttonsstate2 & D_JPAD) { + row = 2; + } + + if (buttonsstate2 & L_JPAD) { + column = 0; + } + + if (buttonsstate2 & R_JPAD) { + column = 2; + } + + absstickx = cstickx2 < 0 ? -cstickx2 : cstickx2; + abssticky = csticky2 < 0 ? -csticky2 : csticky2; + + if (absstickx > 20 || abssticky > 20) { + if ((f32)abssticky / (f32)absstickx < 0.268f) { + row = 1; + column = cstickx2 < 0 ? 0 : 2; + } else if ((f32)absstickx / (f32)abssticky < 0.268f) { + column = 1; + row = csticky2 < 0 ? 2 : 0; + } else { + column = cstickx2 < 0 ? 0 : 2; + row = csticky2 < 0 ? 2 : 0; + } + + stickpushed = true; + } + } + + absstickx = cstickx < 0 ? -cstickx : cstickx; + abssticky = csticky < 0 ? -csticky : csticky; + + if (absstickx > 20 || abssticky > 20) { + stickpushed = true; + + if ((f32)abssticky / (f32)absstickx < 0.268f) { + column = cstickx < 0 ? 0 : 2; + row = 1; + } else if ((f32)absstickx / (f32)abssticky < 0.268f) { + column = 1; + row = csticky < 0 ? 2 : 0; + } else { + column = cstickx < 0 ? 0 : 2; + row = csticky < 0 ? 2 : 0; + } + } + + if (g_Vars.currentplayer->isdead) { + stayopen = false; + } + + if (g_Vars.lvupdate240 == 0) { + stayopen = false; + } + + if (!stayopen && + (g_Vars.currentplayer->activemenumode != AMMODE_EDIT || g_Menus[g_MpPlayerNum].curframe == NULL)) { + activemenuClose(); + break; + } + + if (buttonspressed & Z_TRIG) { + toggle = true; + } + + if (toggle) { + if (g_ActiveMenus[g_ActiveMenuIndex].screenindex >= 2) { + if (g_Vars.numaibuddies && g_MissionConfig.iscoop) { + // Bot command screen, in coop with AI buddies + if (g_ActiveMenus[g_ActiveMenuIndex].slotnum == 4) { + gotonextscreen = true; + } else { + activemenuApply(g_ActiveMenus[g_ActiveMenuIndex].slotnum); + } + } else { + // Bot command screen, in multiplayer + if (g_ActiveMenuMpBotCommands[g_ActiveMenus[g_ActiveMenuIndex].slotnum] == MPBOTCOMMAND_ATTACK) { + mpOpenPickTarget(); + } else if (g_ActiveMenus[g_ActiveMenuIndex].allbots == false) { + gotonextscreen = true; + } + + if (g_ActiveMenus[g_ActiveMenuIndex].slotnum != 4) { + activemenuApply(g_ActiveMenus[g_ActiveMenuIndex].slotnum); + } + } + } else { + // Weapon or function screen + if (g_ActiveMenus[g_ActiveMenuIndex].slotnum == 4) { + gotonextscreen = true; + } else { + activemenuApply(g_ActiveMenus[g_ActiveMenuIndex].slotnum); + } + } + } + + if (gotonextscreen) { + activemenuChangeScreen(gotonextscreen); + + // If weapon has no functions, skip past function screen + if (g_ActiveMenus[g_ActiveMenuIndex].screenindex == 1) { + struct weaponfunc *pri = weaponGetFunction(&g_Vars.currentplayer->hands[0].weaponnum, FUNC_PRIMARY); + struct weaponfunc *sec = weaponGetFunction(&g_Vars.currentplayer->hands[0].weaponnum, FUNC_SECONDARY); + + if (!pri && !sec) { + activemenuChangeScreen(gotonextscreen); + } + } + } + + slotnum = column * 1 + row * 3; + + if (g_Vars.currentplayer->activemenumode != AMMODE_EDIT) { + if (slotnum == 4) { + if (g_ActiveMenus[g_ActiveMenuIndex].returntimer <= 0) { + g_ActiveMenus[g_ActiveMenuIndex].returntimer = 0; + g_ActiveMenus[g_ActiveMenuIndex].slotnum = slotnum; + } else { + g_ActiveMenus[g_ActiveMenuIndex].returntimer--; + } + } else { + bool gotoslot = true; + char text[28]; + u32 flags; + + activemenuGetSlotDetails(slotnum, &flags, text); + + if (strcmp(text, "") == 0) { + gotoslot = false; + } + + // If focusing a corner slot with C buttons or J pad, + // set a special timer for the release. The player is + // unlikely to release both C buttons on the same frame, + // so this gives a bit of grace and prevents accidental + // movement to a neighbouring slot. + if (g_ActiveMenus[g_ActiveMenuIndex].slotnum != 4 + && !stickpushed + && + (g_ActiveMenus[g_ActiveMenuIndex].slotnum == 0 + || g_ActiveMenus[g_ActiveMenuIndex].slotnum == 2 + || g_ActiveMenus[g_ActiveMenuIndex].slotnum == 6 + || g_ActiveMenus[g_ActiveMenuIndex].slotnum == 8)) { + if (slotnum != g_ActiveMenus[g_ActiveMenuIndex].fromslotnum) { + g_ActiveMenus[g_ActiveMenuIndex].cornertimer = 2; + g_ActiveMenus[g_ActiveMenuIndex].fromslotnum = slotnum; + gotoslot = false; + } + + if (g_ActiveMenus[g_ActiveMenuIndex].cornertimer > 0 && gotoslot) { + gotoslot = false; + g_ActiveMenus[g_ActiveMenuIndex].cornertimer--; + } + } + + if (gotoslot) { + g_ActiveMenus[g_ActiveMenuIndex].returntimer = 15; + g_ActiveMenus[g_ActiveMenuIndex].slotnum = slotnum; + } + } + } + } + } + + if (g_Vars.currentplayer->activemenumode != AMMODE_EDIT) { + s16 dist; + s16 dstradius; + + if (g_ActiveMenus[g_ActiveMenuIndex].dstx != -123) { + s16 dist; + + // Update selection x/y values + g_ActiveMenus[g_ActiveMenuIndex].selx = (g_ActiveMenus[g_ActiveMenuIndex].selx + g_ActiveMenus[g_ActiveMenuIndex].dstx) / 2; + g_ActiveMenus[g_ActiveMenuIndex].sely = (g_ActiveMenus[g_ActiveMenuIndex].sely + g_ActiveMenus[g_ActiveMenuIndex].dsty) / 2; + + dist = g_ActiveMenus[g_ActiveMenuIndex].selx - g_ActiveMenus[g_ActiveMenuIndex].dstx; + + if (dist <= 1 && dist >= -1) { + g_ActiveMenus[g_ActiveMenuIndex].selx = g_ActiveMenus[g_ActiveMenuIndex].dstx; + } + + dist = g_ActiveMenus[g_ActiveMenuIndex].sely - g_ActiveMenus[g_ActiveMenuIndex].dsty; + + if (dist <= 1 && dist >= -1) { + g_ActiveMenus[g_ActiveMenuIndex].sely = g_ActiveMenus[g_ActiveMenuIndex].dsty; + } + } + + // Update x radius (the expanding effect when a new screen is loaded) + dstradius = g_ActiveMenus[g_ActiveMenuIndex].slotwidth + 5; + + g_ActiveMenus[g_ActiveMenuIndex].xradius = (g_ActiveMenus[g_ActiveMenuIndex].xradius * 3 + dstradius) / 4; + + dist = g_ActiveMenus[g_ActiveMenuIndex].xradius - dstradius; + + if (dist <= 1 && dist >= -1) { + g_ActiveMenus[g_ActiveMenuIndex].xradius = dstradius; + } + + // Update alpha of slots so they fade in + if (g_ActiveMenus[g_ActiveMenuIndex].alphafrac < 1) { + g_ActiveMenus[g_ActiveMenuIndex].alphafrac += g_Vars.lvupdate240f / 30.0f; + } + + if (g_ActiveMenus[g_ActiveMenuIndex].alphafrac > 1) { + g_ActiveMenus[g_ActiveMenuIndex].alphafrac = 1; + } + + // Make selection border pulsate + g_ActiveMenus[g_ActiveMenuIndex].selpulse += g_Vars.lvupdate240f / 5.0f; + + if (g_ActiveMenus[g_ActiveMenuIndex].selpulse > 18.849555969238f) { + g_ActiveMenus[g_ActiveMenuIndex].selpulse -= 18.849555969238f; + } + } + } + + setCurrentPlayerNum(prevplayernum); +} diff --git a/src/game/game_0fd660.c b/src/game/game_0fd660.c index f5fbf9fdb..0f36df534 100644 --- a/src/game/game_0fd660.c +++ b/src/game/game_0fd660.c @@ -61,8 +61,8 @@ void mpOpenPickTarget(void) u32 prevplayernum = g_MpPlayerNum; if (!mpIsPaused()) { - g_ActiveMenus[g_ActiveMenuIndex].unk33 = g_ActiveMenus[g_ActiveMenuIndex].allbots; - g_Vars.currentplayer->activemenumode = 0; + g_ActiveMenus[g_ActiveMenuIndex].prevallbots = g_ActiveMenus[g_ActiveMenuIndex].allbots; + g_Vars.currentplayer->activemenumode = AMMODE_CLOSED; g_MpPlayerNum = g_Vars.currentplayerstats->mpindex; menuPushRootDialog(&menudialog_picktarget, 8); g_MpPlayerNum = prevplayernum; @@ -679,11 +679,11 @@ void activemenuApply(s32 slot) && g_Vars.currentplayer->weaponnum <= WEAPON_COMBATBOOST && g_MpPlayers[g_Vars.currentplayerstats->mpindex].gunfuncs[(g_Vars.currentplayer->weaponnum - 1) >> 3] & (1 << (g_Vars.currentplayer->weaponnum - 1 & 7))) { if (slot == 1) { - g_ActiveMenus[g_ActiveMenuIndex].unk30 = 1; + g_ActiveMenus[g_ActiveMenuIndex].togglefunc = true; } } else { if (slot != 1) { - g_ActiveMenus[g_ActiveMenuIndex].unk30 = 1; + g_ActiveMenus[g_ActiveMenuIndex].togglefunc = true; } } break; @@ -824,10 +824,10 @@ void activemenusInit(void) s32 j; // @bug? Should this be set for each player? - g_Vars.currentplayer->activemenumode = 0; + g_Vars.currentplayer->activemenumode = AMMODE_CLOSED; for (i = 0; i < ARRAYCOUNT(g_ActiveMenus); i++) { - g_ActiveMenus[i].unk30 = 0; + g_ActiveMenus[i].togglefunc = false; for (j = 0; j < ARRAYCOUNT(g_ActiveMenus[i].weaponnums); j++) { g_ActiveMenus[i].weaponnums[j] = 0xff; @@ -936,12 +936,12 @@ void activemenuChangeScreen(s32 step) g_ActiveMenus[g_ActiveMenuIndex].screenindex = maxscreenindex; } - g_ActiveMenus[g_ActiveMenuIndex].unk02 = 10; - g_ActiveMenus[g_ActiveMenuIndex].unk0a = -123; + g_ActiveMenus[g_ActiveMenuIndex].xradius = 10; + g_ActiveMenus[g_ActiveMenuIndex].dstx = -123; g_ActiveMenus[g_ActiveMenuIndex].slotnum = 4; - g_ActiveMenus[g_ActiveMenuIndex].unk14 = 0; - g_ActiveMenus[g_ActiveMenuIndex].unk10 = 0; - g_ActiveMenus[g_ActiveMenuIndex].unk18 = 0; + g_ActiveMenus[g_ActiveMenuIndex].returntimer = 0; + g_ActiveMenus[g_ActiveMenuIndex].cornertimer = 0; + g_ActiveMenus[g_ActiveMenuIndex].alphafrac = 0; g_ActiveMenus[g_ActiveMenuIndex].slotwidth = activemenuCalculateSlotWidth(); } @@ -1038,16 +1038,16 @@ void activemenuOpen(void) { if (g_Vars.currentplayer->passivemode == false) { g_ActiveMenuIndex = g_Vars.currentplayernum; - g_Vars.currentplayer->activemenumode = 1; + g_Vars.currentplayer->activemenumode = AMMODE_VIEW; g_PlayersWithControl[g_Vars.currentplayernum] = false; g_ActiveMenus[g_ActiveMenuIndex].screenindex = 0; - g_ActiveMenus[g_ActiveMenuIndex].unk1c = 0; + g_ActiveMenus[g_ActiveMenuIndex].selpulse = 0; activemenuAssignWeaponSlots(); activemenuChangeScreen(0); - g_ActiveMenus[g_ActiveMenuIndex].unk02 = g_ActiveMenus[g_ActiveMenuIndex].slotwidth + 5; - g_ActiveMenus[g_ActiveMenuIndex].unk18 = 0.3; - g_ActiveMenus[g_ActiveMenuIndex].unk34 = 0; - g_ActiveMenus[g_ActiveMenuIndex].unk33 = 0; + g_ActiveMenus[g_ActiveMenuIndex].xradius = g_ActiveMenus[g_ActiveMenuIndex].slotwidth + 5; + g_ActiveMenus[g_ActiveMenuIndex].alphafrac = 0.3; + g_ActiveMenus[g_ActiveMenuIndex].origscreennum = 0; + g_ActiveMenus[g_ActiveMenuIndex].prevallbots = 0; g_ActiveMenus[g_ActiveMenuIndex].allbots = false; } } @@ -1058,7 +1058,7 @@ void activemenuClose(void) activemenuApply(g_ActiveMenus[g_ActiveMenuIndex].slotnum); } - g_Vars.currentplayer->activemenumode = 0; + g_Vars.currentplayer->activemenumode = AMMODE_CLOSED; g_Vars.currentplayer->joybutinhibit = 0xffffffff; g_PlayersWithControl[g_Vars.currentplayernum] = 1; } @@ -1074,7 +1074,7 @@ void activemenuCalculateSlotPosition(s16 arg0, s16 arg1, s16 *x, s16 *y) { s32 playercount = PLAYERCOUNT(); - *x = g_ActiveMenus[g_ActiveMenuIndex].unk02 * (arg0 - 1); + *x = g_ActiveMenus[g_ActiveMenuIndex].xradius * (arg0 - 1); *y = arg1 * 50 - 50; if (arg0 != 1 && arg1 != 1) { @@ -1857,7 +1857,7 @@ Gfx *activemenuRenderSlot(Gfx *gdl, char *text, s16 x, s16 y, s32 mode, s32 flag func0000db30("pickcol2", &pickcol2); // Render background colour - colour = (u32)(g_ActiveMenus[g_ActiveMenuIndex].unk18 * (ibcol & 0xff)) | (ibcol & 0xffffff00); + colour = (u32)(g_ActiveMenus[g_ActiveMenuIndex].alphafrac * (ibcol & 0xff)) | (ibcol & 0xffffff00); if (mode == 1) { colour &= 0x000000ff; @@ -1871,7 +1871,7 @@ Gfx *activemenuRenderSlot(Gfx *gdl, char *text, s16 x, s16 y, s32 mode, s32 flag colour &= 0x000000ff; } - if (g_Vars.currentplayer->activemenumode == 2) { + if (g_Vars.currentplayer->activemenumode == AMMODE_EDIT) { colour = 0x0000006f; } @@ -1896,9 +1896,9 @@ Gfx *activemenuRenderSlot(Gfx *gdl, char *text, s16 x, s16 y, s32 mode, s32 flag colour = 0xffffff8f; } - colour = (u32)(g_ActiveMenus[g_ActiveMenuIndex].unk18 * (colour & 0xff)) | (colour & 0xffffff00); + colour = (u32)(g_ActiveMenus[g_ActiveMenuIndex].alphafrac * (colour & 0xff)) | (colour & 0xffffff00); - if (g_Vars.currentplayer->activemenumode == 2) { + if (g_Vars.currentplayer->activemenumode == AMMODE_EDIT) { colour = 0x4f4f4f7f; } @@ -1945,9 +1945,9 @@ Gfx *activemenuRenderSlot(Gfx *gdl, char *text, s16 x, s16 y, s32 mode, s32 flag colour = colourBlend(0xffaf8fff, colour, func0f006b54(10) * 255.0f); } - colour = (u32)(g_ActiveMenus[g_ActiveMenuIndex].unk18 * (colour & 0xff)) | (colour & 0xffffff00); + colour = (u32)(g_ActiveMenus[g_ActiveMenuIndex].alphafrac * (colour & 0xff)) | (colour & 0xffffff00); - if (g_Vars.currentplayer->activemenumode == 2) { + if (g_Vars.currentplayer->activemenumode == AMMODE_EDIT) { colour = 0x4f4f4f7f; } diff --git a/src/include/constants.h b/src/include/constants.h index 839d2852f..05b22430f 100644 --- a/src/include/constants.h +++ b/src/include/constants.h @@ -156,6 +156,11 @@ #define AMSLOTFLAG_ACTIVE 0x08 // pulsates slightly, eg. cloak/xray when active #define AMSLOTFLAG_NOAMMO 0x10 // black BG, no border, orange text +// Active menu (weapon wheel) modes +#define AMMODE_CLOSED 0 +#define AMMODE_VIEW 1 +#define AMMODE_EDIT 2 // unused + #define ANIM_IDLE 0x0000 #define ANIM_TWO_GUN_HOLD 0x0001 #define ANIM_KNEEL_TWO_HANDED_GUN 0x0008 @@ -1765,6 +1770,21 @@ #define MPBODY_DALTON 0x3b #define MPBODY_DJBOND 0x3c +#define MPBOTCOMMAND_FOLLOW 0 +#define MPBOTCOMMAND_ATTACK 1 +#define MPBOTCOMMAND_DEFEND 2 +#define MPBOTCOMMAND_HOLD 3 +#define MPBOTCOMMAND_NORMAL 4 +#define MPBOTCOMMAND_DOWNLOAD 5 +#define MPBOTCOMMAND_GETCASE 6 +#define MPBOTCOMMAND_TAGBOX 7 +#define MPBOTCOMMAND_SAVECASE 8 +#define MPBOTCOMMAND_DEFHILL 9 +#define MPBOTCOMMAND_HOLDHILL 10 +#define MPBOTCOMMAND_GETCASE2 11 +#define MPBOTCOMMAND_POPCAP 12 +#define MPBOTCOMMAND_PROTECT 13 + #define MPCONFIG_TEMPLE 0x00 #define MPCONFIG_PISTOLS 0x01 #define MPCONFIG_FARSIGHT 0x02 diff --git a/src/include/game/game_097ba0.h b/src/include/game/game_097ba0.h index 8a4ea8a1b..e3ff165c0 100644 --- a/src/include/game/game_097ba0.h +++ b/src/include/game/game_097ba0.h @@ -140,7 +140,7 @@ void func0f0a7d98(u8 *arg0, struct prop *prop, s32 arg2); u32 func0f0a8404(void); u32 func0f0a84c8(void); void handSetFiring(s32 hand, bool firing); -u32 currentPlayerConsiderToggleGunFunction(s32 usedowntime, bool firing, s32 arg2); +s32 currentPlayerConsiderToggleGunFunction(s32 usedowntime, bool firing, s32 arg2); void func0f0a8c50(void); bool currentPlayerIsUsingSecondaryFunction(void); void currentPlayerTickInventory(bool triggeron); diff --git a/src/include/game/game_0fd660.h b/src/include/game/game_0fd660.h index c10bd0b6c..e8d3f40bf 100644 --- a/src/include/game/game_0fd660.h +++ b/src/include/game/game_0fd660.h @@ -8,7 +8,7 @@ void activemenuSetAiBuddyTemperament(bool aggressive); void activemenuSetAiBuddyStealth(void); s32 activemenuGetFirstBuddyIndex(void); void activemenuApply(s32 slot); -void activemenuGetSlotDetails(s32 slot, u32 *flags, char *dst); +void activemenuGetSlotDetails(s32 slot, u32 *flags, char *label); void activemenusInit(void); s16 activemenuCalculateSlotWidth(void); void activemenuChangeScreen(s32 step); diff --git a/src/include/types.h b/src/include/types.h index 1e9c1b0a8..ecf743564 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -4728,17 +4728,18 @@ struct trainingdata { struct activemenu { /*0x00*/ s8 screenindex; - /*0x02*/ s16 unk02; + /*0x02*/ s16 xradius; /*0x04*/ s16 slotwidth; - /*0x06*/ u16 unk06; - /*0x08*/ u16 unk08; - /*0x0a*/ s16 unk0a; - /*0x0c*/ u16 unk0c; - /*0x0e*/ u8 slotnum; - /*0x10*/ u32 unk10; - /*0x14*/ u32 unk14; - /*0x18*/ f32 unk18; // seems like a fade duration or current alpha level - /*0x1c*/ f32 unk1c; + /*0x06*/ s16 selx; + /*0x08*/ s16 sely; + /*0x0a*/ s16 dstx; + /*0x0c*/ s16 dsty; + /*0x0e*/ u8 slotnum; // 0-8, where 4 is middle + /*0x0f*/ u8 fromslotnum; // when moving from one slot to another + /*0x10*/ s32 cornertimer; + /*0x14*/ s32 returntimer; // time before selection returns to middle after releasing control stick + /*0x18*/ f32 alphafrac; + /*0x1c*/ f32 selpulse; // determines the border colour of the selection box /** * Indexes into the player's inventory. Element 0 is AM slot top left, @@ -4754,11 +4755,11 @@ struct activemenu { */ /*0x28*/ u8 weaponnums[8]; - /*0x30*/ u8 unk30; + /*0x30*/ u8 togglefunc; /*0x31*/ u8 numitems; // number of items in player's inventory; can be higher than the number of AM slots /*0x32*/ u8 allbots; // when player holds R on the bot command screen - /*0x33*/ u8 unk33; - /*0x34*/ u8 unk34; + /*0x33*/ u8 prevallbots; // used when opening "Pick Target" menu for attack command + /*0x34*/ s8 origscreennum; // original screen number before using allbots }; struct briefing {