diff options
author | Eugene Sandulenko | 2006-11-13 21:16:50 +0000 |
---|---|---|
committer | Eugene Sandulenko | 2006-11-13 21:16:50 +0000 |
commit | aba00bd320418b42668bdb5371c4e86bd0ef0bbc (patch) | |
tree | 5227c300701597e71a1d0fe7bcae6652660a699a /engines | |
parent | cce7cba3b4d9efd123192aebdbbdb8dad7531509 (diff) | |
download | scummvm-rg350-aba00bd320418b42668bdb5371c4e86bd0ef0bbc.tar.gz scummvm-rg350-aba00bd320418b42668bdb5371c4e86bd0ef0bbc.tar.bz2 scummvm-rg350-aba00bd320418b42668bdb5371c4e86bd0ef0bbc.zip |
Implement reading font data from external files for OS.
svn-id: r24714
Diffstat (limited to 'engines')
-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 |