All Items Can Land v2 [MrBean, CLF78]
#1
Today i was looking at the code and realized it could be improved quite a bit. So here's my new version, which is 11 lines smaller than the original.

Quote:This code lets every item (except the Thundercloud) land on the floor when dropped. They will activate when a racer drives over them, and their effects will be identical to if the user actually fired the item themselves.

NTSC-U
06001600 0000008C
38E00008 48000028
38E0000B 48000020
38E0000C 48000018
38E0000D 48000010
38E00004 48000008
38E0000F 9421FFF0
7C0802A6 90010014
3C60809C 8063EE20
80630014 1C980248
7C632214 80830090
38840001 90830090
3C80809B 6084EEB0
1CE7001C 7C84382E
2C040000 4182000C
7C8903A6 4E800421
3860FFFF 80010014
7C0803A6 38210010
4E800020 00000000
0479D6B8 60000000
0478DD24 38600000
08787EE4 39800001
20030004 FFE00000
048B0D80 80001600
048B0D98 80001608
088B0DB0 80001610
2003000C 00000008

PAL
06001600 0000008C
38E00008 48000028
38E0000B 48000020
38E0000C 48000018
38E0000D 48000010
38E00004 48000008
38E0000F 9421FFF0
7C0802A6 90010014
3C60809C 80633618
80630014 1C980248
7C632214 80830090
38840001 90830090
3C80809C 608436B8
1CE7001C 7C84382E
2C040000 4182000C
7C8903A6 4E800421
3860FFFF 80010014
7C0803A6 38210010
4E800020 00000000
047A66C4 60000000
04796D30 38600000
08790EF0 39800001
20030004 FFE00000
048B54B8 80001600
048B54D0 80001608
088B54E8 80001610
2003000C 00000008

NTSC-J
06001600 0000008C
38E00008 48000028
38E0000B 48000020
38E0000C 48000018
38E0000D 48000010
38E00004 48000008
38E0000F 9421FFF0
7C0802A6 90010014
3C60809C 80632678
80630014 1C980248
7C632214 80830090
38840001 90830090
3C80809C 60842718
1CE7001C 7C84382E
2C040000 4182000C
7C8903A6 4E800421
3860FFFF 80010014
7C0803A6 38210010
4E800020 00000000
047A5D30 60000000
0479639C 38600000
0879055C 39800001
20030004 FFE00000
048B4618 80001600
048B4630 80001608
088B4648 80001610
2003000C 00000008

NTSC-K
06001600 0000008C
38E00008 48000028
38E0000B 48000020
38E0000C 48000018
38E0000D 48000010
38E00004 48000008
38E0000F 9421FFF0
7C0802A6 90010014
3C60809B 80631C58
80630014 1C980248
7C632214 80830090
38840001 90830090
3C808089 60843E78
1CE7001C 7C84382E
2C040000 4182000C
7C8903A6 4E800421
3860FFFF 80010014
7C0803A6 38210010
4E800020 00000000
04794A84 60000000
047850F0 38600000
0877F2B0 39800001
20030004 FFE00000
048A3930 80001600
048A3948 80001608
088A3960 80001610
2003000C 00000008

Source (ASM only):
Code:
.set REGION, ''

.if (REGION == 'P')
    .set ItemHolder, 0x809C3618
    .set ItemStructs, 0x809C36B8
.elseif (REGION == 'U')
    .set ItemHolder, 0x809BEE20
    .set ItemStructs, 0x809BEEB0
.elseif (REGION == 'J')
    .set ItemHolder, 0x809C2678
    .set ItemStructs, 0x809C2718
.elseif (REGION == 'K')
    .set ItemHolder, 0x809B1C58
    .set ItemStructs, 0x80893E78
.else
    .err
.endif

# Shock
li r7, 0x8
b begin

# Mega
li r7, 0xB
b begin

# Blooper
li r7, 0xC
b begin

# POW
li r7, 0xD
b begin

# Golden Mushroom
li r7, 0x4
b begin

# Bullet Bill
li r7, 0xF

# Push stack and save LR
begin:
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)

# Get ItemHolder for current player id
lis r3, ItemHolder@ha
lwz r3, ItemHolder@l(r3)
lwz r3, 0x14(r3)
mulli r4, r24, 0x248
add r3, r3, r4

# Add 1 to player's item amount
lwz r4, 0x90(r3)
addi r4, r4, 1
stw r4, 0x90(r3)

# Run the correct function
lis r4, ItemStructs@h
ori r4, r4, ItemStructs@l
mulli r7, r7, 0x1C
lwzx r4, r4, r7
cmpwi r4, 0
beq- return
mtctr r4
bctrl

# Pop stack and return
return:
li r3, -0x1
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr

Code creator: MrBean
Code contributor: CLF78 (edited and shortened the code)
Reply
#2
Nice job!
~MarioKartWii.com #1~
Reply
#3
The code make my game crash after I tired to get a golden mushroom that landed (NTSC-U) (le-code 30).
Is there some code incompatibilities with orther codes ? (I will try the v1 instead).
Reply
#4
For the current version, the quote is not exactly true. The golden mushroom does indeed give only a normal shroom boost. If you want a version that also has a working golden shroom, do the following changes to your region:

1. Change "06001600 0000008C" to "06001600 000000A4"

2. Change "38E00004 48000008" to "38E0000A 48000008" and

3. Replace

38840001 90830090

with

38840001 90830090
2C07000A 40A20014
90E3008C 38800001
90830090 988300A4


If you now drive over a golden, you will get a golden in your inventory and can use it until it runs out.
Reply
#5
Honestly, you should make the tc drop but when driven over go into the inventory as well.
~MarioKartWii.com #1~
Reply
#6
TCs are weird when dropped. To note, they're unsolid to you and slide on the ground. Of course these can be fixed
Reply
#7
Is there a way to customize so that certain items don't drop? For example making bullet bills, blue shells and goldens the only items that will drop while all others can't be dropped
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)