Room Size & Position Based Shared Item Code
#1
Room Size & Position Based Shared Item Code

This is a version of Shared Item code that will only execute on a desired room size AND desired position within that room. If both room size and position is not equal to what you set in the code, your Shared Item will NOT execute. Feel free to add activators/dactivators.

There is one 'flaw' to this code. Let's say you have the code set to room size 7 and you are in a current WW of 6 players, then somebody joins the WW (into Live view mode), the code will then auto activate during the race (because there are now 7 total players in the WW).

NTSC-U
C2653664 00000002
80040040 3D808000
900C1600 00000000
C27AB704 00000005
3D808000 816C1600
2C0B000X 40A20010
2C19000Y 40A20008
386000WW 90770020
60000000 00000000

PAL
C2657AEC 00000002
80040040 3D808000
900C1600 00000000
C27BA164 00000005
3D808000 816C1600
2C0B000X 40A20010
2C19000Y 40A20008
386000WW 90770020
60000000 00000000

NTSC-J
C2657158 00000002
80040040 3D808000
900C1600 00000000
C27B97D0 00000005
3D808000 816C1600
2C0B000X 40A20010
2C19000Y 40A20008
386000WW 90770020
60000000 00000000

NTSC-K
C2645E04 00000002
80040040 3D808000
900C1600 00000000
C27A8524 00000005
3D808000 816C1600
2C0B000X 40A20010
2C19000Y 40A20008
386000WW 90770020
60000000 00000000

X = Size of Room
Y = Position
WW = Item

WW Item Values:
00 = Green Shell
01 = Red Shell
02 = Banana
03 = Fake Item Box
04 = Mushroom
05 = Triple Mushroom
06 = Bob-omb
07 = Blue Shell
08 = Lightning
09 = Star
0A = Golden Mushroom
0B = Mega Mushroom
0C = Blooper
0D = POW Block
0E = Cloud
0F = Bullet Bill
10 = Triple Green Shell
11 = Triple Red Shell
12 = Triple Banana
14 = Nothing

##Source (Room Size Storage Code)##
lwz r0, 0x0040 (r4) #Default ASM. Register 0 now holds the room size value

lis r12, 0x8000 #Set 1st half address to store room size value which will be read later by Shared Item Code
stw r0, 0x1600 (r12) #Store room size value to 0x80001600 address, offset used to complete rest of address location

##Source (Shared Item Code)##
lis r12, 0x8000 #Set 1st half address to load room size value that was stored from previous code
lwz r11, 0x1600 (r12) #Load room size value from 0x80001600 address, offset used to complete rest of address location
cmpwi r11, 0xX #Compare Room size value to what value the User has set it to
bne+ dont_execute #If not equal to User's desired value, jump to dont_execute label. This is most likely to happen, hence the plus symbol

cmpwi r25, 0xY #If room size value checks out, now compare position value to what value the User has set it to
bne+ dont_execute #If not equal to User's desired value, jump to dont_execute label. This is most likely to happen, hence the plus symbol

li r3, 0xWW #If both room size and position values check out, preform the typical shared item code using User's set Item value

dont_execute:
stw r3,32(r23) #Default ASM

Code creator: zak
Code contributor(s): Star, Guru
Reply
#2
Nice work !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)