Quest select changes

This commit is contained in:
aMannus
2025-07-01 21:07:01 +02:00
parent cd90410489
commit 7887d888c4
4 changed files with 151 additions and 126 deletions

View File

@@ -64,36 +64,54 @@ std::array<std::string, LANGUAGE_MAX> RandomizerSettingsMenuText[RSM_MAX] = {
}; };
std::array<std::string, LANGUAGE_MAX> ArchipelagoSettingsMenuText[ASM_MAX] { std::array<std::string, LANGUAGE_MAX> ArchipelagoSettingsMenuText[ASM_MAX] {
{ //ASM_CHANGE_SETTINGS // ASM_START_ARCHIPELAGO
"Change connection settings.", {
"Start Archipelago",
"Todo", "Todo",
"Todo", "Todo",
}, },
{ //ASM_CONNECT // ASM_CHANGE_CONNECTION_INFO
"Connect to server.", {
"Change Connection Info",
"Todo", "Todo",
"Todo", "Todo",
}, },
{ //ASM_CONNECTING // ASM_SERVER_ADDRESS
"Connecting...", {
"Todo",
"Todo",
},
{ //ASM_CONNECTION_ERROR
"Could not connect, please check settings",
"Todo",
"Todo",
},
{ //ASM_SERVER_ADDRESS
"Server Address: ", "Server Address: ",
"Todo", "Todo",
"Todo", "Todo",
}, },
{ //ASM_SLOT_NAME // ASM_SLOT_NAME
{
"Slot Name: ", "Slot Name: ",
"Todo", "Todo",
"Todo", "Todo",
}, },
// ASM_NOT_CONNECTED
{
"Not Connected",
"Todo",
"Todo",
},
// ASM_CONNECTING
{
"Connecting...",
"Todo",
"Todo",
},
// ASM_CONNECTED
{
"Connected",
"Todo",
"Todo",
},
// ASM_STATUS
{
"Status:",
"Todo",
"Todo",
},
}; };
const char* SohFileSelect_GetRandomizerSettingText(uint8_t optionIndex, uint8_t language) { const char* SohFileSelect_GetRandomizerSettingText(uint8_t optionIndex, uint8_t language) {

View File

@@ -22,12 +22,14 @@ typedef enum {
} RandomizerSettingsMenuEnums; } RandomizerSettingsMenuEnums;
typedef enum { typedef enum {
ASM_CHANGE_SETTINGS, ASM_START_ARCHIPELAGO,
ASM_CONNECT, ASM_CHANGE_CONNECTION_INFO,
ASM_CONNECTING,
ASM_CONNECTION_ERROR,
ASM_SERVER_ADDRESS, ASM_SERVER_ADDRESS,
ASM_SLOT_NAME, ASM_SLOT_NAME,
ASM_NOT_CONNECTED,
ASM_CONNECTING,
ASM_CONNECTED,
ASM_STATUS,
ASM_MAX ASM_MAX
} ArchipelagoSettingsMenuEnums; } ArchipelagoSettingsMenuEnums;

View File

@@ -846,7 +846,7 @@ void RegisterOnUpdateMainMenuSelection() {
return; return;
uint8_t language = (gSaveContext.language == LANGUAGE_JPN) ? LANGUAGE_ENG : gSaveContext.language; uint8_t language = (gSaveContext.language == LANGUAGE_JPN) ? LANGUAGE_ENG : gSaveContext.language;
auto optionName = SohFileSelect_GetSettingText(optionIndex, language); auto optionName = SohFileSelect_GetRandomizerSettingText(optionIndex, language);
SpeechSynthesizer::Instance->Speak(optionName, GetLanguageCode()); SpeechSynthesizer::Instance->Speak(optionName, GetLanguageCode());
}); });

View File

@@ -1031,7 +1031,6 @@ void DrawSeedHashSprites(FileChooseContext* this) {
u8 generating; u8 generating;
int retries = 0; int retries = 0;
bool fileSelectSpoilerFileLoaded = false; bool fileSelectSpoilerFileLoaded = false;
bool fileSelectArchipelagoLoaded = false;
void FileChoose_UpdateRandomizer() { void FileChoose_UpdateRandomizer() {
if (CVarGetInteger(CVAR_GENERAL("RandoGenerating"), 0) != 0 && generating == 0) { if (CVarGetInteger(CVAR_GENERAL("RandoGenerating"), 0) != 0 && generating == 0) {
@@ -1053,7 +1052,6 @@ void FileChoose_UpdateRandomizer() {
} }
if (!SpoilerFileExists(CVarGetString(CVAR_GENERAL("SpoilerLog"), "")) && if (!SpoilerFileExists(CVarGetString(CVAR_GENERAL("SpoilerLog"), "")) &&
!fileSelectArchipelagoLoaded &&
!CVarGetInteger(CVAR_RANDOMIZER_SETTING("DontGenerateSpoiler"), 0)) { !CVarGetInteger(CVAR_RANDOMIZER_SETTING("DontGenerateSpoiler"), 0)) {
CVarSetString(CVAR_GENERAL("SpoilerLog"), ""); CVarSetString(CVAR_GENERAL("SpoilerLog"), "");
Randomizer_SetSpoilerLoaded(false); Randomizer_SetSpoilerLoaded(false);
@@ -1085,16 +1083,6 @@ void FileChoose_UpdateRandomizer() {
} }
} }
bool FileChoose_UpdateArchipelago() {
if (CVarGetInteger(CVAR_REMOTE_ARCHIPELAGO("ConnectionStatus"), 0) == 4 && !fileSelectArchipelagoLoaded) {
ParseArchipelago();
fileSelectArchipelagoLoaded = true;
Audio_PlayFanfare(NA_BGM_HORSE_GOAL);
return true;
}
return false;
}
static s16 sLastFileChooseButtonIndex; static s16 sLastFileChooseButtonIndex;
/** /**
@@ -1710,8 +1698,6 @@ void FileChoose_RotateToMain(GameState* thisx) {
void FileChoose_RotateToQuest(GameState* thisx) { void FileChoose_RotateToQuest(GameState* thisx) {
FileChooseContext* this = (FileChooseContext*)thisx; FileChooseContext* this = (FileChooseContext*)thisx;
Archipelago_Disconnect();
if (this->configMode == CM_NAME_ENTRY_TO_QUEST_MENU || this->configMode == CM_BOSS_RUSH_TO_QUEST || if (this->configMode == CM_NAME_ENTRY_TO_QUEST_MENU || this->configMode == CM_BOSS_RUSH_TO_QUEST ||
this->configMode == CM_RANDOMIZER_SETTINGS_MENU_TO_QUEST || this->configMode == CM_RANDOMIZER_SETTINGS_MENU_TO_QUEST ||
this->configMode == CM_ARCHIPELAGO_SETTINGS_TO_QUEST) { this->configMode == CM_ARCHIPELAGO_SETTINGS_TO_QUEST) {
@@ -1787,9 +1773,49 @@ void FileChoose_UpdateArchipelagoMenu(GameState* thisx) {
Input* input = &this->state.input[0]; Input* input = &this->state.input[0];
bool dpad = CVarGetInteger(CVAR_SETTING("DpadInText"), 0); bool dpad = CVarGetInteger(CVAR_SETTING("DpadInText"), 0);
if(FileChoose_UpdateArchipelago()) { // Fade in elements after opening Archipelago Options menu
this->archipelagoUIAlpha += 25;
if (this->archipelagoUIAlpha > 255) {
this->archipelagoUIAlpha = 255;
}
// Move menu selection up or down
if(ABS(this->stickRelY) > 30 || (dpad && CHECK_BTN_ANY(input->press.button, BTN_DDOWN | BTN_DUP))) {
// move down
if(this->stickRelY < -30 || (dpad && CHECK_BTN_ANY(input->press.button, BTN_DDOWN))) {
if ((this->archipelagoIndex + 1) > ASM_CHANGE_CONNECTION_INFO) {
this->archipelagoIndex = ASM_START_ARCHIPELAGO;
} else {
this->archipelagoIndex++;
}
} else {
if (((int8_t)this->archipelagoIndex - 1) < ASM_START_ARCHIPELAGO) {
this->archipelagoIndex = ASM_CHANGE_CONNECTION_INFO;
} else {
this->archipelagoIndex--;
}
}
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
}
if (CHECK_BTN_ALL(input->press.button, BTN_B)) {
this->configMode = CM_ARCHIPELAGO_SETTINGS_TO_QUEST;
return;
}
if (CHECK_BTN_ALL(input->press.button, BTN_A)) {
if (this->archipelagoIndex == ASM_START_ARCHIPELAGO) {
uint16_t testnumber = CVarGetInteger(CVAR_REMOTE_ARCHIPELAGO("ConnectionStatus"), 0);
// Only continue when connected to a slot and locations are scouted.
if (CVarGetInteger(CVAR_REMOTE_ARCHIPELAGO("ConnectionStatus"), 0) != 4) {
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_ERROR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
return;
}
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_DECIDE_L, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, Audio_PlaySoundGeneral(NA_SE_SY_FSEL_DECIDE_L, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
ParseArchipelago();
static u8 emptyName[] = { 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E }; static u8 emptyName[] = { 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E };
static u8 emptyNameNES[] = { 0xDF, 0xDF, 0xDF, 0xDF, 0xDF, 0xDF, 0xDF, 0xDF }; static u8 emptyNameNES[] = { 0xDF, 0xDF, 0xDF, 0xDF, 0xDF, 0xDF, 0xDF, 0xDF };
static u8 linkName[] = { 0x15, 0x2C, 0x31, 0x2E, 0x3E, 0x3E, 0x3E, 0x3E }; static u8 linkName[] = { 0x15, 0x2C, 0x31, 0x2E, 0x3E, 0x3E, 0x3E, 0x3E };
@@ -1825,44 +1851,7 @@ void FileChoose_UpdateArchipelagoMenu(GameState* thisx) {
defaultName = CVarGetInteger(CVAR_ENHANCEMENT("LinkDefaultName"), 0) ? &linkNameNES : &emptyNameNES; defaultName = CVarGetInteger(CVAR_ENHANCEMENT("LinkDefaultName"), 0) ? &linkNameNES : &emptyNameNES;
} }
memcpy(Save_GetSaveMetaInfo(this->buttonIndex)->playerName, defaultName, 8); memcpy(Save_GetSaveMetaInfo(this->buttonIndex)->playerName, defaultName, 8);
} } else if (this->archipelagoIndex == ASM_CHANGE_CONNECTION_INFO) {
// Fade in elements after opening Archipelago Options menu
this->archipelagoUIAlpha += 25;
if (this->archipelagoUIAlpha > 255) {
this->archipelagoUIAlpha = 255;
}
// Move menu selection up or down
if(ABS(this->stickRelY) > 30 || (dpad && CHECK_BTN_ANY(input->press.button, BTN_DDOWN | BTN_DUP))) {
// move down
if(this->stickRelY < -30 || (dpad && CHECK_BTN_ANY(input->press.button, BTN_DDOWN))) {
if((this->archipelagoIndex + 1) > ASM_CONNECT) {
this->archipelagoIndex = ASM_CHANGE_SETTINGS;
} else {
this->archipelagoIndex++;
}
} else {
if(((int8_t)this->archipelagoIndex - 1) < ASM_CHANGE_SETTINGS) {
this->archipelagoIndex = ASM_CONNECT;
} else {
this->archipelagoIndex--;
}
}
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
}
if (CHECK_BTN_ALL(input->press.button, BTN_B)) {
this->configMode = CM_ARCHIPELAGO_SETTINGS_TO_QUEST;
return;
}
if (CHECK_BTN_ALL(input->press.button, BTN_A)) {
if (this->archipelagoIndex == ASM_CONNECT) {
Archipelago_Connect();
} else if (this->archipelagoIndex == ASM_CHANGE_SETTINGS) {
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_DECIDE_L, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, Audio_PlaySoundGeneral(NA_SE_SY_FSEL_DECIDE_L, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
Archipelago_ShowArchipelagoMenu(); Archipelago_ShowArchipelagoMenu();
@@ -1872,8 +1861,6 @@ void FileChoose_UpdateArchipelagoMenu(GameState* thisx) {
void FileChoose_StartArchipelagoMenu(GameState* thisx) { void FileChoose_StartArchipelagoMenu(GameState* thisx) {
FileChooseContext* this = (FileChooseContext*)thisx; FileChooseContext* this = (FileChooseContext*)thisx;
Archipelago_Disconnect();
fileSelectArchipelagoLoaded = false;
this->logoAlpha -= 25; this->logoAlpha -= 25;
this->archipelagoUIAlpha = 0; this->archipelagoUIAlpha = 0;
@@ -2866,21 +2853,8 @@ void FileChoose_DrawWindowContents(GameState* thisx) {
uint8_t textAlpha = this->archipelagoUIAlpha; uint8_t textAlpha = this->archipelagoUIAlpha;
uint8_t textIndex = 0; uint8_t textIndex = 0;
Interface_DrawTextLine(this->state.gfxCtx, SohFileSelect_GetArchipelagoSettingText(ASM_SERVER_ADDRESS, language), 70,
(80 + (textIndex * 16)), 255, 255, 255, textAlpha, 0.8f, true);
textIndex++;
Interface_DrawTextLine(this->state.gfxCtx, CVarGetString(CVAR_REMOTE_ARCHIPELAGO("ServerAddress"), "No Data"), 70,
(75 + (textIndex * 16)), 185, 185, 185, textAlpha, 0.8f, true);
textIndex++; for (uint8_t index = 0; index <= ASM_CHANGE_CONNECTION_INFO; index++) {
Interface_DrawTextLine(this->state.gfxCtx, SohFileSelect_GetArchipelagoSettingText(ASM_SLOT_NAME, language), 70,
(80 + (textIndex * 16)), 255, 255, 255, textAlpha, 0.8f, true);
textIndex++;
Interface_DrawTextLine(this->state.gfxCtx, CVarGetString(CVAR_REMOTE_ARCHIPELAGO("SlotName"), "No Data"), 70,
(75 + (textIndex * 16)), 185, 185, 185, textAlpha, 0.8f, true);
for (uint8_t index = 0; index <= ASM_CONNECT; index++) {
uint8_t textColorR = 255; uint8_t textColorR = 255;
uint8_t textColorG = 255; uint8_t textColorG = 255;
uint8_t textColorB = 255; uint8_t textColorB = 255;
@@ -2890,24 +2864,56 @@ void FileChoose_DrawWindowContents(GameState* thisx) {
textColorB = 80; textColorB = 80;
} }
// todo, gray out text when connecting // If not connected, make Start Archipelago text gray.
if (index == ASM_START_ARCHIPELAGO && CVarGetInteger(CVAR_REMOTE_ARCHIPELAGO("ConnectionStatus"), 0) != 4) {
textColorR = textColorG = textColorB = 100;
}
Interface_DrawTextLine(this->state.gfxCtx, SohFileSelect_GetArchipelagoSettingText(index, language), 70, Interface_DrawTextLine(this->state.gfxCtx, SohFileSelect_GetArchipelagoSettingText(index, language), 70,
(80 + ((5 + index) * 16)), textColorR, textColorG, textColorB, textAlpha, 0.8f, true); (80 + index * 16), textColorR, textColorG, textColorB, textAlpha, 0.8f,
true);
} }
// Server address text
Interface_DrawTextLine(this->state.gfxCtx,
SohFileSelect_GetArchipelagoSettingText(ASM_SERVER_ADDRESS, language), 70,
120, 255, 255, 255, textAlpha, 0.8f, true);
textIndex++;
Interface_DrawTextLine(this->state.gfxCtx, CVarGetString(CVAR_REMOTE_ARCHIPELAGO("ServerAddress"), "No Data"),
70, 130, 185, 185, 185, textAlpha, 0.8f, true);
// Slot name text
textIndex++;
Interface_DrawTextLine(this->state.gfxCtx, SohFileSelect_GetArchipelagoSettingText(ASM_SLOT_NAME, language), 70,
145, 255, 255, 255, textAlpha, 0.8f, true);
textIndex++;
Interface_DrawTextLine(this->state.gfxCtx, CVarGetString(CVAR_REMOTE_ARCHIPELAGO("SlotName"), "No Data"), 70,
155, 185, 185, 185, textAlpha, 0.8f, true);
// Connection status text
Interface_DrawTextLine(this->state.gfxCtx, SohFileSelect_GetArchipelagoSettingText(ASM_STATUS, language),
70, 175, 255, 255, 255, textAlpha, 0.8f, true);
switch(CVarGetInteger(CVAR_REMOTE_ARCHIPELAGO("ConnectionStatus"), 0)) { switch(CVarGetInteger(CVAR_REMOTE_ARCHIPELAGO("ConnectionStatus"), 0)) {
case 1: case 0: // Not Connected
Interface_DrawTextLine(this->state.gfxCtx, SohFileSelect_GetArchipelagoSettingText(ASM_CONNECTING, language), 70, Interface_DrawTextLine(this->state.gfxCtx,
(80 + 64), 185, 185, 185, textAlpha, 0.8f, true); SohFileSelect_GetArchipelagoSettingText(ASM_NOT_CONNECTED, language), 110, 175,
255, 120, 120, textAlpha, 0.8f, true);
break; break;
case 2: case 1: // Connecting
Interface_DrawTextLine(this->state.gfxCtx, SohFileSelect_GetArchipelagoSettingText(ASM_CONNECTION_ERROR, language), 70, case 2: // Connection error, retrying
(80 + 64), 255, 100, 100, textAlpha, 0.8f, true); case 3: // Connected
Interface_DrawTextLine(this->state.gfxCtx,
SohFileSelect_GetArchipelagoSettingText(ASM_CONNECTING, language), 110, 175, 185,
185, 185, textAlpha, 0.8f, true);
break;
case 4: // Connected + Locations Scouted
Interface_DrawTextLine(this->state.gfxCtx,
SohFileSelect_GetArchipelagoSettingText(ASM_CONNECTED, language), 110, 175, 120,
255, 120, textAlpha, 0.8f, true);
break; break;
} }
uint16_t textOffset = 16 * (5 + this->archipelagoIndex);
Gfx_SetupDL_39Opa(this->state.gfxCtx); Gfx_SetupDL_39Opa(this->state.gfxCtx);
gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); 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, gDPLoadTextureBlock(POLY_OPA_DISP++, gArrowCursorTex, G_IM_FMT_IA, G_IM_SIZ_8b, 16, 24, 0,
@@ -2915,7 +2921,7 @@ void FileChoose_DrawWindowContents(GameState* thisx) {
G_TX_NOLOD); G_TX_NOLOD);
FileChoose_DrawTextRec(this->state.gfxCtx, this->stickRightPrompt.arrowColorR, FileChoose_DrawTextRec(this->state.gfxCtx, this->stickRightPrompt.arrowColorR,
this->stickRightPrompt.arrowColorG, this->stickRightPrompt.arrowColorB, textAlpha, 62, this->stickRightPrompt.arrowColorG, this->stickRightPrompt.arrowColorB, textAlpha, 62,
(85 + textOffset), 0.42f, 0, 0, 1.0f, 1.0f); (85 + (this->archipelagoIndex * 16)), 0.42f, 0, 0, 1.0f, 1.0f);
} else if (this->configMode != CM_ROTATE_TO_NAME_ENTRY && this->configMode != CM_START_BOSS_RUSH_MENU && } else if (this->configMode != CM_ROTATE_TO_NAME_ENTRY && this->configMode != CM_START_BOSS_RUSH_MENU &&
this->configMode != CM_ROTATE_TO_BOSS_RUSH_MENU && this->configMode != CM_BOSS_RUSH_TO_QUEST && this->configMode != CM_ROTATE_TO_BOSS_RUSH_MENU && this->configMode != CM_BOSS_RUSH_TO_QUEST &&
@@ -4191,7 +4197,6 @@ void FileChoose_Init(GameState* thisx) {
this->questType[1] = MIN_QUEST; this->questType[1] = MIN_QUEST;
this->questType[2] = MIN_QUEST; this->questType[2] = MIN_QUEST;
fileSelectSpoilerFileLoaded = false; fileSelectSpoilerFileLoaded = false;
fileSelectArchipelagoLoaded = false;
CVarSetInteger(CVAR_GENERAL("OnFileSelectNameEntry"), 0); CVarSetInteger(CVAR_GENERAL("OnFileSelectNameEntry"), 0);
SREG(30) = 1; SREG(30) = 1;