aboutsummaryrefslogtreecommitdiff
path: root/engines/gob/inter_playtoons.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/gob/inter_playtoons.cpp')
-rw-r--r--engines/gob/inter_playtoons.cpp26
1 files changed, 11 insertions, 15 deletions
diff --git a/engines/gob/inter_playtoons.cpp b/engines/gob/inter_playtoons.cpp
index befed4b1c2..05032d712c 100644
--- a/engines/gob/inter_playtoons.cpp
+++ b/engines/gob/inter_playtoons.cpp
@@ -24,12 +24,12 @@
*/
#include "common/endian.h"
+#include "common/str.h"
#include "gui/message.h"
#include "gob/gob.h"
#include "gob/inter.h"
-#include "gob/helper.h"
#include "gob/global.h"
#include "gob/util.h"
#include "gob/dataio.h"
@@ -246,10 +246,10 @@ bool Inter_Playtoons::oPlaytoons_checkData(OpFuncParams &params) {
mode = _vm->_saveLoad->getSaveMode(file);
if (mode == SaveLoad::kSaveModeNone) {
- if (_vm->_dataIO->existData(file))
- size = _vm->_dataIO->getDataSize(file);
- else
+ size = _vm->_dataIO->fileSize(file);
+ if (size == -1)
warning("File \"%s\" not found", file);
+
} else if (mode == SaveLoad::kSaveModeSave)
size = _vm->_saveLoad->getSize(file);
else if (mode == SaveLoad::kSaveModeExists)
@@ -272,7 +272,6 @@ bool Inter_Playtoons::oPlaytoons_readData(OpFuncParams &params) {
int32 size;
int32 offset;
uint16 dataVar;
- int16 handle;
byte *buf;
SaveLoad::SaveMode mode;
@@ -329,13 +328,10 @@ bool Inter_Playtoons::oPlaytoons_readData(OpFuncParams &params) {
}
WRITE_VAR(1, 1);
- handle = _vm->_dataIO->openData(file);
-
- if (handle < 0)
+ Common::SeekableReadStream *stream = _vm->_dataIO->getFile(file);
+ if (!stream)
return false;
- DataStream *stream = _vm->_dataIO->openAsStream(handle, true);
-
_vm->_draw->animateCursor(4);
if (offset < 0)
stream->seek(offset + 1, SEEK_END);
@@ -415,9 +411,9 @@ void Inter_Playtoons::oPlaytoons_copyFile() {
char fileName2[128];
_vm->_game->_script->evalExpr(0);
- strncpy0(fileName1, _vm->_game->_script->getResultStr(), 127);
+ Common::strlcpy(fileName1, _vm->_game->_script->getResultStr(), 128);
_vm->_game->_script->evalExpr(0);
- strncpy0(fileName2, _vm->_game->_script->getResultStr(), 127);
+ Common::strlcpy(fileName2, _vm->_game->_script->getResultStr(), 128);
warning("Playtoons Stub: copy file from \"%s\" to \"%s\"", fileName1, fileName2);
}
@@ -427,7 +423,7 @@ void Inter_Playtoons::oPlaytoons_openItk() {
char *backSlash;
_vm->_game->_script->evalExpr(0);
- strncpy0(fileName, _vm->_game->_script->getResultStr(), 124);
+ Common::strlcpy(fileName, _vm->_game->_script->getResultStr(), 124);
if (!strchr(fileName, '.'))
strcat(fileName, ".ITK");
@@ -435,9 +431,9 @@ void Inter_Playtoons::oPlaytoons_openItk() {
// Workaround for Bambou : In the script, the path is hardcoded (!!)
if ((backSlash = strrchr(fileName, '\\'))) {
debugC(2, kDebugFileIO, "Opening ITK file \"%s\" instead of \"%s\"", backSlash + 1, fileName);
- _vm->_dataIO->openDataFile(backSlash + 1, true);
+ _vm->_dataIO->openArchive(backSlash + 1, false);
} else
- _vm->_dataIO->openDataFile(fileName, true);
+ _vm->_dataIO->openArchive(fileName, false);
// All the other checks are meant to verify (if not found at the first try)
// if the file is present on the CD or not. As everything is supposed to
// be copied, those checks are skipped