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

Adds beta quest Gameshark cheat. #975

Merged
merged 3 commits into from
Aug 1, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions libultraship/libultraship/ImGuiImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ OSContPad* pads;
std::map<std::string, GameAsset*> DefaultAssets;
std::vector<std::string> emptyArgs;

extern bool IsInGamePlay();

namespace SohImGui {

WindowImpl impl;
Expand Down Expand Up @@ -1407,6 +1409,75 @@ namespace SohImGui {
EnhancementCheckbox("Shield with Two-Handed Weapons", "gShieldTwoHanded");
Tooltip("This allows you to put up your shield with any two-handed weapon in hand\nexcept for Deku Sticks");

{
static int32_t betaQuestEnabled = CVar_GetS32("gEnableBetaQuest", 0);
static int32_t lastBetaQuestEnabled = betaQuestEnabled;
static int32_t betaQuestWorld = CVar_GetS32("gBetaQuestWorld", 0xFFEF);
static int32_t lastBetaQuestWorld = betaQuestWorld;

bool isDisabled = !IsInGamePlay();

if (isDisabled) {
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f);
}

EnhancementCheckbox("Enable Beta Quest", "gEnableBetaQuest");
Tooltip("Turns on OoT Beta Quest. *WARNING* This will reset your game.");
betaQuestEnabled = CVar_GetS32("gEnableBetaQuest", 0);
if (betaQuestEnabled) {
if (betaQuestEnabled != lastBetaQuestEnabled) {
betaQuestWorld = 0;
}

ImGui::Text("Beta Quest World: %d", betaQuestWorld);

if (ImGui::Button(" - ##BetaQuest")) {
betaQuestWorld--;
}
ImGui::SameLine();
ImGui::SetCursorPosX(ImGui::GetCursorPosX() - 7.0f);

ImGui::SliderInt("##BetaQuest", &betaQuestWorld, 0, 16, "", ImGuiSliderFlags_AlwaysClamp);
Tooltip("Set the Beta Quest world to explore. *WARNING* Changing this will reset your game.\nCtrl+Click to type in a value.");

ImGui::SameLine();
ImGui::SetCursorPosX(ImGui::GetCursorPosX() - 7.0f);
if (ImGui::Button(" + ##BetaQuest")) {
betaQuestWorld++;
}

if (betaQuestWorld > 16) {
betaQuestWorld = 16;
}
else if (betaQuestWorld < 0) {
betaQuestWorld = 0;
}
}
else {
lastBetaQuestWorld = betaQuestWorld = 0xFFEF;
CVar_SetS32("gBetaQuestWorld", betaQuestWorld);
needs_save = true;
}
if (betaQuestEnabled != lastBetaQuestEnabled || betaQuestWorld != lastBetaQuestWorld)
{
// Reset the game if the beta quest state or world changed because beta quest happens on redirecting the title screen cutscene.
lastBetaQuestEnabled = betaQuestEnabled;
lastBetaQuestWorld = betaQuestWorld;
CVar_SetS32("gEnableBetaQuest", betaQuestEnabled);
CVar_SetS32("gBetaQuestWorld", betaQuestWorld);

console->Commands["reset"].handler(emptyArgs);

needs_save = true;
}

if (isDisabled) {
ImGui::PopItemFlag();
ImGui::PopStyleVar();
}
}

ImGui::EndMenu();
}

Expand Down
4 changes: 4 additions & 0 deletions soh/soh/Enhancements/debugconsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ extern GlobalContext* gGlobalCtx;

#define CMD_REGISTER SohImGui::BindCmd

bool IsInGamePlay() {
return gGlobalCtx != nullptr;
}

static bool ActorSpawnHandler(const std::vector<std::string>& args) {
if ((args.size() != 9) && (args.size() != 3) && (args.size() != 6)) {
ERROR("Not enough arguments passed to actorspawn");
Expand Down
2 changes: 1 addition & 1 deletion soh/src/code/z_common_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ void SaveContext_Init(void) {
gSaveContext.seqId = (u8)NA_BGM_DISABLED;
gSaveContext.natureAmbienceId = NATURE_ID_DISABLED;
gSaveContext.forcedSeqId = NA_BGM_GENERAL_SFX;
gSaveContext.nextCutsceneIndex = 0xFFEF;
gSaveContext.nextCutsceneIndex = CVar_GetS32("gBetaQuestWorld", 0xFFEF);
gSaveContext.cutsceneTrigger = 0;
gSaveContext.chamberCutsceneNum = 0;
gSaveContext.nextDayTime = 0xFFFF;
Expand Down