aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2012-10-24 23:20:26 +1100
committerPaul Gilbert2012-10-24 23:20:26 +1100
commit7441e0e8d78edd8cb8af051fd773b0f998bd9520 (patch)
treee65e5596527fc76c28566f5b049b10b528705875
parent38b5cf1efe0ab75c7100714fb886a704a4661fda (diff)
downloadscummvm-rg350-7441e0e8d78edd8cb8af051fd773b0f998bd9520.tar.gz
scummvm-rg350-7441e0e8d78edd8cb8af051fd773b0f998bd9520.tar.bz2
scummvm-rg350-7441e0e8d78edd8cb8af051fd773b0f998bd9520.zip
HOPKINS: bugfixes to conversation code
-rw-r--r--engines/hopkins/saveload.cpp10
-rw-r--r--engines/hopkins/saveload.h1
-rw-r--r--engines/hopkins/talk.cpp15
3 files changed, 22 insertions, 4 deletions
diff --git a/engines/hopkins/saveload.cpp b/engines/hopkins/saveload.cpp
index ed4e3f1596..1c29eca36f 100644
--- a/engines/hopkins/saveload.cpp
+++ b/engines/hopkins/saveload.cpp
@@ -58,4 +58,14 @@ void SaveLoadManager::initSaves() {
SAUVE_FICHIER(dataFilename, data, 100);
}
+void SaveLoadManager::bload(const Common::String &file, byte *buf) {
+ Common::InSaveFile *f = g_system->getSavefileManager()->openForLoading(file);
+ if (f == NULL)
+ error("Error openinig file - %s", file.c_str());
+
+ int32 filesize = f->size();
+ f->read(buf, filesize);
+ delete f;
+}
+
} // End of namespace Hopkins
diff --git a/engines/hopkins/saveload.h b/engines/hopkins/saveload.h
index d35d529749..4777f33148 100644
--- a/engines/hopkins/saveload.h
+++ b/engines/hopkins/saveload.h
@@ -39,6 +39,7 @@ public:
void initSaves();
bool bsave(const Common::String &file, const void *buf, size_t n);
bool SAUVE_FICHIER(const Common::String &file, const void *buf, size_t n);
+ void bload(const Common::String &file, byte *buf);
};
} // End of namespace Hopkins
diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp
index 1630ce6013..ac49d2a683 100644
--- a/engines/hopkins/talk.cpp
+++ b/engines/hopkins/talk.cpp
@@ -136,8 +136,10 @@ void TalkManager::PARLER_PERSO(const Common::String &filename) {
PERSOSPR = _vm->_globals.LIBERE_FICHIER(PERSOSPR);
_vm->_graphicsManager.NB_SCREEN();
_vm->_globals.NECESSAIRE = 0;
+
_vm->_fileManager.CONSTRUIT_LINUX("TEMP.SCR");
- _vm->_fileManager.bload(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN);
+ _vm->_saveLoadManager.bload(_vm->_globals.NFICHIER, _vm->_graphicsManager.VESA_SCREEN);
+
_vm->_objectsManager.PERSO_ON = 0;
_vm->_eventsManager.btsouris = v14;
@@ -615,7 +617,7 @@ int TalkManager::VERIF_BOITE(int idx, const Common::String &file, int a3) {
int v17;
int v18;
byte *v19;
- byte indexData[16188];
+ uint32 indexData[4047];
Common::String filename;
Common::String dest;
Common::File f;
@@ -624,7 +626,11 @@ int TalkManager::VERIF_BOITE(int idx, const Common::String &file, int a3) {
v18 = 0;
_vm->_globals.police_l = 11;
_vm->_fileManager.CONSTRUIT_FICHIER(_vm->_globals.HOPLINK, file);
+
+ // Build up the filename
filename = dest = _vm->_globals.NFICHIER;
+ while (filename.lastChar() != '.')
+ filename.deleteLastChar();
filename += "IND";
if (!f.open(filename))
@@ -632,13 +638,14 @@ int TalkManager::VERIF_BOITE(int idx, const Common::String &file, int a3) {
filesize = f.size();
assert(filesize < 16188);
- f.read(indexData, filesize);
+ for (int i = 0; i < (filesize / 4); ++i)
+ indexData[i] = f.readUint32LE();
f.close();
if (!f.open(dest))
error("Error opening file - %s", dest.c_str());
- f.seek(READ_LE_UINT32(&indexData[idx * 4]));
+ f.seek(indexData[idx]);
ptr = _vm->_globals.dos_malloc2(2058);
if (ptr == g_PTRNUL)
error("temporary TEXT");