Difference between revisions of "Map Location Calculation"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
m
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
  Map Location Calculation (requires r4 = Target Data Pointer)
+
  Map Location Calculation  
 +
------------------------------------
 +
requires r4 = Unit Data Pointer
 +
returns r2 = r4 Unit's tile ID
 +
------------------------------------
 
  001810a0: 90830048 lbu r3,0x0048(r4) Target Y Coordinate
 
  001810a0: 90830048 lbu r3,0x0048(r4) Target Y Coordinate
 
  001810a4: 3c02800e lui r2,0x800e
 
  001810a4: 3c02800e lui r2,0x800e
Line 17: Line 21:
 
== Return Locations ==
 
== Return Locations ==
  
  00174a90: - [[Routine at 174430]] - massive routine
+
  00174a90: - [[Store movement stuff into scratch pad]]
  00174e38: - [[Routine at 174df8]]
+
  00174e38: - [[00174df8 - 00174e80]]
  001797c8: - [[Routine at 1797b0]]
+
  001797c8: - [[Height vs Water and Float Routine]]
  00179e34: - [[Routine at 179dc8]]
+
  00179e34: - [[Set Ability Targeting?]]
 
  0017a330: - [[Check ability data?]]
 
  0017a330: - [[Check ability data?]]
  0017a738: - [[Routine at 17a6dc]]
+
  0017a738: - [[Set target state for all units panels]]
  0017a9b0: - [[Routine at 17a8c0]]
+
  0017a9b0: - [[Calculate ability range based on action menu byte]]
  0017af68: - [[Routine at 17ac90]]
+
  0017af68: - [[Targeting validation (weapon flags)]]
 
  0017b74c: - [[Calculator Routine]]
 
  0017b74c: - [[Calculator Routine]]
 
  0017bafc: - [[Targeting routine]]
 
  0017bafc: - [[Targeting routine]]
  0017bdfc: - [[Routine at 17bdd0]]
+
  0017bdfc: - [[Check if Unit can be Targeted]]
  0017c2a4: - [[Routine at 17c158]]
+
  0017c2a4: - [[Calculate Height Data]]
  0017d044: - [[Routine at 17ce44]]
+
  0017d044: - [[Main ability loading routine?]]
 
  0017e31c: - [[Main reaction routine?]]
 
  0017e31c: - [[Main reaction routine?]]
  0017e6c4: - [[Routine at 17e650]]
+
  0017e6c4: - [[Store counter ability?]]
  0017eca4: - [[Routine at 17ec18]]
+
  0017eca4: - [[Big map/panel routine]]
  0017f20c: - [[Routine at 17f17c]]
+
  0017f20c: - [[Calculate Projected Action Effect]]
 
  0017f2e0: - [[Get Elemental Ability ID]]
 
  0017f2e0: - [[Get Elemental Ability ID]]
  0017f734: - [[Routine at 17f6c4]]
+
  0017f734: - [[Validate unit placement]]
 
  00181344: - [[Weapon Guard Usability]]
 
  00181344: - [[Weapon Guard Usability]]
 
  00182254: - [[Elemental ability loading]]
 
  00182254: - [[Elemental ability loading]]
 
  001846d4: - [[Knockback 2]]  
 
  001846d4: - [[Knockback 2]]  
 
  0018b44c: - [[Pre Formula Setup (FDC)]]
 
  0018b44c: - [[Pre Formula Setup (FDC)]]
  0018db28: - [[Routine at 18da88]]
+
  0018db28: - [[Poison Marsh Routine]]
  0018f39c: - [[Routine at 18f2b0]]
+
  0018f39c: - [[Load last used ability]]

Latest revision as of 21:27, 11 February 2022

Map Location Calculation 
------------------------------------
requires r4 = Unit Data Pointer
returns r2 = r4 Unit's tile ID
------------------------------------
001810a0: 90830048 lbu r3,0x0048(r4)		Target Y Coordinate
001810a4: 3c02800e lui r2,0x800e
001810a8: 90424e9c lbu r2,0x4e9c(r2)		Map Max X Coordinate
001810ac: 00000000 nop
001810b0: 00620018 mult r3,r2			Y  * Max X
001810b4: 94820048 lhu r2,0x0048(r4)		Y Coordinate + Elevation/Facing Flags
001810b8: 90840047 lbu r4,0x0047(r4)		X Coordinate
001810bc: 000213c2 srl r2,r2,0x0f		Checks for Higher Elevation
001810c0: 00021200 sll r2,r2,0x08		r2 = 0 or 256 (if at a Higher  Elevation)
001810c4: 00001812 mflo r3
001810c8: 00431021 addu r2,r2,r3		Y * Max X + 0 or 256
001810cc: 03e00008 jr r31
001810d0: 00441021 addu r2,r2,r4		r2 = X + Y * Max X + 0 or 256 (Target's Tile ID)


Return Locations

00174a90: - Store movement stuff into scratch pad
00174e38: - 00174df8 - 00174e80
001797c8: - Height vs Water and Float Routine
00179e34: - Set Ability Targeting?
0017a330: - Check ability data?
0017a738: - Set target state for all units panels
0017a9b0: - Calculate ability range based on action menu byte
0017af68: - Targeting validation (weapon flags)
0017b74c: - Calculator Routine
0017bafc: - Targeting routine
0017bdfc: - Check if Unit can be Targeted
0017c2a4: - Calculate Height Data
0017d044: - Main ability loading routine?
0017e31c: - Main reaction routine?
0017e6c4: - Store counter ability?
0017eca4: - Big map/panel routine
0017f20c: - Calculate Projected Action Effect
0017f2e0: - Get Elemental Ability ID
0017f734: - Validate unit placement
00181344: - Weapon Guard Usability
00182254: - Elemental ability loading
001846d4: - Knockback 2 
0018b44c: - Pre Formula Setup (FDC)
0018db28: - Poison Marsh Routine
0018f39c: - Load last used ability