Set some target coordinates/attacker animation, others

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
Finalize Attacks and store Weapon strike animation is wanted.
-----------------------------------------------------------------
No Parameters
Returns nothing

Hard coded mechanics : Elemental gun displaying weapon strike is based on Item ID (0x4a to 0x4c)
----------------------------------------------------------------
00073b9c: 27bdffc0 addiu r29,r29,-0x0040    |
00073ba0: 34020001 ori r2,r0,0x0001         |r2 = 0x01
00073ba4: 3c018004 lui r1,0x8004            |
00073ba8: ac225980 sw r2,0x5980(r1)         |Set 0x80045980 = 0x01 Type of display (0x01 = targeting ?)
00073bac: 3402002c ori r2,r0,0x002c         |r2 = 0x2c
00073bb0: afbf003c sw r31,0x003c(r29)       |
00073bb4: afb40038 sw r20,0x0038(r29)       |
00073bb8: afb30034 sw r19,0x0034(r29)       |
00073bbc: afb20030 sw r18,0x0030(r29)       |
00073bc0: afb1002c sw r17,0x002c(r29)       |
00073bc4: afb00028 sw r16,0x0028(r29)       |
00073bc8: 3c018009 lui r1,0x8009            |
00073bcc: ac2260e4 sw r2,0x60e4(r1)         |store type of dysplay = 0x2c 800960e4
00073bd0: 0c01e875 jal 0x0007a1d4           |-->Get casting unit's misc data Returns r2 = Acting unit's misc data pointer (matching ID at 0x8009611c )
00073bd4: 00000000 nop                      |
00073bd8: 00409021 addu r18,r2,r0           |r£18 = Acting unit's misc data pointer (matching ID at 0x8009611c )
00073bdc: 924201b5 lbu r2,0x01b5(r18)       |r2 = Acting Units misc 0x1b5 Ability Proc related (0x01 when Proc is ongoing)
00073be0: 00000000 nop                      |
00073be4: 14400004 bne r2,r0,0x00073bf8     #If Acting Unit misc 0x1b5 = 0x00 No Proc ongoing ?
00073be8: a6400008 sh r0,0x0008(r18)        |Set Acting Unit misc 0x08 = 0x00 Incremented on ability display
00073bec: 02402021 addu r4,r18,r0               |r4 = Acting Unit misc data pointer
00073bf0: 0c01c9cf jal 0x0007273c               |-->Movement/action_direction_setting%3F
00073bf4: 00002821 addu r5,r0,r0                |r5 = 0x00
00073bf8: 9242018d lbu r2,0x018d(r18)       |r2 = Acting Unit Number of targeted unit's
00073bfc: 00000000 nop                      |
00073c00: 1040001c beq r2,r0,0x00073c74     #If There is target(s) /Else branch if no targets hit ? Again ?
00073c04: 2653018c addiu r19,r18,0x018c     |r19 = Acting Unit misc data 0x18c pointer
00073c08: 1040001a beq r2,r0,0x00073c74         #If There is target(s)
00073c0c: 00008821 addu r17,r0,r0                   |r17 = 0x00
00073c10: 2414ffff addiu r20,r0,-0x0001             |r20 = -0x01
00073c14: 02711021 addu r2,r19,r17                  |r2 = Acting Unit misc data 0x18c pointer
                                                    @LOOP through all targets
00073c18: 90440002 lbu r4,0x0002(r2)                    |r4 = This Iteration Target ID (From Target List at Acting Unit misc 0x18e)
00073c1c: 0c01e9c9 jal 0x0007a724                       |-->Get_unit_misc_data_that_matches_r4_ID
00073c20: 00000000 nop                                  |
00073c24: 00408021 addu r16,r2,r0                       |r16 = This iteration Targeted Unit misc data pointer
00073c28: 1200000d beq r16,r0,0x00073c60                #If Target Pointer is valid
00073c2c: 26310001 addiu r17,r17,0x0001                 |r17 = Counter + 1 (number of accounted targets)
00073c30: 8e020134 lw r2,0x0134(r16)                        |r2 = This iteration Targeted Unit data pointer
00073c34: 00000000 nop                                      |
00073c38: 9044018a lbu r4,0x018a(r2)                        |r4 = This iteration Targeted Unit raw ID
00073c3c: 0c062f82 jal 0x0018be08                           |-->Attack_Finalisation_%26_Reaction_Flagging
00073c40: 00000000 nop                                      |
00073c44: 14540006 bne r2,r20,0x00073c60                    #If Target died while riding
00073c48: ae020180 sw r2,0x0180(r16)                        |Store 0x00 or -0x01 at Misc Unit 0x180 (death on chocobo flag)
00073c4c: 8e020134 lw r2,0x0134(r16)                            |r2 = This iteration Targeted Unit data pointer
00073c50: 00000000 nop                                          |
00073c54: 9044018a lbu r4,0x018a(r2)                            |r4 = Unit raw ID
00073c58: 0c05fb06 jal 0x0017ec18                               |-->Big_map/panel_routine Relocate Rider body near the chocobo
00073c5c: 26050184 addiu r5,r16,0x0184                          |r5 = Pointer to Misc Unit 0x184
00073c60: 92620001 lbu r2,0x0001(r19)                   |Load Target counter
00073c64: 00000000 nop                                  |
00073c68: 0222102a slt r2,r17,r2                        |Check if there is still target to deal with
00073c6c: 1440ffea bne r2,r0,0x00073c18             Λ Loop if there is other targets
00073c70: 02711021 addu r2,r19,r17                      |r2 = address of next target in list
00073c74: 3c038009 lui r3,0x8009                        |
00073c78: 8c636214 lw r3,0x6214(r3)         |Load Action phase
00073c7c: 34020001 ori r2,r0,0x0001         |
---- Acting unit Phase ----
00073c80: 1462002b bne r3,r2,0x00073d30     #If Action phase = 0x01 (Acting unit action)
00073c84: 34020200 ori r2,r0,0x0200         |r2 = 0x200 (Fall Ability ID)
00073c88: 96420138 lhu r2,0x0138(r18)           |Load Acting unit used Ability ID (misc 0x138 )
00073c8c: 00000000 nop                          |
00073c90: 1040001d beq r2,r0,0x00073d08         #If used Ability = 0x00 : Branch to  Prep weapon strike animation section 
00073c94: 00000000 nop                          |
00073c98: 9242013a lbu r2,0x013a(r18)           |Load Acting unit used Weapon/Item ID
00073c9c: 00000000 nop                          |
00073ca0: 2442ffb6 addiu r2,r2,-0x004a          |0x00 if First elemental gun iD
00073ca4: 2c420002 sltiu r2,r2,0x0002           |Check if used weapon is an elemental gun (between 0x4a and 0x4b)
00073ca8: 14400009 bne r2,r0,0x00073cd0         #If Used Weapon is Blaze gun or Glacier gun : Branch to  shitty  Elemental gun / Proc section 
00073cac: 3402004c ori r2,r0,0x004c             |Blast gun ID
00073cb0: 9243013a lbu r3,0x013a(r18)           |Load Acting unit used Weapon/Item ID
00073cb4: 00000000 nop                          |
00073cb8: 10620005 beq r3,r2,0x00073cd0         #If Used Weapon is Blast gun : Branch to  shitty Elemental gun / Proc section  
00073cbc: 00000000 nop                          |
00073cc0: 92620017 lbu r2,0x0017(r19)           |Load misc 0x1a3 - Proc ? Post action thing
00073cc4: 00000000 nop                          |
00073cc8: 1040005c beq r2,r0,0x00073e3c         #If Misc unit 0x1a3 = 0x00 (No Ongoing Proc): Branch to  standard Ability section
00073ccc: 00000000 nop                          |
     ----Acting unit action : Elemental Gun and Proc----
00073cd0: 96420138 lhu r2,0x0138(r18)           |Load Acting unit used Ability ID (misc 0x138 )
00073cd4: 00000000 nop                          |
00073cd8: 1040000b beq r2,r0,0x00073d08         #If used Ability = 0x00 : Branch to  Prep weapon strike animation section              Already done..
00073cdc: 00000000 nop                          |
00073ce0: 9242013a lbu r2,0x013a(r18)           |Load Acting unit used Weapon/Item ID
00073ce4: 00000000 nop                          |
00073ce8: 2442ffb6 addiu r2,r2,-0x004a          |0x00 if First elemental gun iD
00073cec: 2c420002 sltiu r2,r2,0x0002           |Check if used weapon is an elemental gun (between 0x4a and 0x4b)
00073cf0: 14400005 bne r2,r0,0x00073d08         #If Used Weapon is Blaze gun or Glacier gun : Branch to Prep weapon strike animation section 
00073cf4: 3402004c ori r2,r0,0x004c             |Blast gun ID
00073cf8: 9243013a lbu r3,0x013a(r18)           |Load Acting unit used Weapon/Item ID
00073cfc: 00000000 nop                          |
00073d00: 14620071 bne r3,r2,0x00073ec8         #If Not Blast gun : Branch to  END This is where Ability proc avoid weapon strike
00073d04: 00000000 nop                          |
    ----Acting unit action : Prep weapon strike animation----                                               (Standard Attacks and elemental guns)
00073d08: 92620001 lbu r2,0x0001(r19)           |Load Target counter
00073d0c: 00000000 nop                          |
00073d10: 1040006a beq r2,r0,0x00073ebc         #If there is targets /Else Branch and set Target data pointer to 0x00
00073d14: 02402021 addu r4,r18,r0               |r4 = Attacker misc data pointer
00073d18: 92640002 lbu r4,0x0002(r19)               |load 1st target ID (misc 0x18e)
00073d1c: 0c01e9c9 jal 0x0007a724                   |-->Get_unit_misc_data_that_matches_r4_ID returns r2 = Target misc data pointer
00073d20: 00000000 nop                              |
00073d24: 02402021 addu r4,r18,r0                   |r4 = Attacker misc data pointer
00073d28: 0801cfb0 j 0x00073ec0                     >>jump to store weapon strike animation routine
00073d2c: 00402821 addu r5,r2,r0                    |r5 = Target misc data pointer
----Action Phase<> 0x01 - Post acting unit action ?----
00073d30: 96440138 lhu r4,0x0138(r18)       |Load Acting unit used Ability ID (misc 0x138 )
00073d34: 00000000 nop                      |
00073d38: 14820028 bne r4,r2,0x00073ddc     #If used ability is 0x200 (Fall)
00073d3c: 340201b8 ori r2,r0,0x01b8         |r2 = 0x1b8
    ----Ability 0x200 section : FALL----
00073d40: 9242018d lbu r2,0x018d(r18)           |Load Target counter
00073d44: 00000000 nop                          |
00073d48: 1840005f blez r2,0x00073ec8           #If There is at least one target /Else branch to END (No weapon animation)
00073d4c: 00008821 addu r17,r0,r0                   |Initialize loop counter
00073d50: 02711021 addu r2,r19,r17                  |r2 = loop offset misc attacker data
00073d54: 90440002 lbu r4,0x0002(r2)                @LOOP load this iteration target ID (misc 0x18e)
00073d58: 0c01e9c9 jal 0x0007a724                       |-->Get_unit_misc_data_that_matches_r4_ID
00073d5c: 00000000 nop                                  |
00073d60: 00408021 addu r16,r2,r0                       |r16 = Target misc data pointer
00073d64: 12000016 beq r16,r0,0x00073dc0                #branch if unit data not found?
00073d68: 00000000 nop                                      |
00073d6c: 924201a8 lbu r2,0x01a8(r18)                       |Load target new X coordinate (Attacker misc 0x1a8)
00073d70: 86080070 lh r8,0x0070(r16)                        |Load Target current Facing (Target misc 0x70)
00073d74: 8e030134 lw r3,0x0134(r16)                        |r3 = Target data pointer from Target misc 0x134
00073d78: a202007c sb r2,0x007c(r16)                        |Store new Target X coordinates  (Target misc 0x7c = Attacker misc 0x1a8)
00073d7c: 924201a9 lbu r2,0x01a9(r18)                       |Load target new Y coordinate (Attacker misc 0x1a9)
00073d80: 9205007c lbu r5,0x007c(r16)                       |Load Target X coordinate
00073d84: a202007d sb r2,0x007d(r16)                        |store new Y coordinate  (Target misc 0x7d = Attacker misc 0x1a9)
00073d88: 924201aa lbu r2,0x01aa(r18)                       |Load Target new elevation
00073d8c: 9206007d lbu r6,0x007d(r16)                       |Load Target Y coordinate
00073d90: a202007e sb r2,0x007e(r16)                        |Store new elevation  (Target misc 0x7e = Attacker misc 1aa)
00073d94: 9064018a lbu r4,0x018a(r3)                        |Load Target Raw ID
00073d98: 9207007e lbu r7,0x007e(r16)                       |Load Target elevation
00073d9c: 05010003 bgez r8,0x00073dac                       #If Facing is < 0x00
00073da0: 00081282 srl r2,r8,0x0a                           |r2 is Simplified facing (0,1,2,3)
00073da4: 250803ff addiu r8,r8,0x03ff                           |Modify facing
00073da8: 00081282 srl r2,r8,0x0a                               |simplify
00073dac: 304200ff andi r2,r2,0x00ff                        |r2 = Facing mod ( 0 - South / 1 - West / 2 - North / 3 - East)
00073db0: 0c05ff77 jal 0x0017fddc                           |-->Set_Rider/Mount%27s_X/Y_Data
00073db4: afa20010 sw r2,0x0010(r29)                        |Keep r2 on stack
00073db8: 0c0206c3 jal 0x00081b0c                           |-->Store_some_coordinate_data
00073dbc: 02002021 addu r4,r16,r0                           |
00073dc0: 9242018d lbu r2,0x018d(r18)                   |load hit counter
00073dc4: 26310001 addiu r17,r17,0x0001                 |counter + 1
00073dc8: 0222102a slt r2,r17,r2                        |set if counter < hit counter
00073dcc: 1440ffe1 bne r2,r0,0x00073d54             Λ Loop if there's still targets
00073dd0: 02711021 addu r2,r19,r17                      |r2 = next targets address in list
00073dd4: 0801cfb2 j 0x00073ec8                     >>Jump to  END (No weapon animation)
00073dd8: 00000000 nop                              |
     ----Not Fall section : reaction----                                                               reflect and counter magic and counter ends here
00073ddc: 86630020 lh r3,0x0020(r19)            |Load Ongoing Reaction ID
00073de0: 00000000 nop                              | 
00073de4: 10620038 beq r3,r2,0x00073ec8         #If unit is reflecting : branch to  END (No weapon animation)
00073de8: 00000000 nop                          |
00073dec: 10800029 beq r4,r0,0x00073e94         #If used Ability = 0x00 : Branch to  Prep weapon strike animation section 
00073df0: 00000000 nop                          |
00073df4: 9242013a lbu r2,0x013a(r18)           |Load Acting unit used Weapon/Item ID
00073df8: 00000000 nop                          |
00073dfc: 2442ffb6 addiu r2,r2,-0x004a          |0x00 if First elemental gun iD
00073e00: 2c420002 sltiu r2,r2,0x0002           |Check if used weapon is an elemental gun (between 0x4a and 0x4b)
00073e04: 14400015 bne r2,r0,0x00073e5c         #If Used Weapon is Blaze gun or Glacier gun : Branch to  shitty  Elemental gun / Proc X section
00073e08: 3402004c ori r2,r0,0x004c             |Blast gun ID
00073e0c: 9243013a lbu r3,0x013a(r18)           |Load Acting unit used Weapon/Item ID
00073e10: 00000000 nop                          |
00073e14: 10620011 beq r3,r2,0x00073e5c         #If Used Weapon is Blast gun : Branch to  shitty Elemental gun / Proc section  
00073e18: 00000000 nop                          |
00073e1c: 924201b5 lbu r2,0x01b5(r18)           |Load Attacker misc 0x1b5 0x01 When ongoing Proc - Not sure what is the difference with 0x1a3)
00073e20: 00000000 nop                          |
00073e24: 1440000d bne r2,r0,0x00073e5c         #If Attacker misc 0x1b5 <> 0x00 : branch to  shitty Elemental gun / Proc X Section  On going Proc (not only ?)
00073e28: 00000000 nop                          |
00073e2c: 92620017 lbu r2,0x0017(r19)           |Load Attacker misc 0x1a3   ongoing Proc flag ?
00073e30: 00000000 nop                          |
00073e34: 14400024 bne r2,r0,0x00073ec8         #If No Ongoing proc : Branch to END (No weapon animation) /Else go in Ability section
00073e38: 00000000 nop                          |
     ----Standard ability (Action and Post-Action phases)----
00073e3c: 92640002 lbu r4,0x0002(r19)           |Load 1st Target ID
00073e40: 0c01e9c9 jal 0x0007a724               |-->Get_unit_misc_data_that_matches_r4_ID returns r2 = Target misc data pointer
00073e44: 00000000 nop                          |
00073e48: 02402021 addu r4,r18,r0               |r4 = Acting unit misc data pointer
00073e4c: 0c020b04 jal 0x00082c10               |-->Set_attack_animation_flags_and_facing_3
00073e50: 00402821 addu r5,r2,r0                |r5 = Target unit misc data pointer
00073e54: 0801cfb2 j 0x00073ec8                 >>Jump to  END (No weapon animation)
00073e58: 00000000 nop                          |
     ----Post Action : Elemental Gun or Proc----
00073e5c: 96420138 lhu r2,0x0138(r18)           |Load Acting unit used Ability ID (misc 0x138 )
00073e60: 00000000 nop                          |
00073e64: 1040000b beq r2,r0,0x00073e94         #If used Ability = 0x00 : Branch to  Prep weapon strike animation section 
00073e68: 00000000 nop                          |
00073e6c: 9242013a lbu r2,0x013a(r18)           |Load Acting unit used Weapon/Item ID
00073e70: 00000000 nop                          |
00073e74: 2442ffb6 addiu r2,r2,-0x004a          |0x00 if First elemental gun iD
00073e78: 2c420002 sltiu r2,r2,0x0002           |Check if used weapon is an elemental gun (between 0x4a and 0x4b)
00073e7c: 14400005 bne r2,r0,0x00073e94         #If Used Weapon is Blaze gun or Glacier gun : Branch to Prep weapon strike animation section 
00073e80: 3402004c ori r2,r0,0x004c             |Blast gun ID
00073e84: 9243013a lbu r3,0x013a(r18)           |Load Acting unit used Weapon/Item ID
00073e88: 00000000 nop                          |
00073e8c: 1462000e bne r3,r2,0x00073ec8         #If Used Weapon is Not Blast gun : Branch to END (No weapon animation) This is where Ability proc avoid weapon strike
00073e90: 00000000 nop                          |
     ----Post Action : Prep weapon strike animation---- (Standard Attacks and elemental guns)
00073e94: 92620001 lbu r2,0x0001(r19)           |Load Target counter
00073e98: 00000000 nop                          |
00073e9c: 10400007 beq r2,r0,0x00073ebc         #Branch if Target count > 0x00  /Else Branch and set Target data pointer to 0x00
00073ea0: 02402021 addu r4,r18,r0                   |
00073ea4: 92640002 lbu r4,0x0002(r19)               |Load 1st Target ID
00073ea8: 0c01e9c9 jal 0x0007a724                   |-->Get_unit_misc_data_that_matches_r4_ID returns r2 = Target misc data pointer
00073eac: 00000000 nop                              |
00073eb0: 02402021 addu r4,r18,r0                   |r4 = Acting unit misc data pointer
00073eb4: 0801cfb0 j 0x00073ec0                     >>Jump to Store Attack routine with Attacker and 1 target misc pointers
00073eb8: 00402821 addu r5,r2,r0                    |r5 = 1st Target misc data pointer
00073ebc: 00002821 addu r5,r0,r0                |Store no misc Target data pointer (jump here when target count = 0)
00073ec0: 0c020a23 jal 0x0008288c               |-->Target_spritesheet_calculations%3F Set weapon strike animation
00073ec4: 00000000 nop                          |
00073ec8: 8fbf003c lw r31,0x003c(r29)       END
00073ecc: 8fb40038 lw r20,0x0038(r29)
00073ed0: 8fb30034 lw r19,0x0034(r29)
00073ed4: 8fb20030 lw r18,0x0030(r29)
00073ed8: 8fb1002c lw r17,0x002c(r29)
00073edc: 8fb00028 lw r16,0x0028(r29)
00073ee0: 27bd0040 addiu r29,r29,0x0040
00073ee4: 03e00008 jr r31
00073ee8: 00000000 nop

Return locations

Battle.bin
00073f80: Set_damage_display_type_based_on_ability
00077360: 00077314_-_00077374