Get Battle Unit Index By Unit Misc ID
Jump to navigation
Jump to search
# ROUTINE: GET BATTLE UNIT INDEX BY UNIT MISC ID # Parameters: # r4 = (unitMiscID) Unit misc data ID # Returns: # r2 = (Battle unit index) of unit with specified misc ID, if exists # -1, if no battle unit with specified misc ID exists 8008cdd0: 27bdffe8 addiu r29,r29,-0x0018 8008cdd4: afbf0010 sw r31,0x0010(r29) 8008cdd8: 0c01e9b9 jal 0x8007a6e4 # unitMiscData = Get Unit Misc Data Pointer (unitMiscID); 8008cddc: 3084ffff andi r4,r4,0xffff 8008cde0: 10400008 beq r2,r0,0x8008ce04 # if (unitMiscData != null) { 8008cde4: 00000000 nop 8008cde8: 8c420134 lw r2,0x0134(r2) # unitMiscData.battleUnit 8008cdec: 00000000 nop 8008cdf0: 10400006 beq r2,r0,0x8008ce0c # if (unitMiscData.battleUnit != null) { 8008cdf4: 00000000 nop 8008cdf8: 9042018a lbu r2,0x018a(r2) # return unitMiscData.battleUnit.index; 8008cdfc: 08023384 j 0x8008ce10 # } 8008ce00: 00000000 nop # } else { 8008ce04: 0c01128d jal 0x80044a34 # ? 0x44a34 (12); // Routine has no real effect? 8008ce08: 3404000c ori r4,r0,0x000c 8008ce0c: 2402ffff addiu r2,r0,-0x0001 # return -1; # } 8008ce10: 8fbf0010 lw r31,0x0010(r29) 8008ce14: 27bd0018 addiu r29,r29,0x0018 8008ce18: 03e00008 jr r31 8008ce1c: 00000000 nop