Decompile aiShufflePelagicSwitches

This commit is contained in:
Ryan Dwyer
2020-02-08 23:36:34 +10:00
parent f922cef7ea
commit 8999da484e
5 changed files with 39 additions and 88 deletions
+34 -82
View File
@@ -13230,88 +13230,40 @@ bool aiSetAutogunType(void)
/**
* @cmd 01b9
*/
GLOBAL_ASM(
glabel ai01b9
/* f05e990: 27bdffb0 */ addiu $sp,$sp,-80
/* f05e994: 3c0e8007 */ lui $t6,%hi(var80069860)
/* f05e998: afbf002c */ sw $ra,0x2c($sp)
/* f05e99c: afb40028 */ sw $s4,0x28($sp)
/* f05e9a0: afb30024 */ sw $s3,0x24($sp)
/* f05e9a4: afb20020 */ sw $s2,0x20($sp)
/* f05e9a8: afb1001c */ sw $s1,0x1c($sp)
/* f05e9ac: afb00018 */ sw $s0,0x18($sp)
/* f05e9b0: 25ce9860 */ addiu $t6,$t6,%lo(var80069860)
/* f05e9b4: 8dc10000 */ lw $at,0x0($t6)
/* f05e9b8: 27b00048 */ addiu $s0,$sp,0x48
/* f05e9bc: 24130008 */ addiu $s3,$zero,0x8
/* f05e9c0: ae010000 */ sw $at,0x0($s0)
/* f05e9c4: 8dd90004 */ lw $t9,0x4($t6)
/* f05e9c8: 24140001 */ addiu $s4,$zero,0x1
/* f05e9cc: 24040008 */ addiu $a0,$zero,0x8
/* f05e9d0: ae190004 */ sw $t9,0x4($s0)
.L0f05e9d4:
/* f05e9d4: 0fc2554a */ jal tagFindById
/* f05e9d8: 00000000 */ sll $zero,$zero,0x0
/* f05e9dc: 0c004b70 */ jal random
/* f05e9e0: 00409025 */ or $s2,$v0,$zero
/* f05e9e4: 30430007 */ andi $v1,$v0,0x7
/* f05e9e8: 306800ff */ andi $t0,$v1,0xff
/* f05e9ec: 02084821 */ addu $t1,$s0,$t0
/* f05e9f0: 912a0000 */ lbu $t2,0x0($t1)
/* f05e9f4: 307100ff */ andi $s1,$v1,0xff
/* f05e9f8: 93b80048 */ lbu $t8,0x48($sp)
/* f05e9fc: 1540000a */ bnez $t2,.L0f05ea28
/* f05ea00: 00000000 */ sll $zero,$zero,0x0
/* f05ea04: 0fc2554a */ jal tagFindById
/* f05ea08: 02202025 */ or $a0,$s1,$zero
/* f05ea0c: 844b0006 */ lh $t3,0x6($v0)
/* f05ea10: 02116821 */ addu $t5,$s0,$s1
/* f05ea14: a64b0006 */ sh $t3,0x6($s2)
/* f05ea18: 8c4c000c */ lw $t4,0xc($v0)
/* f05ea1c: ae4c000c */ sw $t4,0xc($s2)
/* f05ea20: 10000012 */ beqz $zero,.L0f05ea6c
/* f05ea24: a1b40000 */ sb $s4,0x0($t5)
.L0f05ea28:
/* f05ea28: 13000008 */ beqz $t8,.L0f05ea4c
/* f05ea2c: 00001025 */ or $v0,$zero,$zero
/* f05ea30: 24420001 */ addiu $v0,$v0,0x1
.L0f05ea34:
/* f05ea34: 304f00ff */ andi $t7,$v0,0xff
/* f05ea38: 020f7021 */ addu $t6,$s0,$t7
/* f05ea3c: 91d90000 */ lbu $t9,0x0($t6)
/* f05ea40: 01e01025 */ or $v0,$t7,$zero
/* f05ea44: 5720fffb */ bnezl $t9,.L0f05ea34
/* f05ea48: 24420001 */ addiu $v0,$v0,0x1
.L0f05ea4c:
/* f05ea4c: 00402025 */ or $a0,$v0,$zero
/* f05ea50: 0fc2554a */ jal tagFindById
/* f05ea54: 02028821 */ addu $s1,$s0,$v0
/* f05ea58: 84480006 */ lh $t0,0x6($v0)
/* f05ea5c: a6480006 */ sh $t0,0x6($s2)
/* f05ea60: 8c49000c */ lw $t1,0xc($v0)
/* f05ea64: ae49000c */ sw $t1,0xc($s2)
/* f05ea68: a2340000 */ sb $s4,0x0($s1)
.L0f05ea6c:
/* f05ea6c: 26730001 */ addiu $s3,$s3,0x1
/* f05ea70: 326400ff */ andi $a0,$s3,0xff
/* f05ea74: 28810010 */ slti $at,$a0,0x10
/* f05ea78: 1420ffd6 */ bnez $at,.L0f05e9d4
/* f05ea7c: 00809825 */ or $s3,$a0,$zero
/* f05ea80: 3c03800a */ lui $v1,%hi(g_Vars)
/* f05ea84: 24639fc0 */ addiu $v1,$v1,%lo(g_Vars)
/* f05ea88: 8c6b0438 */ lw $t3,0x438($v1)
/* f05ea8c: 8fbf002c */ lw $ra,0x2c($sp)
/* f05ea90: 8fb00018 */ lw $s0,0x18($sp)
/* f05ea94: 8fb1001c */ lw $s1,0x1c($sp)
/* f05ea98: 8fb20020 */ lw $s2,0x20($sp)
/* f05ea9c: 8fb30024 */ lw $s3,0x24($sp)
/* f05eaa0: 8fb40028 */ lw $s4,0x28($sp)
/* f05eaa4: 256c0002 */ addiu $t4,$t3,0x2
/* f05eaa8: ac6c0438 */ sw $t4,0x438($v1)
/* f05eaac: 27bd0050 */ addiu $sp,$sp,0x50
/* f05eab0: 03e00008 */ jr $ra
/* f05eab4: 00001025 */ or $v0,$zero,$zero
);
bool aiShufflePelagicSwitches(void)
{
u8 buttonsdone[8] = var80069860;
u8 i;
u8 j;
struct tag *tag;
struct tag *button;
u8 index;
for (i = 8; i < 16; i++) {
tag = tagFindById(i);
index = random() & 7;
if (buttonsdone[index] == 0) {
// Switch has not yet been mapped
button = tagFindById(index);
tag->unk06 = button->unk06;
tag->obj = button->obj;
buttonsdone[index] = 1;
} else {
// Switch is already mapped - find first unmapped switch
for (j = 0; buttonsdone[j]; j++);
button = tagFindById(j);
tag->unk06 = button->unk06;
tag->obj = button->obj;
buttonsdone[j] = 1;
}
}
g_Vars.aioffset += 2;
return false;
}
/**
* @cmd 01bb
+2 -3
View File
@@ -6660,7 +6660,7 @@ bool (*g_CommandPointers[])(void) = {
/*0x01b6*/ aiConfigureSnow,
/*0x01b7*/ aiChrSetCloaked,
/*0x01b8*/ aiSetAutogunType,
/*0x01b9*/ ai01b9,
/*0x01b9*/ aiShufflePelagicSwitches,
/*0x01ba*/ ai01ba,
/*0x01bb*/ aiNoOp01bb,
/*0x01bc*/ ai01bc,
@@ -7201,8 +7201,7 @@ u16 special_animations[] = {
0x0000,
};
u32 var80069860 = 0x00000000;
u32 var80069864 = 0x00000000;
u8 var80069860[8] = {0};
struct coord var80069868 = {0, 0, 0};
struct coord var80069874 = {0, 0, 0};
u32 var80069880 = 0x3f800000;
+1 -1
View File
@@ -23,7 +23,7 @@ void currentPlayerInitGunsHeld(void)
}
for (i = 0; i != 10; i++) {
g_Vars.currentplayer->gunheldarr[i].unk08 = -1;
g_Vars.currentplayer->gunheldarr[i].totaltime240_60 = -1;
}
}
+1 -1
View File
@@ -404,7 +404,7 @@
/*0x01b6*/ bool aiConfigureSnow(void);
/*0x01b7*/ bool aiChrSetCloaked(void);
/*0x01b8*/ bool aiSetAutogunType(void);
/*0x01b9*/ bool ai01b9(void);
/*0x01b9*/ bool aiShufflePelagicSwitches(void);
/*0x01ba*/ bool ai01ba(void);
/*0x01bb*/ bool aiNoOp01bb(void);
/*0x01bc*/ bool ai01bc(void);
+1 -1
View File
@@ -230,7 +230,7 @@ extern u16 g_InvestigationPadMap[40];
extern u32 var80069780;
extern u32 var8006978c;
extern u16 special_animations[];
extern u32 var80069860;
extern u8 var80069860[8];
extern struct coord var80069868;
extern struct coord var80069874;
extern u32 var800698c0;