[Scummvm-cvs-logs] scummvm master -> 3e6f031fc56b982331e940a1eb7c5496d030ac1d

athrxx athrxx at scummvm.org
Mon Jun 13 12:41:05 CEST 2011


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:
afb1b3d8d3 SCUMM: fix engine destructor
3e6f031fc5 SCUMM: some cleanup in gfx_towns.cpp


Commit: afb1b3d8d38c32f4a50c1033cec00cc859917463
    https://github.com/scummvm/scummvm/commit/afb1b3d8d38c32f4a50c1033cec00cc859917463
Author: athrxx (athrxx at scummvm.org)
Date: 2011-06-12T18:02:59-07:00

Commit Message:
SCUMM: fix engine destructor

(This is relevant for cases where the engine errors out early, before certain arrays get initialized).

Changed paths:
    engines/scumm/scumm.cpp



diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index 36caff4..dd26e23 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -162,7 +162,7 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr)
 	_pauseDialog = NULL;
 	_versionDialog = NULL;
 	_fastMode = 0;
-	_actors = NULL;
+	_actors = _sortedActors = NULL;
 	_arraySlot = NULL;
 	_inventory = NULL;
 	_newNames = NULL;
@@ -584,9 +584,12 @@ ScummEngine::~ScummEngine() {
 
 	_mixer->stopAll();
 
-	for (int i = 0; i < _numActors; ++i)
-		delete _actors[i];
-	delete[] _actors;
+	if (_actors) {
+		for (int i = 0; i < _numActors; ++i)
+			delete _actors[i];
+		delete[] _actors;
+	}
+	
 	delete[] _sortedActors;
 
 	delete[] _2byteFontPtr;
@@ -1361,6 +1364,7 @@ void ScummEngine::resetScumm() {
 #ifdef USE_RGB_COLOR
 	if (_game.features & GF_16BIT_COLOR
 #ifndef DISABLE_TOWNS_DUAL_LAYER_MODE
+
 		|| _game.platform == Common::kPlatformFMTowns
 #endif
 		)


Commit: 3e6f031fc56b982331e940a1eb7c5496d030ac1d
    https://github.com/scummvm/scummvm/commit/3e6f031fc56b982331e940a1eb7c5496d030ac1d
Author: athrxx (athrxx at scummvm.org)
Date: 2011-06-13T03:39:15-07:00

Commit Message:
SCUMM: some cleanup in gfx_towns.cpp

Changed paths:
    engines/scumm/gfx_towns.cpp



diff --git a/engines/scumm/gfx_towns.cpp b/engines/scumm/gfx_towns.cpp
index 82bb32c..10d6ee0 100644
--- a/engines/scumm/gfx_towns.cpp
+++ b/engines/scumm/gfx_towns.cpp
@@ -248,7 +248,7 @@ void TownsScreen::setupLayer(int layer, int width, int height, int numCol, void
 	l->palette = (uint8*)pal;
 
 	if (l->palette && _bpp == 1)
-		warning("TownsScreen::setupLayer(): Layer palette usage requires 15 bit graphics setting.\nLayer palette will be ignored.");
+		warning("TownsScreen::setupLayer(): Layer palette usage requires 16 bit graphics setting.\nLayer palette will be ignored.");
 
 	delete[] l->pixels;
 	l->pixels = new uint8[l->pitch * l->height];
@@ -270,7 +270,8 @@ void TownsScreen::setupLayer(int layer, int width, int height, int numCol, void
 	l->bltTmpPal = (l->bpp == 1 && _bpp == 2) ? new uint16[l->numCol] : 0;
 	
 	l->enabled = true;
-	l->onBottom = (!layer || !_layers[0].enabled);
+	_layers[0].onBottom = true;
+	_layers[1].onBottom = _layers[0].enabled ? false : true;
 	l->ready = true;
 }
 	
@@ -420,10 +421,10 @@ void TownsScreen::toggleLayers(int flag) {
 	if (flag < 0 || flag > 3)
 		return;
 
-	for (int i = 0; i < 2; ++i) {
-		_layers[i].enabled = (flag & (i + 1)) ? true : false;
-		_layers[i].onBottom = (!i || !_layers[0].enabled);
-	}
+	_layers[0].enabled = (flag & 1) ? true : false;
+	_layers[0].onBottom = true;
+	_layers[1].enabled = (flag & 2) ? true : false;
+	_layers[1].onBottom = _layers[0].enabled ? false : true;
 
 	_dirtyRects.clear();
 	_dirtyRects.push_back(Common::Rect(_width - 1, _height - 1));
@@ -458,12 +459,12 @@ void TownsScreen::updateOutputBuffer() {
 
 			for (int y = r->top; y <= r->bottom; ++y) {
 				if (l->bpp == _bpp && l->scaleW == 1 && l->onBottom) {
-					memcpy(dst, l->bltInternY[y] + l->bltInternX[r->left], (r->right + 1 - r->left) * _bpp);
+					memcpy(dst, &l->bltInternY[y][l->bltInternX[r->left]], (r->right + 1 - r->left) * _bpp);
 					dst += _pitch;
 
 				} else if (_bpp == 2) {
 					for (int x = r->left; x <= r->right; ++x) {
-						uint8 *src = l->bltInternY[y] + l->bltInternX[x];
+						uint8 *src = &l->bltInternY[y][l->bltInternX[x]];
 						if (l->bpp == 1) {
 							uint8 col = *src;
 							if (col || l->onBottom) {
@@ -480,7 +481,7 @@ void TownsScreen::updateOutputBuffer() {
 
 				} else {
 					for (int x = r->left; x <= r->right; ++x) {
-						uint8 col = *(l->bltInternY[y] + l->bltInternX[x]);
+						uint8 col = l->bltInternY[y][l->bltInternX[x]];
 						if (col || l->onBottom) {
 							if (l->numCol == 16)
 								col = (col >> 4) & (col & 0x0f);						






More information about the Scummvm-git-logs mailing list