Pages: 1
skawo |
Posted on 07-10-16, 04:10 pm (rev. 12 by skawo on 09-25-16, 12:26 am)
|
Karma: 19757 Posts: 423/1100 Since: 04-02-13 |
Sometimes a nice SFX or graphical effect would be nice to spawn if you're breaking something or whatever, so here's code to support this:
Normal Particle/Sound Spawning Tilegod: repl_0209EED8_ov_00: @SFX Player on tile break
LDR R0, =0x2000000
CMP R10, R0
LDRLT R0, =0x177
BXLT LR
LDR R0, [R10, #8]
LSR R0,R0,#24
AND R0, R0, #0xF
BL .SetSFX
B 0x0209EEDC
repl_02156BDC_ov_36: @SFX Player on tile spawn
LDR R0, [R10, #8]
LSR R0,R0,#24
AND R0, R0, #0xF
CMP R0, #0
LDREQ R0, [SP, #0x54]
BXEQ LR
BNE .SetSFX
BX LR
repl_02156BB8_ov_36: @Particle Spawner on tile spawn
LDR R0, [R10, #8]
LSR R0,R0,#20
AND R0, R0, #0xF
CMP R0, #0
LDREQ R0, [SP,#0x48]
BXEQ LR
BLNE .SetParticle
B 0x2156BD4
.SetSFX:
STMFD SP!, {R1,LR}
LSL R0, R0, #1
LDR R1, =SoundArray
ADD R0, R1, R0
LDRH R0, [R0]
LDMFD SP!, {R1,LR}
BX LR
.SetParticle:
STMFD SP!, {R1,LR}
SUB R0, R0, #1
LSL R0, R0, #0x1
LDR R1, =ParticleArray
ADD R0, R1, R0
LDRH R0, [R0]
LDMFD SP!, {R1,PC}
.data
.balign 2
SoundArray:
.hword 0x0177 @ Default breaking sound.
.hword 0x0001
.hword 0x0177 @ Used by broozers
.hword 0x0003
.hword 0x0004
.hword 0x0005
.hword 0x0006
.hword 0x0007
.hword 0x0008
.hword 0x0009
.hword 0x000A
.hword 0x000B
.hword 0x000C
.hword 0x000D
.hword 0x000E
.hword 0x000F
.balign 2
ParticleArray:
.hword 0x0001
.hword 0x0002
.hword 0x0003
.hword 0x0004
.hword 0x0005
.hword 0x0006
.hword 0x0007
.hword 0x0008
.hword 0x0009
.hword 0x000A
.hword 0x000B
.hword 0x000C
.hword 0x0000
.hword 0x0000
.hword 0x0000 Sound IDs go into the "SoundArray" section and the ParticleIDs go into "ParticleArray" section. (counting from nybble 1) Nybble 6 = Sound setting Nybble 7 = Particle setting Versatile Particle/Sound Spawning Tilegod: repl_0209EED8_ov_00: @SFX Player on tile break
LDR R0, =0x2000000
CMP R10, R0
LDRLT R0, =0x177
BXLT LR
LDR R0, [R10, #8]
LSR R0,R0,#24
AND R0, R0, #0xF
BL .SetSFX
B 0x0209EEDC
repl_02156BDC_ov_36: @SFX Player on tile spawn
LDR R0, [R10, #8]
LSR R0, R0,#24
AND R0, R0, #0xF
CMP R0, #0
LDREQ R0, [SP, #0x54]
BXEQ LR
BNE .SetSFX
BX LR
repl_02156BB8_ov_36: @Particle Spawner on tile spawn
LDR R0, [R10, #8]
LSR R0, R0,#20
AND R0, R0, #0xF
CMP R0, #0
LDREQ R0, [SP,#0x48]
BXEQ LR
BLNE .SetParticle
B 0x2156BD4
.SetSFX:
STMFD SP!, {R1-R3,LR}
ADD R0, #1
MOV R1, #0x10
MUL R3, R1, R0
LDR R2, =0x0208B19C
LDR R2, [R2]
ADD R2, #0xC
LDRH R0, [R2,R3]
LDMFD SP!, {R1-R3,LR}
BX LR
.SetParticle:
STMFD SP!, {R1-R3,LR}
ADD R0, #1
MOV R1, #0x10
MUL R3, R1, R0
LDR R2, =0x0208B19C
LDR R2, [R2]
ADD R2, #0x8
LDRH R0, [R2,R3]
LDMFD SP!, {R1-R3,LR}
BX LR This one will instead use information which can be edited using Mariomaster's NSMBe mod. Nybble 6 is Settings ID which contains the sound you want to spawn. Nybble 7 is Settings ID which contains the particle you want to spawn. If kept at 0, they will behave as a normal tilegod does. Of course, the sound you're playing must be present in the sound group you loaded for the level. Sounds work on both tile destroy and create, but particles spawn only on create. You can use this with the "Nothing" tile spawning setting to spawn JUST the particle/sound. |
Fluorescent |
Posted on 07-10-16, 05:00 pm
|
Karma: 472 Posts: 86/139 Since: 04-08-16 |
This is awesome, this could definitely be useful for custom cutscenes without ASM (except of this code)
But you're not providing any way to use this whatsoever Good job anyway |
skawo |
Posted on 07-10-16, 05:05 pm (rev. 2 by skawo on 07-10-16, 05:06 pm)
|
Karma: 19757 Posts: 424/1100 Since: 04-02-13 |
Courtesy of MeroMero:
0. Setup ASM Template: http://nsmbhd.net/thread/1281-how-asm-hacks-are-setup-tutorial/ 1. In Notepad++, create a new file 2. Copy/paste the code above 3. Save the file with an extension .s (for example tilegod.s) 4. The file must be located in the Source folder of the ASM-template 5. In NSMBe, click 'Run make and insert' |
KingYoshi |
Posted on 07-10-16, 07:57 pm
|
Fire Brother
Eugene Karma: 3646 Posts: 859/1120 Since: 11-29-11 |
I'm wondering if you can use this to create a sort of firework effect when Mario has reached the flag. Though this ASM Hack might only work when actually playing the level.
|
skawo |
Posted on 07-10-16, 08:58 pm (rev. 4 by skawo on 07-10-16, 11:25 pm)
|
Karma: 19757 Posts: 425/1100 Since: 04-02-13 |
You can make fireworks, yes. After the flag is touched? Mm, maybe.
EDIT: A list of most particle effects! https://dl.dropboxusercontent.com/u/4558852/Effects.htm |
KingYoshi |
Posted on 07-26-16, 03:57 pm
|
Fire Brother
Eugene Karma: 3646 Posts: 900/1120 Since: 11-29-11 |
Will you also add a list of the sound effects?
|
skawo |
Posted on 07-26-16, 04:50 pm
|
Karma: 19757 Posts: 489/1100 Since: 04-02-13 |
Unfortunately, testing for those is an absolute chore, as you need to have the sound banks set correctly.
So, I haven't really tried it, as it'd be uber tedious. |
KingYoshi |
Posted on 07-26-16, 05:12 pm
|
Fire Brother
Eugene Karma: 3646 Posts: 904/1120 Since: 11-29-11 |
Oh okay.
Also, when you say this Nybble 6 = Sound setting Nybble 7 = Particle setting are you counting the nybbles from 0 or from 1? |
skawo |
Posted on 07-26-16, 05:19 pm
|
Karma: 19757 Posts: 491/1100 Since: 04-02-13 |
Oh, sorry, from 1.
|
KingYoshi |
Posted on 07-26-16, 05:26 pm
|
Fire Brother
Eugene Karma: 3646 Posts: 905/1120 Since: 11-29-11 |
I don't really get how to deal with the particle setting.
I wanted to use '19 - Star explosion'. 19 (decimal) = 13 (hex), but I can only use nybble 7 for the particle setting, since nybble 8 defines the 'Pattern/special' setting. |
skawo |
Posted on 07-26-16, 07:05 pm (rev. 1 by skawo on 07-26-16, 07:05 pm)
|
Karma: 19757 Posts: 492/1100 Since: 04-02-13 |
Change one of the ".hword 0xXXXX"s, let's say ".hword 0x000C" in the Particle Array at the end of the code to ".hword 0x0013". Then, put the number of that hword in the nybble (in our example, C)
|
KingYoshi |
Posted on 07-26-16, 07:24 pm (rev. 1 by KingYoshi on 07-26-16, 07:24 pm)
|
Fire Brother
Eugene Karma: 3646 Posts: 907/1120 Since: 11-29-11 |
Oh, so actually we only can use 15 of the 292 particle effects?
|
MeroMero |
Posted on 07-26-16, 07:43 pm
|
Death by cuteness
Karma: 6564 Posts: 486/598 Since: 05-01-13 |
Posted by KingYoshi Oh, so actually we only can use 15 of the 292 particle effects? The very fact that those 2 new settings are handled by 1 nybble only should tell you already than you can't go above 0xF. Problem is that all the other nybbles are used, so skawo pretty much had his hands tied on this one. One tricky solution would be migrate the parameters for nybbles 4 and 7 into nybble 9 to free them completely and increase the number of particles and SFX to 255 each. You can do that because nybbles 4 and 9 only need 1 bit, nybble 7 needs 2, together that makes 4, which is exactly the max limit for a nybble. |
skawo |
Posted on 07-26-16, 09:12 pm
|
Karma: 19757 Posts: 494/1100 Since: 04-02-13 |
Posted by MeroMero Posted by KingYoshi Oh, so actually we only can use 15 of the 292 particle effects? One tricky solution would be migrate the parameters for nybbles 4 and 7 into nybble 9 to free them completely and increase the number of particles and SFX to 255 each. You can do that because nybbles 4 and 9 only need 1 bit, nybble 7 needs 2, together that makes 4, which is exactly the max limit for a nybble. That is true, but I feel it would make it a bit cumbersome to calculate the spritedata. 15 effects is a meager amount, but it's at least 15 better than retail. |
skawo |
Posted on 08-11-16, 09:24 am
|
Karma: 19757 Posts: 569/1100 Since: 04-02-13 |
.hword 0x0177 @ Used by broozers Yes, folks, Broozers spawn FUCKING TILEGODS to destroy blocks. |
skawo |
Posted on 08-12-16, 10:30 am
|
Karma: 19757 Posts: 571/1100 Since: 04-02-13 |
Fixed a crashing-on-real-DS issue and freed a sound slot in the process.
|
skawo |
Posted on 08-21-16, 03:31 pm (rev. 3 by skawo on 09-25-16, 12:26 am)
|
Karma: 19757 Posts: 589/1100 Since: 04-02-13 |
Versatile Particle/Sound Spawning Tilegod:
repl_0209EED8_ov_00: @SFX Player on tile break
LDR R0, =0x2000000
CMP R10, R0
LDRLT R0, =0x177
BXLT LR
LDR R0, [R10, #8]
LSR R0,R0,#24
AND R0, R0, #0xF
BL .SetSFX
B 0x0209EEDC
repl_02156BDC_ov_36: @SFX Player on tile spawn
LDR R0, [R10, #8]
LSR R0, R0,#24
AND R0, R0, #0xF
CMP R0, #0
LDREQ R0, [SP, #0x54]
BXEQ LR
BNE .SetSFX
BX LR
repl_02156BB8_ov_36: @Particle Spawner on tile spawn
LDR R0, [R10, #8]
LSR R0, R0,#20
AND R0, R0, #0xF
CMP R0, #0
LDREQ R0, [SP,#0x48]
BXEQ LR
BLNE .SetParticle
B 0x2156BD4
.SetSFX:
STMFD SP!, {R1-R3,LR}
ADD R0, #1
MOV R1, #0x10
MUL R3, R1, R0
LDR R2, =0x0208B19C
LDR R2, [R2]
ADD R2, #0xC
LDRH R0, [R2,R3]
LDMFD SP!, {R1-R3,LR}
BX LR
.SetParticle:
STMFD SP!, {R1-R3,LR}
ADD R0, #1
MOV R1, #0x10
MUL R3, R1, R0
LDR R2, =0x0208B19C
LDR R2, [R2]
ADD R2, #0x8
LDRH R0, [R2,R3]
LDMFD SP!, {R1-R3,LR}
BX LR This one will use information which can be edited using Mariomaster's NSMBe mod. i.e you can now spawn any particle/sound you want, without being limited to 15 slots and without editing code. Nybble 6 is Settings ID which contains the sound you want to spawn. Nybble 7 is Settings ID which contains the particle you want to spawn. If kept at 0, they will behave as a normal tilegod does. |
skawo |
Posted on 08-27-16, 09:00 pm
|
Karma: 19757 Posts: 611/1100 Since: 04-02-13 |
Fixed both versions to not collide with Mero's subnohara code.
|
skawo |
Posted on 09-25-16, 12:26 am
|
Karma: 19757 Posts: 711/1100 Since: 04-02-13 |
Further fixes.
|
Pages: 1