R/S/M Flag Setting
Jump to navigation
Jump to search
Parameters : r5 = Ability ID Check if Ability is RSM (hardcoded with ID) if yes, enable it in Unit's RSM data Several abilities can be set, but only one reaction ability will be set in Unit 0x14 (used for display ?) --------------------------------------------------------------------------------------------------------------------- 0005b82c: 24a2fe5a addiu r2,r5,-0x01a6 |r2 = Ability ID - 0x1a6 (A Save Ability ID) 0005b830: 00a01821 addu r3,r5,r0 |r3 = Ability ID 0005b834: 3045ffff andi r5,r2,0xffff |r5 = Ability ID - 0x1a6 (halfword) 0005b838: 2ca20058 sltiu r2,r5,0x0058 |r2 = 0x01 If Ability ID is between 0x1a6 and 0x1fd 0005b83c: 1040000e beq r2,r0,0x0005b878 #If Ability Is a RSM ability /Else branch to END 0005b840: 3062ffff andi r2,r3,0xffff |r2 = Ability ID 0005b844: 2c4201c6 sltiu r2,r2,0x01c6 |r2 = 0x01 If Ability ID < 0x1a6 (Equip armor ID) 0005b848: 10400002 beq r2,r0,0x0005b854 #If Ability ID is a reaction Ability 0005b84c: 00000000 nop | 0005b850: a4830014 sh r3,0x0014(r4) |Store Ability ID as Unit's reaction ability 0005b854: 2484008b addiu r4,r4,0x008b |r4 = Unit Reaction 1 Data pointer 0005b858: 000510c2 srl r2,r5,0x03 |r2 = Ability's Set 0005b85c: 00822021 addu r4,r4,r2 |r4 = Unit ability Set matching Ability ID data pointer 0005b860: 30a50007 andi r5,r5,0x0007 |r5 = Position of Ability in his set (Remainder of Ability/8) 0005b864: 34020080 ori r2,r0,0x0080 |r2 = 0x80 0005b868: 90830000 lbu r3,0x0000(r4) |r3 = Unit's RSM set flags 0005b86c: 00a21007 srav r2,r2,r5 |r2 = Ability bitmask 0005b870: 00621825 or r3,r3,r2 |r3 = Unit RSM abilities with new RSM ability enabled 0005b874: a0830000 sb r3,0x0000(r4) |Store updated ability flags 0005b878: 03e00008 jr r31 END 0005b87c: 00000000 nop
Return Locations
SCUS_942.21 0005b7d8: Enable Unit's R/S/M Flags 0005b7f0: ^^ 0005b7fc: ^^ 0005b808: ^^