News:

Don't forget to visit the main site! There's lots of helpful docs, patches, and more!

Main Menu

[SM] Nami fire speed and projectile production

Started by monktroid, May 18, 2017, 06:04:07 PM

Previous topic - Next topic

monktroid

Hiya,

I've coded some cool trap triggers based around the Nami wall monsters and I was wondering if there was a way to make them fire more projectiles. I know I know, you can tweak the speed parameters in the enemy header but none of the speed options really cut it; the timers can be tweaked and you get a couple fireballs running at speed 7 on the screen at once. But Ideally I'm looking for one projectile to immediately follow another; that is, when you trigger the "pressure plate" block, you immediately get a stream of nami fireballs to the face!  I just can't find the Nami's main timer for this behaviour - I suspect it's buried in the undocumented bits of the $8A dissassembly.  any clues?

Smiley

You seem to know your way around ASM, so you might be better off writing a piece of code to spawn the projectiles yourself.

86:8027 spawns enemy specific projectiles (0F96/0F98 copied to projectile).

Y holds the projectile header, A holds an argument. The Nami fireball header is at $DFBC in its bank, so you could spawn a fireball with this code:

LDA #$0000
LDY #$DFBC
JSL $868027


Changing the value in A should change which way the fireball moves and its speed.
Note that if you spawn the fireballs this way, they'll always spawn at the top-left corner of the room. You'll have to set their position yourself, so store values to these addresses after spawning the projectile:

$1A4B, y ;x position
$1A93, y ;y position

monktroid

Thanks, i tried assigning them to fool xray in the manner you suggest but couldn't get them to turn up. Maybe i was dipping it wrong though.  Will have a look into this.

Scyzer

You *must* spawn them from within the enemy code, not via Fool X-Ray blocks or anything else. Nearly all enemy projectiles hijack the graphics of the enemy that calls them, so if they aren't called from an enemy, they will rarely be visible, and almost never look right.
Even calling a projectile from a different enemy will very often cause it to look garbled. You could have the exact same projectile called by 2 different enemies (with different GFX at least) in a room at the same time, and they will look different.

The easiest way to do what you want will probably be to set a breakpoint on $868027 when a Nami is in the room to see when it fires. When you've found the ASM which calls them, have a look around in the routine to see if there's a timer or counter being used, and then it's a matter of just reducing the timer.
The other scenario is that the fireballs are called whenever Nami hits a certain frame in it's tilemap. Then you can either call the routine outside of that tilemap as well, or speed up the timers so it animates faster (and thus reaches the fire tilemap sooner).

monktroid

Quote from: Scyzer on May 20, 2017, 02:34:36 AM
You *must* spawn them from within the enemy code, not via Fool X-Ray blocks or anything else. Nearly all enemy projectiles hijack the graphics of the enemy that calls them, so if they aren't called from an enemy, they will rarely be visible, and almost never look right.
Even calling a projectile from a different enemy will very often cause it to look garbled. You could have the exact same projectile called by 2 different enemies (with different GFX at least) in a room at the same time, and they will look different.

The easiest way to do what you want will probably be to set a breakpoint on $868027 when a Nami is in the room to see when it fires. When you've found the ASM which calls them, have a look around in the routine to see if there's a timer or counter being used, and then it's a matter of just reducing the timer.
The other scenario is that the fireballs are called whenever Nami hits a certain frame in it's tilemap. Then you can either call the routine outside of that tilemap as well, or speed up the timers so it animates faster (and thus reaches the fire tilemap sooner).

thanks Scyzer, That makes sense now you write it (given the way the enemy tiles are laid out in SMILE). I'm gonna try bolting another projectile on midway through the timer sequence, i can't seem to find the enemy's main timer (beyond the limited one in the enemy's header)

as a side note, can anyone explain to me why setting the projectile speed to 7 or 9 works but 8 does not?

Quote58

Alternatively, you could write a new projectile, and have the spawning of it happen in the BTS tile, giving you more control over all aspects of it (what it looks like, how it moves (ex. sine motion fireballs), how it intereacts with samus) without changing the standard enemy. The projectile itself is really simple, since all it does it move in a straight line at a fixed speed with a really simple animation ai. And before the projectile is spawned simply transfer the 8(?) tiles into the top of enemy VRAM manually, which could be done during a door transition, or even the moment samus steps on the trap. This could also be done with PLMs (in fact the gate PLM does exactly this, where the opening/closing gate part is a projectile spawned when samus shoots part of the PLM), but IMO it'd be cleaner to do it with just the BTS tile.

This could also be expanded into a general 'trap' PLM, that could spawn any number of different projectiles in different ways depending on the high/low/other variables.

monktroid

Quote from: Quote58 on May 20, 2017, 04:33:35 PM
Alternatively, you could write a new projectile, and have the spawning of it happen in the BTS tile, giving you more control over all aspects of it (what it looks like, how it moves (ex. sine motion fireballs), how it intereacts with samus) without changing the standard enemy. The projectile itself is really simple, since all it does it move in a straight line at a fixed speed with a really simple animation ai. And before the projectile is spawned simply transfer the 8(?) tiles into the top of enemy VRAM manually, which could be done during a door transition, or even the moment samus steps on the trap. This could also be done with PLMs (in fact the gate PLM does exactly this, where the opening/closing gate part is a projectile spawned when samus shoots part of the PLM), but IMO it'd be cleaner to do it with just the BTS tile.

This could also be expanded into a general 'trap' PLM, that could spawn any number of different projectiles in different ways depending on the high/low/other variables.

Thanks for the suggestion, This would be awesome in theory; right now it's finding the time to go to that length! While I've definitely cut my teeth with ASM now, I'm still relatively inexperienced with it; I'll mull it over though!