Difference between revisions of "Set target coordinates for ability"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
(Created page with "<font face='Courier New'> 0017d350: a0a00012 sb r0,0x0012(r5) 0017d354: 3c028019 lui r2,0x8019 0017d358: 9042390f lbu r2,0x390f(r2) load ability X 0017d35c: 00000000 no...")
 
m (Nyzer moved page Set target coordinates for ability? to Set target coordinates for ability: Fucking question marks)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
<font face='Courier New'>
+
Parameters : r4 = Attacker data pointer
 +
              r5 = Attacker misc data 0x18c pointer
 
   
 
   
  0017d350: a0a00012 sb r0,0x0012(r5)
+
Store Updated Targeted X,Y and elevation at Attacker misc 0x1a8, 0x1a9 and 0x1aa
  0017d354: 3c028019 lui r2,0x8019
+
(Data are different if ability is Target specific, Tile specific or Random fire)
  0017d358: 9042390f lbu r2,0x390f(r2) load ability X
+
----------------------------------------------------------------------------------
  0017d35c: 00000000 nop
+
  0017d350: a0a00012 sb r0,0x0012(r5)         |
  0017d360: 1040000d beq r2,r0,0x0017d398 branch if X = 0
+
  0017d354: 3c028019 lui r2,0x8019           |
  0017d364: 34020006 ori r2,r0,0x0006
+
  0017d358: 9042390f lbu r2,0x390f(r2)       |{{f/load|<nowiki>r2 = 0x01 if random fire ability</nowiki>}} {{f/std|<nowiki> 0x8019390f</nowiki>}}
  0017d368: 3c028019 lui r2,0x8019
+
  0017d35c: 00000000 nop                     |
  0017d36c: 904238ca lbu r2,0x38ca(r2) load target X coordinate?
+
  0017d360: 1040000d beq r2,r0,0x0017d398     {{f/Cond|<nowiki>If random fire has been done</nowiki>}}
  0017d370: 00000000 nop
+
  0017d364: 34020006 ori r2,r0,0x0006         |{{f/std|<nowiki>r2 = 0x06 </nowiki>}}
  0017d374: a0a2001c sb r2,0x001c(r5) store target X coordinate?
+
  0017d368: 3c028019 lui r2,0x8019                 |{{f/std|<nowiki> </nowiki>}}
  0017d378: 3c028019 lui r2,0x8019
+
  0017d36c: 904238ca lbu r2,0x38ca(r2)             |{{f/load|<nowiki>r2 = Ability Target new X</nowiki>}} {{f/std|<nowiki> 0x801938ca / 801938ca</nowiki>}}
  0017d37c: 904238cb lbu r2,0x38cb(r2) load target Y coordinate
+
  0017d370: 00000000 nop                           |
  0017d380: 00000000 nop
+
  0017d374: a0a2001c sb r2,0x001c(r5)             |{{f/store|<nowiki>Store Ability Targeted new X at Attacker misc data 0x1a8</nowiki>}}
  0017d384: a0a2001d sb r2,0x001d(r5) store target y coordinate
+
  0017d378: 3c028019 lui r2,0x8019                 |
  0017d388: 3c028019 lui r2,0x8019
+
  0017d37c: 904238cb lbu r2,0x38cb(r2)             |{{f/load|<nowiki>r2 = Ability Target new Y</nowiki>}} {{f/std|<nowiki> 0x801938cb / 801938cb</nowiki>}}
  0017d38c: 904238cc lbu r2,0x38cc(r2) load target elevation?
+
  0017d380: 00000000 nop                           |
  0017d390: 0805f502 j 0x0017d408
+
  0017d384: a0a2001d sb r2,0x001d(r5)             |{{f/store|<nowiki>Store Ability Targeted new Y at Attacker misc data 0x1a9</nowiki>}}
  0017d394: 00000000 nop
+
  0017d388: 3c028019 lui r2,0x8019                 |
  0017d398: 90830178 lbu r3,0x0178(r4) load attacker reaction ID
+
  0017d38c: 904238cc lbu r2,0x38cc(r2)             |{{f/load|<nowiki>r2 = Ability Target new Elevation </nowiki>}} {{f/std|<nowiki> 0x801938cc / 801938cc</nowiki>}}
  0017d39c: 00000000 nop
+
  0017d390: 0805f502 j 0x0017d408                 {{f/jump|<nowiki>jump to </nowiki>{{f/loc|<nowiki>END</nowiki>}}<nowiki> (store elevation there)</nowiki>}}
  0017d3a0: 14620012 bne r3,r2,0x0017d3ec branch if not 06 (regenerator?)
+
  0017d394: 00000000 nop                           |
  0017d3a4: 00000000 nop
+
  0017d398: 90830178 lbu r3,0x0178(r4)       {{f/Cond|<nowiki>Else</nowiki>}} {{f/load|<nowiki>load attacker current action targeting type</nowiki>}}
  0017d3a8: 90830179 lbu r3,0x0179(r4) load Target ID
+
  0017d39c: 00000000 nop                     |
  0017d3ac: 00000000 nop
+
  0017d3a0: 14620012 bne r3,r2,0x0017d3ec     {{f/Cond|<nowiki>If Targeting type is 0x06 (Target specific)</nowiki>}}
  0017d3b0: 000310c0 sll r2,r3,0x03
+
  0017d3a4: 00000000 nop                           |{{f/std|<nowiki> </nowiki>}}
  0017d3b4: 00431023 subu r2,r2,r3
+
  0017d3a8: 90830179 lbu r3,0x0179(r4)             |{{f/load|<nowiki>r3 = Target ID</nowiki>}}
  0017d3b8: 00021180 sll r2,r2,0x06
+
  0017d3ac: 00000000 nop                           |
  0017d3bc: 3c038019 lui r3,0x8019
+
  0017d3b0: 000310c0 sll r2,r3,0x03               |{{f/std|<nowiki>r2 = Target ID * 8</nowiki>}}
  0017d3c0: 246308cc addiu r3,r3,0x08cc r3 = target unit data?
+
  0017d3b4: 00431023 subu r2,r2,r3                 |{{f/std|<nowiki>r2 = Target ID * 7</nowiki>}}
  0017d3c4: 00431021 addu r2,r2,r3
+
  0017d3b8: 00021180 sll r2,r2,0x06               |{{f/std|<nowiki>r2 = Target ID * 0x1c0</nowiki>}}
  0017d3c8: 90430047 lbu r3,0x0047(r2) load unit X coordinate
+
  0017d3bc: 3c038019 lui r3,0x8019                 |
  0017d3cc: 00000000 nop
+
  0017d3c0: 246308cc addiu r3,r3,0x08cc           |{{f/std|<nowiki>r3 = Start of Unit Data</nowiki>}}
  0017d3d0: a0a3001c sb r3,0x001c(r5) store X coordinate of target
+
  0017d3c4: 00431021 addu r2,r2,r3                 |{{f/adr|<nowiki>r2 = Target unit data</nowiki>}}
  0017d3d4: 90430048 lbu r3,0x0048(r2) load Y coordinate
+
  0017d3c8: 90430047 lbu r3,0x0047(r2)             |{{f/load|<nowiki>r3 = Target X coordinates</nowiki>}}
  0017d3d8: 00000000 nop
+
  0017d3cc: 00000000 nop                           |
  0017d3dc: a0a3001d sb r3,0x001d(r5) Store Y coordinate of target
+
  0017d3d0: a0a3001c sb r3,0x001c(r5)             |{{f/store|<nowiki>Store Target X at Attacker misc data 0x1a8</nowiki>}}
  0017d3e0: 94420048 lhu r2,0x0048(r2) load elevation
+
  0017d3d4: 90430048 lbu r3,0x0048(r2)             |{{f/load|<nowiki>r3 = Target Y coordinates</nowiki>}}
  0017d3e4: 0805f502 j 0x0017d408
+
  0017d3d8: 00000000 nop                           |
  0017d3e8: 000213c2 srl r2,r2,0x0f
+
  0017d3dc: a0a3001d sb r3,0x001d(r5)             |{{f/store|<nowiki>Store Target Y at Attacker misc data 0x1a9</nowiki>}}
knockback goes here
+
  0017d3e0: 94420048 lhu r2,0x0048(r2)             |{{f/load|<nowiki>r2 = Target Y + elevation/facing</nowiki>}}
  0017d3ec: 9082017a lbu r2,0x017a(r4) load target X coordinate
+
  0017d3e4: 0805f502 j 0x0017d408                 {{f/jump|<nowiki>jump to </nowiki>{{f/loc|<nowiki>END</nowiki>}}<nowiki> (store elevation there)</nowiki>}}
  0017d3f0: 00000000 nop
+
  0017d3e8: 000213c2 srl r2,r2,0x0f               |{{f/std|<nowiki>r2 = Target elevation </nowiki>}} {{f/std|<nowiki>left bit of halfword - 0x01 if r2 = has 0x8000 enabled)</nowiki>}}
  0017d3f4: a0a2001c sb r2,0x001c(r5) store target X coordinate
+
  0017d3ec: 9082017a lbu r2,0x017a(r4)       {{f/Cond|<nowiki>Else (Tile specific targeting)</nowiki>}} {{f/load|<nowiki>r2 = Attacker Targeted (panel) X coord</nowiki>}}
  0017d3f8: 9082017e lbu r2,0x017e(r4) load target Y coordinate
+
  0017d3f0: 00000000 nop                           |{{f/std|<nowiki> </nowiki>}}
  0017d3fc: 00000000 nop
+
  0017d3f4: a0a2001c sb r2,0x001c(r5)             |{{f/store|<nowiki>Store Targeted X at Attacker misc data 0x1a8</nowiki>}}
  0017d400: a0a2001d sb r2,0x001d(r5) store target Y
+
  0017d3f8: 9082017e lbu r2,0x017e(r4)             |{{f/load|<nowiki>r2 = Attacker Targeted (panel) Y coord</nowiki>}}
  0017d404: 9082017c lbu r2,0x017c(r4) load elevation?
+
  0017d3fc: 00000000 nop                           |
  0017d408: 03e00008 jr r31
+
  0017d400: a0a2001d sb r2,0x001d(r5)             |{{f/store|<nowiki>Store Targeted Y at Attacker misc data 0x1a9</nowiki>}}
  0017d40c: a0a2001e sb r2,0x001e(r5) store elevation?
+
  0017d404: 9082017c lbu r2,0x017c(r4)             |{{f/load|<nowiki>r2 = Attacker Targeted (panel) Elevation</nowiki>}}
</font>
+
  0017d408: 03e00008 jr r31                       |
 +
  0017d40c: a0a2001e sb r2,0x001e(r5)         {{f/store|<nowiki>store Updated elevation at Attacker misc data 0x1aa</nowiki>}}
 +
=== Notes ===
 +
'''Random Fire''' See [[Select_Random_Tile_For_Random_Fire_Abilities]]
 +
Enter this section if 0x8019390f <> 0x00  (*)
 +
Uses 0x801938ca as X (random targeted X)
 +
Uses 0x801938cb as Y
 +
Uses 0x801938cc as Elevation
 +
 +
'''Target specific targeting'''
 +
Enter this section if Attacker 0x178 = 0x06
 +
Uses Target ID to get to Target Unit Data
 +
Uses Target 0x47 as X
 +
Uses Target 0x48 as Y
 +
Uses Target 0x48 (halfword) last bit (right shifted by 0xf) as elevation
 +
 +
'''Tile specific targeting'''
 +
Enter this section by default (Not Random fire and Attacker 0x178 <> 0x06)
 +
Uses Attacker 0x17a as X
 +
Uses Attacker 0x17e as X
 +
Uses Attacker 0x17c as Elevation
 +
 +
'''*Notes 0x8019390f / 8019390f'''
 +
Found only three occurences in Battle.bin (look after 0x390f)
 +
- Nullified in [[Main_ability_loading_routine%3F]]
 +
- Then set to 0x01 in [[Select_Random_Tile_For_Random_Fire_Abilities]]
 +
- Then Checked here
 +
=== Return location ===
 +
0017d154: [[Main_ability_loading_routine%3F]]

Latest revision as of 21:24, 22 December 2024

Parameters : r4 = Attacker data pointer
             r5 = Attacker misc data 0x18c pointer

Store Updated Targeted X,Y and elevation at Attacker misc 0x1a8, 0x1a9 and 0x1aa
(Data are different if ability is Target specific, Tile specific or Random fire)
----------------------------------------------------------------------------------
0017d350: a0a00012 sb r0,0x0012(r5)         |
0017d354: 3c028019 lui r2,0x8019            |
0017d358: 9042390f lbu r2,0x390f(r2)        |r2 = 0x01 if random fire ability  0x8019390f
0017d35c: 00000000 nop                      |
0017d360: 1040000d beq r2,r0,0x0017d398     #If random fire has been done
0017d364: 34020006 ori r2,r0,0x0006         |r2 = 0x06 
0017d368: 3c028019 lui r2,0x8019                 | 
0017d36c: 904238ca lbu r2,0x38ca(r2)             |r2 = Ability Target new X  0x801938ca / 801938ca
0017d370: 00000000 nop                           |
0017d374: a0a2001c sb r2,0x001c(r5)              |Store Ability Targeted new X at Attacker misc data 0x1a8
0017d378: 3c028019 lui r2,0x8019                 |
0017d37c: 904238cb lbu r2,0x38cb(r2)             |r2 = Ability Target new Y  0x801938cb / 801938cb
0017d380: 00000000 nop                           |
0017d384: a0a2001d sb r2,0x001d(r5)              |Store Ability Targeted new Y at Attacker misc data 0x1a9
0017d388: 3c028019 lui r2,0x8019                 |
0017d38c: 904238cc lbu r2,0x38cc(r2)             |r2 = Ability Target new Elevation   0x801938cc / 801938cc
0017d390: 0805f502 j 0x0017d408                  >>jump to END (store elevation there)
0017d394: 00000000 nop                           |
0017d398: 90830178 lbu r3,0x0178(r4)        #Else load attacker current action targeting type
0017d39c: 00000000 nop                      |
0017d3a0: 14620012 bne r3,r2,0x0017d3ec     #If Targeting type is 0x06 (Target specific)
0017d3a4: 00000000 nop                           | 
0017d3a8: 90830179 lbu r3,0x0179(r4)             |r3 = Target ID
0017d3ac: 00000000 nop                           |
0017d3b0: 000310c0 sll r2,r3,0x03                |r2 = Target ID * 8
0017d3b4: 00431023 subu r2,r2,r3                 |r2 = Target ID * 7
0017d3b8: 00021180 sll r2,r2,0x06                |r2 = Target ID * 0x1c0
0017d3bc: 3c038019 lui r3,0x8019                 |
0017d3c0: 246308cc addiu r3,r3,0x08cc            |r3 = Start of Unit Data
0017d3c4: 00431021 addu r2,r2,r3                 |r2 = Target unit data
0017d3c8: 90430047 lbu r3,0x0047(r2)             |r3 = Target X coordinates
0017d3cc: 00000000 nop                           |
0017d3d0: a0a3001c sb r3,0x001c(r5)              |Store Target X at Attacker misc data 0x1a8
0017d3d4: 90430048 lbu r3,0x0048(r2)             |r3 = Target Y coordinates
0017d3d8: 00000000 nop                           |
0017d3dc: a0a3001d sb r3,0x001d(r5)              |Store Target Y at Attacker misc data 0x1a9
0017d3e0: 94420048 lhu r2,0x0048(r2)             |r2 = Target Y + elevation/facing
0017d3e4: 0805f502 j 0x0017d408                  >>jump to END (store elevation there)
0017d3e8: 000213c2 srl r2,r2,0x0f                |r2 = Target elevation  left bit of halfword - 0x01 if r2 = has 0x8000 enabled)
0017d3ec: 9082017a lbu r2,0x017a(r4)        #Else (Tile specific targeting) r2 = Attacker Targeted (panel) X coord
0017d3f0: 00000000 nop                           | 
0017d3f4: a0a2001c sb r2,0x001c(r5)              |Store Targeted X at Attacker misc data 0x1a8
0017d3f8: 9082017e lbu r2,0x017e(r4)             |r2 = Attacker Targeted (panel) Y coord
0017d3fc: 00000000 nop                           |
0017d400: a0a2001d sb r2,0x001d(r5)              |Store Targeted Y at Attacker misc data 0x1a9
0017d404: 9082017c lbu r2,0x017c(r4)             |r2 = Attacker Targeted (panel) Elevation
0017d408: 03e00008 jr r31                        |
0017d40c: a0a2001e sb r2,0x001e(r5)         store Updated elevation at Attacker misc data 0x1aa

Notes

Random Fire See Select_Random_Tile_For_Random_Fire_Abilities
Enter this section if 0x8019390f <> 0x00  (*)
Uses 0x801938ca as X (random targeted X)
Uses 0x801938cb as Y 
Uses 0x801938cc as Elevation 

Target specific targeting
Enter this section if Attacker 0x178 = 0x06
Uses Target ID to get to Target Unit Data
Uses Target 0x47 as X
Uses Target 0x48 as Y
Uses Target 0x48 (halfword) last bit (right shifted by 0xf) as elevation

Tile specific targeting
Enter this section by default (Not Random fire and Attacker 0x178 <> 0x06)
Uses Attacker 0x17a as X
Uses Attacker 0x17e as X
Uses Attacker 0x17c as Elevation

*Notes 0x8019390f / 8019390f
Found only three occurences in Battle.bin (look after 0x390f)
- Nullified in Main_ability_loading_routine?
- Then set to 0x01 in Select_Random_Tile_For_Random_Fire_Abilities
- Then Checked here 

Return location

0017d154: Main_ability_loading_routine?