diff options
Diffstat (limited to 'engines/cine')
-rw-r--r-- | engines/cine/cine.cpp | 10 | ||||
-rw-r--r-- | engines/cine/texte.cpp | 50 | ||||
-rw-r--r-- | engines/cine/texte.h | 4 |
3 files changed, 61 insertions, 3 deletions
diff --git a/engines/cine/cine.cpp b/engines/cine/cine.cpp index 65e5c1d218..6f52fed7d0 100644 --- a/engines/cine/cine.cpp +++ b/engines/cine/cine.cpp @@ -38,6 +38,7 @@ #include "cine/bg_list.h" #include "cine/main_loop.h" #include "cine/object.h" +#include "cine/texte.h" #include "cine/sfx_player.h" #include "cine/sound_driver.h" #include "cine/various.h" @@ -68,6 +69,10 @@ CineEngine::CineEngine(OSystem *syst) : Engine(syst) { } CineEngine::~CineEngine() { + if (g_cine->getGameType() == Cine::GType_OS) { + freePoldatDat(); + freeErrmessDat(); + } } int CineEngine::init() { @@ -131,9 +136,8 @@ static void initialize() { snd_loadBasesonEntries("BASESON.SND"); break; case Cine::GType_OS: - // TODO - // load POLDAT.DAT - // load ERRMESS.DAT (default responses to actions) + loadPoldatDat("poldat.dat"); + loadErrmessDat("errmess.dat"); break; } diff --git a/engines/cine/texte.cpp b/engines/cine/texte.cpp index e327274c62..a3ebcd3afd 100644 --- a/engines/cine/texte.cpp +++ b/engines/cine/texte.cpp @@ -566,4 +566,54 @@ void initLanguage(Common::Language lang) { } } +void loadErrmessDat(const char *fname) { + Common::File in; + + in.open(fname); + + if (in.isOpen()) { + char **ptr = (char **)malloc(sizeof(char *) * 6 * 4 + 60 * 6 * 4); + + for (int i = 0; i < 6 * 4; i++) { + ptr[i] = (char *)ptr + (sizeof(char *) * 6 * 4) + 60 * i; + in.read(ptr[i], 60); + } + failureMessages = (const char **)ptr; + + in.close(); + } else { + error("Cannot open file %s for reading", fname); + } +} + +void freeErrmessDat() { + free(failureMessages); + failureMessages = 0; +} + +void loadPoldatDat(const char *fname) { + Common::File in; + + in.open(fname); + + if (in.isOpen()) { + CharacterEntry *ptr = (CharacterEntry *)malloc(sizeof(CharacterEntry) * 256); + + for (int i = 0; i < 256; i++) { + ptr[i].characterIdx = (int)in.readByte(); + ptr[i].characterWidth = (int)in.readByte(); + } + fontParamTable = ptr; + + in.close(); + } else { + error("Cannot open file %s for reading", fname); + } +} + +void freePoldatDat() { + free((void *)fontParamTable); + fontParamTable = 0; +} + } // End of namespace Cine diff --git a/engines/cine/texte.h b/engines/cine/texte.h index 9264c23d06..91fe22002e 100644 --- a/engines/cine/texte.h +++ b/engines/cine/texte.h @@ -50,6 +50,10 @@ struct CharacterEntry { extern const CharacterEntry *fontParamTable; void loadTextData(const char *pFileName, byte *pDestinationBuffer); +void loadErrmessDat(const char *fname); +void freeErrmessDat(void); +void loadPoldatDat(const char *fname); +void freePoldatDat(void); } // End of namespace Cine |