From eb9633ee1e085df0ce7fc747a5ee58891c2aa986 Mon Sep 17 00:00:00 2001 From: Kari Salminen Date: Tue, 12 Aug 2008 19:33:17 +0000 Subject: Implemented Operation Stealth's makeCommandLine. svn-id: r33805 --- engines/cine/texte.cpp | 87 ++++++++++++++++++++++++++++++++++++++---------- engines/cine/texte.h | 3 +- engines/cine/various.cpp | 55 +++++++++++++++++++----------- 3 files changed, 106 insertions(+), 39 deletions(-) (limited to 'engines') diff --git a/engines/cine/texte.cpp b/engines/cine/texte.cpp index 6369a2eff4..a7533c30a9 100644 --- a/engines/cine/texte.cpp +++ b/engines/cine/texte.cpp @@ -34,7 +34,8 @@ const CommandeType *defaultActionCommand; const CommandeType *systemMenu; const CommandeType *confirmMenu; const char **otherMessages; -const char *commandPrepositionOn; +const char *defaultCommandPreposition; +const char **commandPrepositionTable; void generateMask(const byte *sprite, byte *mask, uint16 size, byte transparency); @@ -190,6 +191,16 @@ void initLanguage(Common::Language lang) { "NOACTION" }; + static const char *commandPrepositionTable_EN[] = { + "", // EXAMINE + "", // TAKE + "", // INVENTORY + "on", // USE + "", // OPERATE + "to", // SPEAK + "" // NOACTION + }; + static const CommandeType systemMenu_EN[] = { "Pause", "Restart Game", @@ -206,8 +217,7 @@ void initLanguage(Common::Language lang) { "Loading | %s", "Loading canceled ...", "No baclup in the drive...", - "Please enter the backup name", - "on" + "Please enter the backup name" }; static const CommandeType confirmMenu_EN[] = { @@ -258,6 +268,16 @@ void initLanguage(Common::Language lang) { "NOACTION" }; + static const char *commandPrepositionTable_FR[] = { + "", // EXAMINER + "", // PRENDRE + "", // INVENTAIRE + "sur", // UTILISER + "", // ACTIONNER + "a", // PARLER + "" // NOACTION + }; + static const CommandeType systemMenu_FR[] = { "Pause", "Nouvelle partie", @@ -279,8 +299,7 @@ void initLanguage(Common::Language lang) { "Sauvegarde de | %s", "Sauvegarde Annul\x82""e ...", "Aucune sauvegarde dans le lecteur ...", - "Veuillez entrer le Nom de la Sauvegarde .", - "sur" + "Veuillez entrer le Nom de la Sauvegarde ." }; static const char *failureMessages_ES[] = { @@ -326,6 +345,16 @@ void initLanguage(Common::Language lang) { "NOACTION" }; + static const char *commandPrepositionTable_ES[] = { + "", // EXAMINAR + "", // COGER + "", // INVENTARIO + "donde", // USAR + "", // ACCIONAR + "a", // HABLAR + "" // NOACTION + }; + static const CommandeType systemMenu_ES[] = { "Pause", "Nueva partida", @@ -347,8 +376,7 @@ void initLanguage(Common::Language lang) { "Gabacion de| %s", "Rrabacion anulada", "No hay partidas grabadas en este disco...", - "Teclea el nombre de la partida grabada", - "donde" + "Teclea el nombre de la partida grabada" }; static const char *failureMessages_DE[] = { @@ -385,15 +413,25 @@ void initLanguage(Common::Language lang) { }; static const CommandeType defaultActionCommand_DE[] = { - "Pr\x81""fe", + "Pr\x81""fe", // FIXME? The third letter should be Latin Small Letter U with diaeresis "Nimm", "Bestand", "Benutze", - "Bet\x84tige", + "Bet\x84tige", // FIXME? The third letter should be Latin Small Letter A with diaeresis "Sprich", "NOACTION" }; + static const char *commandPrepositionTable_DE[] = { + "", // Prufe + "", // Nimm + "", // Bestand + "gegen", // Benutze + "", // Betatige + "a", // Sprich + "" // NOACTION + }; + static const CommandeType systemMenu_DE[] = { "Pause", "Spiel Neu Starten", @@ -415,8 +453,7 @@ void initLanguage(Common::Language lang) { "Er L\x84""dt | %s", "Ladevorgang Abgebrochen...", "Kein Backup im Laufwerk...", - "Geben Sie den Namen|der Sicherungsdiskette ein", - "gegen" + "Geben Sie den Namen|der Sicherungsdiskette ein" }; static const char *failureMessages_IT[] = { @@ -462,6 +499,16 @@ void initLanguage(Common::Language lang) { "NOACTION" }; + static const char *commandPrepositionTable_IT[] = { + "", // ESAMINARE + "", // PRENDERE + "", // INVENTARIO + "su", // UTILIZZARE + "", // AZIONARE + "a", // PARLARE + "" // NOACTION + }; + static const CommandeType systemMenu_IT[] = { "Pausa", "Parte nuova", @@ -483,8 +530,7 @@ void initLanguage(Common::Language lang) { "Caricamento di| %s", "Caricamento annullato...", "Nessun salvataggio su questo disco...", - "Vogliate accedere con il nome del salvataggio", - "su" + "Vogliate accedere con il nome del salvataggio" }; switch (lang) { @@ -494,7 +540,8 @@ void initLanguage(Common::Language lang) { systemMenu = systemMenu_FR; confirmMenu = confirmMenu_FR; otherMessages = otherMessages_FR; - commandPrepositionOn = otherMessages_FR[7]; + defaultCommandPreposition = commandPrepositionTable_FR[3]; + commandPrepositionTable = commandPrepositionTable_FR; break; case Common::ES_ESP: @@ -503,7 +550,8 @@ void initLanguage(Common::Language lang) { systemMenu = systemMenu_ES; confirmMenu = confirmMenu_ES; otherMessages = otherMessages_ES; - commandPrepositionOn = otherMessages_ES[7]; + defaultCommandPreposition = commandPrepositionTable_ES[3]; + commandPrepositionTable = commandPrepositionTable_ES; break; case Common::DE_DEU: @@ -512,7 +560,8 @@ void initLanguage(Common::Language lang) { systemMenu = systemMenu_DE; confirmMenu = confirmMenu_DE; otherMessages = otherMessages_DE; - commandPrepositionOn = otherMessages_DE[7]; + defaultCommandPreposition = commandPrepositionTable_DE[3]; + commandPrepositionTable = commandPrepositionTable_DE; break; case Common::IT_ITA: @@ -521,7 +570,8 @@ void initLanguage(Common::Language lang) { systemMenu = systemMenu_IT; confirmMenu = confirmMenu_IT; otherMessages = otherMessages_IT; - commandPrepositionOn = otherMessages_IT[7]; + defaultCommandPreposition = commandPrepositionTable_IT[3]; + commandPrepositionTable = commandPrepositionTable_IT; break; default: @@ -530,7 +580,8 @@ void initLanguage(Common::Language lang) { systemMenu = systemMenu_EN; confirmMenu = confirmMenu_EN; otherMessages = otherMessages_EN; - commandPrepositionOn = otherMessages_EN[7]; + defaultCommandPreposition = commandPrepositionTable_EN[3]; + commandPrepositionTable = commandPrepositionTable_EN; break; } diff --git a/engines/cine/texte.h b/engines/cine/texte.h index 03d0c5faec..bc4beac492 100644 --- a/engines/cine/texte.h +++ b/engines/cine/texte.h @@ -51,7 +51,8 @@ extern const CommandeType *defaultActionCommand; extern const CommandeType *systemMenu; extern const CommandeType *confirmMenu; extern const char **otherMessages; -extern const char *commandPrepositionOn; +extern const char *defaultCommandPreposition; +extern const char **commandPrepositionTable; void loadTextData(const char *filename); void loadErrmessDat(const char *fname); diff --git a/engines/cine/various.cpp b/engines/cine/various.cpp index 6da2931c8a..a3359287ce 100644 --- a/engines/cine/various.cpp +++ b/engines/cine/various.cpp @@ -1491,6 +1491,8 @@ int16 selectSubObject(int16 x, int16 y, int16 param) { return objListTab[selectedObject]; } +// TODO: Make separate functions for Future Wars's and Operation Stealth's version of this function, this is getting too messy +// TODO: Add support for using the different prepositions for different verbs (Doesn't work currently) void makeCommandLine(void) { uint16 x, y; @@ -1515,8 +1517,12 @@ void makeCommandLine(void) { } if (si < 0) { - playerCommand = -1; - commandBuffer = ""; + if (g_cine->getGameType() == Cine::GType_OS) { + canUseOnObject = 0; + } else { // Future Wars + playerCommand = -1; + commandBuffer = ""; + } } else { if (g_cine->getGameType() == Cine::GType_OS) { if (si >= 8000) { @@ -1532,9 +1538,15 @@ void makeCommandLine(void) { commandBuffer += " "; commandBuffer += objectTable[commandVar3[0]].name; commandBuffer += " "; - commandBuffer += commandPrepositionOn; + if (g_cine->getGameType() == Cine::GType_OS) { + commandBuffer += commandPrepositionTable[playerCommand]; + } else { // Future Wars + commandBuffer += defaultCommandPreposition; + } } - } else { + } + + if (g_cine->getGameType() == Cine::GType_OS || !(playerCommand != -1 && choiceResultTable[playerCommand] == 2)) { if (playerCommand == 2) { getMouseData(mouseUpdateStatus, &dummyU16, &x, &y); processInventory(x, y + 8); @@ -1544,7 +1556,7 @@ void makeCommandLine(void) { } } - if (g_cine->getGameType() == Cine::GType_OS) { + if (g_cine->getGameType() == Cine::GType_OS && playerCommand != 2) { if (playerCommand != -1 && canUseOnObject != 0) { // call use on sub object int16 si; @@ -1552,34 +1564,37 @@ void makeCommandLine(void) { si = selectSubObject(x, y + 8, -subObjectUseTable[playerCommand]); - if (si) { + if (si >= 0) { if (si >= 8000) { si -= 8000; } commandVar3[commandVar1] = si; - commandVar1++; - - // TODO: add command message draw + commandBuffer += " "; + commandBuffer += objectTable[si].name; } + } - isDrawCommandEnabled = 1; + isDrawCommandEnabled = 1; - if (playerCommand != -1 && choiceResultTable[playerCommand] == commandVar1) { - SelectedObjStruct obj; - obj.idx = commandVar3[0]; - obj.param = commandVar3[1]; - int16 di = getRelEntryForObject(playerCommand, commandVar1, &obj); + if (playerCommand != -1 && choiceResultTable[playerCommand] == commandVar1) { + SelectedObjStruct obj; + obj.idx = commandVar3[0]; + obj.param = commandVar3[1]; + int16 di = getRelEntryForObject(playerCommand, commandVar1, &obj); - if (di != -1) { - runObjectScript(di); - } - } + if (di != -1) { + runObjectScript(di); + } // TODO: else addFailureMessage(playerCommand) + + playerCommand = -1; + commandVar1 = 0; + commandBuffer = ""; } } - if (!disableSystemMenu) { + if (g_cine->getGameType() == Cine::GType_OS || !disableSystemMenu) { isDrawCommandEnabled = 1; renderer->setCommand(commandBuffer); } -- cgit v1.2.3