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

Pause Warp Enhancement #3212

Closed
wants to merge 4 commits into from
Closed

Conversation

mckinlee
Copy link
Contributor

@mckinlee mckinlee commented Sep 18, 2023

Summary
This introduces the Pause Warp Enhancement feature, allowing players to easily teleport to different locations by selecting warp songs from the pause menu.

Changes

  • Introduced PauseWarpState structure to manage various flags and cooldown timers for the pause warp functionality.
  • Added IsStateValid, ResetStateFlags, InitiateWarp, HandleWarpConfirmation, and HandleCooldowns utility functions to facilitate pause warp.
  • Created PauseWarp_Main function that serves as the main logic, which is called every frame to handle the pause warp functionality.
  • Integrated a check to ensure that players can only warp if they possess the required warp song.

Motivation
Teleporting between locations can be cumbersome in the current game. The Pause Warp Enhancement simplifies this process by allowing players to teleport directly from the pause menu, making for a more seamless gameplay experience.

Testing
Manual testing in Windows only has been conducted to ensure the feature works as expected, but could use some further testing.

Build Artifacts

This commit introduces the PauseWarp mod, a feature that allows players to warp to different locations in the game directly from the pause menu.

- Add PauseWarpState structure to manage flags and cooldowns for the pause warp feature.
- Implement IsStateValid function for state validation.
- Implement ResetStateFlags function to reset all state flags to default values.
- Add InitiateWarp function to handle the initiation of warp sequences.
- Implement HandleWarpConfirmation function to confirm and execute warp actions.
- Implement HandleCooldowns function to manage various cooldown timers.
- Add PauseWarp_Main function as the main logic, called every frame to handle pause warp functionality.
- Map warp song messages to in-game text messages.
-Now if you do not have a warp song you won't be able to select the empty slot and still teleport.
-When selecting a warp song the audio for the applicable warp song will now play for a extra vanilla feel.
-Changed the stateFlag1 because previously it just disabled input allowing enemies to harm you. Now that won't happen because the game is put into a cutscene state.
@Malkierian
Copy link
Contributor

Malkierian commented Sep 19, 2023

I'm still not a big fan of having this block of code being called every frame like that. The idea to have it optionally override the behavior directly in kaleido_collect and only be called when warranted actually feels less hacky to me, and has implications for ease of feature support for upcoming ideas/PRs.

@Malkierian
Copy link
Contributor

I do like that you put everything to handle it out in its own file, though. Makes it easier to maintain and differentiate between original code and enhancements.

@jbodner09
Copy link
Contributor

jbodner09 commented Sep 19, 2023

My suggestion is to use the hook system. You can keep this code structure more or less intact with all your code being in its own functions in the mods.cpp file (instead of in a new file), but instead of calling the function in graph.c, you'd register a hook at the right place in the kaleido code (which I know you didn't want to touch) or just use the existing game frame update hook (which would not be my first choice since it would be ideal to only have this code run when on the relevant kaleido screen like Malk mentioned). There are plenty of existing PRs you can look at for how to implement a new hook.

You also should retarget this to the main branch instead of the sulu release since I don't believe we're releasing anything else out of sulu.

@Malkierian
Copy link
Contributor

My suggestion is to use the hook system. You can keep this file structure more or less intact with all your code being in its own file, but instead of calling the function in graph.c, you'd register a hook at the right place in the kaleido code (which I know you didn't want to touch). There are plenty of existing PRs you can look at for how to implement a new hook. That would also mean you could move this file into the mods section instead of the randomizer section, since this isn't strictly related to the randomizer.

Do you think an entire hook is really necessary for something like this, where it will almost certainly be a single-use?

You also should retarget this to the main branch instead of the sulu release since I don't believe we're releasing anything else out of sulu.

LMAO, nice catch. Not only are we not releasing anything on the Sulu channel, the develop-xxx channel is meant for bugfixes.

@jbodner09
Copy link
Contributor

I mean, we've got hooks for when a sale is complete or when the ocarina is played, so I'm not too worried about niche uses! In fact, if the hook just runs on the pause menu in general instead of just on the quest status screen, that would certainly be a useful hook for mods that want to do stuff with custom items (#3190 for a convenient example). There'd just need to be a check for which page they're on.

Either way, moving this code out of the randomizer folder is the right thing to do since this isn't functionality that's specific to the randomizer.

@Malkierian
Copy link
Contributor

True, it could probably reside just in the Enhancements folder directly.

Also, I like the idea of a pause menu hook in general, it's just unfortunate that changes in the future, like ocarina button shuffle, will have to go here to add conditions instead of being able to change how it gets called locally, but I suppose maybe that's the path we need to start taking from now on.

@mckinlee
Copy link
Contributor Author

Keep the suggestions coming! I'll be back later on today and I'll start working on the changes. We can even discuss it in the dev chat before I start to make sure we all agree on the best approach to this.

-A new hook was created 'OnPauseMenu' so now PauseWarp_Main is only called when the pause menu is open
-Moved pauswarp.c to the Enhancements folder
-Removed from graph.c

PR Change:
Changing to the main branch instead of sulu
@mckinlee mckinlee changed the base branch from develop-sulu to develop September 19, 2023 21:55
@mckinlee mckinlee mentioned this pull request Sep 23, 2023
@mckinlee
Copy link
Contributor Author

Moved to PR #3223

@mckinlee mckinlee closed this Sep 23, 2023
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.

3 participants