Adds in-game menu for selecting a dungeon quest/randomizer (#1863)

* Adds most visuals and interactions for quest select menu.

* "Scrolling" menu, adds remaining sub/title textures, language support

* Tweak: ENG, FRA, GER title to match the original style

* ADD: Randomizer tex

* TWEAK: Randomizer ZAPD extension format

* Adds control stick prompts to the "scrolling" menu.

* Adds third entry for Randomizer.

* Bold text on randomizer subtitle.

* Ensures the game won't allow selecting an unsupported quest.

* Makes save files be created from the quest menu selection.

* Removes the master quest and randomizer checkboxes (no longer needed).

* Removes lock on MQ-only rando.

* Skips quest select if only one quest is playable.

* Adds ability to back out of quest select menu

* Show seed icons while Randomizer is selected on Quest Select Menu.

* Fixes custom hud colors and d-pad navigation.

* Implements backing up from name entry to quest select.

Also implements backwards rotations on the file select screen.

Co-authored-by: PurpleHato <linkvssangoku.jr@gmail.com>
This commit is contained in:
Christopher Leggett 2022-11-02 11:50:47 -04:00 committed by GitHub
parent dda4a13bc3
commit fd8a2c9483
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 787 additions and 300 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@ -1322,6 +1322,23 @@ typedef struct {
/* 0x00A8 */ View view;
} OpeningContext; // size = 0x1D0
typedef struct {
/* 0x00 */ u32 stickColorR;
/* 0x04 */ u32 stickColorG;
/* 0x08 */ u32 stickColorB;
/* 0x0C */ u32 stickColorA;
/* 0x10 */ f32 stickTexX;
/* 0x14 */ f32 stickTexY;
/* 0x18 */ u32 arrowColorR;
/* 0x1C */ u32 arrowColorG;
/* 0x20 */ u32 arrowColorB;
/* 0x24 */ u32 arrowColorA;
/* 0x28 */ f32 arrowTexX;
/* 0x2C */ f32 arrowTexY;
/* 0x30 */ f32 z;
/* 0x34 */ s32 isEnabled;
} StickDirectionPrompt;
typedef struct {
/* 0x00000 */ GameState state;
/* 0x000A4 */ Vtx* windowVtx;
@ -1392,6 +1409,14 @@ typedef struct {
/* 0x1CAD2 */ s16 kbdY;
/* 0x1CAD4 */ s16 newFileNameCharCount;
/* 0x1CAD6 */ s16 unk_1CAD6[5];
s16 logoAlpha;
s8 questType[3]; // 0 for Normal, 1 for MQ
StickDirectionPrompt stickLeftPrompt;
StickDirectionPrompt stickRightPrompt;
f32 arrowAnimTween;
f32 stickAnimTween;
u8 arrowAnimState;
u8 stickAnimState;
} FileChooseContext; // size = 0x1CAE0
typedef enum {

View File

@ -27,11 +27,6 @@ void BootCommands_Init()
CVar_RegisterS32("gHudColors", 0); //0 = N64 / 1 = NGC / 2 = Custom
CVar_RegisterS32("gInvertYAxis", 1);
CVar_RegisterS32("gTrailDuration", 4); // 4 = Default trail duration
if (ResourceMgr_GameHasMasterQuest() && !ResourceMgr_GameHasOriginal()) {
CVar_SetS32("gMasterQuest", 1);
} else if (!ResourceMgr_GameHasMasterQuest()) {
CVar_SetS32("gMasterQuest", 0);
}
#if defined(__SWITCH__) || defined(__WIIU__)
CVar_RegisterS32("gControlNav", 1); // always enable controller nav on switch/wii u
#endif

View File

@ -2590,42 +2590,30 @@ void DrawRandoEditor(bool& open) {
return;
}
if (OTRGlobals::Instance->HasMasterQuest() && !OTRGlobals::Instance->HasOriginal()) {
ImGui::Text("Coming Soon! Randomizer is currently not compatible with Master Quest Dungeons.\nFor now, please "
"generate an "
"OTR using a non-Master Quest rom to play the Randomizer");
ImGui::End();
return;
}
bool disableEditingRandoSettings = CVar_GetS32("gRandoGenerating", 0) || CVar_GetS32("gOnFileSelectNameEntry", 0);
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, disableEditingRandoSettings);
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * (disableEditingRandoSettings ? 0.5f : 1.0f));
UIWidgets::EnhancementCheckbox("Enable Randomizer", "gRandomizer");
if (CVar_GetS32("gRandomizer", 0)) {
ImGui::Dummy(ImVec2(0.0f, 0.0f));
if (ImGui::Button("Generate Seed")) {
if (CVar_GetS32("gRandoGenerating", 0) == 0) {
randoThread = std::thread(&GenerateRandomizerImgui);
}
ImGui::Dummy(ImVec2(0.0f, 0.0f));
if (ImGui::Button("Generate Seed")) {
if (CVar_GetS32("gRandoGenerating", 0) == 0) {
randoThread = std::thread(&GenerateRandomizerImgui);
}
ImGui::Dummy(ImVec2(0.0f, 0.0f));
std::string spoilerfilepath = CVar_GetString("gSpoilerLog", "");
ImGui::Text("Spoiler File: %s", spoilerfilepath.c_str());
// RANDOTODO settings presets
// std::string presetfilepath = CVar_GetString("gLoadedPreset", "");
// ImGui::Text("Settings File: %s", presetfilepath.c_str());
}
ImGui::Dummy(ImVec2(0.0f, 0.0f));
std::string spoilerfilepath = CVar_GetString("gSpoilerLog", "");
ImGui::Text("Spoiler File: %s", spoilerfilepath.c_str());
// RANDOTODO settings presets
// std::string presetfilepath = CVar_GetString("gLoadedPreset", "");
// ImGui::Text("Settings File: %s", presetfilepath.c_str());
UIWidgets::PaddedSeparator();
ImGuiWindow* window = ImGui::GetCurrentWindow();
static ImVec2 cellPadding(8.0f, 8.0f);
if (CVar_GetS32("gRandomizer", 0) &&
ImGui::BeginTabBar("Randomizer Settings", ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)) {
if (ImGui::BeginTabBar("Randomizer Settings", ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)) {
if (ImGui::BeginTabItem("World")) {
ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, cellPadding);
if (ImGui::BeginTable("tableRandoWorld", 3, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) {

View File

@ -95,35 +95,6 @@ namespace GameMenuBar {
Audio_SetGameVolume(SEQ_SFX, CVar_GetFloat("gFanfareVolume", 1));
}
bool MasterQuestCheckboxDisabled() {
return !(OTRGlobals::Instance->HasMasterQuest() && OTRGlobals::Instance->HasOriginal())
|| CVar_GetS32("gRandomizer", 0);
}
std::string MasterQuestDisabledTooltip() {
std::string tooltip = "";
if (CVar_GetS32("gRandomizer", 0)) {
tooltip = "This option is disabled because you have the Randomizer enabled.\nRandomizer has it's own "
"settings surrounding Master Quest dungeons\nthat you can set from the Randomizer Settings Menu.";
}
if (!OTRGlobals::Instance->HasOriginal()) {
tooltip = "This option is force-enabled because you have only loaded the\noot-mq.otr file. If you wish to "
"play the Original Quest,\nplease provide the oot.otr file.";
}
if (!OTRGlobals::Instance->HasMasterQuest()) {
tooltip = "This option is disabled because you have only loaded the\noot.otr file. If you wish to play "
"the Master Quest,\nplease proivde the oot-mq.otr file.";
}
return tooltip;
}
UIWidgets::CheckboxGraphics MasterQuestDisabledGraphic() {
if (!OTRGlobals::Instance->HasOriginal()) {
return UIWidgets::CheckboxGraphics::Checkmark;
}
return UIWidgets::CheckboxGraphics::Cross;
}
void applyEnhancementPresetDefault(void) {
// D-pad Support on Pause
CVar_SetS32("gDpadPause", 0);
@ -1313,10 +1284,6 @@ namespace GameMenuBar {
UIWidgets::Tooltip("Holding down B skips text");
UIWidgets::PaddedEnhancementCheckbox("Free Camera", "gFreeCamera", true, false);
UIWidgets::Tooltip("Enables camera control\nNote: You must remap C buttons off of the right stick in the controller config menu, and map the camera stick to the right stick.");
UIWidgets::PaddedEnhancementCheckbox("Master Quest", "gMasterQuest", true, false, MasterQuestCheckboxDisabled(), MasterQuestDisabledTooltip().c_str(), MasterQuestDisabledGraphic());
UIWidgets::Tooltip("Enables Master Quest.\n\nWhen checked, any non-rando save files you create will be "
"Master Quest save files. Master Quest save files will still have Master Quest dungeons "
"regardless of this setting and require oot-mq.otr to be present in order to play.");
#ifdef __SWITCH__
UIWidgets::Spacer(0);

View File

@ -56,8 +56,6 @@ SaveManager::SaveManager() {
}
void SaveManager::LoadRandomizerVersion1() {
if(!CVar_GetS32("gRandomizer", 0)) return;
for (int i = 0; i < ARRAY_COUNT(gSaveContext.itemLocations); i++) {
SaveManager::Instance->LoadStruct("get" + std::to_string(i), [&]() {
SaveManager::Instance->LoadData("rgID", gSaveContext.itemLocations[i].get.rgID);
@ -482,9 +480,6 @@ void SaveManager::InitFileNormal() {
gSaveContext.magicLevel = 0;
gSaveContext.infTable[29] = 1;
gSaveContext.sceneFlags[5].swch = 0x40000000;
gSaveContext.isMasterQuest = CVar_GetS32("gMasterQuest", 0) && !CVar_GetS32("gRandomizer", 0);
//RANDOTODO (ADD ITEMLOCATIONS TO GSAVECONTEXT)
}

View File

@ -297,7 +297,7 @@ void Sram_InitSave(FileChooseContext* fileChooseCtx) {
gSaveContext.playerName[offset] = Save_GetSaveMetaInfo(fileChooseCtx->buttonIndex)->playerName[offset];
}
if (CVar_GetS32("gRandomizer", 0) && strnlen(CVar_GetString("gSpoilerLog", ""), 1) != 0 &&
if (fileChooseCtx->questType[fileChooseCtx->buttonIndex] == 2 && strnlen(CVar_GetString("gSpoilerLog", ""), 1) != 0 &&
!((Save_GetSaveMetaInfo(fileChooseCtx->buttonIndex)->requiresMasterQuest && !ResourceMgr_GameHasMasterQuest()) ||
(Save_GetSaveMetaInfo(fileChooseCtx->buttonIndex)->requiresMasterQuest && !ResourceMgr_GameHasOriginal()))) {
// Set N64DD Flags for save file

View File

@ -14,23 +14,6 @@ typedef void (*EnOssanInitFunc)(struct EnOssan*, GlobalContext*);
typedef s16 (*EnOssanGetGirlAParamsFunc)(s16);
typedef void (*EnOssanStateFunc)(struct EnOssan*, GlobalContext*, Player*);
typedef struct {
/* 0x00 */ u32 stickColorR;
/* 0x04 */ u32 stickColorG;
/* 0x08 */ u32 stickColorB;
/* 0x0C */ u32 stickColorA;
/* 0x10 */ f32 stickTexX;
/* 0x14 */ f32 stickTexY;
/* 0x18 */ u32 arrowColorR;
/* 0x1C */ u32 arrowColorG;
/* 0x20 */ u32 arrowColorB;
/* 0x24 */ u32 arrowColorA;
/* 0x28 */ f32 arrowTexX;
/* 0x2C */ f32 arrowTexY;
/* 0x30 */ f32 z;
/* 0x34 */ s32 isEnabled;
} StickDirectionPrompt; // size = 0x38
#define ColChanMix(c1, c2, m) (c1 - (s32)(c2 * m)) & 0xFF
typedef struct EnOssan {

View File

@ -55,7 +55,12 @@ typedef enum {
/* 37 */ CM_OPTIONS_MENU,
/* 38 */ CM_START_OPTIONS,
/* 39 */ CM_OPTIONS_TO_MAIN,
/* 40 */ CM_UNUSED_DELAY
/* 40 */ CM_UNUSED_DELAY,
CM_ROTATE_TO_QUEST_MENU,
CM_QUEST_MENU,
CM_START_QUEST_MENU,
CM_QUEST_TO_MAIN,
CM_NAME_ENTRY_TO_QUEST_MENU,
} ConfigMode;
typedef enum {

File diff suppressed because it is too large Load Diff

View File

@ -390,7 +390,12 @@ void FileChoose_DrawNameEntry(GameState* thisx) {
if (this->newFileNameCharCount < 0) {
this->newFileNameCharCount = 0;
this->configMode = CM_NAME_ENTRY_TO_MAIN;
if (this->prevConfigMode == CM_QUEST_MENU) {
this->configMode = CM_NAME_ENTRY_TO_QUEST_MENU;
} else {
this->configMode = CM_NAME_ENTRY_TO_MAIN;
}
this->prevConfigMode = CM_NAME_ENTRY;
CVar_SetS32("gOnFileSelectNameEntry", 0);
} else {
for (i = this->newFileNameCharCount; i < 7; i++) {
@ -464,6 +469,7 @@ void FileChoose_DrawNameEntry(GameState* thisx) {
dayTime = ((void)0, gSaveContext.dayTime);
Sram_InitSave(this);
gSaveContext.dayTime = dayTime;
this->prevConfigMode = CM_MAIN_MENU;
this->configMode = CM_NAME_ENTRY_TO_MAIN;
CVar_SetS32("gOnFileSelectNameEntry", 0);
CVar_SetS32("gNewFileDropped", 0);
@ -687,6 +693,7 @@ void FileChoose_UpdateOptionsMenu(GameState* thisx) {
if (CHECK_BTN_ALL(input->press.button, BTN_B)) {
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_DECIDE_L, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
this->prevConfigMode = this->configMode;
this->configMode = CM_OPTIONS_TO_MAIN;
osSyncPrintf("");
Save_SaveGlobal();