diff options
author | Thierry Crozat | 2013-02-24 21:51:46 +0000 |
---|---|---|
committer | Thierry Crozat | 2013-02-26 22:17:42 +0000 |
commit | 4530dd23a58c4a9b6a2a598d2398550efe0f993c (patch) | |
tree | ace28af33ec1da0afa8750a82f940635bf660762 | |
parent | 9210eb5045b083362226c85f5bf84611d629a0cf (diff) | |
download | scummvm-rg350-4530dd23a58c4a9b6a2a598d2398550efe0f993c.tar.gz scummvm-rg350-4530dd23a58c4a9b6a2a598d2398550efe0f993c.tar.bz2 scummvm-rg350-4530dd23a58c4a9b6a2a598d2398550efe0f993c.zip |
DREAMWEB: Add localised commands in the network terminal
The original interpreter only used english commands in the terminal
even when playing one of the localised version (and even though
everything else in the terminal was localised). This adds the possibility
to either use the English commands or the localised ones.
Localized commands have been added for French, German (thanks to
SimSaw, who also proposed that idea) and Italian (thanks to Maff).
-rw-r--r-- | engines/dreamweb/dreamweb.h | 1 | ||||
-rw-r--r-- | engines/dreamweb/monitor.cpp | 105 |
2 files changed, 84 insertions, 22 deletions
diff --git a/engines/dreamweb/dreamweb.h b/engines/dreamweb/dreamweb.h index eb35a73f66..c13a6995bf 100644 --- a/engines/dreamweb/dreamweb.h +++ b/engines/dreamweb/dreamweb.h @@ -513,6 +513,7 @@ public: void dirCom(); void useMon(); bool execCommand(); + int findCommand(const char* cmdList[]); // from newplace.cpp void getUnderCentre(); diff --git a/engines/dreamweb/monitor.cpp b/engines/dreamweb/monitor.cpp index b6922cba51..3bcb38d074 100644 --- a/engines/dreamweb/monitor.cpp +++ b/engines/dreamweb/monitor.cpp @@ -104,6 +104,26 @@ void DreamWebEngine::useMon() { redrawMainScrn(); workToScreenM(); } + +int DreamWebEngine::findCommand(const char* 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[] = { @@ -112,7 +132,38 @@ bool DreamWebEngine::execCommand() { "LIST", "READ", "LOGON", - "KEYS" + "KEYS", + NULL + }; + + static const char *comlistFR[] = { + "SORTIR", + "AIDE", + "LISTE", + "LIRE", + "CONNEXION", + "TOUCHES", // should be CLES but it is translated as TOUCHES in the game... + NULL + }; + + static const char *comlistDE[] = { + "ENDE", + "HILFE", + "LISTE", + "LIES", + "ZUGRIFF", + "DATEN", + NULL + }; + + static const char *comlistIT[] = { + "ESCI", + "AIUTO", + "ELENCA", + "LEGGI", + "ACCEDI", + "CHIAVI", + NULL }; if (_inputLine[0] == 0) { @@ -121,26 +172,23 @@ 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: + default: + break; + } } // Execute the selected command @@ -154,7 +202,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 +239,6 @@ bool DreamWebEngine::execCommand() { } - void DreamWebEngine::monitorLogo() { if (_logoNum != _oldLogoNum) { _oldLogoNum = _logoNum; |