Check if Unit will get his Turn without Status

From Final Fantasy Hacktics Wiki
Revision as of 15:38, 31 March 2024 by Orkney (talk | contribs)
Jump to navigation Jump to search
BATTLE.BIN :  - 
Check if Charm Don't Move or Don't act will fade before Active turn of Unit
------------------------------------------------------------------------------------------
Parameter : r4 = Unit Battle data pointer
            r5 = Status ID
Return : r2 = 0x00 if Unit status will fade before active Turn
         r2 = 0x01 If Unit will get his turn with Charm, don't Move or Don't Act
         r2 = 0x01 if passed status ID is invalid
------------------------------------------------------------------------------------------
0019efb0: 27bdffe0 addiu r29,r29,-0x0020     |
0019efb4: afb10014 sw r17,0x0014(r29)        |
0019efb8: 00808821 addu r17,r4,r0            |Unit Battle data poiner
0019efbc: afb00010 sw r16,0x0010(r29)        |
0019efc0: 00a08021 addu r16,r5,r0            |Desired Status ID
0019efc4: 34020022 ori r2,r0,0x0022          |
0019efc8: 12020005 beq r16,r2,0x0019efe0     #If Status ID is Not Charm
0019efcc: afbf0018 sw r31,0x0018(r29)            |
0019efd0: 2602ffdc addiu r2,r16,-0x0024          |Status ID - 0x24
0019efd4: 2c420002 sltiu r2,r2,0x0002            |0x1 if Status ID is Don't move or Don't Act
0019efd8: 1040000a beq r2,r0,0x0019f004          #If Status ID is NOT [Don't Move] or [Don't Act] Exit routine return 0x01
0019efdc: 34020001 ori r2,r0,0x0001                  |
                                            [Charm] [Don't Move] [Don't Act]
0019efe0: 0c0666e6 jal 0x00199b98            |-->Calculate_Clockticks_Until_Unit_Acts
0019efe4: 02202021 addu r4,r17,r0            |
0019efe8: 02301821 addu r3,r17,r16           |
0019efec: 90630045 lbu r3,0x0045(r3)         |Considered Status CT
0019eff0: 00000000 nop                       |
0019eff4: 0062182a slt r3,r3,r2              |0x1 if Status CT < Unit Turn
0019eff8: 14600002 bne r3,r0,0x0019f004      #If Status will fade before unit active Turn Exit routine return 0x00
0019effc: 00001021 addu r2,r0,r0             |
0019f000: 34020001 ori r2,r0,0x0001          |Else return 0x01
0019f004: 8fbf0018 lw r31,0x0018(r29)
0019f008: 8fb10014 lw r17,0x0014(r29)
0019f00c: 8fb00010 lw r16,0x0010(r29)
0019f010: 27bd0020 addiu r29,r29,0x0020
0019f014: 03e00008 jr r31
0019f018: 00000000 nop

Return locations

BATTLE.BIN
 0019e928: AI_Ability_Use_Decisions   r5 = 0x22
 0019ede8: AI_Ability_Use_Decisions