diff --git a/OTRExporter/assets/objects/object_mag/gTitleRandomizerSubtitleTex.rgba32.png b/OTRExporter/assets/objects/object_mag/gTitleRandomizerSubtitleTex.rgba32.png new file mode 100644 index 000000000..a61a058a8 Binary files /dev/null and b/OTRExporter/assets/objects/object_mag/gTitleRandomizerSubtitleTex.rgba32.png differ diff --git a/OTRExporter/assets/textures/title_static/gFileSelPleaseChooseAQuestENGTex.ia8.png b/OTRExporter/assets/textures/title_static/gFileSelPleaseChooseAQuestENGTex.ia8.png new file mode 100644 index 000000000..02ca600c2 Binary files /dev/null and b/OTRExporter/assets/textures/title_static/gFileSelPleaseChooseAQuestENGTex.ia8.png differ diff --git a/OTRExporter/assets/textures/title_static/gFileSelPleaseChooseAQuestFRATex.ia8.png b/OTRExporter/assets/textures/title_static/gFileSelPleaseChooseAQuestFRATex.ia8.png new file mode 100644 index 000000000..8bc17292b Binary files /dev/null and b/OTRExporter/assets/textures/title_static/gFileSelPleaseChooseAQuestFRATex.ia8.png differ diff --git a/OTRExporter/assets/textures/title_static/gFileSelPleaseChooseAQuestGERTex.ia8.png b/OTRExporter/assets/textures/title_static/gFileSelPleaseChooseAQuestGERTex.ia8.png new file mode 100644 index 000000000..25f96cc2b Binary files /dev/null and b/OTRExporter/assets/textures/title_static/gFileSelPleaseChooseAQuestGERTex.ia8.png differ diff --git a/soh/include/z64.h b/soh/include/z64.h index 274a293df..dada44b48 100644 --- a/soh/include/z64.h +++ b/soh/include/z64.h @@ -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 { diff --git a/soh/soh/Enhancements/bootcommands.c b/soh/soh/Enhancements/bootcommands.c index ff956105a..ebdda902e 100644 --- a/soh/soh/Enhancements/bootcommands.c +++ b/soh/soh/Enhancements/bootcommands.c @@ -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 diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index eddd4cfb7..98e87178f 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -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)) { diff --git a/soh/soh/GameMenuBar.cpp b/soh/soh/GameMenuBar.cpp index 1c04ba69c..9e9301df9 100644 --- a/soh/soh/GameMenuBar.cpp +++ b/soh/soh/GameMenuBar.cpp @@ -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); diff --git a/soh/soh/SaveManager.cpp b/soh/soh/SaveManager.cpp index a9a7ba66b..f8ca5bfb4 100644 --- a/soh/soh/SaveManager.cpp +++ b/soh/soh/SaveManager.cpp @@ -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) } diff --git a/soh/src/code/z_sram.c b/soh/src/code/z_sram.c index fed23dcf3..61e8fecbb 100644 --- a/soh/src/code/z_sram.c +++ b/soh/src/code/z_sram.c @@ -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 diff --git a/soh/src/overlays/actors/ovl_En_Ossan/z_en_ossan.h b/soh/src/overlays/actors/ovl_En_Ossan/z_en_ossan.h index 1dddce504..dfc7ac97f 100644 --- a/soh/src/overlays/actors/ovl_En_Ossan/z_en_ossan.h +++ b/soh/src/overlays/actors/ovl_En_Ossan/z_en_ossan.h @@ -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 { diff --git a/soh/src/overlays/gamestates/ovl_file_choose/file_choose.h b/soh/src/overlays/gamestates/ovl_file_choose/file_choose.h index 93f4efb76..0abf7583a 100644 --- a/soh/src/overlays/gamestates/ovl_file_choose/file_choose.h +++ b/soh/src/overlays/gamestates/ovl_file_choose/file_choose.h @@ -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 { diff --git a/soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c b/soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c index e816670a5..4b1dec055 100644 --- a/soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c +++ b/soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c @@ -7,6 +7,180 @@ #include #include "soh/frame_interpolation.h" #include +#include "objects/object_mag/object_mag.h" +#include "objects/gameplay_keep/gameplay_keep.h" + +#define NORMAL_QUEST 0 +#define MASTER_QUEST 1 +#define RANDOMIZER_QUEST 2 +#define MIN_QUEST (ResourceMgr_GameHasOriginal() ? NORMAL_QUEST : MASTER_QUEST) +u8 getMaxQuest() { + if ((strnlen(CVar_GetString("gSpoilerLog", ""), 1) != 0)) { + return RANDOMIZER_QUEST; + } + + if (ResourceMgr_GameHasMasterQuest()) { + return MASTER_QUEST; + } + + return NORMAL_QUEST; +} +#define MAX_QUEST getMaxQuest() + +void FileChoose_DrawTextureI8(GraphicsContext* gfxCtx, const void* texture, s16 texWidth, s16 texHeight, s16 rectLeft, s16 rectTop, + s16 rectWidth, s16 rectHeight, u16 dsdx, u16 dtdy) { + OPEN_DISPS(gfxCtx); + gDPLoadTextureBlock(POLY_OPA_DISP++, texture, G_IM_FMT_I, G_IM_SIZ_8b, texWidth, texHeight, 0, G_TX_NOMIRROR | G_TX_WRAP, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); + + gSPTextureRectangle(POLY_OPA_DISP++, rectLeft << 2, rectTop << 2, (rectLeft + rectWidth) << 2, (rectTop + rectHeight) << 2, + G_TX_RENDERTILE, 0, 0, dsdx, dtdy); + + CLOSE_DISPS(gfxCtx); +} + +void FileChoose_DrawRawImageRGBA32(GraphicsContext* gfxCtx, s16 centerX, s16 centerY, const char* source, u32 width, u32 height) { + u8* curTexture; + s32 textureCount; + u32 rectLeft; + u32 rectTop; + u32 textureHeight; + s32 remainingSize; + s32 textureSize; + s32 pad; + s32 i; + + OPEN_DISPS(gfxCtx); + + source = ResourceMgr_LoadFileRaw(source); + + curTexture = source; + rectLeft = centerX - (width / 2); + rectTop = centerY - (height / 2); + textureHeight = 4096 / (width << 2); + remainingSize = (width * height) << 2; + textureSize = (width * textureHeight) << 2; + textureCount = remainingSize / textureSize; + if ((remainingSize % textureSize) != 0) { + textureCount += 1; + } + + gDPSetTileCustom(POLY_OPA_DISP++, G_IM_FMT_RGBA, G_IM_SIZ_32b, width, textureHeight, 0, G_TX_NOMIRROR | G_TX_CLAMP, + G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); + + remainingSize -= textureSize; + + for (i = 0; i < textureCount; i++) { + gDPSetTextureImage(POLY_OPA_DISP++, G_IM_FMT_RGBA, G_IM_SIZ_32b, width, curTexture); + + gDPLoadSync(POLY_OPA_DISP++); + gDPLoadTile(POLY_OPA_DISP++, G_TX_LOADTILE, 0, 0, (width - 1) << 2, (textureHeight - 1) << 2); + + gSPTextureRectangle(POLY_OPA_DISP++, rectLeft << 2, rectTop << 2, (rectLeft + (s32)width) << 2, + (rectTop + textureHeight) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); + + curTexture += textureSize; + rectTop += textureHeight; + + if ((remainingSize - textureSize) < 0) { + if (remainingSize > 0) { + textureHeight = remainingSize / (s32)(width << 2); + remainingSize -= textureSize; + + gDPSetTileCustom(POLY_OPA_DISP++, G_IM_FMT_RGBA, G_IM_SIZ_32b, width, textureHeight, 0, + G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, + G_TX_NOLOD, G_TX_NOLOD); + } + } else { + remainingSize -= textureSize; + } + } + CLOSE_DISPS(gfxCtx); +} + +void FileChoose_DrawImageRGBA32(GraphicsContext* gfxCtx, s16 centerX, s16 centerY, const char* source, u32 width, u32 height) { + u8* curTexture; + s32 textureCount; + u32 rectLeft; + u32 rectTop; + u32 textureHeight; + s32 remainingSize; + s32 textureSize; + s32 pad; + s32 i; + + OPEN_DISPS(gfxCtx); + + source = ResourceMgr_LoadTexByName(source); + + curTexture = source; + rectLeft = centerX - (width / 2); + rectTop = centerY - (height / 2); + textureHeight = 4096 / (width << 2); + remainingSize = (width * height) << 2; + textureSize = (width * textureHeight) << 2; + textureCount = remainingSize / textureSize; + if ((remainingSize % textureSize) != 0) { + textureCount += 1; + } + + gDPSetTileCustom(POLY_OPA_DISP++, G_IM_FMT_RGBA, G_IM_SIZ_32b, width, textureHeight, 0, G_TX_NOMIRROR | G_TX_CLAMP, + G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); + + remainingSize -= textureSize; + + for (i = 0; i < textureCount; i++) { + gDPSetTextureImage(POLY_OPA_DISP++, G_IM_FMT_RGBA, G_IM_SIZ_32b, width, curTexture); + + gDPLoadSync(POLY_OPA_DISP++); + gDPLoadTile(POLY_OPA_DISP++, G_TX_LOADTILE, 0, 0, (width - 1) << 2, (textureHeight - 1) << 2); + + gSPTextureRectangle(POLY_OPA_DISP++, rectLeft << 2, rectTop << 2, (rectLeft + (s32)width) << 2, + (rectTop + textureHeight) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); + + curTexture += textureSize; + rectTop += textureHeight; + + if ((remainingSize - textureSize) < 0) { + if (remainingSize > 0) { + textureHeight = remainingSize / (s32)(width << 2); + remainingSize -= textureSize; + + gDPSetTileCustom(POLY_OPA_DISP++, G_IM_FMT_RGBA, G_IM_SIZ_32b, width, textureHeight, 0, + G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, + G_TX_NOLOD, G_TX_NOLOD); + } + } else { + remainingSize -= textureSize; + } + } + CLOSE_DISPS(gfxCtx); +} + +void FileChoose_DrawTextRec(GraphicsContext* gfxCtx, s32 r, s32 g, s32 b, s32 a, f32 x, f32 y, f32 z, s32 s, s32 t, + f32 dx, f32 dy) { + f32 unk; + s32 ulx, uly, lrx, lry; + f32 w, h; + s32 dsdx, dtdy; + + OPEN_DISPS(gfxCtx); + gDPPipeSync(POLY_OPA_DISP++); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, r, g, b, a); + + w = 8.0f * z; + h = 12.0f * z; + unk = (1.0f / z) * 1024; + dsdx = unk * dx; + dtdy = dy * unk; + + ulx = (x - w) * 4.0f; + uly = (y - h) * 4.0f; + lrx = (x + w) * 4.0f; + lry = (y + h) * 4.0f; + gSPTextureRectangle(POLY_OPA_DISP++, ulx, uly, lrx, lry, G_TX_RENDERTILE, s, t, dsdx, dtdy); + CLOSE_DISPS(gfxCtx); +} static s16 sUnused = 106; @@ -212,7 +386,7 @@ void DrawSeedHashSprites(FileChooseContext* this) { gDPPipeSync(POLY_OPA_DISP++); gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); - if (this->windowRot == 0) { + if (this->windowRot == 0 || (this->configMode == CM_QUEST_MENU && this->questType[this->buttonIndex] == RANDOMIZER_QUEST)) { if (this->selectMode == SM_CONFIRM_FILE) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0xFF, 0xFF, 0xFF, this->fileInfoAlpha[this->buttonIndex]); @@ -229,7 +403,7 @@ void DrawSeedHashSprites(FileChooseContext* this) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0xFF, 0xFF, 0xFF, this->fileButtonAlpha[this->buttonIndex]); - if (CVar_GetS32("gRandomizer", 0) && strnlen(CVar_GetString("gSpoilerLog", ""), 1) != 0 && fileSelectSpoilerFileLoaded) { + if (strnlen(CVar_GetString("gSpoilerLog", ""), 1) != 0 && fileSelectSpoilerFileLoaded) { u16 xStart = 64; for (unsigned int i = 0; i < 5; i++) { SpriteLoad(this, GetSeedTexture(gSaveContext.seedIcons[i])); @@ -306,18 +480,25 @@ void FileChoose_UpdateMainMenu(GameState* thisx) { if (this->buttonIndex <= FS_BTN_MAIN_FILE_3) { if (!Save_GetSaveMetaInfo(this->buttonIndex)->valid) { Audio_PlaySoundGeneral(NA_SE_SY_FSEL_DECIDE_L, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); - this->configMode = CM_ROTATE_TO_NAME_ENTRY; - CVar_SetS32("gOnFileSelectNameEntry", 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 = 0; - this->nameEntryBoxPosX = 120; - this->nameEntryBoxAlpha = 0; - memcpy(Save_GetSaveMetaInfo(this->buttonIndex)->playerName, &emptyName, 8); + this->prevConfigMode = this->configMode; + if (MIN_QUEST != MAX_QUEST) { + this->configMode = CM_ROTATE_TO_QUEST_MENU; + } else { + this->configMode = CM_ROTATE_TO_NAME_ENTRY; + this->questType[this->buttonIndex] = MIN_QUEST; + CVar_SetS32("gOnFileSelectNameEntry", 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 = 0; + this->nameEntryBoxPosX = 120; + this->nameEntryBoxAlpha = 0; + memcpy(Save_GetSaveMetaInfo(this->buttonIndex)->playerName, &emptyName, 8); + } + this->logoAlpha = 0; } else if(!FileChoose_IsSaveCompatible(Save_GetSaveMetaInfo(this->buttonIndex))) { Audio_PlaySoundGeneral(NA_SE_SY_FSEL_ERROR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); } @@ -399,6 +580,126 @@ void FileChoose_UpdateMainMenu(GameState* thisx) { } } +void FileChoose_UpdateStickDirectionPromptAnim(GameState* thisx) { + FileChooseContext* this = (FileChooseContext*)thisx; + f32 arrowAnimTween; + f32 new_var3; // likely fake temp + s32 new_var2 = 155; // likely fake temp + f32 stickAnimTween; + + arrowAnimTween = this->arrowAnimTween; + stickAnimTween = this->stickAnimTween; + if (this->arrowAnimState == 0) { + arrowAnimTween += 0.027f; + if (arrowAnimTween > 1.0f) { + arrowAnimTween = 1.0f; + this->arrowAnimState = 1; + } + + } else { + arrowAnimTween -= 0.027f; + if (arrowAnimTween < 0.0f) { + arrowAnimTween = 0.0f; + this->arrowAnimState = 0; + } + } + + this->arrowAnimTween = arrowAnimTween; + if (this->stickAnimState == 0) { + stickAnimTween += 0.027f; + if (stickAnimTween > 1.0f) { + stickAnimTween = 1.0f; + this->stickAnimState = 1; + } + + } else { + stickAnimTween = 0.0f; + this->stickAnimState = 0; + } + + this->stickAnimTween = stickAnimTween; + this->stickLeftPrompt.arrowColorR = (u8)(155 - ((s32)(75.0f * arrowAnimTween))); + this->stickLeftPrompt.arrowColorG = (u8)(new_var2 - (s32)(55.0f * arrowAnimTween)); + new_var3 = (75.0f * arrowAnimTween); + this->stickLeftPrompt.arrowColorB = (u8)(255 - ((s32)(75.0f * arrowAnimTween))); + this->stickLeftPrompt.arrowColorA = (u8)(200 - ((s32)(50.0f * arrowAnimTween))); + this->stickRightPrompt.arrowColorR = (u8)(new_var2 - (s32)new_var3); + this->stickRightPrompt.arrowColorG = (u8)(155 - (s32)new_var3); + this->stickRightPrompt.arrowColorB = (u8)(255 - ((s32)(75.0f * arrowAnimTween))); + this->stickRightPrompt.arrowColorA = (u8)(200 - ((s32)(50.0f * arrowAnimTween))); + this->stickRightPrompt.arrowTexX = 260.0f; + this->stickLeftPrompt.arrowTexX = 63.0f; + this->stickRightPrompt.stickTexX = 244.0f; + this->stickLeftPrompt.stickTexX = 79.0f; + this->stickRightPrompt.stickTexX += (8.0f * stickAnimTween); + this->stickLeftPrompt.stickTexX -= (8.0f * stickAnimTween); + this->stickLeftPrompt.arrowTexY = this->stickRightPrompt.arrowTexY = 135.0f; + this->stickLeftPrompt.stickTexY = this->stickRightPrompt.stickTexY = 139.0f; +} + +void FileChoose_StartQuestMenu(GameState* thisx) { + FileChooseContext* this = (FileChooseContext*)thisx; + + this->logoAlpha += 25; + + if (this->logoAlpha >= 255) { + this->logoAlpha = 255; + this->configMode = CM_QUEST_MENU; + } +} + +void FileChoose_UpdateQuestMenu(GameState* thisx) { + static u8 emptyName[] = { 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E }; + FileChoose_UpdateStickDirectionPromptAnim(thisx); + FileChooseContext* this = (FileChooseContext*)thisx; + Input* input = &this->state.input[0]; + s8 i = 0; + bool dpad = CVar_GetS32("gDpadText", 0);(dpad && CHECK_BTN_ANY(input->press.button, BTN_DDOWN | BTN_DUP)); + + if (ABS(this->stickRelX) > 30 || (dpad && CHECK_BTN_ANY(input->press.button, BTN_DLEFT | BTN_DRIGHT))) { + if (this->stickRelX > 30 || (dpad && CHECK_BTN_ANY(input->press.button, BTN_DRIGHT))) { + this->questType[this->buttonIndex] += 1; + } else if (this->stickRelX < -30 || (dpad && CHECK_BTN_ANY(input->press.button, BTN_DLEFT))) { + this->questType[this->buttonIndex] -= 1; + } + + if (this->questType[this->buttonIndex] > MAX_QUEST) { + this->questType[this->buttonIndex] = MIN_QUEST; + } else if (this->questType[this->buttonIndex] < MIN_QUEST) { + this->questType[this->buttonIndex] = MAX_QUEST; + } + + Audio_PlaySoundGeneral(NA_SE_SY_FSEL_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); + } + + if (CHECK_BTN_ALL(input->press.button, BTN_A)) { + Audio_PlaySoundGeneral(NA_SE_SY_FSEL_DECIDE_L, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); + gSaveContext.isMasterQuest = this->questType[this->buttonIndex] == MASTER_QUEST; + gSaveContext.n64ddFlag = this->questType[this->buttonIndex] == RANDOMIZER_QUEST; + osSyncPrintf("Selected Dungeon Quest: %d\n", gSaveContext.isMasterQuest); + this->prevConfigMode = this->configMode; + this->configMode = CM_ROTATE_TO_NAME_ENTRY; + this->logoAlpha = 0; + CVar_SetS32("gOnFileSelectNameEntry", 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 = 0; + this->nameEntryBoxPosX = 120; + this->nameEntryBoxAlpha = 0; + memcpy(Save_GetSaveMetaInfo(this->buttonIndex)->playerName, &emptyName, 8); + return; + } + + if (CHECK_BTN_ALL(input->press.button, BTN_B)) { + this->configMode = CM_QUEST_TO_MAIN; + return; + } +} + /** * Update function for `CM_UNUSED_31` */ @@ -431,9 +732,12 @@ void FileChoose_RotateToNameEntry(GameState* thisx) { this->windowRot += VREG(16); - if (this->windowRot >= 314.0f) { + if (MIN_QUEST == MAX_QUEST && this->windowRot >= 314.0f) { this->windowRot = 314.0f; this->configMode = CM_START_NAME_ENTRY; + } else if (this->windowRot >= 628.0f) { + this->windowRot = 628.0f; + this->configMode = CM_START_NAME_ENTRY; } } @@ -458,12 +762,43 @@ void FileChoose_RotateToOptions(GameState* thisx) { */ void FileChoose_RotateToMain(GameState* thisx) { FileChooseContext* this = (FileChooseContext*)thisx; + if (this->configMode == CM_QUEST_TO_MAIN || (MIN_QUEST == MAX_QUEST && this->configMode == CM_NAME_ENTRY_TO_MAIN) || + this->configMode == CM_OPTIONS_TO_MAIN) { + this->windowRot -= VREG(16); - this->windowRot += VREG(16); + if (this->windowRot <= 0.0f) { + this->windowRot = 0.0f; + this->configMode = CM_MAIN_MENU; + } + } - if (this->windowRot >= 628.0f) { - this->windowRot = 0.0f; - this->configMode = CM_MAIN_MENU; + if (this->configMode == CM_NAME_ENTRY_TO_MAIN && this->prevConfigMode == CM_MAIN_MENU) { + this->windowRot += VREG(16); + + if (this->windowRot >= 942.0f || (MIN_QUEST == MAX_QUEST && this->windowRot >= 628.0f)) { + this->windowRot = 0.0f; + this->configMode = CM_MAIN_MENU; + } + } +} + +void FileChoose_RotateToQuest(GameState* thisx) { + FileChooseContext* this = (FileChooseContext*)thisx; + + if (this->configMode == CM_NAME_ENTRY_TO_QUEST_MENU) { + this->windowRot -= VREG(16); + + if (this->windowRot <= 314.0f) { + this->windowRot = 314.0f; + this->configMode = CM_START_QUEST_MENU; + } + } else { + this->windowRot += VREG(16); + + if (this->windowRot >= 314.0f) { + this->windowRot = 314.0f; + this->configMode = CM_START_QUEST_MENU; + } } } @@ -488,7 +823,9 @@ static void (*gConfigModeUpdateFuncs[])(GameState*) = { FileChoose_StartNameEntry, FileChoose_RotateToMain, FileChoose_RotateToOptions, FileChoose_UpdateOptionsMenu, FileChoose_StartOptions, FileChoose_RotateToMain, - FileChoose_UnusedCMDelay, + FileChoose_UnusedCMDelay, FileChoose_RotateToQuest, + FileChoose_UpdateQuestMenu, FileChoose_StartQuestMenu, + FileChoose_RotateToMain, FileChoose_RotateToQuest, }; /** @@ -1011,6 +1348,18 @@ static void* sOptionsButtonTextures[] = { gFileSelOptionsButtonENGTex, }; +const char* FileChoose_GetQuestChooseTitleTexName(Language lang) { + switch (lang) { + case LANGUAGE_ENG: + default: + return "assets/textures/title_static/gFileSelPleaseChooseAQuestENGTex"; + case LANGUAGE_FRA: + return "assets/textures/title_static/gFileSelPleaseChooseAQuestFRATex"; + case LANGUAGE_GER: + return "assets/textures/title_static/gFileSelPleaseChooseAQuestGERTex"; + } +} + /** * Draw most window contents including buttons, labels, and icons. * Does not include anything from the keyboard and settings windows. @@ -1023,6 +1372,11 @@ void FileChoose_DrawWindowContents(GameState* thisx) { s16 quadVtxIndex; s16 isActive; s16 pad; + char* tex = (this->configMode == CM_QUEST_MENU || this->configMode == CM_ROTATE_TO_NAME_ENTRY || + this->configMode == CM_START_QUEST_MENU || this->configMode == CM_QUEST_TO_MAIN || + this->configMode == CM_NAME_ENTRY_TO_QUEST_MENU) + ? ResourceMgr_LoadFileRaw(FileChoose_GetQuestChooseTitleTexName(gSaveContext.language)) + : sTitleLabels[gSaveContext.language][this->titleLabel]; Color_RGB8 Background_Color = { this->windowColor[0], this->windowColor[1], this->windowColor[2] }; OPEN_DISPS(this->state.gfxCtx); @@ -1034,235 +1388,317 @@ void FileChoose_DrawWindowContents(GameState* thisx) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, this->titleAlpha[0]); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0); gSPVertex(POLY_OPA_DISP++, this->windowContentVtx, 4, 0); - gDPLoadTextureBlock(POLY_OPA_DISP++, sTitleLabels[gSaveContext.language][this->titleLabel], G_IM_FMT_IA, + gDPLoadTextureBlock(POLY_OPA_DISP++, tex, G_IM_FMT_IA, G_IM_SIZ_8b, 128, 16, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); gSP1Quadrangle(POLY_OPA_DISP++, 0, 2, 3, 1, 0); // draw next title label - 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, - G_IM_SIZ_8b, 128, 16, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, - G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSP1Quadrangle(POLY_OPA_DISP++, 0, 2, 3, 1, 0); + if ((this->configMode == CM_QUEST_MENU) || (this->configMode == CM_START_QUEST_MENU) || + this->configMode == CM_NAME_ENTRY_TO_QUEST_MENU) { + // draw control stick prompts. + if (MIN_QUEST != MAX_QUEST) { + func_800944C4(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 NORMAL_QUEST: + default: + 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, gTitleZeldaShieldLogoTex, 160, 160); + break; - temp = 4; - - gDPPipeSync(POLY_OPA_DISP++); - - // draw file info box (large box when a file is selected) - for (fileIndex = 0; fileIndex < 3; fileIndex++, temp += 20) { + case MASTER_QUEST: + 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, gTitleZeldaShieldLogoMQTex, 160, 160); + FileChoose_DrawImageRGBA32(this->state.gfxCtx, 182, 180, "__OTR__objects/object_mag/gTitleMasterQuestSubtitleTex", 128, 32); + break; + + case RANDOMIZER_QUEST: + DrawSeedHashSprites(this); + 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); + FileChoose_DrawRawImageRGBA32(this->state.gfxCtx, 182, 180, "assets/objects/object_mag/gTitleRandomizerSubtitleTex", 128, 32); + break; + } + } else if (this->configMode != CM_ROTATE_TO_NAME_ENTRY) { gDPPipeSync(POLY_OPA_DISP++); - - if (CVar_GetS32("gHudColors", 1) == 2) { - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetRGB("gCCFileChoosePrim", Background_Color).r, CVar_GetRGB("gCCFileChoosePrim", Background_Color).g, CVar_GetRGB("gCCFileChoosePrim", Background_Color).b, this->fileInfoAlpha[fileIndex]); - } else { - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, Background_Color.r, Background_Color.g, Background_Color.b, this->fileInfoAlpha[fileIndex]); - } - gSPVertex(POLY_OPA_DISP++, &this->windowContentVtx[temp], 20, 0); - - for (quadVtxIndex = 0, i = 0; i < 5; i++, quadVtxIndex += 4) { - gDPLoadTextureBlock(POLY_OPA_DISP++, sFileInfoBoxTextures[i], G_IM_FMT_IA, G_IM_SIZ_16b, - sFileInfoBoxPartWidths[i], 56, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, - G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSP1Quadrangle(POLY_OPA_DISP++, quadVtxIndex, quadVtxIndex + 2, quadVtxIndex + 3, quadVtxIndex + 1, 0); - } - } - - for (i = 0; i < 3; i++, temp += 20) { - // draw file button - gSPVertex(POLY_OPA_DISP++, &this->windowContentVtx[temp], 20, 0); - - isActive = 0; - - if (!FileChoose_IsSaveCompatible(Save_GetSaveMetaInfo(i)) && Save_GetSaveMetaInfo(i)->valid) { - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWindowContentColors[1][0], sWindowContentColors[1][1], - sWindowContentColors[1][2], this->fileButtonAlpha[i]); - } else if (CVar_GetS32("gHudColors", 1) == 2) { - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetRGB("gCCFileChoosePrim", Background_Color).r, - CVar_GetRGB("gCCFileChoosePrim", Background_Color).g, - CVar_GetRGB("gCCFileChoosePrim", Background_Color).b, this->fileButtonAlpha[i]); - } else { - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWindowContentColors[isActive][0], sWindowContentColors[isActive][1], - sWindowContentColors[isActive][2], this->fileButtonAlpha[i]); - } - - gDPLoadTextureBlock(POLY_OPA_DISP++, sFileButtonTextures[gSaveContext.language][i], G_IM_FMT_IA, G_IM_SIZ_16b, - 64, 16, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, - G_TX_NOLOD, G_TX_NOLOD); + 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, + G_IM_SIZ_8b, 128, 16, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, + G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); gSP1Quadrangle(POLY_OPA_DISP++, 0, 2, 3, 1, 0); - // draw file name box - if (CVar_GetS32("gHudColors", 1) == 2 && FileChoose_IsSaveCompatible(Save_GetSaveMetaInfo(i))) { - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetRGB("gCCFileChoosePrim", Background_Color).r, CVar_GetRGB("gCCFileChoosePrim", Background_Color).g, CVar_GetRGB("gCCFileChoosePrim", Background_Color).b, this->nameBoxAlpha[i]); - } else if (!FileChoose_IsSaveCompatible(Save_GetSaveMetaInfo(i))) { - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWindowContentColors[1][0], sWindowContentColors[1][1], - sWindowContentColors[1][2], this->nameBoxAlpha[i]); - } else { - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWindowContentColors[isActive][0], sWindowContentColors[isActive][1], - sWindowContentColors[isActive][2], this->nameBoxAlpha[i]); + temp = 4; + + gDPPipeSync(POLY_OPA_DISP++); + + // draw file info box (large box when a file is selected) + for (fileIndex = 0; fileIndex < 3; fileIndex++, temp += 20) { + gDPPipeSync(POLY_OPA_DISP++); + + if (CVar_GetS32("gHudColors", 1) == 2) { + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetRGB("gCCFileChoosePrim", Background_Color).r, + CVar_GetRGB("gCCFileChoosePrim", Background_Color).g, + CVar_GetRGB("gCCFileChoosePrim", Background_Color).b, this->fileInfoAlpha[fileIndex]); + } else { + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, Background_Color.r, Background_Color.g, Background_Color.b, + this->fileInfoAlpha[fileIndex]); + } + gSPVertex(POLY_OPA_DISP++, &this->windowContentVtx[temp], 20, 0); + + for (quadVtxIndex = 0, i = 0; i < 5; i++, quadVtxIndex += 4) { + gDPLoadTextureBlock(POLY_OPA_DISP++, sFileInfoBoxTextures[i], G_IM_FMT_IA, G_IM_SIZ_16b, + sFileInfoBoxPartWidths[i], 56, 0, G_TX_NOMIRROR | G_TX_WRAP, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); + gSP1Quadrangle(POLY_OPA_DISP++, quadVtxIndex, quadVtxIndex + 2, quadVtxIndex + 3, quadVtxIndex + 1, 0); + } } - gDPLoadTextureBlock(POLY_OPA_DISP++, gFileSelNameBoxTex, G_IM_FMT_IA, G_IM_SIZ_16b, 108, 16, 0, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, - G_TX_NOLOD); - gSP1Quadrangle(POLY_OPA_DISP++, 4, 6, 7, 5, 0); + for (i = 0; i < 3; i++, temp += 20) { + // draw file button + gSPVertex(POLY_OPA_DISP++, &this->windowContentVtx[temp], 20, 0); - // draw rando label - if (Save_GetSaveMetaInfo(i)->randoSave) { + isActive = 0; + + if (!FileChoose_IsSaveCompatible(Save_GetSaveMetaInfo(i)) && Save_GetSaveMetaInfo(i)->valid) { + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWindowContentColors[1][0], sWindowContentColors[1][1], + sWindowContentColors[1][2], this->fileButtonAlpha[i]); + } else if (CVar_GetS32("gHudColors", 1) == 2) { + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetRGB("gCCFileChoosePrim", Background_Color).r, + CVar_GetRGB("gCCFileChoosePrim", Background_Color).g, + CVar_GetRGB("gCCFileChoosePrim", Background_Color).b, this->fileButtonAlpha[i]); + } else { + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWindowContentColors[isActive][0], + sWindowContentColors[isActive][1], sWindowContentColors[isActive][2], + this->fileButtonAlpha[i]); + } + + gDPLoadTextureBlock(POLY_OPA_DISP++, sFileButtonTextures[gSaveContext.language][i], G_IM_FMT_IA, + G_IM_SIZ_16b, 64, 16, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, + G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); + gSP1Quadrangle(POLY_OPA_DISP++, 0, 2, 3, 1, 0); + + // draw file name box if (CVar_GetS32("gHudColors", 1) == 2 && FileChoose_IsSaveCompatible(Save_GetSaveMetaInfo(i))) { - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetRGB("gCCFileChoosePrim", Background_Color).r, CVar_GetRGB("gCCFileChoosePrim", Background_Color).g, CVar_GetRGB("gCCFileChoosePrim", Background_Color).b, this->nameAlpha[i]); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetRGB("gCCFileChoosePrim", Background_Color).r, + CVar_GetRGB("gCCFileChoosePrim", Background_Color).g, + CVar_GetRGB("gCCFileChoosePrim", Background_Color).b, this->nameBoxAlpha[i]); } else if (!FileChoose_IsSaveCompatible(Save_GetSaveMetaInfo(i))) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWindowContentColors[1][0], sWindowContentColors[1][1], sWindowContentColors[1][2], this->nameBoxAlpha[i]); } else { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWindowContentColors[isActive][0], sWindowContentColors[isActive][1], sWindowContentColors[isActive][2], - this->nameAlpha[i]); + this->nameBoxAlpha[i]); } - gDPLoadTextureBlock(POLY_OPA_DISP++, ResourceMgr_LoadFileRaw("assets/textures/title_static/gFileSelRANDButtonTex"), G_IM_FMT_IA, G_IM_SIZ_16b, 44, 16, 0, + + gDPLoadTextureBlock(POLY_OPA_DISP++, gFileSelNameBoxTex, G_IM_FMT_IA, G_IM_SIZ_16b, 108, 16, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSP1Quadrangle(POLY_OPA_DISP++, 8, 10, 11, 9, 0); - } - //Draw MQ label - if (Save_GetSaveMetaInfo(i)->requiresMasterQuest && !Save_GetSaveMetaInfo(i)->randoSave && Save_GetSaveMetaInfo(i)->valid) { + gSP1Quadrangle(POLY_OPA_DISP++, 4, 6, 7, 5, 0); + + // draw rando label + if (Save_GetSaveMetaInfo(i)->randoSave) { + if (CVar_GetS32("gHudColors", 1) == 2 && FileChoose_IsSaveCompatible(Save_GetSaveMetaInfo(i))) { + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetRGB("gCCFileChoosePrim", Background_Color).r, + CVar_GetRGB("gCCFileChoosePrim", Background_Color).g, + CVar_GetRGB("gCCFileChoosePrim", Background_Color).b, this->nameAlpha[i]); + } else if (!FileChoose_IsSaveCompatible(Save_GetSaveMetaInfo(i))) { + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWindowContentColors[1][0], sWindowContentColors[1][1], + sWindowContentColors[1][2], this->nameBoxAlpha[i]); + } else { + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWindowContentColors[isActive][0], + sWindowContentColors[isActive][1], sWindowContentColors[isActive][2], + this->nameAlpha[i]); + } + gDPLoadTextureBlock(POLY_OPA_DISP++, + ResourceMgr_LoadFileRaw("assets/textures/title_static/gFileSelRANDButtonTex"), + G_IM_FMT_IA, G_IM_SIZ_16b, 44, 16, 0, G_TX_NOMIRROR | G_TX_WRAP, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); + gSP1Quadrangle(POLY_OPA_DISP++, 8, 10, 11, 9, 0); + } + // Draw MQ label + if (Save_GetSaveMetaInfo(i)->requiresMasterQuest && !Save_GetSaveMetaInfo(i)->randoSave && + Save_GetSaveMetaInfo(i)->valid) { + if (CVar_GetS32("gHudColors", 1) == 2 && FileChoose_IsSaveCompatible(Save_GetSaveMetaInfo(i))) { + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetRGB("gCCFileChoosePrim", Background_Color).r, + CVar_GetRGB("gCCFileChoosePrim", Background_Color).g, + CVar_GetRGB("gCCFileChoosePrim", Background_Color).b, this->nameAlpha[i]); + } else if (!FileChoose_IsSaveCompatible(Save_GetSaveMetaInfo(i))) { + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWindowContentColors[1][0], sWindowContentColors[1][1], + sWindowContentColors[1][2], this->nameBoxAlpha[i]); + } else { + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWindowContentColors[isActive][0], + sWindowContentColors[isActive][1], sWindowContentColors[isActive][2], + this->nameAlpha[i]); + } + gDPLoadTextureBlock(POLY_OPA_DISP++, + ResourceMgr_LoadFileRaw("assets/textures/title_static/gFileSelMQButtonTex"), + G_IM_FMT_IA, G_IM_SIZ_16b, 44, 16, 0, G_TX_NOMIRROR | G_TX_WRAP, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); + gSP1Quadrangle(POLY_OPA_DISP++, 8, 10, 11, 9, 0); + } + + // draw connectors if (CVar_GetS32("gHudColors", 1) == 2 && FileChoose_IsSaveCompatible(Save_GetSaveMetaInfo(i))) { - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetRGB("gCCFileChoosePrim", Background_Color).r, CVar_GetRGB("gCCFileChoosePrim", Background_Color).g, CVar_GetRGB("gCCFileChoosePrim", Background_Color).b, this->nameAlpha[i]); - } else if (!FileChoose_IsSaveCompatible(Save_GetSaveMetaInfo(i))) { + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetRGB("gCCFileChoosePrim", Background_Color).r, + CVar_GetRGB("gCCFileChoosePrim", Background_Color).g, + CVar_GetRGB("gCCFileChoosePrim", Background_Color).b, this->connectorAlpha[i]); + } else if (!FileChoose_IsSaveCompatible(Save_GetSaveMetaInfo(i)) && Save_GetSaveMetaInfo(i)->valid) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWindowContentColors[1][0], sWindowContentColors[1][1], - sWindowContentColors[1][2], this->nameBoxAlpha[i]); + sWindowContentColors[1][2], this->fileButtonAlpha[i]); } else { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWindowContentColors[isActive][0], sWindowContentColors[isActive][1], sWindowContentColors[isActive][2], - this->nameAlpha[i]); + this->connectorAlpha[i]); } - gDPLoadTextureBlock(POLY_OPA_DISP++, ResourceMgr_LoadFileRaw("assets/textures/title_static/gFileSelMQButtonTex"), G_IM_FMT_IA, G_IM_SIZ_16b, 44, 16, 0, + gDPLoadTextureBlock(POLY_OPA_DISP++, gFileSelConnectorTex, G_IM_FMT_IA, G_IM_SIZ_8b, 24, 16, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSP1Quadrangle(POLY_OPA_DISP++, 8, 10, 11, 9, 0); + gSP1Quadrangle(POLY_OPA_DISP++, 12, 14, 15, 13, 0); + + if (Save_GetSaveMetaInfo(i)->randoSave || Save_GetSaveMetaInfo(i)->requiresMasterQuest) { + gSP1Quadrangle(POLY_OPA_DISP++, 16, 18, 19, 17, 0); + } } - // draw connectors - if (CVar_GetS32("gHudColors", 1) == 2 && FileChoose_IsSaveCompatible(Save_GetSaveMetaInfo(i))) { - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetRGB("gCCFileChoosePrim", Background_Color).r, CVar_GetRGB("gCCFileChoosePrim", Background_Color).g, CVar_GetRGB("gCCFileChoosePrim", Background_Color).b, this->connectorAlpha[i]); - } else if (!FileChoose_IsSaveCompatible(Save_GetSaveMetaInfo(i)) && Save_GetSaveMetaInfo(i)->valid) { - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWindowContentColors[1][0], sWindowContentColors[1][1], - sWindowContentColors[1][2], this->fileButtonAlpha[i]); - } else { - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWindowContentColors[isActive][0], sWindowContentColors[isActive][1], - sWindowContentColors[isActive][2], this->connectorAlpha[i]); + // draw file info + for (fileIndex = 0; fileIndex < 3; fileIndex++) { + isActive = 0; + FileChoose_DrawFileInfo(&this->state, fileIndex, isActive); } - gDPLoadTextureBlock(POLY_OPA_DISP++, gFileSelConnectorTex, G_IM_FMT_IA, G_IM_SIZ_8b, 24, 16, 0, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, - G_TX_NOLOD); - gSP1Quadrangle(POLY_OPA_DISP++, 12, 14, 15, 13, 0); - if (Save_GetSaveMetaInfo(i)->randoSave || Save_GetSaveMetaInfo(i)->requiresMasterQuest) { - gSP1Quadrangle(POLY_OPA_DISP++, 16, 18, 19, 17, 0); - } - } - - // draw file info - for (fileIndex = 0; fileIndex < 3; fileIndex++) { - isActive = 0; - FileChoose_DrawFileInfo(&this->state, fileIndex, isActive); - } - - gDPPipeSync(POLY_OPA_DISP++); - gDPSetCombineLERP(POLY_OPA_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, - ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); - gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0); - gSPVertex(POLY_OPA_DISP++, &this->windowContentVtx[0x274], 20, 0); - - // draw primary action buttons (copy/erase) - for (quadVtxIndex = 0, i = 0; i < 2; i++, quadVtxIndex += 4) { - gDPPipeSync(POLY_OPA_DISP++); - - if (CVar_GetS32("gHudColors", 1) == 2) { - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetRGB("gCCFileChoosePrim", Background_Color).r, CVar_GetRGB("gCCFileChoosePrim", Background_Color).g, CVar_GetRGB("gCCFileChoosePrim", Background_Color).b, this->actionButtonAlpha[i]); - } else { - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2], - this->actionButtonAlpha[i]); - } - gDPLoadTextureBlock(POLY_OPA_DISP++, sActionButtonTextures[gSaveContext.language][i], G_IM_FMT_IA, G_IM_SIZ_16b, - 64, 16, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, - G_TX_NOLOD, G_TX_NOLOD); - gSP1Quadrangle(POLY_OPA_DISP++, quadVtxIndex, quadVtxIndex + 2, quadVtxIndex + 3, quadVtxIndex + 1, 0); - } - - gDPPipeSync(POLY_OPA_DISP++); - - // draw confirm buttons (yes/quit) - for (quadVtxIndex = 0, i = 0; i < 2; i++, quadVtxIndex += 4) { - temp = this->confirmButtonTexIndices[i]; - - if (CVar_GetS32("gHudColors", 1) == 2) { - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetRGB("gCCFileChoosePrim", Background_Color).r, CVar_GetRGB("gCCFileChoosePrim", Background_Color).g, CVar_GetRGB("gCCFileChoosePrim", Background_Color).b, this->confirmButtonAlpha[i]); - } else { - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2], - this->confirmButtonAlpha[i]); - } - gDPLoadTextureBlock(POLY_OPA_DISP++, sActionButtonTextures[gSaveContext.language][temp], G_IM_FMT_IA, - G_IM_SIZ_16b, 64, 16, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, - G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSP1Quadrangle(POLY_OPA_DISP++, quadVtxIndex, quadVtxIndex + 2, quadVtxIndex + 3, quadVtxIndex + 1, 0); - } - - // draw options button - gDPPipeSync(POLY_OPA_DISP++); - - if (CVar_GetS32("gHudColors", 1) == 2) { - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetRGB("gCCFileChoosePrim", Background_Color).r, CVar_GetRGB("gCCFileChoosePrim", Background_Color).g, CVar_GetRGB("gCCFileChoosePrim", Background_Color).b, this->optionButtonAlpha); - } else { - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2], - this->optionButtonAlpha); - } - gDPLoadTextureBlock(POLY_OPA_DISP++, sOptionsButtonTextures[gSaveContext.language], G_IM_FMT_IA, G_IM_SIZ_16b, 64, - 16, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, - G_TX_NOLOD, G_TX_NOLOD); - gSP1Quadrangle(POLY_OPA_DISP++, 8, 10, 11, 9, 0); - - // draw highlight over currently selected button - if (((this->menuMode == FS_MENU_MODE_CONFIG) && - ((this->configMode == CM_MAIN_MENU) || (this->configMode == CM_SELECT_COPY_SOURCE) || - (this->configMode == CM_SELECT_COPY_DEST) || (this->configMode == CM_COPY_CONFIRM) || - (this->configMode == CM_ERASE_SELECT) || (this->configMode == CM_ERASE_CONFIRM))) || - ((this->menuMode == FS_MENU_MODE_SELECT) && (this->selectMode == SM_CONFIRM_FILE))) { - gDPPipeSync(POLY_OPA_DISP++); - gDPSetCombineLERP(POLY_OPA_DISP++, 1, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0, 1, 0, PRIMITIVE, 0, TEXEL0, 0, - PRIMITIVE, 0); - - if (CVar_GetS32("gHudColors", 1) == 2) { - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetRGB("gCCFileChoosePrim", Background_Color).r, CVar_GetRGB("gCCFileChoosePrim", Background_Color).g, CVar_GetRGB("gCCFileChoosePrim", Background_Color).b, this->highlightColor[3]); - } else { - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->highlightColor[0], this->highlightColor[1], - this->highlightColor[2], this->highlightColor[3]); - } - gDPLoadTextureBlock(POLY_OPA_DISP++, gFileSelBigButtonHighlightTex, G_IM_FMT_I, G_IM_SIZ_8b, 72, 24, 0, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, - G_TX_NOLOD); - gSP1Quadrangle(POLY_OPA_DISP++, 12, 14, 15, 13, 0); - } - - // draw warning labels - if (this->warningLabel > FS_WARNING_NONE) { gDPPipeSync(POLY_OPA_DISP++); gDPSetCombineLERP(POLY_OPA_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, this->emptyFileTextAlpha); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0); - gDPLoadTextureBlock(POLY_OPA_DISP++, sWarningLabels[gSaveContext.language][this->warningLabel], G_IM_FMT_IA, - G_IM_SIZ_8b, 128, 16, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, - G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSP1Quadrangle(POLY_OPA_DISP++, 16, 18, 19, 17, 0); + gSPVertex(POLY_OPA_DISP++, &this->windowContentVtx[0x274], 20, 0); + + // draw primary action buttons (copy/erase) + for (quadVtxIndex = 0, i = 0; i < 2; i++, quadVtxIndex += 4) { + gDPPipeSync(POLY_OPA_DISP++); + + if (CVar_GetS32("gHudColors", 1) == 2) { + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetRGB("gCCFileChoosePrim", Background_Color).r, + CVar_GetRGB("gCCFileChoosePrim", Background_Color).g, + CVar_GetRGB("gCCFileChoosePrim", Background_Color).b, this->actionButtonAlpha[i]); + } else { + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2], + this->actionButtonAlpha[i]); + } + gDPLoadTextureBlock(POLY_OPA_DISP++, sActionButtonTextures[gSaveContext.language][i], G_IM_FMT_IA, + G_IM_SIZ_16b, 64, 16, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, + G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); + gSP1Quadrangle(POLY_OPA_DISP++, quadVtxIndex, quadVtxIndex + 2, quadVtxIndex + 3, quadVtxIndex + 1, 0); + } + + gDPPipeSync(POLY_OPA_DISP++); + + // draw confirm buttons (yes/quit) + for (quadVtxIndex = 0, i = 0; i < 2; i++, quadVtxIndex += 4) { + temp = this->confirmButtonTexIndices[i]; + + if (CVar_GetS32("gHudColors", 1) == 2) { + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetRGB("gCCFileChoosePrim", Background_Color).r, + CVar_GetRGB("gCCFileChoosePrim", Background_Color).g, + CVar_GetRGB("gCCFileChoosePrim", Background_Color).b, this->confirmButtonAlpha[i]); + } else { + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2], + this->confirmButtonAlpha[i]); + } + gDPLoadTextureBlock(POLY_OPA_DISP++, sActionButtonTextures[gSaveContext.language][temp], G_IM_FMT_IA, + G_IM_SIZ_16b, 64, 16, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, + G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); + gSP1Quadrangle(POLY_OPA_DISP++, quadVtxIndex, quadVtxIndex + 2, quadVtxIndex + 3, quadVtxIndex + 1, 0); + } + + // draw options button + gDPPipeSync(POLY_OPA_DISP++); + + if (CVar_GetS32("gHudColors", 1) == 2) { + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetRGB("gCCFileChoosePrim", Background_Color).r, + CVar_GetRGB("gCCFileChoosePrim", Background_Color).g, + CVar_GetRGB("gCCFileChoosePrim", Background_Color).b, this->optionButtonAlpha); + } else { + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2], + this->optionButtonAlpha); + } + gDPLoadTextureBlock(POLY_OPA_DISP++, sOptionsButtonTextures[gSaveContext.language], G_IM_FMT_IA, G_IM_SIZ_16b, + 64, 16, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, + G_TX_NOLOD, G_TX_NOLOD); + gSP1Quadrangle(POLY_OPA_DISP++, 8, 10, 11, 9, 0); + + // draw highlight over currently selected button + if (((this->menuMode == FS_MENU_MODE_CONFIG) && + ((this->configMode == CM_MAIN_MENU) || (this->configMode == CM_SELECT_COPY_SOURCE) || + (this->configMode == CM_SELECT_COPY_DEST) || (this->configMode == CM_COPY_CONFIRM) || + (this->configMode == CM_ERASE_SELECT) || (this->configMode == CM_ERASE_CONFIRM))) || + ((this->menuMode == FS_MENU_MODE_SELECT) && (this->selectMode == SM_CONFIRM_FILE))) { + gDPPipeSync(POLY_OPA_DISP++); + gDPSetCombineLERP(POLY_OPA_DISP++, 1, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0, 1, 0, PRIMITIVE, 0, TEXEL0, + 0, PRIMITIVE, 0); + + if (CVar_GetS32("gHudColors", 1) == 2) { + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetRGB("gCCFileChoosePrim", Background_Color).r, + CVar_GetRGB("gCCFileChoosePrim", Background_Color).g, + CVar_GetRGB("gCCFileChoosePrim", Background_Color).b, this->highlightColor[3]); + } else { + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->highlightColor[0], this->highlightColor[1], + this->highlightColor[2], this->highlightColor[3]); + } + gDPLoadTextureBlock(POLY_OPA_DISP++, gFileSelBigButtonHighlightTex, G_IM_FMT_I, G_IM_SIZ_8b, 72, 24, 0, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, + G_TX_NOLOD, G_TX_NOLOD); + gSP1Quadrangle(POLY_OPA_DISP++, 12, 14, 15, 13, 0); + } + + // draw warning labels + if (this->warningLabel > FS_WARNING_NONE) { + gDPPipeSync(POLY_OPA_DISP++); + gDPSetCombineLERP(POLY_OPA_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, + PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, this->emptyFileTextAlpha); + gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0); + gDPLoadTextureBlock(POLY_OPA_DISP++, sWarningLabels[gSaveContext.language][this->warningLabel], G_IM_FMT_IA, + G_IM_SIZ_8b, 128, 16, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, + G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); + gSP1Quadrangle(POLY_OPA_DISP++, 16, 18, 19, 17, 0); + } + + gDPPipeSync(POLY_OPA_DISP++); + gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIDECALA, G_CC_MODULATEIDECALA); + + CLOSE_DISPS(this->state.gfxCtx); } - - gDPPipeSync(POLY_OPA_DISP++); - gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIDECALA, G_CC_MODULATEIDECALA); - - CLOSE_DISPS(this->state.gfxCtx); } void FileChoose_ConfigModeDraw(GameState* thisx) { @@ -1292,7 +1728,8 @@ void FileChoose_ConfigModeDraw(GameState* thisx) { FrameInterpolation_RecordOpenChild(this, this->configMode); - if ((this->configMode != CM_NAME_ENTRY) && (this->configMode != CM_START_NAME_ENTRY)) { + 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) { gDPPipeSync(POLY_OPA_DISP++); gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); @@ -1308,7 +1745,13 @@ void FileChoose_ConfigModeDraw(GameState* thisx) { Matrix_Scale(0.78f, 0.78f, 0.78f, MTXMODE_APPLY); if (this->windowRot != 0) { - Matrix_RotateX(this->windowRot / 100.0f, MTXMODE_APPLY); + if (this->configMode == CM_ROTATE_TO_QUEST_MENU || + (this->configMode >= CM_MAIN_TO_OPTIONS && this->configMode <= CM_OPTIONS_TO_MAIN) || + MIN_QUEST == MAX_QUEST || 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); + } } gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(this->state.gfxCtx), @@ -1343,7 +1786,11 @@ 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 - 314.0f) / 100.0f, MTXMODE_APPLY); + if (MIN_QUEST == MAX_QUEST) { + 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); @@ -1395,6 +1842,42 @@ void FileChoose_ConfigModeDraw(GameState* thisx) { FileChoose_DrawOptions(&this->state); } + // 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 || + this->configMode == CM_NAME_ENTRY_TO_QUEST_MENU) { + // window + gDPPipeSync(POLY_OPA_DISP++); + gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); + if (CVar_GetS32("gHudColors", 1) == 2) { + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetRGB("gCCFileChoosePrim", Background_Color).r, CVar_GetRGB("gCCFileChoosePrim", Background_Color).g, CVar_GetRGB("gCCFileChoosePrim", Background_Color).b, this->windowAlpha); + } else { + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2], + this->windowAlpha); + } + gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0); + + Matrix_Translate(0.0f, 0.0f, -93.6f, MTXMODE_NEW); + Matrix_Scale(0.78f, 0.78f, 0.78f, MTXMODE_APPLY); + Matrix_RotateX((this->windowRot - 314.0f) / 100.0f, MTXMODE_APPLY); + + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(this->state.gfxCtx), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + gSPVertex(POLY_OPA_DISP++, &this->windowVtx[0], 32, 0); + gSPDisplayList(POLY_OPA_DISP++, gFileSelWindow1DL); + + gSPVertex(POLY_OPA_DISP++, &this->windowVtx[32], 32, 0); + gSPDisplayList(POLY_OPA_DISP++, gFileSelWindow2DL); + + gSPVertex(POLY_OPA_DISP++, &this->windowVtx[64], 16, 0); + gSPDisplayList(POLY_OPA_DISP++, gFileSelWindow3DL); + + gDPPipeSync(POLY_OPA_DISP++); + + FileChoose_DrawWindowContents(&this->state); + } + gDPPipeSync(POLY_OPA_DISP++); FileChoose_SetView(this, 0.0f, 0.0f, 64.0f); @@ -2080,6 +2563,41 @@ void FileChoose_InitContext(GameState* thisx) { this->unk_1CAD6[3] = 8; this->unk_1CAD6[4] = 10; + this->stickLeftPrompt.stickColorR = 200; + this->stickLeftPrompt.stickColorG = 200; + this->stickLeftPrompt.stickColorB = 200; + this->stickLeftPrompt.stickColorA = 180; + this->stickLeftPrompt.stickTexX = 79; + this->stickLeftPrompt.stickTexY = 139; + this->stickLeftPrompt.arrowColorR = 155; + this->stickLeftPrompt.arrowColorG = 155; + this->stickLeftPrompt.arrowColorB = 255; + this->stickLeftPrompt.arrowColorA = 200; + this->stickLeftPrompt.arrowTexX = 63; + this->stickLeftPrompt.arrowTexY = 135; + this->stickLeftPrompt.z = 1; + this->stickLeftPrompt.isEnabled = false; + + this->stickRightPrompt.stickColorR = 200; + this->stickRightPrompt.stickColorG = 200; + this->stickRightPrompt.stickColorB = 200; + this->stickRightPrompt.stickColorA = 180; + this->stickRightPrompt.stickTexX = 244; + this->stickRightPrompt.stickTexY = 139; + this->stickRightPrompt.arrowColorR = 155; + this->stickRightPrompt.arrowColorG = 155; + this->stickRightPrompt.arrowColorB = 255; + this->stickRightPrompt.arrowColorA = 200; + this->stickRightPrompt.arrowTexX = 260; + this->stickRightPrompt.arrowTexY = 135; + this->stickRightPrompt.z = 1; + this->stickRightPrompt.isEnabled = false; + + this->arrowAnimState = 0; + this->stickAnimState = 0; + this->arrowAnimTween = 0; + this->stickAnimTween = 0; + ShrinkWindow_SetVal(0); gSaveContext.skyboxTime = 0; @@ -2119,6 +2637,10 @@ void FileChoose_Init(GameState* thisx) { FileChooseContext* this = (FileChooseContext*)thisx; size_t size = (u32)_title_staticSegmentRomEnd - (u32)_title_staticSegmentRomStart; s32 pad; + this->logoAlpha = 0; + this->questType[0] = MIN_QUEST; + this->questType[1] = MIN_QUEST; + this->questType[2] = MIN_QUEST; fileSelectSpoilerFileLoaded = false; isFastFileIdIncompatible = 0; CVar_SetS32("gOnFileSelectNameEntry", 0); diff --git a/soh/src/overlays/gamestates/ovl_file_choose/z_file_nameset_PAL.c b/soh/src/overlays/gamestates/ovl_file_choose/z_file_nameset_PAL.c index 358ab35f6..42ced48e1 100644 --- a/soh/src/overlays/gamestates/ovl_file_choose/z_file_nameset_PAL.c +++ b/soh/src/overlays/gamestates/ovl_file_choose/z_file_nameset_PAL.c @@ -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"); Save_SaveGlobal();