Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement] Persist entrance and respawn information in saves #890

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

Eblo
Copy link
Contributor

@Eblo Eblo commented Dec 10, 2024

Pause saves almost already worked well enough, but shared grottos and cutscene entrances made that a no-go. This PR addresses those hurdles.

  • Add RespawnData to ShipSaveInfo, using it to persist gSaveContext.respawn. This affects multiple things. The most obvious is that it maintains respawn information, i.e. where a player will reload if they die. Less obvious is that this data is also used to handle shared grotto scenes, their chest contents, and their exit destinations. Persisting this allows pause saves to work from within grottos.
  • Add cutscene skip hook. This could be used for many things, but here it is used to blanket skip cutscene entrances.
  • Add OnSaveLoad hook. This is used with other hooks to ensure that respawn data is populated properly and that any entrance cutscenes are skipped on load.
  • To ensure that only a possible entrance cutscene gets skipped on load, I used OnPassPlayerInputs as the entry point for unregistering the entrance cutscene skip hook. This seemed like the best existing hook to say "the player has assumed control, so don't skip any more cutscenes now". I tested various combinations of loading an entrance cutscene save and trying other cutscenes, as well as loading a non-entrance cutscene save and trying other cutscenes. This seems to work as I intended.
  • Gut switch-case from SavingEnhancements_GetSaveEntrance since this aims to remove the need for it
  • This may break old saves

This has worked remarkably well from testing, both via resets and cold boots. However, there are hundreds of entrances in the game, so I welcome any additional eyes on this.

Build Artifacts

@Eblo Eblo force-pushed the persist-save-entrances branch from 88f0d3d to 716a292 Compare December 10, 2024 23:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant