Mico27 / SuperMarioBrosMini

Super Mario Bros Remake using GBS
123 stars 15 forks source link

Add Variables for RetroAchievements #20

Closed laytonloztew closed 3 weeks ago

laytonloztew commented 3 weeks ago

I am working on a RetroAchievements set for this game, memory addresses are read to unlock achievements and display the current state and statistics in rich presence. This PR adds additional variables that would allow for simpler achievement logic and more accurate Rich Presence. In my testing these work well for my purposes, but I want to make sure this is approved before I rewrite my logic to rely on these variables.

ActualWorld ActualLevel

The CurrentWorld and CurrentLevel variables are changed on contact with warp triggers. These variables would allow me to accurately detect which world/level the player is in. These are set to CurrentWorld/CurrentLevel in InitLevel and Intermission

ActualSubLevel

This serves the same purpose, but I noticed that later levels don't always set the CurrentSubLevel value when transitioning to different scenes. (Ex. 14-3-1 and 14-3-2 both set CurrentSubLevel to 0) I'm not sure if this is intended or if this variable goes unused here. For now I've left that alone and only added the variable - I think I'll be able to work around any issues with this.

IsPaused

This allows me to detect when the player has paused the game to display a pause symbol on Rich Presence.

InWarpZone

This simplifies detecting when the player has discovered a warp zone. This is attached to each warp zone trigger and is reset on InitLevel/Intermission

LevelComplete

This is set to 1 when the player completes a level (CastleEnter, BowserEndTrigger/BowserEndFinalTrigger) and reset on InitLevel/Intermission

(I had warnings for line ending changes that I couldn't figure out a solution for, hopefully that doesn't cause any issues)

Mico27 commented 3 weeks ago

Looks good to me, I'll add it with the other fixes on the next version, trying to fix the vine grabbing mechanic issues.