Frogs Ocarina Game Difficulty Options (#3373)

* Frog actor edits, menu, presets

* Block off vanilla code + comments

* fix logic + formatting

* new documentation format

* Update for CVAR changes

* Fix alignment

* Conditions cleanup

* Update soh/soh/SohMenuBar.cpp

Oops, added

Co-authored-by: inspectredc <78732756+inspectredc@users.noreply.github.com>

---------

Co-authored-by: inspectredc <78732756+inspectredc@users.noreply.github.com>
This commit is contained in:
Eric Hoey 2024-05-09 21:55:53 -04:00 committed by GitHub
parent 23f9654940
commit 63bc2aff59
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 65 additions and 8 deletions

View File

@ -200,6 +200,10 @@ const std::vector<const char*> enhancementsCvars = {
CVAR_ENHANCEMENT("OcarinaGame.RoundOneNotes"), CVAR_ENHANCEMENT("OcarinaGame.RoundOneNotes"),
CVAR_ENHANCEMENT("OcarinaGame.RoundTwoNotes"), CVAR_ENHANCEMENT("OcarinaGame.RoundTwoNotes"),
CVAR_ENHANCEMENT("OcarinaGame.RoundThreeNotes"), CVAR_ENHANCEMENT("OcarinaGame.RoundThreeNotes"),
CVAR_ENHANCEMENT("CustomizeFrogsOcarinaGame"),
CVAR_ENHANCEMENT("InstantFrogsGameWin"),
CVAR_ENHANCEMENT("FrogsUnlimitedFailTime"),
CVAR_ENHANCEMENT("FrogsModifyFailTime"),
CVAR_ENHANCEMENT("CreditsFix"), CVAR_ENHANCEMENT("CreditsFix"),
CVAR_ENHANCEMENT("SilverRupeeJingleExtend"), CVAR_ENHANCEMENT("SilverRupeeJingleExtend"),
CVAR_ENHANCEMENT("StaticExplosionRadius"), CVAR_ENHANCEMENT("StaticExplosionRadius"),

View File

@ -891,6 +891,32 @@ void DrawEnhancementsMenu() {
UIWidgets::Spacer(0); UIWidgets::Spacer(0);
if (ImGui::BeginMenu("Frogs Ocarina Game")) {
UIWidgets::EnhancementCheckbox("Customize Behavior", CVAR_ENHANCEMENT("CustomizeFrogsOcarinaGame"));
UIWidgets::Tooltip("Turn on/off changes to the frogs ocarina game behavior");
bool disabled = !CVarGetInteger(CVAR_ENHANCEMENT("CustomizeFrogsOcarinaGame"), 0);
static const char* disabledTooltip =
"This option is disabled because \"Customize Behavior\" is turned off";
UIWidgets::PaddedEnhancementCheckbox("Instant Win", CVAR_ENHANCEMENT("InstantFrogsGameWin"), true, false, disabled, disabledTooltip);
UIWidgets::Tooltip("Skips the frogs ocarina game");
UIWidgets::PaddedEnhancementCheckbox("Unlimited Playback Time", CVAR_ENHANCEMENT("FrogsUnlimitedFailTime"), true, false, disabled, disabledTooltip);
UIWidgets::Tooltip("Removes the timer to play back the song");
bool disabledFrog = 0;
static const char* disabledFrogTooltip =
"This option is disabled because \"Customize Behavior\" is turned off or \"Unlimited Playback Time\" is on";
if (!CVarGetInteger(CVAR_ENHANCEMENT("CustomizeFrogsOcarinaGame"), 0) || CVarGetInteger(CVAR_ENHANCEMENT("FrogsUnlimitedFailTime"), 0)) {
disabledFrog = 1;
} else {
disabledFrog = 0;
}
UIWidgets::PaddedEnhancementSliderInt("Modify note timer: %dx", "##FrogsFailTimer", CVAR_ENHANCEMENT("FrogsModifyFailTime"), 1, 5, "", 1, true, true, false,
disabledFrog, disabledFrogTooltip);
UIWidgets::Tooltip("Adjusts the time allowed for playback before failing");
ImGui::EndMenu();
}
UIWidgets::Spacer(0);
UIWidgets::PaddedEnhancementCheckbox("Delete File On Death", CVAR_ENHANCEMENT("DeleteFileOnDeath"), true, false); UIWidgets::PaddedEnhancementCheckbox("Delete File On Death", CVAR_ENHANCEMENT("DeleteFileOnDeath"), true, false);
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 0.0f, 0.0f, 1.0f)); ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 0.0f, 0.0f, 1.0f));
UIWidgets::Tooltip("Dying will delete your file\n\n " ICON_FA_EXCLAMATION_TRIANGLE " WARNING " ICON_FA_EXCLAMATION_TRIANGLE "\nTHIS IS NOT REVERSABLE\nUSE AT YOUR OWN RISK!"); UIWidgets::Tooltip("Dying will delete your file\n\n " ICON_FA_EXCLAMATION_TRIANGLE " WARNING " ICON_FA_EXCLAMATION_TRIANGLE "\nTHIS IS NOT REVERSABLE\nUSE AT YOUR OWN RISK!");

View File

@ -818,6 +818,21 @@ u8 EnFr_GetNextNoteFrogSong(u8 ocarinaNoteIndex) {
void EnFr_SetupFrogSong(EnFr* this, PlayState* play) { void EnFr_SetupFrogSong(EnFr* this, PlayState* play) {
if (this->frogSongTimer != 0) { if (this->frogSongTimer != 0) {
this->frogSongTimer--; this->frogSongTimer--;
} else {
// #region SOH [Enhancement]
if (CVarGetInteger(CVAR_ENHANCEMENT("CustomizeFrogsOcarinaGame"), 0)) {
this->frogSongTimer = 40 * CVarGetInteger(CVAR_ENHANCEMENT("FrogsModifyFailTime"), 1);
if (CVarGetInteger(CVAR_ENHANCEMENT("InstantFrogsGameWin"), 0)) {
this->actor.textId = 0x40AC;
EnFr_SetupReward(this, play, false);
} else {
this->ocarinaNoteIndex = 0;
func_8010BD58(play, OCARINA_ACTION_FROGS);
this->ocarinaNote = EnFr_GetNextNoteFrogSong(this->ocarinaNoteIndex);
EnFr_CheckOcarinaInputFrogSong(this->ocarinaNote);
this->actionFunc = EnFr_ContinueFrogSong;
}
// #endregion
} else { } else {
this->frogSongTimer = 40; this->frogSongTimer = 40;
this->ocarinaNoteIndex = 0; this->ocarinaNoteIndex = 0;
@ -826,6 +841,7 @@ void EnFr_SetupFrogSong(EnFr* this, PlayState* play) {
EnFr_CheckOcarinaInputFrogSong(this->ocarinaNote); EnFr_CheckOcarinaInputFrogSong(this->ocarinaNote);
this->actionFunc = EnFr_ContinueFrogSong; this->actionFunc = EnFr_ContinueFrogSong;
} }
}
} }
s32 EnFr_IsFrogSongComplete(EnFr* this, PlayState* play) { s32 EnFr_IsFrogSongComplete(EnFr* this, PlayState* play) {
@ -846,8 +862,14 @@ s32 EnFr_IsFrogSongComplete(EnFr* this, PlayState* play) {
ocarinaNote = EnFr_GetNextNoteFrogSong(ocarinaNoteIndex); ocarinaNote = EnFr_GetNextNoteFrogSong(ocarinaNoteIndex);
this->ocarinaNote = ocarinaNote; this->ocarinaNote = ocarinaNote;
EnFr_CheckOcarinaInputFrogSong(ocarinaNote); EnFr_CheckOcarinaInputFrogSong(ocarinaNote);
// #region SOH [Enhancement]
if (CVarGetInteger(CVAR_ENHANCEMENT("CustomizeFrogsOcarinaGame"), 0)) {
this->frogSongTimer = sTimerFrogSong[index] * CVarGetInteger(CVAR_ENHANCEMENT("FrogsModifyFailTime"), 1);
// #endregion
} else {
this->frogSongTimer = sTimerFrogSong[index]; this->frogSongTimer = sTimerFrogSong[index];
} }
}
return false; return false;
} }
@ -870,7 +892,12 @@ void EnFr_ContinueFrogSong(EnFr* this, PlayState* play) {
if (this->frogSongTimer == 0) { if (this->frogSongTimer == 0) {
EnFr_OcarinaMistake(this, play); EnFr_OcarinaMistake(this, play);
} else { } else {
// #region SOH [Enhancement] - Don't decrement timer
if (!CVarGetInteger(CVAR_ENHANCEMENT("CustomizeFrogsOcarinaGame"), 0) ||
!CVarGetInteger(CVAR_ENHANCEMENT("FrogsUnlimitedFailTime"), 0)) {
// #endregion
this->frogSongTimer--; this->frogSongTimer--;
}
if (play->msgCtx.msgMode == MSGMODE_FROGS_PLAYING) { if (play->msgCtx.msgMode == MSGMODE_FROGS_PLAYING) {
counter = 0; counter = 0;
for (i = 0; i < ARRAY_COUNT(sEnFrPointers.frogs); i++) { for (i = 0; i < ARRAY_COUNT(sEnFrPointers.frogs); i++) {