AI Check if Unit is a Crystal/Treasure (0019bb20)

From Final Fantasy Hacktics Wiki
Revision as of 16:27, 31 July 2023 by Orkney (talk | contribs)
Jump to navigation Jump to search
ALTERNATIVE VERSION Check_Unit_for_Crystal_or_Treasure_Status
-----------------------------------------------------------------
0019bb20: 27bdffe8 addiu r29,r29,0xffe8
0019bb24: 3c04801a lui r4,0x801a
0019bb28: 2484f3dc addiu r4,r4,0xf3dc
0019bb2c: afbf0010 sw r31,0x0010(r29)
0019bb30: 3c01801a lui r1,0x801a
0019bb34: a0200083 sb r0,0x0083(r1)
0019bb38: 0c0674a5 jal 0x0019d294					Check if all units match their positions in the AI
0019bb3c: 00000000 nop
0019bb40: 00401821 addu r3,r2,r0
0019bb44: 34020015 ori r2,r0,0x0015
0019bb48: 10620018 beq r3,r2,0x0019bbac				Exit if all units were evaluated (nothing found)
0019bb4c: 000310c0 sll r2,r3,0x03
0019bb50: 00431023 subu r2,r2,r3
0019bb54: 00021180 sll r2,r2,0x06
0019bb58: 3c038019 lui r3,0x8019
0019bb5c: 246308cc addiu r3,r3,0x08cc
0019bb60: 00432021 addu r4,r2,r3
0019bb64: 90830001 lbu r3,0x0001(r4)				Load Unit ID
0019bb68: 340200ff ori r2,r0,0x00ff
0019bb6c: 1062000f beq r3,r2,0x0019bbac				Branch if unit doesn't exist
0019bb70: 00000000 nop
0019bb74: 90820058 lbu r2,0x0058(r4)				Load Current Status 1
0019bb78: 00000000 nop
0019bb7c: 30420040 andi r2,r2,0x0040				
0019bb80: 10400003 beq r2,r0,0x0019bb90				Branch if not Crystal
0019bb84: 34020001 ori r2,r0,0x0001
0019bb88: 3c01801a lui r1,0x801a
0019bb8c: a0220083 sb r2,0x0083(r1)
0019bb90: 90820059 lbu r2,0x0059(r4)
0019bb94: 00000000 nop
0019bb98: 30420001 andi r2,r2,0x0001				
0019bb9c: 10400003 beq r2,r0,0x0019bbac				Branch if not Treasure
0019bba0: 34020002 ori r2,r0,0x0002
0019bba4: 3c01801a lui r1,0x801a
0019bba8: a0220083 sb r2,0x0083(r1)
0019bbac: 8fbf0010 lw r31,0x0010(r29)
0019bbb0: 27bd0018 addiu r29,r29,0x0018
0019bbb4: 03e00008 jr r31
0019bbb8: 00000000 nop