Learn Used Ability
Jump to navigation
Jump to search
# ROUTINE: Learn Used Ability # Parameters: # r4 = (unit) In-battle unit data of learning unit 8018e8ac: 27bdffd0 addiu r29,r29,-0x0030 8018e8b0: afbf002c sw r31,0x002c(r29) 8018e8b4: afb40028 sw r20,0x0028(r29) 8018e8b8: afb30024 sw r19,0x0024(r29) 8018e8bc: afb20020 sw r18,0x0020(r29) 8018e8c0: afb1001c sw r17,0x001c(r29) 8018e8c4: afb00018 sw r16,0x0018(r29) 8018e8c8: 90860003 lbu r6,0x0003(r4) # unit.JobID 8018e8cc: 90940012 lbu r20,0x0012(r4) # unit.PrimarySkilset 8018e8d0: 28c2004a slti r2,r6,0x004a 8018e8d4: 10400002 beq r2,r0,0x8018e8e0 8018e8d8: 24c6ffb6 addiu r6,r6,-0x004a # jobWheelIndex = unit.JobID - 0x4A # if (unit.JobID < 0x4A) { // Special character 8018e8dc: 00003021 addu r6,r0,r0 # jobWheelIndex = 0 # } 8018e8e0: 27a30010 addiu r3,r29,0x0010 # localLearnedAbilityFlagsPtr = localLearnedAbilityFlags 8018e8e4: 00061040 sll r2,r6,0x01 # jobWheelIndex * 2 8018e8e8: 00461021 addu r2,r2,r6 # jobWheelIndex * 3 8018e8ec: 00441021 addu r2,r2,r4 # (jobWheelIndex * 3) + unit 8018e8f0: 24450099 addiu r5,r2,0x0099 # learnedAbilityPtr = unit + (jobWheelIndex * 3) + 0x99 8018e8f4: 27a70013 addiu r7,r29,0x0013 # sentinelPtr = localLearnedAbilityFlagsPtr + 3 # do { 8018e8f8: 90a20000 lbu r2,0x0000(r5) # *learnedAbilityPtr 8018e8fc: 00000000 nop 8018e900: a0620000 sb r2,0x0000(r3) # *localLearnedAbilityFlagsPtr = *learnedAbilityPtr 8018e904: 24630001 addiu r3,r3,0x0001 # localLearnedAbilityFlagsPtr = localLearnedAbilityFlagsPtr + 1 8018e908: 0067102a slt r2,r3,r7 8018e90c: 1440fffa bne r2,r0,0x8018e8f8 8018e910: 24a50001 addiu r5,r5,0x0001 # learnedAbilityPtr = learnedAbilityPtr + 1 # } while (localLearnedAbilityFlagsPtr < sentinelPtr); 8018e914: 00008021 addu r16,r0,r0 # abilityIndex = 0 8018e918: 00061040 sll r2,r6,0x01 # jobWheelIndex * 2 8018e91c: 00461021 addu r2,r2,r6 # jobWheelIndex * 3 8018e920: 00441021 addu r2,r2,r4 # (jobWheelIndex * 3) + unit 8018e924: 24530099 addiu r19,r2,0x0099 # learnedAbilityPtr = unit + (jobWheelIndex * 3) + 0x99 # for (; abilityIndex < 25; abilityIndex++) { 8018e928: 06010002 bgez r16,0x8018e934 8018e92c: 02001821 addu r3,r16,r0 8018e930: 26030007 addiu r3,r16,0x0007 8018e934: 000388c3 sra r17,r3,0x03 # abilityIndex / 8 8018e938: 001118c0 sll r3,r17,0x03 8018e93c: 02031823 subu r3,r16,r3 # abilityIndex % 8 8018e940: 34040080 ori r4,r0,0x0080 # 0x80 8018e944: 03b11021 addu r2,r29,r17 # localLearnedAbilityFlagsPtr + (abilityIndex / 8) - 0x10 8018e948: 90420010 lbu r2,0x0010(r2) # currentLearnedAbilityFlags = *(localLearnedAbilityFlagsPtr + (abilityIndex / 8)) 8018e94c: 00649007 srav r18,r4,r3 # abilityFlag = 0x80 >> (abilityIndex % 8) 8018e950: 00521024 and r2,r2,r18 # currentLearnedAbilityFlag = currentLearnedAbilityFlags & abilityFlag 8018e954: 1440000c bne r2,r0,0x8018e988 # if (currentLearnedAbilityFlag != 0) continue; // Ability already learned 8018e958: 328400ff andi r4,r20,0x00ff 8018e95c: 0c01695a jal 0x8005a568 # abilityID = Load Ability From Skillset (unit.PrimarySkillset, abilityIndex); 8018e960: 02002821 addu r5,r16,r0 8018e964: 3c038019 lui r3,0x8019 8018e968: 84633d44 lh r3,0x3d44(r3) # usedAbilityID 8018e96c: 3042ffff andi r2,r2,0xffff 8018e970: 14430005 bne r2,r3,0x8018e988 # if (abilityID != usedAbilityID) continue; 8018e974: 02711821 addu r3,r19,r17 # learnedAbilityPtr + (abilityIndex / 8) 8018e978: 90620000 lbu r2,0x0000(r3) # currentLearnedAbilityValue = *(learnedAbilityPtr + (abilityIndex / 8)) 8018e97c: 00000000 nop 8018e980: 02421025 or r2,r18,r2 # currentLearnedAbilityValue | abilityFlag 8018e984: a0620000 sb r2,0x0000(r3) # *(learnedAbilityPtr + (abilityIndex / 8)) = currentLearnedAbilityValue | abilityFlag 8018e988: 26100001 addiu r16,r16,0x0001 8018e98c: 2a020018 slti r2,r16,0x0018 8018e990: 1440ffe5 bne r2,r0,0x8018e928 8018e994: 00000000 nop # } 8018e998: 8fbf002c lw r31,0x002c(r29) 8018e99c: 8fb40028 lw r20,0x0028(r29) 8018e9a0: 8fb30024 lw r19,0x0024(r29) 8018e9a4: 8fb20020 lw r18,0x0020(r29) 8018e9a8: 8fb1001c lw r17,0x001c(r29) 8018e9ac: 8fb00018 lw r16,0x0018(r29) 8018e9b0: 27bd0030 addiu r29,r29,0x0030 8018e9b4: 03e00008 jr r31 8018e9b8: 00000000 nop
Return Locations
00077a50: 000779a0 - 00077b54