Enable Unit's R/S/M Flags

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
Parameters : r4 = Unit data pointer

Enable unit R/S/M flags (0x8b to 0x95) based on Unit Innate status, Unit's 0x14 (Reaction Ability), 0x16 (Support) and 0x18 (Movement)
------------------------------------------------------------------------------------------------------------------------------------------
0005b7a0: 27bdffe0 addiu r29,r29,-0x0020    |
0005b7a4: afb10014 sw r17,0x0014(r29)       |
0005b7a8: 00808821 addu r17,r4,r0           |r17 = Unit's data pointer
0005b7ac: 2624008b addiu r4,r17,0x008b      |r4 = Unit's Reaction 1 data pointer
0005b7b0: 3405000b ori r5,r0,0x000b         |r5 = 0x0b
0005b7b4: afbf001c sw r31,0x001c(r29)       |
0005b7b8: afb20018 sw r18,0x0018(r29)       |
0005b7bc: 0c017991 jal 0x0005e644           |-->Data_Nullifying Nullify data from Unit Reaction 1 (0x8b) to Movement 3 (0x95) 
0005b7c0: afb00010 sw r16,0x0010(r29)       |
0005b7c4: 00009021 addu r18,r0,r0           |r18 = 0x00
0005b7c8: 02208021 addu r16,r17,r0          |r16 = Unit's data pointer
0005b7cc: 02202021 addu r4,r17,r0           |r4 = Unit's dta pointer
                                            @LOOP - though all unit's innate abilities (from job ?)
0005b7d0: 9605000a lhu r5,0x000a(r16)           |r5 = This iteration Unit's Innate ability ID
0005b7d4: 26100002 addiu r16,r16,0x0002         |r16 = Unit's Innate Ability data pointer (halfwords - +0x02 each iteration)
0005b7d8: 0c016e0b jal 0x0005b82c               |-->R/S/M_Flag_Setting Enable Innate abilities
0005b7dc: 26520001 addiu r18,r18,0x0001         |r18 = Loop counter + 1 Counter += 1
0005b7e0: 2a420004 slti r2,r18,0x0004           |r2 = 0x01 if counter < 0x04
0005b7e4: 1440fffa bne r2,r0,0x0005b7d0     Λ Loop 4 times (all unit innate abilities)
0005b7e8: 02202021 addu r4,r17,r0               |r4 = Unit's data pointer
0005b7ec: 96250014 lhu r5,0x0014(r17)       |r5 = Unit's Reaction Ability ID
0005b7f0: 0c016e0b jal 0x0005b82c           |-->R/S/M_Flag_Setting Enable Reaction ability (could have been overwritten by Innate (just above)
0005b7f4: 02202021 addu r4,r17,r0           |r4 = Unit's dta pointer
0005b7f8: 96250016 lhu r5,0x0016(r17)       |r5 = Unit's Support Ability ID
0005b7fc: 0c016e0b jal 0x0005b82c           |-->R/S/M_Flag_Setting Enable Support ability (Unit 0x8f to 0x92)
0005b800: 02202021 addu r4,r17,r0           |r4 = Unit's dta pointer
0005b804: 96250018 lhu r5,0x0018(r17)       |r5 = Unit's Movement Ability ID
0005b808: 0c016e0b jal 0x0005b82c           |-->R/S/M_Flag_Setting Enable Movement ability (Unit 0x93 to 0x95)
0005b80c: 02202021 addu r4,r17,r0           |r4 = Unit's dta pointer
0005b810: 8fbf001c lw r31,0x001c(r29)       |
0005b814: 8fb20018 lw r18,0x0018(r29)       |
0005b818: 8fb10014 lw r17,0x0014(r29)       |
0005b81c: 8fb00010 lw r16,0x0010(r29)       |
0005b820: 27bd0020 addiu r29,r29,0x0020     |
0005b824: 03e00008 jr r31                   END
0005b828: 00000000 nop                     

Return Locations

0005a964: Initialize Unit's Job Data
0005aa54: Unit Battle Initialization
0005d6f0: Status Setting/Checking + Equip/R/S/M Stats