Can Unit equip Item ID

From Final Fantasy Hacktics Wiki
(Redirected from 0012457c - 00124610)
Jump to navigation Jump to search

0012457c: 27bdffe0 addiu r29,r29,0xffe0
00124580: afb10014 sw r17,0x0014(r29)
00124584: 00808821 addu r17,r4,r0			#unit formation ID
00124588: afb00010 sw r16,0x0010(r29)
0012458c: 30b003ff andi r16,r5,0x03ff			#item ID
00124590: 16000003 bne r16,r0,0x001245a0		#Branch if item is not fists
00124594: afbf0018 sw r31,0x0018(r29)
00124598: 0804917f j 0x001245fc			#if item is fists, Return 2 = 0x1
0012459c: 34020001 ori r2,r0,0x0001
001245a0: 0c0494dd jal 0x00125374			Find Equip slot Type
001245a4: 02002021 addu r4,r16,r0
001245a8: 34030005 ori r3,r0,0x0005
001245ac: 14430003 bne r2,r3,0x001245bc		#branch if equip type != chemist item/throwable
001245b0: 00111400 sll r2,r17,0x10
001245b4: 0804917f j 0x001245fc			#if equip is not equippable, return 2 = -0x1
001245b8: 2402ffff addiu r2,r0,0xffff
001245bc: 00021383 sra r2,r2,0x0e			#formation ID * 0x4
001245c0: 3c01801d lui r1,0x801d
001245c4: 00220821 addu r1,r1,r2
001245c8: 8c24d5ec lw r4,-0x2a14(r1)			#pointer to current unit's formation data
001245cc: 0c04ac6d jal 0x0012b1b4			#store pointer as current 0x801ca6f0
001245d0: 24840073 addiu r4,r4,0x0073			#+ 0x73 (equippable items)
001245d4: 0c0493f4 jal 0x00124fd0			#r2 = item's Item type
001245d8: 02002021 addu r4,r16,r0			#item ID
001245dc: 0c04ac7b jal 0x0012b1ec			#Check for Present Flags sets bit-mask shift for pointer & increment pointer if necessary
001245e0: 00402021 addu r4,r2,r0			#Parse item Type
001245e4: 0c04ac7b jal 0x0012b1ec			#Check for Present Flags checks if the unit can equip current item
001245e8: 34040001 ori r4,r0,0x0001			#parse 0x1 (check equipable for current item type)
001245ec: 14400002 bne r2,r0,0x001245f8		#branch if unit can
001245f0: 34030001 ori r3,r0,0x0001			#if unit can equip, return 0x1
001245f4: 2403ffff addiu r3,r0,0xffff			#otherwise, return -0x1
001245f8: 00601021 addu r2,r3,r0			#RETURN
001245fc: 8fbf0018 lw r31,0x0018(r29)
00124600: 8fb10014 lw r17,0x0014(r29)
00124604: 8fb00010 lw r16,0x0010(r29)
00124608: 27bd0020 addiu r29,r29,0x0020
0012460c: 03e00008 jr r31
00124610: 00000000 nop