aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/gob/aniobject.cpp26
-rw-r--r--engines/gob/aniobject.h8
-rw-r--r--engines/gob/minigames/geisha/diving.cpp8
-rw-r--r--engines/gob/minigames/geisha/penetration.cpp12
4 files changed, 32 insertions, 22 deletions
diff --git a/engines/gob/aniobject.cpp b/engines/gob/aniobject.cpp
index 154f8e04ed..54534cd60b 100644
--- a/engines/gob/aniobject.cpp
+++ b/engines/gob/aniobject.cpp
@@ -167,19 +167,21 @@ bool ANIObject::isIn(const ANIObject &obj) const {
obj.isIn(frameX + frameWidth - 1, frameY + frameHeight - 1);
}
-void ANIObject::draw(Surface &dest, int16 &left, int16 &top,
+bool ANIObject::draw(Surface &dest, int16 &left, int16 &top,
int16 &right, int16 &bottom) {
if (!_visible)
- return;
+ return false;
if (_cmp)
- drawCMP(dest, left, top, right, bottom);
+ return drawCMP(dest, left, top, right, bottom);
else if (_ani)
- drawANI(dest, left, top, right, bottom);
+ return drawANI(dest, left, top, right, bottom);
+
+ return false;
}
-void ANIObject::drawCMP(Surface &dest, int16 &left, int16 &top,
+bool ANIObject::drawCMP(Surface &dest, int16 &left, int16 &top,
int16 &right, int16 &bottom) {
if (!_background) {
@@ -209,9 +211,11 @@ void ANIObject::drawCMP(Surface &dest, int16 &left, int16 &top,
top = _backgroundTop;
right = _backgroundRight;
bottom = _backgroundBottom;
+
+ return true;
}
-void ANIObject::drawANI(Surface &dest, int16 &left, int16 &top,
+bool ANIObject::drawANI(Surface &dest, int16 &left, int16 &top,
int16 &right, int16 &bottom) {
if (!_background) {
@@ -224,7 +228,7 @@ void ANIObject::drawANI(Surface &dest, int16 &left, int16 &top,
const ANIFile::Animation &animation = _ani->getAnimationInfo(_animation);
if (_frame >= animation.frameCount)
- return;
+ return false;
const ANIFile::FrameArea &area = animation.frameAreas[_frame];
@@ -244,13 +248,15 @@ void ANIObject::drawANI(Surface &dest, int16 &left, int16 &top,
top = _backgroundTop;
right = _backgroundRight;
bottom = _backgroundBottom;
+
+ return true;
}
-void ANIObject::clear(Surface &dest, int16 &left, int16 &top,
+bool ANIObject::clear(Surface &dest, int16 &left, int16 &top,
int16 &right, int16 &bottom) {
if (!_drawn)
- return;
+ return false;
const int16 bgRight = _backgroundRight - _backgroundLeft;
const int16 bgBottom = _backgroundBottom - _backgroundTop;
@@ -263,6 +269,8 @@ void ANIObject::clear(Surface &dest, int16 &left, int16 &top,
top = _backgroundTop;
right = _backgroundRight;
bottom = _backgroundBottom;
+
+ return true;
}
void ANIObject::advance() {
diff --git a/engines/gob/aniobject.h b/engines/gob/aniobject.h
index c101d747b7..bd4cf791a8 100644
--- a/engines/gob/aniobject.h
+++ b/engines/gob/aniobject.h
@@ -93,9 +93,9 @@ public:
bool lastFrame() const;
/** Draw the current frame onto the surface and return the affected rectangle. */
- void draw(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom);
+ bool draw(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom);
/** Draw the current frame from the surface and return the affected rectangle. */
- void clear(Surface &dest, int16 &left , int16 &top, int16 &right, int16 &bottom);
+ bool clear(Surface &dest, int16 &left , int16 &top, int16 &right, int16 &bottom);
/** Advance the animation to the next frame. */
virtual void advance();
@@ -123,8 +123,8 @@ private:
int16 _backgroundRight; ///< The right position of the saved background.
int16 _backgroundBottom; ///< The bottom position of the saved background.
- void drawCMP(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom);
- void drawANI(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom);
+ bool drawCMP(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom);
+ bool drawANI(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom);
};
} // End of namespace Gob
diff --git a/engines/gob/minigames/geisha/diving.cpp b/engines/gob/minigames/geisha/diving.cpp
index 6f4c6e168a..56c7b5213c 100644
--- a/engines/gob/minigames/geisha/diving.cpp
+++ b/engines/gob/minigames/geisha/diving.cpp
@@ -706,16 +706,16 @@ void Diving::updateAnims() {
for (Common::List<ANIObject *>::iterator a = _anims.reverse_begin();
a != _anims.end(); --a) {
- (*a)->clear(*_vm->_draw->_backSurface, left, top, right, bottom);
- _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom);
+ if ((*a)->clear(*_vm->_draw->_backSurface, left, top, right, bottom))
+ _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom);
}
// Draw the current animation frames
for (Common::List<ANIObject *>::iterator a = _anims.begin();
a != _anims.end(); ++a) {
- (*a)->draw(*_vm->_draw->_backSurface, left, top, right, bottom);
- _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom);
+ if ((*a)->draw(*_vm->_draw->_backSurface, left, top, right, bottom))
+ _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom);
(*a)->advance();
}
diff --git a/engines/gob/minigames/geisha/penetration.cpp b/engines/gob/minigames/geisha/penetration.cpp
index e4e7798216..35802e6733 100644
--- a/engines/gob/minigames/geisha/penetration.cpp
+++ b/engines/gob/minigames/geisha/penetration.cpp
@@ -298,6 +298,8 @@ void Penetration::deinit() {
_objects = 0;
_sprites = 0;
+
+ _sub = 0;
}
void Penetration::createMap() {
@@ -503,14 +505,14 @@ void Penetration::checkShields() {
}
void Penetration::updateAnims() {
- int16 left, top, right, bottom;
+ int16 left = 0, top = 0, right = 0, bottom = 0;
// Clear the previous animation frames
for (Common::List<ANIObject *>::iterator a = _anims.reverse_begin();
a != _anims.end(); --a) {
- (*a)->clear(*_vm->_draw->_backSurface, left, top, right, bottom);
- _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom);
+ if ((*a)->clear(*_vm->_draw->_backSurface, left, top, right, bottom))
+ _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom);
}
if (_mapUpdate) {
@@ -526,8 +528,8 @@ void Penetration::updateAnims() {
for (Common::List<ANIObject *>::iterator a = _anims.begin();
a != _anims.end(); ++a) {
- (*a)->draw(*_vm->_draw->_backSurface, left, top, right, bottom);
- _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom);
+ if ((*a)->draw(*_vm->_draw->_backSurface, left, top, right, bottom))
+ _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom);
(*a)->advance();
}