[Enhancement] Enable Suns Song (#262)

* Enable Suns Song

* Move Sun's Song to no longer check for save data at all

* Update description

* Address review comments

---------

Co-authored-by: Archez <Archez@users.noreply.github.com>
This commit is contained in:
aMannus
2024-05-22 09:05:03 -05:00
committed by Garrett Cox
co-authored by Archez
parent 6b73dab27b
commit f3924c2f83
8 changed files with 48 additions and 6 deletions
+10
View File
@@ -382,6 +382,16 @@ void DrawEnhancementsMenu() {
ImGui::EndMenu();
}
if (UIWidgets::BeginMenu("Songs")) {
UIWidgets::CVarCheckbox("Enable Sun's Song", "gEnhancements.Songs.EnableSunsSong", {
.tooltip = "Enables the partially implemented Sun's Song. RIGHT-DOWN-UP-RIGHT-DOWN-UP to play it. "
"This song will make time move very fast until either Link moves to a different scene, "
"or when the time switches to a new time period."
});
ImGui::EndMenu();
}
if (mHudEditorWindow) {
UIWidgets::WindowButton("Hud Editor", "gWindows.HudEditor", mHudEditorWindow, {
.tooltip = "Enables the Hud Editor window, allowing you to edit your hud"
+3
View File
@@ -16,6 +16,9 @@ void InitEnhancements() {
// Minigames
RegisterAlwaysWinDoggyRace();
// Songs
RegisterEnableSunsSong();
// Restorations
RegisterSideRoll();
+1
View File
@@ -13,6 +13,7 @@
#include "Cutscenes/HideTitleCards.h"
#include "Restorations/SideRoll.h"
#include "Graphics/PlayAsKafei.h"
#include "Songs/EnableSunsSong.h"
enum AlwaysWinDoggyRaceOptions {
ALWAYS_WIN_DOGGY_RACE_OFF,
@@ -37,6 +37,7 @@ typedef enum {
GI_VB_SET_BLAST_MASK_COOLDOWN_TIMER,
GI_VB_PATCH_SIDEROLL,
GI_VB_PREVENT_MASK_TRANSFORMATION_CS,
GI_VB_SONG_AVAILABLE_TO_PLAY,
} GIVanillaBehavior;
#ifdef __cplusplus
@@ -0,0 +1,16 @@
#include <libultraship/bridge.h>
#include "Enhancements/GameInteractor/GameInteractor.h"
extern "C" {
#include <z64ocarina.h>
}
void RegisterEnableSunsSong() {
REGISTER_VB_SHOULD(GI_VB_SONG_AVAILABLE_TO_PLAY, {
uint8_t* songIndex = static_cast<uint8_t*>(opt);
// If the enhancement is on, and the currently played song is Sun's Song, set it to be available to be played.
if (CVarGetInteger("gEnhancements.Songs.EnableSunsSong", 0) && *songIndex == OCARINA_SONG_SUNS) {
*should = true;
}
});
}
@@ -0,0 +1,6 @@
#ifndef SONGS_ENABLE_SUNS_SONG_H
#define SONGS_ENABLE_SUNS_SONG_H
void RegisterEnableSunsSong();
#endif // SONGS_ENABLE_SUNS_SONG_H
+4 -1
View File
@@ -1,5 +1,7 @@
#include "global.h"
#include "Enhancements/GameInteractor/GameInteractor.h"
typedef struct {
/* 0x0 */ s8 x;
/* 0x1 */ s8 y;
@@ -2551,7 +2553,8 @@ void AudioOcarina_CheckSongsWithoutMusicStaff(void) {
// Loop through each of the songs
for (songIndex = sFirstOcarinaSongIndex; songIndex < sLastOcarinaSongIndex; songIndex++) {
// Checks to see if the song is available to be played
if ((u32)sOcarinaAvailableSongFlags & (1 << songIndex)) {
bool vanillaCondition = (u32)sOcarinaAvailableSongFlags & (1 << songIndex);
if (GameInteractor_Should(GI_VB_SONG_AVAILABLE_TO_PLAY, vanillaCondition, &songIndex)) {
// Loops through all possible starting indices?
// Loops through the notes of the song?
for (j = 0, k = 0; (j < gOcarinaSongButtons[songIndex].numButtons) && (k == 0) &&
+7 -5
View File
@@ -4574,6 +4574,12 @@ void Message_DrawMain(PlayState* play, Gfx** gfxP) {
msgCtx->songPlayed = msgCtx->ocarinaStaff->state;
bool vanillaOwnedSongCheck = (msgCtx->ocarinaStaff->state == OCARINA_SONG_SCARECROW_SPAWN) ||
(msgCtx->ocarinaStaff->state == OCARINA_SONG_INVERTED_TIME) ||
(msgCtx->ocarinaStaff->state == OCARINA_SONG_DOUBLE_TIME) ||
(msgCtx->ocarinaStaff->state == OCARINA_SONG_GORON_LULLABY_INTRO) ||
CHECK_QUEST_ITEM(QUEST_SONG_SONATA + msgCtx->ocarinaStaff->state);
if (msgCtx->ocarinaStaff->state <= OCARINA_SONG_SCARECROW_SPAWN) {
if (msgCtx->ocarinaStaff->state == OCARINA_SONG_EVAN_PART1) {
AudioOcarina_ResetAndReadInput();
@@ -4583,11 +4589,7 @@ void Message_DrawMain(PlayState* play, Gfx** gfxP) {
AudioOcarina_SetOcarinaDisableTimer(0, 20);
Message_CloseTextbox(play);
play->msgCtx.ocarinaMode = OCARINA_MODE_PLAYED_FULL_EVAN_SONG;
} else if ((msgCtx->ocarinaStaff->state == OCARINA_SONG_SCARECROW_SPAWN) ||
(msgCtx->ocarinaStaff->state == OCARINA_SONG_INVERTED_TIME) ||
(msgCtx->ocarinaStaff->state == OCARINA_SONG_DOUBLE_TIME) ||
(msgCtx->ocarinaStaff->state == OCARINA_SONG_GORON_LULLABY_INTRO) ||
CHECK_QUEST_ITEM(QUEST_SONG_SONATA + msgCtx->ocarinaStaff->state)) {
} else if (GameInteractor_Should(GI_VB_SONG_AVAILABLE_TO_PLAY, vanillaOwnedSongCheck, &msgCtx->ocarinaStaff->state)) {
sLastPlayedSong = msgCtx->ocarinaStaff->state;
msgCtx->lastPlayedSong = msgCtx->ocarinaStaff->state;
msgCtx->songPlayed = msgCtx->ocarinaStaff->state;