aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2018-05-05 20:47:18 +0200
committerEugene Sandulenko2018-05-05 23:17:35 +0200
commit5515f414afd062b78a60c71fb465e978dfef62ae (patch)
tree8a9f80f0f4b3e7f79b5c9726f63693743aecf4e8
parent85aa17d9ac8c97f0939bdd9380f97c8a71fcd140 (diff)
downloadscummvm-rg350-5515f414afd062b78a60c71fb465e978dfef62ae.tar.gz
scummvm-rg350-5515f414afd062b78a60c71fb465e978dfef62ae.tar.bz2
scummvm-rg350-5515f414afd062b78a60c71fb465e978dfef62ae.zip
PRINCE: Decompress files if they're extracted
-rw-r--r--engines/prince/music.cpp3
-rw-r--r--engines/prince/object.cpp3
-rw-r--r--engines/prince/prince.cpp3
-rw-r--r--engines/prince/pscr.cpp3
-rw-r--r--engines/prince/resource.cpp18
-rw-r--r--engines/prince/script.cpp2
6 files changed, 32 insertions, 0 deletions
diff --git a/engines/prince/music.cpp b/engines/prince/music.cpp
index ca72e9caa0..f1846f925e 100644
--- a/engines/prince/music.cpp
+++ b/engines/prince/music.cpp
@@ -23,6 +23,7 @@
#include "prince/prince.h"
#include "prince/music.h"
#include "prince/musNum.h"
+#include "prince/resource.h"
#include "common/archive.h"
#include "common/debug.h"
@@ -153,6 +154,8 @@ void MusicPlayer::loadMidi(const char *name) {
return;
}
+ stream = Resource::getDecompressedStream(stream);
+
// Stop any currently playing MIDI file
killMidi();
diff --git a/engines/prince/object.cpp b/engines/prince/object.cpp
index e4a3eda689..109d180355 100644
--- a/engines/prince/object.cpp
+++ b/engines/prince/object.cpp
@@ -28,6 +28,7 @@
#include "graphics/surface.h"
#include "prince/object.h"
+#include "prince/resource.h"
namespace Prince {
@@ -73,6 +74,8 @@ bool Object::loadFromStream(Common::SeekableReadStream &stream) {
const Common::String obStreamName = Common::String::format("OB%02d", stream.readUint16LE());
Common::SeekableReadStream *obStream = SearchMan.createReadStreamForMember(obStreamName);
if (obStream) {
+ obStream = Resource::getDecompressedStream(obStream);
+
loadSurface(*obStream);
}
delete obStream;
diff --git a/engines/prince/prince.cpp b/engines/prince/prince.cpp
index a8448a0aed..06cc739bcb 100644
--- a/engines/prince/prince.cpp
+++ b/engines/prince/prince.cpp
@@ -325,6 +325,9 @@ void PrinceEngine::init() {
error("Can't load dialogDatStream");
return;
}
+
+ dialogDatStream = Resource::getDecompressedStream(dialogDatStream);
+
_dialogDatSize = dialogDatStream->size();
_dialogDat = (byte *)malloc(_dialogDatSize);
dialogDatStream->read(_dialogDat, _dialogDatSize);
diff --git a/engines/prince/pscr.cpp b/engines/prince/pscr.cpp
index 4f79704e62..481d17cace 100644
--- a/engines/prince/pscr.cpp
+++ b/engines/prince/pscr.cpp
@@ -24,6 +24,7 @@
#include "common/stream.h"
#include "prince/pscr.h"
+#include "prince/resource.h"
namespace Prince {
@@ -64,6 +65,8 @@ bool PScr::loadFromStream(Common::SeekableReadStream &stream) {
const Common::String pscrStreamName = Common::String::format("PS%02d", file);
Common::SeekableReadStream *pscrStream = SearchMan.createReadStreamForMember(pscrStreamName);
if (pscrStream != nullptr) {
+ pscrStream = Resource::getDecompressedStream(pscrStream);
+
loadSurface(*pscrStream);
}
delete pscrStream;
diff --git a/engines/prince/resource.cpp b/engines/prince/resource.cpp
index 96a831cdfb..96e7dce735 100644
--- a/engines/prince/resource.cpp
+++ b/engines/prince/resource.cpp
@@ -203,6 +203,8 @@ bool PrinceEngine::loadAnim(uint16 animNr, bool loop) {
return false;
}
+ flicStream = Resource::getDecompressedStream(flicStream);
+
if (!_flicPlayer.loadStream(flicStream)) {
error("Can't load flic stream %s", streamName.c_str());
}
@@ -220,6 +222,8 @@ bool PrinceEngine::loadZoom(byte *zoomBitmap, uint32 dataSize, const char *resou
delete stream;
return false;
}
+ stream = Resource::getDecompressedStream(stream);
+
if (stream->read(zoomBitmap, dataSize) != dataSize) {
free(zoomBitmap);
delete stream;
@@ -236,6 +240,8 @@ bool PrinceEngine::loadShadow(byte *shadowBitmap, uint32 dataSize, const char *r
return false;
}
+ stream = Resource::getDecompressedStream(stream);
+
if (stream->read(shadowBitmap, dataSize) != dataSize) {
free(shadowBitmap);
delete stream;
@@ -249,6 +255,8 @@ bool PrinceEngine::loadShadow(byte *shadowBitmap, uint32 dataSize, const char *r
return false;
}
+ stream2 = Resource::getDecompressedStream(stream2);
+
byte *shadowBitmap2 = shadowBitmap + dataSize;
if (stream2->read(shadowBitmap2, dataSize) != dataSize) {
free(shadowBitmap);
@@ -273,6 +281,9 @@ bool PrinceEngine::loadTrans(byte *transTable, const char *resourceName) {
}
return true;
}
+
+ stream = Resource::getDecompressedStream(stream);
+
if (stream->read(transTable, kTransTableSize) != kTransTableSize) {
delete stream;
return false;
@@ -287,6 +298,9 @@ bool PrinceEngine::loadPath(const char *resourceName) {
delete stream;
return false;
}
+
+ stream = Resource::getDecompressedStream(stream);
+
if (stream->read(_roomPathBitmap, kPathBitmapLen) != kPathBitmapLen) {
delete stream;
return false;
@@ -306,6 +320,8 @@ bool PrinceEngine::loadAllInv() {
return true;
}
+ invStream = Resource::getDecompressedStream(invStream);
+
tempInvItem._x = invStream->readUint16LE();
tempInvItem._y = invStream->readUint16LE();
int width = invStream->readUint16LE();
@@ -331,6 +347,8 @@ bool PrinceEngine::loadMobPriority(const char *resourceName) {
return false;
}
+ stream = Resource::getDecompressedStream(stream);
+
_mobPriorityList.clear();
uint mobId;
while (1) {
diff --git a/engines/prince/script.cpp b/engines/prince/script.cpp
index 7d8f8344b5..e40492fe27 100644
--- a/engines/prince/script.cpp
+++ b/engines/prince/script.cpp
@@ -391,6 +391,8 @@ bool Script::loadAllMasks(Common::Array<Mask> &maskList, int offset) {
debug("Can't load %s", msStreamName.c_str());
delete msStream;
} else {
+ msStream = Resource::getDecompressedStream(msStream);
+
int32 dataSize = msStream->size();
if (dataSize != -1) {
tempMask._data = (byte *)malloc(dataSize);