diff options
Diffstat (limited to 'engines/dreamweb/monitor.cpp')
-rw-r--r-- | engines/dreamweb/monitor.cpp | 119 |
1 files changed, 96 insertions, 23 deletions
diff --git a/engines/dreamweb/monitor.cpp b/engines/dreamweb/monitor.cpp index b6922cba51..1f9fa8d24f 100644 --- a/engines/dreamweb/monitor.cpp +++ b/engines/dreamweb/monitor.cpp @@ -104,15 +104,76 @@ void DreamWebEngine::useMon() { redrawMainScrn(); workToScreenM(); } + +int DreamWebEngine::findCommand(const char *const cmdList[]) { + // Loop over all commands in the list and see if we get a match + int cmd = 0; + while (cmdList[cmd] != NULL) { + const char *cmdStr = cmdList[cmd]; + const char *inputStr = _inputLine; + // Compare the command, char by char, to see if we get a match. + // We only care about the prefix matching, though. + char inputChar, cmdChar; + do { + inputChar = *inputStr; inputStr += 2; + cmdChar = *cmdStr++; + if (cmdChar == 0) + return cmd; + } while (inputChar == cmdChar); + ++cmd; + } + return -1; +} bool DreamWebEngine::execCommand() { - static const char *comlist[] = { + static const char *const comlist[] = { "EXIT", "HELP", "LIST", "READ", "LOGON", - "KEYS" + "KEYS", + NULL + }; + + static const char *const comlistFR[] = { + "SORTIR", + "AIDE", + "LISTE", + "LIRE", + "CONNEXION", + "TOUCHES", // should be CLES but it is translated as TOUCHES in the game... + NULL + }; + + static const char *const comlistDE[] = { + "ENDE", + "HILF", + "LISTE", + "LIES", + "ZUGRIFF", + "DATEN", + NULL + }; + + static const char *const comlistIT[] = { + "ESCI", + "AIUTO", + "ELENCA", + "LEGGI", + "ACCEDI", + "CHIAVI", + NULL + }; + + static const char *const comlistES[] = { + "SALIR", + "AYUDA", + "LISTA", + "LEER", + "ACCESO", + "CLAVES", + NULL }; if (_inputLine[0] == 0) { @@ -121,26 +182,25 @@ bool DreamWebEngine::execCommand() { return false; } - int cmd; - bool done = false; - // Loop over all commands in the list and see if we get a match - for (cmd = 0; cmd < ARRAYSIZE(comlist); ++cmd) { - const char *cmdStr = comlist[cmd]; - const char *inputStr = _inputLine; - // Compare the command, char by char, to see if we get a match. - // We only care about the prefix matching, though. - char inputChar, cmdChar; - do { - inputChar = *inputStr; inputStr += 2; - cmdChar = *cmdStr++; - if (cmdChar == 0) { - done = true; - break; - } - } while (inputChar == cmdChar); - - if (done) + int cmd = findCommand(comlist); + if (cmd == -1) { + // This did not match an english command. Try to find a localized one. + switch (getLanguage()) { + case Common::FR_FRA: + cmd = findCommand(comlistFR); + break; + case Common::DE_DEU: + cmd = findCommand(comlistDE); + break; + case Common::IT_ITA: + cmd = findCommand(comlistIT); break; + case Common::ES_ESP: + cmd = findCommand(comlistES); + break; + default: + break; + } } // Execute the selected command @@ -154,7 +214,21 @@ bool DreamWebEngine::execCommand() { // this extra text is wrapped around the common copy protection check, // to keep it faithful to the original, if requested. if (!_copyProtection) { - monPrint("VALID COMMANDS ARE EXIT, HELP, LIST, READ, LOGON, KEYS"); + switch (getLanguage()) { + case Common::FR_FRA: + monPrint("LES COMMANDES VALIDES SONT SORTIR, AIDE, LISTE, LIRE, CONNEXION, TOUCHES"); + break; + case Common::DE_DEU: + monPrint("G\232LTIGE BEFEHLE SIND ENDE, HILFE, LISTE, LIES, ZUGRIFF, DATEN"); + break; + case Common::IT_ITA: + monPrint("I COMANDI VALIDI SONO ESCI, AIUTO, ELENCA, LEGGI, ACCEDI, CHIAVI"); + break; + case Common::ES_ESP: + default: + monPrint("VALID COMMANDS ARE EXIT, HELP, LIST, READ, LOGON, KEYS"); + break; + } } break; case 2: @@ -177,7 +251,6 @@ bool DreamWebEngine::execCommand() { } - void DreamWebEngine::monitorLogo() { if (_logoNum != _oldLogoNum) { _oldLogoNum = _logoNum; |