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

* Adds most visuals and interactions for quest select menu.

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

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

* ADD: Randomizer tex

* TWEAK: Randomizer ZAPD extension format

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

* Adds third entry for Randomizer.

* Bold text on randomizer subtitle.

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

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

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

* Removes lock on MQ-only rando.

* Skips quest select if only one quest is playable.

* Adds ability to back out of quest select menu

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

* Fixes custom hud colors and d-pad navigation.

* Implements backing up from name entry to quest select.

Also implements backwards rotations on the file select screen.

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@ -1322,6 +1322,23 @@ typedef struct {
/* 0x00A8 */ View view; /* 0x00A8 */ View view;
} OpeningContext; // size = 0x1D0 } 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 { typedef struct {
/* 0x00000 */ GameState state; /* 0x00000 */ GameState state;
/* 0x000A4 */ Vtx* windowVtx; /* 0x000A4 */ Vtx* windowVtx;
@ -1392,6 +1409,14 @@ typedef struct {
/* 0x1CAD2 */ s16 kbdY; /* 0x1CAD2 */ s16 kbdY;
/* 0x1CAD4 */ s16 newFileNameCharCount; /* 0x1CAD4 */ s16 newFileNameCharCount;
/* 0x1CAD6 */ s16 unk_1CAD6[5]; /* 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 } FileChooseContext; // size = 0x1CAE0
typedef enum { typedef enum {

View File

@ -27,11 +27,6 @@ void BootCommands_Init()
CVar_RegisterS32("gHudColors", 0); //0 = N64 / 1 = NGC / 2 = Custom CVar_RegisterS32("gHudColors", 0); //0 = N64 / 1 = NGC / 2 = Custom
CVar_RegisterS32("gInvertYAxis", 1); CVar_RegisterS32("gInvertYAxis", 1);
CVar_RegisterS32("gTrailDuration", 4); // 4 = Default trail duration 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__) #if defined(__SWITCH__) || defined(__WIIU__)
CVar_RegisterS32("gControlNav", 1); // always enable controller nav on switch/wii u CVar_RegisterS32("gControlNav", 1); // always enable controller nav on switch/wii u
#endif #endif

View File

@ -2590,20 +2590,10 @@ void DrawRandoEditor(bool& open) {
return; 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); bool disableEditingRandoSettings = CVar_GetS32("gRandoGenerating", 0) || CVar_GetS32("gOnFileSelectNameEntry", 0);
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, disableEditingRandoSettings); ImGui::PushItemFlag(ImGuiItemFlags_Disabled, disableEditingRandoSettings);
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * (disableEditingRandoSettings ? 0.5f : 1.0f)); 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)); ImGui::Dummy(ImVec2(0.0f, 0.0f));
if (ImGui::Button("Generate Seed")) { if (ImGui::Button("Generate Seed")) {
if (CVar_GetS32("gRandoGenerating", 0) == 0) { if (CVar_GetS32("gRandoGenerating", 0) == 0) {
@ -2617,15 +2607,13 @@ void DrawRandoEditor(bool& open) {
// RANDOTODO settings presets // RANDOTODO settings presets
// std::string presetfilepath = CVar_GetString("gLoadedPreset", ""); // std::string presetfilepath = CVar_GetString("gLoadedPreset", "");
// ImGui::Text("Settings File: %s", presetfilepath.c_str()); // ImGui::Text("Settings File: %s", presetfilepath.c_str());
}
UIWidgets::PaddedSeparator(); UIWidgets::PaddedSeparator();
ImGuiWindow* window = ImGui::GetCurrentWindow(); ImGuiWindow* window = ImGui::GetCurrentWindow();
static ImVec2 cellPadding(8.0f, 8.0f); static ImVec2 cellPadding(8.0f, 8.0f);
if (CVar_GetS32("gRandomizer", 0) && if (ImGui::BeginTabBar("Randomizer Settings", ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)) {
ImGui::BeginTabBar("Randomizer Settings", ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)) {
if (ImGui::BeginTabItem("World")) { if (ImGui::BeginTabItem("World")) {
ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, cellPadding); ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, cellPadding);
if (ImGui::BeginTable("tableRandoWorld", 3, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) { if (ImGui::BeginTable("tableRandoWorld", 3, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) {

View File

@ -95,35 +95,6 @@ namespace GameMenuBar {
Audio_SetGameVolume(SEQ_SFX, CVar_GetFloat("gFanfareVolume", 1)); 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) { void applyEnhancementPresetDefault(void) {
// D-pad Support on Pause // D-pad Support on Pause
CVar_SetS32("gDpadPause", 0); CVar_SetS32("gDpadPause", 0);
@ -1313,10 +1284,6 @@ namespace GameMenuBar {
UIWidgets::Tooltip("Holding down B skips text"); UIWidgets::Tooltip("Holding down B skips text");
UIWidgets::PaddedEnhancementCheckbox("Free Camera", "gFreeCamera", true, false); 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::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__ #ifdef __SWITCH__
UIWidgets::Spacer(0); UIWidgets::Spacer(0);

View File

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

View File

@ -297,7 +297,7 @@ void Sram_InitSave(FileChooseContext* fileChooseCtx) {
gSaveContext.playerName[offset] = Save_GetSaveMetaInfo(fileChooseCtx->buttonIndex)->playerName[offset]; 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_GameHasMasterQuest()) ||
(Save_GetSaveMetaInfo(fileChooseCtx->buttonIndex)->requiresMasterQuest && !ResourceMgr_GameHasOriginal()))) { (Save_GetSaveMetaInfo(fileChooseCtx->buttonIndex)->requiresMasterQuest && !ResourceMgr_GameHasOriginal()))) {
// Set N64DD Flags for save file // Set N64DD Flags for save file

View File

@ -14,23 +14,6 @@ typedef void (*EnOssanInitFunc)(struct EnOssan*, GlobalContext*);
typedef s16 (*EnOssanGetGirlAParamsFunc)(s16); typedef s16 (*EnOssanGetGirlAParamsFunc)(s16);
typedef void (*EnOssanStateFunc)(struct EnOssan*, GlobalContext*, Player*); 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 #define ColChanMix(c1, c2, m) (c1 - (s32)(c2 * m)) & 0xFF
typedef struct EnOssan { typedef struct EnOssan {

View File

@ -55,7 +55,12 @@ typedef enum {
/* 37 */ CM_OPTIONS_MENU, /* 37 */ CM_OPTIONS_MENU,
/* 38 */ CM_START_OPTIONS, /* 38 */ CM_START_OPTIONS,
/* 39 */ CM_OPTIONS_TO_MAIN, /* 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; } ConfigMode;
typedef enum { typedef enum {

View File

@ -7,6 +7,180 @@
#include <textures/icon_item_static/icon_item_static.h> #include <textures/icon_item_static/icon_item_static.h>
#include "soh/frame_interpolation.h" #include "soh/frame_interpolation.h"
#include <libultraship/GameVersions.h> #include <libultraship/GameVersions.h>
#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; static s16 sUnused = 106;
@ -212,7 +386,7 @@ void DrawSeedHashSprites(FileChooseContext* this) {
gDPPipeSync(POLY_OPA_DISP++); gDPPipeSync(POLY_OPA_DISP++);
gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); 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) { if (this->selectMode == SM_CONFIRM_FILE) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0xFF, 0xFF, 0xFF, this->fileInfoAlpha[this->buttonIndex]); 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]); 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; u16 xStart = 64;
for (unsigned int i = 0; i < 5; i++) { for (unsigned int i = 0; i < 5; i++) {
SpriteLoad(this, GetSeedTexture(gSaveContext.seedIcons[i])); SpriteLoad(this, GetSeedTexture(gSaveContext.seedIcons[i]));
@ -306,7 +480,12 @@ void FileChoose_UpdateMainMenu(GameState* thisx) {
if (this->buttonIndex <= FS_BTN_MAIN_FILE_3) { if (this->buttonIndex <= FS_BTN_MAIN_FILE_3) {
if (!Save_GetSaveMetaInfo(this->buttonIndex)->valid) { if (!Save_GetSaveMetaInfo(this->buttonIndex)->valid) {
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_DECIDE_L, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); Audio_PlaySoundGeneral(NA_SE_SY_FSEL_DECIDE_L, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
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->configMode = CM_ROTATE_TO_NAME_ENTRY;
this->questType[this->buttonIndex] = MIN_QUEST;
CVar_SetS32("gOnFileSelectNameEntry", 1); CVar_SetS32("gOnFileSelectNameEntry", 1);
this->kbdButton = FS_KBD_BTN_NONE; this->kbdButton = FS_KBD_BTN_NONE;
this->charPage = FS_CHAR_PAGE_ENG; this->charPage = FS_CHAR_PAGE_ENG;
@ -318,6 +497,8 @@ void FileChoose_UpdateMainMenu(GameState* thisx) {
this->nameEntryBoxPosX = 120; this->nameEntryBoxPosX = 120;
this->nameEntryBoxAlpha = 0; this->nameEntryBoxAlpha = 0;
memcpy(Save_GetSaveMetaInfo(this->buttonIndex)->playerName, &emptyName, 8); memcpy(Save_GetSaveMetaInfo(this->buttonIndex)->playerName, &emptyName, 8);
}
this->logoAlpha = 0;
} else if(!FileChoose_IsSaveCompatible(Save_GetSaveMetaInfo(this->buttonIndex))) { } else if(!FileChoose_IsSaveCompatible(Save_GetSaveMetaInfo(this->buttonIndex))) {
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_ERROR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); 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` * Update function for `CM_UNUSED_31`
*/ */
@ -431,9 +732,12 @@ void FileChoose_RotateToNameEntry(GameState* thisx) {
this->windowRot += VREG(16); this->windowRot += VREG(16);
if (this->windowRot >= 314.0f) { if (MIN_QUEST == MAX_QUEST && this->windowRot >= 314.0f) {
this->windowRot = 314.0f; this->windowRot = 314.0f;
this->configMode = CM_START_NAME_ENTRY; this->configMode = CM_START_NAME_ENTRY;
} else if (this->windowRot >= 628.0f) {
this->windowRot = 628.0f;
this->configMode = CM_START_NAME_ENTRY;
} }
} }
@ -458,13 +762,44 @@ void FileChoose_RotateToOptions(GameState* thisx) {
*/ */
void FileChoose_RotateToMain(GameState* thisx) { void FileChoose_RotateToMain(GameState* thisx) {
FileChooseContext* this = (FileChooseContext*)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) {
if (this->windowRot >= 628.0f) {
this->windowRot = 0.0f; this->windowRot = 0.0f;
this->configMode = CM_MAIN_MENU; 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;
}
}
} }
static void (*gConfigModeUpdateFuncs[])(GameState*) = { static void (*gConfigModeUpdateFuncs[])(GameState*) = {
@ -488,7 +823,9 @@ static void (*gConfigModeUpdateFuncs[])(GameState*) = {
FileChoose_StartNameEntry, FileChoose_RotateToMain, FileChoose_StartNameEntry, FileChoose_RotateToMain,
FileChoose_RotateToOptions, FileChoose_UpdateOptionsMenu, FileChoose_RotateToOptions, FileChoose_UpdateOptionsMenu,
FileChoose_StartOptions, FileChoose_RotateToMain, 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, 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. * Draw most window contents including buttons, labels, and icons.
* Does not include anything from the keyboard and settings windows. * Does not include anything from the keyboard and settings windows.
@ -1023,6 +1372,11 @@ void FileChoose_DrawWindowContents(GameState* thisx) {
s16 quadVtxIndex; s16 quadVtxIndex;
s16 isActive; s16 isActive;
s16 pad; 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] }; Color_RGB8 Background_Color = { this->windowColor[0], this->windowColor[1], this->windowColor[2] };
OPEN_DISPS(this->state.gfxCtx); OPEN_DISPS(this->state.gfxCtx);
@ -1034,12 +1388,68 @@ void FileChoose_DrawWindowContents(GameState* thisx) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, this->titleAlpha[0]); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, this->titleAlpha[0]);
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0);
gSPVertex(POLY_OPA_DISP++, this->windowContentVtx, 4, 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_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); G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
gSP1Quadrangle(POLY_OPA_DISP++, 0, 2, 3, 1, 0); gSP1Quadrangle(POLY_OPA_DISP++, 0, 2, 3, 1, 0);
// draw next title label // draw next title label
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;
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++); gDPPipeSync(POLY_OPA_DISP++);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, this->titleAlpha[1]); 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, gDPLoadTextureBlock(POLY_OPA_DISP++, sTitleLabels[gSaveContext.language][this->nextTitleLabel], G_IM_FMT_IA,
@ -1056,16 +1466,19 @@ void FileChoose_DrawWindowContents(GameState* thisx) {
gDPPipeSync(POLY_OPA_DISP++); gDPPipeSync(POLY_OPA_DISP++);
if (CVar_GetS32("gHudColors", 1) == 2) { 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]); 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 { } else {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, Background_Color.r, Background_Color.g, Background_Color.b, this->fileInfoAlpha[fileIndex]); 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); gSPVertex(POLY_OPA_DISP++, &this->windowContentVtx[temp], 20, 0);
for (quadVtxIndex = 0, i = 0; i < 5; i++, quadVtxIndex += 4) { for (quadVtxIndex = 0, i = 0; i < 5; i++, quadVtxIndex += 4) {
gDPLoadTextureBlock(POLY_OPA_DISP++, sFileInfoBoxTextures[i], G_IM_FMT_IA, G_IM_SIZ_16b, 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, sFileInfoBoxPartWidths[i], 56, 0, G_TX_NOMIRROR | G_TX_WRAP,
G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); 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); gSP1Quadrangle(POLY_OPA_DISP++, quadVtxIndex, quadVtxIndex + 2, quadVtxIndex + 3, quadVtxIndex + 1, 0);
} }
} }
@ -1084,35 +1497,41 @@ void FileChoose_DrawWindowContents(GameState* thisx) {
CVar_GetRGB("gCCFileChoosePrim", Background_Color).g, CVar_GetRGB("gCCFileChoosePrim", Background_Color).g,
CVar_GetRGB("gCCFileChoosePrim", Background_Color).b, this->fileButtonAlpha[i]); CVar_GetRGB("gCCFileChoosePrim", Background_Color).b, this->fileButtonAlpha[i]);
} else { } else {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWindowContentColors[isActive][0], sWindowContentColors[isActive][1], gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWindowContentColors[isActive][0],
sWindowContentColors[isActive][2], this->fileButtonAlpha[i]); 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, gDPLoadTextureBlock(POLY_OPA_DISP++, sFileButtonTextures[gSaveContext.language][i], G_IM_FMT_IA,
64, 16, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_IM_SIZ_16b, 64, 16, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP,
G_TX_NOLOD, G_TX_NOLOD); G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
gSP1Quadrangle(POLY_OPA_DISP++, 0, 2, 3, 1, 0); gSP1Quadrangle(POLY_OPA_DISP++, 0, 2, 3, 1, 0);
// draw file name box // draw file name box
if (CVar_GetS32("gHudColors", 1) == 2 && FileChoose_IsSaveCompatible(Save_GetSaveMetaInfo(i))) { 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]); 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))) { } else if (!FileChoose_IsSaveCompatible(Save_GetSaveMetaInfo(i))) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWindowContentColors[1][0], sWindowContentColors[1][1], gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWindowContentColors[1][0], sWindowContentColors[1][1],
sWindowContentColors[1][2], this->nameBoxAlpha[i]); sWindowContentColors[1][2], this->nameBoxAlpha[i]);
} else { } else {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWindowContentColors[isActive][0], sWindowContentColors[isActive][1], gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWindowContentColors[isActive][0],
sWindowContentColors[isActive][2], this->nameBoxAlpha[i]); sWindowContentColors[isActive][1], sWindowContentColors[isActive][2],
this->nameBoxAlpha[i]);
} }
gDPLoadTextureBlock(POLY_OPA_DISP++, gFileSelNameBoxTex, G_IM_FMT_IA, G_IM_SIZ_16b, 108, 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_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK,
G_TX_NOLOD); G_TX_NOLOD, G_TX_NOLOD);
gSP1Quadrangle(POLY_OPA_DISP++, 4, 6, 7, 5, 0); gSP1Quadrangle(POLY_OPA_DISP++, 4, 6, 7, 5, 0);
// draw rando label // draw rando label
if (Save_GetSaveMetaInfo(i)->randoSave) { if (Save_GetSaveMetaInfo(i)->randoSave) {
if (CVar_GetS32("gHudColors", 1) == 2 && FileChoose_IsSaveCompatible(Save_GetSaveMetaInfo(i))) { 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->nameAlpha[i]);
} else if (!FileChoose_IsSaveCompatible(Save_GetSaveMetaInfo(i))) { } else if (!FileChoose_IsSaveCompatible(Save_GetSaveMetaInfo(i))) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWindowContentColors[1][0], sWindowContentColors[1][1], gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWindowContentColors[1][0], sWindowContentColors[1][1],
sWindowContentColors[1][2], this->nameBoxAlpha[i]); sWindowContentColors[1][2], this->nameBoxAlpha[i]);
@ -1121,15 +1540,19 @@ void FileChoose_DrawWindowContents(GameState* thisx) {
sWindowContentColors[isActive][1], sWindowContentColors[isActive][2], sWindowContentColors[isActive][1], sWindowContentColors[isActive][2],
this->nameAlpha[i]); 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, gDPLoadTextureBlock(POLY_OPA_DISP++,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, ResourceMgr_LoadFileRaw("assets/textures/title_static/gFileSelRANDButtonTex"),
G_TX_NOLOD, G_TX_NOLOD); 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); gSP1Quadrangle(POLY_OPA_DISP++, 8, 10, 11, 9, 0);
} }
//Draw MQ label // Draw MQ label
if (Save_GetSaveMetaInfo(i)->requiresMasterQuest && !Save_GetSaveMetaInfo(i)->randoSave && Save_GetSaveMetaInfo(i)->valid) { if (Save_GetSaveMetaInfo(i)->requiresMasterQuest && !Save_GetSaveMetaInfo(i)->randoSave &&
Save_GetSaveMetaInfo(i)->valid) {
if (CVar_GetS32("gHudColors", 1) == 2 && FileChoose_IsSaveCompatible(Save_GetSaveMetaInfo(i))) { 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->nameAlpha[i]);
} else if (!FileChoose_IsSaveCompatible(Save_GetSaveMetaInfo(i))) { } else if (!FileChoose_IsSaveCompatible(Save_GetSaveMetaInfo(i))) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWindowContentColors[1][0], sWindowContentColors[1][1], gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWindowContentColors[1][0], sWindowContentColors[1][1],
sWindowContentColors[1][2], this->nameBoxAlpha[i]); sWindowContentColors[1][2], this->nameBoxAlpha[i]);
@ -1138,25 +1561,29 @@ void FileChoose_DrawWindowContents(GameState* thisx) {
sWindowContentColors[isActive][1], sWindowContentColors[isActive][2], sWindowContentColors[isActive][1], sWindowContentColors[isActive][2],
this->nameAlpha[i]); 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, gDPLoadTextureBlock(POLY_OPA_DISP++,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, ResourceMgr_LoadFileRaw("assets/textures/title_static/gFileSelMQButtonTex"),
G_TX_NOLOD, G_TX_NOLOD); 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); gSP1Quadrangle(POLY_OPA_DISP++, 8, 10, 11, 9, 0);
} }
// draw connectors // draw connectors
if (CVar_GetS32("gHudColors", 1) == 2 && FileChoose_IsSaveCompatible(Save_GetSaveMetaInfo(i))) { 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]); 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) { } else if (!FileChoose_IsSaveCompatible(Save_GetSaveMetaInfo(i)) && Save_GetSaveMetaInfo(i)->valid) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWindowContentColors[1][0], sWindowContentColors[1][1], gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWindowContentColors[1][0], sWindowContentColors[1][1],
sWindowContentColors[1][2], this->fileButtonAlpha[i]); sWindowContentColors[1][2], this->fileButtonAlpha[i]);
} else { } else {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWindowContentColors[isActive][0], sWindowContentColors[isActive][1], gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWindowContentColors[isActive][0],
sWindowContentColors[isActive][2], this->connectorAlpha[i]); sWindowContentColors[isActive][1], sWindowContentColors[isActive][2],
this->connectorAlpha[i]);
} }
gDPLoadTextureBlock(POLY_OPA_DISP++, gFileSelConnectorTex, G_IM_FMT_IA, G_IM_SIZ_8b, 24, 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_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK,
G_TX_NOLOD); G_TX_NOLOD, G_TX_NOLOD);
gSP1Quadrangle(POLY_OPA_DISP++, 12, 14, 15, 13, 0); gSP1Quadrangle(POLY_OPA_DISP++, 12, 14, 15, 13, 0);
if (Save_GetSaveMetaInfo(i)->randoSave || Save_GetSaveMetaInfo(i)->requiresMasterQuest) { if (Save_GetSaveMetaInfo(i)->randoSave || Save_GetSaveMetaInfo(i)->requiresMasterQuest) {
@ -1171,8 +1598,8 @@ void FileChoose_DrawWindowContents(GameState* thisx) {
} }
gDPPipeSync(POLY_OPA_DISP++); gDPPipeSync(POLY_OPA_DISP++);
gDPSetCombineLERP(POLY_OPA_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, gDPSetCombineLERP(POLY_OPA_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0,
ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0);
gSPVertex(POLY_OPA_DISP++, &this->windowContentVtx[0x274], 20, 0); gSPVertex(POLY_OPA_DISP++, &this->windowContentVtx[0x274], 20, 0);
@ -1181,14 +1608,16 @@ void FileChoose_DrawWindowContents(GameState* thisx) {
gDPPipeSync(POLY_OPA_DISP++); gDPPipeSync(POLY_OPA_DISP++);
if (CVar_GetS32("gHudColors", 1) == 2) { 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]); 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 { } else {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2], gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2],
this->actionButtonAlpha[i]); this->actionButtonAlpha[i]);
} }
gDPLoadTextureBlock(POLY_OPA_DISP++, sActionButtonTextures[gSaveContext.language][i], G_IM_FMT_IA, G_IM_SIZ_16b, gDPLoadTextureBlock(POLY_OPA_DISP++, sActionButtonTextures[gSaveContext.language][i], G_IM_FMT_IA,
64, 16, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_IM_SIZ_16b, 64, 16, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP,
G_TX_NOLOD, G_TX_NOLOD); G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
gSP1Quadrangle(POLY_OPA_DISP++, quadVtxIndex, quadVtxIndex + 2, quadVtxIndex + 3, quadVtxIndex + 1, 0); gSP1Quadrangle(POLY_OPA_DISP++, quadVtxIndex, quadVtxIndex + 2, quadVtxIndex + 3, quadVtxIndex + 1, 0);
} }
@ -1199,14 +1628,16 @@ void FileChoose_DrawWindowContents(GameState* thisx) {
temp = this->confirmButtonTexIndices[i]; temp = this->confirmButtonTexIndices[i];
if (CVar_GetS32("gHudColors", 1) == 2) { 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]); 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 { } else {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2], gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2],
this->confirmButtonAlpha[i]); this->confirmButtonAlpha[i]);
} }
gDPLoadTextureBlock(POLY_OPA_DISP++, sActionButtonTextures[gSaveContext.language][temp], G_IM_FMT_IA, 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_IM_SIZ_16b, 64, 16, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP,
G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
gSP1Quadrangle(POLY_OPA_DISP++, quadVtxIndex, quadVtxIndex + 2, quadVtxIndex + 3, quadVtxIndex + 1, 0); gSP1Quadrangle(POLY_OPA_DISP++, quadVtxIndex, quadVtxIndex + 2, quadVtxIndex + 3, quadVtxIndex + 1, 0);
} }
@ -1214,13 +1645,15 @@ void FileChoose_DrawWindowContents(GameState* thisx) {
gDPPipeSync(POLY_OPA_DISP++); gDPPipeSync(POLY_OPA_DISP++);
if (CVar_GetS32("gHudColors", 1) == 2) { 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); 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 { } else {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2], gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2],
this->optionButtonAlpha); this->optionButtonAlpha);
} }
gDPLoadTextureBlock(POLY_OPA_DISP++, sOptionsButtonTextures[gSaveContext.language], G_IM_FMT_IA, G_IM_SIZ_16b, 64, gDPLoadTextureBlock(POLY_OPA_DISP++, sOptionsButtonTextures[gSaveContext.language], G_IM_FMT_IA, G_IM_SIZ_16b,
16, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, 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); G_TX_NOLOD, G_TX_NOLOD);
gSP1Quadrangle(POLY_OPA_DISP++, 8, 10, 11, 9, 0); gSP1Quadrangle(POLY_OPA_DISP++, 8, 10, 11, 9, 0);
@ -1231,18 +1664,20 @@ void FileChoose_DrawWindowContents(GameState* thisx) {
(this->configMode == CM_ERASE_SELECT) || (this->configMode == CM_ERASE_CONFIRM))) || (this->configMode == CM_ERASE_SELECT) || (this->configMode == CM_ERASE_CONFIRM))) ||
((this->menuMode == FS_MENU_MODE_SELECT) && (this->selectMode == SM_CONFIRM_FILE))) { ((this->menuMode == FS_MENU_MODE_SELECT) && (this->selectMode == SM_CONFIRM_FILE))) {
gDPPipeSync(POLY_OPA_DISP++); gDPPipeSync(POLY_OPA_DISP++);
gDPSetCombineLERP(POLY_OPA_DISP++, 1, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0, 1, 0, PRIMITIVE, 0, TEXEL0, 0, gDPSetCombineLERP(POLY_OPA_DISP++, 1, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0, 1, 0, PRIMITIVE, 0, TEXEL0,
PRIMITIVE, 0); 0, PRIMITIVE, 0);
if (CVar_GetS32("gHudColors", 1) == 2) { 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]); 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 { } else {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->highlightColor[0], this->highlightColor[1], gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->highlightColor[0], this->highlightColor[1],
this->highlightColor[2], this->highlightColor[3]); this->highlightColor[2], this->highlightColor[3]);
} }
gDPLoadTextureBlock(POLY_OPA_DISP++, gFileSelBigButtonHighlightTex, G_IM_FMT_I, G_IM_SIZ_8b, 72, 24, 0, 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_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK,
G_TX_NOLOD); G_TX_NOLOD, G_TX_NOLOD);
gSP1Quadrangle(POLY_OPA_DISP++, 12, 14, 15, 13, 0); gSP1Quadrangle(POLY_OPA_DISP++, 12, 14, 15, 13, 0);
} }
@ -1254,8 +1689,8 @@ void FileChoose_DrawWindowContents(GameState* thisx) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, this->emptyFileTextAlpha); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, this->emptyFileTextAlpha);
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0);
gDPLoadTextureBlock(POLY_OPA_DISP++, sWarningLabels[gSaveContext.language][this->warningLabel], G_IM_FMT_IA, 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_IM_SIZ_8b, 128, 16, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP,
G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
gSP1Quadrangle(POLY_OPA_DISP++, 16, 18, 19, 17, 0); gSP1Quadrangle(POLY_OPA_DISP++, 16, 18, 19, 17, 0);
} }
@ -1263,6 +1698,7 @@ void FileChoose_DrawWindowContents(GameState* thisx) {
gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIDECALA, G_CC_MODULATEIDECALA); gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIDECALA, G_CC_MODULATEIDECALA);
CLOSE_DISPS(this->state.gfxCtx); CLOSE_DISPS(this->state.gfxCtx);
}
} }
void FileChoose_ConfigModeDraw(GameState* thisx) { void FileChoose_ConfigModeDraw(GameState* thisx) {
@ -1292,7 +1728,8 @@ void FileChoose_ConfigModeDraw(GameState* thisx) {
FrameInterpolation_RecordOpenChild(this, this->configMode); 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++); gDPPipeSync(POLY_OPA_DISP++);
gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); 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); Matrix_Scale(0.78f, 0.78f, 0.78f, MTXMODE_APPLY);
if (this->windowRot != 0) { if (this->windowRot != 0) {
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); 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), 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_Translate(0.0f, 0.0f, -93.6f, MTXMODE_NEW);
Matrix_Scale(0.78f, 0.78f, 0.78f, MTXMODE_APPLY); Matrix_Scale(0.78f, 0.78f, 0.78f, MTXMODE_APPLY);
if (MIN_QUEST == MAX_QUEST) {
Matrix_RotateX((this->windowRot - 314.0f) / 100.0f, MTXMODE_APPLY); 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), gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(this->state.gfxCtx),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
@ -1395,6 +1842,42 @@ void FileChoose_ConfigModeDraw(GameState* thisx) {
FileChoose_DrawOptions(&this->state); 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++); gDPPipeSync(POLY_OPA_DISP++);
FileChoose_SetView(this, 0.0f, 0.0f, 64.0f); 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[3] = 8;
this->unk_1CAD6[4] = 10; 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); ShrinkWindow_SetVal(0);
gSaveContext.skyboxTime = 0; gSaveContext.skyboxTime = 0;
@ -2119,6 +2637,10 @@ void FileChoose_Init(GameState* thisx) {
FileChooseContext* this = (FileChooseContext*)thisx; FileChooseContext* this = (FileChooseContext*)thisx;
size_t size = (u32)_title_staticSegmentRomEnd - (u32)_title_staticSegmentRomStart; size_t size = (u32)_title_staticSegmentRomEnd - (u32)_title_staticSegmentRomStart;
s32 pad; s32 pad;
this->logoAlpha = 0;
this->questType[0] = MIN_QUEST;
this->questType[1] = MIN_QUEST;
this->questType[2] = MIN_QUEST;
fileSelectSpoilerFileLoaded = false; fileSelectSpoilerFileLoaded = false;
isFastFileIdIncompatible = 0; isFastFileIdIncompatible = 0;
CVar_SetS32("gOnFileSelectNameEntry", 0); CVar_SetS32("gOnFileSelectNameEntry", 0);

View File

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