Difference between revisions of "Prep Current Action Data"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
m
m
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
<font face='Courier New'>
+
'''0017c9b8 - 0017cac8'''
 
   
 
   
  0017c9b8: 27bdffd8 addiu r29,r29,0xffd8
+
  '''Parameters''' : r4 = Acting unit's ID
0017c9bc: afb20018 sw r18,0x0018(r29)
 
0017c9c0: 00809021 addu r18,r4,r0
 
0017c9c4: 2402ffff addiu r2,r0,0xffff
 
0017c9c8: 3c018019 lui r1,0x8019
 
0017c9cc: ac22f8c8 sw r2,-0x0738(r1) clear acting unit ID
 
0017c9d0: 2a420015 slti r2,r18,0x0015
 
0017c9d4: afbf0020 sw r31,0x0020(r29)
 
0017c9d8: afb3001c sw r19,0x001c(r29)
 
0017c9dc: afb10014 sw r17,0x0014(r29)
 
0017c9e0: afb00010 sw r16,0x0010(r29)
 
0017c9e4: 3c018019 lui r1,0x8019
 
0017c9e8: ac20f5f0 sw r0,-0x0a10(r1) type of action = pre attack/initial attack
 
0017c9ec: 1040000a beq r2,r0,0x0017ca18 branch if unit not in party?
 
0017c9f0: 001210c0 sll r2,r18,0x03
 
0017c9f4: 00521023 subu r2,r2,r18
 
0017c9f8: 00021180 sll r2,r2,0x06
 
0017c9fc: 3c138019 lui r19,0x8019
 
0017ca00: 267308cc addiu r19,r19,0x08cc
 
0017ca04: 00538021 addu r16,r2,r19 r16 = unit data
 
0017ca08: 92030001 lbu r3,0x0001(r16)
 
0017ca0c: 340200ff ori r2,r0,0x00ff
 
0017ca10: 14620003 bne r3,r2,0x0017ca20 unit exists check
 
0017ca14: 00000000 nop
 
0017ca18: 0805f2ab j 0x0017caac jump to end, return r2 = FF, fail
 
0017ca1c: 2402ffff addiu r2,r0,0xffff
 
0017ca20: 3c028019 lui r2,0x8019
 
0017ca24: 8c4238bc lw r2,0x38bc(r2) load unknown byte (reacting?)
 
0017ca28: 00000000 nop
 
0017ca2c: 10400005 beq r2,r0,0x0017ca44 jump to ability usage checks
 
0017ca30: 00000000 nop
 
0017ca34: 0c05f6f2 jal 0x0017dbc8 Store target data for reaction (acting unit data)
 
0017ca38: 02002021 addu r4,r16,r0
 
0017ca3c: 0805f2ab j 0x0017caac Jump to end, return r2 = 6
 
0017ca40: 34020006 ori r2,r0,0x0006
 
0017ca44: 0c05f688 jal 0x0017da20 [[Ability Usage Checks and MP Reduction]]
 
0017ca48: 02002021 addu r4,r16,r0
 
0017ca4c: 00408821 addu r17,r2,r0
 
0017ca50: 12200005 beq r17,r0,0x0017ca68 branch if ability can be used (MP cost is sufficient, unit is not silenced, attempting to cast frog as frog, etc.)
 
0017ca54: 00002021 addu r4,r0,r0
 
0017ca58: 0c05f6f2 jal 0x0017dbc8 store target data
 
0017ca5c: 02002021 addu r4,r16,r0
 
0017ca60: 0805f2ab j 0x0017caac jump to end
 
0017ca64: 02201021 addu r2,r17,r0 return usage checks
 
 
   
 
   
  Ability can be used:
+
  '''Returns''' : r2 = 0x00 If Ability is used (and updated)
  0017ca68: 96020170 lhu r2,0x0170(r16) Load attacker's ability
+
          -- All cases bellow abort action -- (Attacker 0x16e to 0x181 are cleared)
  0017ca6c: 02601821 addu r3,r19,r0 Start of battle data
+
          r2 = 0x08 if Unit is in deep water
  0017ca70: 3c018019 lui r1,0x8019
+
          r2 = 0x07 if unit can't act
  0017ca74: ac32f8c8 sw r18,-0x0738(r1) store acting unit id
+
          r2 = 0x06 If Hamedo is triggered (no action)
  0017ca78: 3c018019 lui r1,0x8019
+
          r2 = 0x05 if unit is a frog attempting to do non frog things
  0017ca7c: a4223d44 sh r2,0x3d44(r1) store attack used
+
          r2 = 0x03 if unit does not have enough MP (And action menu = default)
  0017ca80: a460019a sh r0,0x019a(r3) clear reaction ID
+
          r2 = 0x02 if unit is silenced and [Action menu = default or monster] and [Ability is silencable]
  0017ca84: a0600189 sb r0,0x0189(r3) clear mid turn actions (reacting, learning abilities, being hit by ability?)
+
  0017ca88: 24840001 addiu r4,r4,0x0001
+
'''Store some ability data '''([[#Notes|See Notes]])
  0017ca8c: 28820015 slti r2,r4,0x0015
+
-----------------------------------------------------------------------------------------------------------------------
  0017ca90: 1440fffb bne r2,r0,0x0017ca80 cycle through each unit
+
0017c9b8: 27bdffd8 addiu r29,r29,-0x0028    |
  0017ca94: 246301c0 addiu r3,r3,0x01c0 next unit's battle data table
+
0017c9bc: afb20018 sw r18,0x0018(r29)      |
  0017ca98: 0c05f528 jal 0x0017d4a0 [[Current Action Ability Data Setting / Multi Hit Formulas]]
+
0017c9c0: 00809021 addu r18,r4,r0          |{{f/std|<nowiki>r18 = Acting unit ID</nowiki>}}
  0017ca9c: 02002021 addu r4,r16,r0
+
0017c9c4: 2402ffff addiu r2,r0,0xffff      |{{f/std|<nowiki>r2 = -0x0001</nowiki>}}
  0017caa0: 0c063bcd jal 0x0018ef34 [[Current Action Attacker Data Setting]]
+
0017c9c8: 3c018019 lui r1,0x8019            |
  0017caa4: 02002021 addu r4,r16,r0 r4 = units action pointer
+
0017c9cc: ac22f8c8 sw r2,-0x0738(r1)        |{{f/store|<nowiki>clear acting unit ID</nowiki>}} {{f/std|<nowiki> 0x8018f8c8 / 8018f8c8</nowiki>}}
  0017caa8: 00001021 addu r2,r0,r0
+
0017c9d0: 2a420015 slti r2,r18,0x0015      |{{f/std|<nowiki>r2 = 0x01 if Acting unit ID < 0x15 (valid)</nowiki>}}
  0017caac: 8fbf0020 lw r31,0x0020(r29)
+
0017c9d4: afbf0020 sw r31,0x0020(r29)      |
  0017cab0: 8fb3001c lw r19,0x001c(r29)
+
0017c9d8: afb3001c sw r19,0x001c(r29)      |
  0017cab4: 8fb20018 lw r18,0x0018(r29)
+
0017c9dc: afb10014 sw r17,0x0014(r29)      |
  0017cab8: 8fb10014 lw r17,0x0014(r29)
+
0017c9e0: afb00010 sw r16,0x0010(r29)      |
  0017cabc: 8fb00010 lw r16,0x0010(r29)
+
0017c9e4: 3c018019 lui r1,0x8019            |
  0017cac0: 27bd0028 addiu r29,r29,0x0028
+
0017c9e8: ac20f5f0 sw r0,-0x0a10(r1)        |{{f/store|<nowiki>Set Type of action = 0x00 (not reacting)</nowiki>}} {{f/std|<nowiki> 0x8018f5f0 / 8018f5f0</nowiki>}}
  0017cac4: 03e00008 jr r31
+
0017c9ec: 1040000a beq r2,r0,0x0017ca18    {{f/Cond|<nowiki>If Acting unit ID is valid (<0x15)</nowiki>}} /Else branch to {{f/loc|<nowiki>END</nowiki>}} With r2 = -0x01 (via jump)
  0017cac8: 00000000 nop
+
0017c9f0: 001210c0 sll r2,r18,0x03              |{{f/std|<nowiki>r2 = acting unit ID * 8</nowiki>}}
</font>
+
0017c9f4: 00521023 subu r2,r2,r18                |{{f/std|<nowiki>r2 = acting unit ID *7</nowiki>}}
 +
0017c9f8: 00021180 sll r2,r2,0x06                |{{f/std|<nowiki>r2 = acting unit ID * 0x1c0</nowiki>}}
 +
0017c9fc: 3c138019 lui r19,0x8019                |
 +
0017ca00: 267308cc addiu r19,r19,0x08cc          |{{f/std|<nowiki>r19 = 0x801908cc (start of units data)</nowiki>}}
 +
0017ca04: 00538021 addu r16,r2,r19              |{{f/adr|<nowiki>r16 = Acting Unit data</nowiki>}}
 +
0017ca08: 92030001 lbu r3,0x0001(r16)            |{{f/load|<nowiki>r3 = Acting Unit ID (0xff if doesn't exists)</nowiki>}}
 +
0017ca0c: 340200ff ori r2,r0,0x00ff              |{{f/std|<nowiki>r2 = 0xff</nowiki>}}
 +
0017ca10: 14620003 bne r3,r2,0x0017ca20          {{f/Cond|<nowiki>If Unit Doesn't exists</nowiki>}} /Else avoid jump to end
 +
0017ca14: 00000000 nop                              |
 +
0017ca18: 0805f2ab j 0x0017caac            {{f/Cond|<nowiki>E</nowiki>}}      {{f/jump|<nowiki>jump to end, return r2 = -0x01</nowiki>}}
 +
0017ca1c: 2402ffff addiu r2,r0,-0x0001              |{{f/std|<nowiki>r2 = -0x01</nowiki>}}
 +
0017ca20: 3c028019 lui r2,0x8019            {{f/Cond|<nowiki>Else (Unit ID < 0x15 and <> 0xff)</nowiki>}}
 +
0017ca24: 8c4238bc lw r2,0x38bc(r2)        |{{f/adr|<nowiki>r2 = Hamedo flag</nowiki>}} {{f/std|<nowiki> 0x801938bc / 801938bc</nowiki>}}
 +
0017ca28: 00000000 nop                      |
 +
0017ca2c: 10400005 beq r2,r0,0x0017ca44    {{f/Cond|<nowiki>If Hamedo is triggered </nowiki>}}
 +
0017ca30: 00000000 nop                          |{{f/std|<nowiki> </nowiki>}}
 +
0017ca34: 0c05f6f2 jal 0x0017dbc8                |{{f/jal|Store_Some_Acting_Unit_Data|<nowiki>Store_Some_Acting_Unit_Data</nowiki>}}  Nullify Acting unit 0x16e to 0x181
 +
0017ca38: 02002021 addu r4,r16,r0                |{{f/adr|<nowiki>r4 = Acting Unit data</nowiki>}}
 +
0017ca3c: 0805f2ab j 0x0017caac                  {{f/jump|<nowiki>Jump to </nowiki>{{f/loc|<nowiki>END</nowiki>}}<nowiki> (return r2 = 0x06)</nowiki>}}
 +
0017ca40: 34020006 ori r2,r0,0x0006              |{{f/std|<nowiki>r2 = 0x06</nowiki>}}
 +
0017ca44: 0c05f688 jal 0x0017da20          {{f/Cond|<nowiki>Else (No Hamedo)</nowiki>}} {{f/jal|Ability Usage Checks and MP Reduction|<nowiki>Ability Usage Checks and MP Reduction</nowiki>}} Returns r2 = 0x00 if ok / Else something went wrong (lot of values)
 +
0017ca48: 02002021 addu r4,r16,r0          |{{f/adr|<nowiki>r4 = Acting Unit data</nowiki>}}
 +
0017ca4c: 00408821 addu r17,r2,r0          |{{f/std|<nowiki>r17 = Returned value of Above jal</nowiki>}}
 +
 +
'''Ability can not be used:'''
 +
0017ca50: 12200005 beq r17,r0,0x0017ca68    {{f/Cond|<nowiki>If Ability can not be used</nowiki>}} /Branch if ability can be used (MP cost is sufficient, unit is not silenced, attempting to cast frog as frog, etc.)
 +
0017ca54: 00002021 addu r4,r0,r0            |{{f/std|<nowiki>r4 = 0x00 (counter for next loop)</nowiki>}}
 +
0017ca58: 0c05f6f2 jal 0x0017dbc8                |{{f/jal|Store_Some_Acting_Unit_Data|<nowiki>Store_Some_Acting_Unit_Data</nowiki>}}  Nullify Acting unit 0x16e to 0x181
 +
0017ca5c: 02002021 addu r4,r16,r0                |{{f/adr|<nowiki>r4 = Acting Unit data</nowiki>}}
 +
0017ca60: 0805f2ab j 0x0017caac                  {{f/jump|<nowiki>jump to </nowiki>{{f/loc|<nowiki>END</nowiki>}}<nowiki> returning [Ability Usage Checks and MP Reduction] returned value</nowiki>}}
 +
0017ca64: 02201021 addu r2,r17,r0                |{{f/std|<nowiki>r2 =  [Ability Usage Checks and MP Reduction] returned value</nowiki>}}
 +
 +
'''Ability can be used:'''
 +
  0017ca68: 96020170 lhu r2,0x0170(r16)       {{f/Cond|<nowiki>Else (Ability is used)</nowiki>}} {{f/load|<nowiki>r2 = Acting unit Used Ability</nowiki>}}
 +
  0017ca6c: 02601821 addu r3,r19,r0           |{{f/std|<nowiki>r3 = Start of unit data ( 0x801908cc)</nowiki>}}
 +
  0017ca70: 3c018019 lui r1,0x8019           |
 +
  0017ca74: ac32f8c8 sw r18,-0x0738(r1)       |{{f/store|<nowiki>Store Acting unit's raw ID at 0x8018f8c8</nowiki>}}
 +
  0017ca78: 3c018019 lui r1,0x8019           |
 +
  0017ca7c: a4223d44 sh r2,0x3d44(r1)         |{{f/store|<nowiki>Store Acting unit's used ability at 0x80193d44</nowiki>}}
 +
  0017ca80: a460019a sh r0,0x019a(r3)         {{f/bloop|<nowiki>LOOP</nowiki>}} {{f/store|<nowiki>Clear Acting unit's Current Action's reaction ID</nowiki>}}
 +
  0017ca84: a0600189 sb r0,0x0189(r3)             |{{f/store|<nowiki>Clear Acting unit's Current Action 0x189</nowiki>}} {{f/std|<nowiki> clear mid turn actions (reacting, learning abilities, being hit by ability?)</nowiki>}}
 +
  0017ca88: 24840001 addiu r4,r4,0x0001           |{{f/std|<nowiki>r4 = 0x01 (loop counter +1)</nowiki>}}
 +
  0017ca8c: 28820015 slti r2,r4,0x0015             |{{f/std|<nowiki>r2 = 0x01 if Acting unit ID < 0x15 (valid)</nowiki>}}
 +
  0017ca90: 1440fffb bne r2,r0,0x0017ca80     {{f/eloop|<nowiki>loop while counter < 0x15 (each unit)</nowiki>}}
 +
  0017ca94: 246301c0 addiu r3,r3,0x01c0           |{{f/std|<nowiki>r3 = Unit Data offset counter (+0x1c0 each iteration)</nowiki>}}
 +
  0017ca98: 0c05f528 jal 0x0017d4a0           |{{f/jal|Current Action Ability Data Setting / Multi Hit Formulas|<nowiki>Current Action Ability Data Setting / Multi Hit Formulas</nowiki>}}  Set some ability data (weapon - hit counter …)
 +
  0017ca9c: 02002021 addu r4,r16,r0           |{{f/adr|<nowiki>r4 = Acting Unit data</nowiki>}}
 +
  0017caa0: 0c063bcd jal 0x0018ef34           |{{f/jal|Current Action Attacker Data Setting|<nowiki>Current Action Attacker Data Setting</nowiki>}}  Set some ability data (Target coordinates..)
 +
  0017caa4: 02002021 addu r4,r16,r0           |{{f/adr|<nowiki>r4 = Acting Unit data</nowiki>}}
 +
  0017caa8: 00001021 addu r2,r0,r0           |{{f/std|<nowiki>r2 = 0x00</nowiki>}}
 +
  0017caac: 8fbf0020 lw r31,0x0020(r29)      
 +
  0017cab0: 8fb3001c lw r19,0x001c(r29)      
 +
  0017cab4: 8fb20018 lw r18,0x0018(r29)      
 +
  0017cab8: 8fb10014 lw r17,0x0014(r29)      
 +
  0017cabc: 8fb00010 lw r16,0x0010(r29)      
 +
  0017cac0: 27bd0028 addiu r29,r29,0x0028    
 +
  0017cac4: 03e00008 jr r31                  
 +
  0017cac8: 00000000 nop                    
 +
=== Notes ===
 +
Set 0x8018f5f0 to 0x00 (not reacting)
 +
Set 0x8018f8c8 to 0x00 if Action is not taken (r2 <> 0x00)
 +
                to Acting unit raw ID (Unit 0x18a) if Action is taken (r2 = 0x00)
 +
 +
If Action is taken (ability used)
 +
  Store Acting unit used ability (0x170) at 0x80193d44
 +
  Clear Every unit 0x189 (Target's event ?)
 +
  Clear Every unit 0x19a (Reaction ID)
 +
  Other Ability's data are set in
 +
    [[Current_Action_Ability_Data_Setting_/_Multi_Hit_Formulas#Notes|Current_Action_Ability_Data_Setting_/_Multi_Hit_Formulas]]
 +
    [[Current_Action_Attacker_Data_Setting#Notes|Current_Action_Attacker_Data_Setting]]
 +
 
 +
=== Return Locations ===
 +
'''Battle.bin'''
 +
00073a68: [[Action_phase_control]]
 +
0019ddd8: [[AI_ability_processing]]

Latest revision as of 19:53, 21 May 2024

0017c9b8 - 0017cac8

Parameters : r4 = Acting unit's ID

Returns : r2 = 0x00 If Ability is used (and updated)
          -- All cases bellow abort action -- (Attacker 0x16e to 0x181 are cleared)
          r2 = 0x08 if Unit is in deep water
          r2 = 0x07 if unit can't act
          r2 = 0x06 If Hamedo is triggered (no action)
          r2 = 0x05 if unit is a frog attempting to do non frog things
          r2 = 0x03 if unit does not have enough MP (And action menu = default)
          r2 = 0x02 if unit is silenced and [Action menu = default or monster] and [Ability is silencable]

Store some ability data (See Notes)
-----------------------------------------------------------------------------------------------------------------------
0017c9b8: 27bdffd8 addiu r29,r29,-0x0028    |
0017c9bc: afb20018 sw r18,0x0018(r29)       |
0017c9c0: 00809021 addu r18,r4,r0           |r18 = Acting unit ID
0017c9c4: 2402ffff addiu r2,r0,0xffff       |r2 = -0x0001
0017c9c8: 3c018019 lui r1,0x8019            |
0017c9cc: ac22f8c8 sw r2,-0x0738(r1)        |clear acting unit ID  0x8018f8c8 / 8018f8c8
0017c9d0: 2a420015 slti r2,r18,0x0015       |r2 = 0x01 if Acting unit ID < 0x15 (valid)
0017c9d4: afbf0020 sw r31,0x0020(r29)       |
0017c9d8: afb3001c sw r19,0x001c(r29)       |
0017c9dc: afb10014 sw r17,0x0014(r29)       |
0017c9e0: afb00010 sw r16,0x0010(r29)       |
0017c9e4: 3c018019 lui r1,0x8019            |
0017c9e8: ac20f5f0 sw r0,-0x0a10(r1)        |Set Type of action = 0x00 (not reacting)  0x8018f5f0 / 8018f5f0
0017c9ec: 1040000a beq r2,r0,0x0017ca18     #If Acting unit ID is valid (<0x15) /Else branch to END With r2 = -0x01 (via jump)
0017c9f0: 001210c0 sll r2,r18,0x03               |r2 = acting unit ID * 8
0017c9f4: 00521023 subu r2,r2,r18                |r2 = acting unit ID *7
0017c9f8: 00021180 sll r2,r2,0x06                |r2 = acting unit ID * 0x1c0
0017c9fc: 3c138019 lui r19,0x8019                |
0017ca00: 267308cc addiu r19,r19,0x08cc          |r19 = 0x801908cc (start of units data)
0017ca04: 00538021 addu r16,r2,r19               |r16 = Acting Unit data
0017ca08: 92030001 lbu r3,0x0001(r16)            |r3 = Acting Unit ID (0xff if doesn't exists)
0017ca0c: 340200ff ori r2,r0,0x00ff              |r2 = 0xff
0017ca10: 14620003 bne r3,r2,0x0017ca20          #If Unit Doesn't exists /Else avoid jump to end
0017ca14: 00000000 nop                               |
0017ca18: 0805f2ab j 0x0017caac             #E       >>jump to end, return r2 = -0x01
0017ca1c: 2402ffff addiu r2,r0,-0x0001               |r2 = -0x01
0017ca20: 3c028019 lui r2,0x8019            #Else (Unit ID < 0x15 and <> 0xff)
0017ca24: 8c4238bc lw r2,0x38bc(r2)         |r2 = Hamedo flag  0x801938bc / 801938bc
0017ca28: 00000000 nop                      |
0017ca2c: 10400005 beq r2,r0,0x0017ca44     #If Hamedo is triggered 
0017ca30: 00000000 nop                           | 
0017ca34: 0c05f6f2 jal 0x0017dbc8                |-->Store_Some_Acting_Unit_Data  Nullify Acting unit 0x16e to 0x181 
0017ca38: 02002021 addu r4,r16,r0                |r4 = Acting Unit data
0017ca3c: 0805f2ab j 0x0017caac                  >>Jump to END (return r2 = 0x06)
0017ca40: 34020006 ori r2,r0,0x0006              |r2 = 0x06
0017ca44: 0c05f688 jal 0x0017da20           #Else (No Hamedo) -->Ability Usage Checks and MP Reduction Returns r2 = 0x00 if ok / Else something went wrong (lot of values)
0017ca48: 02002021 addu r4,r16,r0           |r4 = Acting Unit data
0017ca4c: 00408821 addu r17,r2,r0           |r17 = Returned value of Above jal

Ability can not be used:
0017ca50: 12200005 beq r17,r0,0x0017ca68    #If Ability can not be used /Branch if ability can be used (MP cost is sufficient, unit is not silenced, attempting to cast frog as frog, etc.)
0017ca54: 00002021 addu r4,r0,r0            |r4 = 0x00 (counter for next loop)
0017ca58: 0c05f6f2 jal 0x0017dbc8                |-->Store_Some_Acting_Unit_Data  Nullify Acting unit 0x16e to 0x181 
0017ca5c: 02002021 addu r4,r16,r0                |r4 = Acting Unit data
0017ca60: 0805f2ab j 0x0017caac                  >>jump to END returning [Ability Usage Checks and MP Reduction] returned value
0017ca64: 02201021 addu r2,r17,r0                |r2 =  [Ability Usage Checks and MP Reduction] returned value

Ability can be used:
0017ca68: 96020170 lhu r2,0x0170(r16)       #Else (Ability is used) r2 = Acting unit Used Ability
0017ca6c: 02601821 addu r3,r19,r0           |r3 = Start of unit data ( 0x801908cc)
0017ca70: 3c018019 lui r1,0x8019            |
0017ca74: ac32f8c8 sw r18,-0x0738(r1)       |Store Acting unit's raw ID at 0x8018f8c8
0017ca78: 3c018019 lui r1,0x8019            |
0017ca7c: a4223d44 sh r2,0x3d44(r1)         |Store Acting unit's used ability at 0x80193d44
0017ca80: a460019a sh r0,0x019a(r3)         @LOOP Clear Acting unit's Current Action's reaction ID
0017ca84: a0600189 sb r0,0x0189(r3)              |Clear Acting unit's Current Action 0x189  clear mid turn actions (reacting, learning abilities, being hit by ability?)
0017ca88: 24840001 addiu r4,r4,0x0001            |r4 = 0x01 (loop counter +1)
0017ca8c: 28820015 slti r2,r4,0x0015             |r2 = 0x01 if Acting unit ID < 0x15 (valid)
0017ca90: 1440fffb bne r2,r0,0x0017ca80     Λ loop while counter < 0x15 (each unit)
0017ca94: 246301c0 addiu r3,r3,0x01c0            |r3 = Unit Data offset counter (+0x1c0 each iteration)
0017ca98: 0c05f528 jal 0x0017d4a0           |-->Current Action Ability Data Setting / Multi Hit Formulas  Set some ability data (weapon - hit counter …)
0017ca9c: 02002021 addu r4,r16,r0           |r4 = Acting Unit data
0017caa0: 0c063bcd jal 0x0018ef34           |-->Current Action Attacker Data Setting  Set some ability data (Target coordinates..)
0017caa4: 02002021 addu r4,r16,r0           |r4 = Acting Unit data
0017caa8: 00001021 addu r2,r0,r0            |r2 = 0x00
0017caac: 8fbf0020 lw r31,0x0020(r29)       
0017cab0: 8fb3001c lw r19,0x001c(r29)       
0017cab4: 8fb20018 lw r18,0x0018(r29)       
0017cab8: 8fb10014 lw r17,0x0014(r29)       
0017cabc: 8fb00010 lw r16,0x0010(r29)       
0017cac0: 27bd0028 addiu r29,r29,0x0028     
0017cac4: 03e00008 jr r31                   
0017cac8: 00000000 nop                      

Notes

Set 0x8018f5f0 to 0x00 (not reacting)
Set 0x8018f8c8 to 0x00 if Action is not taken (r2 <> 0x00)
               to Acting unit raw ID (Unit 0x18a) if Action is taken (r2 = 0x00)

If Action is taken (ability used)
  Store Acting unit used ability (0x170) at 0x80193d44
  Clear Every unit 0x189 (Target's event ?)
  Clear Every unit 0x19a (Reaction ID) 
  Other Ability's data are set in
   Current_Action_Ability_Data_Setting_/_Multi_Hit_Formulas
   Current_Action_Attacker_Data_Setting

Return Locations

Battle.bin
00073a68: Action_phase_control
0019ddd8: AI_ability_processing