Store Skillset's Abilities

From Final Fantasy Hacktics Wiki
Revision as of 20:32, 20 April 2023 by Orkney (talk | contribs)
Jump to navigation Jump to search
Store Skillset's Abilities
---------------------------------------------------------------------
Parameters : r4 - Unit's Skillset ID
             r5 - Type of Ability to check : 0x01 - Action
                                               0x02 - Reaction
                                               0x04 - Movement
                                               0x08 - Support
                                                
Returns : r2 = 0x80066204 (Temporary Ability list pointer)
------------------------------------------------------------------------
0005a638: 27bdffd8 addiu r29,r29,-0x0028    |
0005a63c: afb40020 sw r20,0x0020(r29)       |
0005a640: 0080a021 addu r20,r4,r0           |r20 = Unit's Skillset
0005a644: afb20018 sw r18,0x0018(r29)       |
0005a648: 00a09021 addu r18,r5,r0           |r18 = Check
0005a64c: 2a820100 slti r2,r20,0x0100       |Check if skillset ID <0x100 (?? Last monster skillset is DF)
0005a650: afbf0024 sw r31,0x0024(r29)       |
0005a654: afb3001c sw r19,0x001c(r29)       |
0005a658: afb10014 sw r17,0x0014(r29)       |
0005a65c: 14400002 bne r2,r0,0x0005a668     #If Skillset ID is not a byte (invalid)
0005a660: afb00010 sw r16,0x0010(r29)           |
0005a664: 0000a021 addu r20,r0,r0               |Nullify skillset ID
0005a668: 00008021 addu r16,r0,r0           |Counter = 0 (useless)
0005a66c: 00008821 addu r17,r0,r0           |Ability counter
0005a670: 3c138006 lui r19,0x8006           |
0005a674: 26736204 addiu r19,r19,0x6204     |r19 = Pointer to Temp Ability List
                                            @LOOP 0x18 times - check all skillset abilities (and more !?)
0005a678: 02802021 addu r4,r20,r0               |r4 = Skillset ID
0005a67c: 0c01695a jal 0x0005a568               |-->Load Ability From Skillset returns r2 = Skillset N°r5 Ability ID
0005a680: 02202821 addu r5,r17,r0               |r5 = Counter2
0005a684: 00402021 addu r4,r2,r0                |r4 = Ability ID
0005a688: 3083ffff andi r3,r4,0xffff            |r3 = Ability ID
0005a68c: 2c6201a6 sltiu r2,r3,0x01a6           |check if Ability ID is a action Ability
0005a690: 14400008 bne r2,r0,0x0005a6b4         #If Ability ID is not an action
0005a694: 32420001 andi r2,r18,0x0001           |Check = Ability
0005a698: 2c6201c6 sltiu r2,r3,0x01c6               |Check if Ability is a reaction
0005a69c: 14400005 bne r2,r0,0x0005a6b4             #If Ability is not a reaction
0005a6a0: 32420002 andi r2,r18,0x0002               |Check = Reaction
0005a6a4: 2c6201e7 sltiu r2,r3,0x01e7                   |check if ability is a support  Bug : should check 0x1e6
0005a6a8: 14400002 bne r2,r0,0x0005a6b4                 #Branch if Ability is a Support
0005a6ac: 32420008 andi r2,r18,0x0008                   |Check = Support
0005a6b0: 32420004 andi r2,r18,0x0004                   |Check = Movement 
0005a6b4: 14400002 bne r2,r0,0x0005a6c0         #If r2 = 0x00 (Ability ID and check value do not match)
0005a6b8: 26100001 addiu r16,r16,0x0001         |Counter 2 +1
0005a6bc: 00002021 addu r4,r0,r0                    |Ability ID = 0
0005a6c0: a6640000 sh r4,0x0000(r19)            |Store Ability ID in 0x80066204 table
0005a6c4: 26310001 addiu r17,r17,0x0001         |Ability counter +1
0005a6c8: 2a220018 slti r2,r17,0x0018           |Check if ability counter < 0x18 Note that any value above 0x15 will be ignored in Load Ability From Skillset
0005a6cc: 1440ffea bne r2,r0,0x0005a678     Λ Loop while counter < 0x18
0005a6d0: 26730002 addiu r19,r19,0x0002         |Temp Ability List Pointer += 2
0005a6d4: 2a020018 slti r2,r16,0x0018       |Check if counter2 goes until 0x18
0005a6d8: 10400009 beq r2,r0,0x0005a700     #If counter2 < 0x18 (never ?)
0005a6dc: 00101040 sll r2,r16,0x01              |Counter * 2
0005a6e0: 3c038006 lui r3,0x8006                |
0005a6e4: 24636204 addiu r3,r3,0x6204           |Temp Ability list pointer
0005a6e8: 00431821 addu r3,r2,r3                |Ability List + counter offset
                                                {{f/loop|LOOP until end of list (until 0x18 abilities ?!)
0005a6ec: a4600000 sh r0,0x0000(r3)                 |Store Ability ID = 0
0005a6f0: 26100001 addiu r16,r16,0x0001             |Counter2 +1
0005a6f4: 2a020018 slti r2,r16,0x0018               |check if counter < 0x18
0005a6f8: 1440fffc bne r2,r0,0x0005a6ec         Λ Loop while Counter < 0x18
0005a6fc: 24630002 addiu r3,r3,0x0002               |Temp Ability List Pointer offset += 2
0005a700: 3c028006 lui r2,0x8006            |
0005a704: 24426204 addiu r2,r2,0x6204       |r2 = Returns Temp Ability List Pointer
0005a708: 8fbf0024 lw r31,0x0024(r29)
0005a70c: 8fb40020 lw r20,0x0020(r29)
0005a710: 8fb3001c lw r19,0x001c(r29)
0005a714: 8fb20018 lw r18,0x0018(r29)
0005a718: 8fb10014 lw r17,0x0014(r29)
0005a71c: 8fb00010 lw r16,0x0010(r29)
0005a720: 27bd0028 addiu r29,r29,0x0028
0005a724: 03e00008 jr r31
0005a728: 00000000 nop

Return location

WORLD.BIN
0012562c: 001255e4_-_001256c4 r5 = 0x0f
001229b0: Skillset_Display r5 = 0x0f
00120e34: Load_party_data_into_Formation_screen_data r5 = 0x01

BATTLE.BIN
00133a14: Store units small in battle display data r5 = 0x01
001975e0: Store ability/skillset data, set AI settings for ability? r5 = 0x01
0019a680: Usable Ability Setting r5 = 0x01
0019bc70: Math_Skill_Targeting r5 = 0x01

ATTACK.OUT
001c5f9c: 001c5be0_-_001c60dc r5 = 0x01

REQUIRE.OUT
001c5c8c: 001c58d0_-_001c5dcc r5 = 0x01

DEBUGCHR.OUT
001c2db0: DEBUGCHR.OUT/001c2af0_-_001c3030 r5 = 0x01

Not sure
001c2b40: 001c2888_-_001c2dc8 r5 = 0x01
000875b8: 00087254_-_00087654 r5 = 0x01
000e808c: 000e7dcc_-_000e830c r5 = 0x01 (Probably world.bin)