[Scummvm-cvs-logs] SF.net SVN: scummvm: [24714] scummvm/trunk/engines/cine
sev at users.sourceforge.net
sev at users.sourceforge.net
Mon Nov 13 22:16:50 CET 2006
Revision: 24714
http://svn.sourceforge.net/scummvm/?rev=24714&view=rev
Author: sev
Date: 2006-11-13 13:16:50 -0800 (Mon, 13 Nov 2006)
Log Message:
-----------
Implement reading font data from external files for OS.
Modified Paths:
--------------
scummvm/trunk/engines/cine/cine.cpp
scummvm/trunk/engines/cine/texte.cpp
scummvm/trunk/engines/cine/texte.h
Modified: scummvm/trunk/engines/cine/cine.cpp
===================================================================
--- scummvm/trunk/engines/cine/cine.cpp 2006-11-13 20:58:21 UTC (rev 24713)
+++ scummvm/trunk/engines/cine/cine.cpp 2006-11-13 21:16:50 UTC (rev 24714)
@@ -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() {
+ if (g_cine->getGameType() == Cine::GType_OS) {
+ freePoldatDat();
+ freeErrmessDat();
+ }
}
int CineEngine::init() {
@@ -131,9 +136,8 @@
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;
}
Modified: scummvm/trunk/engines/cine/texte.cpp
===================================================================
--- scummvm/trunk/engines/cine/texte.cpp 2006-11-13 20:58:21 UTC (rev 24713)
+++ scummvm/trunk/engines/cine/texte.cpp 2006-11-13 21:16:50 UTC (rev 24714)
@@ -566,4 +566,54 @@
}
}
+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
Modified: scummvm/trunk/engines/cine/texte.h
===================================================================
--- scummvm/trunk/engines/cine/texte.h 2006-11-13 20:58:21 UTC (rev 24713)
+++ scummvm/trunk/engines/cine/texte.h 2006-11-13 21:16:50 UTC (rev 24714)
@@ -50,6 +50,10 @@
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
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list