Remove Equipment, Skillsets, Supports after Job or Support Change

From Final Fantasy Hacktics Wiki
(Redirected from 0012499c - 00124c50)
Jump to navigation Jump to search

0012499c: 27bdffd8 addiu r29,r29,0xffd8
001249a0: afb40020 sw r20,0x0020(r29)
001249a4: 0080a021 addu r20,r4,r0
001249a8: afb10014 sw r17,0x0014(r29)
001249ac: 00008821 addu r17,r0,r0			equip slot counter
001249b0: 00042400 sll r4,r4,0x10			r4 = unit formation ID
001249b4: afb3001c sw r19,0x001c(r29)
001249b8: 00049c03 sra r19,r4,0x10
001249bc: 3c03801d lui r3,0x801d
001249c0: 2463d5ec addiu r3,r3,0xd5ec
001249c4: 00131080 sll r2,r19,0x02
001249c8: afb20018 sw r18,0x0018(r29)
001249cc: 00439021 addu r18,r2,r3
001249d0: afbf0024 sw r31,0x0024(r29)
001249d4: afb00010 sw r16,0x0010(r29)
001249d8: 02602021 addu r4,r19,r0			unit formation ID
001249dc: 00118040 sll r16,r17,0x01
001249e0: 8e420000 lw r2,0x0000(r18)			formation pointer
001249e4: 00112c00 sll r5,r17,0x10			equip slot
001249e8: 02021021 addu r2,r16,r2
001249ec: 84460054 lh r6,0x0054(r2)			load weapon to equip from unit's equips?
001249f0: 0c049185 jal 0x00124614			WORLD: 2 H/S Check on Equip
001249f4: 00052c03 sra r5,r5,0x10
001249f8: 00401821 addu r3,r2,r0
001249fc: 24620001 addiu r2,r3,0x0001			return + 1
00124a00: 2c420002 sltiu r2,r2,0x0002			set if return = 0, 1
00124a04: 14400004 bne r2,r0,0x00124a18		branch if not -1
00124a08: 34020014 ori r2,r0,0x0014
00124a0c: 2402fffa addiu r2,r0,0xfffa
00124a10: 1462000d bne r3,r2,0x00124a48		...? (-0x10 isn't a valid return from the above? skips unequipping item)
00124a14: 34020014 ori r2,r0,0x0014
00124a18: 12620007 beq r19,r2,0x00124a38		Branch if unit ID = preview
00124a1c: 00000000 nop
00124a20: 8e420000 lw r2,0x0000(r18)
00124a24: 00000000 nop
00124a28: 02021021 addu r2,r16,r2
00124a2c: 84440054 lh r4,0x0054(r2)			load current equip for slot
00124a30: 0c04822e jal 0x001208b8			Change Item Quantity on Equip
00124a34: 34050001 ori r5,r0,0x0001			increment quantity +1
00124a38: 8e420000 lw r2,0x0000(r18)
00124a3c: 00000000 nop
00124a40: 02021021 addu r2,r16,r2
00124a44: a4400054 sh r0,0x0054(r2)			store no item in equip
00124a48: 26310001 addiu r17,r17,0x0001
00124a4c: 2a220005 slti r2,r17,0x0005
00124a50: 1440ffe2 bne r2,r0,0x001249dc			loop for all 5 equips
00124a54: 02602021 addu r4,r19,r0
00124a58: 00141400 sll r2,r20,0x10
00124a5c: 00028403 sra r16,r2,0x10			unit ID
00124a60: 3c03801d lui r3,0x801d
00124a64: 2463d5ec addiu r3,r3,0xd5ec
00124a68: 00101080 sll r2,r16,0x02
00124a6c: 00439021 addu r18,r2,r3
00124a70: 8e420000 lw r2,0x0000(r18)			load unit's formation pointer
00124a74: 00000000 nop
00124a78: 94510054 lhu r17,0x0054(r2)
00124a7c: 94430056 lhu r3,0x0056(r2)			load right and left hand equips
00124a80: 2a22007a slti r2,r17,0x007a			set if RH legal weapon
00124a84: 10400016 beq r2,r0,0x00124ae0		branch if not
00124a88: 00000000 nop
00124a8c: 12200014 beq r17,r0,0x00124ae0		branch if 0
00124a90: 2862007a slti r2,r3,0x007a
00124a94: 10400012 beq r2,r0,0x00124ae0		branch if left hand is illegal
00124a98: 00000000 nop
00124a9c: 10600011 beq r3,r0,0x00124ae4		branch if left hand is 0
00124aa0: 00141400 sll r2,r20,0x10			if both hands have legal weapons
00124aa4: 0c048a21 jal 0x00122884			Check For Two Swords
00124aa8: 02002021 addu r4,r16,r0
00124aac: 1440000d bne r2,r0,0x00124ae4		branch if 2 swords equipped
00124ab0: 00141400 sll r2,r20,0x10
00124ab4: 34020014 ori r2,r0,0x0014
00124ab8: 12020006 beq r16,r2,0x00124ad4		branch if unit is preview
00124abc: 00000000 nop
00124ac0: 8e420000 lw r2,0x0000(r18)
00124ac4: 00000000 nop
00124ac8: 84440056 lh r4,0x0056(r2)
00124acc: 0c04822e jal 0x001208b8			Change Item Quantity on Equip
00124ad0: 34050001 ori r5,r0,0x0001			increment item quantity + 1
00124ad4: 8e420000 lw r2,0x0000(r18)
00124ad8: 00000000 nop
00124adc: a4400056 sh r0,0x0056(r2)			Unequip left hand if no 2 swords
00124ae0: 00141400 sll r2,r20,0x10
00124ae4: 3c03801d lui r3,0x801d
00124ae8: 2463d5ec addiu r3,r3,0xd5ec
00124aec: 00021383 sra r2,r2,0x0e
00124af0: 00438021 addu r16,r2,r3
00124af4: 8e040000 lw r4,0x0000(r16)			load formation pointer
00124af8: 00000000 nop
00124afc: 84830024 lh r3,0x0024(r4)			load job ID
00124b00: 3402005d ori r2,r0,0x005d
00124b04: 14620009 bne r3,r2,0x00124b2c		branch if not mime
00124b08: 3402004b ori r2,r0,0x004b
00124b0c: 2484005e addiu r4,r4,0x005e			formation skillset pointer
00124b10: 00002821 addu r5,r0,r0
00124b14: 0c0088bf jal 0x000222fc			kernal call (0a2b, p1 = ptr, p2 = 0, p3 = 0xa?)
00124b18: 3406000a ori r6,r0,0x000a			r6 = 0xa
00124b1c: 8e040000 lw r4,0x0000(r16)
00124b20: 00000000 nop
00124b24: 84830024 lh r3,0x0024(r4)			load job
00124b28: 3402004b ori r2,r0,0x004b
00124b2c: 14620006 bne r3,r2,0x00124b48		branch if not chemist
00124b30: 00141400 sll r2,r20,0x10
00124b34: 94830064 lhu r3,0x0064(r4)			load support equip
00124b38: 340201da ori r2,r0,0x01da
00124b3c: 14620002 bne r3,r2,0x00124b48		branch if not throw item
00124b40: 00141400 sll r2,r20,0x10
00124b44: a4800064 sh r0,0x0064(r4)			store no equip if ability is throw item
00124b48: 00021383 sra r2,r2,0x0e
00124b4c: 3c01801d lui r1,0x801d
00124b50: 00220821 addu r1,r1,r2
00124b54: 8c24d5ec lw r4,-0x2a14(r1)
00124b58: 00000000 nop
00124b5c: 84830024 lh r3,0x0024(r4)			load job
00124b60: 3402004e ori r2,r0,0x004e
00124b64: 14620006 bne r3,r2,0x00124b80		branch if not monk
00124b68: 00141400 sll r2,r20,0x10
00124b6c: 94830064 lhu r3,0x0064(r4)			load support
00124b70: 340201d8 ori r2,r0,0x01d8
00124b74: 14620002 bne r3,r2,0x00124b80		branch if not martial arts
00124b78: 00141400 sll r2,r20,0x10
00124b7c: a4800064 sh r0,0x0064(r4)			store no support if ability is martial arts
00124b80: 00021383 sra r2,r2,0x0e
00124b84: 3c01801d lui r1,0x801d
00124b88: 00220821 addu r1,r1,r2
00124b8c: 8c24d5ec lw r4,-0x2a14(r1)
00124b90: 00000000 nop
00124b94: 84830024 lh r3,0x0024(r4)			load job
00124b98: 34020054 ori r2,r0,0x0054
00124b9c: 14620006 bne r3,r2,0x00124bb8		branch if not mediator
00124ba0: 00141400 sll r2,r20,0x10
00124ba4: 94830064 lhu r3,0x0064(r4)
00124ba8: 340201d9 ori r2,r0,0x01d9
00124bac: 14620002 bne r3,r2,0x00124bb8		branch if ability is not monster talk
00124bb0: 00141400 sll r2,r20,0x10
00124bb4: a4800064 sh r0,0x0064(r4)			store no support if ability is monster talk
00124bb8: 00021383 sra r2,r2,0x0e
00124bbc: 3c01801d lui r1,0x801d
00124bc0: 00220821 addu r1,r1,r2
00124bc4: 8c24d5ec lw r4,-0x2a14(r1)
00124bc8: 00000000 nop
00124bcc: 84830024 lh r3,0x0024(r4)			load job
00124bd0: 34020059 ori r2,r0,0x0059
00124bd4: 14620006 bne r3,r2,0x00124bf0		branch if not ninja
00124bd8: 00141400 sll r2,r20,0x10
00124bdc: 94830064 lhu r3,0x0064(r4)			load support
00124be0: 340201dd ori r2,r0,0x01dd
00124be4: 14620002 bne r3,r2,0x00124bf0		branch if not 2 swords
00124be8: 00141400 sll r2,r20,0x10
00124bec: a4800064 sh r0,0x0064(r4)			if 2 swords, store no 2 swords
00124bf0: 00022c03 sra r5,r2,0x10
00124bf4: 00051080 sll r2,r5,0x02
00124bf8: 3c01801d lui r1,0x801d
00124bfc: 00220821 addu r1,r1,r2
00124c00: 8c24d5ec lw r4,-0x2a14(r1)
00124c04: 00000000 nop
00124c08: 9483005e lhu r3,0x005e(r4)			load primary skillset
00124c0c: 94820060 lhu r2,0x0060(r4)			load secondary skillset
00124c10: 00000000 nop
00124c14: 14620002 bne r3,r2,0x00124c20		branch if they're unique
00124c18: 34020014 ori r2,r0,0x0014
00124c1c: a4800060 sh r0,0x0060(r4)			store no secondary skillset if identical
00124c20: 10a20003 beq r5,r2,0x00124c30		branch if preview unit
00124c24: 00000000 nop
00124c28: 0c0484ae jal 0x001212b8			copy formation data to party data
00124c2c: 00000000 nop
00124c30: 8fbf0024 lw r31,0x0024(r29)
00124c34: 8fb40020 lw r20,0x0020(r29)
00124c38: 8fb3001c lw r19,0x001c(r29)
00124c3c: 8fb20018 lw r18,0x0018(r29)
00124c40: 8fb10014 lw r17,0x0014(r29)
00124c44: 8fb00010 lw r16,0x0010(r29)
00124c48: 27bd0028 addiu r29,r29,0x0028
00124c4c: 03e00008 jr r31
00124c50: 00000000 nop