Decompile aiIfRandomGreaterThan

This commit is contained in:
Ryan Dwyer 2019-10-08 19:44:44 +10:00
parent c56572e61f
commit 2bbbf77d0d
3 changed files with 15 additions and 52 deletions

View File

@ -1378,56 +1378,19 @@ bool aiIfRandomLessThan(void)
/**
* @cmd 0038
*/
GLOBAL_ASM(
glabel ai0038
/* f04f7c8: 3c03800a */ lui $v1,0x800a
/* f04f7cc: 24639fc0 */ addiu $v1,$v1,-24640
/* f04f7d0: 8c620424 */ lw $v0,0x424($v1)
/* f04f7d4: 8c640434 */ lw $a0,0x434($v1)
/* f04f7d8: 8c650438 */ lw $a1,0x438($v1)
/* f04f7dc: 27bdffe0 */ addiu $sp,$sp,-32
/* f04f7e0: afbf0014 */ sw $ra,0x14($sp)
/* f04f7e4: 10400006 */ beqz $v0,.L0f04f800
/* f04f7e8: 00853821 */ addu $a3,$a0,$a1
/* f04f7ec: 90ee0002 */ lbu $t6,0x2($a3)
/* f04f7f0: 904f0124 */ lbu $t7,0x124($v0)
/* f04f7f4: 01cf082a */ slt $at,$t6,$t7
/* f04f7f8: 14200010 */ bnez $at,.L0f04f83c
/* f04f7fc: 00000000 */ sll $zero,$zero,0x0
.L0f04f800:
/* f04f800: 8c780430 */ lw $t8,0x430($v1)
/* f04f804: 53000014 */ beqzl $t8,.L0f04f858
/* f04f808: 8c690438 */ lw $t1,0x438($v1)
/* f04f80c: 0c004b70 */ jal random
/* f04f810: afa7001c */ sw $a3,0x1c($sp)
/* f04f814: 8fa7001c */ lw $a3,0x1c($sp)
/* f04f818: 304800ff */ andi $t0,$v0,0xff
/* f04f81c: 3c03800a */ lui $v1,0x800a
/* f04f820: 90f90002 */ lbu $t9,0x2($a3)
/* f04f824: 24639fc0 */ addiu $v1,$v1,-24640
/* f04f828: 0328082a */ slt $at,$t9,$t0
/* f04f82c: 5020000a */ beqzl $at,.L0f04f858
/* f04f830: 8c690438 */ lw $t1,0x438($v1)
/* f04f834: 8c640434 */ lw $a0,0x434($v1)
/* f04f838: 8c650438 */ lw $a1,0x438($v1)
.L0f04f83c:
/* f04f83c: 0fc13583 */ jal chraiGoToLabel
/* f04f840: 90e60003 */ lbu $a2,0x3($a3)
/* f04f844: 3c03800a */ lui $v1,0x800a
/* f04f848: 24639fc0 */ addiu $v1,$v1,-24640
/* f04f84c: 10000004 */ beqz $zero,.L0f04f860
/* f04f850: ac620438 */ sw $v0,0x438($v1)
/* f04f854: 8c690438 */ lw $t1,0x438($v1)
.L0f04f858:
/* f04f858: 252a0004 */ addiu $t2,$t1,0x4
/* f04f85c: ac6a0438 */ sw $t2,0x438($v1)
.L0f04f860:
/* f04f860: 8fbf0014 */ lw $ra,0x14($sp)
/* f04f864: 27bd0020 */ addiu $sp,$sp,0x20
/* f04f868: 00001025 */ or $v0,$zero,$zero
/* f04f86c: 03e00008 */ jr $ra
/* f04f870: 00000000 */ sll $zero,$zero,0x0
);
bool aiIfRandomGreaterThan(void)
{
u8 *cmd = g_Vars.ailist + g_Vars.aioffset;
if ((g_Vars.chrdata && g_Vars.chrdata->random > cmd[2]) ||
(g_Vars.aiddata && (random() & 0xff) > cmd[2])) {
g_Vars.aioffset = chraiGoToLabel(g_Vars.ailist, g_Vars.aioffset, cmd[3]);
} else {
g_Vars.aioffset += 4;
}
return false;
}
/**
* @cmd 001d

View File

@ -59,7 +59,7 @@
/*0x0035*/ bool aiIfPlayerInSight(void);
/*0x0036*/ bool aiRandom(void);
/*0x0037*/ bool aiIfRandomLessThan(void);
/*0x0038*/ bool ai0038(void);
/*0x0038*/ bool aiIfRandomGreaterThan(void);
/*0x0039*/ bool aiIfAlarmActivate(void);
/*0x003a*/ bool ai003a(void);
/*0x003b*/ bool ai003b(void);

View File

@ -14005,7 +14005,7 @@ bool (*command_pointers[])(void) = {
/*0x0035*/ aiIfPlayerInSight,
/*0x0036*/ aiRandom,
/*0x0037*/ aiIfRandomLessThan,
/*0x0038*/ ai0038,
/*0x0038*/ aiIfRandomGreaterThan,
/*0x0039*/ aiIfAlarmActivate,
/*0x003a*/ ai003a,
/*0x003b*/ ai003b,