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