Current Action Attacker Data Setting

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
0018ef34 - 0018f034 

Parameters: r4 = Acting unit's data pointer

 Store some ability data See Notes
-------------------------------------------------------------------
0018ef34: 27bdffe8 addiu r29,r29,-0x0018    |
0018ef38: afb00010 sw r16,0x0010(r29)       |
0018ef3c: 00808021 addu r16,r4,r0           |r16 = Acting Unit's Data Pointer
0018ef40: afbf0014 sw r31,0x0014(r29)       |
0018ef44: 92030003 lbu r3,0x0003(r16)       |r3 = Acting unit's job
0018ef48: 3402005d ori r2,r0,0x005d         |r2 = 0x5d (Mime Job ID)
0018ef4c: 10620035 beq r3,r2,0x0018f024     #If Acting unit is not a Mime /Else Branch to END
0018ef50: 00000000 nop                           | 
0018ef54: 3c058019 lui r5,0x8019                 |r5 = 0x80190000
0018ef58: 24a538a6 addiu r5,r5,0x38a6            |r5 = 0x801938a6   801938a6
0018ef5c: 0c01788b jal 0x0005e22c                |-->Copy_Byte_Data_(20_Bytes) Copy Attacker 0x16e to 0x181at 0x801938a6 to 0x801938b9
0018ef60: 2604016e addiu r4,r16,0x016e           |r4 = Attacker 0x16e pointer
0018ef64: 92030178 lbu r3,0x0178(r16)            |r3 = Acting Unit's Action targeting type
0018ef68: 34020006 ori r2,r0,0x0006              |r2 = 0x06
0018ef6c: 1462000d bne r3,r2,0x0018efa4          #If Targeting is Target specific
0018ef70: 00000000 nop                               | 
0018ef74: 92020179 lbu r2,0x0179(r16)                |r2 = Acting unit's Action Target ID
0018ef78: 00000000 nop                                   | 
0018ef7c: 000218c0 sll r3,r2,0x03                    |Target ID * 8
0018ef80: 00621823 subu r3,r3,r2                     |Target ID * 7
0018ef84: 00031980 sll r3,r3,0x06                    |Target ID * 0x1c0 (Offset of Target in units data)
0018ef88: 3c028019 lui r2,0x8019                     |
0018ef8c: 244208cc addiu r2,r2,0x08cc                |r2 = 0x801908cc
0018ef90: 00621821 addu r3,r3,r2                     |r3 = Target's Data Pointer
0018ef94: 90640047 lbu r4,0x0047(r3)                 |r4 = Target's X Coordinate
0018ef98: 90630048 lbu r3,0x0048(r3)                 |r5 = Target's Y Coordinate
0018ef9c: 08063beb j 0x0018efac                      >>Jump (keeping Target coordinates in memory)
0018efa0: 00000000 nop                               | 
0018efa4: 9204017a lbu r4,0x017a(r16)            #Else (Tile targeting) Load Acting Unit's Targeted X
0018efa8: 9203017e lbu r3,0x017e(r16)                |Load Acting Unit's Targeted Y
0018efac: 92020047 lbu r2,0x0047(r16)            |r2 = Acting Unit's X Coordinate
0018efb0: 00000000 nop                           |
0018efb4: 00821023 subu r2,r4,r2                 |r2 =X distance (Targeted X - Acting Unit X)
0018efb8: 3c018019 lui r1,0x8019                 |
0018efbc: a42238a2 sh r2,0x38a2(r1)              |Store X distance at 0x801938a2
0018efc0: 92020048 lbu r2,0x0048(r16)            |r2 = Acting unit's Y coordinates
0018efc4: 00000000 nop                           |
0018efc8: 00621023 subu r2,r3,r2                 |r2 = Y distance (Target - Acting unit)
0018efcc: 3c018019 lui r1,0x8019                 |
0018efd0: a42238a4 sh r2,0x38a4(r1)              |Store Y distance at 0x801938a4
0018efd4: 96020048 lhu r2,0x0048(r16)            |r2 = Acting unit Y & Facing/Elevation
0018efd8: 00000000 nop                           |
0018efdc: 00021202 srl r2,r2,0x08                |r2 = Acting unit's Facing/Elevation
0018efe0: 3042000f andi r2,r2,0x000f             |r2 = Acting unit's Facing
0018efe4: 3c018019 lui r1,0x8019                 |
0018efe8: a022389c sb r2,0x389c(r1)              |Store Acting unit's Facing at 0x8019389c
0018efec: 92020005 lbu r2,0x0005(r16)            |r2 = Acting Unit's ENTD Flags
0018eff0: 00000000 nop                           |
0018eff4: 30420030 andi r2,r2,0x0030             |r2 = Acting Unit's Team
0018eff8: 3c018019 lui r1,0x8019                 |
0018effc: a02238a0 sb r2,0x38a0(r1)              |StoreActing unit's Team at 0x801938a0
0018f000: 9202001d lbu r2,0x001d(r16)            |r2 = Acting Unit's RH Weapon
0018f004: 3c018019 lui r1,0x8019                 |
0018f008: a022389e sb r2,0x389e(r1)              |Store Acting unit's Right Hand Weapon ID at 0x8019389e
0018f00c: 9203001f lbu r3,0x001f(r16)            |r3 = Acting Unit's LH Weapon
0018f010: 34020001 ori r2,r0,0x0001              |r2 = 0x01
0018f014: 3c018019 lui r1,0x8019                 |
0018f018: a022389d sb r2,0x389d(r1)              |Set 0x8019389d  = 0x01 (?)
0018f01c: 3c018019 lui r1,0x8019                 |
0018f020: a023389f sb r3,0x389f(r1)              |Store Acting unit's Left Hand weapon at 0x8019389f
0018f024: 8fbf0014 lw r31,0x0014(r29)            |
0018f028: 8fb00010 lw r16,0x0010(r29)            
0018f02c: 27bd0018 addiu r29,r29,0x0018          
0018f030: 03e00008 jr r31                        
0018f034: 00000000 nop                           

Notes

0x8019389c : Acting unit Facing
0x8019389d : 0x01
0x8019389e : Acting unit Right hand weapon
0x8019389f : Acting unit Left hand weapon
0x801938a0 : Acting unit Team 
0x801938a2 : Check targeting type (Attacker 0x178)
  - If = 0x06 : X distance between Attacker and Targeted unit
  - If <> 0x06 : X distance between Attacker and targeted tile
0x801938a4 : Check targeting type (Attacker 0x178)
  - If = 0x06 : Y distance between Attacker and Targeted unit
  - If <> 0x06 : Y distance between Attacker and targeted tile 
0x801938a6 to 0x801938b9 : Attacker 0x16e to 0x181 data

Return locations

0017caa8: Prep_Current_Action_Data