aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorlukaslw2014-08-01 00:35:31 +0200
committerlukaslw2014-08-01 00:35:31 +0200
commitb3589c76da856239828377a3011525a888b04920 (patch)
tree0d7cb02349570aa5d5535b50d3a5c928798bbe71 /engines
parent03b6b61d5175c717c4bbfc3e6c0bdadb931d3158 (diff)
downloadscummvm-rg350-b3589c76da856239828377a3011525a888b04920.tar.gz
scummvm-rg350-b3589c76da856239828377a3011525a888b04920.tar.bz2
scummvm-rg350-b3589c76da856239828377a3011525a888b04920.zip
PRINCE: Parallax and animSet loading update
Diffstat (limited to 'engines')
-rw-r--r--engines/prince/hero.cpp4
-rw-r--r--engines/prince/prince.cpp12
-rw-r--r--engines/prince/pscr.cpp14
3 files changed, 14 insertions, 16 deletions
diff --git a/engines/prince/hero.cpp b/engines/prince/hero.cpp
index c139148c82..79a69da471 100644
--- a/engines/prince/hero.cpp
+++ b/engines/prince/hero.cpp
@@ -69,12 +69,12 @@ bool Hero::loadAnimSet(uint32 animSetNr) {
const HeroSetAnimNames &animSet = *heroSetTable[animSetNr];
_moveSet.resize(kMoveSetSize);
- for (uint32 i = 0; i < kMoveSetSize; ++i) {
+ for (uint32 i = 0; i < kMoveSetSize; i++) {
debug("Anim set item %d %s", i, animSet[i]);
Animation *anim = NULL;
if (animSet[i] != NULL) {
anim = new Animation();
- Resource::loadResource(anim, animSet[i], true);
+ Resource::loadResource(anim, animSet[i], false);
}
_moveSet[i] = anim;
}
diff --git a/engines/prince/prince.cpp b/engines/prince/prince.cpp
index 54579820ec..ee96895d31 100644
--- a/engines/prince/prince.cpp
+++ b/engines/prince/prince.cpp
@@ -1739,11 +1739,13 @@ void PrinceEngine::showParallax() {
if (!_pscrList.empty()) {
for (uint i = 0; i < _pscrList.size(); i++) {
Graphics::Surface *pscrSurface = _pscrList[i]->getSurface();
- int x = _pscrList[i]->_x - (_pscrList[i]->_step * _picWindowX / 4);
- int y = _pscrList[i]->_y;
- int z = 1000;
- if (spriteCheck(pscrSurface->w, pscrSurface->h, x, y)) {
- showSprite(pscrSurface, x, y, z);
+ if (pscrSurface != nullptr) {
+ int x = _pscrList[i]->_x - (_pscrList[i]->_step * _picWindowX / 4);
+ int y = _pscrList[i]->_y;
+ int z = 1000;
+ if (spriteCheck(pscrSurface->w, pscrSurface->h, x, y)) {
+ showSprite(pscrSurface, x, y, z);
+ }
}
}
}
diff --git a/engines/prince/pscr.cpp b/engines/prince/pscr.cpp
index ea6de2a5b6..bb4316d465 100644
--- a/engines/prince/pscr.cpp
+++ b/engines/prince/pscr.cpp
@@ -31,15 +31,15 @@
namespace Prince {
-PScr::PScr() :_file(0), _x(0), _y(0), _step(0), _addr(0), _len(0), _surface(NULL)
+PScr::PScr() :_file(0), _x(0), _y(0), _step(0), _addr(0), _len(0), _surface(nullptr)
{
}
PScr::~PScr() {
- if (_surface) {
+ if (_surface != nullptr) {
_surface->free();
delete _surface;
- _surface = NULL;
+ _surface = nullptr;
}
}
@@ -68,14 +68,10 @@ bool PScr::loadFromStream(Common::SeekableReadStream &stream) {
const Common::String pscrStreamName = Common::String::format("PS%02d", _file);
Common::SeekableReadStream *pscrStream = SearchMan.createReadStreamForMember(pscrStreamName);
- if (!pscrStream) {
- error("Can't load %s", pscrStreamName.c_str());
- return false;
+ if (pscrStream != nullptr) {
+ loadSurface(*pscrStream);
}
-
- loadSurface(*pscrStream);
delete pscrStream;
-
stream.seek(pos + 12); // size of PScrList struct
debug("Parallex nr %d, x %d, y %d, step %d", _file, _x, _y, _step);