Disable Tile Flag 0x10 For Dead and Jumping Units

From Final Fantasy Hacktics Wiki
(Redirected from 00174df8 - 00174e80)
Jump to navigation Jump to search
BATTLE.BIN : Disable Tile Flag 0x10 For Dead and Jumping Units
--------------------------------------------------------------------------------------------------------------
Parameters : Nothing

Returns : Nothing

Check all units : If dead or Jumping, disable the flag 0x10 (Reachable tile ?) in Scratch Pad at 0x18f00200
                  (Not sure yet, but it seems to be used in unit Path-finding)
--------------------------------------------------------------------------------------------------------------
00174df8: 27bdffe0 addiu r29,r29,-0x0020    |
00174dfc: afb10014 sw r17,0x0014(r29)       |
00174e00: 00008821 addu r17,r0,r0           |Initialize counter r17 = 0 (initial value for counter)
00174e04: afb00010 sw r16,0x0010(r29)       |
00174e08: 3c108019 lui r16,0x8019           |
00174e0c: 261008cc addiu r16,r16,0x08cc     |Start of Unit Battle Data (Dynamic pointer + 0x1c0 each iteration)
00174e10: afbf0018 sw r31,0x0018(r29)       |
                                            @LOOP - Though all units
00174e14: 92030001 lbu r3,0x0001(r16)           |Unit ID
00174e18: 340200ff ori r2,r0,0x00ff             |
00174e1c: 10620010 beq r3,r2,0x00174e60         #If Unit doesn't exist : Branch to   Next Unit iteration
00174e20: 26310001 addiu r17,r17,0x0001         |Counter +1
00174e24: 92020058 lbu r2,0x0058(r16)               |Load Current Status 1
00174e28: 00000000 nop                              |
00174e2c: 30420024 andi r2,r2,0x0024                |
00174e30: 1040000c beq r2,r0,0x00174e64             #If Unit is not Dead nor Jumping
00174e34: 2a220015 slti r2,r17,0x0015                   |
00174e38: 0c060428 jal 0x001810a0                       |-->Map Location Calculation returns Unit's Tile ID
00174e3c: 02002021 addu r4,r16,r0                       |Send Unit ID
00174e40: 3c038019 lui r3,0x8019                        |
00174e44: 8c63f4f0 lw r3,-0x0b10(r3)                    |Pointer to Scratch Pad (0x1f800200) - refered as S-Pad 0x200
00174e48: 00000000 nop                                  |
00174e4c: 00621821 addu r3,r3,r2                        |Pointer to Unit's Tile data (S-Pad 0x200)
00174e50: 90620000 lbu r2,0x0000(r3)                    |Load Tile's flag
00174e54: 00000000 nop                                  |
00174e58: 304200ef andi r2,r2,0x00ef                    |
00174e5c: a0620000 sb r2,0x0000(r3)                     |Disable flag 0x10 (not reachable anymore ?)
00174e60: 2a220015 slti r2,r17,0x0015                   |
00174e64: 1440ffeb bne r2,r0,0x00174e14     Λ Loop 0x15 Times
00174e68: 261001c0 addiu r16,r16,0x01c0         |Unit Battle data offset
00174e6c: 8fbf0018 lw r31,0x0018(r29)       END
00174e70: 8fb10014 lw r17,0x0014(r29)
00174e74: 8fb00010 lw r16,0x0010(r29)
00174e78: 27bd0020 addiu r29,r29,0x0020
00174e7c: 03e00008 jr r31
00174e80: 00000000 nop

Return location

BATTLE.BIN
 001752e4: 00175288_-_001754cc