Super Mario Bros. Hacking - "No Piranha Plants" Flag

Started by Josephine Lithius, January 12, 2022, 11:23:21 AM

Previous topic - Next topic

Josephine Lithius

Alright.  I feel a little odd asking this in its own thread, but I was wondering...  In Super Mario Bros. on the NES, every single pipe in the game is programmed to spawn a Piranha Plant unless the World counter is set to 1-1.  For some reason, World 1-1 has a special flag somewhere in the code which completely prevents Piranha Plants from spawning.  This only happens in World 1-1, even on the Second Quest.

So, my question is... is there some documentation, other than the disassembly, on what this "no Piranha Plants" flag is, where in the code it rests, how it works, and if it's possible to implement in other levels?  Or... port over to Super Mario Bros. 2 / The Lost Levels...?

Thanks in advance for any help!

Cyneprepou4uk

Super Mario Bros. (W) [!].nes

This is where the game checks if both level and world numbers are zero at the same time in order to disable the plant spawn.


NesDraug

Quote from: Josephine Lithius on January 12, 2022, 11:23:21 AM
Alright.  I feel a little odd asking this in its own thread, but I was wondering...  In Super Mario Bros. on the NES, every single pipe in the game is programmed to spawn a Piranha Plant unless the World counter is set to 1-1.  For some reason, World 1-1 has a special flag somewhere in the code which completely prevents Piranha Plants from spawning.  This only happens in World 1-1, even on the Second Quest.

So, my question is... is there some documentation, other than the disassembly, on what this "no Piranha Plants" flag is, where in the code it rests, how it works, and if it's possible to implement in other levels?  Or... port over to Super Mario Bros. 2 / The Lost Levels...?

Thanks in advance for any help!


There's an option to turn of all turning Piranha Plants in Smb Remodeler 
https://www.romhacking.net/utilities/1319/

Check under Enemies 2.


Turning off Piranha Plants will affect this adress:

Adress: 53E1
change C9 21 90 into 4C 0A D4


Turning on Piranha Plants from level 1 will affect this adress:

Adress: 1905
change 0D 5F 07 F0 2B into EA EA EA EA EA


✍️ Blog: https://www.tumblr.com/blog/nesdraug

💀 Join my crypt on discord:
https://discord.gg/Eb4HTSNzeg

Josephine Lithius

Thank you both for your help!  Either of these methods seems to work perfectly!  Though, I do wonder...  Would it be possible to change the level / world counter to allow Piranha Plants to appear only in later levels?  I'm not terribly good with programming, but if those addresses are expecting the RAM values to both be $00, it seems like it should be possible to change that second one to, say, $01, which would make the 'Plants appear from World 2-1 onward.

Also, I fiddled around with Super Mario Bros. 2 / The Lost Levels, trying to see if any of the LDA / ORA combos like that made it so the 'Plants don't spawn in World 1-1.  'cause, ya know, why not.  My attempts at making this happen resulted in failure, unfortunately.  It seems like none of the existing code that looks like it might be the same actually is.

Cyneprepou4uk

Yes, it's possible to add any conditions that you want in the code.