HOPKINS: bugfixes to conversation code

This commit is contained in:
Paul Gilbert 2012-10-24 23:20:26 +11:00
parent 38b5cf1efe
commit 7441e0e8d7
3 changed files with 22 additions and 4 deletions

View File

@ -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

View File

@ -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

View File

@ -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");