[Scummvm-cvs-logs] scummvm master -> db99d23717ce4f39f9d9f55ce1abf0d8b73cc630

DrMcCoy drmccoy at drmccoy.de
Sun Jun 3 18:59:03 CEST 2012


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
d124b87649 GOB: Remove unnecessary include
db99d23717 GOB: Fix invalid reads in Geisha's minigames


Commit: d124b87649c14e1851228821fcb6d3a523f1e0ae
    https://github.com/scummvm/scummvm/commit/d124b87649c14e1851228821fcb6d3a523f1e0ae
Author: Sven Hesse (drmccoy at users.sourceforge.net)
Date: 2012-06-03T08:15:18-07:00

Commit Message:
GOB: Remove unnecessary include

A remnant of when we were still doing dithering color LUT
creation at startup

Changed paths:
    engines/gob/video.cpp



diff --git a/engines/gob/video.cpp b/engines/gob/video.cpp
index c865b2b..3b1c642 100644
--- a/engines/gob/video.cpp
+++ b/engines/gob/video.cpp
@@ -25,7 +25,6 @@
 #include "engines/util.h"
 
 #include "graphics/cursorman.h"
-#include "graphics/fontman.h"
 #include "graphics/palette.h"
 #include "graphics/surface.h"
 


Commit: db99d23717ce4f39f9d9f55ce1abf0d8b73cc630
    https://github.com/scummvm/scummvm/commit/db99d23717ce4f39f9d9f55ce1abf0d8b73cc630
Author: Sven Hesse (drmccoy at users.sourceforge.net)
Date: 2012-06-03T09:58:03-07:00

Commit Message:
GOB: Fix invalid reads in Geisha's minigames

Changed paths:
    engines/gob/aniobject.cpp
    engines/gob/aniobject.h
    engines/gob/minigames/geisha/diving.cpp
    engines/gob/minigames/geisha/penetration.cpp



diff --git a/engines/gob/aniobject.cpp b/engines/gob/aniobject.cpp
index 154f8e0..54534cd 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 c101d74..bd4cf79 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 6f4c6e1..56c7b52 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 e4e7798..35802e6 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();
 	}






More information about the Scummvm-git-logs mailing list