Difference between revisions of "Weapon Guard Usability"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
m
m (Added a note about how this routine is used by the Player Control Routine and what it seems to be for in that case.)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
  Weapon Guard Usability (requires r4 = Target's Data Pointer)
+
  Weapon Guard Usability (more likely : Check if unit can evade, since it used in abandon too)
  0018130c: 27bdffe8 addiu r29,r29,0xffe8
+
Actually, this routine is used by the [Player Control Routine] too. Seems to be in order to check if the unit is underwater/being ridden/Don't Acted.
  00181310: afb00010 sw r16,0x0010(r29)
+
- requires r4 = Target's Data Pointer
  00181314: 00808021 addu r16,r4,r0 r16 = Target's Data Pointer
+
- returns r2 = 0x00 if unit can evade, 0x01 if can not, 0x02 if underwater (no evasion either)
  00181318: afbf0014 sw r31,0x0014(r29)
+
----------------------------------------------------------------------------------------------------
  0018131c: 9202005c lbu r2,0x005c(r16) Load [[Data/Table_Locations#Current Statuses|5th set of statuses]]
+
  0018130c: 27bdffe8 addiu r29,r29,0xffe8     |
  00181320: 00000000 nop
+
  00181310: afb00010 sw r16,0x0010(r29)       |
  00181324: 30420004 andi r2,r2,0x0004
+
  00181314: 00808021 addu r16,r4,r0           |{{f/std|<nowiki>r16 = Target's Data Pointer</nowiki>}}
  00181328: 14400020 bne r2,r0,0x001813ac Branch if Target has Don't Act
+
  00181318: afbf0014 sw r31,0x0014(r29)       |
  0018132c: 34020001 ori r2,r0,0x0001 r2 = 1
+
  0018131c: 9202005c lbu r2,0x005c(r16)       |{{f/load|<nowiki>r2 = Target 5th set of statuses </nowiki>}} /[[Data/Table_Locations#Current Statuses|5th set of statuses]]
  00181330: 92020182 lbu r2,0x0182(r16) Load [[Data/Table_Locations#Mount Info|Mount Info]]
+
  00181320: 00000000 nop                     |
  00181334: 00000000 nop
+
  00181324: 30420004 andi r2,r2,0x0004       |{{f/std|<nowiki>r2 = 0x04 if target has don't act - else 0x00</nowiki>}}
  00181338: 30420040 andi r2,r2,0x0040
+
  00181328: 14400020 bne r2,r0,0x001813ac     {{f/Cond|<nowiki>If target can act</nowiki>}} /Else Target has Don't Act - {{f/loc|<nowiki>branch to end</nowiki>}} (r2 = 0x01)
  0018133c: 1440001b bne r2,r0,0x001813ac Branch if Target is Being Ridden
+
  0018132c: 34020001 ori r2,r0,0x0001         |{{f/std|<nowiki>r2 = 0x01</nowiki>}}
  00181340: 34020001 ori r2,r0,0x0001 r2 = 1
+
  00181330: 92020182 lbu r2,0x0182(r16)           |{{f/load|<nowiki>r2 = target mount info</nowiki>}} /[[Data/Table_Locations#Mount Info|Mount Info]]
  00181344: 0c060428 jal 0x001810a0 [[Map_Location_Calculation|Map Location Calculation]] - (requires r4 = Target Data Pointer)
+
  00181334: 00000000 nop                           |
  00181348: 02002021 addu r4,r16,r0
+
  00181338: 30420040 andi r2,r2,0x0040             |{{f/std|<nowiki>r2 = 0x40 </nowiki>}}
  0018134c: 000210c0 sll r2,r2,0x03 Tile ID * 8
+
  0018133c: 1440001b bne r2,r0,0x001813ac         {{f/Cond|<nowiki>If target is not being ridden</nowiki>}} /Else Target is being ridden {{f/loc|<nowiki>Branch to end</nowiki>}} (r2 = 0x01)
  00181350: 3c018019 lui r1,0x8019
+
  00181340: 34020001 ori r2,r0,0x0001             |{{f/std|<nowiki>r2 = 1</nowiki>}}
  00181354: 00220821 addu r1,r1,r2
+
  00181344: 0c060428 jal 0x001810a0                   |{{f/jal|Map_Location_Calculation|<nowiki>Map Location Calculation</nowiki>}} Return r2 = Tile ID
  00181358: 9022f8cf lbu r2,-0x0731(r1) Load Height (halves) + Water Depth Flags
+
  00181348: 02002021 addu r4,r16,r0                   |{{f/std|<nowiki>r4 = Target data pointer</nowiki>}}
  0018135c: 00000000 nop
+
  0018134c: 000210c0 sll r2,r2,0x03                   |{{f/std|<nowiki>Tile ID * 8 (tile offset in tile data table)</nowiki>}}
  00181360: 00021142 srl r2,r2,0x05 Remove Height aspect (leave Depth)
+
  00181350: 3c018019 lui r1,0x8019                     |
  00181364: 28420002 slti r2,r2,0x0002
+
  00181354: 00220821 addu r1,r1,r2                     |{{f/std|<nowiki>r1 = 8019 + Tiles offset</nowiki>}}
  00181368: 14400010 bne r2,r0,0x001813ac Branch if Depth is less than 2
+
  00181358: 9022f8cf lbu r2,-0x0731(r1)               |{{f/load|<nowiki>r2 = Targt tile Depht + height/2 </nowiki>}} {{f/std|<nowiki>0x8018F8CC + 0x03  + tile ID*8</nowiki>}}
  0018136c: 00001021 addu r2,r0,r0 r2 = 0
+
  0018135c: 00000000 nop                               |
  00181370: 9202005a lbu r2,0x005a(r16) Load Target's [[Data/Table_Locations#Current Statuses|3rd set of statuses]]
+
  00181360: 00021142 srl r2,r2,0x05                   |{{f/std|<nowiki>r2 = tiles depht</nowiki>}}
  00181374: 00000000 nop
+
  00181364: 28420002 slti r2,r2,0x0002                 |{{f/std|<nowiki>r2 = 0x01 if depht is 0 or 1</nowiki>}}
  00181378: 30420046 andi r2,r2,0x0046
+
  00181368: 14400010 bne r2,r0,0x001813ac             {{f/Cond|<nowiki>If Depht >= 2</nowiki>}} /Else Depth <= 1 {{f/loc|<nowiki>Branch to end</nowiki>}} (r2 = 0x00)
  0018137c: 1440000b bne r2,r0,0x001813ac Branch if Target has Chicken/Frog/Float
+
  0018136c: 00001021 addu r2,r0,r0                     |{{f/std|<nowiki>r2 = 0x00</nowiki>}}
  00181380: 00001021 addu r2,r0,r0 r2 = 0
+
  00181370: 9202005a lbu r2,0x005a(r16)                   |{{f/load|<nowiki>r3 = Target 3rd set of statuses</nowiki>}} /[[Data/Table_Locations#Current Statuses|3rd set of statuses]]
  00181384: 92020095 lbu r2,0x0095(r16) Load Target's 3rd set of Movements
+
  00181374: 00000000 nop                                   |
  00181388: 00000000 nop
+
  00181378: 30420046 andi r2,r2,0x0046                     |{{f/std|<nowiki>r2 <> 0x00 if target has either chicken, frog or float</nowiki>}}
  0018138c: 304200c8 andi r2,r2,0x00c8
+
  0018137c: 1440000b bne r2,r0,0x001813ac                 {{f/Cond|<nowiki>If r2 = 0x00 (target don't have chicken, frog or float)</nowiki>}} /Else {{f/loc|<nowiki>Branch to end</nowiki>}} (r2 = 0x00)
  00181390: 14400006 bne r2,r0,0x001813ac Branch if Target has Move in/Walk on Water/Float
+
  00181380: 00001021 addu r2,r0,r0                         |{{f/std|<nowiki>r2 = 0x00</nowiki>}}
  00181394: 00001021 addu r2,r0,r0 r2 = 0
+
  00181384: 92020095 lbu r2,0x0095(r16)                       |{{f/load|<nowiki>r2 = target third set of mouvement skill</nowiki>}}
  00181398: 92020182 lbu r2,0x0182(r16) Load Target's Chocobo/? Flags
+
  00181388: 00000000 nop                                       |
  0018139c: 00000000 nop
+
  0018138c: 304200c8 andi r2,r2,0x00c8                         |{{f/std|<nowiki>r2 <> 0x00 if Branch if Target has Move in/Walk on Water/Float</nowiki>}}
  001813a0: 30420080 andi r2,r2,0x0080 Check for Riding Chocobo Flag
+
  00181390: 14400006 bne r2,r0,0x001813ac                     {{f/Cond|<nowiki>If Target is underwater</nowiki>}} /Else Target has Move in/Walk on Water/Float - {{f/loc|<nowiki>Branch to end</nowiki>}} (r2 = 0x00)
  001813a4: 2c420001 sltiu r2,r2,0x0001 r2 = 1 if not riding a chocobo
+
  00181394: 00001021 addu r2,r0,r0                             |{{f/std|<nowiki>r2 = 0x00</nowiki>}}
  001813a8: 00021040 sll r2,r2,0x01 r2 * 2
+
  00181398: 92020182 lbu r2,0x0182(r16)                           |{{f/load|<nowiki>r2 = target mount info</nowiki>}} /[[Data/Table_Locations#Mount Info|Mount Info]]
  001813ac: 8fbf0014 lw r31,0x0014(r29)
+
  0018139c: 00000000 nop                                           |
  001813b0: 8fb00010 lw r16,0x0010(r29)
+
  001813a0: 30420080 andi r2,r2,0x0080                             |{{f/std|<nowiki>r2 = 0x80 if target is ridding a unit - Else 0x00</nowiki>}}
  001813b4: 27bd0018 addiu r29,r29,0x0018
+
  001813a4: 2c420001 sltiu r2,r2,0x0001                           |{{f/std|<nowiki>r2 = 0x01 if not riding a unit - Else 0x00</nowiki>}}
  001813b8: 03e00008 jr r31
+
  001813a8: 00021040 sll r2,r2,0x01                               |{{f/std|<nowiki>r2 = 0x02 if not riding a unit </nowiki>}} - '''r2 = 0x00 if riding (can evade attack)'''
  001813bc: 00000000 nop
+
  001813ac: 8fbf0014 lw r31,0x0014(r29)                          
 +
  001813b0: 8fb00010 lw r16,0x0010(r29)                          
 +
  001813b4: 27bd0018 addiu r29,r29,0x0018                        
 +
  001813b8: 03e00008 jr r31                                      
 +
  001813bc: 00000000 nop                                          
  
  
 
== Return Locations ==
 
== Return Locations ==
 
+
'''BATTLE.bin'''
  00140534: - [[Routine at 1404cc]]
+
  00140534: - [[001404cc - 00140728]]
  00140b44: - [[Routine at 140b04]]
+
  00140b4c: - [[00140b04_-_00140cd0]]
  00140d28: - [[Routine at 140cd4]]
+
  00140d30: - [[Ability_selected_routine]]
  0017da6c: - [[MP Cost (Half of MP) Section]]
+
  0017da74: - [[Ability_Usage_Checks_and_MP_Reduction]]
  0017e1ec: - [[Routine at 17e178]]
+
  0017e1f4: - [[Main_reaction_routine%3F]]
  00181278: - [[Player Control Routine?]]
+
  00181280: - [[Player Control Routine?]]
  00183d1c: - [[Able to move/act checks (Menu?)]]
+
  00183d24: - [[Able to move/act checks (Menu?)]]
  00184fc0: - [[Equipment Evasion Setting (Physical)]]
+
  00184fc8: - [[Equipment Evasion Setting (Physical)]]
  0018538c: - [[Dark/Confuse Caclulation]]
+
  00185394: - [[Abandon_Calculation]]
  0018c94c: - [[Routine at 18c920]]
+
  0018c954: - [[Check_if_unit_can_react_1]]
 
  0018caa0: - [['Reflect', Blade Grasp, and Arrow Guard]]
 
  0018caa0: - [['Reflect', Blade Grasp, and Arrow Guard]]

Latest revision as of 19:45, 21 April 2024

Weapon Guard Usability (more likely : Check if unit can evade, since it used in abandon too)
Actually, this routine is used by the [Player Control Routine] too. Seems to be in order to check if the unit is underwater/being ridden/Don't Acted. 
- requires r4 = Target's Data Pointer
- returns r2 = 0x00 if unit can evade, 0x01 if can not, 0x02 if underwater (no evasion either)
----------------------------------------------------------------------------------------------------
0018130c: 27bdffe8 addiu r29,r29,0xffe8     |
00181310: afb00010 sw r16,0x0010(r29)       |
00181314: 00808021 addu r16,r4,r0           |r16 = Target's Data Pointer
00181318: afbf0014 sw r31,0x0014(r29)       |
0018131c: 9202005c lbu r2,0x005c(r16)       |r2 = Target 5th set of statuses  /5th set of statuses
00181320: 00000000 nop                      |
00181324: 30420004 andi r2,r2,0x0004        |r2 = 0x04 if target has don't act - else 0x00
00181328: 14400020 bne r2,r0,0x001813ac     #If target can act /Else Target has Don't Act - branch to end (r2 = 0x01)
0018132c: 34020001 ori r2,r0,0x0001         |r2 = 0x01
00181330: 92020182 lbu r2,0x0182(r16)            |r2 = target mount info /Mount Info
00181334: 00000000 nop                           |
00181338: 30420040 andi r2,r2,0x0040             |r2 = 0x40 
0018133c: 1440001b bne r2,r0,0x001813ac          #If target is not being ridden /Else Target is being ridden Branch to end (r2 = 0x01)
00181340: 34020001 ori r2,r0,0x0001              |r2 = 1
00181344: 0c060428 jal 0x001810a0                    |-->Map Location Calculation Return r2 = Tile ID
00181348: 02002021 addu r4,r16,r0                    |r4 = Target data pointer
0018134c: 000210c0 sll r2,r2,0x03                    |Tile ID * 8 (tile offset in tile data table)
00181350: 3c018019 lui r1,0x8019                     |
00181354: 00220821 addu r1,r1,r2                     |r1 = 8019 + Tiles offset
00181358: 9022f8cf lbu r2,-0x0731(r1)                |r2 = Targt tile Depht + height/2  0x8018F8CC + 0x03  + tile ID*8
0018135c: 00000000 nop                               |
00181360: 00021142 srl r2,r2,0x05                    |r2 = tiles depht
00181364: 28420002 slti r2,r2,0x0002                 |r2 = 0x01 if depht is 0 or 1
00181368: 14400010 bne r2,r0,0x001813ac              #If Depht >= 2 /Else Depth <= 1 Branch to end (r2 = 0x00)
0018136c: 00001021 addu r2,r0,r0                     |r2 = 0x00
00181370: 9202005a lbu r2,0x005a(r16)                    |r3 = Target 3rd set of statuses /3rd set of statuses
00181374: 00000000 nop                                   |
00181378: 30420046 andi r2,r2,0x0046                     |r2 <> 0x00 if target has either chicken, frog or float
0018137c: 1440000b bne r2,r0,0x001813ac                  #If r2 = 0x00 (target don't have chicken, frog or float) /Else Branch to end (r2 = 0x00)
00181380: 00001021 addu r2,r0,r0                         |r2 = 0x00
00181384: 92020095 lbu r2,0x0095(r16)                        |r2 = target third set of mouvement skill
00181388: 00000000 nop                                       |
0018138c: 304200c8 andi r2,r2,0x00c8                         |r2 <> 0x00 if Branch if Target has Move in/Walk on Water/Float
00181390: 14400006 bne r2,r0,0x001813ac                      #If Target is underwater /Else Target has Move in/Walk on Water/Float - Branch to end (r2 = 0x00)
00181394: 00001021 addu r2,r0,r0                             |r2 = 0x00
00181398: 92020182 lbu r2,0x0182(r16)                            |r2 = target mount info /Mount Info
0018139c: 00000000 nop                                           |
001813a0: 30420080 andi r2,r2,0x0080                             |r2 = 0x80 if target is ridding a unit - Else 0x00
001813a4: 2c420001 sltiu r2,r2,0x0001                            |r2 = 0x01 if not riding a unit - Else 0x00
001813a8: 00021040 sll r2,r2,0x01                                |r2 = 0x02 if not riding a unit  - r2 = 0x00 if riding (can evade attack)
001813ac: 8fbf0014 lw r31,0x0014(r29)                            
001813b0: 8fb00010 lw r16,0x0010(r29)                            
001813b4: 27bd0018 addiu r29,r29,0x0018                          
001813b8: 03e00008 jr r31                                        
001813bc: 00000000 nop                                           


Return Locations

BATTLE.bin
00140534: - 001404cc - 00140728
00140b4c: - 00140b04_-_00140cd0
00140d30: - Ability_selected_routine
0017da74: - Ability_Usage_Checks_and_MP_Reduction
0017e1f4: - Main_reaction_routine?
00181280: - Player Control Routine?
00183d24: - Able to move/act checks (Menu?)
00184fc8: - Equipment Evasion Setting (Physical)
00185394: - Abandon_Calculation
0018c954: - Check_if_unit_can_react_1
0018caa0: - 'Reflect', Blade Grasp, and Arrow Guard