Difference between revisions of "Enable Unit's R/S/M Flags"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
  Enable Unit's R/S/M Flags
+
Parameters : r4 = Unit data pointer
  0005b7a0: 27bdffe0 addiu r29,r29,0xffe0
+
  0005b7a4: afb10014 sw r17,0x0014(r29)
+
  Enable unit R/S/M flags (0x8b to 0x95) based on Unit Innate status, Unit's 0x14 (Reaction Ability), 0x16 (Support) and 0x18 (Movement)
  0005b7a8: 00808821 addu r17,r4,r0 r17 = Unit's Data Pointer
+
------------------------------------------------------------------------------------------------------------------------------------------
  0005b7ac: 2624008b addiu r4,r17,0x008b r4 = Unit's Data Pointer  (Reactions 1)
+
  0005b7a0: 27bdffe0 addiu r29,r29,-0x0020    |
  0005b7b0: 3405000b ori r5,r0,0x000b r5 = b (Reaction -> Movement)
+
  0005b7a4: afb10014 sw r17,0x0014(r29)       |
  0005b7b4: afbf001c sw r31,0x001c(r29)
+
  0005b7a8: 00808821 addu r17,r4,r0           |{{f/adr|<nowiki>r17 = Unit's data pointer</nowiki>}}
  0005b7b8: afb20018 sw r18,0x0018(r29)
+
  0005b7ac: 2624008b addiu r4,r17,0x008b     |{{f/adr|<nowiki>r4 = Unit's Reaction 1 data pointer</nowiki>}}
  0005b7bc: 0c017991 jal 0x0005e644 Data Nullifying (Reactions through  Movements)
+
  0005b7b0: 3405000b ori r5,r0,0x000b         |{{f/std|<nowiki>r5 = 0x0b</nowiki>}}
  0005b7c0: afb00010 sw r16,0x0010(r29)
+
  0005b7b4: afbf001c sw r31,0x001c(r29)       |
  0005b7c4: 00009021 addu r18,r0,r0 Counter = 0
+
  0005b7b8: afb20018 sw r18,0x0018(r29)       |
  0005b7c8: 02208021 addu r16,r17,r0 r16 = Unit's Data Pointer
+
  0005b7bc: 0c017991 jal 0x0005e644           |{{f/jal|Data_Nullifying|Data_Nullifying}} Nullify data from Unit Reaction 1 (0x8b) to Movement 3 (0x95)  
  0005b7cc: 02202021 addu r4,r17,r0 r4 = Unit's Data Pointer
+
  0005b7c0: afb00010 sw r16,0x0010(r29)       |
  0005b7d0: 9605000a lhu r5,0x000a(r16) Load Innate Ability 1
+
  0005b7c4: 00009021 addu r18,r0,r0           |{{f/std|<nowiki>r18 = 0x00</nowiki>}}
  0005b7d4: 26100002 addiu r16,r16,0x0002 Unit's Data Pointer += 2
+
  0005b7c8: 02208021 addu r16,r17,r0         |{{f/std|<nowiki>r16 = Unit's data pointer</nowiki>}}
  0005b7d8: 0c016e0b jal 0x0005b82c R/S/M Flag Setting (Add Innate Abilities)
+
  0005b7cc: 02202021 addu r4,r17,r0           |{{f/std|<nowiki>r4 = Unit's dta pointer</nowiki>}}
  0005b7dc: 26520001 addiu r18,r18,0x0001 Counter += 1
+
                                            '''@LOOP - though all unit's innate abilities (from job ?)'''
  0005b7e0: 2a420004 slti r2,r18,0x0004
+
  0005b7d0: 9605000a lhu r5,0x000a(r16)           |{{f/load|<nowiki>r5 = This iteration Unit's Innate ability ID</nowiki>}}
  0005b7e4: 1440fffa bne r2,r0,0x0005b7d0 Branch if all Innates haven't been checked
+
  0005b7d4: 26100002 addiu r16,r16,0x0002         |{{f/adr|<nowiki>r16 = Unit's Innate Ability data pointer (halfwords - +0x02 each iteration)</nowiki>}}
  0005b7e8: 02202021 addu r4,r17,r0 r4 = Unit's Data Pointer
+
  0005b7d8: 0c016e0b jal 0x0005b82c               |{{f/jal|R/S/M_Flag_Setting|R/S/M_Flag_Setting}} Enable Innate abilities
  0005b7ec: 96250014 lhu r5,0x0014(r17) Load Unit's Reaction Ability
+
  0005b7dc: 26520001 addiu r18,r18,0x0001         |{{f/std|<nowiki>r18 = Loop counter + 1</nowiki>}} {{f/std|<nowiki>Counter += 1</nowiki>}}
  0005b7f0: 0c016e0b jal 0x0005b82c R/S/M Flag Setting (Add Reaction)
+
  0005b7e0: 2a420004 slti r2,r18,0x0004           |{{f/std|<nowiki>r2 = 0x01 if counter < 0x04</nowiki>}}
  0005b7f4: 02202021 addu r4,r17,r0 r4 = Unit's Data Pointer
+
  0005b7e4: 1440fffa bne r2,r0,0x0005b7d0     {{f/eloop|Loop 4 times (all unit innate abilities)}}
  0005b7f8: 96250016 lhu r5,0x0016(r17) Load Unit's Support Ability
+
  0005b7e8: 02202021 addu r4,r17,r0               |{{f/std|<nowiki>r4 = Unit's data pointer</nowiki>}}
  0005b7fc: 0c016e0b jal 0x0005b82c R/S/M Flag Setting (Add Support)
+
  0005b7ec: 96250014 lhu r5,0x0014(r17)       |{{f/load|<nowiki>r5 = Unit's Reaction Ability ID</nowiki>}}
  0005b800: 02202021 addu r4,r17,r0 r4 = Unit's Data Pointer
+
  0005b7f0: 0c016e0b jal 0x0005b82c           |{{f/jal|R/S/M_Flag_Setting|R/S/M_Flag_Setting}} Enable Reaction ability (could have been overwritten by Innate (just above)
  0005b804: 96250018 lhu r5,0x0018(r17) Load Unit's Movement Ability
+
  0005b7f4: 02202021 addu r4,r17,r0           |{{f/std|<nowiki>r4 = Unit's dta pointer</nowiki>}}
  0005b808: 0c016e0b jal 0x0005b82c R/S/M Flag Setting (Add Movement)
+
  0005b7f8: 96250016 lhu r5,0x0016(r17)       |{{f/load|<nowiki>r5 = Unit's Support Ability ID</nowiki>}}
  0005b80c: 02202021 addu r4,r17,r0 r4 = Unit's Data Pointer
+
  0005b7fc: 0c016e0b jal 0x0005b82c           |{{f/jal|R/S/M_Flag_Setting|R/S/M_Flag_Setting}} Enable Support ability (Unit 0x8f to 0x92)
  0005b810: 8fbf001c lw r31,0x001c(r29)
+
  0005b800: 02202021 addu r4,r17,r0           |{{f/std|<nowiki>r4 = Unit's dta pointer</nowiki>}}
  0005b814: 8fb20018 lw r18,0x0018(r29)
+
  0005b804: 96250018 lhu r5,0x0018(r17)       |{{f/load|<nowiki>r5 = Unit's Movement Ability ID</nowiki>}}
  0005b818: 8fb10014 lw r17,0x0014(r29)
+
  0005b808: 0c016e0b jal 0x0005b82c           |{{f/jal|R/S/M_Flag_Setting|R/S/M_Flag_Setting}} Enable Movement ability (Unit 0x93 to 0x95)
  0005b81c: 8fb00010 lw r16,0x0010(r29)
+
  0005b80c: 02202021 addu r4,r17,r0           |{{f/std|<nowiki>r4 = Unit's dta pointer</nowiki>}}
  0005b820: 27bd0020 addiu r29,r29,0x0020
+
  0005b810: 8fbf001c lw r31,0x001c(r29)       |
  0005b824: 03e00008 jr r31
+
  0005b814: 8fb20018 lw r18,0x0018(r29)       |
  0005b828: 00000000 nop
+
  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 ==
 
== Return Locations ==

Latest revision as of 20:05, 21 March 2022

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