-
Notifications
You must be signed in to change notification settings - Fork 521
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 #3223
Merged
garrettjoecox
merged 22 commits into
HarbourMasters:develop
from
mckinlee:develop-pausewarp
Feb 16, 2024
Merged
Pause Warp Enhancement #3223
Changes from 21 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
ee0d0b0
Pause Warp Enhancement
mckinlee 5bf4230
Warp Song Check
mckinlee a5b851c
Added Audio Fanfares and Changed stateFlag1 to PLAYER_STATE1_IN_CUTSCENE
mckinlee b1e621b
Feedback Update
mckinlee 362f642
Feedback Update #2
mckinlee d8f59f0
Merge branch 'HarbourMasters:develop' into develop-pausewarp
mckinlee d8b8316
Linux Compile Issue
mckinlee dacf205
Minor Bug Fix
mckinlee 22cc0cd
Merge branch 'HarbourMasters:develop' into develop-pausewarp
mckinlee 2fee2b5
Merge remote-tracking branch 'upstream/develop' into develop-pausewarp
mckinlee 746fc23
Update libultraship
mckinlee 3765a01
Merge remote-tracking branch 'upstream/develop' into develop-pausewarp
mckinlee 83b2136
Revert "Update libultraship"
mckinlee 190c4d3
Bug Fix
mckinlee 1f75d26
Merge branch 'develop' into develop-pausewarp
mckinlee 9651382
Merge branch 'develop' into develop-pausewarp
mckinlee 14d56e3
WIP
mckinlee d52ef4c
Done unless I'm missing headers
mckinlee 0b14cbe
now we done
mckinlee 29e167c
Merge remote-tracking branch 'origin/pausewarpredo' into develop-paus…
mckinlee c80adcc
clean up, these arn't needed anymore
mckinlee b8f175f
Rename OnPauseMenu to OnKaleidoUpdate
mckinlee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
#include "custom-message/CustomMessageTypes.h" | ||
#include "global.h" | ||
#include "z64.h" | ||
#include "game-interactor/GameInteractor.h" | ||
|
||
static const int songMessageMap[] = { | ||
TEXT_WARP_MINUET_OF_FOREST, | ||
TEXT_WARP_BOLERO_OF_FIRE, | ||
TEXT_WARP_SERENADE_OF_WATER, | ||
TEXT_WARP_REQUIEM_OF_SPIRIT, | ||
TEXT_WARP_NOCTURNE_OF_SHADOW, | ||
TEXT_WARP_PRELUDE_OF_LIGHT | ||
}; | ||
|
||
static const int ocarinaSongMap[] = { | ||
OCARINA_SONG_MINUET, | ||
OCARINA_SONG_BOLERO, | ||
OCARINA_SONG_SERENADE, | ||
OCARINA_SONG_REQUIEM, | ||
OCARINA_SONG_NOCTURNE, | ||
OCARINA_SONG_PRELUDE | ||
}; | ||
|
||
static const int entranceIndexMap[] = { | ||
ENTR_SACRED_FOREST_MEADOW_2, // Minuet | ||
ENTR_DEATH_MOUNTAIN_CRATER_4, // Bolero | ||
ENTR_LAKE_HYLIA_8, // Serenade | ||
ENTR_DESERT_COLOSSUS_5, // Requiem | ||
ENTR_GRAVEYARD_7, // Nocturne | ||
ENTR_TEMPLE_OF_TIME_7 // Prelude | ||
}; | ||
|
||
static const int songAudioMap[] = { | ||
NA_BGM_OCA_MINUET, | ||
NA_BGM_OCA_BOLERO, | ||
NA_BGM_OCA_SERENADE, | ||
NA_BGM_OCA_REQUIEM, | ||
NA_BGM_OCA_NOCTURNE, | ||
NA_BGM_OCA_LIGHT | ||
}; | ||
|
||
static bool isWarpActive = false; | ||
|
||
void PauseWarp_Execute() { | ||
if (!isWarpActive || gPlayState->msgCtx.msgMode != MSGMODE_NONE) { | ||
return; | ||
} | ||
isWarpActive = false; | ||
GET_PLAYER(gPlayState)->stateFlags1 &= ~PLAYER_STATE1_IN_CUTSCENE; | ||
if (gPlayState->msgCtx.choiceIndex != 0) { | ||
return; | ||
} | ||
if (IS_RANDO) { | ||
Entrance_SetWarpSongEntrance(); | ||
return; | ||
} | ||
gPlayState->transitionTrigger = TRANS_TRIGGER_START; | ||
gPlayState->transitionType = TRANS_TYPE_FADE_WHITE_FAST; | ||
for (int i = 0; i < ARRAY_COUNT(ocarinaSongMap); i++) { | ||
if (gPlayState->msgCtx.lastPlayedSong == ocarinaSongMap[i]) { | ||
gPlayState->nextEntranceIndex = entranceIndexMap[i]; | ||
return; | ||
} | ||
} | ||
gPlayState->transitionTrigger = TRANS_TRIGGER_OFF; | ||
} | ||
|
||
void ActivateWarp(PauseContext* pauseCtx, int song) { | ||
Audio_OcaSetInstrument(0); | ||
Interface_SetDoAction(gPlayState, DO_ACTION_NONE); | ||
pauseCtx->state = 0x12; | ||
WREG(2) = -6240; | ||
func_800F64E0(0); | ||
pauseCtx->unk_1E4 = 0; | ||
int idx = song - QUEST_SONG_MINUET; | ||
gPlayState->msgCtx.lastPlayedSong = ocarinaSongMap[idx]; | ||
Audio_SetSoundBanksMute(0x20); | ||
Audio_PlayFanfare(songAudioMap[idx]); | ||
Message_StartTextbox(gPlayState, songMessageMap[idx], NULL); | ||
GET_PLAYER(gPlayState)->stateFlags1 |= PLAYER_STATE1_IN_CUTSCENE; | ||
isWarpActive = true; | ||
} | ||
|
||
void PauseWarp_HandleSelection() { | ||
if (gSaveContext.inventory.items[SLOT_OCARINA] != ITEM_NONE) { | ||
int aButtonPressed = CHECK_BTN_ALL(gPlayState->state.input->press.button, BTN_A); | ||
int song = gPlayState->pauseCtx.cursorPoint[PAUSE_QUEST]; | ||
if (aButtonPressed && CHECK_QUEST_ITEM(song) && song >= QUEST_SONG_MINUET && song <= QUEST_SONG_PRELUDE) { | ||
ActivateWarp(&gPlayState->pauseCtx, song); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this maybe makes more sense as
OnKaleidoUpdate
I also assume that this means
OnGameFrameUpdate
does not run with kaleido open? So you couldn't just also useOnGameFrameUpdate
and instead just check some sort of pauseCtx value?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nah, OnGameFrameUpdate does run with Kaleido open. You're right, I could of just checked if pauseCtx->pageIndex == PAUSE_QUEST. However, on my original PR for this @jbodner09 liked the idea of having a hook specific to the pause menu for custom item mods. That comment is here. That's why I kept it in, but it's up to yall. It's not necessary for my use case so I could remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On second thought,
OnGameFrameUpdate
is not something we want to use often, so this may be better after allThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. I tried to figure out a way around using it for PauseWarp_Execute, but couldn't figure out a easy way to do it. I've made the checks pretty specific so it shouldn't cause any issue anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea should be fine, I still stand by my original rename suggestion though 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine by me and I just changed it in the latest commit.