Introduce in-game Randomizer Settings menu, remove plando mode (#4804)

* Initial mockup

* Rip out part of plando mode, implement rando settings menu

* MVP new randomizer flow

* Translation support and code cleanup

* Fixes and more cleanup

* Fix whoopsie

* Fix whoopsie 2
This commit is contained in:
aMannus 2025-01-05 18:42:45 +01:00 committed by GitHub
commit 537a57c361
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 368 additions and 248 deletions

View file

@ -1597,6 +1597,9 @@ typedef struct {
uint8_t bossRushOffset;
int16_t bossRushUIAlpha;
uint16_t bossRushArrowOffset;
uint8_t randomizerIndex;
int16_t randomizerUIAlpha;
uint16_t randomizerArrowOffset;
} FileChooseContext; // size = 0x1CAE0
// Macros for `EntranceInfo.field`

View file

@ -0,0 +1,69 @@
#include "FileSelectEnhancements.h"
#include "soh/OTRGlobals.h"
#include <array>
#include <string>
#include <vector>
std::array<std::string, LANGUAGE_MAX> RandomizerSettingsMenuText[RSM_MAX] = {
{
// English
"Start Randomizer",
// German
"Start Randomizer",
// French
"Start Randomizer",
},
{
// English
"Generate New Randomizer Seed",
// German
"Generate New Randomizer Seed",
// French
"Generate New Randomizer Seed",
},
{
// English
"Open Randomizer Settings",
// German
"Open Randomizer Settings",
// French
"Open Randomizer Settings",
},
{
// English
"Generating...",
// German
"Generating...",
// French
"Generating...",
},
{
// English
"No randomizer seed loaded.\nPlease generate one first"
#if defined(__WIIU__) || defined(__SWITCH__)
".",
#else
",\nor drop a spoiler log on the game window.",
#endif
// German
"No randomizer seed loaded.\nPlease generate one first"
#if defined(__WIIU__) || defined(__SWITCH__)
".",
#else
",\nor drop a spoiler log on the game window.",
#endif
// French
"Aucune Seed de Randomizer actuellement disponible.\nGénérez-en une dans les \"Randomizer Settings\""
#if (defined(__WIIU__) || defined(__SWITCH__))
"."
#else
"\nou glissez un spoilerlog sur la fenêtre du jeu."
#endif
},
};
const char* SohFileSelect_GetSettingText(uint8_t optionIndex, uint8_t language) {
return RandomizerSettingsMenuText[optionIndex][language].c_str();
}

View file

@ -0,0 +1,23 @@
#ifndef FILE_SELECT_ENHANCEMENTS_H
#define FILE_SELECT_ENHANCEMENTS_H
#include "z64.h"
#ifdef __cplusplus
extern "C" {
#endif
const char* SohFileSelect_GetSettingText(u8 optionIndex, u8 language);
#ifdef __cplusplus
};
#endif
typedef enum {
RSM_START_RANDOMIZER,
RSM_GENERATE_RANDOMIZER,
RSM_OPEN_RANDOMIZER_SETTINGS,
RSM_GENERATING,
RSM_NO_RANDOMIZER_GENERATED,
RSM_MAX,
} RandomizerSettingsMenuEnums;
#endif

View file

@ -16,5 +16,4 @@ void RandoMain::GenerateRando(std::set<RandomizerCheck> excludedLocations, std::
Rando::Context::GetInstance()->SetSeedGenerated(GenerateRandomizer(excludedLocations, enabledTricks, seedString));
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
Rando::Context::GetInstance()->SetPlandoLoaded(false);
}

View file

@ -229,14 +229,6 @@ void Context::SetSpoilerLoaded(const bool spoilerLoaded) {
mSpoilerLoaded = spoilerLoaded;
}
bool Context::IsPlandoLoaded() const {
return mPlandoLoaded;
}
void Context::SetPlandoLoaded(const bool plandoLoaded) {
mPlandoLoaded = plandoLoaded;
}
GetItemEntry Context::GetFinalGIEntry(const RandomizerCheck rc, const bool checkObtainability, const GetItemID ogItemId) {
const auto itemLoc = GetItemLocation(rc);
if (itemLoc->GetPlacedRandomizerGet() == RG_NONE) {
@ -279,27 +271,23 @@ std::string sanitize(std::string stringValue) {
return stringValue;
}
void Context::ParseSpoiler(const char* spoilerFileName, const bool plandoMode) {
void Context::ParseSpoiler(const char* spoilerFileName) {
std::ifstream spoilerFileStream(sanitize(spoilerFileName));
if (!spoilerFileStream) {
return;
}
mSeedGenerated = false;
mSpoilerLoaded = false;
mPlandoLoaded = false;
try {
nlohmann::json spoilerFileJson;
spoilerFileStream >> spoilerFileJson;
ParseHashIconIndexesJson(spoilerFileJson);
mSettings->ParseJson(spoilerFileJson);
if (plandoMode) {
ParseItemLocationsJson(spoilerFileJson);
ParseHintJson(spoilerFileJson);
mEntranceShuffler->ParseJson(spoilerFileJson);
mDungeons->ParseJson(spoilerFileJson);
mTrials->ParseJson(spoilerFileJson);
mPlandoLoaded = true;
}
ParseItemLocationsJson(spoilerFileJson);
ParseHintJson(spoilerFileJson);
mEntranceShuffler->ParseJson(spoilerFileJson);
mDungeons->ParseJson(spoilerFileJson);
mTrials->ParseJson(spoilerFileJson);
mSpoilerLoaded = true;
mSeedGenerated = false;
} catch (...) {

View file

@ -62,8 +62,6 @@ class Context {
void SetSeedGenerated(bool seedGenerated = true);
bool IsSpoilerLoaded() const;
void SetSpoilerLoaded(bool spoilerLoaded = true);
bool IsPlandoLoaded() const;
void SetPlandoLoaded(bool plandoLoaded = true);
std::shared_ptr<Settings> GetSettings();
std::shared_ptr<EntranceShuffler> GetEntranceShuffler();
std::shared_ptr<Dungeons> GetDungeons();
@ -78,7 +76,7 @@ class Context {
Option& GetOption(RandomizerSettingKey key) const;
TrickOption& GetTrickOption(RandomizerTrick key) const;
GetItemEntry GetFinalGIEntry(RandomizerCheck rc, bool checkObtainability = true, GetItemID ogItemId = GI_NONE);
void ParseSpoiler(const char* spoilerFileName, bool plandoMode);
void ParseSpoiler(const char* spoilerFileName);
void ParseHashIconIndexesJson(nlohmann::json spoilerFileJson);
void ParseItemLocationsJson(nlohmann::json spoilerFileJson);
void WriteHintJson(nlohmann::ordered_json& spoilerFileJson);
@ -106,6 +104,5 @@ class Context {
std::shared_ptr<Kaleido> mKaleido;
bool mSeedGenerated = false;
bool mSpoilerLoaded = false;
bool mPlandoLoaded = false;
};
} // namespace Rando

View file

@ -1968,7 +1968,6 @@ void RandomizerSettingsWindow::DrawElement() {
ctx->SetSpoilerLoaded(false);
GenerateRandomizer(CVarGetInteger(CVAR_RANDOMIZER_SETTING("ManualSeedEntry"), 0) ? seedString : "");
}
UIWidgets::Tooltip("You can also press L on the Quest Select screen to generate a new seed");
ImGui::EndDisabled();
UIWidgets::Spacer(0);

View file

@ -1904,7 +1904,7 @@ extern "C" int GetEquipNowMessage(char* buffer, char* src, const int maxBufferSi
}
extern "C" void Randomizer_ParseSpoiler(const char* fileLoc) {
OTRGlobals::Instance->gRandoContext->ParseSpoiler(fileLoc, CVarGetInteger(CVAR_GENERAL("PlandoMode"), 0));
OTRGlobals::Instance->gRandoContext->ParseSpoiler(fileLoc);
}
extern "C" void Randomizer_LoadHintMessages() {
@ -1995,14 +1995,6 @@ extern "C" GetItemEntry GetItemMystery() {
return { ITEM_NONE_FE, 0, 0, 0, 0, 0, 0, ITEM_NONE_FE, 0, false, ITEM_FROM_NPC, ITEM_CATEGORY_JUNK, NULL, MOD_RANDOMIZER, (CustomDrawFunc)Randomizer_DrawMysteryItem };
}
extern "C" void Randomizer_GenerateSeed() {
std::string seed = "";
if (OTRGlobals::Instance->gRandoContext->IsSpoilerLoaded()) {
seed = OTRGlobals::Instance->gRandoContext->GetSettings()->GetSeedString();
}
GenerateRandomizer(seed);
}
extern "C" uint8_t Randomizer_IsSeedGenerated() {
return OTRGlobals::Instance->gRandoContext->IsSeedGenerated() ? 1 : 0;
}
@ -2019,12 +2011,12 @@ extern "C" void Randomizer_SetSpoilerLoaded(bool spoilerLoaded) {
OTRGlobals::Instance->gRandoContext->SetSpoilerLoaded(spoilerLoaded);
}
extern "C" uint8_t Randomizer_IsPlandoLoaded() {
return OTRGlobals::Instance->gRandoContext->IsPlandoLoaded() ? 1 : 0;
extern "C" uint8_t Randomizer_GenerateRandomizer() {
return GenerateRandomizer() ? 1 : 0;
}
extern "C" void Randomizer_SetPlandoLoaded(bool plandoLoaded) {
OTRGlobals::Instance->gRandoContext->SetPlandoLoaded(plandoLoaded);
extern "C" void Randomizer_ShowRandomizerMenu() {
SohGui::ShowRandomizerSettingsMenu();
}
CustomMessage Randomizer_GetCustomGetItemMessage(Player* player) {

View file

@ -135,13 +135,12 @@ RandomizerInf Randomizer_GetRandomizerInfFromCheck(RandomizerCheck randomizerChe
bool Randomizer_IsCheckShuffled(RandomizerCheck check);
GetItemEntry GetItemMystery();
ItemObtainability Randomizer_GetItemObtainabilityFromRandomizerCheck(RandomizerCheck randomizerCheck);
void Randomizer_GenerateSeed();
uint8_t Randomizer_IsSeedGenerated();
void Randomizer_SetSeedGenerated(bool seedGenerated);
uint8_t Randomizer_IsSpoilerLoaded();
void Randomizer_SetSpoilerLoaded(bool spoilerLoaded);
uint8_t Randomizer_IsPlandoLoaded();
void Randomizer_SetPlandoLoaded(bool plandoLoaded);
uint8_t Randomizer_GenerateRandomizer();
void Randomizer_ShowRandomizerMenu();
int CustomMessage_RetrieveIfExists(PlayState* play);
void Overlay_DisplayText(float duration, const char* text);
void Overlay_DisplayText_Seconds(int seconds, const char* text);

View file

@ -266,4 +266,8 @@ namespace SohGui {
void RegisterPopup(std::string title, std::string message, std::string button1, std::string button2, std::function<void()> button1callback, std::function<void()> button2callback) {
mModalWindow->RegisterPopup(title, message, button1, button2, button1callback, button2callback);
}
void ShowRandomizerSettingsMenu() {
mRandomizerSettingsWindow->Show();
}
}

View file

@ -43,6 +43,7 @@ namespace SohGui {
void Draw();
void Destroy();
void RegisterPopup(std::string title, std::string message, std::string button1 = "OK", std::string button2 = "", std::function<void()> button1callback = nullptr, std::function<void()> button2callback = nullptr);
void ShowRandomizerSettingsMenu();
}
#endif /* SohGui_hpp */

View file

@ -2123,25 +2123,17 @@ void DrawRemoteControlMenu() {
#endif
extern std::shared_ptr<RandomizerSettingsWindow> mRandomizerSettingsWindow;
extern std::shared_ptr<PlandomizerWindow> mPlandomizerWindow;
extern std::shared_ptr<ItemTrackerWindow> mItemTrackerWindow;
extern std::shared_ptr<ItemTrackerSettingsWindow> mItemTrackerSettingsWindow;
extern std::shared_ptr<EntranceTrackerWindow> mEntranceTrackerWindow;
extern std::shared_ptr<EntranceTrackerSettingsWindow> mEntranceTrackerSettingsWindow;
extern std::shared_ptr<CheckTracker::CheckTrackerWindow> mCheckTrackerWindow;
extern std::shared_ptr<CheckTracker::CheckTrackerSettingsWindow> mCheckTrackerSettingsWindow;
extern std::shared_ptr<PlandomizerWindow> mPlandomizerWindow;
extern "C" u8 Randomizer_GetSettingValue(RandomizerSettingKey randoSettingKey);
void DrawRandomizerMenu() {
if (ImGui::BeginMenu("Randomizer")) {
UIWidgets::EnhancementCheckbox("Plando Mode", CVAR_GENERAL("PlandoMode"));
UIWidgets::Tooltip(
"When dropping a spoiler file on the game window, parse the full spoiler file instead of just the "
"necessary "
"parts to regenerate a seed.\n\nKeep in mind if you do this, all custom text will only be available in the "
"language present in the spoilerfile. You can use this to edit a previously generated spoilerfile that has "
"been edited with custom hint text and item locations. May be useful for debugging.");
UIWidgets::PaddedSeparator();
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(12.0f, 6.0f));
ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(0, 0));
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f);
@ -2159,17 +2151,17 @@ void DrawRandomizerMenu() {
static float separationToOptionsButton = 5.0f;
#endif
if (mPlandomizerWindow) {
if (ImGui::Button(GetWindowButtonText("Plandomizer Editor", CVarGetInteger(CVAR_WINDOW("PlandomizerWindow"), 0)).c_str(), buttonSize)) {
mPlandomizerWindow->ToggleVisibility();
if (mRandomizerSettingsWindow) {
if (ImGui::Button(GetWindowButtonText("Randomizer Settings", CVarGetInteger(CVAR_WINDOW("RandomizerSettings"), 0)).c_str(), buttonSize)) {
mRandomizerSettingsWindow->ToggleVisibility();
}
}
UIWidgets::Spacer(0);
if (mRandomizerSettingsWindow) {
if (ImGui::Button(GetWindowButtonText("Randomizer Settings", CVarGetInteger(CVAR_WINDOW("RandomizerSettings"), 0)).c_str(), buttonSize)) {
mRandomizerSettingsWindow->ToggleVisibility();
if (mPlandomizerWindow) {
if (ImGui::Button(GetWindowButtonText("Plandomizer Editor", CVarGetInteger(CVAR_WINDOW("PlandomizerWindow"), 0)).c_str(), buttonSize)) {
mPlandomizerWindow->ToggleVisibility();
}
}

View file

@ -251,7 +251,7 @@ void Sram_InitSave(FileChooseContext* fileChooseCtx) {
u8 currentQuest = fileChooseCtx->questType[fileChooseCtx->buttonIndex];
if (currentQuest == QUEST_RANDOMIZER && (Randomizer_IsSeedGenerated() || Randomizer_IsPlandoLoaded())) {
if (currentQuest == QUEST_RANDOMIZER && (Randomizer_IsSeedGenerated() || Randomizer_IsSpoilerLoaded())) {
gSaveContext.questId = QUEST_RANDOMIZER;
Randomizer_InitSaveFile();

View file

@ -65,7 +65,11 @@ typedef enum {
CM_BOSS_RUSH_MENU,
CM_START_BOSS_RUSH_MENU,
CM_BOSS_RUSH_TO_QUEST,
CM_GENERATE_SEED,
CM_ROTATE_TO_RANDOMIZER_SETTINGS_MENU,
CM_RANDOMIZER_SETTINGS_MENU,
CM_START_RANDOMIZER_SETTINGS_MENU,
CM_RANDOMIZER_SETTINGS_MENU_TO_QUEST,
CM_NAME_ENTRY_TO_RANDOMIZER_SETTINGS_MENU,
} ConfigMode;
typedef enum {

View file

@ -17,6 +17,7 @@
#include "soh_assets.h"
#include "soh/Enhancements/game-interactor/GameInteractor.h"
#include "soh/Enhancements/boss-rush/BossRush.h"
#include "soh/Enhancements/FileSelectEnhancements.h"
#include "soh/Enhancements/custom-message/CustomMessageTypes.h"
#include "soh/Enhancements/enhancementTypes.h"
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
@ -984,17 +985,13 @@ void DrawSeedHashSprites(FileChooseContext* this) {
// 1. On Name Entry if a rando seed has been generated
// 2. On Quest Menu if a spoiler has been dropped and the Randomizer quest option is currently hovered.
if ((Randomizer_IsSeedGenerated() || Randomizer_IsSpoilerLoaded()) &&
((this->configMode == CM_NAME_ENTRY && gSaveContext.questId == QUEST_RANDOMIZER) ||
(this->configMode == CM_GENERATE_SEED && Randomizer_IsSpoilerLoaded()) ||
(this->configMode == CM_QUEST_MENU && this->questType[this->buttonIndex] == QUEST_RANDOMIZER))) {
// Fade top seed icons based on main menu fade and if save supports rando
u8 alpha =
MAX(this->optionButtonAlpha, Save_GetSaveMetaInfo(this->selectedFileIndex)->randoSave == 1 ? 0xFF : 0);
if (alpha >= 200) {
alpha = 0xFF;
}
(((this->configMode == CM_NAME_ENTRY || this->configMode == CM_ROTATE_TO_NAME_ENTRY ||
this->configMode == CM_NAME_ENTRY_TO_RANDOMIZER_SETTINGS_MENU || this->configMode == CM_START_NAME_ENTRY ||
this->configMode == CM_START_RANDOMIZER_SETTINGS_MENU) ||
this->configMode == CM_RANDOMIZER_SETTINGS_MENU) &&
gSaveContext.questId == QUEST_RANDOMIZER)) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0xFF, 0xFF, 0xFF, alpha);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF);
u16 xStart = 64;
for (unsigned int i = 0; i < 5; i++) {
SpriteLoad(this, GetSeedTexture(GetSeedIconIndex(i)));
@ -1243,12 +1240,25 @@ void FileChoose_StartBossRushMenu(GameState* thisx) {
this->bossRushUIAlpha = 0;
this->bossRushArrowOffset = 0;
if (this->logoAlpha >= 0) {
if (this->logoAlpha <= 0) {
this->logoAlpha = 0;
this->configMode = CM_BOSS_RUSH_MENU;
}
}
void FileChoose_StartRandomizerMenu(GameState* thisx) {
FileChooseContext* this = (FileChooseContext*)thisx;
this->logoAlpha -= 25;
this->randomizerUIAlpha = 0;
this->randomizerArrowOffset = 0;
if (this->logoAlpha <= 0) {
this->logoAlpha = 0;
this->configMode = CM_RANDOMIZER_SETTINGS_MENU;
}
}
void FileChoose_UpdateQuestMenu(GameState* thisx) {
static u8 emptyName[] = { 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E };
static u8 linkName[] = { 0x15, 0x2C, 0x31, 0x2E, 0x3E, 0x3E, 0x3E, 0x3E };
@ -1287,14 +1297,6 @@ void FileChoose_UpdateQuestMenu(GameState* thisx) {
GameInteractor_ExecuteOnUpdateFileQuestSelection(this->questType[this->buttonIndex]);
}
if (CHECK_BTN_ALL(input->press.button, BTN_L)) {
if (this->questType[this->buttonIndex] == QUEST_RANDOMIZER) {
Randomizer_SetSpoilerLoaded(false);
this->prevConfigMode = this->configMode;
this->configMode = CM_GENERATE_SEED;
}
}
if (CHECK_BTN_ALL(input->press.button, BTN_A)) {
gSaveContext.questId = this->questType[this->buttonIndex];
@ -1306,14 +1308,13 @@ void FileChoose_UpdateQuestMenu(GameState* thisx) {
} else if (this->questType[this->buttonIndex] == QUEST_RANDOMIZER) {
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_DECIDE_L, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
this->prevConfigMode = this->configMode;
this->configMode = CM_GENERATE_SEED;
this->configMode = CM_ROTATE_TO_RANDOMIZER_SETTINGS_MENU;
} else {
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_DECIDE_L, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
osSyncPrintf("Selected Dungeon Quest: %d\n", IS_MASTER_QUEST);
this->prevConfigMode = this->configMode;
this->configMode = CM_ROTATE_TO_NAME_ENTRY;
this->logoAlpha = 0;
CVarSetInteger(CVAR_GENERAL("OnFileSelectNameEntry"), 1);
this->kbdButton = FS_KBD_BTN_NONE;
this->charPage = FS_CHAR_PAGE_ENG;
this->kbdX = 0;
@ -1335,45 +1336,6 @@ void FileChoose_UpdateQuestMenu(GameState* thisx) {
}
}
void FileChoose_GenerateRandoSeed(GameState* thisx) {
FileChooseContext* this = (FileChooseContext*)thisx;
FileChoose_UpdateRandomizer();
if (Randomizer_IsSeedGenerated() || Randomizer_IsPlandoLoaded()) {
Audio_PlayFanfare(NA_BGM_HORSE_GOAL);
func_800F5E18(SEQ_PLAYER_BGM_MAIN, NA_BGM_FILE_SELECT, 0, 7, 1);
generating = 0;
retries = 0;
Randomizer_SetSpoilerLoaded(true);
static u8 emptyName[] = { 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E };
static u8 linkName[] = { 0x15, 0x2C, 0x31, 0x2E, 0x3E, 0x3E, 0x3E, 0x3E };
this->prevConfigMode = this->configMode;
this->configMode = CM_ROTATE_TO_NAME_ENTRY;
this->logoAlpha = 0;
CVarSetInteger(CVAR_GENERAL("OnFileSelectNameEntry"), 1);
this->kbdButton = FS_KBD_BTN_NONE;
this->charPage = FS_CHAR_PAGE_ENG;
this->kbdX = 0;
this->kbdY = 0;
this->charIndex = 0;
this->charBgAlpha = 0;
this->newFileNameCharCount = CVarGetInteger(CVAR_ENHANCEMENT("LinkDefaultName"), 0) ? 4 : 0;
this->nameEntryBoxPosX = 120;
this->nameEntryBoxAlpha = 0;
memcpy(Save_GetSaveMetaInfo(this->buttonIndex)->playerName,
CVarGetInteger(CVAR_ENHANCEMENT("LinkDefaultName"), 0) ? &linkName : &emptyName, 8);
return;
}
if (!generating) {
if (retries >= 5 || (retries >= 1 && Randomizer_IsSpoilerLoaded())){
this->configMode = CM_QUEST_MENU;
retries = 0;
} else {
Randomizer_GenerateSeed();
retries++;
}
}
}
static s8 sLastBossRushOptionIndex = -1;
static s8 sLastBossRushOptionValue = -1;
@ -1471,6 +1433,84 @@ void FileChoose_UpdateBossRushMenu(GameState* thisx) {
}
}
void FileChoose_UpdateRandomizerMenu(GameState* thisx) {
FileChoose_UpdateStickDirectionPromptAnim(thisx);
FileChooseContext* this = (FileChooseContext*)thisx;
Input* input = &this->state.input[0];
bool dpad = CVarGetInteger(CVAR_SETTING("DpadInText"), 0);
FileChoose_UpdateRandomizer();
if (generating) {
return;
}
// Fade in elements after opening Randomizer options menu
this->randomizerUIAlpha += 25;
if (this->randomizerUIAlpha > 255) {
this->randomizerUIAlpha = 255;
}
// Move menu selection up or down.
if (ABS(this->stickRelY) > 30 || (dpad && CHECK_BTN_ANY(input->press.button, BTN_DDOWN | BTN_DUP))) {
// Move down
if (this->stickRelY < -30 || (dpad && CHECK_BTN_ANY(input->press.button, BTN_DDOWN))) {
// When selecting past the last option, cycle back to the first option.
if ((this->randomizerIndex + 1) > RSM_OPEN_RANDOMIZER_SETTINGS) {
this->randomizerIndex = RSM_START_RANDOMIZER;
} else {
this->randomizerIndex++;
}
} else if (this->stickRelY > 30 || (dpad && CHECK_BTN_ANY(input->press.button, BTN_DUP))) {
// When selecting past the first option, cycle back to the last option and offset the list to view it properly.
if ((this->randomizerIndex - 1) < RSM_START_RANDOMIZER) {
this->randomizerIndex = RSM_OPEN_RANDOMIZER_SETTINGS;
} else {
this->randomizerIndex--;
}
}
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
}
if (CHECK_BTN_ALL(input->press.button, BTN_B)) {
this->configMode = CM_RANDOMIZER_SETTINGS_MENU_TO_QUEST;
return;
}
if (CHECK_BTN_ALL(input->press.button, BTN_A)) {
if (this->randomizerIndex == RSM_START_RANDOMIZER) {
if (Randomizer_IsSeedGenerated() || Randomizer_IsSpoilerLoaded()) {
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_DECIDE_L, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
static u8 emptyName[] = { 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E };
static u8 linkName[] = { 0x15, 0x2C, 0x31, 0x2E, 0x3E, 0x3E, 0x3E, 0x3E };
this->prevConfigMode = this->configMode;
this->configMode = CM_ROTATE_TO_NAME_ENTRY;
this->logoAlpha = 0;
CVarSetInteger(CVAR_GENERAL("OnFileSelectNameEntry"), 1);
this->kbdButton = FS_KBD_BTN_NONE;
this->charPage = FS_CHAR_PAGE_ENG;
this->kbdX = 0;
this->kbdY = 0;
this->charIndex = 0;
this->charBgAlpha = 0;
this->newFileNameCharCount = CVarGetInteger(CVAR_ENHANCEMENT("LinkDefaultName"), 0) ? 4 : 0;
this->nameEntryBoxPosX = 120;
this->nameEntryBoxAlpha = 0;
memcpy(Save_GetSaveMetaInfo(this->buttonIndex)->playerName,
CVarGetInteger(CVAR_ENHANCEMENT("LinkDefaultName"), 0) ? &linkName : &emptyName, 8);
} else {
Sfx_PlaySfxCentered(NA_SE_SY_OCARINA_ERROR);
}
} else if (this->randomizerIndex == RSM_GENERATE_RANDOMIZER) {
Randomizer_GenerateRandomizer();
} else if (this->randomizerIndex == RSM_OPEN_RANDOMIZER_SETTINGS) {
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_DECIDE_L, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
Randomizer_ShowRandomizerMenu();
}
}
}
/**
* Update function for `CM_UNUSED_31`
*/
@ -1503,9 +1543,16 @@ void FileChoose_RotateToNameEntry(GameState* thisx) {
this->windowRot += VREG(16);
if (this->windowRot >= 628.0f) {
this->windowRot = 628.0f;
this->configMode = CM_START_NAME_ENTRY;
if (this->prevConfigMode == CM_RANDOMIZER_SETTINGS_MENU) {
if (this->windowRot >= 942.0f) {
this->windowRot = 628.0f;
this->configMode = CM_START_NAME_ENTRY;
}
} else {
if (this->windowRot >= 628.0f) {
this->windowRot = 628.0f;
this->configMode = CM_START_NAME_ENTRY;
}
}
}
@ -1552,7 +1599,8 @@ void FileChoose_RotateToMain(GameState* thisx) {
void FileChoose_RotateToQuest(GameState* thisx) {
FileChooseContext* this = (FileChooseContext*)thisx;
if (this->configMode == CM_NAME_ENTRY_TO_QUEST_MENU || this->configMode == CM_BOSS_RUSH_TO_QUEST) {
if (this->configMode == CM_NAME_ENTRY_TO_QUEST_MENU || this->configMode == CM_BOSS_RUSH_TO_QUEST ||
this->configMode == CM_RANDOMIZER_SETTINGS_MENU_TO_QUEST) {
this->windowRot -= VREG(16);
if (this->windowRot <= 314.0f) {
@ -1580,6 +1628,26 @@ void FileChoose_RotateToBossRush(GameState* thisx) {
}
}
void FileChoose_RotateToRandomizer(GameState* thisx) {
FileChooseContext* this = (FileChooseContext*)thisx;
if (this->configMode == CM_NAME_ENTRY_TO_RANDOMIZER_SETTINGS_MENU) {
this->windowRot -= VREG(16);
if (this->windowRot <= 314.0f) {
this->windowRot = 628.0f;
this->configMode = CM_START_RANDOMIZER_SETTINGS_MENU;
}
} else {
this->windowRot += VREG(16);
if (this->windowRot >= 628.0f) {
this->windowRot = 628.0f;
this->configMode = CM_START_RANDOMIZER_SETTINGS_MENU;
}
}
}
static void (*gConfigModeUpdateFuncs[])(GameState*) = {
FileChoose_StartFadeIn, FileChoose_FinishFadeIn,
FileChoose_UpdateMainMenu, FileChoose_SetupCopySource,
@ -1606,7 +1674,9 @@ static void (*gConfigModeUpdateFuncs[])(GameState*) = {
FileChoose_RotateToMain, FileChoose_RotateToQuest,
FileChoose_RotateToBossRush, FileChoose_UpdateBossRushMenu,
FileChoose_StartBossRushMenu, FileChoose_RotateToQuest,
FileChoose_GenerateRandoSeed,
FileChoose_RotateToRandomizer, FileChoose_UpdateRandomizerMenu,
FileChoose_StartRandomizerMenu,FileChoose_RotateToQuest,
FileChoose_RotateToRandomizer
};
/**
@ -2173,7 +2243,7 @@ const char* FileChoose_GetQuestChooseTitleTexName(Language lang) {
}
}
const char* FileChoose_GetBossRushOptionsTitleTexName(Language lang) {
const char* FileChoose_GetSohOptionsTitleTexName(Language lang) {
switch (lang) {
case LANGUAGE_ENG:
default:
@ -2199,20 +2269,24 @@ void FileChoose_DrawWindowContents(GameState* thisx) {
s16 pad;
char* tex;
switch (this->configMode) {
switch (this->configMode) {
case CM_QUEST_MENU:
case CM_ROTATE_TO_NAME_ENTRY:
case CM_START_QUEST_MENU:
case CM_QUEST_TO_MAIN:
case CM_NAME_ENTRY_TO_QUEST_MENU:
case CM_ROTATE_TO_BOSS_RUSH_MENU:
case CM_GENERATE_SEED:
case CM_ROTATE_TO_RANDOMIZER_SETTINGS_MENU:
tex = FileChoose_GetQuestChooseTitleTexName(gSaveContext.language);
break;
case CM_BOSS_RUSH_MENU:
case CM_START_BOSS_RUSH_MENU:
case CM_BOSS_RUSH_TO_QUEST:
tex = FileChoose_GetBossRushOptionsTitleTexName(gSaveContext.language);
case CM_RANDOMIZER_SETTINGS_MENU:
case CM_START_RANDOMIZER_SETTINGS_MENU:
case CM_RANDOMIZER_SETTINGS_MENU_TO_QUEST:
case CM_NAME_ENTRY_TO_RANDOMIZER_SETTINGS_MENU:
tex = FileChoose_GetSohOptionsTitleTexName(gSaveContext.language);
break;
default:
tex = sTitleLabels[gSaveContext.language][this->titleLabel];
@ -2236,34 +2310,32 @@ void FileChoose_DrawWindowContents(GameState* thisx) {
// draw next title label
if ((this->configMode == CM_QUEST_MENU) || (this->configMode == CM_START_QUEST_MENU) ||
this->configMode == CM_NAME_ENTRY_TO_QUEST_MENU || this->configMode == CM_GENERATE_SEED) {
this->configMode == CM_NAME_ENTRY_TO_QUEST_MENU || this->configMode == CM_NAME_ENTRY_TO_RANDOMIZER_SETTINGS_MENU) {
// draw control stick prompts.
if (this->configMode != CM_GENERATE_SEED) {
Gfx_SetupDL_39Opa(this->state.gfxCtx);
gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
gDPLoadTextureBlock(POLY_OPA_DISP++, gArrowCursorTex, G_IM_FMT_IA, G_IM_SIZ_8b, 16, 24, 0,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, 4, G_TX_NOMASK, G_TX_NOLOD,
G_TX_NOLOD);
FileChoose_DrawTextRec(this->state.gfxCtx, this->stickLeftPrompt.arrowColorR,
this->stickLeftPrompt.arrowColorG, this->stickLeftPrompt.arrowColorB,
this->stickLeftPrompt.arrowColorA, this->stickLeftPrompt.arrowTexX,
this->stickLeftPrompt.arrowTexY, this->stickLeftPrompt.z, 0, 0, -1.0f, 1.0f);
FileChoose_DrawTextRec(this->state.gfxCtx, this->stickRightPrompt.arrowColorR,
this->stickRightPrompt.arrowColorG, this->stickRightPrompt.arrowColorB,
this->stickRightPrompt.arrowColorA, this->stickRightPrompt.arrowTexX,
this->stickRightPrompt.arrowTexY, this->stickRightPrompt.z, 0, 0, 1.0f, 1.0f);
gDPLoadTextureBlock(POLY_OPA_DISP++, gControlStickTex, G_IM_FMT_IA, G_IM_SIZ_8b, 16, 16, 0,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, 4, G_TX_NOMASK, G_TX_NOLOD,
G_TX_NOLOD);
FileChoose_DrawTextRec(this->state.gfxCtx, this->stickLeftPrompt.stickColorR,
this->stickLeftPrompt.stickColorG, this->stickLeftPrompt.stickColorB,
this->stickLeftPrompt.stickColorA, this->stickLeftPrompt.stickTexX,
this->stickLeftPrompt.stickTexY, this->stickLeftPrompt.z, 0, 0, -1.0f, 1.0f);
FileChoose_DrawTextRec(this->state.gfxCtx, this->stickRightPrompt.stickColorR,
this->stickRightPrompt.stickColorG, this->stickRightPrompt.stickColorB,
this->stickRightPrompt.stickColorA, this->stickRightPrompt.stickTexX,
this->stickRightPrompt.stickTexY, this->stickRightPrompt.z, 0, 0, 1.0f, 1.0f);
}
Gfx_SetupDL_39Opa(this->state.gfxCtx);
gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
gDPLoadTextureBlock(POLY_OPA_DISP++, gArrowCursorTex, G_IM_FMT_IA, G_IM_SIZ_8b, 16, 24, 0,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, 4, G_TX_NOMASK, G_TX_NOLOD,
G_TX_NOLOD);
FileChoose_DrawTextRec(this->state.gfxCtx, this->stickLeftPrompt.arrowColorR,
this->stickLeftPrompt.arrowColorG, this->stickLeftPrompt.arrowColorB,
this->stickLeftPrompt.arrowColorA, this->stickLeftPrompt.arrowTexX,
this->stickLeftPrompt.arrowTexY, this->stickLeftPrompt.z, 0, 0, -1.0f, 1.0f);
FileChoose_DrawTextRec(this->state.gfxCtx, this->stickRightPrompt.arrowColorR,
this->stickRightPrompt.arrowColorG, this->stickRightPrompt.arrowColorB,
this->stickRightPrompt.arrowColorA, this->stickRightPrompt.arrowTexX,
this->stickRightPrompt.arrowTexY, this->stickRightPrompt.z, 0, 0, 1.0f, 1.0f);
gDPLoadTextureBlock(POLY_OPA_DISP++, gControlStickTex, G_IM_FMT_IA, G_IM_SIZ_8b, 16, 16, 0,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, 4, G_TX_NOMASK, G_TX_NOLOD,
G_TX_NOLOD);
FileChoose_DrawTextRec(this->state.gfxCtx, this->stickLeftPrompt.stickColorR,
this->stickLeftPrompt.stickColorG, this->stickLeftPrompt.stickColorB,
this->stickLeftPrompt.stickColorA, this->stickLeftPrompt.stickTexX,
this->stickLeftPrompt.stickTexY, this->stickLeftPrompt.z, 0, 0, -1.0f, 1.0f);
FileChoose_DrawTextRec(this->state.gfxCtx, this->stickRightPrompt.stickColorR,
this->stickRightPrompt.stickColorG, this->stickRightPrompt.stickColorB,
this->stickRightPrompt.stickColorA, this->stickRightPrompt.stickTexX,
this->stickRightPrompt.stickTexY, this->stickRightPrompt.z, 0, 0, 1.0f, 1.0f);
switch (this->questType[this->buttonIndex]) {
case QUEST_NORMAL:
default:
@ -2282,11 +2354,7 @@ void FileChoose_DrawWindowContents(GameState* thisx) {
break;
case QUEST_RANDOMIZER:
if (this->configMode == CM_GENERATE_SEED) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, this->logoAlpha / 2);
} else {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, this->logoAlpha);
}
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, this->logoAlpha);
FileChoose_DrawTextureI8(this->state.gfxCtx, gTitleTheLegendOfTextTex, 72, 8, 156, 108, 72, 8, 1024, 1024);
FileChoose_DrawTextureI8(this->state.gfxCtx, gTitleOcarinaOfTimeTMTextTex, 96, 8, 154, 163, 96, 8, 1024, 1024);
FileChoose_DrawImageRGBA32(this->state.gfxCtx, 160, 135, ResourceMgr_GameHasOriginal() ? gTitleZeldaShieldLogoTex : gTitleZeldaShieldLogoMQTex, 160, 160);
@ -2360,9 +2428,57 @@ void FileChoose_DrawWindowContents(GameState* thisx) {
(92 + textYOffset), 0.42f, 0, 0, 1.0f, 1.0f);
}
}
} else if (this->configMode == CM_RANDOMIZER_SETTINGS_MENU) {
uint8_t textAlpha = this->randomizerUIAlpha;
for (uint8_t index = 0; index <= RSM_OPEN_RANDOMIZER_SETTINGS; index++) {
uint8_t textColorR = 255;
uint8_t textColorG = 255;
uint8_t textColorB = 255;
// If current index is the selected one, make the text yellow.
if (this->randomizerIndex == index) {
textColorB = 80;
}
// If no randomizer is loaded and text is "start randomizer" or when a seed is generating, make all options gray.
if ((index == RSM_START_RANDOMIZER && !Randomizer_IsSeedGenerated() && !Randomizer_IsSpoilerLoaded()) || generating) {
textColorR = textColorG = textColorB = 100;
}
Interface_DrawTextLine(this->state.gfxCtx, SohFileSelect_GetSettingText(index, gSaveContext.language), 70,
(80 + (index * 16)), textColorR, textColorG, textColorB, textAlpha, 0.8f, true);
}
// Show text to indicate randomizer is being generated.
if (generating) {
Interface_DrawTextLine(this->state.gfxCtx,
SohFileSelect_GetSettingText(RSM_GENERATING, gSaveContext.language), 70,
(80 + 64), 255, 255, 255, textAlpha, 0.8f, true);
}
// If no randomizer is generated and "start randomizer" is selected, show text to explain why user can't start the randomizer.
if (!Randomizer_IsSeedGenerated() && !Randomizer_IsSpoilerLoaded() && this->randomizerIndex == RSM_START_RANDOMIZER) {
Interface_DrawTextLine(this->state.gfxCtx,
SohFileSelect_GetSettingText(RSM_NO_RANDOMIZER_GENERATED, gSaveContext.language), 70,
(80 + 64),
240, 80, 80, textAlpha, 0.8f, true);
}
uint16_t textOffset = 16 * this->randomizerIndex;
Gfx_SetupDL_39Opa(this->state.gfxCtx);
gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
gDPLoadTextureBlock(POLY_OPA_DISP++, gArrowCursorTex, G_IM_FMT_IA, G_IM_SIZ_8b, 16, 24, 0,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, 4, G_TX_NOMASK, G_TX_NOLOD,
G_TX_NOLOD);
FileChoose_DrawTextRec(this->state.gfxCtx, this->stickRightPrompt.arrowColorR,
this->stickRightPrompt.arrowColorG, this->stickRightPrompt.arrowColorB, textAlpha,
62, (85 + textOffset), 0.42f, 0, 0, 1.0f, 1.0f);
} else if (this->configMode != CM_ROTATE_TO_NAME_ENTRY && this->configMode != CM_START_BOSS_RUSH_MENU &&
this->configMode != CM_ROTATE_TO_BOSS_RUSH_MENU && this->configMode != CM_BOSS_RUSH_TO_QUEST) {
this->configMode != CM_ROTATE_TO_BOSS_RUSH_MENU && this->configMode != CM_BOSS_RUSH_TO_QUEST &&
this->configMode != CM_START_RANDOMIZER_SETTINGS_MENU && this->configMode != CM_ROTATE_TO_RANDOMIZER_SETTINGS_MENU &&
this->configMode != CM_RANDOMIZER_SETTINGS_MENU_TO_QUEST && this->configMode != CM_NAME_ENTRY_TO_RANDOMIZER_SETTINGS_MENU) {
gDPPipeSync(POLY_OPA_DISP++);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, this->titleAlpha[1]);
gDPLoadTextureBlock(POLY_OPA_DISP++, sTitleLabels[gSaveContext.language][this->nextTitleLabel], G_IM_FMT_IA,
@ -2608,8 +2724,9 @@ void FileChoose_ConfigModeDraw(GameState* thisx) {
FrameInterpolation_RecordOpenChild(this, this->configMode);
if ((this->configMode != CM_NAME_ENTRY) && (this->configMode != CM_START_NAME_ENTRY) &&
(this->configMode != CM_QUEST_MENU) && this->configMode != CM_NAME_ENTRY_TO_QUEST_MENU) {
if (this->configMode != CM_NAME_ENTRY && this->configMode != CM_START_NAME_ENTRY &&
this->configMode != CM_QUEST_MENU && this->configMode != CM_NAME_ENTRY_TO_QUEST_MENU &&
this->configMode != CM_RANDOMIZER_SETTINGS_MENU && this->configMode != CM_NAME_ENTRY_TO_RANDOMIZER_SETTINGS_MENU) {
gDPPipeSync(POLY_OPA_DISP++);
gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2],
@ -2620,9 +2737,8 @@ void FileChoose_ConfigModeDraw(GameState* thisx) {
Matrix_Scale(0.78f, 0.78f, 0.78f, MTXMODE_APPLY);
if (this->windowRot != 0) {
if (this->configMode == CM_ROTATE_TO_QUEST_MENU ||
(this->configMode >= CM_MAIN_TO_OPTIONS && this->configMode <= CM_OPTIONS_TO_MAIN) ||
this->configMode == CM_QUEST_TO_MAIN) {
if ((this->configMode >= CM_MAIN_TO_OPTIONS && this->configMode <= CM_OPTIONS_TO_MAIN) ||
this->configMode == CM_ROTATE_TO_QUEST_MENU || this->configMode == CM_QUEST_TO_MAIN) {
Matrix_RotateX(this->windowRot / 100.0f, MTXMODE_APPLY);
} else {
Matrix_RotateX((this->windowRot - 942.0f) / 100.0f, MTXMODE_APPLY);
@ -2656,7 +2772,13 @@ void FileChoose_ConfigModeDraw(GameState* thisx) {
Matrix_Translate(0.0f, 0.0f, -93.6f, MTXMODE_NEW);
Matrix_Scale(0.78f, 0.78f, 0.78f, MTXMODE_APPLY);
Matrix_RotateX((this->windowRot - 628.0f) / 100.0f, MTXMODE_APPLY);
// Invert name select when switching from randomizer settings menu to name entry, otherwise
// it'll show on the backside while rotating to the menu.
if (this->configMode == CM_ROTATE_TO_NAME_ENTRY && this->prevConfigMode == CM_RANDOMIZER_SETTINGS_MENU) {
Matrix_RotateX((this->windowRot - 314.0f) / 100.0f, MTXMODE_APPLY);
} else {
Matrix_RotateX((this->windowRot - 628.0f) / 100.0f, MTXMODE_APPLY);
}
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(this->state.gfxCtx),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
@ -2704,10 +2826,10 @@ void FileChoose_ConfigModeDraw(GameState* thisx) {
}
// draw quest menu
if ((this->configMode == CM_QUEST_MENU) || (this->configMode == CM_ROTATE_TO_QUEST_MENU) ||
(this->configMode == CM_ROTATE_TO_NAME_ENTRY) || this->configMode == CM_QUEST_TO_MAIN ||
if (this->configMode == CM_QUEST_MENU || (this->configMode == CM_ROTATE_TO_QUEST_MENU) ||
this->configMode == CM_ROTATE_TO_NAME_ENTRY || this->configMode == CM_QUEST_TO_MAIN ||
this->configMode == CM_NAME_ENTRY_TO_QUEST_MENU || this->configMode == CM_ROTATE_TO_BOSS_RUSH_MENU ||
this->configMode == CM_GENERATE_SEED) {
this->configMode == CM_ROTATE_TO_RANDOMIZER_SETTINGS_MENU || this->configMode == CM_NAME_ENTRY_TO_RANDOMIZER_SETTINGS_MENU) {
// window
gDPPipeSync(POLY_OPA_DISP++);
gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
@ -2736,9 +2858,11 @@ void FileChoose_ConfigModeDraw(GameState* thisx) {
FileChoose_DrawWindowContents(&this->state);
}
// Draw Boss Rush Options Menu
// Draw Boss Rush / Randomizer Options Menu
if (this->configMode == CM_BOSS_RUSH_MENU || this->configMode == CM_ROTATE_TO_BOSS_RUSH_MENU ||
this->configMode == CM_START_BOSS_RUSH_MENU || this->configMode == CM_BOSS_RUSH_TO_QUEST) {
this->configMode == CM_START_BOSS_RUSH_MENU || this->configMode == CM_BOSS_RUSH_TO_QUEST ||
this->configMode == CM_RANDOMIZER_SETTINGS_MENU || this->configMode == CM_ROTATE_TO_RANDOMIZER_SETTINGS_MENU ||
this->configMode == CM_START_RANDOMIZER_SETTINGS_MENU || this->configMode == CM_RANDOMIZER_SETTINGS_MENU_TO_QUEST) {
// window
gDPPipeSync(POLY_OPA_DISP++);
gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
@ -3120,8 +3244,6 @@ void FileChoose_SelectModeDraw(GameState* thisx) {
gDPPipeSync(POLY_OPA_DISP++);
FileChoose_SetView(this, 0.0f, 0.0f, 64.0f);
DrawSeedHashSprites(this);
CLOSE_DISPS(this->state.gfxCtx);
}
@ -3191,77 +3313,6 @@ void FileChoose_DrawRandoSaveVersionWarning(GameState* thisx) {
CLOSE_DISPS(this->state.gfxCtx);
}
static const char* noRandoGeneratedText[] = {
// English
"No Randomizer seed currently available.\nGenerate one in the Randomizer Settings"
#if defined(__WIIU__) || defined(__SWITCH__)
".",
#else
",\nor drop a spoiler log on the game window.",
#endif
// German
"No Randomizer seed currently available.\nGenerate one in the Randomizer Settings"
#if defined(__WIIU__) || defined(__SWITCH__)
".",
#else
",\nor drop a spoiler log on the game window.",
#endif
// French
"Aucune Seed de Randomizer actuellement disponible.\nGénérez-en une dans les \"Randomizer Settings\""
#if (defined(__WIIU__) || defined(__SWITCH__))
"."
#else
"\nou glissez un spoilerlog sur la fenêtre du jeu."
#endif
};
void FileChoose_DrawNoRandoGeneratedWarning(GameState* thisx) {
FileChooseContext* this = (FileChooseContext*)thisx;
OPEN_DISPS(this->state.gfxCtx);
// Draw rando seed warning when build version doesn't match for Major or Minor number
if (this->configMode == CM_QUEST_MENU && this->questType[this->buttonIndex] == QUEST_RANDOMIZER && !(Randomizer_IsSeedGenerated() || Randomizer_IsSpoilerLoaded())) {
uint8_t textAlpha = 225;
uint8_t textboxAlpha = 170;
float textboxScale = 0.7f;
// float math to get a S5.10 number that will squish the texture
float texCoordinateHeightF = 512 / textboxScale;
uint16_t texCoordinateHeightScale = texCoordinateHeightF + 0.5f;
float texCoordinateWidthF = 512 / textboxScale;
uint16_t texCoordinateWidthScale = texCoordinateWidthF + 0.5f;
uint16_t textboxWidth = 256 * textboxScale;
uint16_t textboxHeight = 64 * textboxScale;
uint8_t leftOffset = 72;
uint8_t bottomOffset = 84;
uint8_t textVerticalOffset;
#if defined(__WIIU__) || defined(__SWITCH__)
textVerticalOffset = 127; // 2 lines
#else
textVerticalOffset = 122; // 3 lines
#endif
Gfx_SetupDL_39Opa(this->state.gfxCtx);
gDPSetAlphaDither(POLY_OPA_DISP++, G_AD_DISABLE);
gSPClearGeometryMode(POLY_OPA_DISP++, G_SHADE);
gDPSetCombineLERP(POLY_OPA_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0,
0, PRIMITIVE, 0);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, textboxAlpha);
gDPLoadTextureBlock_4b(POLY_OPA_DISP++, gDefaultMessageBackgroundTex, G_IM_FMT_I, 128, 64, 0, G_TX_MIRROR,
G_TX_MIRROR, 7, 0, G_TX_NOLOD, G_TX_NOLOD);
gSPTextureRectangle(POLY_OPA_DISP++, leftOffset << 2, (SCREEN_HEIGHT - bottomOffset - textboxHeight) << 2,
(textboxWidth + leftOffset) << 2, (SCREEN_HEIGHT - bottomOffset) << 2, G_TX_RENDERTILE, 0, 0,
texCoordinateWidthScale << 1, texCoordinateHeightScale << 1);
Interface_DrawTextLine(this->state.gfxCtx, noRandoGeneratedText[gSaveContext.language], 80, textVerticalOffset,
255, 255, 255, textAlpha, 0.6f, 1);
}
CLOSE_DISPS(this->state.gfxCtx);
}
void FileChoose_Main(GameState* thisx) {
static void* controlsTextures[] = {
gFileSelControlsENGTex,
@ -3456,8 +3507,6 @@ void FileChoose_Main(GameState* thisx) {
// Draw rando save version warning over the controls text, but before the screen fill fade out
FileChoose_DrawRandoSaveVersionWarning(&this->state);
FileChoose_DrawNoRandoGeneratedWarning(&this->state);
gDPPipeSync(POLY_OPA_DISP++);
gSPDisplayList(POLY_OPA_DISP++, sScreenFillSetupDL);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, sScreenFillAlpha);
@ -3629,6 +3678,7 @@ void FileChoose_InitContext(GameState* thisx) {
this->bossRushIndex = 0;
this->bossRushOffset = 0;
this->randomizerIndex = 0;
ShrinkWindow_SetVal(0);

View file

@ -376,9 +376,10 @@ void FileChoose_DrawNameEntry(GameState* thisx) {
if (this->newFileNameCharCount < 0) {
this->newFileNameCharCount = 0;
if (this->prevConfigMode == CM_QUEST_MENU || this->prevConfigMode == CM_GENERATE_SEED) {
if (this->prevConfigMode == CM_QUEST_MENU) {
this->configMode = CM_NAME_ENTRY_TO_QUEST_MENU;
Randomizer_SetSeedGenerated(false);
} else if (this->prevConfigMode == CM_RANDOMIZER_SETTINGS_MENU) {
this->configMode = CM_NAME_ENTRY_TO_RANDOMIZER_SETTINGS_MENU;
} else {
this->configMode = CM_NAME_ENTRY_TO_MAIN;
}
@ -460,7 +461,6 @@ void FileChoose_DrawNameEntry(GameState* thisx) {
this->prevConfigMode = CM_MAIN_MENU;
this->configMode = CM_NAME_ENTRY_TO_MAIN;
CVarSetInteger(CVAR_GENERAL("OnFileSelectNameEntry"), 0);
Randomizer_SetSeedGenerated(false);
this->nameBoxAlpha[this->buttonIndex] = this->nameAlpha[this->buttonIndex] = 200;
this->connectorAlpha[this->buttonIndex] = 255;
func_800AA000(300.0f, 0xB4, 0x14, 0x64);