Sort equipment as weapon/shield/hat/body/other based on item number

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search

uses r2, r3, r4; takes item number (r4) and returns r2 = r3 = item slot (0 = weapon, 1 = shield, 2 = head, 3 = body, 4 = accessory, 5 = item/throwable/other)

andi r4, r4, 0x3ff
slti r2, r4, 0x007a
bne r2, r0, 0x001253cc
addu r3, r0, r0
slti r2, r4, 0x0080
bne r2, r0, 0x001253cc
ori r3, r0, 0x0005
slti r2, r4, 0x0090
bne r2, r0, 0x001253cc
ori r3, r0, 0x0001
slti r2, r4, 0x00ac
bne r2, r0, 0x001253cc
ori r3, r0, 0x0002
slti r2, r4, 0x00d0
bne r2, r0, 0x001253bc
nop
j 0x001253cc
ori r3, r0, 0x0003
slti r2, r4, 0x00f0
beq r2, r0, 0x001253cc
ori r3, r0, 0x0005
ori r3, r0, 0x0004
jr r31
addu r2, r3, r0