Difference between revisions of "Store target stats pointer data"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
m
 
Line 1: Line 1:
Handles recoil?
+
'''BATTLE.BIN''' :  - Store_target_stats_pointer_data
   
+
Use Passed Unit ID as Target, then copy data from 0x80192da0 to Target Action data and call Attack finalization (Handles recoil?)
  0018d70c: 27bdffe8 addiu r29,r29,0xffe8
+
------------------------------------------------------------------------------------------
  0018d710: afb00010 sw r16,0x0010(r29)
+
Parameter : r4 = Unit ID
  0018d714: 00808021 addu r16,r4,r0
+
  Return : r2 = -0x01 if invalid data
  0018d718: 001010c0 sll r2,r16,0x03
+
          r2 = 0x00 if no invalid data
  0018d71c: 00501023 subu r2,r2,r16
+
------------------------------------------------------------------------------------------
  0018d720: 00022980 sll r5,r2,0x06
+
  0018d70c: 27bdffe8 addiu r29,r29,-0x0018    |
  0018d724: 3c048019 lui r4,0x8019
+
  0018d710: afb00010 sw r16,0x0010(r29)       |
  0018d728: 248408cc addiu r4,r4,0x08cc                 unit battle data table
+
  0018d714: 00808021 addu r16,r4,r0           |{{f/std|Preserve Unit ID}}
  0018d72c: 00a41821 addu r3,r5,r4
+
  0018d718: 001010c0 sll r2,r16,0x03           |
  0018d730: 2a020015 slti r2,r16,0x0015
+
  0018d71c: 00501023 subu r2,r2,r16           |
  0018d734: afbf0014 sw r31,0x0014(r29)
+
  0018d720: 00022980 sll r5,r2,0x06           |
  0018d738: 3c018019 lui r1,0x8019
+
  0018d724: 3c048019 lui r4,0x8019             |
  0018d73c: ac232d98 sw r3,0x2d98(r1)                   store caster as target data pointer
+
  0018d728: 248408cc addiu r4,r4,0x08cc       |
  0018d740: 1040000a beq r2,r0,0x0018d76c
+
  0018d72c: 00a41821 addu r3,r5,r4             |{{f/adr|Pointer to Considered Unit Battle}}
  0018d744: 2482018c addiu r2,r4,0x018c
+
  0018d730: 2a020015 slti r2,r16,0x0015       |
  0018d748: 00a22821 addu r5,r5,r2
+
  0018d734: afbf0014 sw r31,0x0014(r29)       |
  0018d74c: 3c018019 lui r1,0x8019
+
  0018d738: 3c018019 lui r1,0x8019             |
  0018d750: a03038c1 sb r16,0x38c1(r1) store caster as target ID
+
  0018d73c: ac232d98 sw r3,0x2d98(r1)         |{{f/store|Set  Considered Unit Pointer as Target data Pointer}}
  0018d754: 3c018019 lui r1,0x8019
+
  0018d740: 1040000a beq r2,r0,0x0018d76c     {{f/Cond|If Unit ID is invalid : }} {{f/loc|Exit}} {{f/Returns|Returns -0x01}}
  0018d758: ac252d90 sw r5,0x2d90(r1) store target current action pointer
+
  0018d744: 2482018c addiu r2,r4,0x018c       |
  0018d75c: 90630001 lbu r3,0x0001(r3) load target unit ID
+
  0018d748: 00a22821 addu r5,r5,r2             |
  0018d760: 340200ff ori r2,r0,0x00ff
+
  0018d74c: 3c018019 lui r1,0x8019             |
  0018d764: 14620003 bne r3,r2,0x0018d774 if target exists, branch
+
  0018d750: a03038c1 sb r16,0x38c1(r1)         |{{f/store|Store Considered Unit ID as Target ID}}
  0018d768: 00000000 nop
+
  0018d754: 3c018019 lui r1,0x8019             |
  0018d76c: 080635ed j 0x0018d7b4
+
  0018d758: ac252d90 sw r5,0x2d90(r1)         |{{f/store|Set  Considered Unit action data Pointer as Target current action data Pointer}}
  0018d770: 2402ffff addiu r2,r0,0xffff
+
  0018d75c: 90630001 lbu r3,0x0001(r3)         |{{f/load|Load target unit ID}}
  0018d774: 3c048019 lui r4,0x8019
+
  0018d760: 340200ff ori r2,r0,0x00ff         |
  0018d778: 24842da0 addiu r4,r4,0x2da0 Attacker current action data copy
+
  0018d764: 14620003 bne r3,r2,0x0018d774     {{f/Cond|<nowiki>If Target do not exist (ID = 0xff)</nowiki>}}
  0018d77c: 0c017895 jal 0x0005e254 [[Store_X_Byte_into_Y]]
+
  0018d768: 00000000 nop                           |
  0018d780: 3406002c ori r6,r0,0x002c
+
  0018d76c: 080635ed j 0x0018d7b4                 |{{f/loc|Exit}} {{f/Returns|Returns - 0x01}}
  0018d784: 0c062f82 jal 0x0018be08 [[Attack Finalisation & Reaction Flagging]]
+
  0018d770: 2402ffff addiu r2,r0,-0x0001          |
  0018d788: 02002021 addu r4,r16,r0
+
                                              '''Else : Target exists'''
  0018d78c: 3c048019 lui r4,0x8019
+
  0018d774: 3c048019 lui r4,0x8019                 |
  0018d790: 8c842d90 lw r4,0x2d90(r4)
+
  0018d778: 24842da0 addiu r4,r4,0x2da0           |{{f/std|Attacker current action data copy}}
  0018d794: 00000000 nop
+
  0018d77c: 0c017895 jal 0x0005e254               |{{f/jal|Store_X_Byte_into_Y|Store_X_Byte_into_Y}} {{f/std|Transfer data from 0x80192da0 to Considered Unit action data}}
  0018d798: 90830000 lbu r3,0x0000(r4) load hit?
+
  0018d780: 3406002c ori r6,r0,0x002c             |
  0018d79c: 00000000 nop
+
  0018d784: 0c062f82 jal 0x0018be08               |{{f/jal|Attack Finalisation & Reaction Flagging|Attack Finalisation & Reaction Flagging}}
  0018d7a0: 14600003 bne r3,r0,0x0018d7b0 branch if attack hit
+
  0018d788: 02002021 addu r4,r16,r0               |
  0018d7a4: 00402821 addu r5,r2,r0
+
  0018d78c: 3c048019 lui r4,0x8019                 |
  0018d7a8: 34020008 ori r2,r0,0x0008
+
  0018d790: 8c842d90 lw r4,0x2d90(r4)             |{{f/adr|Pointer to Target current action data}}
  0018d7ac: a0820002 sb r2,0x0002(r4) store evade type = cancelled by status
+
  0018d794: 00000000 nop                           |
  0018d7b0: 00a01021 addu r2,r5,r0
+
  0018d798: 90830000 lbu r3,0x0000(r4)             |{{f/load|Hit flag}}
 +
  0018d79c: 00000000 nop                           |
 +
  0018d7a0: 14600003 bne r3,r0,0x0018d7b0         {{f/Cond|If Unit is not hit}}
 +
  0018d7a4: 00402821 addu r5,r2,r0                     |
 +
  0018d7a8: 34020008 ori r2,r0,0x0008                 |
 +
  0018d7ac: a0820002 sb r2,0x0002(r4)                 |{{f/store|<nowiki>store evade type = canceled by status</nowiki>}}
 +
  0018d7b0: 00a01021 addu r2,r5,r0                 |{{f/Returns|Return Last routine result}}
 
  0018d7b4: 8fbf0014 lw r31,0x0014(r29)
 
  0018d7b4: 8fbf0014 lw r31,0x0014(r29)
 
  0018d7b8: 8fb00010 lw r16,0x0010(r29)
 
  0018d7b8: 8fb00010 lw r16,0x0010(r29)
Line 48: Line 54:
 
  0018d7c0: 03e00008 jr r31
 
  0018d7c0: 03e00008 jr r31
 
  0018d7c4: 00000000 nop
 
  0018d7c4: 00000000 nop
</font>
+
===Return locations===
 +
'''BATTLE.BIN'''
 +
  00073274: [[00073250_-_000732c4]]
 +
  0019e054: [[AI_ability_processing]]

Latest revision as of 19:36, 23 May 2024

BATTLE.BIN :  - Store_target_stats_pointer_data
Use Passed Unit ID as Target, then copy data from 0x80192da0 to Target Action data and call Attack finalization (Handles recoil?)
------------------------------------------------------------------------------------------
Parameter : r4 = Unit ID
Return : r2 = -0x01 if invalid data
         r2 = 0x00 if no invalid data
------------------------------------------------------------------------------------------
0018d70c: 27bdffe8 addiu r29,r29,-0x0018     |
0018d710: afb00010 sw r16,0x0010(r29)        |
0018d714: 00808021 addu r16,r4,r0            |Preserve Unit ID
0018d718: 001010c0 sll r2,r16,0x03           |
0018d71c: 00501023 subu r2,r2,r16            |
0018d720: 00022980 sll r5,r2,0x06            |
0018d724: 3c048019 lui r4,0x8019             |
0018d728: 248408cc addiu r4,r4,0x08cc        |
0018d72c: 00a41821 addu r3,r5,r4             |Pointer to Considered Unit Battle
0018d730: 2a020015 slti r2,r16,0x0015        |
0018d734: afbf0014 sw r31,0x0014(r29)        |
0018d738: 3c018019 lui r1,0x8019             |
0018d73c: ac232d98 sw r3,0x2d98(r1)          |Set  Considered Unit Pointer as Target data Pointer
0018d740: 1040000a beq r2,r0,0x0018d76c      #If Unit ID is invalid :  Exit Returns -0x01
0018d744: 2482018c addiu r2,r4,0x018c        |
0018d748: 00a22821 addu r5,r5,r2             |
0018d74c: 3c018019 lui r1,0x8019             |
0018d750: a03038c1 sb r16,0x38c1(r1)         |Store Considered Unit ID as Target ID
0018d754: 3c018019 lui r1,0x8019             |
0018d758: ac252d90 sw r5,0x2d90(r1)          |Set  Considered Unit action data Pointer as Target current action data Pointer
0018d75c: 90630001 lbu r3,0x0001(r3)         |Load target unit ID
0018d760: 340200ff ori r2,r0,0x00ff          |
0018d764: 14620003 bne r3,r2,0x0018d774      #If Target do not exist (ID = 0xff)
0018d768: 00000000 nop                           |
0018d76c: 080635ed j 0x0018d7b4                  |Exit Returns - 0x01
0018d770: 2402ffff addiu r2,r0,-0x0001           |
                                             Else : Target exists
0018d774: 3c048019 lui r4,0x8019                 |
0018d778: 24842da0 addiu r4,r4,0x2da0            |Attacker current action data copy
0018d77c: 0c017895 jal 0x0005e254                |-->Store_X_Byte_into_Y Transfer data from 0x80192da0 to Considered Unit action data
0018d780: 3406002c ori r6,r0,0x002c              |
0018d784: 0c062f82 jal 0x0018be08                |-->Attack Finalisation & Reaction Flagging
0018d788: 02002021 addu r4,r16,r0                |
0018d78c: 3c048019 lui r4,0x8019                 |
0018d790: 8c842d90 lw r4,0x2d90(r4)              |Pointer to Target current action data
0018d794: 00000000 nop                           |
0018d798: 90830000 lbu r3,0x0000(r4)             |Hit flag
0018d79c: 00000000 nop                           |
0018d7a0: 14600003 bne r3,r0,0x0018d7b0          #If Unit is not hit
0018d7a4: 00402821 addu r5,r2,r0                     |
0018d7a8: 34020008 ori r2,r0,0x0008                  |
0018d7ac: a0820002 sb r2,0x0002(r4)                  |store evade type = canceled by status
0018d7b0: 00a01021 addu r2,r5,r0                 |Return Last routine result
0018d7b4: 8fbf0014 lw r31,0x0014(r29)
0018d7b8: 8fb00010 lw r16,0x0010(r29)
0018d7bc: 27bd0018 addiu r29,r29,0x0018
0018d7c0: 03e00008 jr r31
0018d7c4: 00000000 nop

Return locations

BATTLE.BIN
 00073274: 00073250_-_000732c4
 0019e054: AI_ability_processing