aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--devtools/create_mortdat/create_mortdat.cpp19
-rw-r--r--devtools/create_mortdat/create_mortdat.h5
-rw-r--r--engines/mortevielle/mortevielle.cpp31
-rw-r--r--engines/mortevielle/mortevielle.h14
-rw-r--r--engines/mortevielle/outtext.cpp12
-rw-r--r--engines/mortevielle/ovd1.cpp63
6 files changed, 102 insertions, 42 deletions
diff --git a/devtools/create_mortdat/create_mortdat.cpp b/devtools/create_mortdat/create_mortdat.cpp
index de4bb415d4..4c1dd14fdb 100644
--- a/devtools/create_mortdat/create_mortdat.cpp
+++ b/devtools/create_mortdat/create_mortdat.cpp
@@ -82,10 +82,15 @@ void writeFontBlock() {
outputFile.write(fontBuffer, 121 * 6);
}
-void writeStaticStrings(const char **strings, int languageId) {
+void writeStaticStrings(const char **strings, DataType dataType, int languageId) {
// Write out a section header
char sStaticStrings[4] = { 'S', 'S', 'T', 'R' };
- outputFile.write(sStaticStrings, 4);
+ char sGameStrings[4] = { 'G', 'S', 'T', 'R' };
+
+ if (dataType == kStaticStrings)
+ outputFile.write(sStaticStrings, 4);
+ else if (dataType == kGameStrings)
+ outputFile.write(sGameStrings, 4);
// Figure out the block size
int blockSize = 1;
@@ -112,22 +117,22 @@ void writeStaticStrings(const char **strings, int languageId) {
* Write out the strings previously hard-coded into the engine
*/
void writeEngineStrings() {
- writeStaticStrings(engineDataEn, 1);
- writeStaticStrings(engineDataFr, 0);
+ writeStaticStrings(engineDataEn, kStaticStrings, 1);
+ writeStaticStrings(engineDataFr, kStaticStrings, 0);
}
/**
* Write out the strings used in the game
*/
void writeGameStrings() {
- writeStaticStrings(gameDataEn, 1);
- writeStaticStrings(gameDataFr, 0);
+ writeStaticStrings(gameDataEn, kGameStrings, 1);
+ writeStaticStrings(gameDataFr, kGameStrings, 0);
}
void process() {
writeFontBlock();
- writeEngineStrings();
writeGameStrings();
+ writeEngineStrings();
}
/**
diff --git a/devtools/create_mortdat/create_mortdat.h b/devtools/create_mortdat/create_mortdat.h
index d9c7561d93..0aa6b529df 100644
--- a/devtools/create_mortdat/create_mortdat.h
+++ b/devtools/create_mortdat/create_mortdat.h
@@ -31,6 +31,11 @@ enum AccessMode {
kFileWriteMode = 2
};
+enum DataType {
+ kStaticStrings = 0,
+ kGameStrings = 1
+};
+
#define MORT_DAT "mort.dat"
class File {
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() {