In-Race Room Size & Position Based Shared Item Code
#1
In-Race Room Size & Position Based Shared Item Code

This is a version of Shared Item code that will only execute on a desired in-race room size AND desired position within that room. If both in-race 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/deactivators.

NTSC-U
C27AC3C0 00000002
3D808000 992C164F
2C09000C 00000000
C27AB704 00000005
3D808000 896C164F
2C0B000X 40A20010
2C19000Y 40A20008
386000WW 90770020
60000000 00000000

PAL
C27BAE20 00000002
3D808000 992C164F
2C09000C 00000000
C27BA164 00000005
3D808000 896C164F
2C0B000X 40A20010
2C19000Y 40A20008
386000WW 90770020
60000000 00000000

NTSC-J
C27BA48C 00000002
3D808000 992C164F
2C09000C 00000000
C27B97D0 00000005
3D808000 896C164F
2C0B000X 40A20010
2C19000Y 40A20008
386000WW 90770020
60000000 00000000

NTSC-K
C27A91E0 00000002
3D808000 992C164F
2C09000C 00000000
C27A8524 00000005
3D808000 896C164F
2C0B000X 40A20010
2C19000Y 40A20008
386000WW 90770020
60000000 00000000

X = In-Race Room Size
Y = Position
WW = Item

X/Y Values:
Anything from 1 thru C (hex)

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 (In-Race Room Size Storage Code)##
lis r12, 0x8000 #Load 0x8000 into upper 16 bits of r12, lower 16 bits are cleared)
stb r9, 0x164F (r12) #Store byte of r9 (in-race room size) to address 0x8000164F, offset used to complete 2nd half of address
cmpwi r9, 0xC #Default instruction

##Source (Shared Item Code)##
lis r12, 0x8000 #Set 1st half address to load room size value that was stored from previous code
lbz r11, 0x164F (r12) #Load in-race room size value from 0x8000164F address, offset used to complete rest of address location
cmpwi r11, 0xX #Compare In-Race 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 in-race 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 in-race 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 instruction



Code creator: zak
Code credits: Star, Guru
Reply
#2
Nice work !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)