diff options
author | Strangerke | 2012-02-26 02:04:25 +0100 |
---|---|---|
committer | Strangerke | 2012-04-06 08:22:03 +0200 |
commit | ce56512c99b522e3942a84993360203d5f9e8fbc (patch) | |
tree | dc398e9708df2a0a754c642afb7bb232c2a2d3a9 /engines/mortevielle | |
parent | 8072e9e97a909e2d1f9d97c6af4d2ec6a08df14d (diff) | |
download | scummvm-rg350-ce56512c99b522e3942a84993360203d5f9e8fbc.tar.gz scummvm-rg350-ce56512c99b522e3942a84993360203d5f9e8fbc.tar.bz2 scummvm-rg350-ce56512c99b522e3942a84993360203d5f9e8fbc.zip |
MORTEVIELLE: First "English" version.
DAT file needs to be rebuilt
Diffstat (limited to 'engines/mortevielle')
-rw-r--r-- | engines/mortevielle/mortevielle.cpp | 31 | ||||
-rw-r--r-- | engines/mortevielle/mortevielle.h | 14 | ||||
-rw-r--r-- | engines/mortevielle/outtext.cpp | 12 | ||||
-rw-r--r-- | engines/mortevielle/ovd1.cpp | 63 |
4 files changed, 85 insertions, 35 deletions
diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 4f367412fc..9ca4839e76 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -38,6 +38,7 @@ #include "mortevielle/mor.h" #include "mortevielle/mor2.h" #include "mortevielle/mouse.h" +#include "mortevielle/outtext.h" #include "mortevielle/ovd1.h" #include "mortevielle/parole2.h" #include "mortevielle/prog.h" @@ -123,11 +124,28 @@ Common::ErrorCode MortevielleEngine::initialise() { _currGraphicalDevice = MODE_EGA; res = 2; + _txxFileFl = false; + // Load texts from TXX files + chartex(); + // Load the mort.dat resource Common::ErrorCode result = loadMortDat(); if (result != Common::kNoError) return result; + // Load some error messages (was previously in chartex()) + int length = 0; + char str[1410]; + + deline(578, str, length); + al_mess = delig; + deline(579, str, length); + err_mess = delig; + deline(580, str, length); + ind_mess = delig; + deline(581, str, length); + al_mess2 = delig; + // Set default EGA palette _paletteManager.setDefaultPalette(); @@ -138,7 +156,6 @@ Common::ErrorCode MortevielleEngine::initialise() { _newGraphicalDevice = _currGraphicalDevice; zuul = false; tesok = false; - chartex(); charpal(); charge_cfiph(); charge_cfiec(); @@ -202,7 +219,9 @@ Common::ErrorCode MortevielleEngine::loadMortDat() { // Font resource _screenSurface.readFontData(f, dataSize); } else if (!strncmp(dataType, "SSTR", 4)) { - readStaticStrings(f, dataSize); + readStaticStrings(f, dataSize, kStaticStrings); + } else if ((!strncmp(dataType, "GSTR", 4)) && (!_txxFileFl)) { + readStaticStrings(f, dataSize, kGameStrings); } else { // Unknown section f.skip(dataSize); @@ -219,7 +238,7 @@ Common::ErrorCode MortevielleEngine::loadMortDat() { /** * Read in a static strings block, and if the language matches, load up the static strings */ -void MortevielleEngine::readStaticStrings(Common::File &f, int dataSize) { +void MortevielleEngine::readStaticStrings(Common::File &f, int dataSize, DataType dataType) { // Figure out what language Id is needed byte desiredLanguageId = (getLanguage() == Common::EN_ANY) ? LANG_ENGLISH : LANG_FRENCH; @@ -240,7 +259,11 @@ void MortevielleEngine::readStaticStrings(Common::File &f, int dataSize) { while ((ch = (char)f.readByte()) != '\0') s += ch; - _engineStrings.push_back(s); + if (dataType == kStaticStrings) + _engineStrings.push_back(s); + else if (dataType == kGameStrings) + _gameStrings.push_back(s); + dataSize -= s.size() + 1; } assert(dataSize == 0); diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 07c5896086..c44daff1bd 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -48,7 +48,8 @@ enum { // Game languages enum { LANG_FRENCH = 0, - LANG_ENGLISH = 1 + LANG_ENGLISH = 1, + LANG_GERMAN = 2 }; // Static string list @@ -65,6 +66,11 @@ enum { S_SMELL = 40, S_SCRATCH = 41, S_PROBE2 = 42, S_BEFORE_USE_DEP_MENU = 43, S_DAY = 44 }; +enum DataType { + kStaticStrings = 0, + kGameStrings = 1 +}; + #define SCREEN_WIDTH 640 #define SCREEN_HEIGHT 400 #define SCREEN_ORIG_HEIGHT 200 @@ -81,10 +87,10 @@ private: Common::Point _mousePos; bool _inMainGameLoop; // Flag when the main game loop is active Common::StringArray _engineStrings; - + Common::StringArray _gameStrings; Common::ErrorCode initialise(); Common::ErrorCode loadMortDat(); - void readStaticStrings(Common::File &f, int dataSize); + void readStaticStrings(Common::File &f, int dataSize, DataType dataType); void loadFont(Common::File &f); bool handleEvents(); void addKeypress(Common::Event &evt); @@ -105,6 +111,7 @@ public: bool _quitGame; // Quit game flag. Originally called 'arret' bool _endGame; // End game flag. Originally called 'solu' bool _loseGame; // Lose game flag. Originally called 'perdu' + bool _txxFileFl; // Flag used to determine if texts are from the original files or from a DAT file public: MortevielleEngine(OSystem *system, const ADGameDescription *gameDesc); ~MortevielleEngine(); @@ -125,6 +132,7 @@ public: void setMouseClick(bool v) { _mouseClick = v; } void delay(int amount); Common::String getEngineString(int idx) const { return _engineStrings[idx]; } + Common::String getGameString(int idx) const { return _gameStrings[idx]; } void endGame(); void loseGame(); diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index 1c73f7ab4d..99c2cac92c 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -132,6 +132,16 @@ void deline(int num, char *line , int &length) { return; } + if (!g_vm->_txxFileFl) { + delig = g_vm->getGameString(num); + if (line) { + strcpy(line, delig.c_str()); + length = delig.size(); + } + + return; + } + // DETEX delig = ""; int ts = t_rec[num].indis; @@ -155,6 +165,8 @@ void deline(int num, char *line , int &length) { if (length < 255) // Remove trailing '$' delig.deleteLastChar(); + + warning("deline: delig %s - line %s", delig.c_str(), line); } diff --git a/engines/mortevielle/ovd1.cpp b/engines/mortevielle/ovd1.cpp index 74639d32db..17966b88c6 100644 --- a/engines/mortevielle/ovd1.cpp +++ b/engines/mortevielle/ovd1.cpp @@ -100,45 +100,52 @@ void charpal() { } void chartex() { - Common::File f; + Common::File inpFile; + Common::File ntpFile; char s[1410]; - /* debug('o3 chartex'); */ - if (!f.open("TXX.INP")) - if (!f.open("TXX.MOR")) - error("Missing file - TXX.INP or .MOR"); + g_vm->_txxFileFl = false; + if (g_vm->getLanguage() == Common::EN_ANY) { + warning("English version expected - Switching to DAT file"); + return; + } - assert(f.size() <= (maxti * 2)); - for (int i = 0; i < f.size() / 2; ++i) - t_mot[i] = f.readUint16LE(); + if (!inpFile.open("TXX.INP")) { + if (!inpFile.open("TXX.MOR")) { + warning("Missing file - TXX.INP or .MOR - Switching to DAT file"); + return; + } + } - f.close(); + if (!ntpFile.open("TXX.NTP")) { + if (!ntpFile.open("TXX.IND")) { + warning("Missing file - TXX.NTP or .IND - Switching to DAT file"); + return; + } + } - if (!f.open("TXX.NTP")) - if (!f.open("TXX.IND")) - error("Missing file - TXX.NTP or .IND"); - - assert(f.size() <= (maxtd * 3)); - int i; - for (i = 0; i < (f.size() / 3); ++i) { - t_rec[i].indis = f.readSint16LE(); - t_rec[i].point = f.readByte(); + if ((inpFile.size() > (maxti * 2)) || (ntpFile.size() > (maxtd * 3))) { + warning("TXX file - Unexpected format - Switching to DAT file"); + return; } - f.close(); + for (int i = 0; i < inpFile.size() / 2; ++i) + t_mot[i] = inpFile.readUint16LE(); + + inpFile.close(); + + for (int i = 0; i < (ntpFile.size() / 3); ++i) { + t_rec[i].indis = ntpFile.readSint16LE(); + t_rec[i].point = ntpFile.readByte(); + } + + ntpFile.close(); - deline(578, s, i); - al_mess = delig; - deline(579, s, i); - err_mess = delig; - deline(580, s, i); - ind_mess = delig; - deline(581, s, i); - al_mess2 = delig; + g_vm->_txxFileFl = true; } /** - * The original engine used this method to display a starting text screen letting the palyer + * The original engine used this method to display a starting text screen letting the player * select the graphics mode to use */ void dialpre() { |