WORLD: 2 H/S Check on Equip

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search


Checks for 2 swords/2 hands from unit's formation data, and if both weapons are 2 swordable / weapon is forced 2 hands (on equip change)

00124614: 27bdffc8 addiu r29,r29,0xffc8
00124618: 00801821 addu r3,r4,r0			#r4 = current unit formation ID
0012461c: afb20018 sw r18,0x0018(r29)
00124620: 00a09021 addu r18,r5,r0			#r5 = hand to swap equipment into
00124624: afb00010 sw r16,0x0010(r29)
00124628: 00c08021 addu r16,r6,r0			#r16 = weapon to equip
0012462c: 00031400 sll r2,r3,0x10			#r2 = current unit formation ID
00124630: afb10014 sw r17,0x0014(r29)
00124634: 00028c03 sra r17,r2,0x10
00124638: 02202021 addu r4,r17,r0			#unit formation ID in upper halfword
0012463c: afb60028 sw r22,0x0028(r29)
00124640: 0060b021 addu r22,r3,r0			#r22 = current unit formation ID
00124644: afbf0030 sw r31,0x0030(r29)
00124648: afb7002c sw r23,0x002c(r29)
0012464c: afb50024 sw r21,0x0024(r29)
00124650: afb40020 sw r20,0x0020(r29)
00124654: 0c049550 jal 0x00125540
00124658: afb3001c sw r19,0x001c(r29)
0012465c: 00409821 addu r19,r2,r0			#r19 = unit formation ID
00124660: 06600055 bltz r19,0x001247b8			#branch if unit formation ID is erroneous
00124664: 0240a021 addu r20,r18,r0			#r20 = hand to swap equipment into
00124668: 320203ff andi r2,r16,0x03ff
0012466c: 00408021 addu r16,r2,r0
00124670: 1200003a beq r16,r0,0x0012475c		#branch if weapon is 0
00124674: 0040b821 addu r23,r2,r0			#r23 = weapon to equip
00124678: 02202021 addu r4,r17,r0
0012467c: 0c04915f jal 0x0012457c
00124680: 02002821 addu r5,r16,r0
00124684: 00409821 addu r19,r2,r0			#output into r19
00124688: 00121400 sll r2,r18,0x10			#
0012468c: 00021403 sra r2,r2,0x10			#
00124690: 28420002 slti r2,r2,0x0002			#set if r18 < 0x2
00124694: 10400047 beq r2,r0,0x001247b4		#branch if r18 => 0x2
00124698: 34020001 ori r2,r0,0x0001			#r2 = 1
0012469c: 16620046 bne r19,r2,0x001247b8		#branch if output is not 0x1?
001246a0: 02601021 addu r2,r19,r0			#r2 = output again
001246a4: 2a02007a slti r2,r16,0x007a			#set if weapon < 0x7a (wewapon)
001246a8: 38520001 xori r18,r2,0x0001			#if weapon, return 0
001246ac: 12400003 beq r18,r0,0x001246bc		#branch if weapon is shield
001246b0: 0000a821 addu r21,r0,r0			#r21 = 0 (shields cannot be forced 2 hands)
001246b4: 080491b6 j 0x001246d8
001246b8: 00002021 addu r4,r0,r0			#r4 = 0 (shields can't be 2 swordable)
001246bc: 001010c0 sll r2,r16,0x03			#r2 = weapon type * 8
001246c0: 3c018006 lui r1,0x8006
001246c4: 00220821 addu r1,r1,r2
001246c8: 90223ab9 lbu r2,0x3ab9(r1)			#load weapon's attack flag
001246cc: 00000000 nop
001246d0: 30550001 andi r21,r2,0x0001			#check for forced 2 hands
001246d4: 30440008 andi r4,r2,0x0008			#check for 2 swordable
001246d8: 00141c00 sll r3,r20,0x10
001246dc: 2c630001 sltiu r3,r3,0x0001			#r3 = 1 if right hand, r3 = 0 if left hand
001246e0: 00161400 sll r2,r22,0x10
001246e4: 00021383 sra r2,r2,0x0e
001246e8: 3c01801d lui r1,0x801d
001246ec: 00220821 addu r1,r1,r2
001246f0: 8c22d5ec lw r2,-0x2a14(r1)			#load unit formation pointer
001246f4: 00031840 sll r3,r3,0x01			#2 or 0 depending on hand being checked
001246f8: 00621821 addu r3,r3,r2			#unit formation pointer
001246fc: 94620054 lhu r2,0x0054(r3)			#load hand interacted with (?)
00124700: 00000000 nop
00124704: 305103ff andi r17,r2,0x03ff			#0 out erroneous data
00124708: 2a22007a slti r2,r17,0x007a			#r2 = 1 if weapon < shield
0012470c: 38500001 xori r16,r2,0x0001			#r16 = 1 if weapon > shield
00124710: 12000003 beq r16,r0,0x00124720		#branch if weapon < shield
00124714: 0000a021 addu r20,r0,r0			#r20 = 0
00124718: 080491cf j 0x0012473c
0012471c: 00001021 addu r2,r0,r0			#r2 = 0
00124720: 001110c0 sll r2,r17,0x03			#weapon * 8
00124724: 3c018006 lui r1,0x8006
00124728: 00220821 addu r1,r1,r2
0012472c: 90223ab9 lbu r2,0x3ab9(r1)			#load attack flag of weapon
00124730: 00000000 nop
00124734: 30540001 andi r20,r2,0x0001			#r20 = forced 2 hands
00124738: 30420008 andi r2,r2,0x0008			#
0012473c: 10800009 beq r4,r0,0x00124764		#branch if left hand is not 2 swordable
00124740: 00000000 nop
00124744: 10400007 beq r2,r0,0x00124764		#branch if right hand is not 2 swordable
00124748: 00162400 sll r4,r22,0x10			#
0012474c: 0c048a21 jal 0x00122884			00122884 - 001228a4 Checks Formation support flags for Two Swords
00124750: 00042403 sra r4,r4,0x10			#
00124754: 10400003 beq r2,r0,0x00124764		#branch if unit does not have 2 swords support
00124758: 00000000 nop
0012475c: 080491ee j 0x001247b8
00124760: 34020001 ori r2,r0,0x0001			#r2 = 1 (2 swords?)
00124764: 16400009 bne r18,r0,0x0012478c		#branch if RH weapon is not fists
00124768: 00000000 nop
0012476c: 16000005 bne r16,r0,0x00124784		#branch if LH weapon is not fists
00124770: 00000000 nop
00124774: 12e00003 beq r23,r0,0x00124784		#branch if weapon to equip is fists
00124778: 00000000 nop
0012477c: 1620000e bne r17,r0,0x001247b8		#branch if weapon to equip is not fists
00124780: 00001021 addu r2,r0,r0			#r2 = 0 (2 hands?)
00124784: 12400007 beq r18,r0,0x001247a4		#branch if RH weapon is fists
00124788: 00000000 nop
0012478c: 1600000a bne r16,r0,0x001247b8		#branch if LH weapon is not fists
00124790: 00001021 addu r2,r0,r0			#r2 = 0 (2 hands?)
00124794: 12400003 beq r18,r0,0x001247a4		#branch if RH weapon is fists
00124798: 00000000 nop
0012479c: 16800006 bne r20,r0,0x001247b8		#Branch if hand to swap equipment into is left hand
001247a0: 00000000 nop
001247a4: 12000003 beq r16,r0,0x001247b4		#branch if LH weapon is not fists
001247a8: 00000000 nop
001247ac: 16a00002 bne r21,r0,0x001247b8		#branch if forced 2 hands is true
001247b0: 00001021 addu r2,r0,r0			#r2 = 0 (2 hands?)
001247b4: 02601021 addu r2,r19,r0
001247b8: 8fbf0030 lw r31,0x0030(r29)
001247bc: 8fb7002c lw r23,0x002c(r29)
001247c0: 8fb60028 lw r22,0x0028(r29)
001247c4: 8fb50024 lw r21,0x0024(r29)
001247c8: 8fb40020 lw r20,0x0020(r29)
001247cc: 8fb3001c lw r19,0x001c(r29)
001247d0: 8fb20018 lw r18,0x0018(r29)
001247d4: 8fb10014 lw r17,0x0014(r29)
001247d8: 8fb00010 lw r16,0x0010(r29)
001247dc: 27bd0038 addiu r29,r29,0x0038
001247e0: 03e00008 jr r31
001247e4: 00000000 nop