[Scummvm-cvs-logs] scummvm master -> 4530dd23a58c4a9b6a2a598d2398550efe0f993c

criezy criezy at scummvm.org
Tue Feb 26 23:19:51 CET 2013


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
4530dd23a5 DREAMWEB: Add localised commands in the network terminal


Commit: 4530dd23a58c4a9b6a2a598d2398550efe0f993c
    https://github.com/scummvm/scummvm/commit/4530dd23a58c4a9b6a2a598d2398550efe0f993c
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2013-02-26T14:17:42-08:00

Commit Message:
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).

Changed paths:
    engines/dreamweb/dreamweb.h
    engines/dreamweb/monitor.cpp



diff --git a/engines/dreamweb/dreamweb.h b/engines/dreamweb/dreamweb.h
index eb35a73..c13a699 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 b6922cb..3bcb38d 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;






More information about the Scummvm-git-logs mailing list