Check for unit availability(existance) and ENTD level setting

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search

0017fd08: 27bdffe8 addiu r29,r29,0xffe8
0017fd0c: 00802821 addu r5,r4,r0
0017fd10: 000510c0 sll r2,r5,0x03
0017fd14: 00451023 subu r2,r2,r5
0017fd18: 00021180 sll r2,r2,0x06
0017fd1c: 3c038019 lui r3,0x8019
0017fd20: 246308cc addiu r3,r3,0x08cc
0017fd24: 00432021 addu r4,r2,r3
0017fd28: afbf0010 sw r31,0x0010(r29)
0017fd2c: 90830001 lbu r3,0x0001(r4)
0017fd30: 340200ff ori r2,r0,0x00ff
0017fd34: 1462000e bne r3,r2,0x0017fd70			branch if unit doesn't exist
0017fd38: 00001021 addu r2,r0,r0				return r2 = 0x00
0017fd3c: 90820183 lbu r2,0x0183(r4)
0017fd40: 00000000 nop
0017fd44: 1440000a bne r2,r0,0x0017fd70			branch if unit doesn't exist but can
0017fd48: 2402ffff addiu r2,r0,0xffff			return r2 = 0xff
0017fd4c: 90820005 lbu r2,0x0005(r4)			load ENTD flags
0017fd50: 34030001 ori r3,r0,0x0001
0017fd54: a0850001 sb r5,0x0001(r4)				store unit ID = unit ID
0017fd58: 30420030 andi r2,r2,0x0030
0017fd5c: 10400003 beq r2,r0,0x0017fd6c			branch if unit is player unit
0017fd60: a0830183 sb r3,0x0183(r4)				store unit exists
0017fd64: 0c06036c jal 0x00180db0				Set Enemy Level Data
0017fd68: 00000000 nop
0017fd6c: 00001021 addu r2,r0,r0				return r2 = 00
0017fd70: 8fbf0010 lw r31,0x0010(r29)
0017fd74: 27bd0018 addiu r29,r29,0x0018
0017fd78: 03e00008 jr r31
0017fd7c: 00000000 nop