Get Elemental Ability ID

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
-----------------------------------------
Preserve r4 (Attacker data pointer) for Map Location Calculation
Returns r2 as geomancy ability ID
-----------------------------------------
0017f2d8: 27bdffe8 addiu r29,r29,0xffe8
0017f2dc: afbf0010 sw r31,0x0010(r29)
0017f2e0: 0c060428 jal 0x001810a0            -->Map Location Calculation
0017f2e4: 00000000 nop
0017f2e8: 000210c0 sll r2,r2,0x03            r2 = Tile ID * 8
0017f2ec: 3c018019 lui r1,0x8019
0017f2f0: 00220821 addu r1,r1,r2             r1 = 8019XXXX (XXXX = tile ID * 8)
0017f2f4: 9022f8cc lbu r2,-0x0734(r1)        r2 = Tile's Type
0017f2f8: 00000000 nop
0017f2fc: 3042003f andi r2,r2,0x003f         r2 = Tile's type filter out terrain type
0017f300: 3c018006 lui r1,0x8006
0017f304: 00220821 addu r1,r1,r2             r1 = 8006XXXX (XXXX = terrain type) 
0017f308: 9022e9d0 lbu r2,-0x1630(r1)        r2 = Elemental Ability ID (from terrain type) *see notes
0017f30c: 8fbf0010 lw r31,0x0010(r29)
0017f310: 27bd0018 addiu r29,r29,0x0018
0017f314: 03e00008 jr r31
0017f318: 00000000 nop
---------------------------------------
Notes
  - 0x8005e9D0 = start of geomancy table that links terrain type to ability
---------------------------------------

Return location

0017abdc: Calculate_Targeting_for_Menu_Types
0017c6c0: Attack_Preparation
0018b690: Pre_Formula_Setup_(FDC)