Decompile aiIfCoopMode and fix typos in command docblocks

This commit is contained in:
Ryan Dwyer 2020-01-14 17:19:08 +10:00
parent b11011d807
commit 558f3c8943
4 changed files with 34 additions and 60 deletions

View File

@ -14426,52 +14426,17 @@ glabel ai01dd
/**
* @cmd 01de
*/
GLOBAL_ASM(
glabel ai01de
/* f060048: 3c03800a */ lui $v1,%hi(g_Vars)
/* f06004c: 24639fc0 */ addiu $v1,$v1,%lo(g_Vars)
/* f060050: 8c6e0318 */ lw $t6,0x318($v1)
/* f060054: 27bdffe8 */ addiu $sp,$sp,-24
/* f060058: afbf0014 */ sw $ra,0x14($sp)
/* f06005c: 15c0000d */ bnez $t6,.L0f060094
/* f060060: 3c0f800a */ lui $t7,0x800a
/* f060064: 81f8dfeb */ lb $t8,-0x2015($t7)
/* f060068: 0703000b */ bgezl $t8,.L0f060098
/* f06006c: 8c790438 */ lw $t9,0x438($v1)
/* f060070: 8c640434 */ lw $a0,0x434($v1)
/* f060074: 8c650438 */ lw $a1,0x438($v1)
/* f060078: 00851021 */ addu $v0,$a0,$a1
/* f06007c: 0fc13583 */ jal chraiGoToLabel
/* f060080: 90460002 */ lbu $a2,0x2($v0)
/* f060084: 3c03800a */ lui $v1,%hi(g_Vars)
/* f060088: 24639fc0 */ addiu $v1,$v1,%lo(g_Vars)
/* f06008c: 10000004 */ beqz $zero,.L0f0600a0
/* f060090: ac620438 */ sw $v0,0x438($v1)
.L0f060094:
/* f060094: 8c790438 */ lw $t9,0x438($v1)
.L0f060098:
/* f060098: 27280003 */ addiu $t0,$t9,0x3
/* f06009c: ac680438 */ sw $t0,0x438($v1)
.L0f0600a0:
/* f0600a0: 8fbf0014 */ lw $ra,0x14($sp)
/* f0600a4: 27bd0018 */ addiu $sp,$sp,0x18
/* f0600a8: 00001025 */ or $v0,$zero,$zero
/* f0600ac: 03e00008 */ jr $ra
/* f0600b0: 00000000 */ sll $zero,$zero,0x0
);
bool aiIfCoopMode(void)
{
if (g_Vars.unk000318 == 0 && g_MissionConfig.iscoop) {
u8 *cmd = g_Vars.ailist + g_Vars.aioffset;
g_Vars.aioffset = chraiGoToLabel(g_Vars.ailist, g_Vars.aioffset, cmd[2]);
} else {
g_Vars.aioffset += 3;
}
// Mismatch due to different temporary registers
//bool ai01de(void)
//{
// if (g_Vars.unk000318 == 0 && (s8)g_MissionConfig[3] < 0) {
// u8 *cmd = g_Vars.ailist + g_Vars.aioffset;
// g_Vars.aioffset = chraiGoToLabel(g_Vars.ailist, g_Vars.aioffset, cmd[2]);
// } else {
// g_Vars.aioffset += 3;
// }
//
// return false;
//}
return false;
}
/**
* @cmd 01e0

View File

@ -31,7 +31,7 @@
id,
/**
* Pauses the current script and yield execution back to the engine. At least
* Pauses the current script and yields execution back to the engine. At least
* one frame will pass before the script is continued.
*
* To prevent infinite loops this must be called at least once per loop. This is
@ -86,7 +86,7 @@
* You would typically set this to the same list as the current one so the chr
* continues doing what they were doing previously (eg. running to a target).
* The list will be restarted from the beginning. You may want to use
* if_just_injured near the top of the list so you detect then injury, make them
* if_just_injured near the top of the list so you detect the injury, make them
* say something and wait for their injury animation to finish before they
* continue their regular logic.
*/
@ -189,6 +189,11 @@
mkshort(0x0012), \
label,
/**
* Attempt to run and shoot. If it worked then go to the given label.
* The command may fail if the chr is blocked, or maybe if the chr can't see
* their target.
*/
#define try_run_and_shoot(label) \
mkshort(0x0013), \
label,
@ -615,7 +620,7 @@
label,
/**
* Checks if the chr had shot nearly hit them.
* Checks if the chr had a shot nearly hit them.
*/
#define if_near_miss(label) \
mkshort(0x004b), \
@ -975,7 +980,7 @@
* Checks if the given objective index is complete.
*
* This is not the same as the objective number. Objective indexes start from 0,
* and some objective indexes do not apply to higher difficulties.
* and some objective indexes do not apply to easier difficulties.
*/
#define if_objective_complete(objective, label) \
mkshort(0x0073), \
@ -986,7 +991,7 @@
* Checks if the given objective index is failed.
*
* This is not the same as the objective number. Objective indexes start from 0,
* and some objective indexes do not apply to higher difficulties.
* and some objective indexes do not apply to easier difficulties.
*/
#define if_objective_failed(objective, label) \
mkshort(0x0074), \
@ -1588,7 +1593,7 @@
*
* padpreset can be referenced via PAD_PRESET.
*/
#define chr_set_target_pad(pad) \
#define chr_set_target_pad(chr, pad) \
mkshort(0x00b3), \
chr, \
mkshort(pad),
@ -2102,7 +2107,7 @@
/**
* Checks if the player is invincible.
*
* Set set_invincible.
* See set_invincible.
*/
#define if_player_is_invincible(chr, label) \
mkshort(0x00f8), \
@ -2699,12 +2704,11 @@
object, \
0x00,
// Related to hovercopter and Infiltration interceptors
// Sets player struct's field_0x2e to 1/true.
// Sets the heli's 0x90 field to true.
#define cmd0143 \
mkshort(0x0143),
// Sets heli field 0x90
// Sets the heli's 0x90 field to false.
#define cmd0144 \
mkshort(0x0144), \
label,
@ -2896,8 +2900,8 @@
// If bool is false, run some function on the chr and their gun ground
// prop, then follow the label.
// If bool is true, don't call the function, and only follow the label if field
// 0x4 in the gun ground prop struct is less than 64.
// If bool is true, don't call the function, and only follow the label if the
// gun prop has OBJHIDDENFLAG_00000080.
#define if_gun_landed(bool, label) \
mkshort(0x0170), \
bool, \
@ -3724,7 +3728,12 @@
mkshort(distance / 10), \
label,
// Not sure about this
/**
* Checks if the game is being played in co-operative mode.
*
* This command does not check if the buddy is a human or bot. You can use
* if_num_human_players_lt for that.
*/
#define if_coop_mode(label) \
mkshort(0x01de), \
label,

View File

@ -441,7 +441,7 @@
/*0x01db*/ bool aiChrKill(void);
/*0x01dc*/ bool aiRemoveWeaponFromInventory(void);
/*0x01dd*/ bool ai01dd(void);
/*0x01de*/ bool ai01de(void);
/*0x01de*/ bool aiIfCoopMode(void);
/*0x01df*/ bool aiIfChrSameFloorDistanceToPadLessThan(void);
/*0x01e0*/ bool ai01e0(void);

View File

@ -14613,7 +14613,7 @@ bool (*g_CommandPointers[])(void) = {
/*0x01db*/ aiChrKill,
/*0x01dc*/ aiRemoveWeaponFromInventory,
/*0x01dd*/ ai01dd,
/*0x01de*/ ai01de,
/*0x01de*/ aiIfCoopMode,
/*0x01df*/ aiIfChrSameFloorDistanceToPadLessThan,
/*0x01e0*/ ai01e0,
};