diff --git a/src/game/bot.c b/src/game/bot.c index f8fd19060..c5a76450b 100644 --- a/src/game/bot.c +++ b/src/game/bot.c @@ -845,11 +845,11 @@ glabel botReset // aibot->unk0e2 = 0; // aibot->unk0e0 = 0; // aibot->unk118 = 0; -// aibot->unk11c = 0; +// aibot->targethotness = 0; // aibot->unk120 = -1; -// aibot->unk124 = -1; -// aibot->unk128 = 0; -// aibot->unk12c = 0; +// aibot->lastseenanytarget60 = -1; +// aibot->targetinsight = 0; +// aibot->queryplayernum = 0; // aibot->unk040 = 0; // aibot->unk06c = 0; // aibot->unk070 = 0; @@ -860,18 +860,18 @@ glabel botReset // aibot->unk110 = 0; // // for (i = 0; i != 12; i++) { -// aibot->unk130[i] = -1; -// aibot->playerdistances[i] = U32_MAX; -// aibot->unk16c[i] = 0; -// aibot->unk178[i] = -1; -// aibot->unk1a8[i] = -1; +// aibot->chrnumsbydistanceasc[i] = -1; +// aibot->chrdistances[i] = U32_MAX; +// aibot->chrsinsight[i] = false; +// aibot->chrslastseen60[i] = -1; +// aibot->chrrooms[i] = -1; // } // // aibot->unk1e8 = 0; // aibot->unk208 = 0; // aibot->rand = random(); // aibot->randttl60 = 0; -// aibot->unk2c8 = 0; +// aibot->targetcloaktimer60 = 0; // aibot->unk09c_03 = 0; // aibot->unk2cc = 0; // aibot->unk2c4 = 0; @@ -2655,20 +2655,20 @@ bool bot0f191638(struct chrdata *chr, bool arg1) mpindex = mpPlayerGetIndex(target->chr); result = false; - if (chr->aibot->unk16c[mpindex]) { + if (chr->aibot->chrsinsight[mpindex]) { result = true; } if (chr->aibot->config->difficulty > BOTDIFF_MEAT) { - if (chr->aibot->unk178[mpindex] >= g_Vars.lvframe60 - PALDOWN(240) + if (chr->aibot->chrslastseen60[mpindex] >= g_Vars.lvframe60 - PALDOWN(240) || (arrayIntersects(chr->prop->rooms, target->rooms))) { result = true; } if (chr->aibot->config->difficulty >= BOTDIFF_NORMAL) { if (roomsAreNeighbours(chr->prop->rooms[0], target->rooms[0]) - || chr->aibot->unk1a8[mpindex] == target->rooms[0] - || roomsAreNeighbours(chr->aibot->unk1a8[mpindex], target->rooms[0])) { + || chr->aibot->chrrooms[mpindex] == target->rooms[0] + || roomsAreNeighbours(chr->aibot->chrrooms[mpindex], target->rooms[0])) { result = true; } @@ -3796,7 +3796,7 @@ glabel var7f1b8ef0 // newangle = oldangle + chrGetAngleToPos(chr, &g_ScenarioData.htm.unk07c[g_ScenarioData.htm.unk0d4].prop->pos); // } else if (chr->myaction == MA_AIBOTFOLLOW // && aibot->followingplayernum >= 0 -// && aibot->playerdistances[aibot->followingplayernum] < 300 +// && aibot->chrdistances[aibot->followingplayernum] < 300 // && aibot->unk1e4 >= g_Vars.lvframe60 - 60 // && aibot->config->difficulty != BOTDIFF_MEAT) { // newangle = chrGetInverseTheta(g_MpAllChrPtrs[aibot->followingplayernum]); @@ -4153,68 +4153,74 @@ void botLoseGun(struct chrdata *chr, struct prop *attackerprop) } } -void bot0f19277c(struct chrdata *chr, s32 propnum) +/** + * Set the bot's target and update tracking figures. + * + * This should be called on each tick even if the target hasn't changed + * because the tracking figures need to be constantly updated. + */ +void botSetTarget(struct chrdata *botchr, s32 propnum) { - struct chrdata *chr2 = NULL; + struct chrdata *otherchr = NULL; s32 index; if (propnum >= 0) { - chr2 = (g_Vars.props + propnum)->chr; + otherchr = (g_Vars.props + propnum)->chr; - index = mpPlayerGetIndex(chr2); + index = mpPlayerGetIndex(otherchr); - chr->aibot->unk128 = chr->aibot->unk16c[index]; - chr->aibot->unk120 = chr->aibot->unk178[index]; + botchr->aibot->targetinsight = botchr->aibot->chrsinsight[index]; + botchr->aibot->targetlastseen60 = botchr->aibot->chrslastseen60[index]; } else { - chr->aibot->unk128 = 0; - chr->aibot->unk120 = -1; + botchr->aibot->targetinsight = false; + botchr->aibot->targetlastseen60 = -1; } - if (chr->aibot->unk120 > chr->aibot->unk124) { - chr->aibot->unk124 = chr->aibot->unk120; + if (botchr->aibot->targetlastseen60 > botchr->aibot->lastseenanytarget60) { + botchr->aibot->lastseenanytarget60 = botchr->aibot->targetlastseen60; } - if (chr->target != propnum) { - chr->target = propnum; - chr->aibot->unk11c = 0; - chr->aibot->unk1e8 = 0; - chr->aibot->unk208 = 0; + if (botchr->target != propnum) { + botchr->target = propnum; + botchr->aibot->targethotness = 0; + botchr->aibot->unk1e8 = 0; + botchr->aibot->unk208 = 0; - if (chr->aibot->unk128 && chr2) { - chr->aibot->unk2c8 = PALDOWN(120); + if (botchr->aibot->targetinsight && otherchr) { + botchr->aibot->targetcloaktimer60 = PALDOWN(120); } else { - chr->aibot->unk2c8 = 0; + botchr->aibot->targetcloaktimer60 = 0; } } else { - if (chr->aibot->unk128) { + if (botchr->aibot->targetinsight) { if (g_Vars.lvupdate240 > 0) { - chr->aibot->unk11c += g_Vars.diffframe60; + botchr->aibot->targethotness += g_Vars.diffframe60; } } else { if (g_Vars.lvupdate240 > 0) { - chr->aibot->unk11c -= g_Vars.diffframe60; + botchr->aibot->targethotness -= g_Vars.diffframe60; } - if (chr->aibot->unk11c < 0) { - chr->aibot->unk11c = 0; + if (botchr->aibot->targethotness < 0) { + botchr->aibot->targethotness = 0; } } } - if (chr->aibot->unk128 && chr2) { - if ((chr2->hidden & CHRHFLAG_CLOAKED) == 0) { - chr->aibot->unk2c8 = PALDOWN(120); + if (botchr->aibot->targetinsight && otherchr) { + if ((otherchr->hidden & CHRHFLAG_CLOAKED) == 0) { + botchr->aibot->targetcloaktimer60 = PALDOWN(120); } else { - if (chr->aibot->unk2c8 > 0) { - chr->aibot->unk2c8 -= g_Vars.lvupdate240_60; + if (botchr->aibot->targetcloaktimer60 > 0) { + botchr->aibot->targetcloaktimer60 -= g_Vars.lvupdate240_60; } } } else { - chr->aibot->unk2c8 = 0; + botchr->aibot->targetcloaktimer60 = 0; } } -bool bot0f19294c(struct chrdata *botchr, struct chrdata *otherchr) +bool botIsTargetInvisible(struct chrdata *botchr, struct chrdata *otherchr) { if (otherchr->prop->type == PROPTYPE_PLAYER && !g_Vars.bondvisible) { return true; @@ -4226,8 +4232,8 @@ bool bot0f19294c(struct chrdata *botchr, struct chrdata *otherchr) if ((otherchr->hidden & CHRHFLAG_CLOAKED)) { if (botchr && botchr->aibot - && ((botchr->target != -1 && chrGetTargetProp(botchr) == otherchr->prop && botchr->aibot->unk2c8 > 0) - || (botchr->aibot->unk09c_03 && func0f04911c(botchr, &otherchr->prop->pos, 0x20)))) { + && ((botchr->target != -1 && chrGetTargetProp(botchr) == otherchr->prop && botchr->aibot->targetcloaktimer60 > 0) + || (botchr->aibot->unk09c_03 && func0f04911c(botchr, &otherchr->prop->pos, 32)))) { return false; } @@ -4265,7 +4271,7 @@ void bot0f192a74(struct chrdata *chr) } if (g_Vars.lvupdate240 > 0) { - if (aibot->unk128) { + if (aibot->targetinsight) { aibot->unk1d4 += g_Vars.diffframe60; } else { aibot->unk1d4 -= g_Vars.diffframe60; @@ -4280,8 +4286,8 @@ void bot0f192a74(struct chrdata *chr) aibot->unk1d4 -= tmp; } - if (aibot->unk1d4 > aibot->unk11c) { - aibot->unk1d4 = aibot->unk11c; + if (aibot->unk1d4 > aibot->targethotness) { + aibot->unk1d4 = aibot->targethotness; } if (aibot->unk1d4 < 0) { @@ -4373,895 +4379,191 @@ bool botPassesCowardCheck(struct chrdata *botchr, struct chrdata *otherchr) return pass; } -#if VERSION >= VERSION_PAL_FINAL -GLOBAL_ASM( -glabel bot0f192e90 -/* f192e90: 27bdff58 */ addiu $sp,$sp,-168 -/* f192e94: afbf002c */ sw $ra,0x2c($sp) -/* f192e98: afb50028 */ sw $s5,0x28($sp) -/* f192e9c: afb40024 */ sw $s4,0x24($sp) -/* f192ea0: afb30020 */ sw $s3,0x20($sp) -/* f192ea4: afb2001c */ sw $s2,0x1c($sp) -/* f192ea8: afb10018 */ sw $s1,0x18($sp) -/* f192eac: afb00014 */ sw $s0,0x14($sp) -/* f192eb0: 8c9302d4 */ lw $s3,0x2d4($a0) -/* f192eb4: 240effff */ addiu $t6,$zero,-1 -/* f192eb8: a7ae006a */ sh $t6,0x6a($sp) -/* f192ebc: 8e6f012c */ lw $t7,0x12c($s3) -/* f192ec0: 3c19800b */ lui $t9,%hi(g_MpNumChrs) -/* f192ec4: 8f39c530 */ lw $t9,%lo(g_MpNumChrs)($t9) -/* f192ec8: 25f80001 */ addiu $t8,$t7,0x1 -/* f192ecc: 0080a825 */ or $s5,$a0,$zero -/* f192ed0: 0319001a */ div $zero,$t8,$t9 -/* f192ed4: 00002010 */ mfhi $a0 -/* f192ed8: ae64012c */ sw $a0,0x12c($s3) -/* f192edc: 17200002 */ bnez $t9,.L0f192ee8 -/* f192ee0: 00000000 */ nop -/* f192ee4: 0007000d */ break 0x7 -.L0f192ee8: -/* f192ee8: 2401ffff */ addiu $at,$zero,-1 -/* f192eec: 17210004 */ bne $t9,$at,.L0f192f00 -/* f192ef0: 3c018000 */ lui $at,0x8000 -/* f192ef4: 17010002 */ bne $t8,$at,.L0f192f00 -/* f192ef8: 00000000 */ nop -/* f192efc: 0006000d */ break 0x6 -.L0f192f00: -/* f192f00: 0fc63410 */ jal mpGetChrFromPlayerIndex -/* f192f04: 00000000 */ nop -/* f192f08: 1055002b */ beq $v0,$s5,.L0f192fb8 -/* f192f0c: 00408825 */ or $s1,$v0,$zero -/* f192f10: 0c004b70 */ jal random -/* f192f14: 00000000 */ nop -/* f192f18: 24013840 */ addiu $at,$zero,0x2ee0 -/* f192f1c: 0041001b */ divu $zero,$v0,$at -/* f192f20: 3c0d800b */ lui $t5,%hi(g_MpNumChrs) -/* f192f24: 3c0e800a */ lui $t6,%hi(g_Vars+0x38) -/* f192f28: 8dce9ff8 */ lw $t6,%lo(g_Vars+0x38)($t6) -/* f192f2c: 8dadc530 */ lw $t5,%lo(g_MpNumChrs)($t5) -/* f192f30: 00006010 */ mfhi $t4 -/* f192f34: 00000000 */ nop -/* f192f38: 00000000 */ nop -/* f192f3c: 01ae0019 */ multu $t5,$t6 -/* f192f40: 00007812 */ mflo $t7 -/* f192f44: 018f082b */ sltu $at,$t4,$t7 -/* f192f48: 50200005 */ beqzl $at,.L0f192f60 -/* f192f4c: 8e25001c */ lw $a1,0x1c($s1) -/* f192f50: 9279009c */ lbu $t9,0x9c($s3) -/* f192f54: 372b0010 */ ori $t3,$t9,0x10 -/* f192f58: a26b009c */ sb $t3,0x9c($s3) -/* f192f5c: 8e25001c */ lw $a1,0x1c($s1) -.L0f192f60: -/* f192f60: 02a02025 */ or $a0,$s5,$zero -/* f192f64: 0fc1250e */ jal chrGetDistanceToCoord -/* f192f68: 24a50008 */ addiu $a1,$a1,0x8 -/* f192f6c: 8e6d012c */ lw $t5,0x12c($s3) -/* f192f70: 02a02025 */ or $a0,$s5,$zero -/* f192f74: 02202825 */ or $a1,$s1,$zero -/* f192f78: 000d7080 */ sll $t6,$t5,0x2 -/* f192f7c: 026e6021 */ addu $t4,$s3,$t6 -/* f192f80: e580013c */ swc1 $f0,0x13c($t4) -/* f192f84: 0fc0e48b */ jal chrCanSeeChr -/* f192f88: 27a6006a */ addiu $a2,$sp,0x6a -/* f192f8c: 8e6f012c */ lw $t7,0x12c($s3) -/* f192f90: 026fc021 */ addu $t8,$s3,$t7 -/* f192f94: a302016c */ sb $v0,0x16c($t8) -/* f192f98: 8e6b012c */ lw $t3,0x12c($s3) -/* f192f9c: 87b9006a */ lh $t9,0x6a($sp) -/* f192fa0: 000b6840 */ sll $t5,$t3,0x1 -/* f192fa4: 026d7021 */ addu $t6,$s3,$t5 -/* f192fa8: a5d901a8 */ sh $t9,0x1a8($t6) -/* f192fac: 926c009c */ lbu $t4,0x9c($s3) -/* f192fb0: 318fffef */ andi $t7,$t4,0xffef -/* f192fb4: a26f009c */ sb $t7,0x9c($s3) -.L0f192fb8: -/* f192fb8: 3c07800b */ lui $a3,%hi(g_MpNumChrs) -/* f192fbc: 8ce7c530 */ lw $a3,%lo(g_MpNumChrs)($a3) -/* f192fc0: 00009025 */ or $s2,$zero,$zero -/* f192fc4: 02608025 */ or $s0,$s3,$zero -/* f192fc8: 18e00010 */ blez $a3,.L0f19300c -/* f192fcc: 3c0a800a */ lui $t2,%hi(g_Vars) -/* f192fd0: 254a9fc0 */ addiu $t2,$t2,%lo(g_Vars) -.L0f192fd4: -/* f192fd4: 9218016c */ lbu $t8,0x16c($s0) -/* f192fd8: 00126880 */ sll $t5,$s2,0x2 -/* f192fdc: 53000007 */ beqzl $t8,.L0f192ffc -/* f192fe0: 26520001 */ addiu $s2,$s2,0x1 -/* f192fe4: 8d4b0008 */ lw $t3,0x8($t2) -/* f192fe8: 026dc821 */ addu $t9,$s3,$t5 -/* f192fec: 3c07800b */ lui $a3,%hi(g_MpNumChrs) -/* f192ff0: af2b0178 */ sw $t3,0x178($t9) -/* f192ff4: 8ce7c530 */ lw $a3,%lo(g_MpNumChrs)($a3) -/* f192ff8: 26520001 */ addiu $s2,$s2,0x1 -.L0f192ffc: -/* f192ffc: 0247082a */ slt $at,$s2,$a3 -/* f193000: 1420fff4 */ bnez $at,.L0f192fd4 -/* f193004: 26100001 */ addiu $s0,$s0,0x1 -/* f193008: 00009025 */ or $s2,$zero,$zero -.L0f19300c: -/* f19300c: 18e00008 */ blez $a3,.L0f193030 -/* f193010: 27a2006c */ addiu $v0,$sp,0x6c -/* f193014: 00076080 */ sll $t4,$a3,0x2 -/* f193018: 01821821 */ addu $v1,$t4,$v0 -.L0f19301c: -/* f19301c: 24420004 */ addiu $v0,$v0,0x4 -/* f193020: 0043082b */ sltu $at,$v0,$v1 -/* f193024: 1420fffd */ bnez $at,.L0f19301c -/* f193028: ac40fffc */ sw $zero,-0x4($v0) -/* f19302c: 00009025 */ or $s2,$zero,$zero -.L0f193030: -/* f193030: 18e00026 */ blez $a3,.L0f1930cc -/* f193034: 24090001 */ addiu $t1,$zero,0x1 -/* f193038: 44801000 */ mtc1 $zero,$f2 -/* f19303c: 27a8006c */ addiu $t0,$sp,0x6c -/* f193040: 2406ffff */ addiu $a2,$zero,-1 -.L0f193044: -/* f193044: 46001006 */ mov.s $f0,$f2 -/* f193048: 18e00014 */ blez $a3,.L0f19309c -/* f19304c: 00001825 */ or $v1,$zero,$zero -/* f193050: 00002025 */ or $a0,$zero,$zero -/* f193054: 27a5006c */ addiu $a1,$sp,0x6c -.L0f193058: -/* f193058: 8caf0000 */ lw $t7,0x0($a1) -/* f19305c: 24a50004 */ addiu $a1,$a1,0x4 -/* f193060: 55e0000b */ bnezl $t7,.L0f193090 -/* f193064: 24630001 */ addiu $v1,$v1,0x1 -/* f193068: 04c00006 */ bltz $a2,.L0f193084 -/* f19306c: 02641021 */ addu $v0,$s3,$a0 -/* f193070: c444013c */ lwc1 $f4,0x13c($v0) -/* f193074: 4600203c */ c.lt.s $f4,$f0 -/* f193078: 00000000 */ nop -/* f19307c: 45020004 */ bc1fl .L0f193090 -/* f193080: 24630001 */ addiu $v1,$v1,0x1 -.L0f193084: -/* f193084: 00603025 */ or $a2,$v1,$zero -/* f193088: c440013c */ lwc1 $f0,0x13c($v0) -/* f19308c: 24630001 */ addiu $v1,$v1,0x1 -.L0f193090: -/* f193090: 0067082a */ slt $at,$v1,$a3 -/* f193094: 1420fff0 */ bnez $at,.L0f193058 -/* f193098: 24840004 */ addiu $a0,$a0,0x4 -.L0f19309c: -/* f19309c: 04c00007 */ bltz $a2,.L0f1930bc -/* f1930a0: 0272c021 */ addu $t8,$s3,$s2 -/* f1930a4: 00066880 */ sll $t5,$a2,0x2 -/* f1930a8: a3060130 */ sb $a2,0x130($t8) -/* f1930ac: 010d5821 */ addu $t3,$t0,$t5 -/* f1930b0: ad690000 */ sw $t1,0x0($t3) -/* f1930b4: 3c07800b */ lui $a3,%hi(g_MpNumChrs) -/* f1930b8: 8ce7c530 */ lw $a3,%lo(g_MpNumChrs)($a3) -.L0f1930bc: -/* f1930bc: 26520001 */ addiu $s2,$s2,0x1 -/* f1930c0: 0247082a */ slt $at,$s2,$a3 -/* f1930c4: 5420ffdf */ bnezl $at,.L0f193044 -/* f1930c8: 2406ffff */ addiu $a2,$zero,-1 -.L0f1930cc: -/* f1930cc: 0fc64a9d */ jal bot0f192a74 -/* f1930d0: 02a02025 */ or $a0,$s5,$zero -/* f1930d4: 92a202a0 */ lbu $v0,0x2a0($s5) -/* f1930d8: 2401002e */ addiu $at,$zero,0x2e -/* f1930dc: 02a02025 */ or $a0,$s5,$zero -/* f1930e0: 54410006 */ bnel $v0,$at,.L0f1930fc -/* f1930e4: 2401002f */ addiu $at,$zero,0x2f -/* f1930e8: 0fc649df */ jal bot0f19277c -/* f1930ec: 2405ffff */ addiu $a1,$zero,-1 -/* f1930f0: 100000f2 */ b .L0f1934bc -/* f1930f4: 8fbf002c */ lw $ra,0x2c($sp) -/* f1930f8: 2401002f */ addiu $at,$zero,0x2f -.L0f1930fc: -/* f1930fc: 5441001f */ bnel $v0,$at,.L0f19317c -/* f193100: 86b8017e */ lh $t8,0x17e($s5) -/* f193104: 86620008 */ lh $v0,0x8($s3) -/* f193108: 0440001b */ bltz $v0,.L0f193178 -/* f19310c: 0262c821 */ addu $t9,$s3,$v0 -/* f193110: 932c016c */ lbu $t4,0x16c($t9) -/* f193114: 3c10800b */ lui $s0,%hi(g_MpAllChrPtrs) -/* f193118: 2610c4d0 */ addiu $s0,$s0,%lo(g_MpAllChrPtrs) -/* f19311c: 11800016 */ beqz $t4,.L0f193178 -/* f193120: 00027080 */ sll $t6,$v0,0x2 -/* f193124: 020e7821 */ addu $t7,$s0,$t6 -/* f193128: 0fc0e6a5 */ jal chrIsDead -/* f19312c: 8de40000 */ lw $a0,0x0($t7) -/* f193130: 54400012 */ bnezl $v0,.L0f19317c -/* f193134: 86b8017e */ lh $t8,0x17e($s5) -/* f193138: 86780008 */ lh $t8,0x8($s3) -/* f19313c: 3c0e800a */ lui $t6,%hi(g_Vars+0x338) -/* f193140: 8dcea2f8 */ lw $t6,%lo(g_Vars+0x338)($t6) -/* f193144: 00186880 */ sll $t5,$t8,0x2 -/* f193148: 020d5821 */ addu $t3,$s0,$t5 -/* f19314c: 8d790000 */ lw $t9,0x0($t3) -/* f193150: 24010048 */ addiu $at,$zero,0x48 -/* f193154: 02a02025 */ or $a0,$s5,$zero -/* f193158: 8f2c001c */ lw $t4,0x1c($t9) -/* f19315c: 018e2823 */ subu $a1,$t4,$t6 -/* f193160: 00a1001a */ div $zero,$a1,$at -/* f193164: 00002812 */ mflo $a1 -/* f193168: 0fc649df */ jal bot0f19277c -/* f19316c: 00000000 */ nop -/* f193170: 100000d2 */ b .L0f1934bc -/* f193174: 8fbf002c */ lw $ra,0x2c($sp) -.L0f193178: -/* f193178: 86b8017e */ lh $t8,0x17e($s5) -.L0f19317c: -/* f19317c: 2411ffff */ addiu $s1,$zero,-1 -/* f193180: 52380028 */ beql $s1,$t8,.L0f193224 -/* f193184: 86a2017e */ lh $v0,0x17e($s5) -/* f193188: 0fc0a221 */ jal chrGetTargetProp -/* f19318c: 02a02025 */ or $a0,$s5,$zero -/* f193190: 00408025 */ or $s0,$v0,$zero -/* f193194: 0fc0e6a5 */ jal chrIsDead -/* f193198: 8c440004 */ lw $a0,0x4($v0) -/* f19319c: 10400002 */ beqz $v0,.L0f1931a8 -/* f1931a0: 02a02025 */ or $a0,$s5,$zero -/* f1931a4: a6b1017e */ sh $s1,0x17e($s5) -.L0f1931a8: -/* f1931a8: 8ead02d4 */ lw $t5,0x2d4($s5) -/* f1931ac: 8dab0128 */ lw $t3,0x128($t5) -/* f1931b0: 55600007 */ bnezl $t3,.L0f1931d0 -/* f1931b4: 02a02025 */ or $a0,$s5,$zero -/* f1931b8: 0fc64a53 */ jal bot0f19294c -/* f1931bc: 8e050004 */ lw $a1,0x4($s0) -/* f1931c0: 50400003 */ beqzl $v0,.L0f1931d0 -/* f1931c4: 02a02025 */ or $a0,$s5,$zero -/* f1931c8: a6b1017e */ sh $s1,0x17e($s5) -/* f1931cc: 02a02025 */ or $a0,$s5,$zero -.L0f1931d0: -/* f1931d0: 8e050004 */ lw $a1,0x4($s0) -/* f1931d4: 0fc12aa3 */ jal chrCompareTeams -/* f1931d8: 24060001 */ addiu $a2,$zero,0x1 -/* f1931dc: 10400002 */ beqz $v0,.L0f1931e8 -/* f1931e0: 02a02025 */ or $a0,$s5,$zero -/* f1931e4: a6b1017e */ sh $s1,0x17e($s5) -.L0f1931e8: -/* f1931e8: 0fc64b59 */ jal botPassesPeaceCheck -/* f1931ec: 8e050004 */ lw $a1,0x4($s0) -/* f1931f0: 14400002 */ bnez $v0,.L0f1931fc -/* f1931f4: 02a02025 */ or $a0,$s5,$zero -/* f1931f8: a6b1017e */ sh $s1,0x17e($s5) -.L0f1931fc: -/* f1931fc: 8eb902d4 */ lw $t9,0x2d4($s5) -/* f193200: 8f2c0128 */ lw $t4,0x128($t9) -/* f193204: 55800007 */ bnezl $t4,.L0f193224 -/* f193208: 86a2017e */ lh $v0,0x17e($s5) -/* f19320c: 0fc64b70 */ jal botPassesCowardCheck -/* f193210: 8e050004 */ lw $a1,0x4($s0) -/* f193214: 54400003 */ bnezl $v0,.L0f193224 -/* f193218: 86a2017e */ lh $v0,0x17e($s5) -/* f19321c: a6b1017e */ sh $s1,0x17e($s5) -/* f193220: 86a2017e */ lh $v0,0x17e($s5) -.L0f193224: -/* f193224: 3c0f800b */ lui $t7,%hi(g_MpNumChrs) -/* f193228: 3c0b800a */ lui $t3,%hi(g_Vars+0x338) -/* f19322c: 16220062 */ bne $s1,$v0,.L0f1933b8 -/* f193230: 000268c0 */ sll $t5,$v0,0x3 -/* f193234: 8defc530 */ lw $t7,%lo(g_MpNumChrs)($t7) -/* f193238: 240effff */ addiu $t6,$zero,-1 -/* f19323c: afae0050 */ sw $t6,0x50($sp) -/* f193240: 19e00047 */ blez $t7,.L0f193360 -/* f193244: 00009025 */ or $s2,$zero,$zero -/* f193248: 0260a025 */ or $s4,$s3,$zero -/* f19324c: 82900130 */ lb $s0,0x130($s4) -.L0f193250: -/* f193250: 0fc63410 */ jal mpGetChrFromPlayerIndex -/* f193254: 02002025 */ or $a0,$s0,$zero -/* f193258: 1055003a */ beq $v0,$s5,.L0f193344 -/* f19325c: 00408825 */ or $s1,$v0,$zero -/* f193260: 0fc0e6a5 */ jal chrIsDead -/* f193264: 00402025 */ or $a0,$v0,$zero -/* f193268: 14400036 */ bnez $v0,.L0f193344 -/* f19326c: 02a02025 */ or $a0,$s5,$zero -/* f193270: 02202825 */ or $a1,$s1,$zero -/* f193274: 0fc12aa3 */ jal chrCompareTeams -/* f193278: 24060002 */ addiu $a2,$zero,0x2 -/* f19327c: 10400031 */ beqz $v0,.L0f193344 -/* f193280: 02a02025 */ or $a0,$s5,$zero -/* f193284: 0fc64b59 */ jal botPassesPeaceCheck -/* f193288: 02202825 */ or $a1,$s1,$zero -/* f19328c: 1040002d */ beqz $v0,.L0f193344 -/* f193290: 0270c021 */ addu $t8,$s3,$s0 -/* f193294: 930d016c */ lbu $t5,0x16c($t8) -/* f193298: 02a02025 */ or $a0,$s5,$zero -/* f19329c: 11a0000c */ beqz $t5,.L0f1932d0 -/* f1932a0: 3c19800a */ lui $t9,%hi(g_Vars+0x338) -/* f1932a4: 8f39a2f8 */ lw $t9,%lo(g_Vars+0x338)($t9) -/* f1932a8: 8e2b001c */ lw $t3,0x1c($s1) -/* f1932ac: 24010048 */ addiu $at,$zero,0x48 -/* f1932b0: 02a02025 */ or $a0,$s5,$zero -/* f1932b4: 01792823 */ subu $a1,$t3,$t9 -/* f1932b8: 00a1001a */ div $zero,$a1,$at -/* f1932bc: 00002812 */ mflo $a1 -/* f1932c0: 0fc649df */ jal bot0f19277c -/* f1932c4: 00000000 */ nop -/* f1932c8: 1000007c */ b .L0f1934bc -/* f1932cc: 8fbf002c */ lw $ra,0x2c($sp) -.L0f1932d0: -/* f1932d0: 0fc64a53 */ jal bot0f19294c -/* f1932d4: 02202825 */ or $a1,$s1,$zero -/* f1932d8: 14400013 */ bnez $v0,.L0f193328 -/* f1932dc: 02a02025 */ or $a0,$s5,$zero -/* f1932e0: 8e6e0004 */ lw $t6,0x4($s3) -/* f1932e4: 24010001 */ addiu $at,$zero,0x1 -/* f1932e8: 91c20048 */ lbu $v0,0x48($t6) -/* f1932ec: 10400002 */ beqz $v0,.L0f1932f8 -/* f1932f0: 00000000 */ nop -/* f1932f4: 1441000c */ bne $v0,$at,.L0f193328 -.L0f1932f8: -/* f1932f8: 3c18800a */ lui $t8,%hi(g_Vars+0x338) -/* f1932fc: 8f18a2f8 */ lw $t8,%lo(g_Vars+0x338)($t8) -/* f193300: 8e2f001c */ lw $t7,0x1c($s1) -/* f193304: 24010048 */ addiu $at,$zero,0x48 -/* f193308: 02a02025 */ or $a0,$s5,$zero -/* f19330c: 01f82823 */ subu $a1,$t7,$t8 -/* f193310: 00a1001a */ div $zero,$a1,$at -/* f193314: 00002812 */ mflo $a1 -/* f193318: 0fc649df */ jal bot0f19277c -/* f19331c: 00000000 */ nop -/* f193320: 10000066 */ b .L0f1934bc -/* f193324: 8fbf002c */ lw $ra,0x2c($sp) -.L0f193328: -/* f193328: 0fc64a53 */ jal bot0f19294c -/* f19332c: 02202825 */ or $a1,$s1,$zero -/* f193330: 14400004 */ bnez $v0,.L0f193344 -/* f193334: 8fab0050 */ lw $t3,0x50($sp) -/* f193338: 05610002 */ bgez $t3,.L0f193344 -/* f19333c: 00000000 */ nop -/* f193340: afb00050 */ sw $s0,0x50($sp) -.L0f193344: -/* f193344: 3c19800b */ lui $t9,%hi(g_MpNumChrs) -/* f193348: 8f39c530 */ lw $t9,%lo(g_MpNumChrs)($t9) -/* f19334c: 26520001 */ addiu $s2,$s2,0x1 -/* f193350: 26940001 */ addiu $s4,$s4,0x1 -/* f193354: 0259082a */ slt $at,$s2,$t9 -/* f193358: 5420ffbd */ bnezl $at,.L0f193250 -/* f19335c: 82900130 */ lb $s0,0x130($s4) -.L0f193360: -/* f193360: 8fac0050 */ lw $t4,0x50($sp) -/* f193364: 02a02025 */ or $a0,$s5,$zero -/* f193368: 0580000f */ bltz $t4,.L0f1933a8 -/* f19336c: 00000000 */ nop -/* f193370: 0fc63410 */ jal mpGetChrFromPlayerIndex -/* f193374: 01802025 */ or $a0,$t4,$zero -/* f193378: 3c0f800a */ lui $t7,%hi(g_Vars+0x338) -/* f19337c: 8defa2f8 */ lw $t7,%lo(g_Vars+0x338)($t7) -/* f193380: 8c4e001c */ lw $t6,0x1c($v0) -/* f193384: 24010048 */ addiu $at,$zero,0x48 -/* f193388: 02a02025 */ or $a0,$s5,$zero -/* f19338c: 01cf2823 */ subu $a1,$t6,$t7 -/* f193390: 00a1001a */ div $zero,$a1,$at -/* f193394: 00002812 */ mflo $a1 -/* f193398: 0fc649df */ jal bot0f19277c -/* f19339c: 00000000 */ nop -/* f1933a0: 10000046 */ b .L0f1934bc -/* f1933a4: 8fbf002c */ lw $ra,0x2c($sp) -.L0f1933a8: -/* f1933a8: 0fc649df */ jal bot0f19277c -/* f1933ac: 2405ffff */ addiu $a1,$zero,-1 -/* f1933b0: 10000042 */ b .L0f1934bc -/* f1933b4: 8fbf002c */ lw $ra,0x2c($sp) -.L0f1933b8: -/* f1933b8: 8d6ba2f8 */ lw $t3,%lo(g_Vars+0x338)($t3) -/* f1933bc: 01a26821 */ addu $t5,$t5,$v0 -/* f1933c0: 000d68c0 */ sll $t5,$t5,0x3 -/* f1933c4: 01abc821 */ addu $t9,$t5,$t3 -/* f1933c8: 0fc633fe */ jal mpPlayerGetIndex -/* f1933cc: 8f240004 */ lw $a0,0x4($t9) -/* f1933d0: 02626021 */ addu $t4,$s3,$v0 -/* f1933d4: 918e016c */ lbu $t6,0x16c($t4) -/* f1933d8: 02a02025 */ or $a0,$s5,$zero -/* f1933dc: 3c0f800b */ lui $t7,%hi(g_MpNumChrs) -/* f1933e0: 11c00005 */ beqz $t6,.L0f1933f8 -/* f1933e4: 00000000 */ nop -/* f1933e8: 0fc649df */ jal bot0f19277c -/* f1933ec: 86a5017e */ lh $a1,0x17e($s5) -/* f1933f0: 10000032 */ b .L0f1934bc -/* f1933f4: 8fbf002c */ lw $ra,0x2c($sp) -.L0f1933f8: -/* f1933f8: 8defc530 */ lw $t7,%lo(g_MpNumChrs)($t7) -/* f1933fc: 00009025 */ or $s2,$zero,$zero -/* f193400: 02608025 */ or $s0,$s3,$zero -/* f193404: 59e0002a */ blezl $t7,.L0f1934b0 -/* f193408: 02a02025 */ or $a0,$s5,$zero -/* f19340c: 82040130 */ lb $a0,0x130($s0) -.L0f193410: -/* f193410: 0264c021 */ addu $t8,$s3,$a0 -/* f193414: 930d016c */ lbu $t5,0x16c($t8) -/* f193418: 11a0001d */ beqz $t5,.L0f193490 -/* f19341c: 00000000 */ nop -/* f193420: 0fc63410 */ jal mpGetChrFromPlayerIndex -/* f193424: 00000000 */ nop -/* f193428: 10550019 */ beq $v0,$s5,.L0f193490 -/* f19342c: 00408825 */ or $s1,$v0,$zero -/* f193430: 0fc0e6a5 */ jal chrIsDead -/* f193434: 00402025 */ or $a0,$v0,$zero -/* f193438: 14400015 */ bnez $v0,.L0f193490 -/* f19343c: 02a02025 */ or $a0,$s5,$zero -/* f193440: 02202825 */ or $a1,$s1,$zero -/* f193444: 0fc12aa3 */ jal chrCompareTeams -/* f193448: 24060002 */ addiu $a2,$zero,0x2 -/* f19344c: 10400010 */ beqz $v0,.L0f193490 -/* f193450: 02a02025 */ or $a0,$s5,$zero -/* f193454: 0fc64b59 */ jal botPassesPeaceCheck -/* f193458: 02202825 */ or $a1,$s1,$zero -/* f19345c: 1040000c */ beqz $v0,.L0f193490 -/* f193460: 3c19800a */ lui $t9,%hi(g_Vars+0x338) -/* f193464: 8f39a2f8 */ lw $t9,%lo(g_Vars+0x338)($t9) -/* f193468: 8e2b001c */ lw $t3,0x1c($s1) -/* f19346c: 24010048 */ addiu $at,$zero,0x48 -/* f193470: 02a02025 */ or $a0,$s5,$zero -/* f193474: 01792823 */ subu $a1,$t3,$t9 -/* f193478: 00a1001a */ div $zero,$a1,$at -/* f19347c: 00002812 */ mflo $a1 -/* f193480: 0fc649df */ jal bot0f19277c -/* f193484: 00000000 */ nop -/* f193488: 1000000c */ b .L0f1934bc -/* f19348c: 8fbf002c */ lw $ra,0x2c($sp) -.L0f193490: -/* f193490: 3c0e800b */ lui $t6,%hi(g_MpNumChrs) -/* f193494: 8dcec530 */ lw $t6,%lo(g_MpNumChrs)($t6) -/* f193498: 26520001 */ addiu $s2,$s2,0x1 -/* f19349c: 26100001 */ addiu $s0,$s0,0x1 -/* f1934a0: 024e082a */ slt $at,$s2,$t6 -/* f1934a4: 5420ffda */ bnezl $at,.L0f193410 -/* f1934a8: 82040130 */ lb $a0,0x130($s0) -/* f1934ac: 02a02025 */ or $a0,$s5,$zero -.L0f1934b0: -/* f1934b0: 0fc649df */ jal bot0f19277c -/* f1934b4: 86a5017e */ lh $a1,0x17e($s5) -/* f1934b8: 8fbf002c */ lw $ra,0x2c($sp) -.L0f1934bc: -/* f1934bc: 8fb00014 */ lw $s0,0x14($sp) -/* f1934c0: 8fb10018 */ lw $s1,0x18($sp) -/* f1934c4: 8fb2001c */ lw $s2,0x1c($sp) -/* f1934c8: 8fb30020 */ lw $s3,0x20($sp) -/* f1934cc: 8fb40024 */ lw $s4,0x24($sp) -/* f1934d0: 8fb50028 */ lw $s5,0x28($sp) -/* f1934d4: 03e00008 */ jr $ra -/* f1934d8: 27bd00a8 */ addiu $sp,$sp,0xa8 -); -#else -GLOBAL_ASM( -glabel bot0f192e90 -/* f192e90: 27bdff58 */ addiu $sp,$sp,-168 -/* f192e94: afbf002c */ sw $ra,0x2c($sp) -/* f192e98: afb50028 */ sw $s5,0x28($sp) -/* f192e9c: afb40024 */ sw $s4,0x24($sp) -/* f192ea0: afb30020 */ sw $s3,0x20($sp) -/* f192ea4: afb2001c */ sw $s2,0x1c($sp) -/* f192ea8: afb10018 */ sw $s1,0x18($sp) -/* f192eac: afb00014 */ sw $s0,0x14($sp) -/* f192eb0: 8c9302d4 */ lw $s3,0x2d4($a0) -/* f192eb4: 240effff */ addiu $t6,$zero,-1 -/* f192eb8: a7ae006a */ sh $t6,0x6a($sp) -/* f192ebc: 8e6f012c */ lw $t7,0x12c($s3) -/* f192ec0: 3c19800b */ lui $t9,%hi(g_MpNumChrs) -/* f192ec4: 8f39c530 */ lw $t9,%lo(g_MpNumChrs)($t9) -/* f192ec8: 25f80001 */ addiu $t8,$t7,0x1 -/* f192ecc: 0080a825 */ or $s5,$a0,$zero -/* f192ed0: 0319001a */ div $zero,$t8,$t9 -/* f192ed4: 00002010 */ mfhi $a0 -/* f192ed8: ae64012c */ sw $a0,0x12c($s3) -/* f192edc: 17200002 */ bnez $t9,.L0f192ee8 -/* f192ee0: 00000000 */ nop -/* f192ee4: 0007000d */ break 0x7 -.L0f192ee8: -/* f192ee8: 2401ffff */ addiu $at,$zero,-1 -/* f192eec: 17210004 */ bne $t9,$at,.L0f192f00 -/* f192ef0: 3c018000 */ lui $at,0x8000 -/* f192ef4: 17010002 */ bne $t8,$at,.L0f192f00 -/* f192ef8: 00000000 */ nop -/* f192efc: 0006000d */ break 0x6 -.L0f192f00: -/* f192f00: 0fc63410 */ jal mpGetChrFromPlayerIndex -/* f192f04: 00000000 */ nop -/* f192f08: 1055002b */ beq $v0,$s5,.L0f192fb8 -/* f192f0c: 00408825 */ or $s1,$v0,$zero -/* f192f10: 0c004b70 */ jal random -/* f192f14: 00000000 */ nop -/* f192f18: 24013840 */ addiu $at,$zero,0x3840 -/* f192f1c: 0041001b */ divu $zero,$v0,$at -/* f192f20: 3c0d800b */ lui $t5,%hi(g_MpNumChrs) -/* f192f24: 3c0e800a */ lui $t6,%hi(g_Vars+0x38) -/* f192f28: 8dce9ff8 */ lw $t6,%lo(g_Vars+0x38)($t6) -/* f192f2c: 8dadc530 */ lw $t5,%lo(g_MpNumChrs)($t5) -/* f192f30: 00006010 */ mfhi $t4 -/* f192f34: 00000000 */ nop -/* f192f38: 00000000 */ nop -/* f192f3c: 01ae0019 */ multu $t5,$t6 -/* f192f40: 00007812 */ mflo $t7 -/* f192f44: 018f082b */ sltu $at,$t4,$t7 -/* f192f48: 50200005 */ beqzl $at,.L0f192f60 -/* f192f4c: 8e25001c */ lw $a1,0x1c($s1) -/* f192f50: 9279009c */ lbu $t9,0x9c($s3) -/* f192f54: 372b0010 */ ori $t3,$t9,0x10 -/* f192f58: a26b009c */ sb $t3,0x9c($s3) -/* f192f5c: 8e25001c */ lw $a1,0x1c($s1) -.L0f192f60: -/* f192f60: 02a02025 */ or $a0,$s5,$zero -/* f192f64: 0fc1250e */ jal chrGetDistanceToCoord -/* f192f68: 24a50008 */ addiu $a1,$a1,0x8 -/* f192f6c: 8e6d012c */ lw $t5,0x12c($s3) -/* f192f70: 02a02025 */ or $a0,$s5,$zero -/* f192f74: 02202825 */ or $a1,$s1,$zero -/* f192f78: 000d7080 */ sll $t6,$t5,0x2 -/* f192f7c: 026e6021 */ addu $t4,$s3,$t6 -/* f192f80: e580013c */ swc1 $f0,0x13c($t4) -/* f192f84: 0fc0e48b */ jal chrCanSeeChr -/* f192f88: 27a6006a */ addiu $a2,$sp,0x6a -/* f192f8c: 8e6f012c */ lw $t7,0x12c($s3) -/* f192f90: 026fc021 */ addu $t8,$s3,$t7 -/* f192f94: a302016c */ sb $v0,0x16c($t8) -/* f192f98: 8e6b012c */ lw $t3,0x12c($s3) -/* f192f9c: 87b9006a */ lh $t9,0x6a($sp) -/* f192fa0: 000b6840 */ sll $t5,$t3,0x1 -/* f192fa4: 026d7021 */ addu $t6,$s3,$t5 -/* f192fa8: a5d901a8 */ sh $t9,0x1a8($t6) -/* f192fac: 926c009c */ lbu $t4,0x9c($s3) -/* f192fb0: 318fffef */ andi $t7,$t4,0xffef -/* f192fb4: a26f009c */ sb $t7,0x9c($s3) -.L0f192fb8: -/* f192fb8: 3c07800b */ lui $a3,%hi(g_MpNumChrs) -/* f192fbc: 8ce7c530 */ lw $a3,%lo(g_MpNumChrs)($a3) -/* f192fc0: 00009025 */ or $s2,$zero,$zero -/* f192fc4: 02608025 */ or $s0,$s3,$zero -/* f192fc8: 18e00010 */ blez $a3,.L0f19300c -/* f192fcc: 3c0a800a */ lui $t2,%hi(g_Vars) -/* f192fd0: 254a9fc0 */ addiu $t2,$t2,%lo(g_Vars) -.L0f192fd4: -/* f192fd4: 9218016c */ lbu $t8,0x16c($s0) -/* f192fd8: 00126880 */ sll $t5,$s2,0x2 -/* f192fdc: 53000007 */ beqzl $t8,.L0f192ffc -/* f192fe0: 26520001 */ addiu $s2,$s2,0x1 -/* f192fe4: 8d4b0008 */ lw $t3,0x8($t2) -/* f192fe8: 026dc821 */ addu $t9,$s3,$t5 -/* f192fec: 3c07800b */ lui $a3,%hi(g_MpNumChrs) -/* f192ff0: af2b0178 */ sw $t3,0x178($t9) -/* f192ff4: 8ce7c530 */ lw $a3,%lo(g_MpNumChrs)($a3) -/* f192ff8: 26520001 */ addiu $s2,$s2,0x1 -.L0f192ffc: -/* f192ffc: 0247082a */ slt $at,$s2,$a3 -/* f193000: 1420fff4 */ bnez $at,.L0f192fd4 -/* f193004: 26100001 */ addiu $s0,$s0,0x1 -/* f193008: 00009025 */ or $s2,$zero,$zero -.L0f19300c: -/* f19300c: 18e00008 */ blez $a3,.L0f193030 -/* f193010: 27a2006c */ addiu $v0,$sp,0x6c -/* f193014: 00076080 */ sll $t4,$a3,0x2 -/* f193018: 01821821 */ addu $v1,$t4,$v0 -.L0f19301c: -/* f19301c: 24420004 */ addiu $v0,$v0,0x4 -/* f193020: 0043082b */ sltu $at,$v0,$v1 -/* f193024: 1420fffd */ bnez $at,.L0f19301c -/* f193028: ac40fffc */ sw $zero,-0x4($v0) -/* f19302c: 00009025 */ or $s2,$zero,$zero -.L0f193030: -/* f193030: 18e00026 */ blez $a3,.L0f1930cc -/* f193034: 24090001 */ addiu $t1,$zero,0x1 -/* f193038: 44801000 */ mtc1 $zero,$f2 -/* f19303c: 27a8006c */ addiu $t0,$sp,0x6c -/* f193040: 2406ffff */ addiu $a2,$zero,-1 -.L0f193044: -/* f193044: 46001006 */ mov.s $f0,$f2 -/* f193048: 18e00014 */ blez $a3,.L0f19309c -/* f19304c: 00001825 */ or $v1,$zero,$zero -/* f193050: 00002025 */ or $a0,$zero,$zero -/* f193054: 27a5006c */ addiu $a1,$sp,0x6c -.L0f193058: -/* f193058: 8caf0000 */ lw $t7,0x0($a1) -/* f19305c: 24a50004 */ addiu $a1,$a1,0x4 -/* f193060: 55e0000b */ bnezl $t7,.L0f193090 -/* f193064: 24630001 */ addiu $v1,$v1,0x1 -/* f193068: 04c00006 */ bltz $a2,.L0f193084 -/* f19306c: 02641021 */ addu $v0,$s3,$a0 -/* f193070: c444013c */ lwc1 $f4,0x13c($v0) -/* f193074: 4600203c */ c.lt.s $f4,$f0 -/* f193078: 00000000 */ nop -/* f19307c: 45020004 */ bc1fl .L0f193090 -/* f193080: 24630001 */ addiu $v1,$v1,0x1 -.L0f193084: -/* f193084: 00603025 */ or $a2,$v1,$zero -/* f193088: c440013c */ lwc1 $f0,0x13c($v0) -/* f19308c: 24630001 */ addiu $v1,$v1,0x1 -.L0f193090: -/* f193090: 0067082a */ slt $at,$v1,$a3 -/* f193094: 1420fff0 */ bnez $at,.L0f193058 -/* f193098: 24840004 */ addiu $a0,$a0,0x4 -.L0f19309c: -/* f19309c: 04c00007 */ bltz $a2,.L0f1930bc -/* f1930a0: 0272c021 */ addu $t8,$s3,$s2 -/* f1930a4: 00066880 */ sll $t5,$a2,0x2 -/* f1930a8: a3060130 */ sb $a2,0x130($t8) -/* f1930ac: 010d5821 */ addu $t3,$t0,$t5 -/* f1930b0: ad690000 */ sw $t1,0x0($t3) -/* f1930b4: 3c07800b */ lui $a3,%hi(g_MpNumChrs) -/* f1930b8: 8ce7c530 */ lw $a3,%lo(g_MpNumChrs)($a3) -.L0f1930bc: -/* f1930bc: 26520001 */ addiu $s2,$s2,0x1 -/* f1930c0: 0247082a */ slt $at,$s2,$a3 -/* f1930c4: 5420ffdf */ bnezl $at,.L0f193044 -/* f1930c8: 2406ffff */ addiu $a2,$zero,-1 -.L0f1930cc: -/* f1930cc: 0fc64a9d */ jal bot0f192a74 -/* f1930d0: 02a02025 */ or $a0,$s5,$zero -/* f1930d4: 92a202a0 */ lbu $v0,0x2a0($s5) -/* f1930d8: 2401002e */ addiu $at,$zero,0x2e -/* f1930dc: 02a02025 */ or $a0,$s5,$zero -/* f1930e0: 54410006 */ bnel $v0,$at,.L0f1930fc -/* f1930e4: 2401002f */ addiu $at,$zero,0x2f -/* f1930e8: 0fc649df */ jal bot0f19277c -/* f1930ec: 2405ffff */ addiu $a1,$zero,-1 -/* f1930f0: 100000f2 */ b .L0f1934bc -/* f1930f4: 8fbf002c */ lw $ra,0x2c($sp) -/* f1930f8: 2401002f */ addiu $at,$zero,0x2f -.L0f1930fc: -/* f1930fc: 5441001f */ bnel $v0,$at,.L0f19317c -/* f193100: 86b8017e */ lh $t8,0x17e($s5) -/* f193104: 86620008 */ lh $v0,0x8($s3) -/* f193108: 0440001b */ bltz $v0,.L0f193178 -/* f19310c: 0262c821 */ addu $t9,$s3,$v0 -/* f193110: 932c016c */ lbu $t4,0x16c($t9) -/* f193114: 3c10800b */ lui $s0,%hi(g_MpAllChrPtrs) -/* f193118: 2610c4d0 */ addiu $s0,$s0,%lo(g_MpAllChrPtrs) -/* f19311c: 11800016 */ beqz $t4,.L0f193178 -/* f193120: 00027080 */ sll $t6,$v0,0x2 -/* f193124: 020e7821 */ addu $t7,$s0,$t6 -/* f193128: 0fc0e6a5 */ jal chrIsDead -/* f19312c: 8de40000 */ lw $a0,0x0($t7) -/* f193130: 54400012 */ bnezl $v0,.L0f19317c -/* f193134: 86b8017e */ lh $t8,0x17e($s5) -/* f193138: 86780008 */ lh $t8,0x8($s3) -/* f19313c: 3c0e800a */ lui $t6,%hi(g_Vars+0x338) -/* f193140: 8dcea2f8 */ lw $t6,%lo(g_Vars+0x338)($t6) -/* f193144: 00186880 */ sll $t5,$t8,0x2 -/* f193148: 020d5821 */ addu $t3,$s0,$t5 -/* f19314c: 8d790000 */ lw $t9,0x0($t3) -/* f193150: 24010048 */ addiu $at,$zero,0x48 -/* f193154: 02a02025 */ or $a0,$s5,$zero -/* f193158: 8f2c001c */ lw $t4,0x1c($t9) -/* f19315c: 018e2823 */ subu $a1,$t4,$t6 -/* f193160: 00a1001a */ div $zero,$a1,$at -/* f193164: 00002812 */ mflo $a1 -/* f193168: 0fc649df */ jal bot0f19277c -/* f19316c: 00000000 */ nop -/* f193170: 100000d2 */ b .L0f1934bc -/* f193174: 8fbf002c */ lw $ra,0x2c($sp) -.L0f193178: -/* f193178: 86b8017e */ lh $t8,0x17e($s5) -.L0f19317c: -/* f19317c: 2411ffff */ addiu $s1,$zero,-1 -/* f193180: 52380028 */ beql $s1,$t8,.L0f193224 -/* f193184: 86a2017e */ lh $v0,0x17e($s5) -/* f193188: 0fc0a221 */ jal chrGetTargetProp -/* f19318c: 02a02025 */ or $a0,$s5,$zero -/* f193190: 00408025 */ or $s0,$v0,$zero -/* f193194: 0fc0e6a5 */ jal chrIsDead -/* f193198: 8c440004 */ lw $a0,0x4($v0) -/* f19319c: 10400002 */ beqz $v0,.L0f1931a8 -/* f1931a0: 02a02025 */ or $a0,$s5,$zero -/* f1931a4: a6b1017e */ sh $s1,0x17e($s5) -.L0f1931a8: -/* f1931a8: 8ead02d4 */ lw $t5,0x2d4($s5) -/* f1931ac: 8dab0128 */ lw $t3,0x128($t5) -/* f1931b0: 55600007 */ bnezl $t3,.L0f1931d0 -/* f1931b4: 02a02025 */ or $a0,$s5,$zero -/* f1931b8: 0fc64a53 */ jal bot0f19294c -/* f1931bc: 8e050004 */ lw $a1,0x4($s0) -/* f1931c0: 50400003 */ beqzl $v0,.L0f1931d0 -/* f1931c4: 02a02025 */ or $a0,$s5,$zero -/* f1931c8: a6b1017e */ sh $s1,0x17e($s5) -/* f1931cc: 02a02025 */ or $a0,$s5,$zero -.L0f1931d0: -/* f1931d0: 8e050004 */ lw $a1,0x4($s0) -/* f1931d4: 0fc12aa3 */ jal chrCompareTeams -/* f1931d8: 24060001 */ addiu $a2,$zero,0x1 -/* f1931dc: 10400002 */ beqz $v0,.L0f1931e8 -/* f1931e0: 02a02025 */ or $a0,$s5,$zero -/* f1931e4: a6b1017e */ sh $s1,0x17e($s5) -.L0f1931e8: -/* f1931e8: 0fc64b59 */ jal botPassesPeaceCheck -/* f1931ec: 8e050004 */ lw $a1,0x4($s0) -/* f1931f0: 14400002 */ bnez $v0,.L0f1931fc -/* f1931f4: 02a02025 */ or $a0,$s5,$zero -/* f1931f8: a6b1017e */ sh $s1,0x17e($s5) -.L0f1931fc: -/* f1931fc: 8eb902d4 */ lw $t9,0x2d4($s5) -/* f193200: 8f2c0128 */ lw $t4,0x128($t9) -/* f193204: 55800007 */ bnezl $t4,.L0f193224 -/* f193208: 86a2017e */ lh $v0,0x17e($s5) -/* f19320c: 0fc64b70 */ jal botPassesCowardCheck -/* f193210: 8e050004 */ lw $a1,0x4($s0) -/* f193214: 54400003 */ bnezl $v0,.L0f193224 -/* f193218: 86a2017e */ lh $v0,0x17e($s5) -/* f19321c: a6b1017e */ sh $s1,0x17e($s5) -/* f193220: 86a2017e */ lh $v0,0x17e($s5) -.L0f193224: -/* f193224: 3c0f800b */ lui $t7,%hi(g_MpNumChrs) -/* f193228: 3c0b800a */ lui $t3,%hi(g_Vars+0x338) -/* f19322c: 16220062 */ bne $s1,$v0,.L0f1933b8 -/* f193230: 000268c0 */ sll $t5,$v0,0x3 -/* f193234: 8defc530 */ lw $t7,%lo(g_MpNumChrs)($t7) -/* f193238: 240effff */ addiu $t6,$zero,-1 -/* f19323c: afae0050 */ sw $t6,0x50($sp) -/* f193240: 19e00047 */ blez $t7,.L0f193360 -/* f193244: 00009025 */ or $s2,$zero,$zero -/* f193248: 0260a025 */ or $s4,$s3,$zero -/* f19324c: 82900130 */ lb $s0,0x130($s4) -.L0f193250: -/* f193250: 0fc63410 */ jal mpGetChrFromPlayerIndex -/* f193254: 02002025 */ or $a0,$s0,$zero -/* f193258: 1055003a */ beq $v0,$s5,.L0f193344 -/* f19325c: 00408825 */ or $s1,$v0,$zero -/* f193260: 0fc0e6a5 */ jal chrIsDead -/* f193264: 00402025 */ or $a0,$v0,$zero -/* f193268: 14400036 */ bnez $v0,.L0f193344 -/* f19326c: 02a02025 */ or $a0,$s5,$zero -/* f193270: 02202825 */ or $a1,$s1,$zero -/* f193274: 0fc12aa3 */ jal chrCompareTeams -/* f193278: 24060002 */ addiu $a2,$zero,0x2 -/* f19327c: 10400031 */ beqz $v0,.L0f193344 -/* f193280: 02a02025 */ or $a0,$s5,$zero -/* f193284: 0fc64b59 */ jal botPassesPeaceCheck -/* f193288: 02202825 */ or $a1,$s1,$zero -/* f19328c: 1040002d */ beqz $v0,.L0f193344 -/* f193290: 0270c021 */ addu $t8,$s3,$s0 -/* f193294: 930d016c */ lbu $t5,0x16c($t8) -/* f193298: 02a02025 */ or $a0,$s5,$zero -/* f19329c: 11a0000c */ beqz $t5,.L0f1932d0 -/* f1932a0: 3c19800a */ lui $t9,%hi(g_Vars+0x338) -/* f1932a4: 8f39a2f8 */ lw $t9,%lo(g_Vars+0x338)($t9) -/* f1932a8: 8e2b001c */ lw $t3,0x1c($s1) -/* f1932ac: 24010048 */ addiu $at,$zero,0x48 -/* f1932b0: 02a02025 */ or $a0,$s5,$zero -/* f1932b4: 01792823 */ subu $a1,$t3,$t9 -/* f1932b8: 00a1001a */ div $zero,$a1,$at -/* f1932bc: 00002812 */ mflo $a1 -/* f1932c0: 0fc649df */ jal bot0f19277c -/* f1932c4: 00000000 */ nop -/* f1932c8: 1000007c */ b .L0f1934bc -/* f1932cc: 8fbf002c */ lw $ra,0x2c($sp) -.L0f1932d0: -/* f1932d0: 0fc64a53 */ jal bot0f19294c -/* f1932d4: 02202825 */ or $a1,$s1,$zero -/* f1932d8: 14400013 */ bnez $v0,.L0f193328 -/* f1932dc: 02a02025 */ or $a0,$s5,$zero -/* f1932e0: 8e6e0004 */ lw $t6,0x4($s3) -/* f1932e4: 24010001 */ addiu $at,$zero,0x1 -/* f1932e8: 91c20048 */ lbu $v0,0x48($t6) -/* f1932ec: 10400002 */ beqz $v0,.L0f1932f8 -/* f1932f0: 00000000 */ nop -/* f1932f4: 1441000c */ bne $v0,$at,.L0f193328 -.L0f1932f8: -/* f1932f8: 3c18800a */ lui $t8,%hi(g_Vars+0x338) -/* f1932fc: 8f18a2f8 */ lw $t8,%lo(g_Vars+0x338)($t8) -/* f193300: 8e2f001c */ lw $t7,0x1c($s1) -/* f193304: 24010048 */ addiu $at,$zero,0x48 -/* f193308: 02a02025 */ or $a0,$s5,$zero -/* f19330c: 01f82823 */ subu $a1,$t7,$t8 -/* f193310: 00a1001a */ div $zero,$a1,$at -/* f193314: 00002812 */ mflo $a1 -/* f193318: 0fc649df */ jal bot0f19277c -/* f19331c: 00000000 */ nop -/* f193320: 10000066 */ b .L0f1934bc -/* f193324: 8fbf002c */ lw $ra,0x2c($sp) -.L0f193328: -/* f193328: 0fc64a53 */ jal bot0f19294c -/* f19332c: 02202825 */ or $a1,$s1,$zero -/* f193330: 14400004 */ bnez $v0,.L0f193344 -/* f193334: 8fab0050 */ lw $t3,0x50($sp) -/* f193338: 05610002 */ bgez $t3,.L0f193344 -/* f19333c: 00000000 */ nop -/* f193340: afb00050 */ sw $s0,0x50($sp) -.L0f193344: -/* f193344: 3c19800b */ lui $t9,%hi(g_MpNumChrs) -/* f193348: 8f39c530 */ lw $t9,%lo(g_MpNumChrs)($t9) -/* f19334c: 26520001 */ addiu $s2,$s2,0x1 -/* f193350: 26940001 */ addiu $s4,$s4,0x1 -/* f193354: 0259082a */ slt $at,$s2,$t9 -/* f193358: 5420ffbd */ bnezl $at,.L0f193250 -/* f19335c: 82900130 */ lb $s0,0x130($s4) -.L0f193360: -/* f193360: 8fac0050 */ lw $t4,0x50($sp) -/* f193364: 02a02025 */ or $a0,$s5,$zero -/* f193368: 0580000f */ bltz $t4,.L0f1933a8 -/* f19336c: 00000000 */ nop -/* f193370: 0fc63410 */ jal mpGetChrFromPlayerIndex -/* f193374: 01802025 */ or $a0,$t4,$zero -/* f193378: 3c0f800a */ lui $t7,%hi(g_Vars+0x338) -/* f19337c: 8defa2f8 */ lw $t7,%lo(g_Vars+0x338)($t7) -/* f193380: 8c4e001c */ lw $t6,0x1c($v0) -/* f193384: 24010048 */ addiu $at,$zero,0x48 -/* f193388: 02a02025 */ or $a0,$s5,$zero -/* f19338c: 01cf2823 */ subu $a1,$t6,$t7 -/* f193390: 00a1001a */ div $zero,$a1,$at -/* f193394: 00002812 */ mflo $a1 -/* f193398: 0fc649df */ jal bot0f19277c -/* f19339c: 00000000 */ nop -/* f1933a0: 10000046 */ b .L0f1934bc -/* f1933a4: 8fbf002c */ lw $ra,0x2c($sp) -.L0f1933a8: -/* f1933a8: 0fc649df */ jal bot0f19277c -/* f1933ac: 2405ffff */ addiu $a1,$zero,-1 -/* f1933b0: 10000042 */ b .L0f1934bc -/* f1933b4: 8fbf002c */ lw $ra,0x2c($sp) -.L0f1933b8: -/* f1933b8: 8d6ba2f8 */ lw $t3,%lo(g_Vars+0x338)($t3) -/* f1933bc: 01a26821 */ addu $t5,$t5,$v0 -/* f1933c0: 000d68c0 */ sll $t5,$t5,0x3 -/* f1933c4: 01abc821 */ addu $t9,$t5,$t3 -/* f1933c8: 0fc633fe */ jal mpPlayerGetIndex -/* f1933cc: 8f240004 */ lw $a0,0x4($t9) -/* f1933d0: 02626021 */ addu $t4,$s3,$v0 -/* f1933d4: 918e016c */ lbu $t6,0x16c($t4) -/* f1933d8: 02a02025 */ or $a0,$s5,$zero -/* f1933dc: 3c0f800b */ lui $t7,%hi(g_MpNumChrs) -/* f1933e0: 11c00005 */ beqz $t6,.L0f1933f8 -/* f1933e4: 00000000 */ nop -/* f1933e8: 0fc649df */ jal bot0f19277c -/* f1933ec: 86a5017e */ lh $a1,0x17e($s5) -/* f1933f0: 10000032 */ b .L0f1934bc -/* f1933f4: 8fbf002c */ lw $ra,0x2c($sp) -.L0f1933f8: -/* f1933f8: 8defc530 */ lw $t7,%lo(g_MpNumChrs)($t7) -/* f1933fc: 00009025 */ or $s2,$zero,$zero -/* f193400: 02608025 */ or $s0,$s3,$zero -/* f193404: 59e0002a */ blezl $t7,.L0f1934b0 -/* f193408: 02a02025 */ or $a0,$s5,$zero -/* f19340c: 82040130 */ lb $a0,0x130($s0) -.L0f193410: -/* f193410: 0264c021 */ addu $t8,$s3,$a0 -/* f193414: 930d016c */ lbu $t5,0x16c($t8) -/* f193418: 11a0001d */ beqz $t5,.L0f193490 -/* f19341c: 00000000 */ nop -/* f193420: 0fc63410 */ jal mpGetChrFromPlayerIndex -/* f193424: 00000000 */ nop -/* f193428: 10550019 */ beq $v0,$s5,.L0f193490 -/* f19342c: 00408825 */ or $s1,$v0,$zero -/* f193430: 0fc0e6a5 */ jal chrIsDead -/* f193434: 00402025 */ or $a0,$v0,$zero -/* f193438: 14400015 */ bnez $v0,.L0f193490 -/* f19343c: 02a02025 */ or $a0,$s5,$zero -/* f193440: 02202825 */ or $a1,$s1,$zero -/* f193444: 0fc12aa3 */ jal chrCompareTeams -/* f193448: 24060002 */ addiu $a2,$zero,0x2 -/* f19344c: 10400010 */ beqz $v0,.L0f193490 -/* f193450: 02a02025 */ or $a0,$s5,$zero -/* f193454: 0fc64b59 */ jal botPassesPeaceCheck -/* f193458: 02202825 */ or $a1,$s1,$zero -/* f19345c: 1040000c */ beqz $v0,.L0f193490 -/* f193460: 3c19800a */ lui $t9,%hi(g_Vars+0x338) -/* f193464: 8f39a2f8 */ lw $t9,%lo(g_Vars+0x338)($t9) -/* f193468: 8e2b001c */ lw $t3,0x1c($s1) -/* f19346c: 24010048 */ addiu $at,$zero,0x48 -/* f193470: 02a02025 */ or $a0,$s5,$zero -/* f193474: 01792823 */ subu $a1,$t3,$t9 -/* f193478: 00a1001a */ div $zero,$a1,$at -/* f19347c: 00002812 */ mflo $a1 -/* f193480: 0fc649df */ jal bot0f19277c -/* f193484: 00000000 */ nop -/* f193488: 1000000c */ b .L0f1934bc -/* f19348c: 8fbf002c */ lw $ra,0x2c($sp) -.L0f193490: -/* f193490: 3c0e800b */ lui $t6,%hi(g_MpNumChrs) -/* f193494: 8dcec530 */ lw $t6,%lo(g_MpNumChrs)($t6) -/* f193498: 26520001 */ addiu $s2,$s2,0x1 -/* f19349c: 26100001 */ addiu $s0,$s0,0x1 -/* f1934a0: 024e082a */ slt $at,$s2,$t6 -/* f1934a4: 5420ffda */ bnezl $at,.L0f193410 -/* f1934a8: 82040130 */ lb $a0,0x130($s0) -/* f1934ac: 02a02025 */ or $a0,$s5,$zero -.L0f1934b0: -/* f1934b0: 0fc649df */ jal bot0f19277c -/* f1934b4: 86a5017e */ lh $a1,0x17e($s5) -/* f1934b8: 8fbf002c */ lw $ra,0x2c($sp) -.L0f1934bc: -/* f1934bc: 8fb00014 */ lw $s0,0x14($sp) -/* f1934c0: 8fb10018 */ lw $s1,0x18($sp) -/* f1934c4: 8fb2001c */ lw $s2,0x1c($sp) -/* f1934c8: 8fb30020 */ lw $s3,0x20($sp) -/* f1934cc: 8fb40024 */ lw $s4,0x24($sp) -/* f1934d0: 8fb50028 */ lw $s5,0x28($sp) -/* f1934d4: 03e00008 */ jr $ra -/* f1934d8: 27bd00a8 */ addiu $sp,$sp,0xa8 -); -#endif +/** + * Choose and assign a general target to chase and attack. + * + * The function considers the distances and visibility of other chrs. + * + * The function does not compare weapons with the target, nor ammo counts, + * and does not factor in the bot types (eg. VengeSim). + */ +void botChooseGeneralTarget(struct chrdata *botchr) +{ + struct aibot *aibot = botchr->aibot; + s32 i; + s32 j; + bool distancesdone[12]; + s16 room = -1; + struct chrdata *trychr; + s32 playernum; + + // Advance the bot's internal pointer to the next chr + // and update stats about that chr + aibot->queryplayernum = (aibot->queryplayernum + 1) % g_MpNumChrs; + + trychr = mpGetChrFromPlayerIndex(aibot->queryplayernum); + + if (trychr != botchr) { + // This condition passes on average once every 4 minutes per player + if (random() % PALDOWN(4 * 60 * 60) < g_MpNumChrs * g_Vars.lvupdate240_60) { + aibot->unk09c_03 = true; + } + + aibot->chrdistances[aibot->queryplayernum] = chrGetDistanceToCoord(botchr, &trychr->prop->pos); + aibot->chrsinsight[aibot->queryplayernum] = chrCanSeeChr(botchr, trychr, &room); + aibot->chrrooms[aibot->queryplayernum] = room; + + aibot->unk09c_03 = false; + } + + // Update last seen timestamps for all visible chrs + for (i = 0; i < g_MpNumChrs; i++) { + if (aibot->chrsinsight[i]) { + aibot->chrslastseen60[i] = g_Vars.lvframe60; + } + } + + // Update chrnumsbydistanceasc + for (i = 0; i < g_MpNumChrs; i++) { + distancesdone[i] = false; + } + + for (i = 0; i < g_MpNumChrs; i++) { + s32 closestplayernum = -1; + f32 closestdistance = 0; + + for (j = 0; j < g_MpNumChrs; j++) { + if (!distancesdone[j] && (closestplayernum < 0 || aibot->chrdistances[j] < closestdistance)) { + closestplayernum = j; + closestdistance = aibot->chrdistances[j]; + } + } + + if (closestplayernum >= 0) { + aibot->chrnumsbydistanceasc[i] = closestplayernum; + distancesdone[closestplayernum] = true; + } + } + + bot0f192a74(botchr); + + // If the bot is data uplinking, clear the target + if (botchr->myaction == MA_AIBOTDOWNLOAD) { + botSetTarget(botchr, -1); + return; + } + + // if the bot is attacking, keep the same target if possible + if (botchr->myaction == MA_AIBOTATTACK + && aibot->attackingplayernum >= 0 + && aibot->chrsinsight[aibot->attackingplayernum] + && !chrIsDead(g_MpAllChrPtrs[aibot->attackingplayernum])) { + botSetTarget(botchr, g_MpAllChrPtrs[aibot->attackingplayernum]->prop - g_Vars.props); + return; + } + + // Check if existing target needs to be invalidated + if (botchr->target != -1) { + struct prop *targetprop = chrGetTargetProp(botchr); + + if (chrIsDead(targetprop->chr)) { + botchr->target = -1; + } + + if (!botchr->aibot->targetinsight && botIsTargetInvisible(botchr, targetprop->chr)) { + botchr->target = -1; + } + + if (chrCompareTeams(botchr, targetprop->chr, COMPARE_FRIENDS)) { + botchr->target = -1; + } + + if (!botPassesPeaceCheck(botchr, targetprop->chr)) { + botchr->target = -1; + } + + if (!botchr->aibot->targetinsight && !botPassesCowardCheck(botchr, targetprop->chr)) { + botchr->target = -1; + } + } + + // If there's no existing target, try all chrs in distance order + if (botchr->target == -1) { + s32 closestavailablechrnum = -1; + s32 tmp; + s32 stack; + + for (tmp = 0; tmp < g_MpNumChrs; tmp++) { + s32 i = aibot->chrnumsbydistanceasc[tmp]; + trychr = mpGetChrFromPlayerIndex(i); + + if (trychr != botchr + && !chrIsDead(trychr) + && chrCompareTeams(botchr, trychr, COMPARE_ENEMIES) + && botPassesPeaceCheck(botchr, trychr)) { + // If the chr is in sight, that's it + if (aibot->chrsinsight[i]) { + botSetTarget(botchr, trychr->prop - g_Vars.props); + return; + } + + // Meat and easy sims will target the closest chr, even if that + // chr isn't in sight and when there are other chrs in sight who + // are further away + if (!botIsTargetInvisible(botchr, trychr) + && (aibot->config->difficulty == BOTDIFF_MEAT || aibot->config->difficulty == BOTDIFF_EASY)) { + botSetTarget(botchr, trychr->prop - g_Vars.props); + return; + } + + // Other sim types will prioritise chrs in sight, which means + // the closest out of sight chrnum must be stored for later + if (!botIsTargetInvisible(botchr, trychr) && closestavailablechrnum < 0) { + closestavailablechrnum = i; + } + } + } + + // Use closest out of sight chr + if (closestavailablechrnum >= 0) { + trychr = mpGetChrFromPlayerIndex(closestavailablechrnum); + botSetTarget(botchr, trychr->prop - g_Vars.props); + return; + } + + // No one available - maybe everyone else is dead or cloaked + botSetTarget(botchr, -1); + return; + } + + // Bot has an existing target + // If they're still in sight, keep the target + playernum = mpPlayerGetIndex((g_Vars.props + botchr->target)->chr); + + if (aibot->chrsinsight[playernum]) { + botSetTarget(botchr, botchr->target); + return; + } + + // Target is no longer in sight + // Check for other chrs who are in sight, by distance + for (i = 0; i < g_MpNumChrs; i++) { + if (aibot->chrsinsight[aibot->chrnumsbydistanceasc[i]]) { + trychr = mpGetChrFromPlayerIndex(aibot->chrnumsbydistanceasc[i]); + + if (trychr != botchr + && !chrIsDead(trychr) + && chrCompareTeams(botchr, trychr, COMPARE_ENEMIES) + && botPassesPeaceCheck(botchr, trychr)) { + botSetTarget(botchr, trychr->prop - g_Vars.props); + return; + } + } + } + + // No one else in sight - maintain original target + botSetTarget(botchr, botchr->target); +} bool botIsFollowing(struct chrdata *leader, struct chrdata *follower) { @@ -5301,7 +4603,7 @@ s32 bot0f193530(struct chrdata *chr, f32 range) && !chrIsDead(g_MpAllChrPtrs[i]) && chr->team == g_MpAllChrPtrs[i]->team && botIsFollowing(chr, g_MpAllChrPtrs[i])) { - f32 distance = chr->aibot->playerdistances[i]; + f32 distance = chr->aibot->chrdistances[i]; if (closestplayernum < 0 || distance < closestdistance) { closestplayernum = i; @@ -8402,7 +7704,7 @@ glabel var7f1b8fc8 /* f1966b8: 02002025 */ move $a0,$s0 /* f1966bc: 14400232 */ bnez $v0,.PF0f196f88 /* f1966c0: 02802025 */ move $a0,$s4 -/* f1966c4: 0fc64e81 */ jal bot0f19294c +/* f1966c4: 0fc64e81 */ jal botIsTargetInvisible /* f1966c8: 02002825 */ move $a1,$s0 /* f1966cc: 1440022e */ bnez $v0,.PF0f196f88 /* f1966d0: 02802025 */ move $a0,$s4 @@ -8662,7 +7964,7 @@ glabel var7f1b8fc8 /* f196a60: 02002025 */ move $a0,$s0 /* f196a64: 14400148 */ bnez $v0,.PF0f196f88 /* f196a68: 02802025 */ move $a0,$s4 -/* f196a6c: 0fc64e81 */ jal bot0f19294c +/* f196a6c: 0fc64e81 */ jal botIsTargetInvisible /* f196a70: 02002825 */ move $a1,$s0 /* f196a74: 14400144 */ bnez $v0,.PF0f196f88 /* f196a78: 02802025 */ move $a0,$s4 @@ -8861,7 +8163,7 @@ glabel var7f1b8fc8 /* f196d64: 10000088 */ b .PF0f196f88 /* f196d68: a642000a */ sh $v0,0xa($s2) .PF0f196d6c: -/* f196d6c: 0fc64e81 */ jal bot0f19294c +/* f196d6c: 0fc64e81 */ jal botIsTargetInvisible /* f196d70: 02002825 */ move $a1,$s0 /* f196d74: 14400084 */ bnez $v0,.PF0f196f88 /* f196d78: 02802025 */ move $a0,$s4 @@ -8925,7 +8227,7 @@ glabel var7f1b8fc8 /* f196e54: 1000004c */ b .PF0f196f88 /* f196e58: a642000a */ sh $v0,0xa($s2) .PF0f196e5c: -/* f196e5c: 0fc64e81 */ jal bot0f19294c +/* f196e5c: 0fc64e81 */ jal botIsTargetInvisible /* f196e60: 02002825 */ move $a1,$s0 /* f196e64: 14400048 */ bnez $v0,.PF0f196f88 /* f196e68: 02802025 */ move $a0,$s4 @@ -8991,7 +8293,7 @@ glabel var7f1b8fc8 /* f196f50: 1000000d */ b .PF0f196f88 /* f196f54: a642000a */ sh $v0,0xa($s2) .PF0f196f58: -/* f196f58: 0fc64e81 */ jal bot0f19294c +/* f196f58: 0fc64e81 */ jal botIsTargetInvisible /* f196f5c: 02002825 */ move $a1,$s0 /* f196f60: 14400009 */ bnez $v0,.PF0f196f88 /* f196f64: 02802025 */ move $a0,$s4 @@ -9144,7 +8446,7 @@ glabel var7f1b8fc8 /* f197194: 04400098 */ bltz $v0,.PF0f1973f8 /* f197198: 0002c880 */ sll $t9,$v0,0x2 /* f19719c: 00b92821 */ addu $a1,$a1,$t9 -/* f1971a0: 0fc64e81 */ jal bot0f19294c +/* f1971a0: 0fc64e81 */ jal botIsTargetInvisible /* f1971a4: 8ca5ca70 */ lw $a1,-0x3590($a1) /* f1971a8: 14400093 */ bnez $v0,.PF0f1973f8 /* f1971ac: 00000000 */ nop @@ -9181,7 +8483,7 @@ glabel var7f1b8fc8 /* f19721c: 04400076 */ bltz $v0,.PF0f1973f8 /* f197220: 00027080 */ sll $t6,$v0,0x2 /* f197224: 00ae2821 */ addu $a1,$a1,$t6 -/* f197228: 0fc64e81 */ jal bot0f19294c +/* f197228: 0fc64e81 */ jal botIsTargetInvisible /* f19722c: 8ca5ca70 */ lw $a1,-0x3590($a1) /* f197230: 14400071 */ bnez $v0,.PF0f1973f8 /* f197234: 00000000 */ nop @@ -9221,7 +8523,7 @@ glabel var7f1b8fc8 /* f1972b4: 24060002 */ li $a2,0x2 /* f1972b8: 10400008 */ beqz $v0,.PF0f1972dc /* f1972bc: 02802025 */ move $a0,$s4 -/* f1972c0: 0fc64e81 */ jal bot0f19294c +/* f1972c0: 0fc64e81 */ jal botIsTargetInvisible /* f1972c4: 02202825 */ move $a1,$s1 /* f1972c8: 14400004 */ bnez $v0,.PF0f1972dc /* f1972cc: 8fa900d8 */ lw $t1,0xd8($sp) @@ -9263,7 +8565,7 @@ glabel var7f1b8fc8 /* f197350: 1040001f */ beqz $v0,.PF0f1973d0 /* f197354: 8fa500c0 */ lw $a1,0xc0($sp) /* f197358: 02802025 */ move $a0,$s4 -/* f19735c: 0fc64e81 */ jal bot0f19294c +/* f19735c: 0fc64e81 */ jal botIsTargetInvisible /* f197360: afa500c0 */ sw $a1,0xc0($sp) /* f197364: 1440001a */ bnez $v0,.PF0f1973d0 /* f197368: 8fa500c0 */ lw $a1,0xc0($sp) @@ -9384,7 +8686,7 @@ glabel var7f1b8fc8 /* f197504: 02802025 */ move $a0,$s4 /* f197508: 51c00061 */ beqzl $t6,.PF0f197690 /* f19750c: 928202a0 */ lbu $v0,0x2a0($s4) -/* f197510: 0fc64e0d */ jal bot0f19277c +/* f197510: 0fc64e0d */ jal botSetTarget /* f197514: 03c02825 */ move $a1,$s8 /* f197518: 1000005d */ b .PF0f197690 /* f19751c: 928202a0 */ lbu $v0,0x2a0($s4) @@ -9397,7 +8699,7 @@ glabel var7f1b8fc8 /* f197534: 02802025 */ move $a0,$s4 /* f197538: 51800004 */ beqzl $t4,.PF0f19754c /* f19753c: 02802025 */ move $a0,$s4 -/* f197540: 0fc64e0d */ jal bot0f19277c +/* f197540: 0fc64e0d */ jal botSetTarget /* f197544: 03c02825 */ move $a1,$s8 /* f197548: 02802025 */ move $a0,$s4 .PF0f19754c: @@ -9898,7 +9200,7 @@ glabel var7f1b8fc8 /* f197c50: 00000000 */ nop /* f197c54: a29902a0 */ sb $t9,0x2a0($s4) .PF0f197c58: -/* f197c58: 0fc64fd0 */ jal bot0f192e90 +/* f197c58: 0fc64fd0 */ jal botChooseGeneralTarget /* f197c5c: 02802025 */ move $a0,$s4 /* f197c60: 0fc63831 */ jal mpPlayerGetIndex /* f197c64: 02802025 */ move $a0,$s4 @@ -11416,7 +10718,7 @@ glabel var7f1b8fc8 /* f195600: 02002025 */ or $a0,$s0,$zero /* f195604: 14400232 */ bnez $v0,.L0f195ed0 /* f195608: 02802025 */ or $a0,$s4,$zero -/* f19560c: 0fc64a53 */ jal bot0f19294c +/* f19560c: 0fc64a53 */ jal botIsTargetInvisible /* f195610: 02002825 */ or $a1,$s0,$zero /* f195614: 1440022e */ bnez $v0,.L0f195ed0 /* f195618: 02802025 */ or $a0,$s4,$zero @@ -11676,7 +10978,7 @@ glabel var7f1b8fc8 /* f1959a8: 02002025 */ or $a0,$s0,$zero /* f1959ac: 14400148 */ bnez $v0,.L0f195ed0 /* f1959b0: 02802025 */ or $a0,$s4,$zero -/* f1959b4: 0fc64a53 */ jal bot0f19294c +/* f1959b4: 0fc64a53 */ jal botIsTargetInvisible /* f1959b8: 02002825 */ or $a1,$s0,$zero /* f1959bc: 14400144 */ bnez $v0,.L0f195ed0 /* f1959c0: 02802025 */ or $a0,$s4,$zero @@ -11875,7 +11177,7 @@ glabel var7f1b8fc8 /* f195cac: 10000088 */ b .L0f195ed0 /* f195cb0: a642000a */ sh $v0,0xa($s2) .L0f195cb4: -/* f195cb4: 0fc64a53 */ jal bot0f19294c +/* f195cb4: 0fc64a53 */ jal botIsTargetInvisible /* f195cb8: 02002825 */ or $a1,$s0,$zero /* f195cbc: 14400084 */ bnez $v0,.L0f195ed0 /* f195cc0: 02802025 */ or $a0,$s4,$zero @@ -11939,7 +11241,7 @@ glabel var7f1b8fc8 /* f195d9c: 1000004c */ b .L0f195ed0 /* f195da0: a642000a */ sh $v0,0xa($s2) .L0f195da4: -/* f195da4: 0fc64a53 */ jal bot0f19294c +/* f195da4: 0fc64a53 */ jal botIsTargetInvisible /* f195da8: 02002825 */ or $a1,$s0,$zero /* f195dac: 14400048 */ bnez $v0,.L0f195ed0 /* f195db0: 02802025 */ or $a0,$s4,$zero @@ -12005,7 +11307,7 @@ glabel var7f1b8fc8 /* f195e98: 1000000d */ b .L0f195ed0 /* f195e9c: a642000a */ sh $v0,0xa($s2) .L0f195ea0: -/* f195ea0: 0fc64a53 */ jal bot0f19294c +/* f195ea0: 0fc64a53 */ jal botIsTargetInvisible /* f195ea4: 02002825 */ or $a1,$s0,$zero /* f195ea8: 14400009 */ bnez $v0,.L0f195ed0 /* f195eac: 02802025 */ or $a0,$s4,$zero @@ -12158,7 +11460,7 @@ glabel var7f1b8fc8 /* f1960dc: 04400096 */ bltz $v0,.L0f196338 /* f1960e0: 0002c880 */ sll $t9,$v0,0x2 /* f1960e4: 00b92821 */ addu $a1,$a1,$t9 -/* f1960e8: 0fc64a53 */ jal bot0f19294c +/* f1960e8: 0fc64a53 */ jal botIsTargetInvisible /* f1960ec: 8ca5c4d0 */ lw $a1,%lo(g_MpAllChrPtrs)($a1) /* f1960f0: 14400091 */ bnez $v0,.L0f196338 /* f1960f4: 00000000 */ nop @@ -12195,7 +11497,7 @@ glabel var7f1b8fc8 /* f196164: 04400074 */ bltz $v0,.L0f196338 /* f196168: 00027080 */ sll $t6,$v0,0x2 /* f19616c: 00ae2821 */ addu $a1,$a1,$t6 -/* f196170: 0fc64a53 */ jal bot0f19294c +/* f196170: 0fc64a53 */ jal botIsTargetInvisible /* f196174: 8ca5c4d0 */ lw $a1,%lo(g_MpAllChrPtrs)($a1) /* f196178: 1440006f */ bnez $v0,.L0f196338 /* f19617c: 00000000 */ nop @@ -12234,7 +11536,7 @@ glabel var7f1b8fc8 /* f1961f8: 24060002 */ addiu $a2,$zero,0x2 /* f1961fc: 10400008 */ beqz $v0,.L0f196220 /* f196200: 02802025 */ or $a0,$s4,$zero -/* f196204: 0fc64a53 */ jal bot0f19294c +/* f196204: 0fc64a53 */ jal botIsTargetInvisible /* f196208: 8fa500d4 */ lw $a1,0xd4($sp) /* f19620c: 14400004 */ bnez $v0,.L0f196220 /* f196210: 8fb900d8 */ lw $t9,0xd8($sp) @@ -12275,7 +11577,7 @@ glabel var7f1b8fc8 /* f196290: 1040001f */ beqz $v0,.L0f196310 /* f196294: 8fa500c0 */ lw $a1,0xc0($sp) /* f196298: 02802025 */ or $a0,$s4,$zero -/* f19629c: 0fc64a53 */ jal bot0f19294c +/* f19629c: 0fc64a53 */ jal botIsTargetInvisible /* f1962a0: afa500c0 */ sw $a1,0xc0($sp) /* f1962a4: 1440001a */ bnez $v0,.L0f196310 /* f1962a8: 8fa500c0 */ lw $a1,0xc0($sp) @@ -12394,7 +11696,7 @@ glabel var7f1b8fc8 /* f19643c: 02802025 */ or $a0,$s4,$zero /* f196440: 51a00060 */ beqzl $t5,.L0f1965c4 /* f196444: 928202a0 */ lbu $v0,0x2a0($s4) -/* f196448: 0fc649df */ jal bot0f19277c +/* f196448: 0fc649df */ jal botSetTarget /* f19644c: 03c02825 */ or $a1,$s8,$zero /* f196450: 1000005c */ b .L0f1965c4 /* f196454: 928202a0 */ lbu $v0,0x2a0($s4) @@ -12406,7 +11708,7 @@ glabel var7f1b8fc8 /* f196468: 02802025 */ or $a0,$s4,$zero /* f19646c: 51600004 */ beqzl $t3,.L0f196480 /* f196470: 02802025 */ or $a0,$s4,$zero -/* f196474: 0fc649df */ jal bot0f19277c +/* f196474: 0fc649df */ jal botSetTarget /* f196478: 03c02825 */ or $a1,$s8,$zero /* f19647c: 02802025 */ or $a0,$s4,$zero .L0f196480: @@ -12906,7 +12208,7 @@ glabel var7f1b8fc8 /* f196b80: 00000000 */ nop /* f196b84: a29802a0 */ sb $t8,0x2a0($s4) .L0f196b88: -/* f196b88: 0fc64ba4 */ jal bot0f192e90 +/* f196b88: 0fc64ba4 */ jal botChooseGeneralTarget /* f196b8c: 02802025 */ or $a0,$s4,$zero /* f196b90: 0fc633fe */ jal mpPlayerGetIndex /* f196b94: 02802025 */ or $a0,$s4,$zero diff --git a/src/game/botcmd.c b/src/game/botcmd.c index b873b8cee..ba2a679cc 100644 --- a/src/game/botcmd.c +++ b/src/game/botcmd.c @@ -44,7 +44,7 @@ void botcmdTickDistMode(struct chrdata *chr) struct aibot *aibot = chr->aibot; s32 prevmode = aibot->distmode; struct prop *targetprop = NULL; - s32 somevalue = 0; + bool insight = false; f32 minattackdistance; f32 maxattackdistance; f32 limit3; @@ -59,7 +59,7 @@ void botcmdTickDistMode(struct chrdata *chr) if (chr->myaction == MA_AIBOTFOLLOW && aibot->followingplayernum >= 0) { limits = g_BotDistConfigs[BOTDISTCFG_FOLLOW]; targetprop = g_MpAllChrPtrs[aibot->followingplayernum]->prop; - somevalue = aibot->unk16c[aibot->followingplayernum]; + insight = aibot->chrsinsight[aibot->followingplayernum]; if (chr->target != -1 && (confignum == BOTDISTCFG_CLOSE || confignum == BOTDISTCFG_KAZE)) { struct prop *target = chrGetTargetProp(chr); @@ -70,7 +70,7 @@ void botcmdTickDistMode(struct chrdata *chr) if (xdiff * xdiff + ydiff * ydiff + zdiff * zdiff < 500 * 500) { limits = g_BotDistConfigs[confignum]; targetprop = target; - somevalue = aibot->unk128; + insight = aibot->targetinsight; } } } else { @@ -78,10 +78,10 @@ void botcmdTickDistMode(struct chrdata *chr) if (chr->myaction == MA_AIBOTATTACK && aibot->attackingplayernum >= 0) { targetprop = g_MpAllChrPtrs[aibot->attackingplayernum]->prop; - somevalue = aibot->unk16c[aibot->attackingplayernum]; + insight = aibot->chrsinsight[aibot->attackingplayernum]; } else if (chr->target != -1) { targetprop = chrGetTargetProp(chr); - somevalue = aibot->unk128; + insight = aibot->targetinsight; } } @@ -125,17 +125,17 @@ void botcmdTickDistMode(struct chrdata *chr) } #if VERSION >= VERSION_NTSC_1_0 - if (newmode != BOTDISTMODE_BACKUP || somevalue == 0 || aibot->unk050 != targetprop) { + if (newmode != BOTDISTMODE_BACKUP || !insight || aibot->unk050 != targetprop) { aibot->unk050 = NULL; aibot->unk09d = 0; } if (newmode == BOTDISTMODE_OK) { - if (somevalue == 0) { + if (!insight) { newmode = BOTDISTMODE_ADVANCE; } } else if (newmode == BOTDISTMODE_BACKUP) { - if (somevalue == 0) { + if (!insight) { newmode = BOTDISTMODE_ADVANCE; aibot->unk050 = targetprop; aibot->unk09d = PALDOWN(20) + (random() % PALDOWN(120)); @@ -150,7 +150,7 @@ void botcmdTickDistMode(struct chrdata *chr) } } #else - if (newmode == BOTDISTMODE_OK && somevalue == 0) { + if (newmode == BOTDISTMODE_OK && !insight) { newmode = BOTDISTMODE_ADVANCE; } #endif diff --git a/src/game/botinv.c b/src/game/botinv.c index f305d6dd2..c4196e2ff 100644 --- a/src/game/botinv.c +++ b/src/game/botinv.c @@ -628,7 +628,7 @@ void botinvScoreWeapon(struct chrdata *chr, s32 weaponnum, s32 funcnum, s32 arg3 if (chr->aibot->config->difficulty > BOTDIFF_MEAT) { if (comparewithtarget) { if (chr->target != -1 - && chr->aibot->unk16c[mpPlayerGetIndex(chrGetTargetProp(chr)->chr)] == 0 + && chr->aibot->chrsinsight[mpPlayerGetIndex(chrGetTargetProp(chr)->chr)] == 0 && (chr->aibot->rand % 2) == 0) { score1 += 10; } else { @@ -645,7 +645,7 @@ void botinvScoreWeapon(struct chrdata *chr, s32 weaponnum, s32 funcnum, s32 arg3 if (chr->aibot->config->difficulty >= BOTDIFF_NORMAL) { if (comparewithtarget) { if (chr->target != -1 - && chr->aibot->unk16c[mpPlayerGetIndex(chrGetTargetProp(chr)->chr)] == 0 + && chr->aibot->chrsinsight[mpPlayerGetIndex(chrGetTargetProp(chr)->chr)] == 0 && (chr->aibot->rand % 2) == 0) { score1 = 178; score2 = 188; @@ -978,8 +978,8 @@ void botinvTick(struct chrdata *chr) if (newweaponnum == WEAPON_COMBATKNIFE && botactGetAmmoQuantityByWeapon(aibot, WEAPON_COMBATKNIFE, FUNC_SECONDARY, true) >= 2 && chr->target != -1 - && chr->aibot->playerdistances[mpPlayerGetIndex(chrGetTargetProp(chr)->chr)] > 200 - && chr->aibot->playerdistances[mpPlayerGetIndex(chrGetTargetProp(chr)->chr)] < 1500) { + && chr->aibot->chrdistances[mpPlayerGetIndex(chrGetTargetProp(chr)->chr)] > 200 + && chr->aibot->chrdistances[mpPlayerGetIndex(chrGetTargetProp(chr)->chr)] < 1500) { newfuncnum = FUNC_SECONDARY; } diff --git a/src/game/botmgr.c b/src/game/botmgr.c index ed7b4f75c..2ba70cd84 100644 --- a/src/game/botmgr.c +++ b/src/game/botmgr.c @@ -211,18 +211,18 @@ void botmgrAllocateBot(s32 chrnum, s32 aibotnum) aibot->shotspeed.y = 0.0f; aibot->shotspeed.z = 0.0f; aibot->unk118 = 0; - aibot->unk11c = 0; - aibot->unk120 = -1; - aibot->unk124 = -1; - aibot->unk128 = 0; - aibot->unk12c = 0; + aibot->targethotness = 0; + aibot->targetlastseen60 = -1; + aibot->lastseenanytarget60 = -1; + aibot->targetinsight = false; + aibot->queryplayernum = 0; for (i = 0; i < 12; i++) { - aibot->unk130[i] = -1; - aibot->playerdistances[i] = U32_MAX; - aibot->unk16c[i] = 0; - aibot->unk178[i] = -1; - aibot->unk1a8[i] = -1; + aibot->chrnumsbydistanceasc[i] = -1; + aibot->chrdistances[i] = U32_MAX; + aibot->chrsinsight[i] = 0; + aibot->chrslastseen60[i] = -1; + aibot->chrrooms[i] = -1; } aibot->unk1c0 = 0.0f; @@ -253,7 +253,7 @@ void botmgrAllocateBot(s32 chrnum, s32 aibotnum) aibot->unk2a4 = 0; aibot->dampensuicidesttl60 = 0; aibot->unk2c4 = 0.0f; - aibot->unk2c8 = 0; + aibot->targetcloaktimer60 = 0; aibot->unk09c_03 = 0; diff --git a/src/game/chr/chraction.c b/src/game/chr/chraction.c index 0abc593e9..ec65e0501 100644 --- a/src/game/chr/chraction.c +++ b/src/game/chr/chraction.c @@ -6729,7 +6729,7 @@ bool chrCanSeeChr(struct chrdata *chr, struct chrdata *target, s16 *room) u32 stack; s16 sp88[] = {-1, 0, 0, 0, 0, 0, 0, 0}; - if (bot0f19294c(chr, target) == 0) { + if (botIsTargetInvisible(chr, target) == 0) { struct prop *prop = chr->prop; struct coord pos; s16 rooms[8]; diff --git a/src/game/propobj.c b/src/game/propobj.c index dda033486..29e0fd2fa 100644 --- a/src/game/propobj.c +++ b/src/game/propobj.c @@ -21962,7 +21962,7 @@ glabel var7f1aa3d0 /* f0738fc: 24060002 */ addiu $a2,$zero,0x2 /* f073900: 1040004a */ beqz $v0,.L0f073a2c /* f073904: 00002025 */ or $a0,$zero,$zero -/* f073908: 0fc64a53 */ jal bot0f19294c +/* f073908: 0fc64a53 */ jal botIsTargetInvisible /* f07390c: 02002825 */ or $a1,$s0,$zero /* f073910: 14400046 */ bnez $v0,.L0f073a2c /* f073914: 00000000 */ nop @@ -22419,7 +22419,7 @@ glabel var7f1aa3d0 /* f0738fc: 24060002 */ addiu $a2,$zero,0x2 /* f073900: 1040004a */ beqz $v0,.L0f073a2c /* f073904: 00002025 */ or $a0,$zero,$zero -/* f073908: 0fc64a53 */ jal bot0f19294c +/* f073908: 0fc64a53 */ jal botIsTargetInvisible /* f07390c: 02002825 */ or $a1,$s0,$zero /* f073910: 14400046 */ bnez $v0,.L0f073a2c /* f073914: 00000000 */ nop diff --git a/src/include/game/bot.h b/src/include/game/bot.h index 490690673..f9ee32789 100644 --- a/src/include/game/bot.h +++ b/src/include/game/bot.h @@ -25,13 +25,13 @@ void bot0f1921f8(struct chrdata *chr, f32 *move); #endif void botLoseGun(struct chrdata *chr, struct prop *attacker); -void bot0f19277c(struct chrdata *chr, s32 propnum); -bool bot0f19294c(struct chrdata *botchr, struct chrdata *otherchr); +void botSetTarget(struct chrdata *chr, s32 propnum); +bool botIsTargetInvisible(struct chrdata *botchr, struct chrdata *otherchr); bool botHasGround(struct chrdata *chr); void bot0f192a74(struct chrdata *chr); bool botPassesPeaceCheck(struct chrdata *botchr, struct chrdata *otherchr); bool botPassesCowardCheck(struct chrdata *botchr, struct chrdata *otherchr); -u32 bot0f192e90(void); +void botChooseGeneralTarget(struct chrdata *chr); void bot0f19369c(struct chrdata *chr, s32 arg1); s32 bot0f1937a4(struct chrdata *chr, s32 arg1); s32 botGetNumOpponentsInHill(struct chrdata *chr); diff --git a/src/include/types.h b/src/include/types.h index 5467af4bc..4b731ae9c 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -934,16 +934,16 @@ struct aibot { /*0x108*/ struct coord shotspeed; // "boost" when aibot is shot /*0x114*/ s32 unk114; /*0x118*/ u32 unk118; - /*0x11c*/ s32 unk11c; - /*0x120*/ s32 unk120; - /*0x124*/ s32 unk124; - /*0x128*/ s32 unk128; - /*0x12c*/ u32 unk12c; - /*0x130*/ s8 unk130[12]; - /*0x13c*/ f32 playerdistances[12]; - /*0x16c*/ u8 unk16c[12]; - /*0x178*/ s32 unk178[12]; - /*0x1a8*/ s16 unk1a8[12]; + /*0x11c*/ s32 targethotness; // ticks up when target onscreen, down when offscreen, always >= 0 + /*0x120*/ s32 targetlastseen60; + /*0x124*/ s32 lastseenanytarget60; + /*0x128*/ bool targetinsight; + /*0x12c*/ s32 queryplayernum; + /*0x130*/ s8 chrnumsbydistanceasc[12]; + /*0x13c*/ f32 chrdistances[12]; + /*0x16c*/ u8 chrsinsight[12]; + /*0x178*/ s32 chrslastseen60[12]; + /*0x1a8*/ s16 chrrooms[12]; /*0x1c0*/ f32 unk1c0; /*0x1c4*/ f32 unk1c4; /*0x1c8*/ f32 unk1c8; @@ -978,7 +978,15 @@ struct aibot { */ /*0x2c4*/ f32 unk2c4; - /*0x2c8*/ s32 unk2c8; + /** + * 120 when target is in sight + * 0 when target is not in sight + * Ticks down when target is in sight but cloaked + * + * Bot maintains target while cloak timer is active + */ + /*0x2c8*/ s32 targetcloaktimer60; + /*0x2cc*/ u32 unk2cc; /*0x2d0*/ u32 unk2d0; /*0x2d4*/ f32 unk2d4;