Improve TTS for file select menus (#2950)

* improve TTS for file select menus

* french translation change recommendation
This commit is contained in:
Adam Bird
2023-06-05 17:18:18 -04:00
committed by GitHub
parent 451ce8b107
commit 820fdf78cc
10 changed files with 234 additions and 28 deletions
@@ -383,7 +383,7 @@ void FileChoose_UpdateRandomizer() {
}
}
uint16_t lastFileChooseButtonIndex;
static s16 sLastFileChooseButtonIndex;
/**
* Update the cursor and wait for the player to select a button to change menus accordingly.
@@ -441,6 +441,8 @@ void FileChoose_UpdateMainMenu(GameState* thisx) {
this->nameEntryBoxPosX = 120;
}
sLastFileChooseButtonIndex = -1;
this->actionTimer = 8;
} else {
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_ERROR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
@@ -487,10 +489,10 @@ void FileChoose_UpdateMainMenu(GameState* thisx) {
} else {
this->warningLabel = FS_WARNING_NONE;
}
if (lastFileChooseButtonIndex != this->buttonIndex) {
if (sLastFileChooseButtonIndex != this->buttonIndex) {
GameInteractor_ExecuteOnUpdateFileSelectSelection(this->buttonIndex);
lastFileChooseButtonIndex = this->buttonIndex;
sLastFileChooseButtonIndex = this->buttonIndex;
}
}
}
@@ -560,6 +562,8 @@ void FileChoose_StartQuestMenu(GameState* thisx) {
if (this->logoAlpha >= 255) {
this->logoAlpha = 255;
this->configMode = CM_QUEST_MENU;
GameInteractor_ExecuteOnUpdateFileQuestSelection(this->questType[this->buttonIndex]);
}
}
@@ -614,6 +618,8 @@ void FileChoose_UpdateQuestMenu(GameState* thisx) {
}
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
GameInteractor_ExecuteOnUpdateFileQuestSelection(this->questType[this->buttonIndex]);
}
if (CHECK_BTN_ALL(input->press.button, BTN_A)) {
@@ -651,10 +657,14 @@ void FileChoose_UpdateQuestMenu(GameState* thisx) {
if (CHECK_BTN_ALL(input->press.button, BTN_B)) {
this->configMode = CM_QUEST_TO_MAIN;
sLastFileChooseButtonIndex = -1;
return;
}
}
static s8 sLastBossRushOptionIndex = -1;
static s8 sLastBossRushOptionValue = -1;
void FileChoose_UpdateBossRushMenu(GameState* thisx) {
FileChoose_UpdateStickDirectionPromptAnim(thisx);
FileChooseContext* this = (FileChooseContext*)thisx;
@@ -726,6 +736,13 @@ void FileChoose_UpdateBossRushMenu(GameState* thisx) {
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
}
if (sLastBossRushOptionIndex != this->bossRushIndex ||
sLastBossRushOptionValue != gSaveContext.bossRushOptions[this->bossRushIndex]) {
GameInteractor_ExecuteOnUpdateFileBossRushOptionSelection(this->bossRushIndex, gSaveContext.bossRushOptions[this->bossRushIndex]);
sLastBossRushOptionIndex = this->bossRushIndex;
sLastBossRushOptionValue = gSaveContext.bossRushOptions[this->bossRushIndex];
}
if (CHECK_BTN_ALL(input->press.button, BTN_B)) {
this->configMode = CM_BOSS_RUSH_TO_QUEST;
return;
@@ -2072,6 +2089,7 @@ void FileChoose_FadeMainToSelect(GameState* thisx) {
this->actionTimer = 8;
this->selectMode++;
this->confirmButtonIndex = FS_BTN_CONFIRM_YES;
sLastFileChooseButtonIndex = -1;
}
}
@@ -2149,6 +2167,11 @@ void FileChoose_ConfirmFile(GameState* thisx) {
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
this->confirmButtonIndex ^= 1;
}
if (sLastFileChooseButtonIndex != this->confirmButtonIndex) {
GameInteractor_ExecuteOnUpdateFileSelectConfirmationSelection(this->confirmButtonIndex);
sLastFileChooseButtonIndex = this->confirmButtonIndex;
}
}
/**
@@ -2169,6 +2192,7 @@ void FileChoose_FadeOutFileInfo(GameState* thisx) {
this->nextTitleLabel = FS_TITLE_SELECT_FILE;
this->actionTimer = 8;
this->selectMode++;
sLastFileChooseButtonIndex = -1;
}
this->confirmButtonAlpha[0] = this->confirmButtonAlpha[1] = this->fileInfoAlpha[this->buttonIndex];
@@ -54,7 +54,7 @@ void FileChoose_SetupCopySource(GameState* thisx) {
}
}
uint16_t lastCopyEraseButtonIndex;
static s16 sLastCopyEraseButtonIndex;
/**
* Allow the player to select a file to copy or exit back to the main menu.
@@ -112,10 +112,10 @@ void FileChoose_SelectCopySource(GameState* thisx) {
}
}
}
if (lastCopyEraseButtonIndex != this->buttonIndex) {
if (sLastCopyEraseButtonIndex != this->buttonIndex) {
GameInteractor_ExecuteOnUpdateFileCopySelection(this->buttonIndex);
lastCopyEraseButtonIndex = this->buttonIndex;
sLastCopyEraseButtonIndex = this->buttonIndex;
}
}
@@ -240,6 +240,11 @@ void FileChoose_SelectCopyDest(GameState* thisx) {
this->warningLabel = FS_WARNING_NONE;
}
}
if (sLastCopyEraseButtonIndex != this->buttonIndex) {
GameInteractor_ExecuteOnUpdateFileCopySelection(this->buttonIndex);
sLastCopyEraseButtonIndex = this->buttonIndex;
}
}
}
@@ -386,10 +391,10 @@ void FileChoose_CopyConfirm(GameState* thisx) {
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
this->buttonIndex ^= 1;
}
if (lastCopyEraseButtonIndex != this->buttonIndex) {
if (sLastCopyEraseButtonIndex != this->buttonIndex) {
GameInteractor_ExecuteOnUpdateFileCopyConfirmationSelection(this->buttonIndex);
lastCopyEraseButtonIndex = this->buttonIndex;
sLastCopyEraseButtonIndex = this->buttonIndex;
}
}
@@ -630,6 +635,8 @@ void FileChoose_ExitCopyToMain(GameState* thisx) {
this->optionButtonAlpha = this->actionButtonAlpha[FS_BTN_ACTION_ERASE] =
this->actionButtonAlpha[FS_BTN_ACTION_COPY];
sLastCopyEraseButtonIndex = -1;
}
/**
@@ -736,10 +743,10 @@ void FileChoose_EraseSelect(GameState* thisx) {
this->warningLabel = FS_WARNING_NONE;
}
}
if (lastCopyEraseButtonIndex != this->buttonIndex) {
if (sLastCopyEraseButtonIndex != this->buttonIndex) {
GameInteractor_ExecuteOnUpdateFileEraseSelection(this->buttonIndex);
lastCopyEraseButtonIndex = this->buttonIndex;
sLastCopyEraseButtonIndex = this->buttonIndex;
}
}
@@ -850,10 +857,10 @@ void FileChoose_EraseConfirm(GameState* thisx) {
Audio_PlaySoundGeneral(NA_SE_SY_FSEL_CURSOR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
this->buttonIndex ^= 1;
}
if (lastCopyEraseButtonIndex != this->buttonIndex) {
if (sLastCopyEraseButtonIndex != this->buttonIndex) {
GameInteractor_ExecuteOnUpdateFileEraseConfirmationSelection(this->buttonIndex);
lastCopyEraseButtonIndex = this->buttonIndex;
sLastCopyEraseButtonIndex = this->buttonIndex;
}
}
@@ -1084,4 +1091,6 @@ void FileChoose_ExitEraseToMain(GameState* thisx) {
this->optionButtonAlpha = this->actionButtonAlpha[FS_BTN_ACTION_ERASE] =
this->actionButtonAlpha[FS_BTN_ACTION_COPY];
sLastCopyEraseButtonIndex = -1;
}
@@ -102,6 +102,9 @@ static s16 D_80812604[] = {
0x0048, 0x0045, 0x0045, 0x0045, 0x0045, 0x0045, 0x0045, 0x0045, 0x0045, 0x0045, 0x0045,
};
static s16 sLastCharIndex = -1;
static s16 sLastKbdX = -1;
/**
* Set vertices used by all elements of the name entry screen that are NOT the keyboard.
* This includes the cursor highlight, the name entry plate and characters, and the buttons.
@@ -373,6 +376,7 @@ void FileChoose_DrawNameEntry(GameState* thisx) {
this->configMode = CM_NAME_ENTRY_TO_MAIN;
}
this->prevConfigMode = CM_NAME_ENTRY;
sLastCharIndex = -1;
CVarSetInteger("gOnFileSelectNameEntry", 0);
} else {
for (i = this->newFileNameCharCount; i < 7; i++) {
@@ -628,6 +632,16 @@ void FileChoose_UpdateKeyboardCursor(GameState* thisx) {
if (this->kbdY == 5) {
this->kbdButton = this->kbdX;
if (sLastKbdX != this->kbdX) {
GameInteractor_ExecuteOnUpdateFileNameSelection(0xF0 + this->kbdX);
sLastKbdX = this->kbdX;
sLastCharIndex = -1;
}
} else if (sLastCharIndex != this->charIndex && this->charIndex < 65) {
GameInteractor_ExecuteOnUpdateFileNameSelection(D_808123F0[this->charIndex]);
sLastCharIndex = this->charIndex;
sLastKbdX = -1;
}
}
@@ -656,7 +670,7 @@ void FileChoose_StartOptions(GameState* thisx) {
}
static u8 sSelectedSetting;
int8_t lastOptionButtonIndex = -1;
static s8 sLastOptionButtonIndex = -1;
/**
* Update the cursor and appropriate settings for the options menu.
@@ -673,6 +687,7 @@ void FileChoose_UpdateOptionsMenu(GameState* thisx) {
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;
sLastOptionButtonIndex = -1;
osSyncPrintf("SAVE");
Save_SaveGlobal();
osSyncPrintf(VT_FGCOL(YELLOW));
@@ -721,15 +736,15 @@ void FileChoose_UpdateOptionsMenu(GameState* thisx) {
}
if (sSelectedSetting == FS_SETTING_AUDIO) {
if (lastOptionButtonIndex != gSaveContext.audioSetting) {
if (sLastOptionButtonIndex != gSaveContext.audioSetting) {
GameInteractor_ExecuteOnUpdateFileAudioSelection(gSaveContext.audioSetting);
lastOptionButtonIndex = gSaveContext.audioSetting;
sLastOptionButtonIndex = gSaveContext.audioSetting;
}
} else {
// offset to detect switching between modes
if (lastOptionButtonIndex != FS_BTN_SELECT_QUIT + gSaveContext.zTargetSetting + 1) {
if (sLastOptionButtonIndex != FS_BTN_SELECT_QUIT + gSaveContext.zTargetSetting + 1) {
GameInteractor_ExecuteOnUpdateFileTargetSelection(gSaveContext.zTargetSetting);
lastOptionButtonIndex = FS_BTN_SELECT_QUIT + gSaveContext.zTargetSetting + 1;
sLastOptionButtonIndex = FS_BTN_SELECT_QUIT + gSaveContext.zTargetSetting + 1;
}
}
}