Achilles1515
Smash Master
Custom Subaction Event - Projectile/Item Spawn (1.02) [Achilles]
Inject this code into your ISO (I suggest using DRGN's Code Manager) and then you can start modifying subaction data to include this new command.
Custom Subaction Format (0x10 in length):
F4FFZZAA XXXXYYYY VVVVZZZZ SSSSTTTT
F4 = subaction command byte (always keep as 0xF4)
FF = flag for custom function (always keep as 0xFF)
ZZ = Flags
XXXX = x-offset from player TopN [float]
YYYY = y-offset from player TopN [float]
VVVV = x-velocity [float]
ZZZZ = y-velocity [float]
SSSS = model scale [float]
TTTT = time to expire [float]
NOTES:
Examples:
(Sorry for bad quality. For these tests, I was being lazy and just overwrote a GFX spawn subaction event on Fox's jump with the new projectile subaction.)
@Itaru Ampers Tater @MagicScrumpy @TheDankbanker
Code:
Custom Subaction Event - Projectile/Item Spawn v1.0 (SSBM 1.02) [Achilles]
C207168C 00000031
80A40008 88A50001
2C0500FF 40820170
7C0802A6 90010004
3821FF80 93E1006C
DBC10070 DBE10078
80A40008 90A10068
38C50010 90C40008
7C250B78 38A5FFFC
38C00000 38E00000
94C50004 38E70004
2C070064 40A2FFF4
90610008 9061000C
8063002C 8083002C
90810040 80A10068
88850002 548407FF
41820010 80831974
2C040000 408200DC
88850003 90810010
A0850004 B0810018
C3C10018 C3E3002C
FFDF07B2 C3E300B0
FFDEF82A D3C1001C
D3C10028 A0850006
B0810018 C3C10018
C3E300B4 FFDEF82A
D3C10020 D3C1002C
A0850008 B0810018
C3C10018 C3E3002C
FFDF07B2 D3C10034
A085000A B0810018
C3C10018 D3C10038
3C608026 60638B18
7C6803A6 7C230B78
38630008 4E800021
8063002C 80810068
A0A4000C B0A10018
80A10018 90A30038
88A40002 54A507FF
41820020 3CA08009
60A548A8 7CA803A6
80830004 80630518
4E800021 48000014
A0A4000E B0A10018
80A10018 90A30D44
83E1006C CBC10070
CBE10078 38210080
80010004 7C0803A6
4E800020 7C0802A6
60000000 00000000
Custom Subaction Format (0x10 in length):
F4FFZZAA XXXXYYYY VVVVZZZZ SSSSTTTT
F4 = subaction command byte (always keep as 0xF4)
FF = flag for custom function (always keep as 0xFF)
ZZ = Flags
00 = launch created item
01 = give created item to player
AA = article/projectile/item ID01 = give created item to player
XXXX = x-offset from player TopN [float]
YYYY = y-offset from player TopN [float]
VVVV = x-velocity [float]
ZZZZ = y-velocity [float]
SSSS = model scale [float]
TTTT = time to expire [float]
NOTES:
- TopN is basically the base of your character. Use the x & y offset to move the starting location of the item/projectile.
- Items labeled with [float] are values expressed as floating point numbers. BUT, only the first half of the floating point number. Use this website to convert your decimal number into floating point hex. Then chop off the last half of it.
- Positive x-axis values are in front of the character. Positive y-axis values are up.
- Model scale doesn't work for some things (Blastoise's water & Chikorita's leaf for example. It seems to work for regular items).
- Time to expire, offsets, & velocities are ignored if the created item is given to a character
- MANY of the items/projectiles that are not meant to be thrown/spawned in such a manner cause the game to freeze, especially character specific items. Some Pokemon can be spawned without problems. Experiment.
Code:
Items (decimal/hex/name)
-------------------------------
## 0x Item
------------------
00 00 capsule
01 01 box
02 02 barrel
03 03 egg
04 04 partyball
05 05 cannon
06 06 bombomb
07 07 mr. saturn
08 08 heart
09 09 tomato
10 0A star
11 0B bat
12 0C sword
13 0D umbrella
14 0E green shell
15 0F red shell
16 10 gun
17 11 freezie
18 12 food
19 13 mine
20 14 bumper
21 15 super scope
22 16 star rod
23 17 lip stick
24 18 fan
25 19 fire flower
26 1A big mushroom
27 1B small mushroom
28 1C hammer
29 1D warp star
30 1E screw attack
31 1F rabbit hood
32 20 metal
33 21 cloak
34 22 pokeball
43 2B goomba
44 2C redead
45 2D octarok
46 2E otosea
2F Stone
30 Mario's fire
31 Dr.Mario's Capsule
32 Kirby's Cutter beam
33 Kirby's Hammer
34 Raygun beam
35
36 Fox's laser
37 ? Falco's Laser ?
38 Fox's shadow
39 Falco's shadow
3A Link's bomb
3B Young Link's bomb
3C Link's boomerang
3D Young Link's boomerang
3E Link's Hookshot
3F Young Link's Hookshot
40 Arrow
41 Fire Arrow
42 PK Fire
43 PK Flash
44 PK Flash
45 PK Thunder
46 PK Thunder
47 PK Thunder
48 PK Thunder
49 PK Thunder
4A Fox's Blaster
4B Falco's Blaster
4C ? Link's Arrow ?
4D Young Link's arrow
4E PK Flash (explosion)
4F Needle(thrown)
50 Needle
51 Pikachu's Thunder
52 Pichu's Thunder
53 Mario's cape
54 Dr.Mario's cape
55 Smoke (Sheik)
56 Yoshi's egg(thrown)
57
58 Yoshi's Star
59 Pikachu's thunder
5A Pikachu's thunder
5B Pichu's thunder
5C Pichu's thunder
5D Samus's bomb
5E Samus's chargeshot
5F Missile
60 Grapple beam
61 Sheik's chain
62
63 Turnip
64 Bowser's flame
65 Ness's bat
66 Yoyo
67 Peach's parasol
68 Toad
69 Luigi's fire
6A Ice(Iceclimbers)
6B Blizzard
6C Zelda's fire
6D Zelda's fire (explosion)
6E
6F Toad's spore
70 Mewtwo's Shadowball
71 Iceclimbers' Up-B
72 Pesticide
73 Manhole
74 Fire(G&W)
75 Parashute
76 Turtle
77 Sperky
78 Judge
79
7A Sausage
7B Milk (Young Link)
7C Firefighter(G&W)
7D Masterhand's laser
7E Masterhand's bullet
7F
80
81 Crazyhand's Bomb
82
83
84
85
86
87
88
89
8A
8B
8C
8D
8E
8F
90
91
92
93
94
95
96
97 (crashes with peach pulls out)
98
99
9A
9B
9C
9D
9E Coin
9F
A0 Null pokemon entry?
A1 Goldeen (Tosakinto)
A2 Chicorita
A3 Snorlax
A4 Blastoise
A5 Weezing (Matadogas)
A6 Charizard (Lizardon)
A7 Moltres
A8 Zapdos
A9 Articuno
AA Wobbuffet
AB Scizor
AC Unown
AD Entei
AE Raikou
AF Suicune
B0 Bellossom (Kireihana)
B1 Electrode (Marumine)
B2 Lugia
B3 Ho-oh
B4 Metamon
B5 Clefairy
B6 Togepi
B7 Mew
B8 Celebi
B9 Staryu (Hitodeman)
BA Chansey
BB Porygon2
BC Cyndaquil (Hinoarashi)
BD Marill
BE Venusaur (Fushigibana)
BF Chikorita's Leaf
C0 Blastoise's Water
C1 Weezing's Gas
C2 Weezing's Gas
C3 Burn ??? Fire something
C4 Burn ??? Fire something
C5 Charizard's Breath
C6 Charizard's Breath
C7 Unowns
C8 Lugia's Aeroblast
C9 Lugia's Aeroblast
CA Lugia's Aeroblast
CB Ho-oh's Flame
CC Staryu's Star
CD Healing Egg
CE Cyndaquil's Fire
CF ??? invisible
D0
D1 Target
D2 Shyguy (Heiho)
D3 Koopa(Green) (Nokonoko)
D4 Koopa(Red) (PataPata)
D5 Likelile
D6 (old-lead)
D7 (old-octa)
D8 (old-otto)
D9 White Bear (whitebea)
DA klap
DB Paratroopa (Green) (zgshell)
DC Paratroopa (Red) (zrshell)
DD
DE
DF
E0 (crashes with peach pulls out)
E1 Apple
E2
E3
E4
E5
E6 Tool
E7
E8
EA Arwing Laser
EB Wolfen Laser
EC
ED
EE
EF
F0
F1
F2
F3
F4
F5
F6
F7
F8
F9 (crashes with peach pulls out)
FA
FB
FC
FD
FE
FF
Examples:
(Sorry for bad quality. For these tests, I was being lazy and just overwrote a GFX spawn subaction event on Fox's jump with the new projectile subaction.)
Blastoise's water (x-veloc = 2.00):
Electrode (0.5x scale):
Chikorita's Leaf:
Electrode (0.5x scale):
Chikorita's Leaf:
Code:
0xF4 = subaction command = controlling function 8007168c
Inject @ 8007168C
- r3 = external data offset
- r4 = data offset subaction timer offset
DEFAULT_FUNCTION:
lwz r3,0x8(r4)
addi r0,r3,4
stw r0,0x8(r4)
blr
--------------------------------
Custom Projectile Subaction v1.0
lwz r5,0x8(r4) # load current subaction RAM location
lbz r5,1(r5) # load second byte
cmpwi r5,0xff # 0xFF is flag for custom function
bne- DEFAULT # In case this function is used in vanilla
mflr r0
stw r0,0x4(sp)
subi sp,sp,0x80 # push back stack
stw r31,0x6c(sp)
stfd f30,0x70(sp)
stfd f31,0x78(sp)
UPDATE_SUBACTION_TIMER:
lwz r5,0x8(r4) # load current subaction location
stw r5,0x68(sp) # store this location in stack
addi r6,r5,0x10 # custom subaction event is 0x10 in length
stw r6,0x8(r4) # store new subaction location
mr r5,sp
subi r5,r5,4
li r6,0
li r7,0
ZERO_LOOP: # zero the entity struct in stack
stwu r6,4(r5)
addi r7,r7,4
cmpwi r7,0x64
bne- ZERO_LOOP
stw r3,0x8(sp) # store player pointer at entity (0x00)
stw r3,0xc(sp) # store player pointer at entity (0x04)
lwz r3,0x2c(r3) # r3 now holds internal data offset
lwz r4,0x2c(r3) # load facing direction
stw r4,0x40(sp) # store facing direction at entity (0x38)
lwz r5,0x68(sp) # load subaction location
#########
ITEM_HELD_CHECK: # check only if giving item to player
lbz r4,0x2(r5) # load flags
rlwinm. r4,r4,0,31,31 # does contain 01?
beq- END_ITEM_HELD_CHECK
lwz r4,0x1974(r3) # load item held
cmpwi r4,0
bne- FINISH # if not zero, then holding another item
END_ITEM_HELD_CHECK:
########
lbz r4,0x3(r5) # load item ID
stw r4,0x10(sp) # store item ID at entity (0x08)
lhz r4,0x4(r5) # load x-coord offset from TOPN
sth r4,0x18(sp) # this is free to use, set to 0 by SpawnEnt
lfs f30,0x18(sp) # load x-coord offset
lfs f31,0x2c(r3) # load facing direction
fmul f30,f31,f30 # multiply facing direction by offset
lfs f31,0xb0(r3) # load TopN x-coord
fadd f30,f30,f31
stfs f30,0x1c(sp) # store item x-coord at entity (0x14)
stfs f30,0x28(sp) # store item x-coord at entity (0x20)
lhz r4,0x6(r5) # load y-coord offset from TOPN
sth r4,0x18(sp) # this is free to use, set to 0 by SpawnEnt
lfs f30,0x18(sp) # load y-coord offset
lfs f31,0xb4(r3) # load TopN y-coord
fadd f30,f30,f31
stfs f30,0x20(sp) # store item y-coord at entity (0x18)
stfs f30,0x2c(sp) # store item y-coord at entity (0x24)
lhz r4,0x8(r5) # load x-veloc
sth r4,0x18(sp)
lfs f30,0x18(sp)
lfs f31,0x2c(r3) # load facing direction
fmul f30,f31,f30 # multiply facing direction by offset
stfs f30,0x34(sp) # store x velocity
lhz r4,0xa(r5) # load y-veloc
sth r4,0x18(sp)
lfs f30,0x18(sp)
stfs f30,0x38(sp) # store y velocity
lis r3,0x8026
ori r3,r3,0x8b18 # load EntityItemSpawn
mtlr r3
mr r3,sp
addi r3,r3,8
blrl
lwz r3,0x2c(r3) # load item internal offset
lwz r4,0x68(sp) # load subaction location
lhz r5,0xc(r4) # load model scale
sth r5,0x18(sp)
lwz r5,0x18(sp)
stw r5,0x38(r3) # store model scale
lbz r5,0x2(r4) # load flags
rlwinm. r5,r5,0,31,31 # does contain 01?
beq- TIME_TO_EXPIRE
lis r5,0x8009
ori r5,r5,0x48a8 # load GiveItemToPlayer function
mtlr r5
lwz r4,0x4(r3) # load item entity start
lwz r3,0x518(r3) # load item owner
blrl
b FINISH
TIME_TO_EXPIRE:
lhz r5,0xe(r4) # time to expire
sth r5,0x18(sp)
lwz r5,0x18(sp)
stw r5,0xd44(r3) # store time to expire
TIME_TO_EXPIRE_END:
FINISH:
lwz r31,0x6c(sp)
lfd f30,0x70(sp)
lfd f31,0x78(sp)
addi sp,sp,0x80
lwz r0,4(sp)
mtlr r0
blr # end new function
DEFAULT:
mflr r0 # default code line
@Itaru Ampers Tater @MagicScrumpy @TheDankbanker
Last edited: