Difference between revisions of "Transfer Unit Coordinates to AI"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
(Created page with " 0019f2a4: 000410c0 sll r2,r4,0x03 ID * 8 0019f2a8: 00441023 subu r2,r2,r4 ID * 7 0019f2ac: 00021180 sll r2,r2,0x06 ID * 448 0019f2b0: 3c018019 lui r1,0x8019 0019f2b4: ...")
 
Line 1: Line 1:
  0019f2a4: 000410c0 sll r2,r4,0x03 ID * 8
+
BATTLE.BIN : Transfer Unit Coordinates to AI
  0019f2a8: 00441023 subu r2,r2,r4 ID * 7
+
-----------------------------------------------------------------------------------------
  0019f2ac: 00021180 sll r2,r2,0x06 ID * 448
+
Parameters : r4 is Unit ID (Focused Unit)
  0019f2b0: 3c018019 lui r1,0x8019
+
              r5 is Acting unit Decision data pointer (0x8019f3c4 + 182c + Unit offset)
  0019f2b4: 00220821 addu r1,r1,r2
+
Returns Nothing
  0019f2b8: 90230913 lbu r3,0x0913(r1) Load Unit's X Coordinate
+
  0019f2bc: 00000000 nop
+
Transfer X, Y and elevation in AI data.
  0019f2c0: a0a30000 sb r3,0x0000(r5) Store X Coordinate
+
Nullify AI data byte 0x03
  0019f2c4: 3c018019 lui r1,0x8019
+
-----------------------------------------------------------------------------------------
  0019f2c8: 00220821 addu r1,r1,r2
+
  0019f2a4: 000410c0 sll r2,r4,0x03           |{{f/std|ID * 8}}
  0019f2cc: 90230914 lbu r3,0x0914(r1) Load Unit's Y Coordinate
+
  0019f2a8: 00441023 subu r2,r2,r4           |{{f/std|ID * 7}}
  0019f2d0: 00000000 nop
+
  0019f2ac: 00021180 sll r2,r2,0x06           |{{f/std|ID * 448}}
  0019f2d4: a0a30002 sb r3,0x0002(r5) Store Y Coordinate
+
  0019f2b0: 3c018019 lui r1,0x8019           |
  0019f2d8: 3c018019 lui r1,0x8019
+
  0019f2b4: 00220821 addu r1,r1,r2           |{{f/std|80190000 + Unit offset}}
  0019f2dc: 00220821 addu r1,r1,r2
+
  0019f2b8: 90230913 lbu r3,0x0913(r1)       |{{f/load|Load Unit's X Coordinate}} {{f/std|801908cc + 0x47 + Unit Offset}}
  0019f2e0: 94220914 lhu r2,0x0914(r1) Load Unit's Y Coordinate + Map Level
+
  0019f2bc: 00000000 nop                     |
  0019f2e4: a0a00003 sb r0,0x0003(r5) Store ? = 0
+
  0019f2c0: a0a30000 sb r3,0x0000(r5)         |{{f/store|Store X Coordinate in Unit AI decision data }} {{f/std|8019f3c4 + 182c + Unit offset}}
  0019f2e8: 000213c2 srl r2,r2,0x0f Get Map Level
+
  0019f2c4: 3c018019 lui r1,0x8019           |
  0019f2ec: 03e00008 jr r31
+
  0019f2c8: 00220821 addu r1,r1,r2           |
  0019f2f0: a0a20001 sb r2,0x0001(r5) Store Map Level
+
  0019f2cc: 90230914 lbu r3,0x0914(r1)       |{{f/load|Load Unit's Y Coordinate}}
 +
  0019f2d0: 00000000 nop                     |
 +
  0019f2d4: a0a30002 sb r3,0x0002(r5)         |{{f/store|Store Y Coordinate in AI decision data}}
 +
  0019f2d8: 3c018019 lui r1,0x8019           |
 +
  0019f2dc: 00220821 addu r1,r1,r2           |
 +
  0019f2e0: 94220914 lhu r2,0x0914(r1)       |{{f/load|Load Unit's Y Coordinate + Map Level}}
 +
  0019f2e4: a0a00003 sb r0,0x0003(r5)         |{{f/store|Nullify AI decision 0x03}}
 +
  0019f2e8: 000213c2 srl r2,r2,0x0f           |{{f/std|Get Elevation}}
 +
  0019f2ec: 03e00008 jr r31                   |
 +
  0019f2f0: a0a20001 sb r2,0x0001(r5)         |{{f/store|Store Map Elevation flag}}
 +
===Return Locations===
 +
'''BATTLE.BIN'''
 +
001947fc: [[Set_AI_flags_for_target_consideration]]
 +
00194934: [[Store_main_target_ID_and_focus_on_target_flag]]
 +
001964e0: [[Map_movement_decision/data_setting]]
 +
001972e4: [[Set_chosen_ability/target_for_AI_status]]
 +
0019ac0c: [[Some_Map_calculations_-_height_diff.,_coordinates]]
 +
0019ace4: [[Some_Map_calculations_-_height_diff.,_coordinates]]
 +
0019b8bc: [[AI_Targeting_Matrix_Analysis_(0019b7b8)]]
 +
0019c484: [[Evaluate_Linear_Ability_Behaviors]]
 +
0019c728: [[Evaluate_Linear_Ability_Behaviors]]

Revision as of 11:51, 1 May 2023

BATTLE.BIN : Transfer Unit Coordinates to AI
-----------------------------------------------------------------------------------------
Parameters : r4 is Unit ID (Focused Unit)
             r5 is Acting unit Decision data pointer (0x8019f3c4 + 182c + Unit offset)
Returns Nothing

Transfer X, Y and elevation in AI data. 
Nullify AI data byte 0x03
-----------------------------------------------------------------------------------------
0019f2a4: 000410c0 sll r2,r4,0x03           |ID * 8
0019f2a8: 00441023 subu r2,r2,r4            |ID * 7
0019f2ac: 00021180 sll r2,r2,0x06           |ID * 448
0019f2b0: 3c018019 lui r1,0x8019            |
0019f2b4: 00220821 addu r1,r1,r2            |80190000 + Unit offset
0019f2b8: 90230913 lbu r3,0x0913(r1)        |Load Unit's X Coordinate 801908cc + 0x47 + Unit Offset
0019f2bc: 00000000 nop                      |
0019f2c0: a0a30000 sb r3,0x0000(r5)         |Store X Coordinate in Unit AI decision data  8019f3c4 + 182c + Unit offset
0019f2c4: 3c018019 lui r1,0x8019            |
0019f2c8: 00220821 addu r1,r1,r2            |
0019f2cc: 90230914 lbu r3,0x0914(r1)        |Load Unit's Y Coordinate
0019f2d0: 00000000 nop                      |
0019f2d4: a0a30002 sb r3,0x0002(r5)         |Store Y Coordinate in AI decision data
0019f2d8: 3c018019 lui r1,0x8019            |
0019f2dc: 00220821 addu r1,r1,r2            |
0019f2e0: 94220914 lhu r2,0x0914(r1)        |Load Unit's Y Coordinate + Map Level
0019f2e4: a0a00003 sb r0,0x0003(r5)         |Nullify AI decision 0x03
0019f2e8: 000213c2 srl r2,r2,0x0f           |Get Elevation
0019f2ec: 03e00008 jr r31                   |
0019f2f0: a0a20001 sb r2,0x0001(r5)         |Store Map Elevation flag

Return Locations

BATTLE.BIN
001947fc: Set_AI_flags_for_target_consideration
00194934: Store_main_target_ID_and_focus_on_target_flag
001964e0: Map_movement_decision/data_setting
001972e4: Set_chosen_ability/target_for_AI_status
0019ac0c: Some_Map_calculations_-_height_diff.,_coordinates
0019ace4: Some_Map_calculations_-_height_diff.,_coordinates
0019b8bc: AI_Targeting_Matrix_Analysis_(0019b7b8)
0019c484: Evaluate_Linear_Ability_Behaviors
0019c728: Evaluate_Linear_Ability_Behaviors