Load Known Ability Flag
Jump to navigation
Jump to search
BATTLE.BIN : Load Known Ability Flag ------------------------------------------------------------------------------------------- Parameters : r4 = Unit's ID r5 = Skillset ID r6 = Ability counter (position in skillset) Returns : r2 = 0x01 if Ability is known r2 = 0x00 if not r2 = 0x01 by default if unit is using a skillset with no data in unit's data. ------------------------------------------------------------------------------------------- 0019aa50: 000410c0 sll r2,r4,0x03 |Unit's ID * 8 0019aa54: 00441023 subu r2,r2,r4 |ID * 7 0019aa58: 00021180 sll r2,r2,0x06 |ID * 1c0 0019aa5c: 3c038019 lui r3,0x8019 | 0019aa60: 246308cc addiu r3,r3,0x08cc | 0019aa64: 00432021 addu r4,r2,r3 |Unit Battle data pointer 0019aa68: 90820006 lbu r2,0x0006(r4) |Load Unit's ENTD flags 0019aa6c: 00000000 nop | 0019aa70: 30420020 andi r2,r2,0x0020 |Check for monster 0019aa74: 14400022 bne r2,r0,0x0019ab00 #If unit is not a monster / Else branch to END with r2 = 0x01 0019aa78: 34020001 ori r2,r0,0x0001 |r2 = 1 0019aa7c: 24a3fffb addiu r3,r5,-0x05 |r3 = Skillset ID - 5 (Basic Skill = 0x00) 0019aa80: 2c620013 sltiu r2,r3,0x0013 |Check If Skillset is generic (but not mime) 0019aa84: 10400003 beq r2,r0,0x0019aa94 #If Skillset is a generic skillset 0019aa88: 00000000 nop | 0019aa8c: 08066ab0 j 0x0019aac0 >>Avoid not generic section 0019aa90: 00602821 addu r5,r3,r0 |Skillset ID - 5 (0x00 for Basic skill) #Else - Mime or Not generic skillset 0019aa94: 90820012 lbu r2,0x0012(r4) |Load Unit's Primary Skillset 0019aa98: 00000000 nop | 0019aa9c: 10a20007 beq r5,r2,0x0019aabc #If skillset is not primary skillset 0019aaa0: 00000000 nop | 0019aaa4: 90820162 lbu r2,0x0162(r4) |Load Unit's Special Skillset? 0019aaa8: 00000000 nop | 0019aaac: 10a20004 beq r5,r2,0x0019aac0 #If skillset is not special skillset /Else Branch with skillset = 0x00 0019aab0: 00002821 addu r5,r0,r0 |Skillset = 0 (Base skillset) 0019aab4: 08066ac0 j 0x0019ab00 >>Jump to END returns r2 = 0x01 - Ability is known 0019aab8: 34020001 ori r2,r0,0x0001 | #Else : Skillset is primary skillset (not generic) 0019aabc: 00002821 addu r5,r0,r0 |r5 = 0x00 (Base skillset) 0019aac0: 00c01821 addu r3,r6,r0 |r3 = Counter 0019aac4: 00051040 sll r2,r5,0x01 |Skillset ID * 2 (note : if skillset is not a generic one, ID = 0x00) 0019aac8: 00451021 addu r2,r2,r5 |Skillset ID *3 0019aacc: 00441021 addu r2,r2,r4 |Unit data pointer + skillset offset 0019aad0: 04c10002 bgez r6,0x0019aadc #If Counter < 0x00 0019aad4: 24420099 addiu r2,r2,0x0099 |Pointer to Unit's Known skillset's abilties 0019aad8: 24c30007 addiu r3,r6,0x0007 |Counter + 7 0019aadc: 000320c3 sra r4,r3,0x03 |Counter / 8 (0x00 or 0x1) - Ability Offset in Unit's known abilities 0019aae0: 00441021 addu r2,r2,r4 |Pointer to ability known byte in unit's skillset data 0019aae4: 90420000 lbu r2,0x0000(r2) |Load known Ability Byte 0019aae8: 000420c0 sll r4,r4,0x03 |Counter / 8 * 8 (0x00 or 0x08) 0019aaec: 00c42023 subu r4,r6,r4 |Position of ability known flag in byte 0019aaf0: 34030080 ori r3,r0,0x0080 |r3 = 0x80 0019aaf4: 00831807 srav r3,r3,r4 |Bitmask to known flag 0019aaf8: 00431024 and r2,r2,r3 |Check Ability known flag 0019aafc: 0002102b sltu r2,r0,r2 |r2 = 0x1 if known, r2 = 0x0 otherwise 0019ab00: 03e00008 jr r31 END 0019ab04: 00000000 nop
Return locations
BATTLE.BIN 00195120: Set_AI_ability_considerations_for_all_units_and_self 00197664: Store_ability/skillset_data,_set_AI_settings_for_ability? 001976a4: Store_ability/skillset_data,_set_AI_settings_for_ability? 001976e4: Store_ability/skillset_data,_set_AI_settings_for_ability? 0019a6bc: Usable_Ability_Setting 0019a720: Usable_Ability_Setting 0019a788: Usable_Ability_Setting 0019a94c: Usable_Ability_Setting 0019bcf4: Math_Skill_Targeting 0019bd34: Math_Skill_Targeting 0019be14: Math_Skill_Targeting 0019be40: Math_Skill_Targeting