0019db80 - 0019dca8

From Final Fantasy Hacktics Wiki
Revision as of 09:24, 14 March 2024 by Orkney (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
BATTLE.BIN - 0019db80_-_0019dca8 : AI Movement Simulation - Moving on crystal/treasure 
---------------------------------------------------------------------------------------
Parameters : Nothing
Returns : Nothing

This routine simulate AI Unit movement on a crystal / treasure Tile.
---------------------------------------------------------------------------------------
0019db80: 3c03801a lui r3,0x801a            |
0019db84: 8c63f3dc lw r3,-0x0c24(r3)        |Load Tile of interest coordinates  8019f3c4 - 0x18
0019db88: 3c02801a lui r2,0x801a            |
0019db8c: 8c4201f4 lw r2,0x01f4(r2)         |Acting unit coordinates  8019f3c4 - 0xe30
0019db90: 27bdffe8 addiu r29,r29,-0x0018    |
0019db94: afb00010 sw r16,0x0010(r29)       |
0019db98: 3c10801a lui r16,0x801a           |
0019db9c: 2610f3c4 addiu r16,r16,-0x0c3c    |AI data pointer  8019f3c4
0019dba0: 1062003d beq r3,r2,0x0019dc98     #If this tile is active unit tile :   Exit routine 
0019dba4: afbf0014 sw r31,0x0014(r29)
0019dba8: 0c067c96 jal 0x0019f258           |-->Store Unit Coordinates Transfer Tile coordinates in Unit data
0019dbac: 26040018 addiu r4,r16,0x0018      |Pointer to AI 0x18
0019dbb0: 3c03801a lui r3,0x801a            |
0019dbb4: 90630083 lbu r3,0x0083(r3)        |Load Crystal/Treasure on Tile flag
0019dbb8: 34020001 ori r2,r0,0x0001         |
0019dbbc: 1462001b bne r3,r2,0x0019dc2c     #If There is a crystal on this Tile
0019dbc0: 00000000 nop                          |
0019dbc4: 3c03801a lui r3,0x801a                |
0019dbc8: 8c630bbc lw r3,0x0bbc(r3)             |Load Acting Unit's Data Pointer
0019dbcc: 00000000 nop                          |
0019dbd0: 9462002a lhu r2,0x002a(r3)            |Max HP
0019dbd4: 00000000 nop                          |
0019dbd8: a4620028 sh r2,0x0028(r3)             |Store Max HP as current HP
0019dbdc: 3c03801a lui r3,0x801a                |
0019dbe0: 8c630bbc lw r3,0x0bbc(r3)             |Load Acting Unit's Data Pointer
0019dbe4: 00000000 nop                          |
0019dbe8: 9462002e lhu r2,0x002e(r3)            |Load Max MP
0019dbec: 00000000 nop                          |
0019dbf0: a462002c sh r2,0x002c(r3)             |Store Max MP as current MP
0019dbf4: 3c03801a lui r3,0x801a                |
0019dbf8: 8c630bbc lw r3,0x0bbc(r3)             |Load Acting Unit's Data Pointer
0019dbfc: 00000000 nop                          |
0019dc00: 9062005a lbu r2,0x005a(r3)            |Load Current Status 3
0019dc04: 00000000 nop                          |
0019dc08: 304200fe andi r2,r2,0x00fe            |
0019dc0c: a062005a sb r2,0x005a(r3)             |Remove [Critical]
0019dc10: 3c03801a lui r3,0x801a                |
0019dc14: 8c630bbc lw r3,0x0bbc(r3)             |Load Acting Unit's Data Pointer
0019dc18: 00000000 nop                          |
0019dc1c: 906201bd lbu r2,0x01bd(r3)            |Load Inflicted Status List 3 (From Current Action Data)
0019dc20: 00000000 nop                          |
0019dc24: 304200fe andi r2,r2,0x00fe            |
0019dc28: a06201bd sb r2,0x01bd(r3)             |Remove Critical
0019dc2c: 3c02801a lui r2,0x801a                |
0019dc30: 90420083 lbu r2,0x0083(r2)        |Load Crystal/Treasure on Tile flag
0019dc34: 00000000 nop                      |
0019dc38: 10400014 beq r2,r0,0x0019dc8c     #If there is a Treasure on This Tile
0019dc3c: 00000000 nop                          |
0019dc40: 3c02801a lui r2,0x801a                |
0019dc44: 8c420bbc lw r2,0x0bbc(r2)             | Acting Unit's Data Pointer
0019dc48: 00000000 nop                          |
0019dc4c: 9042005a lbu r2,0x005a(r2)            |Load Current Status 3
0019dc50: 00000000 nop                          |
0019dc54: 30420001 andi r2,r2,0x0001            |
0019dc58: 1440000c bne r2,r0,0x0019dc8c         #If Acting unit has critical
0019dc5c: 34020011 ori r2,r0,0x0011                 |
0019dc60: 3c03801a lui r3,0x801a                    |
0019dc64: 90630d7a lbu r3,0x0d7a(r3)                |Load AI/Autobattle Settings AI 0x19b6
0019dc68: 00000000 nop                              |
0019dc6c: 10620007 beq r3,r2,0x0019dc8c             #If Unit is set on Conserve CT
0019dc70: 00000000 nop                                  |
0019dc74: 3c02801a lui r2,0x801a                        |
0019dc78: 9442f3f6 lhu r2,-0x0c0a(r2)                   |AI 0x0032  8019f3c4 - 0x14 offset 0x1e
0019dc7c: 00000000 nop                                  |
0019dc80: 24420002 addiu r2,r2,0x0002                   |
0019dc84: 3c01801a lui r1,0x801a                        |
0019dc88: a422f3f6 sh r2,-0x0c0a(r1)                    |Add 2 to AI 0x32 Priority ?
0019dc8c: 8e0317f8 lw r3,0x17f8(r16)        |Acting Unit's Data Pointer
0019dc90: 34020001 ori r2,r0,0x0001         |
0019dc94: a0620187 sb r2,0x0187(r3)         |Set Movement Taken to True Movement simulation
0019dc98: 8fbf0014 lw r31,0x0014(r29)       END
0019dc9c: 8fb00010 lw r16,0x0010(r29)
0019dca0: 27bd0018 addiu r29,r29,0x0018
0019dca4: 03e00008 jr r31
0019dca8: 00000000 nop

Return location

Battle.bin
0019d484: AI_End_of_turn,_in_between_turn,_etc.
0019d494: AI_End_of_turn,_in_between_turn,_etc.