Status checks

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
BATTLE.BIN - Status_checks
---------------------------------------------------------------------------------------
Parameter : r4 = unit pointer	

Returns : r2 = 0x01 if unit do not exist, has a frozen CT or is ridden
          r2 = 0x06 if unit is dead
          r2 with flags :		     
                  0x0a : Unit is sleeping
                  0x10 : Unit has haste
                  0x20 : Unit has slow
---------------------------------------------------------------------------------------
001832cc: 27bdffe8 addiu r29,r29,-0x0018    |
001832d0: afb00010 sw r16,0x0010(r29)       |
001832d4: 00808021 addu r16,r4,r0           |Pointer to Unit battle stats
001832d8: afbf0014 sw r31,0x0014(r29)       |
001832dc: 92030001 lbu r3,0x0001(r16)       |Unit ID
001832e0: 340200ff ori r2,r0,0x00ff         |
001832e4: 1062000a beq r3,r2,0x00183310     #If Unit do not exist :  Exit and returns 0x01
001832e8: 02002021 addu r4,r16,r0
001832ec: 0c01786c jal 0x0005e1b0           |-->Status_Checks_(r5_%3D_set_to_check)  Check if unit CT is frozen
001832f0: 34050003 ori r5,r0,0x0003         |CT freezing statii
001832f4: 1440001a bne r2,r0,0x00183360     #If Unit CT is frozen :  Exit and returns 0x01
001832f8: 34020001 ori r2,r0,0x0001
001832fc: 92020182 lbu r2,0x0182(r16)       |load mount info
00183300: 00000000 nop                      |
00183304: 30420040 andi r2,r2,0x0040        |Check if unit is being ridden
00183308: 10400003 beq r2,r0,0x00183318     #If Unit is being ridden
0018330c: 00000000 nop                          |
00183310: 08060cd8 j 0x00183360                 | Exit and returns 0x01
00183314: 34020001 ori r2,r0,0x0001
00183318: 92020058 lbu r2,0x0058(r16)       |Unit current Status 1
0018331c: 9205005b lbu r5,0x005b(r16)       |Unit current Status 4
00183320: 9204005c lbu r4,0x005c(r16)       |Unit current Status 5
00183324: 30420020 andi r2,r2,0x0020        |check [Dead]
00183328: 1440000d bne r2,r0,0x00183360     #If Unit is Dead :  Exit and returns 0x06
0018332c: 34020006 ori r2,r0,0x0006
00183330: 30820010 andi r2,r4,0x0010        |check [Sleep]
00183334: 0002102b sltu r2,r0,r2            |1 if sleep, else 0
00183338: 00021023 subu r2,r0,r2            |0xff if sleep else 0
0018333c: 3043000a andi r3,r2,0x000a        |0x0a if sleep, else 0
00183340: 30a20008 andi r2,r5,0x0008        |check [Haste]
00183344: 10400002 beq r2,r0,0x00183350     #If Unit has haste
00183348: 30a20004 andi r2,r5,0x0004        |check [slow]
0018334c: 34630010 ori r3,r3,0x0010             |Enable 0x10 on r3
00183350: 10400003 beq r2,r0,0x00183360     #If unit has slow
00183354: 00601021 addu r2,r3,r0                |
00183358: 34630020 ori r3,r3,0x0020             |Enable 0x20 on r3
0018335c: 00601021 addu r2,r3,r0            |return r3
00183360: 8fbf0014 lw r31,0x0014(r29)       END
00183364: 8fb00010 lw r16,0x0010(r29)
00183368: 27bd0018 addiu r29,r29,0x0018
0018336c: 03e00008 jr r31
00183370: 00000000 nop

Return location

Battle.bin
000725e0: 00072544_-_00072670
001829cc: In_between_turn_control_routine
00182a5c: In_between_turn_control_routine
00182b4c: In_between_turn_control_routine
00182bbc: In_between_turn_control_routine
00182c1c: In_between_turn_control_routine
00182da8: In_between_turn_control_routine
00182e24: In_between_turn_control_routine
00183dac: Change_of_Turn_check