Difference between revisions of "Main Reaction subroutine - ENTD/ID stuff"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
m
Line 1: Line 1:
  Calculate unlocked jobs from JP gain, set ability element?
+
  Parameters : r4 = unit data pointer
  0018dff8: 27bdffd8 addiu r29,r29,0xffd8
+
  0018dffc: afb0 0018 sw r16,0x 0018(r29)
+
Returns nothing
  0018e000: 00808021 addu r16,r4,r0
+
  0018e004: 27a60010 addiu r6,r29,0x0010
+
Check if Jp gain unlocks new Jobs or increase Job Lv
  0018e008: afbf0024 sw r31,0x0024(r29)
+
Set 0x8019390d to 0x01 if Job Lv is increased
  0018e00c: afb20020 sw r18,0x0020(r29)
+
----------------------------------------------------------------------------------------------
  0018e010: afb1001c sw r17,0x001c(r29)
+
  0018dff8: 27bdffd8 addiu r29,r29,-0x0028    |
  0018e014: 92120003 lbu r18,0x0003(r16) load job ID
+
  0018dffc: afb00018 sw r16,0x0018(r29)       |
  0018e018: 9211018a lbu r17,0x018a(r16) load Unit ID
+
  0018e000: 00808021 addu r16,r4,r0           |{{f/adr|<nowiki>r16 = Unit data pointer</nowiki>}}
  0018e01c: 0c05fa8a jal 0x0017ea28 Calculate JP/Unlocked jobs
+
  0018e004: 27a60010 addiu r6,r29,0x0010     |{{f/adr|<nowiki>r6 = Stack 0x0010</nowiki>}}
  0018e020: 02402821 addu r5,r18,r0
+
  0018e008: afbf0024 sw r31,0x0024(r29)       |
  0018e024: 02202021 addu r4,r17,r0
+
  0018e00c: afb20020 sw r18,0x0020(r29)       |
  0018e028: 00408821 addu r17,r2,r0
+
  0018e010: afb1001c sw r17,0x001c(r29)       |
  0018e02c: 920601ba lbu r6,0x01ba(r16) load ENTD flags
+
  0018e014: 92120003 lbu r18,0x0003(r16)     |{{f/load|<nowiki>r18 = Unit current Job ID</nowiki>}}
  0018e030: 920501b5 lbu r5,0x01b5(r16) load Gained JP
+
  0018e018: 9211018a lbu r17,0x018a(r16)     |{{f/load|<nowiki>17 = Unit raw ID (without FF check)</nowiki>}}
  0018e034: 8fa70010 lw r7,0x0010(r29)
+
  0018e01c: 0c05fa8a jal 0x0017ea28           |{{f/jal|Load_Job_Level|Load_Job_Level}} {{f/std|<nowiki>returns r2 = Unit current job Lv</nowiki>}}
  0018e038: 0c05faa0 jal 0x0017ea80 Calculate JP/Unlocked jobs
+
  0018e020: 02402821 addu r5,r18,r0           |{{f/std|<nowiki>r5 = Unit current Job</nowiki>}}
  0018e03c: 30c60030 andi r6,r6,0x0030           r6 = enemy team check
+
  0018e024: 02202021 addu r4,r17,r0           |{{f/std|<nowiki>r4 = Unit ID</nowiki>}}
  0018e040: 02002021 addu r4,r16,r0
+
  0018e028: 00408821 addu r17,r2,r0           |{{f/std|<nowiki>r17 = Unit current job Lv</nowiki>}}
  0018e044: 02402821 addu r5,r18,r0
+
  0018e02c: 920601ba lbu r6,0x01ba(r16)       |{{f/load|<nowiki>r6 = Unit ENTD modified flags</nowiki>}}
  0018e048: 0c05fa8a jal 0x0017ea28 Calculate JP/Unlocked Jobs
+
  0018e030: 920501b5 lbu r5,0x01b5(r16)       |{{f/load|<nowiki>r5 = Unit gained Jp</nowiki>}}
  0018e04c: 27a60010 addiu r6,r29,0x0010
+
  0018e034: 8fa70010 lw r7,0x0010(r29)       |{{f/load|<nowiki>r7 = Unit Current generic job ID</nowiki>}}
  0018e050: 10510003 beq r2,r17,0x 0018e060      jump to end, return 0x01
+
  0018e038: 0c05faa0 jal 0x0017ea80           |{{f/jal|Calculate JP/Unlocked jobs|Calculate JP/Unlocked jobs}}
  0018e054: 34020001 ori r2,r0,0x0001
+
  0018e03c: 30c60030 andi r6,r6,0x0030       |{{f/std|<nowiki>r6 = Unit Team</nowiki>}}
  0018e058: 3c018019 lui r1,0x8019
+
  0018e040: 02002021 addu r4,r16,r0           |{{f/adr|<nowiki>r4 = Unit data pointer</nowiki>}}
  0018e05c: a022390d sb r2,0x390d(r1) AI ability element = 0x01 (dark?)
+
  0018e044: 02402821 addu r5,r18,r0           |{{f/std|<nowiki>r5 = Unit current Job ID</nowiki>}}
  0018e060: 8fbf0024 lw r31,0x0024(r29)
+
  0018e048: 0c05fa8a jal 0x0017ea28           |{{f/jal|Load_Job_Level|Load_Job_Level}} {{f/std|<nowiki>returns r2 = Unit current job Lv</nowiki>}}
 +
  0018e04c: 27a60010 addiu r6,r29,0x0010     |{{f/adr|<nowiki>r6 = Stack 0x0010</nowiki>}}
 +
  0018e050: 10510003 beq r2,r17,0x0018e060    {{f/Cond|If Unit gained a job Lv}}
 +
  0018e054: 34020001 ori r2,r0,0x0001             |{{f/std|<nowiki>r2 = 0x01</nowiki>}}
 +
  0018e058: 3c018019 lui r1,0x8019               |
 +
  0018e05c: a022390d sb r2,0x390d(r1)             |{{f/store|Store 0x01 at 0x8019390d}} {{f/std| 0x8019390d / 8019390d}}
 +
  0018e060: 8fbf0024 lw r31,0x0024(r29)       END
 
  0018e064: 8fb20020 lw r18,0x0020(r29)
 
  0018e064: 8fb20020 lw r18,0x0020(r29)
 
  0018e068: 8fb1001c lw r17,0x001c(r29)
 
  0018e068: 8fb1001c lw r17,0x001c(r29)
  0018e06c: 8fb0 0018 lw r16,0x 0018(r29)
+
  0018e06c: 8fb00018 lw r16,0x0018(r29)
 
  0018e070: 27bd0028 addiu r29,r29,0x0028
 
  0018e070: 27bd0028 addiu r29,r29,0x0028
 
  0018e074: 03e00008 jr r31
 
  0018e074: 03e00008 jr r31
 
  0018e078: 00000000 nop
 
  0018e078: 00000000 nop
 +
=== Retun location ===
 +
'''Battle.bin'''
 +
0018c23c: [[Main_Action_Routine_-_performs_ability_effects]]

Revision as of 20:10, 29 June 2022

Parameters : r4 = unit data pointer

Returns nothing

Check if Jp gain unlocks new Jobs or increase Job Lv
Set 0x8019390d to 0x01 if Job Lv is increased
----------------------------------------------------------------------------------------------
0018dff8: 27bdffd8 addiu r29,r29,-0x0028    |
0018dffc: afb00018 sw r16,0x0018(r29)       |
0018e000: 00808021 addu r16,r4,r0           |r16 = Unit data pointer
0018e004: 27a60010 addiu r6,r29,0x0010      |r6 = Stack 0x0010
0018e008: afbf0024 sw r31,0x0024(r29)       |
0018e00c: afb20020 sw r18,0x0020(r29)       |
0018e010: afb1001c sw r17,0x001c(r29)       |
0018e014: 92120003 lbu r18,0x0003(r16)      |r18 = Unit current Job ID
0018e018: 9211018a lbu r17,0x018a(r16)      |17 = Unit raw ID (without FF check)
0018e01c: 0c05fa8a jal 0x0017ea28           |-->Load_Job_Level returns r2 = Unit current job Lv
0018e020: 02402821 addu r5,r18,r0           |r5 = Unit current Job
0018e024: 02202021 addu r4,r17,r0           |r4 = Unit ID
0018e028: 00408821 addu r17,r2,r0           |r17 = Unit current job Lv
0018e02c: 920601ba lbu r6,0x01ba(r16)       |r6 = Unit ENTD modified flags
0018e030: 920501b5 lbu r5,0x01b5(r16)       |r5 = Unit gained Jp
0018e034: 8fa70010 lw r7,0x0010(r29)        |r7 = Unit Current generic job ID
0018e038: 0c05faa0 jal 0x0017ea80           |-->Calculate JP/Unlocked jobs
0018e03c: 30c60030 andi r6,r6,0x0030        |r6 = Unit Team
0018e040: 02002021 addu r4,r16,r0           |r4 = Unit data pointer
0018e044: 02402821 addu r5,r18,r0           |r5 = Unit current Job ID
0018e048: 0c05fa8a jal 0x0017ea28           |-->Load_Job_Level returns r2 = Unit current job Lv
0018e04c: 27a60010 addiu r6,r29,0x0010      |r6 = Stack 0x0010
0018e050: 10510003 beq r2,r17,0x0018e060    #If Unit gained a job Lv
0018e054: 34020001 ori r2,r0,0x0001             |r2 = 0x01
0018e058: 3c018019 lui r1,0x8019                |
0018e05c: a022390d sb r2,0x390d(r1)             |Store 0x01 at 0x8019390d  0x8019390d / 8019390d
0018e060: 8fbf0024 lw r31,0x0024(r29)       END
0018e064: 8fb20020 lw r18,0x0020(r29)
0018e068: 8fb1001c lw r17,0x001c(r29)
0018e06c: 8fb00018 lw r16,0x0018(r29)
0018e070: 27bd0028 addiu r29,r29,0x0028
0018e074: 03e00008 jr r31
0018e078: 00000000 nop

Retun location

Battle.bin
0018c23c: Main_Action_Routine_-_performs_ability_effects