Difference between revisions of "Learn on hit 1"
Jump to navigation
Jump to search
(Created page with "<font face='Courier New'> 0018e6b8: 3c028019 lui r2,0x8019 0018e6bc: 8c4238bc lw r2,0x38bc(r2) load ?? 0018e6c0: 27bdffc0 addiu r29,r29,0xffc0 0018e6c4: afb60030 sw r...") |
|||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | + | Duplicated page here : [[Process_Learn_on_Hit]] | |
+ | |||
+ | Parameters: | ||
+ | r4 = (actingUnitIndex) Battle unit index of acting unit | ||
+ | r5 = (learnedAbilityStorePtr) Pointer for storing learned ability ID | ||
+ | |||
+ | Returns: | ||
+ | r2 = (Unit index) of unit that learned the ability | ||
+ | r2 = -1 if no used ability or used ability is not flagged as Learn on Hit, or no unit learned the ability | ||
+ | |||
0018e6b8: 3c028019 lui r2,0x8019 | 0018e6b8: 3c028019 lui r2,0x8019 | ||
− | 0018e6bc: 8c4238bc lw r2,0x38bc(r2) | + | 0018e6bc: 8c4238bc lw r2,0x38bc(r2) #r2 = Hamedo flag? |
0018e6c0: 27bdffc0 addiu r29,r29,0xffc0 | 0018e6c0: 27bdffc0 addiu r29,r29,0xffc0 | ||
0018e6c4: afb60030 sw r22,0x0030(r29) | 0018e6c4: afb60030 sw r22,0x0030(r29) | ||
− | 0018e6c8: 0080b021 addu r22,r4,r0 | + | 0018e6c8: 0080b021 addu r22,r4,r0 #r22 = Acting Unit data pointer |
0018e6cc: afb70034 sw r23,0x0034(r29) | 0018e6cc: afb70034 sw r23,0x0034(r29) | ||
− | 0018e6d0: 00a0b821 addu r23,r5,r0 | + | 0018e6d0: 00a0b821 addu r23,r5,r0 #r23 = ID of ability to be learned |
0018e6d4: afbf0038 sw r31,0x0038(r29) | 0018e6d4: afbf0038 sw r31,0x0038(r29) | ||
0018e6d8: afb5002c sw r21,0x002c(r29) | 0018e6d8: afb5002c sw r21,0x002c(r29) | ||
Line 14: | Line 23: | ||
0018e6e4: afb20020 sw r18,0x0020(r29) | 0018e6e4: afb20020 sw r18,0x0020(r29) | ||
0018e6e8: afb1001c sw r17,0x001c(r29) | 0018e6e8: afb1001c sw r17,0x001c(r29) | ||
− | 0018e6ec: 14400062 bne r2,r0,0x0018e878 | + | 0018e6ec: 14400062 bne r2,r0,0x0018e878 #Branch to Fail if Hamedoing? |
0018e6f0: afb00018 sw r16,0x0018(r29) | 0018e6f0: afb00018 sw r16,0x0018(r29) | ||
0018e6f4: 3c038019 lui r3,0x8019 | 0018e6f4: 3c038019 lui r3,0x8019 | ||
− | 0018e6f8: 84633d44 lh r3,0x3d44(r3) | + | 0018e6f8: 84633d44 lh r3,0x3d44(r3) #r3 = Acting Unit's used ability |
0018e6fc: 00000000 nop | 0018e6fc: 00000000 nop | ||
− | 0018e700: 1060005d beq r3,r0,0x0018e878 | + | 0018e700: 1060005d beq r3,r0,0x0018e878 #Branch to Fail if Attack |
− | 0018e704: 000318c0 sll r3,r3,0x03 | + | 0018e704: 000318c0 sll r3,r3,0x03 #r3 = Ability ID * 8 |
0018e708: 3c028006 lui r2,0x8006 | 0018e708: 3c028006 lui r2,0x8006 | ||
− | 0018e70c: 2442ebf0 addiu r2,r2,0xebf0 | + | 0018e70c: 2442ebf0 addiu r2,r2,0xebf0 #r2 = Ability data table |
− | 0018e710: 0062a821 addu r21,r3,r2 | + | 0018e710: 0062a821 addu r21,r3,r2 #r21 = Ability data for used ability |
− | 0018e714: 92a20003 lbu r2,0x0003(r21) | + | 0018e714: 92a20003 lbu r2,0x0003(r21) #r2 = Learn-on-Hit flag for used ability |
0018e718: 00000000 nop | 0018e718: 00000000 nop | ||
− | 0018e71c: 30420020 andi r2,r2,0x0020 | + | 0018e71c: 30420020 andi r2,r2,0x0020 #Check if ability can be learned on hit |
− | 0018e720: 14400007 bne r2,r0,0x0018e740 | + | 0018e720: 14400007 bne r2,r0,0x0018e740 #Branch to Unit Loop Prep if able to LoH |
− | 0018e724: 00008821 addu r17,r0,r0 | + | 0018e724: 00008821 addu r17,r0,r0 #r17 = Unit counter = 0 |
− | 0018e728: 08063a1f j 0x0018e87c | + | 0018e728: 08063a1f j 0x0018e87c #Jump to End if not able to LoH |
− | 0018e72c: 2402ffff addiu r2,r0,0xffff | + | 0018e72c: 2402ffff addiu r2,r0,0xffff #r2 = -1 (fail) |
+ | |||
+ | Success: | ||
0018e730: 3c038019 lui r3,0x8019 | 0018e730: 3c038019 lui r3,0x8019 | ||
− | 0018e734: 94633d44 lhu r3,0x3d44(r3) | + | 0018e734: 94633d44 lhu r3,0x3d44(r3) #r3 = Used ability |
− | 0018e738: 08063a1f j 0x0018e87c | + | 0018e738: 08063a1f j 0x0018e87c #Jump to End |
− | 0018e73c: a6e30000 sh r3,0x0000(r23) | + | 0018e73c: a6e30000 sh r3,0x0000(r23) #Store used ability |
+ | |||
+ | Unit Loop Prep: | ||
0018e740: 27b20010 addiu r18,r29,0x0010 | 0018e740: 27b20010 addiu r18,r29,0x0010 | ||
− | 0018e744: 0000a021 addu r20,r0,r0 | + | 0018e744: 0000a021 addu r20,r0,r0 #r20 = Unit pointer = 0 |
− | + | ||
− | 0018e748: 12d10047 beq r22,r17,0x0018e868 | + | Unit Loop: |
+ | 0018e748: 12d10047 beq r22,r17,0x0018e868 #Branch to Battlefield Loop if Unit = Attacking Unit | ||
0018e74c: 00000000 nop | 0018e74c: 00000000 nop | ||
0018e750: 3c028019 lui r2,0x8019 | 0018e750: 3c028019 lui r2,0x8019 | ||
− | 0018e754: 244208cc addiu r2,r2,0x08cc | + | 0018e754: 244208cc addiu r2,r2,0x08cc #r2 = Unit data |
− | 0018e758: 02828021 addu r16,r20,r2 | + | 0018e758: 02828021 addu r16,r20,r2 #r16 = Unit data for unit being checked |
− | 0018e75c: 92020189 lbu r2,0x0189(r16) | + | 0018e75c: 92020189 lbu r2,0x0189(r16) #r2 = LoH byte |
0018e760: 00000000 nop | 0018e760: 00000000 nop | ||
− | 0018e764: 30420002 andi r2,r2,0x0002 | + | 0018e764: 30420002 andi r2,r2,0x0002 #Check if unit has "hit by ability" flag |
− | 0018e768: 1040003f beq r2,r0,0x0018e868 | + | 0018e768: 1040003f beq r2,r0,0x0018e868 #Branch to Battlefield Loop if target wasn't hit by ability |
− | 0018e76c: 34020004 ori r2,r0,0x0004 | + | 0018e76c: 34020004 ori r2,r0,0x0004 #r2 = 0x04 |
− | 0018e770: 92030006 lbu r3,0x0006(r16) | + | 0018e770: 92030006 lbu r3,0x0006(r16) #r3 = Unit gender |
0018e774: 00000000 nop | 0018e774: 00000000 nop | ||
− | 0018e778: 30630020 andi r3,r3,0x0020 | + | 0018e778: 30630020 andi r3,r3,0x0020 #Check if Unit is a monster |
− | 0018e77c: 1460003a bne r3,r0,0x0018e868 | + | 0018e77c: 1460003a bne r3,r0,0x0018e868 #Branch to Battlefield Loop if monster |
− | 0018e780: a2020189 sb r2,0x0189(r16) | + | 0018e780: a2020189 sb r2,0x0189(r16) #Store 0x04 to LoH byte ("target is learning ability" flag) |
− | 0018e784: 02002021 addu r4,r16,r0 | + | 0018e784: 02002021 addu r4,r16,r0 #r4 = Unit data |
− | 0018e788: 0c01786c jal 0x0005e1b0 check | + | 0018e788: 0c01786c jal 0x0005e1b0 #[[Status Checks (r5 = set to check)]] routine |
− | 0018e78c: 34050004 ori r5,r0,0x0004 | + | 0018e78c: 34050004 ori r5,r0,0x0004 #r5 = 0x04 |
− | 0018e790: 14400035 bne r2,r0,0x0018e868 | + | 0018e790: 14400035 bne r2,r0,0x0018e868 #Branch to Battlefield Loop if status present |
0018e794: 00000000 nop | 0018e794: 00000000 nop | ||
− | 0018e798: 92030003 lbu r3,0x0003(r16) | + | 0018e798: 92030003 lbu r3,0x0003(r16) #r3 = Job ID |
− | 0018e79c: 92130012 lbu r19,0x0012(r16) | + | 0018e79c: 92130012 lbu r19,0x0012(r16) #r19 = Primary skillset |
− | 0018e7a0: 2862004a slti r2,r3,0x004a | + | 0018e7a0: 2862004a slti r2,r3,0x004a #Check if special job |
− | 0018e7a4: 10400003 beq r2,r0,0x0018e7b4 | + | 0018e7a4: 10400003 beq r2,r0,0x0018e7b4 #Branch if not special job |
0018e7a8: 00000000 nop | 0018e7a8: 00000000 nop | ||
− | 0018e7ac: 080639ee j 0x0018e7b8 | + | 0018e7ac: 080639ee j 0x0018e7b8 #Skip generic job ID adjustment |
− | 0018e7b0: 00001821 addu r3,r0,r0 | + | 0018e7b0: 00001821 addu r3,r0,r0 #r3 = 0 if special job |
− | 0018e7b4: 2463ffb6 addiu r3,r3,0xffb6 | + | 0018e7b4: 2463ffb6 addiu r3,r3,0xffb6 #r3 = Job ID - 0x4a |
− | 0018e7b8: 02402021 addu r4,r18,r0 | + | 0018e7b8: 02402021 addu r4,r18,r0 #r4 = Stack |
− | 0018e7bc: 00031040 sll r2,r3,0x01 | + | 0018e7bc: 00031040 sll r2,r3,0x01 #r2 = Job ID*2 |
− | 0018e7c0: 00431021 addu r2,r2,r3 | + | 0018e7c0: 00431021 addu r2,r2,r3 #r2 = Job ID*3 |
− | 0018e7c4: 00501021 addu r2,r2,r16 | + | 0018e7c4: 00501021 addu r2,r2,r16 #r2 = Unit data + job ID*3 |
− | 0018e7c8: 24430099 addiu r3,r2,0x0099 | + | 0018e7c8: 24430099 addiu r3,r2,0x0099 #r3 = Adjusted Job ID + 99 |
− | 0018e7cc: 26450003 addiu r5,r18,0x0003 | + | 0018e7cc: 26450003 addiu r5,r18,0x0003 |
− | 0018e7d0: 90620000 lbu r2,0x0000(r3) | + | 0018e7d0: 90620000 lbu r2,0x0000(r3) #r2 = Learned abilities |
0018e7d4: 00000000 nop | 0018e7d4: 00000000 nop | ||
− | 0018e7d8: a0820000 sb r2,0x0000(r4) | + | 0018e7d8: a0820000 sb r2,0x0000(r4) #Store learned abilities on stack |
0018e7dc: 24840001 addiu r4,r4,0x0001 | 0018e7dc: 24840001 addiu r4,r4,0x0001 | ||
0018e7e0: 0085102a slt r2,r4,r5 | 0018e7e0: 0085102a slt r2,r4,r5 | ||
− | 0018e7e4: 1440fffa bne r2,r0,0x0018e7d0 | + | 0018e7e4: 1440fffa bne r2,r0,0x0018e7d0 #Repeat for all known abilities |
0018e7e8: 24630001 addiu r3,r3,0x0001 | 0018e7e8: 24630001 addiu r3,r3,0x0001 | ||
− | 0018e7ec: 00008021 addu r16,r0,r0 | + | 0018e7ec: 00008021 addu r16,r0,r0 #r16 = Ability counter = 0 |
− | Ability Loop | + | |
− | 0018e7f0: 06010002 bgez r16,0x0018e7fc | + | Ability Loop: |
− | 0018e7f4: 02001021 addu r2,r16,r0 | + | 0018e7f0: 06010002 bgez r16,0x0018e7fc #Branch if counter is valid (>0) |
− | 0018e7f8: 26020007 addiu r2,r16,0x0007 | + | 0018e7f4: 02001021 addu r2,r16,r0 #r2 = Ability counter |
− | 0018e7fc: 000210c3 sra r2,r2,0x03 | + | 0018e7f8: 26020007 addiu r2,r16,0x0007 #r2 = Ability counter +7 (if it wasnt valid) |
− | 0018e800: 000220c0 sll r4,r2,0x03 | + | 0018e7fc: 000210c3 sra r2,r2,0x03 #r2 = counter/8 |
− | 0018e804: 02042023 subu r4,r16,r4 | + | 0018e800: 000220c0 sll r4,r2,0x03 |
− | 0018e808: 34030080 ori r3,r0,0x0080 | + | 0018e804: 02042023 subu r4,r16,r4 #r4 = counter %8 |
+ | 0018e808: 34030080 ori r3,r0,0x0080 #r3 = 0x80 | ||
0018e80c: 02421021 addu r2,r18,r2 | 0018e80c: 02421021 addu r2,r18,r2 | ||
− | 0018e810: 90420000 lbu r2,0x0000(r2) | + | 0018e810: 90420000 lbu r2,0x0000(r2) #r2 = Ability flags |
− | 0018e814: 00831807 srav r3,r3,r4 | + | 0018e814: 00831807 srav r3,r3,r4 |
0018e818: 00431024 and r2,r2,r3 | 0018e818: 00431024 and r2,r2,r3 | ||
− | 0018e81c: 1440000e bne r2,r0,0x0018e858 | + | 0018e81c: 1440000e bne r2,r0,0x0018e858 #Branch to next ability if ability already known |
0018e820: 00000000 nop | 0018e820: 00000000 nop | ||
− | 0018e824: 326400ff andi r4,r19,0x00ff r4 = | + | 0018e824: 326400ff andi r4,r19,0x00ff #r4 = Skillset ID |
− | 0018e828: 0c01695a jal 0x0005a568 | + | 0018e828: 0c01695a jal 0x0005a568 #[[Load Ability From Skillset]] routine |
− | 0018e82c: 02002821 addu r5,r16,r0 | + | 0018e82c: 02002821 addu r5,r16,r0 #r5 = Ability counter (ability number) |
0018e830: 3c038019 lui r3,0x8019 | 0018e830: 3c038019 lui r3,0x8019 | ||
− | 0018e834: 84633d44 lh r3,0x3d44(r3) | + | 0018e834: 84633d44 lh r3,0x3d44(r3) #r3 = Used ability ID |
0018e838: 3042ffff andi r2,r2,0xffff | 0018e838: 3042ffff andi r2,r2,0xffff | ||
− | 0018e83c: 14430006 bne r2,r3,0x0018e858 | + | 0018e83c: 14430006 bne r2,r3,0x0018e858 #Branch to next ability if used ability != ability being checked |
0018e840: 00000000 nop | 0018e840: 00000000 nop | ||
− | 0018e844: 92a50002 lbu r5,0x0002(r21) | + | 0018e844: 92a50002 lbu r5,0x0002(r21) #r5 = Chance to learn |
− | 0018e848: 0c017833 jal 0x0005e0cc check if random > chance | + | 0018e848: 0c017833 jal 0x0005e0cc #[[Pass/Fail Roll]] routine (check if random > chance) |
− | 0018e84c: 34040064 ori r4,r0,0x0064 | + | 0018e84c: 34040064 ori r4,r0,0x0064 #r4 = Base chance = 100% |
− | 0018e850: 1040ffb7 beq r2,r0,0x0018e730 | + | 0018e850: 1040ffb7 beq r2,r0,0x0018e730 #Branch to Success if learned |
0018e854: 02201021 addu r2,r17,r0 | 0018e854: 02201021 addu r2,r17,r0 | ||
− | 0018e858: 26100001 addiu r16,r16,0x0001 | + | 0018e858: 26100001 addiu r16,r16,0x0001 #r16 = Ability counter ++ |
0018e85c: 2a020018 slti r2,r16,0x0018 | 0018e85c: 2a020018 slti r2,r16,0x0018 | ||
− | 0018e860: 1440ffe3 bne r2,r0,0x0018e7f0 | + | 0018e860: 1440ffe3 bne r2,r0,0x0018e7f0 #Branch to Ability Loop (repeat 0x18 times) |
0018e864: 00000000 nop | 0018e864: 00000000 nop | ||
− | 0018e868: 26310001 addiu r17,r17,0x0001 | + | |
− | 0018e86c: 2a220015 slti r2,r17,0x0015 | + | Battlefield Loop: |
− | 0018e870: 1440ffb5 bne r2,r0,0x0018e748 | + | 0018e868: 26310001 addiu r17,r17,0x0001 #r17 = Unit counter ++ |
− | 0018e874: 269401c0 addiu r20,r20,0x01c0 | + | 0018e86c: 2a220015 slti r2,r17,0x0015 #Check if cycled through all units |
− | 0018e878: 2402ffff addiu r2,r0,0xffff | + | 0018e870: 1440ffb5 bne r2,r0,0x0018e748 #Branch to Unit Loop if not all units have been checked |
+ | 0018e874: 269401c0 addiu r20,r20,0x01c0 #Unit pointer ++ | ||
+ | |||
+ | Fail: | ||
+ | 0018e878: 2402ffff addiu r2,r0,0xffff #r2 = -1 | ||
+ | |||
+ | End: | ||
0018e87c: 8fbf0038 lw r31,0x0038(r29) | 0018e87c: 8fbf0038 lw r31,0x0038(r29) | ||
0018e880: 8fb70034 lw r23,0x0034(r29) | 0018e880: 8fb70034 lw r23,0x0034(r29) | ||
Line 128: | Line 149: | ||
0018e8a4: 03e00008 jr r31 | 0018e8a4: 03e00008 jr r31 | ||
0018e8a8: 00000000 nop | 0018e8a8: 00000000 nop | ||
− | + | ||
+ | == Return Locations == | ||
+ | |||
+ | 80073598: [[Some_post_action_(including_learn_on_hit_setup)]] |
Latest revision as of 16:51, 19 October 2024
Duplicated page here : Process_Learn_on_Hit
Parameters: r4 = (actingUnitIndex) Battle unit index of acting unit r5 = (learnedAbilityStorePtr) Pointer for storing learned ability ID Returns: r2 = (Unit index) of unit that learned the ability r2 = -1 if no used ability or used ability is not flagged as Learn on Hit, or no unit learned the ability 0018e6b8: 3c028019 lui r2,0x8019 0018e6bc: 8c4238bc lw r2,0x38bc(r2) #r2 = Hamedo flag? 0018e6c0: 27bdffc0 addiu r29,r29,0xffc0 0018e6c4: afb60030 sw r22,0x0030(r29) 0018e6c8: 0080b021 addu r22,r4,r0 #r22 = Acting Unit data pointer 0018e6cc: afb70034 sw r23,0x0034(r29) 0018e6d0: 00a0b821 addu r23,r5,r0 #r23 = ID of ability to be learned 0018e6d4: afbf0038 sw r31,0x0038(r29) 0018e6d8: afb5002c sw r21,0x002c(r29) 0018e6dc: afb40028 sw r20,0x0028(r29) 0018e6e0: afb30024 sw r19,0x0024(r29) 0018e6e4: afb20020 sw r18,0x0020(r29) 0018e6e8: afb1001c sw r17,0x001c(r29) 0018e6ec: 14400062 bne r2,r0,0x0018e878 #Branch to Fail if Hamedoing? 0018e6f0: afb00018 sw r16,0x0018(r29) 0018e6f4: 3c038019 lui r3,0x8019 0018e6f8: 84633d44 lh r3,0x3d44(r3) #r3 = Acting Unit's used ability 0018e6fc: 00000000 nop 0018e700: 1060005d beq r3,r0,0x0018e878 #Branch to Fail if Attack 0018e704: 000318c0 sll r3,r3,0x03 #r3 = Ability ID * 8 0018e708: 3c028006 lui r2,0x8006 0018e70c: 2442ebf0 addiu r2,r2,0xebf0 #r2 = Ability data table 0018e710: 0062a821 addu r21,r3,r2 #r21 = Ability data for used ability 0018e714: 92a20003 lbu r2,0x0003(r21) #r2 = Learn-on-Hit flag for used ability 0018e718: 00000000 nop 0018e71c: 30420020 andi r2,r2,0x0020 #Check if ability can be learned on hit 0018e720: 14400007 bne r2,r0,0x0018e740 #Branch to Unit Loop Prep if able to LoH 0018e724: 00008821 addu r17,r0,r0 #r17 = Unit counter = 0 0018e728: 08063a1f j 0x0018e87c #Jump to End if not able to LoH 0018e72c: 2402ffff addiu r2,r0,0xffff #r2 = -1 (fail) Success: 0018e730: 3c038019 lui r3,0x8019 0018e734: 94633d44 lhu r3,0x3d44(r3) #r3 = Used ability 0018e738: 08063a1f j 0x0018e87c #Jump to End 0018e73c: a6e30000 sh r3,0x0000(r23) #Store used ability Unit Loop Prep: 0018e740: 27b20010 addiu r18,r29,0x0010 0018e744: 0000a021 addu r20,r0,r0 #r20 = Unit pointer = 0 Unit Loop: 0018e748: 12d10047 beq r22,r17,0x0018e868 #Branch to Battlefield Loop if Unit = Attacking Unit 0018e74c: 00000000 nop 0018e750: 3c028019 lui r2,0x8019 0018e754: 244208cc addiu r2,r2,0x08cc #r2 = Unit data 0018e758: 02828021 addu r16,r20,r2 #r16 = Unit data for unit being checked 0018e75c: 92020189 lbu r2,0x0189(r16) #r2 = LoH byte 0018e760: 00000000 nop 0018e764: 30420002 andi r2,r2,0x0002 #Check if unit has "hit by ability" flag 0018e768: 1040003f beq r2,r0,0x0018e868 #Branch to Battlefield Loop if target wasn't hit by ability 0018e76c: 34020004 ori r2,r0,0x0004 #r2 = 0x04 0018e770: 92030006 lbu r3,0x0006(r16) #r3 = Unit gender 0018e774: 00000000 nop 0018e778: 30630020 andi r3,r3,0x0020 #Check if Unit is a monster 0018e77c: 1460003a bne r3,r0,0x0018e868 #Branch to Battlefield Loop if monster 0018e780: a2020189 sb r2,0x0189(r16) #Store 0x04 to LoH byte ("target is learning ability" flag) 0018e784: 02002021 addu r4,r16,r0 #r4 = Unit data 0018e788: 0c01786c jal 0x0005e1b0 #Status Checks (r5 = set to check) routine 0018e78c: 34050004 ori r5,r0,0x0004 #r5 = 0x04 0018e790: 14400035 bne r2,r0,0x0018e868 #Branch to Battlefield Loop if status present 0018e794: 00000000 nop 0018e798: 92030003 lbu r3,0x0003(r16) #r3 = Job ID 0018e79c: 92130012 lbu r19,0x0012(r16) #r19 = Primary skillset 0018e7a0: 2862004a slti r2,r3,0x004a #Check if special job 0018e7a4: 10400003 beq r2,r0,0x0018e7b4 #Branch if not special job 0018e7a8: 00000000 nop 0018e7ac: 080639ee j 0x0018e7b8 #Skip generic job ID adjustment 0018e7b0: 00001821 addu r3,r0,r0 #r3 = 0 if special job 0018e7b4: 2463ffb6 addiu r3,r3,0xffb6 #r3 = Job ID - 0x4a 0018e7b8: 02402021 addu r4,r18,r0 #r4 = Stack 0018e7bc: 00031040 sll r2,r3,0x01 #r2 = Job ID*2 0018e7c0: 00431021 addu r2,r2,r3 #r2 = Job ID*3 0018e7c4: 00501021 addu r2,r2,r16 #r2 = Unit data + job ID*3 0018e7c8: 24430099 addiu r3,r2,0x0099 #r3 = Adjusted Job ID + 99 0018e7cc: 26450003 addiu r5,r18,0x0003 0018e7d0: 90620000 lbu r2,0x0000(r3) #r2 = Learned abilities 0018e7d4: 00000000 nop 0018e7d8: a0820000 sb r2,0x0000(r4) #Store learned abilities on stack 0018e7dc: 24840001 addiu r4,r4,0x0001 0018e7e0: 0085102a slt r2,r4,r5 0018e7e4: 1440fffa bne r2,r0,0x0018e7d0 #Repeat for all known abilities 0018e7e8: 24630001 addiu r3,r3,0x0001 0018e7ec: 00008021 addu r16,r0,r0 #r16 = Ability counter = 0 Ability Loop: 0018e7f0: 06010002 bgez r16,0x0018e7fc #Branch if counter is valid (>0) 0018e7f4: 02001021 addu r2,r16,r0 #r2 = Ability counter 0018e7f8: 26020007 addiu r2,r16,0x0007 #r2 = Ability counter +7 (if it wasnt valid) 0018e7fc: 000210c3 sra r2,r2,0x03 #r2 = counter/8 0018e800: 000220c0 sll r4,r2,0x03 0018e804: 02042023 subu r4,r16,r4 #r4 = counter %8 0018e808: 34030080 ori r3,r0,0x0080 #r3 = 0x80 0018e80c: 02421021 addu r2,r18,r2 0018e810: 90420000 lbu r2,0x0000(r2) #r2 = Ability flags 0018e814: 00831807 srav r3,r3,r4 0018e818: 00431024 and r2,r2,r3 0018e81c: 1440000e bne r2,r0,0x0018e858 #Branch to next ability if ability already known 0018e820: 00000000 nop 0018e824: 326400ff andi r4,r19,0x00ff #r4 = Skillset ID 0018e828: 0c01695a jal 0x0005a568 #Load Ability From Skillset routine 0018e82c: 02002821 addu r5,r16,r0 #r5 = Ability counter (ability number) 0018e830: 3c038019 lui r3,0x8019 0018e834: 84633d44 lh r3,0x3d44(r3) #r3 = Used ability ID 0018e838: 3042ffff andi r2,r2,0xffff 0018e83c: 14430006 bne r2,r3,0x0018e858 #Branch to next ability if used ability != ability being checked 0018e840: 00000000 nop 0018e844: 92a50002 lbu r5,0x0002(r21) #r5 = Chance to learn 0018e848: 0c017833 jal 0x0005e0cc #Pass/Fail Roll routine (check if random > chance) 0018e84c: 34040064 ori r4,r0,0x0064 #r4 = Base chance = 100% 0018e850: 1040ffb7 beq r2,r0,0x0018e730 #Branch to Success if learned 0018e854: 02201021 addu r2,r17,r0 0018e858: 26100001 addiu r16,r16,0x0001 #r16 = Ability counter ++ 0018e85c: 2a020018 slti r2,r16,0x0018 0018e860: 1440ffe3 bne r2,r0,0x0018e7f0 #Branch to Ability Loop (repeat 0x18 times) 0018e864: 00000000 nop Battlefield Loop: 0018e868: 26310001 addiu r17,r17,0x0001 #r17 = Unit counter ++ 0018e86c: 2a220015 slti r2,r17,0x0015 #Check if cycled through all units 0018e870: 1440ffb5 bne r2,r0,0x0018e748 #Branch to Unit Loop if not all units have been checked 0018e874: 269401c0 addiu r20,r20,0x01c0 #Unit pointer ++ Fail: 0018e878: 2402ffff addiu r2,r0,0xffff #r2 = -1 End: 0018e87c: 8fbf0038 lw r31,0x0038(r29) 0018e880: 8fb70034 lw r23,0x0034(r29) 0018e884: 8fb60030 lw r22,0x0030(r29) 0018e888: 8fb5002c lw r21,0x002c(r29) 0018e88c: 8fb40028 lw r20,0x0028(r29) 0018e890: 8fb30024 lw r19,0x0024(r29) 0018e894: 8fb20020 lw r18,0x0020(r29) 0018e898: 8fb1001c lw r17,0x001c(r29) 0018e89c: 8fb00018 lw r16,0x0018(r29) 0018e8a0: 27bd0040 addiu r29,r29,0x0040 0018e8a4: 03e00008 jr r31 0018e8a8: 00000000 nop
Return Locations
80073598: Some_post_action_(including_learn_on_hit_setup)