Add TTS for Game Over menu (#3338)

This commit is contained in:
Adam Bird 2023-11-05 13:06:21 -05:00 committed by GitHub
parent 7e9efeeadb
commit f1f04a5583
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 70 additions and 2 deletions

View File

@ -12,6 +12,8 @@
"equipped": "$0 - Equipped",
"save_prompt": "Would you like to save?",
"game_saved": "Game saved",
"game_over": "Game Over",
"continue_game": "Continue playing?",
"assigned_to": "Assigned to $0",
"0": "Deku Stick - $0",
"1": "Deku Nut - $0",

View File

@ -12,6 +12,8 @@
"equipped": "$0 - Équipé",
"save_prompt": "Voulez-vous sauvegarder ?",
"game_saved": "Jeu sauvegardé",
"game_over": "Game Over",
"continue_game": "Continuer la partie ?",
"assigned_to": "Assigné au $0",
"0": "Bâton Mojo - $0",
"1": "Noix Mojo - $0",

View File

@ -12,6 +12,8 @@
"equipped": "$0 - Ausgerüstet",
"save_prompt": "Spielstand sichern ?",
"game_saved": "Spielstand gesichert",
"game_over": "Game Over",
"continue_game": "Spiel fortsetzen ?",
"assigned_to": "$0 zugeordnet",
"0": "Deku-Stab - $0",
"1": "Deku-Nuß - $0",

View File

@ -228,6 +228,68 @@ void RegisterOnKaleidoscopeUpdateHook() {
return;
}
// Game over + prompts
if (pauseCtx->state >= 0xC && pauseCtx->state <= 0x10) {
// Reset prompt tracker after state change
if (prevState != pauseCtx->state) {
prevPromptChoice = -1;
}
switch (pauseCtx->state) {
// Game over in full alpha
case 0xC: {
// Fire once on state change
if (prevState != pauseCtx->state) {
auto translation = GetParameritizedText("game_over", TEXT_BANK_KALEIDO, nullptr);
SpeechSynthesizer::Instance->Speak(translation.c_str(), GetLanguageCode());
}
break;
}
// Prompt for save
case 0xE: {
if (prevPromptChoice != pauseCtx->promptChoice) {
auto prompt = GetParameritizedText(pauseCtx->promptChoice == 0 ? "yes" : "no", TEXT_BANK_MISC, nullptr);
if (prevPromptChoice == -1) {
auto translation = GetParameritizedText("save_prompt", TEXT_BANK_KALEIDO, nullptr);
SpeechSynthesizer::Instance->Speak((translation + " - " + prompt).c_str(), GetLanguageCode());
} else {
SpeechSynthesizer::Instance->Speak(prompt.c_str(), GetLanguageCode());
}
prevPromptChoice = pauseCtx->promptChoice;
}
break;
}
// Game saved
case 0xF: {
// Fire once on state change
if (prevState != pauseCtx->state) {
auto translation = GetParameritizedText("game_saved", TEXT_BANK_KALEIDO, nullptr);
SpeechSynthesizer::Instance->Speak(translation.c_str(), GetLanguageCode());
}
break;
}
// Prompt to continue playing
case 0x10: {
if (prevPromptChoice != pauseCtx->promptChoice) {
auto prompt = GetParameritizedText(pauseCtx->promptChoice == 0 ? "yes" : "no", TEXT_BANK_MISC, nullptr);
if (prevPromptChoice == -1) {
auto translation = GetParameritizedText("continue_game", TEXT_BANK_KALEIDO, nullptr);
SpeechSynthesizer::Instance->Speak((translation + " - " + prompt).c_str(), GetLanguageCode());
} else {
SpeechSynthesizer::Instance->Speak(prompt.c_str(), GetLanguageCode());
}
prevPromptChoice = pauseCtx->promptChoice;
}
break;
}
}
prevState = pauseCtx->state;
return;
}
// Announce page when
// Kaleido pages are rotating and page halfway rotated
// Or Kaleido was just opened