Difference between revisions of "See if elemental ability can be used"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<font face='Courier New'>
+
'''BATTLE.BIN''' :  - See if elemental ability can be used  
See if elemental ability can be used 0019b754: 90830002 lbu r3,0x0002(r4)
+
------------------------------------------------------------------------------------------
  0019b758: 3c02801a lui r2,0x801a
+
Parameter : r4 = Pointer to Some coordinates
  0019b75c: 904201fe lbu r2,0x01fe(r2)
+
Return : r2 = 0x01 if Considered Ability matches terrain type
  0019b760: 00000000 nop
+
          r2 = 0x00 if wrong Ability for terrain type
  0019b764: 00620018 mult r3,r2
+
------------------------------------------------------------------------------------------
  0019b768: 90820001 lbu r2,0x0001(r4)
+
0019b754: 90830002 lbu r3,0x0002(r4)         |{{f/load|Y coordinates}}
  0019b76c: 90840000 lbu r4,0x0000(r4)
+
  0019b758: 3c02801a lui r2,0x801a             |
  0019b770: 00021200 sll r2,r2,0x08
+
  0019b75c: 904201fe lbu r2,0x01fe(r2)         |{{f/load|Map Max X}}
  0019b774: 00001812 mflo r3
+
  0019b760: 00000000 nop                       |
  0019b778: 00431021 addu r2,r2,r3
+
  0019b764: 00620018 mult r3,r2               |
  0019b77c: 00441021 addu r2,r2,r4
+
  0019b768: 90820001 lbu r2,0x0001(r4)         |{{f/load|Elevation}}
  0019b780: 000210c0 sll r2,r2,0x03
+
  0019b76c: 90840000 lbu r4,0x0000(r4)         |{{f/load|X coordinates}}
  0019b784: 3c018019 lui r1,0x8019
+
  0019b770: 00021200 sll r2,r2,0x08           |
  0019b788: 00220821 addu r1,r1,r2
+
  0019b774: 00001812 mflo r3                   |{{f/std|Y*Max X}}
  0019b78c: 9022f8cc lbu r2,-0x0734(r1)            
+
  0019b778: 00431021 addu r2,r2,r3             |
  0019b790: 3c03801a lui r3,0x801a
+
  0019b77c: 00441021 addu r2,r2,r4             |{{f/std|Tile ID}} {{f/std|X + YMax X + 0x100 if High elevation}}
  0019b794: 8463f3c6 lh r3,-0x0c3a(r3)                     load ability ID
+
  0019b780: 000210c0 sll r2,r2,0x03           |{{f/std|8 bytes per tile}}
  0019b798: 3042003f andi r2,r2,0x003f
+
  0019b784: 3c018019 lui r1,0x8019             |
  0019b79c: 3c018006 lui r1,0x8006
+
  0019b788: 00220821 addu r1,r1,r2             |
  0019b7a0: 00220821 addu r1,r1,r2
+
  0019b78c: 9022f8cc lbu r2,-0x0734(r1)       |{{f/load|Tile Type}} {{f/adr|0x8018f8cc + Tile Offset}}
  0019b7a4: 9022e9d0 lbu r2,-0x1630(r1)               load ability ID for terrain type
+
  0019b790: 3c03801a lui r3,0x801a             |
  0019b7a8: 00000000 nop
+
  0019b794: 8463f3c6 lh r3,-0x0c3a(r3)         |{{f/load|Ability ID}} {{f/adr|8019f3c4 + 0x02}}
  0019b7ac: 00431026 xor r2,r2,r3                         r2 = 0 if they're different
+
  0019b798: 3042003f andi r2,r2,0x003f         |
  0019b7b0: 03e00008 jr r31
+
  0019b79c: 3c018006 lui r1,0x8006             |
  0019b7b4: 2c420001 sltiu r2,r2,0x0001               r2 = 1 if usable</font>
+
  0019b7a0: 00220821 addu r1,r1,r2             |
 +
  0019b7a4: 9022e9d0 lbu r2,-0x1630(r1)       |{{f/load|Load Ability ID matching Terrain Type}} {{f/adr|0x8005e9d0}}
 +
  0019b7a8: 00000000 nop                       |
 +
  0019b7ac: 00431026 xor r2,r2,r3             |{{f/std|0 if Abilities match}}
 +
  0019b7b0: 03e00008 jr r31                   |
 +
  0019b7b4: 2c420001 sltiu r2,r2,0x0001       |{{f/std|1 if considered ability match terrain type}}
 +
===Return locations===
 +
'''BATTLE.BIN'''
 +
  0019b59c: [[AI_Depth_Elemental_Monster_Skill_Use_Check_(0019b4f4)]]
 +
  0019c650: [[Evaluate_Linear_Ability_Behaviors]]

Latest revision as of 19:05, 8 May 2024

BATTLE.BIN :  - See if elemental ability can be used 
------------------------------------------------------------------------------------------
Parameter : r4 = Pointer to Some coordinates
Return : r2 = 0x01 if Considered Ability matches terrain type
         r2 = 0x00 if wrong Ability for terrain type
------------------------------------------------------------------------------------------
0019b754: 90830002 lbu r3,0x0002(r4)         |Y coordinates
0019b758: 3c02801a lui r2,0x801a             |
0019b75c: 904201fe lbu r2,0x01fe(r2)         |Map Max X
0019b760: 00000000 nop                       |
0019b764: 00620018 mult r3,r2                |
0019b768: 90820001 lbu r2,0x0001(r4)         |Elevation
0019b76c: 90840000 lbu r4,0x0000(r4)         |X coordinates
0019b770: 00021200 sll r2,r2,0x08            |
0019b774: 00001812 mflo r3                   |Y*Max X
0019b778: 00431021 addu r2,r2,r3             |
0019b77c: 00441021 addu r2,r2,r4             |Tile ID X + YMax X + 0x100 if High elevation
0019b780: 000210c0 sll r2,r2,0x03            |8 bytes per tile
0019b784: 3c018019 lui r1,0x8019             |
0019b788: 00220821 addu r1,r1,r2             |
0019b78c: 9022f8cc lbu r2,-0x0734(r1)        |Tile Type 0x8018f8cc + Tile Offset
0019b790: 3c03801a lui r3,0x801a             |
0019b794: 8463f3c6 lh r3,-0x0c3a(r3)         |Ability ID 8019f3c4 + 0x02
0019b798: 3042003f andi r2,r2,0x003f         |
0019b79c: 3c018006 lui r1,0x8006             |
0019b7a0: 00220821 addu r1,r1,r2             |
0019b7a4: 9022e9d0 lbu r2,-0x1630(r1)        |Load Ability ID matching Terrain Type 0x8005e9d0
0019b7a8: 00000000 nop                       |
0019b7ac: 00431026 xor r2,r2,r3              |0 if Abilities match
0019b7b0: 03e00008 jr r31                    |
0019b7b4: 2c420001 sltiu r2,r2,0x0001        |1 if considered ability match terrain type

Return locations

BATTLE.BIN
 0019b59c: AI_Depth_Elemental_Monster_Skill_Use_Check_(0019b4f4)
 0019c650: Evaluate_Linear_Ability_Behaviors