diff --git a/src/game/game_01b0a0.c b/src/game/game_01b0a0.c index 8c8d86a4f..b820fb8ee 100644 --- a/src/game/game_01b0a0.c +++ b/src/game/game_01b0a0.c @@ -696,7 +696,7 @@ glabel func0f01b160 /* f01b9a8: 9339cb78 */ lbu $t9,-0x3488($t9) /* f01b9ac: 5721000d */ bnel $t9,$at,.L0f01b9e4 /* f01b9b0: 920a0032 */ lbu $t2,0x32($s0) -/* f01b9b4: 0fc3f598 */ jal func0f0fd660 +/* f01b9b4: 0fc3f598 */ jal mpOpenPickTarget /* f01b9b8: 00000000 */ sll $zero,$zero,0x0 /* f01b9bc: 3c08800a */ lui $t0,0x800a /* f01b9c0: 8d0821b8 */ lw $t0,0x21b8($t0) diff --git a/src/game/game_0fd660.c b/src/game/game_0fd660.c index 533468a80..40f52c944 100644 --- a/src/game/game_0fd660.c +++ b/src/game/game_0fd660.c @@ -32,7 +32,7 @@ const u32 var7f1b2b20[] = {0x00010603}; const u32 var7f1b2b24[] = {0x04070502}; -void func0f0fd660(void) +void mpOpenPickTarget(void) { u32 prevplayernum = g_MpPlayerNum; @@ -273,7 +273,7 @@ glabel var7f1b2cd8 /* f0fd97c: 8f240000 */ lw $a0,0x0($t9) /* f0fd980: 8de5001c */ lw $a1,0x1c($t7) /* f0fd984: afa6004c */ sw $a2,0x4c($sp) -/* f0fd988: 0fc6490e */ jal func0f192438 +/* f0fd988: 0fc6490e */ jal mpAibotApplyAttack /* f0fd98c: afa20098 */ sw $v0,0x98($sp) /* f0fd990: 3c0b800a */ lui $t3,%hi(g_Vars) /* f0fd994: 256b9fc0 */ addiu $t3,$t3,%lo(g_Vars) @@ -288,7 +288,7 @@ glabel var7f1b2cd8 /* f0fd9b8: 10000003 */ beqz $zero,.L0f0fd9c8 /* f0fd9bc: 00000000 */ sll $zero,$zero,0x0 .L0f0fd9c0: -/* f0fd9c0: 0fc6490e */ jal func0f192438 +/* f0fd9c0: 0fc6490e */ jal mpAibotApplyAttack /* f0fd9c4: 8c65001c */ lw $a1,0x1c($v1) .L0f0fd9c8: /* f0fd9c8: 0fc3cdb7 */ jal menuPopDialog @@ -652,10 +652,10 @@ void activemenuApply(s32 slot) } else if (g_Vars.normmplayerisrunning) { if (g_ActiveMenuThings[g_ActiveMenuIndex].allbots) { for (i = 0; i < g_Vars.currentplayer->numaibuddies; i++) { - func0f197af4(g_MpPlayerChrs[g_Vars.currentplayer->aibuddynums[i]], g_ActiveMenuMpBotCommands[slot]); + mpAibotApplyCommand(g_MpPlayerChrs[g_Vars.currentplayer->aibuddynums[i]], g_ActiveMenuMpBotCommands[slot]); } } else { - func0f197af4(g_MpPlayerChrs[g_Vars.currentplayer->aibuddynums[g_ActiveMenuThings[g_ActiveMenuIndex].screenindex - 2]], g_ActiveMenuMpBotCommands[slot]); + mpAibotApplyCommand(g_MpPlayerChrs[g_Vars.currentplayer->aibuddynums[g_ActiveMenuThings[g_ActiveMenuIndex].screenindex - 2]], g_ActiveMenuMpBotCommands[slot]); } } } diff --git a/src/game/game_190260.c b/src/game/game_190260.c index 958b5b99a..0819d7b8b 100644 --- a/src/game/game_190260.c +++ b/src/game/game_190260.c @@ -2443,52 +2443,52 @@ char *mpGetBotCommandName(s32 command) return langGet(g_MpBotCommands[command]); } -void func0f192438(struct chrdata *chr, struct prop *prop) +void mpAibotApplyAttack(struct chrdata *chr, struct prop *prop) { - chr->unk2d4->unk079 = 1; - chr->unk2d4->unk0c0_propindex = prop - g_Vars.props; + chr->unk2d4->command = AIBOTCMD_ATTACK; + chr->unk2d4->attackpropnum = prop - g_Vars.props; chr->unk2d4->unk0d8 = 1; } -void func0f192474(struct chrdata *chr, struct prop *prop) +void mpAibotApplyFollow(struct chrdata *chr, struct prop *prop) { - chr->unk2d4->unk079 = 0; - chr->unk2d4->unk0d4_propindex = prop - g_Vars.props; + chr->unk2d4->command = AIBOTCMD_FOLLOW; + chr->unk2d4->followprotectpropnum = prop - g_Vars.props; chr->unk2d4->unk0d8 = 1; } -void func0f1924ac(struct chrdata *chr, struct prop *prop) +void mpAibotApplyProtect(struct chrdata *chr, struct prop *prop) { - chr->unk2d4->unk079 = 13; - chr->unk2d4->unk0d4_propindex = prop - g_Vars.props; + chr->unk2d4->command = AIBOTCMD_PROTECT; + chr->unk2d4->followprotectpropnum = prop - g_Vars.props; chr->unk2d4->unk0d8 = 1; } -void func0f1924e8(struct chrdata *chr, struct coord *pos, s16 *room, f32 arg3) +void mpAibotApplyDefend(struct chrdata *chr, struct coord *pos, s16 *room, f32 arg3) { - chr->unk2d4->unk079 = 2; - chr->unk2d4->unk08c.x = pos->x; - chr->unk2d4->unk08c.y = pos->y; - chr->unk2d4->unk08c.z = pos->z; + chr->unk2d4->command = AIBOTCMD_DEFEND; + chr->unk2d4->defendholdpos.x = pos->x; + chr->unk2d4->defendholdpos.y = pos->y; + chr->unk2d4->defendholdpos.z = pos->z; func0f0657a4(room, &chr->unk2d4->rooms[0]); chr->unk2d4->unk098 = arg3; chr->unk2d4->unk0d8 = 1; } -void func0f19257c(struct chrdata *chr, struct coord *pos, s16 *room, f32 arg3) +void mpAibotApplyHold(struct chrdata *chr, struct coord *pos, s16 *room, f32 arg3) { - chr->unk2d4->unk079 = 3; - chr->unk2d4->unk08c.x = pos->x; - chr->unk2d4->unk08c.y = pos->y; - chr->unk2d4->unk08c.z = pos->z; + chr->unk2d4->command = AIBOTCMD_HOLD; + chr->unk2d4->defendholdpos.x = pos->x; + chr->unk2d4->defendholdpos.y = pos->y; + chr->unk2d4->defendholdpos.z = pos->z; func0f0657a4(room, &chr->unk2d4->rooms[0]); chr->unk2d4->unk098 = arg3; chr->unk2d4->unk0d8 = 1; } -void func0f192610(struct chrdata *chr, s32 arg1) +void mpAibotApplyScenarioCommand(struct chrdata *chr, u32 command) { - chr->unk2d4->unk079 = arg1; + chr->unk2d4->command = command; chr->unk2d4->unk0d8 = 1; } @@ -3709,7 +3709,7 @@ glabel func0f1937a4 /* f193814: 852a0028 */ lh $t2,0x28($t1) /* f193818: 554b000e */ bnel $t2,$t3,.L0f193854 /* f19381c: 03c02025 */ or $a0,$s8,$zero -/* f193820: 0fc65241 */ jal mpGetNumTeammatesInRoomDoingSomething +/* f193820: 0fc65241 */ jal mpGetNumTeammatesDefendingHill /* f193824: 00000000 */ sll $zero,$zero,0x0 /* f193828: 00408025 */ or $s0,$v0,$zero /* f19382c: 0fc65264 */ jal func0f194990 @@ -4753,7 +4753,7 @@ s32 mpGetNumPlayerTeammates(struct chrdata *chr) return count; } -s32 func0f194724(struct chrdata *self, s32 arg1, bool includeself) +s32 mpCountAibotsWithCommand(struct chrdata *self, u32 command, bool includeself) { s32 count = 0; s32 i; @@ -4761,7 +4761,7 @@ s32 func0f194724(struct chrdata *self, s32 arg1, bool includeself) for (i = PLAYERCOUNT(); i < g_MpNumPlayers; i++) { if (self->team == g_MpPlayerChrs[i]->team) { if (includeself || self != g_MpPlayerChrs[i]) { - if (arg1 == g_MpPlayerChrs[i]->unk2d4->unk079) { + if (command == g_MpPlayerChrs[i]->unk2d4->command) { count++; } } @@ -4790,14 +4790,14 @@ bool func0f19489c(struct chrdata *chr) return false; } -s32 mpGetNumTeammatesInRoomDoingSomething(struct chrdata *bot) +s32 mpGetNumTeammatesDefendingHill(struct chrdata *bot) { s32 count = 0; s32 i; for (i = 0; i < g_MpNumPlayers; i++) { if (bot->team == g_MpPlayerChrs[i]->team && g_MpPlayerChrs[i]->prop->rooms[0] == g_ScenarioData.cbt.unk0e[0]) { - if (g_MpPlayerChrs[i]->unk2d4->unk079 == 9 || g_MpPlayerChrs[i]->unk2d4->unk079 == 10) { + if (g_MpPlayerChrs[i]->unk2d4->command == AIBOTCMD_DEFHILL || g_MpPlayerChrs[i]->unk2d4->command == AIBOTCMD_HOLDHILL) { count++; } } @@ -5298,7 +5298,7 @@ glabel func0f194b40 /* f19507c: 16e3001e */ bne $s7,$v1,.L0f1950f8 /* f195080: 24010002 */ addiu $at,$zero,0x2 /* f195084: 2405000b */ addiu $a1,$zero,0xb -/* f195088: 0fc651c9 */ jal func0f194724 +/* f195088: 0fc651c9 */ jal mpCountAibotsWithCommand /* f19508c: 00003025 */ or $a2,$zero,$zero /* f195090: 18400010 */ blez $v0,.L0f1950d4 /* f195094: 266c0001 */ addiu $t4,$s3,0x1 @@ -5321,12 +5321,12 @@ glabel func0f194b40 .L0f1950d4: /* f1950d4: 02802025 */ or $a0,$s4,$zero .L0f1950d8: -/* f1950d8: 0fc64984 */ jal func0f192610 +/* f1950d8: 0fc64984 */ jal mpAibotApplyScenarioCommand /* f1950dc: 2405000b */ addiu $a1,$zero,0xb /* f1950e0: 10000111 */ beqz $zero,.L0f195528 /* f1950e4: 00000000 */ sll $zero,$zero,0x0 .L0f1950e8: -/* f1950e8: 0fc64984 */ jal func0f192610 +/* f1950e8: 0fc64984 */ jal mpAibotApplyScenarioCommand /* f1950ec: 24050004 */ addiu $a1,$zero,0x4 /* f1950f0: 1000010d */ beqz $zero,.L0f195528 /* f1950f4: 00000000 */ sll $zero,$zero,0x0 @@ -5334,7 +5334,7 @@ glabel func0f194b40 /* f1950f8: 14610022 */ bne $v1,$at,.L0f195184 /* f1950fc: 02802025 */ or $a0,$s4,$zero /* f195100: 24050005 */ addiu $a1,$zero,0x5 -/* f195104: 0fc651c9 */ jal func0f194724 +/* f195104: 0fc651c9 */ jal mpCountAibotsWithCommand /* f195108: 00003025 */ or $a2,$zero,$zero /* f19510c: 8e58004c */ lw $t8,0x4c($s2) /* f195110: 00184940 */ sll $t1,$t8,0x5 @@ -5361,12 +5361,12 @@ glabel func0f194b40 .L0f195160: /* f195160: 02802025 */ or $a0,$s4,$zero .L0f195164: -/* f195164: 0fc64984 */ jal func0f192610 +/* f195164: 0fc64984 */ jal mpAibotApplyScenarioCommand /* f195168: 24050005 */ addiu $a1,$zero,0x5 /* f19516c: 100000ee */ beqz $zero,.L0f195528 /* f195170: 00000000 */ sll $zero,$zero,0x0 .L0f195174: -/* f195174: 0fc64984 */ jal func0f192610 +/* f195174: 0fc64984 */ jal mpAibotApplyScenarioCommand /* f195178: 24050004 */ addiu $a1,$zero,0x4 /* f19517c: 100000ea */ beqz $zero,.L0f195528 /* f195180: 00000000 */ sll $zero,$zero,0x0 @@ -5375,7 +5375,7 @@ glabel func0f194b40 /* f195188: 1461001e */ bne $v1,$at,.L0f195204 /* f19518c: 02802025 */ or $a0,$s4,$zero /* f195190: 2405000c */ addiu $a1,$zero,0xc -/* f195194: 0fc651c9 */ jal func0f194724 +/* f195194: 0fc651c9 */ jal mpCountAibotsWithCommand /* f195198: 00003025 */ or $a2,$zero,$zero /* f19519c: 18400010 */ blez $v0,.L0f1951e0 /* f1951a0: 266c0001 */ addiu $t4,$s3,0x1 @@ -5398,12 +5398,12 @@ glabel func0f194b40 .L0f1951e0: /* f1951e0: 02802025 */ or $a0,$s4,$zero .L0f1951e4: -/* f1951e4: 0fc64984 */ jal func0f192610 +/* f1951e4: 0fc64984 */ jal mpAibotApplyScenarioCommand /* f1951e8: 2405000c */ addiu $a1,$zero,0xc /* f1951ec: 100000ce */ beqz $zero,.L0f195528 /* f1951f0: 00000000 */ sll $zero,$zero,0x0 .L0f1951f4: -/* f1951f4: 0fc64984 */ jal func0f192610 +/* f1951f4: 0fc64984 */ jal mpAibotApplyScenarioCommand /* f1951f8: 24050004 */ addiu $a1,$zero,0x4 /* f1951fc: 100000ca */ beqz $zero,.L0f195528 /* f195200: 00000000 */ sll $zero,$zero,0x0 @@ -5411,7 +5411,7 @@ glabel func0f194b40 /* f195204: 24010004 */ addiu $at,$zero,0x4 /* f195208: 54610034 */ bnel $v1,$at,.L0f1952dc /* f19520c: 24010005 */ addiu $at,$zero,0x5 -/* f195210: 0fc65241 */ jal mpGetNumTeammatesInRoomDoingSomething +/* f195210: 0fc65241 */ jal mpGetNumTeammatesDefendingHill /* f195214: 02802025 */ or $a0,$s4,$zero /* f195218: 8e98001c */ lw $t8,0x1c($s4) /* f19521c: 3c09800b */ lui $t1,0x800b @@ -5434,7 +5434,7 @@ glabel func0f194b40 /* f195258: 10200005 */ beqz $at,.L0f195270 /* f19525c: 00000000 */ sll $zero,$zero,0x0 .L0f195260: -/* f195260: 0fc64984 */ jal func0f192610 +/* f195260: 0fc64984 */ jal mpAibotApplyScenarioCommand /* f195264: 2405000a */ addiu $a1,$zero,0xa /* f195268: 100000af */ beqz $zero,.L0f195528 /* f19526c: 00000000 */ sll $zero,$zero,0x0 @@ -5453,17 +5453,17 @@ glabel func0f194b40 /* f19529c: 10200006 */ beqz $at,.L0f1952b8 /* f1952a0: 02802025 */ or $a0,$s4,$zero /* f1952a4: 02802025 */ or $a0,$s4,$zero -/* f1952a8: 0fc64984 */ jal func0f192610 +/* f1952a8: 0fc64984 */ jal mpAibotApplyScenarioCommand /* f1952ac: 24050009 */ addiu $a1,$zero,0x9 /* f1952b0: 1000009d */ beqz $zero,.L0f195528 /* f1952b4: 00000000 */ sll $zero,$zero,0x0 .L0f1952b8: -/* f1952b8: 0fc64984 */ jal func0f192610 +/* f1952b8: 0fc64984 */ jal mpAibotApplyScenarioCommand /* f1952bc: 24050004 */ addiu $a1,$zero,0x4 /* f1952c0: 10000099 */ beqz $zero,.L0f195528 /* f1952c4: 00000000 */ sll $zero,$zero,0x0 .L0f1952c8: -/* f1952c8: 0fc64984 */ jal func0f192610 +/* f1952c8: 0fc64984 */ jal mpAibotApplyScenarioCommand /* f1952cc: 2405000a */ addiu $a1,$zero,0xa /* f1952d0: 10000095 */ beqz $zero,.L0f195528 /* f1952d4: 00000000 */ sll $zero,$zero,0x0 @@ -5475,14 +5475,14 @@ glabel func0f194b40 /* f1952e8: 02802025 */ or $a0,$s4,$zero /* f1952ec: 02802025 */ or $a0,$s4,$zero /* f1952f0: 24050006 */ addiu $a1,$zero,0x6 -/* f1952f4: 0fc651c9 */ jal func0f194724 +/* f1952f4: 0fc651c9 */ jal mpCountAibotsWithCommand /* f1952f8: 02e03025 */ or $a2,$s7,$zero /* f1952fc: 00408025 */ or $s0,$v0,$zero /* f195300: 0fc65227 */ jal func0f19489c /* f195304: 02802025 */ or $a0,$s4,$zero /* f195308: 10400005 */ beqz $v0,.L0f195320 /* f19530c: 02802025 */ or $a0,$s4,$zero -/* f195310: 0fc64984 */ jal func0f192610 +/* f195310: 0fc64984 */ jal mpAibotApplyScenarioCommand /* f195314: 24050006 */ addiu $a1,$zero,0x6 /* f195318: 10000083 */ beqz $zero,.L0f195528 /* f19531c: 00000000 */ sll $zero,$zero,0x0 @@ -5500,12 +5500,12 @@ glabel func0f194b40 /* f195348: 10200006 */ beqz $at,.L0f195364 /* f19534c: 02802025 */ or $a0,$s4,$zero /* f195350: 02802025 */ or $a0,$s4,$zero -/* f195354: 0fc64984 */ jal func0f192610 +/* f195354: 0fc64984 */ jal mpAibotApplyScenarioCommand /* f195358: 24050006 */ addiu $a1,$zero,0x6 /* f19535c: 10000072 */ beqz $zero,.L0f195528 /* f195360: 00000000 */ sll $zero,$zero,0x0 .L0f195364: -/* f195364: 0fc64984 */ jal func0f192610 +/* f195364: 0fc64984 */ jal mpAibotApplyScenarioCommand /* f195368: 24050008 */ addiu $a1,$zero,0x8 /* f19536c: 1000006e */ beqz $zero,.L0f195528 /* f195370: 00000000 */ sll $zero,$zero,0x0 @@ -5521,30 +5521,30 @@ glabel func0f194b40 /* f195394: 1e000005 */ bgtz $s0,.L0f1953ac /* f195398: 24050008 */ addiu $a1,$zero,0x8 .L0f19539c: -/* f19539c: 0fc64984 */ jal func0f192610 +/* f19539c: 0fc64984 */ jal mpAibotApplyScenarioCommand /* f1953a0: 24050006 */ addiu $a1,$zero,0x6 /* f1953a4: 10000060 */ beqz $zero,.L0f195528 /* f1953a8: 00000000 */ sll $zero,$zero,0x0 .L0f1953ac: -/* f1953ac: 0fc64984 */ jal func0f192610 +/* f1953ac: 0fc64984 */ jal mpAibotApplyScenarioCommand /* f1953b0: 02802025 */ or $a0,$s4,$zero /* f1953b4: 1000005c */ beqz $zero,.L0f195528 /* f1953b8: 00000000 */ sll $zero,$zero,0x0 .L0f1953bc: /* f1953bc: 24050006 */ addiu $a1,$zero,0x6 -/* f1953c0: 0fc651c9 */ jal func0f194724 +/* f1953c0: 0fc651c9 */ jal mpCountAibotsWithCommand /* f1953c4: 00003025 */ or $a2,$zero,$zero /* f1953c8: 00408825 */ or $s1,$v0,$zero /* f1953cc: 02802025 */ or $a0,$s4,$zero /* f1953d0: 24050008 */ addiu $a1,$zero,0x8 -/* f1953d4: 0fc651c9 */ jal func0f194724 +/* f1953d4: 0fc651c9 */ jal mpCountAibotsWithCommand /* f1953d8: 00003025 */ or $a2,$zero,$zero /* f1953dc: 00408025 */ or $s0,$v0,$zero /* f1953e0: 0fc65227 */ jal func0f19489c /* f1953e4: 02802025 */ or $a0,$s4,$zero /* f1953e8: 10400005 */ beqz $v0,.L0f195400 /* f1953ec: 02802025 */ or $a0,$s4,$zero -/* f1953f0: 0fc64984 */ jal func0f192610 +/* f1953f0: 0fc64984 */ jal mpAibotApplyScenarioCommand /* f1953f4: 24050006 */ addiu $a1,$zero,0x6 /* f1953f8: 1000004b */ beqz $zero,.L0f195528 /* f1953fc: 00000000 */ sll $zero,$zero,0x0 @@ -5565,12 +5565,12 @@ glabel func0f194b40 /* f195434: 02802025 */ or $a0,$s4,$zero /* f195438: 02802025 */ or $a0,$s4,$zero .L0f19543c: -/* f19543c: 0fc64984 */ jal func0f192610 +/* f19543c: 0fc64984 */ jal mpAibotApplyScenarioCommand /* f195440: 24050008 */ addiu $a1,$zero,0x8 /* f195444: 10000038 */ beqz $zero,.L0f195528 /* f195448: 00000000 */ sll $zero,$zero,0x0 .L0f19544c: -/* f19544c: 0fc64984 */ jal func0f192610 +/* f19544c: 0fc64984 */ jal mpAibotApplyScenarioCommand /* f195450: 24050006 */ addiu $a1,$zero,0x6 /* f195454: 10000034 */ beqz $zero,.L0f195528 /* f195458: 00000000 */ sll $zero,$zero,0x0 @@ -5583,7 +5583,7 @@ glabel func0f194b40 /* f195470: 10200005 */ beqz $at,.L0f195488 .L0f195474: /* f195474: 02802025 */ or $a0,$s4,$zero -/* f195478: 0fc64984 */ jal func0f192610 +/* f195478: 0fc64984 */ jal mpAibotApplyScenarioCommand /* f19547c: 24050006 */ addiu $a1,$zero,0x6 /* f195480: 10000029 */ beqz $zero,.L0f195528 /* f195484: 00000000 */ sll $zero,$zero,0x0 @@ -5599,7 +5599,7 @@ glabel func0f194b40 /* f1954a4: 10200005 */ beqz $at,.L0f1954bc /* f1954a8: 00000000 */ sll $zero,$zero,0x0 .L0f1954ac: -/* f1954ac: 0fc64984 */ jal func0f192610 +/* f1954ac: 0fc64984 */ jal mpAibotApplyScenarioCommand /* f1954b0: 24050008 */ addiu $a1,$zero,0x8 /* f1954b4: 1000001c */ beqz $zero,.L0f195528 /* f1954b8: 00000000 */ sll $zero,$zero,0x0 @@ -5612,7 +5612,7 @@ glabel func0f194b40 /* f1954d0: 2f21001e */ sltiu $at,$t9,0x1e /* f1954d4: 10200005 */ beqz $at,.L0f1954ec /* f1954d8: 02802025 */ or $a0,$s4,$zero -/* f1954dc: 0fc64984 */ jal func0f192610 +/* f1954dc: 0fc64984 */ jal mpAibotApplyScenarioCommand /* f1954e0: 24050006 */ addiu $a1,$zero,0x6 /* f1954e4: 10000010 */ beqz $zero,.L0f195528 /* f1954e8: 00000000 */ sll $zero,$zero,0x0 @@ -5626,12 +5626,12 @@ glabel func0f194b40 /* f195504: 10200006 */ beqz $at,.L0f195520 /* f195508: 02802025 */ or $a0,$s4,$zero /* f19550c: 02802025 */ or $a0,$s4,$zero -/* f195510: 0fc64984 */ jal func0f192610 +/* f195510: 0fc64984 */ jal mpAibotApplyScenarioCommand /* f195514: 24050008 */ addiu $a1,$zero,0x8 /* f195518: 10000003 */ beqz $zero,.L0f195528 /* f19551c: 00000000 */ sll $zero,$zero,0x0 .L0f195520: -/* f195520: 0fc64984 */ jal func0f192610 +/* f195520: 0fc64984 */ jal mpAibotApplyScenarioCommand /* f195524: 24050004 */ addiu $a1,$zero,0x4 .L0f195528: /* f195528: 0c004b70 */ jal random diff --git a/src/game/game_197600.c b/src/game/game_197600.c index b3758b8d2..80e56ce43 100644 --- a/src/game/game_197600.c +++ b/src/game/game_197600.c @@ -23,56 +23,6 @@ const u32 var7f1b8fd0[] = {0x48742400}; const u32 var7f1b8fd4[] = {0x3eb33333}; -const u32 var7f1b8fd8[] = {0x7f197b34}; -const u32 var7f1b8fdc[] = {0x7f197b24}; -const u32 var7f1b8fe0[] = {0x7f197b6c}; -const u32 var7f1b8fe4[] = {0x7f197ba8}; -const u32 var7f1b8fe8[] = {0x7f197be4}; -const u32 var7f1b8fec[] = {0x7f197be4}; -const u32 var7f1b8ff0[] = {0x7f197be4}; -const u32 var7f1b8ff4[] = {0x7f197be4}; -const u32 var7f1b8ff8[] = {0x7f197be4}; -const u32 var7f1b8ffc[] = {0x7f197be4}; -const u32 var7f1b9000[] = {0x7f197be4}; -const u32 var7f1b9004[] = {0x7f197be4}; -const u32 var7f1b9008[] = {0x7f197be4}; -const u32 var7f1b900c[] = {0x7f197b50}; -const u32 var7f1b9010[] = {0x7f198508}; -const u32 var7f1b9014[] = {0x7f198570}; -const u32 var7f1b9018[] = {0x7f198588}; -const u32 var7f1b901c[] = {0x7f1985a0}; -const u32 var7f1b9020[] = {0x7f1985b8}; -const u32 var7f1b9024[] = {0x7f198bd8}; -const u32 var7f1b9028[] = {0x7f1985dc}; -const u32 var7f1b902c[] = {0x7f198644}; -const u32 var7f1b9030[] = {0x7f19865c}; -const u32 var7f1b9034[] = {0x7f198bd8}; -const u32 var7f1b9038[] = {0x7f198674}; -const u32 var7f1b903c[] = {0x7f198698}; -const u32 var7f1b9040[] = {0x7f1986bc}; -const u32 var7f1b9044[] = {0x7f198730}; -const u32 var7f1b9048[] = {0x7f198748}; -const u32 var7f1b904c[] = {0x7f198bd8}; -const u32 var7f1b9050[] = {0x7f198bd8}; -const u32 var7f1b9054[] = {0x7f198760}; -const u32 var7f1b9058[] = {0x7f198794}; -const u32 var7f1b905c[] = {0x7f1987b8}; -const u32 var7f1b9060[] = {0x7f198bd8}; -const u32 var7f1b9064[] = {0x7f198bd8}; -const u32 var7f1b9068[] = {0x7f1987d0}; -const u32 var7f1b906c[] = {0x7f1987e8}; -const u32 var7f1b9070[] = {0x7f19880c}; -const u32 var7f1b9074[] = {0x7f198960}; -const u32 var7f1b9078[] = {0x7f198978}; -const u32 var7f1b907c[] = {0x7f198a04}; -const u32 var7f1b9080[] = {0x7f198bd8}; -const u32 var7f1b9084[] = {0x7f198bd8}; -const u32 var7f1b9088[] = {0x7f198ba0}; -const u32 var7f1b908c[] = {0x3991a2b4}; -const u32 var7f1b9090[] = {0x3f666666}; -const u32 var7f1b9094[] = {0x44bb8000}; -const u32 var7f1b9098[] = {0x00000000}; -const u32 var7f1b909c[] = {0x00000000}; GLOBAL_ASM( glabel func0f197600 @@ -428,78 +378,33 @@ glabel func0f197600 /* f197af0: 00000000 */ sll $zero,$zero,0x0 ); -GLOBAL_ASM( -glabel func0f197af4 -/* f197af4: 27bdffe0 */ addiu $sp,$sp,-32 -/* f197af8: afb00018 */ sw $s0,0x18($sp) -/* f197afc: 2ca1000e */ sltiu $at,$a1,0xe -/* f197b00: 00808025 */ or $s0,$a0,$zero -/* f197b04: 10200037 */ beqz $at,.L0f197be4 -/* f197b08: afbf001c */ sw $ra,0x1c($sp) -/* f197b0c: 00057080 */ sll $t6,$a1,0x2 -/* f197b10: 3c017f1c */ lui $at,%hi(var7f1b8fd8) -/* f197b14: 002e0821 */ addu $at,$at,$t6 -/* f197b18: 8c2e8fd8 */ lw $t6,%lo(var7f1b8fd8)($at) -/* f197b1c: 01c00008 */ jr $t6 -/* f197b20: 00000000 */ sll $zero,$zero,0x0 -/* f197b24: 0fc3f598 */ jal func0f0fd660 -/* f197b28: 00000000 */ sll $zero,$zero,0x0 -/* f197b2c: 10000030 */ beqz $zero,.L0f197bf0 -/* f197b30: 8fbf001c */ lw $ra,0x1c($sp) -/* f197b34: 3c0f800a */ lui $t7,0x800a -/* f197b38: 8defa244 */ lw $t7,-0x5dbc($t7) -/* f197b3c: 02002025 */ or $a0,$s0,$zero -/* f197b40: 0fc6491d */ jal func0f192474 -/* f197b44: 8de500bc */ lw $a1,0xbc($t7) -/* f197b48: 10000029 */ beqz $zero,.L0f197bf0 -/* f197b4c: 8fbf001c */ lw $ra,0x1c($sp) -/* f197b50: 3c18800a */ lui $t8,0x800a -/* f197b54: 8f18a244 */ lw $t8,-0x5dbc($t8) -/* f197b58: 02002025 */ or $a0,$s0,$zero -/* f197b5c: 0fc6492b */ jal func0f1924ac -/* f197b60: 8f0500bc */ lw $a1,0xbc($t8) -/* f197b64: 10000022 */ beqz $zero,.L0f197bf0 -/* f197b68: 8fbf001c */ lw $ra,0x1c($sp) -/* f197b6c: 3c19800a */ lui $t9,0x800a -/* f197b70: 8f39a244 */ lw $t9,-0x5dbc($t9) -/* f197b74: 8f2800bc */ lw $t0,0xbc($t9) -/* f197b78: 0fc0f917 */ jal func0f03e45c -/* f197b7c: 8d040004 */ lw $a0,0x4($t0) -/* f197b80: 3c09800a */ lui $t1,0x800a -/* f197b84: 8d29a244 */ lw $t1,-0x5dbc($t1) -/* f197b88: 44070000 */ mfc1 $a3,$f0 -/* f197b8c: 02002025 */ or $a0,$s0,$zero -/* f197b90: 8d2200bc */ lw $v0,0xbc($t1) -/* f197b94: 24450008 */ addiu $a1,$v0,0x8 -/* f197b98: 0fc6493a */ jal func0f1924e8 -/* f197b9c: 24460028 */ addiu $a2,$v0,0x28 -/* f197ba0: 10000013 */ beqz $zero,.L0f197bf0 -/* f197ba4: 8fbf001c */ lw $ra,0x1c($sp) -/* f197ba8: 3c0a800a */ lui $t2,0x800a -/* f197bac: 8d4aa244 */ lw $t2,-0x5dbc($t2) -/* f197bb0: 8d4b00bc */ lw $t3,0xbc($t2) -/* f197bb4: 0fc0f917 */ jal func0f03e45c -/* f197bb8: 8d640004 */ lw $a0,0x4($t3) -/* f197bbc: 3c0c800a */ lui $t4,0x800a -/* f197bc0: 8d8ca244 */ lw $t4,-0x5dbc($t4) -/* f197bc4: 44070000 */ mfc1 $a3,$f0 -/* f197bc8: 02002025 */ or $a0,$s0,$zero -/* f197bcc: 8d8200bc */ lw $v0,0xbc($t4) -/* f197bd0: 24450008 */ addiu $a1,$v0,0x8 -/* f197bd4: 0fc6495f */ jal func0f19257c -/* f197bd8: 24460028 */ addiu $a2,$v0,0x28 -/* f197bdc: 10000004 */ beqz $zero,.L0f197bf0 -/* f197be0: 8fbf001c */ lw $ra,0x1c($sp) -.L0f197be4: -/* f197be4: 0fc64984 */ jal func0f192610 -/* f197be8: 02002025 */ or $a0,$s0,$zero -/* f197bec: 8fbf001c */ lw $ra,0x1c($sp) -.L0f197bf0: -/* f197bf0: 8fb00018 */ lw $s0,0x18($sp) -/* f197bf4: 27bd0020 */ addiu $sp,$sp,0x20 -/* f197bf8: 03e00008 */ jr $ra -/* f197bfc: 00000000 */ sll $zero,$zero,0x0 -); +void mpAibotApplyCommand(struct chrdata *chr, u32 command) +{ + f32 value; + + switch (command) { + case AIBOTCMD_ATTACK: + mpOpenPickTarget(); + break; + case AIBOTCMD_FOLLOW: + mpAibotApplyFollow(chr, g_Vars.currentplayer->prop); + break; + case AIBOTCMD_PROTECT: + mpAibotApplyProtect(chr, g_Vars.currentplayer->prop); + break; + case AIBOTCMD_DEFEND: + value = func0f03e45c(g_Vars.currentplayer->prop->chr); + mpAibotApplyDefend(chr, &g_Vars.currentplayer->prop->pos, g_Vars.currentplayer->prop->rooms, value); + break; + case AIBOTCMD_HOLD: + value = func0f03e45c(g_Vars.currentplayer->prop->chr); + mpAibotApplyHold(chr, &g_Vars.currentplayer->prop->pos, g_Vars.currentplayer->prop->rooms, value); + break; + default: + mpAibotApplyScenarioCommand(chr, command); + break; + } +} GLOBAL_ASM( glabel func0f197c00 @@ -1071,6 +976,72 @@ glabel func0f1982d4 GLOBAL_ASM( glabel func0f198338 +.late_rodata +glabel var7f1b9010 +.word 0x7f198508 +glabel var7f1b9014 +.word 0x7f198570 +glabel var7f1b9018 +.word 0x7f198588 +glabel var7f1b901c +.word 0x7f1985a0 +glabel var7f1b9020 +.word 0x7f1985b8 +glabel var7f1b9024 +.word 0x7f198bd8 +glabel var7f1b9028 +.word 0x7f1985dc +glabel var7f1b902c +.word 0x7f198644 +glabel var7f1b9030 +.word 0x7f19865c +glabel var7f1b9034 +.word 0x7f198bd8 +glabel var7f1b9038 +.word 0x7f198674 +glabel var7f1b903c +.word 0x7f198698 +glabel var7f1b9040 +.word 0x7f1986bc +glabel var7f1b9044 +.word 0x7f198730 +glabel var7f1b9048 +.word 0x7f198748 +glabel var7f1b904c +.word 0x7f198bd8 +glabel var7f1b9050 +.word 0x7f198bd8 +glabel var7f1b9054 +.word 0x7f198760 +glabel var7f1b9058 +.word 0x7f198794 +glabel var7f1b905c +.word 0x7f1987b8 +glabel var7f1b9060 +.word 0x7f198bd8 +glabel var7f1b9064 +.word 0x7f198bd8 +glabel var7f1b9068 +.word 0x7f1987d0 +glabel var7f1b906c +.word 0x7f1987e8 +glabel var7f1b9070 +.word 0x7f19880c +glabel var7f1b9074 +.word 0x7f198960 +glabel var7f1b9078 +.word 0x7f198978 +glabel var7f1b907c +.word 0x7f198a04 +glabel var7f1b9080 +.word 0x7f198bd8 +glabel var7f1b9084 +.word 0x7f198bd8 +glabel var7f1b9088 +.word 0x7f198ba0 +glabel var7f1b908c +.word 0x3991a2b4 +.text /* f198338: 27bdffb0 */ addiu $sp,$sp,-80 /* f19833c: afbf0014 */ sw $ra,0x14($sp) /* f198340: afa40050 */ sw $a0,0x50($sp) @@ -1892,6 +1863,12 @@ glabel func0f198e78 GLOBAL_ASM( glabel func0f198eec +.late_rodata +glabel var7f1b9090 +.word 0x3f666666 +glabel var7f1b9094 +.word 0x44bb8000 +.text /* f198eec: 27bdff60 */ addiu $sp,$sp,-160 /* f198ef0: afb60040 */ sw $s6,0x40($sp) /* f198ef4: 240e0001 */ addiu $t6,$zero,0x1 diff --git a/src/include/constants.h b/src/include/constants.h index 0f69f61d1..6a091795e 100644 --- a/src/include/constants.h +++ b/src/include/constants.h @@ -53,6 +53,21 @@ #define ACT_PUNCH 36 #define ACT_CUTFIRE 37 +#define AIBOTCMD_FOLLOW 0 +#define AIBOTCMD_ATTACK 1 +#define AIBOTCMD_DEFEND 2 +#define AIBOTCMD_HOLD 3 +#define AIBOTCMD_NORMAL 4 +#define AIBOTCMD_DOWNLOAD 5 +#define AIBOTCMD_GETCASE 6 +#define AIBOTCMD_TAGBOX 7 +#define AIBOTCMD_SAVECASE 8 +#define AIBOTCMD_DEFHILL 9 +#define AIBOTCMD_HOLDHILL 10 +#define AIBOTCMD_GETCASE2 11 +#define AIBOTCMD_POPCAP 12 +#define AIBOTCMD_PROTECT 13 + #define AIMCONTROL_HOLD 0 #define AIMCONTROL_TOGGLE 1 diff --git a/src/include/game/game_0fd660.h b/src/include/game/game_0fd660.h index 2622b15f6..733c00010 100644 --- a/src/include/game/game_0fd660.h +++ b/src/include/game/game_0fd660.h @@ -3,7 +3,7 @@ #include #include "types.h" -void func0f0fd660(void); +void mpOpenPickTarget(void); void activemenuSetAiBuddyTemperament(bool aggressive); void activemenuSetAiBuddyStealth(void); s32 activemenuGetFirstBuddyIndex(void); diff --git a/src/include/game/game_190260.h b/src/include/game/game_190260.h index 135706a36..f73c387d7 100644 --- a/src/include/game/game_190260.h +++ b/src/include/game/game_190260.h @@ -33,22 +33,22 @@ s32 mpObjIsSafe(struct defaultobj *obj); u32 func0f1915b4(struct chrdata *chr); u8 func0f191600(struct chrdata *chr); char *mpGetBotCommandName(s32 command); -void func0f192438(struct chrdata *chr, struct prop *prop); -void func0f192474(struct chrdata *chr, struct prop *prop); -void func0f1924ac(struct chrdata *chr, struct prop *prop); -void func0f1924e8(struct chrdata *chr, struct coord *pos, s16 *room, f32 arg3); -void func0f19257c(struct chrdata *chr, struct coord *pos, s16 *room, f32 arg3); -void func0f192610(struct chrdata *chr, s32 arg1); +void mpAibotApplyAttack(struct chrdata *chr, struct prop *prop); +void mpAibotApplyFollow(struct chrdata *chr, struct prop *prop); +void mpAibotApplyProtect(struct chrdata *chr, struct prop *prop); +void mpAibotApplyDefend(struct chrdata *chr, struct coord *pos, s16 *room, f32 arg3); +void mpAibotApplyHold(struct chrdata *chr, struct coord *pos, s16 *room, f32 arg3); +void mpAibotApplyScenarioCommand(struct chrdata *chr, u32 arg1); bool mpIsChrFollowedByChr(struct chrdata *leader, struct chrdata *follower); s32 func0f193530(struct chrdata *chr, f32 arg1); bool func0f194670(struct chrdata *chr); s32 func0f194694(struct chrdata *chr); s32 func0f1946b4(struct chrdata *chr); s32 mpGetNumPlayerTeammates(struct chrdata *chr); -s32 func0f194724(struct chrdata *self, s32 arg1, bool includeself); +s32 mpCountAibotsWithCommand(struct chrdata *self, u32 command, bool includeself); s32 scenarioCtcIsChrsTokenHeld(struct chrdata *chr); bool func0f19489c(struct chrdata *chr); -s32 mpGetNumTeammatesInRoomDoingSomething(struct chrdata *bot); +s32 mpGetNumTeammatesDefendingHill(struct chrdata *bot); void func0f197544(struct chrdata *chr); #endif diff --git a/src/include/game/game_197600.h b/src/include/game/game_197600.h index e54ed1360..8afc7bbb4 100644 --- a/src/include/game/game_197600.h +++ b/src/include/game/game_197600.h @@ -4,7 +4,7 @@ #include "types.h" u32 func0f197600(void); -void func0f197af4(struct chrdata *chr, s32 aibotcommand); +void mpAibotApplyCommand(struct chrdata *chr, u32 command); void func0f197c00(struct chrdata *chr); u32 func0f197c70(void); u32 func0f197cf0(void); diff --git a/src/include/types.h b/src/include/types.h index ed8b02702..5b1a6d500 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -198,13 +198,13 @@ struct chr2d4 { /*0x076*/ s8 unk076; /*0x077*/ s8 unk077; /*0x078*/ u8 unk078; - /*0x079*/ u8 unk079; + /*0x079*/ u8 command; /*0x07a*/ s16 rooms[1]; /*0x07c*/ u32 unk07c; /*0x080*/ u32 unk080; /*0x084*/ u32 unk084; /*0x088*/ u32 unk088; - /*0x08c*/ struct coord unk08c; + /*0x08c*/ struct coord defendholdpos; /*0x098*/ f32 unk098; /*0x09c*/ u8 unk09c_00 : 1; /*0x09c*/ u8 unk09c_01 : 1; @@ -223,12 +223,12 @@ struct chr2d4 { /*0x0b4*/ f32 unk0b4; /*0x0b8*/ f32 unk0b8; /*0x0bc*/ s32 unk0bc; - /*0x0c0*/ s32 unk0c0_propindex; + /*0x0c0*/ s32 attackpropnum; /*0x0c4*/ u32 unk0c4; /*0x0c8*/ u32 unk0c8; /*0x0cc*/ u32 unk0cc; /*0x0d0*/ u32 unk0d0; - /*0x0d4*/ u32 unk0d4_propindex; + /*0x0d4*/ s32 followprotectpropnum; /*0x0d8*/ s32 unk0d8; /*0x0dc*/ u32 unk0dc; /*0x0e0*/ u16 unk0e0; @@ -4675,7 +4675,7 @@ struct scenariodata_cbt { u32 unk04; u32 unk08; u16 unk0c; - s16 unk0e[1]; // possibly for a different scenario - see mpGetNumTeammatesInRoomDoingSomething + s16 unk0e[1]; // possibly for a different scenario - see mpGetNumTeammatesDefendingHill }; struct scenariodata_htb {