[Scummvm-cvs-logs] SF.net SVN: scummvm: [22954] scummvm/trunk/engines/gob

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Tue Jun 6 17:43:54 CEST 2006


Revision: 22954
Author:   drmccoy
Date:     2006-06-06 08:43:44 -0700 (Tue, 06 Jun 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=22954&view=rev

Log Message:
-----------
Two segfault and several coding style related fixes

Modified Paths:
--------------
    scummvm/trunk/engines/gob/draw.cpp
    scummvm/trunk/engines/gob/draw_v2.cpp
    scummvm/trunk/engines/gob/game.cpp
    scummvm/trunk/engines/gob/game_v1.cpp
    scummvm/trunk/engines/gob/game_v2.cpp
    scummvm/trunk/engines/gob/goblin.cpp
    scummvm/trunk/engines/gob/inter_v2.cpp
    scummvm/trunk/engines/gob/mult_v2.cpp
Modified: scummvm/trunk/engines/gob/draw.cpp
===================================================================
--- scummvm/trunk/engines/gob/draw.cpp	2006-06-06 15:39:58 UTC (rev 22953)
+++ scummvm/trunk/engines/gob/draw.cpp	2006-06-06 15:43:44 UTC (rev 22954)
@@ -667,7 +667,7 @@
 
 void Draw::drawString(char *str, int16 x, int16 y, int16 color1, int16 color2,
 		int16 transp, Video::SurfaceDesc *dest, Video::FontDesc *font) {
-	while(*str != '\0') {
+	while (*str != '\0') {
 		_vm->_video->drawLetter(*str, x, y, font, transp, color1, color2, dest);
 		if (font->extraData == 0)
 			x += font->itemWidth;

Modified: scummvm/trunk/engines/gob/draw_v2.cpp
===================================================================
--- scummvm/trunk/engines/gob/draw_v2.cpp	2006-06-06 15:39:58 UTC (rev 22953)
+++ scummvm/trunk/engines/gob/draw_v2.cpp	2006-06-06 15:43:44 UTC (rev 22954)
@@ -144,7 +144,7 @@
 		if ((_vm->_game->_totFileData[0x29] < 0x32) && (*ptr2 > 3) && (*ptr2 < 32))
 			*ptr2 = 32;
 
-		switch(*ptr2) {
+		switch (*ptr2) {
 		case 1:
 			break;
 
@@ -202,7 +202,7 @@
 	_backColor = 0;
 	_transparency = 1;
 	
-	while(true) {
+	while (true) {
 		if ((*ptr >= 1) && ((*ptr <= 7) || (*ptr == 10)) && (strPos != 0)) {
 			str[MAX(strPos, strPos2)] = 0;
 			strPosBak = strPos;
@@ -352,7 +352,7 @@
 			if (cmd == 0) {
 				val = READ_LE_UINT16(ptr2 + 18) * 4;
 				sprintf(buf, "%d",  VAR_OFFSET(val));
-			} else if(cmd == 1) {
+			} else if (cmd == 1) {
 				val = READ_LE_UINT16(ptr2 + 18) * 4;
 				strcpy(buf, _vm->_global->_inter_variables + val);
 			} else {

Modified: scummvm/trunk/engines/gob/game.cpp
===================================================================
--- scummvm/trunk/engines/gob/game.cpp	2006-06-06 15:39:58 UTC (rev 22953)
+++ scummvm/trunk/engines/gob/game.cpp	2006-06-06 15:43:44 UTC (rev 22954)
@@ -404,7 +404,10 @@
 
 	if (_soundADL[slot]) {
 		_vm->_music->stopPlay();
-		delete[] ((char *) _soundSamples[slot]);
+		if (_soundFromExt[slot] == 1) {
+			delete[] ((char *) _soundSamples[slot]);
+			_soundFromExt[slot] = 0;
+		}
 	} else {
 		char* data = _soundSamples[slot]->data;
 
@@ -2013,7 +2016,7 @@
 			delete imdPtr;
 			return 0;
 		}
-		if(imdPtr->stdX != 0) {
+		if (imdPtr->stdX != 0) {
 			_vm->_dataio->readData(handle, buf, 8);
 			imdPtr->stdX = READ_LE_UINT16(buf);
 			imdPtr->stdY = READ_LE_UINT16(buf + 2);
@@ -2401,7 +2404,7 @@
 			}
 		} else
 			retVal |= 0x800;
-	} while(var_4 != 0);
+	} while (var_4 != 0);
 
 	if (byte_2DA60 != 0) {
 		byte_2DA60 = 0;
@@ -2567,7 +2570,7 @@
 	chunkCount = 1;
 	chunkBitField = 0;
 
-	while(frameLength > 0) {
+	while (frameLength > 0) {
 		chunkCount--;
 		if (chunkCount == 0) {
 			tmp = *src++;

Modified: scummvm/trunk/engines/gob/game_v1.cpp
===================================================================
--- scummvm/trunk/engines/gob/game_v1.cpp	2006-06-06 15:39:58 UTC (rev 22953)
+++ scummvm/trunk/engines/gob/game_v1.cpp	2006-06-06 15:43:44 UTC (rev 22954)
@@ -80,7 +80,7 @@
 				_vm->_draw->_fontToSprite[i].height = -1;
 			}
 
-			if(_vm->_features & GF_MAC)
+			if (_vm->_features & GF_MAC)
 				_vm->_music->stopPlay();
 			else
 				_vm->_cdrom->stopPlaying();

Modified: scummvm/trunk/engines/gob/game_v2.cpp
===================================================================
--- scummvm/trunk/engines/gob/game_v2.cpp	2006-06-06 15:39:58 UTC (rev 22953)
+++ scummvm/trunk/engines/gob/game_v2.cpp	2006-06-06 15:43:44 UTC (rev 22954)
@@ -80,7 +80,7 @@
 				_vm->_draw->_fontToSprite[i].height = -1;
 			}
 
-			if(_vm->_features & GF_MAC)
+			if (_vm->_features & GF_MAC)
 				_vm->_music->stopPlay();
 			else
 				_vm->_cdrom->stopPlaying();
@@ -481,14 +481,14 @@
 					cursorRight = _vm->_global->_inter_mouseX + _vm->_draw->_cursorWidth;
 					if (cursorRight > (_word_2FC9E + sWidth))
 						_word_2FC9E = MIN(cursorRight - sWidth, width - sWidth);
-				} else if(_vm->_global->_inter_mouseX < _word_2FC9E)
+				} else if (_vm->_global->_inter_mouseX < _word_2FC9E)
 					_word_2FC9E = _vm->_global->_inter_mouseX;
 				height = _vm->_draw->_frontSurface->height;
 				if ((height > sHeight) && (_vm->_global->_inter_mouseY >= _word_2FC9C)) {
 					cursorBottom = _vm->_global->_inter_mouseY + _vm->_draw->_cursorHeight;
 					if (cursorBottom > (_word_2FC9C + sHeight))
 						_word_2FC9C = MIN(cursorBottom - sHeight, height - sHeight);
-				} else if(_vm->_global->_inter_mouseY < _word_2FC9C)
+				} else if (_vm->_global->_inter_mouseY < _word_2FC9C)
 					_word_2FC9C = _vm->_global->_inter_mouseY;
 				if ((oldWord_2FC9E != _word_2FC9E) || (oldWord_2FC9C != _word_2FC9C)) {
 					if (_byte_2FC9B == 0) {
@@ -499,7 +499,7 @@
 							if ((_vm->_global->_inter_mouseX + _vm->_draw->_cursorWidth) >
 									(_word_2FC9E + sWidth))
 								_vm->_global->_inter_mouseX = _word_2FC9E + sWidth - _vm->_draw->_cursorWidth;
-						} else if(_vm->_global->_inter_mouseX < oldWord_2FC9E)
+						} else if (_vm->_global->_inter_mouseX < oldWord_2FC9E)
 							_vm->_global->_inter_mouseX = oldWord_2FC9E;
 
 						if ((_vm->_draw->_frontSurface->height > sHeight) && 
@@ -507,7 +507,7 @@
 							if ((_vm->_global->_inter_mouseY + _vm->_draw->_cursorHeight) >
 									(_word_2FC9C + sHeight))
 								_vm->_global->_inter_mouseY = _word_2FC9C + sHeight - _vm->_draw->_cursorHeight;
-						} else if(_vm->_global->_inter_mouseY < oldWord_2FC9E)
+						} else if (_vm->_global->_inter_mouseY < oldWord_2FC9E)
 							_vm->_global->_inter_mouseY = _word_2FC9C;
 					} else {
 						if (oldWord_2FC9E > _word_2FC9E) {

Modified: scummvm/trunk/engines/gob/goblin.cpp
===================================================================
--- scummvm/trunk/engines/gob/goblin.cpp	2006-06-06 15:39:58 UTC (rev 22953)
+++ scummvm/trunk/engines/gob/goblin.cpp	2006-06-06 15:43:44 UTC (rev 22954)
@@ -1821,6 +1821,7 @@
 
 void Goblin::freeAllObjects(void) {
 	_vm->_util->deleteList(_objList);
+	_objList = 0;
 	freeObjects();
 }
 
@@ -2347,7 +2348,7 @@
 			anim0->field_10 = 6;
 	}
 	if (anim1->someFlag == 0) {
-		if((_word_2F9BA == 0) && (anim1->isStatic == 0)) {
+		if ((_word_2F9BA == 0) && (anim1->isStatic == 0)) {
 			if ((VAR(_dword_2F9B2) == 0) && (di == 28)) {
 				di = _vm->_util->getRandom(3) + 24;
 				warning("GOB2 Stub! sub_195C7(1, di);");
@@ -2369,7 +2370,7 @@
 	if (VAR(18) != ((uint32) -1)) {
 		if (anim0->layer == 44)
 			anim0->field_10 = 4;
-		else if(anim0->layer == 45)
+		else if (anim0->layer == 45)
 			anim0->field_10 = 0;
 		if (anim0->someFlag == 0)
 			anim0->field_10 = 6;
@@ -2377,7 +2378,7 @@
 	if (VAR(19) != ((uint32) -1)) {
 		if (anim1->layer == 48)
 			anim1->field_10 = 4;
-		else if(anim1->layer == 49)
+		else if (anim1->layer == 49)
 			anim1->field_10 = 0;
 		if (anim1->someFlag == 0)
 			anim1->field_10 = 6;

Modified: scummvm/trunk/engines/gob/inter_v2.cpp
===================================================================
--- scummvm/trunk/engines/gob/inter_v2.cpp	2006-06-06 15:39:58 UTC (rev 22953)
+++ scummvm/trunk/engines/gob/inter_v2.cpp	2006-06-06 15:43:44 UTC (rev 22954)
@@ -1253,7 +1253,7 @@
 
 	cmd = *_vm->_global->_inter_execPtr++;
 
-	switch(cmd & 0x7f) {
+	switch (cmd & 0x7f) {
 	case 48:
 		if ((_vm->_global->_videoMode < 0x32) || (_vm->_global->_videoMode > 0x63)) {
 			_vm->_global->_inter_execPtr += 48;
@@ -1325,7 +1325,7 @@
 		int dl = 0;
 		for (i = 2; i < 18; i++) {
 			dl = 1;
-			if(_vm->_global->_inter_execPtr[i] != 0)
+			if (_vm->_global->_inter_execPtr[i] != 0)
 				dl = 0;
 		}
 		if (dl != 0) {

Modified: scummvm/trunk/engines/gob/mult_v2.cpp
===================================================================
--- scummvm/trunk/engines/gob/mult_v2.cpp	2006-06-06 15:39:58 UTC (rev 22953)
+++ scummvm/trunk/engines/gob/mult_v2.cpp	2006-06-06 15:43:44 UTC (rev 22954)
@@ -1236,7 +1236,7 @@
 						animData1->frame++;
 					if (animData1->frame >=
 							_vm->_scenery->_animations[(int)animData1->animation].layers[animData1->layer]->framesCount) {
-						switch(animData1->animType) {
+						switch (animData1->animType) {
 						case 0:
 							animData1->frame = 0;
 							break;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.





More information about the Scummvm-git-logs mailing list