|File Name:||Save Power-Up to Item Box with L/R|
|Type:||Level, Game Mode|
|Description:||This UberASM will "steal" any of the 4 valid power-up states that Mario can have (Big, Flower, Cape and Star) when you press L or R, and store the corresponding power-up in the item box. (As seen in my KLDC 2022 entry "Save It For Later"). |
There is an option for the steal to give Mario a handful of invincibility frames as if he took damage to give players leeway to react (on by default).
Uses 2 bytes of FreeRAM.
|Tags:||item box, lorom, power-up, sa-1|
- There's no reason to use the two bytes of freeram for the previous powerup state and star counter unless you need to preserve it across multiple frames, which the code does not do. Instead you can store the value to scratch RAM or push-pull it from the stack. Or alternatively you can just clear $19 and $1490 at the end of the code, after the item box has been filled.
- Having both a star and a powerup strips you of both at once but you only store the powerup, i think the star and powerup should be stored one after the other, and maybe getting to choose which one depending on an L or R press.
- This right here:
Could be this instead:
Which also takes care of that problem of losing the star item.
- I'm not sure if it's intentional or not but there are no checks for if game is paused/sprites are locked/player is dying/message box open/level is finished/etc... to decide wether to run the code or not. You might want to add those.
- Using this, the player can be invincible the entire time because the stored star always gives full invincibility timer. Hack designers are likely not to use this patch once they realize the issue.
You can take care of this by hijacking the star interact routine (at $01C580) to use the invincibility value the player had once they stored the star in the item box with a byte of freeram.
You can also make it an option, since kaizo hackers might instead want to use that oversight.
- Not a rejection reason but you can optimize this:
(BIT is the same as AND but it doesn't change the value of A)
Benny Harvey RIP, miss you big man.