[Scummvm-cvs-logs] scummvm master -> 81815f0b8a9488e1627d371d07e08ff4ae0521a4

Strangerke Strangerke at scummvm.org
Sat Mar 8 18:09:15 CET 2014


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:
65b819305d TUCKER: Initialize some uninitialized variables
81815f0b8a TUCKER: Change the type of some variables to boolean


Commit: 65b819305d5021cb98bf99459e9bf4e4b9edfc9f
    https://github.com/scummvm/scummvm/commit/65b819305d5021cb98bf99459e9bf4e4b9edfc9f
Author: Strangerke (strangerke at scummvm.org)
Date: 2014-03-08T17:49:53+01:00

Commit Message:
TUCKER: Initialize some uninitialized variables

Changed paths:
    engines/tucker/sequences.cpp
    engines/tucker/tucker.cpp
    engines/tucker/tucker.h



diff --git a/engines/tucker/sequences.cpp b/engines/tucker/sequences.cpp
index cfc3503..b77c166 100644
--- a/engines/tucker/sequences.cpp
+++ b/engines/tucker/sequences.cpp
@@ -492,6 +492,15 @@ AnimationSequencePlayer::AnimationSequencePlayer(OSystem *system, Audio::Mixer *
 	_updateScreenWidth = 0;
 	_updateScreenPicture = false;
 	_picBufPtr = _pic2BufPtr = 0;
+
+	_changeToNextSequence = false;
+	_updateFunc = nullptr;
+	_updateFuncIndex = 0;
+	_updateScreenCounter = 0;
+	_updateScreenIndex = -1;
+	_frameCounter = 0;
+	_frameTime = 0;
+	_lastFrameTime = 1;
 }
 
 AnimationSequencePlayer::~AnimationSequencePlayer() {
diff --git a/engines/tucker/tucker.cpp b/engines/tucker/tucker.cpp
index 130c417..e679831 100644
--- a/engines/tucker/tucker.cpp
+++ b/engines/tucker/tucker.cpp
@@ -43,6 +43,8 @@ namespace Tucker {
 TuckerEngine::TuckerEngine(OSystem *system, Common::Language language, uint32 flags)
 	: Engine(system), _gameLang(language), _gameFlags(flags), _rnd("tucker") {
 	_console = new TuckerConsole(this);
+
+	resetVariables();
 }
 
 TuckerEngine::~TuckerEngine() {
@@ -119,7 +121,7 @@ void TuckerEngine::freeBuffers() {
 	free(_ptTextBuf);
 }
 
-void TuckerEngine::restart() {
+void TuckerEngine::resetVariables() {
 	_quitGame = false;
 	_fastMode = false;
 	_syncCounter = 0;
@@ -326,7 +328,7 @@ void TuckerEngine::restart() {
 
 void TuckerEngine::mainLoop() {
 	allocateBuffers();
-	restart();
+	resetVariables();
 
 	loadCharSizeDta();
 	if ((_gameFlags & kGameFlagDemo) != 0) {
diff --git a/engines/tucker/tucker.h b/engines/tucker/tucker.h
index dc2e785..f798fac 100644
--- a/engines/tucker/tucker.h
+++ b/engines/tucker/tucker.h
@@ -284,7 +284,7 @@ protected:
 	int getRandomNumber();
 	void allocateBuffers();
 	void freeBuffers();
-	void restart();
+	void resetVariables();
 	void mainLoop();
 	void waitForTimer(int ticksCount);
 	void parseEvents();


Commit: 81815f0b8a9488e1627d371d07e08ff4ae0521a4
    https://github.com/scummvm/scummvm/commit/81815f0b8a9488e1627d371d07e08ff4ae0521a4
Author: Strangerke (strangerke at scummvm.org)
Date: 2014-03-08T18:07:24+01:00

Commit Message:
TUCKER: Change the type of some variables to boolean

Changed paths:
    engines/tucker/locations.cpp
    engines/tucker/tucker.cpp
    engines/tucker/tucker.h



diff --git a/engines/tucker/locations.cpp b/engines/tucker/locations.cpp
index bb75f46..c6f727c 100644
--- a/engines/tucker/locations.cpp
+++ b/engines/tucker/locations.cpp
@@ -326,7 +326,7 @@ void TuckerEngine::updateSprite_locationNum3_2(int i) {
 	} else if (_flagsTable[45] == 3) {
 		_flagsTable[45] = 0;
 		num = 16;
-		_updateSpriteFlag2 = 1;
+		_updateSpriteFlag2 = true;
 	} else {
 		_spritesTable[i]._needUpdate = false;
 		++_spritesTable[i]._counter;
@@ -417,7 +417,7 @@ void TuckerEngine::updateSprite_locationNum6_0(int i) {
 			state = 2;
 		} else if (_spritesTable[0]._counter == 0) {
 			setCharacterAnimation(0, 0);
-			_updateSpriteFlag1 = 1;
+			_updateSpriteFlag1 = true;
 			++_spritesTable[0]._counter;
 			return;
 		} else {
@@ -829,7 +829,7 @@ void TuckerEngine::updateSprite_locationNum11_1(int i) {
 		_spritesTable[i]._state = 5;
 	} else {
 		_spritesTable[i]._animationFrame = 14;
-		_updateSpriteFlag1 = 1;
+		_updateSpriteFlag1 = true;
 		_spritesTable[i]._state = 5;
 	}
 }
@@ -840,7 +840,7 @@ void TuckerEngine::updateSprite_locationNum11_2(int i) {
 	} else {
 		_spritesTable[i]._animationFrame = 17;
 		_spritesTable[i]._state = 6;
-		_updateSpriteFlag1 = 1;
+		_updateSpriteFlag1 = true;
 	}
 }
 
@@ -1129,7 +1129,7 @@ void TuckerEngine::updateSprite_locationNum16_0(int i) {
 		} else {
 			state = 1;
 			_spritesTable[0]._animationFrame = 2;
-			_updateSpriteFlag1 = 1;
+			_updateSpriteFlag1 = true;
 		}
 	} else if (_csDataHandled) {
 		_spritesTable[0]._needUpdate = false;
@@ -1863,7 +1863,7 @@ void TuckerEngine::updateSprite_locationNum32_0(int i) {
 	} else if (_flagsTable[222] == 2) {
 		state = 19;
 		_spritesTable[i]._animationFrame = 23;
-		_updateSpriteFlag1 = 1;
+		_updateSpriteFlag1 = true;
 	} else if (_flagsTable[123] == 1) {
 		state = 17;
 		_flagsTable[123] = 2;
@@ -2020,7 +2020,7 @@ void TuckerEngine::execData3PreUpdate_locationNum41() {
 		} else if (_backgroundSpriteCurrentFrame == 7) {
 			_flagsTable[77] = 0;
 		}
-		if (_changeBackgroundSprite == 0) {
+		if (!_changeBackgroundSprite) {
 			if (_backgroundSpriteCurrentFrame == 16 && !isSoundPlaying(4)) {
 				_locationSoundsTable[4].type = 2;
 				startSound(_locationSoundsTable[4].offset, 4, _locationSoundsTable[4].volume);
@@ -2078,7 +2078,7 @@ void TuckerEngine::updateSprite_locationNum42(int i) {
 		state = 5;
 		_spritesTable[i]._updateDelay = 5;
 		_spritesTable[i]._state = _spritesTable[i]._firstFrame - 1; // FIXME: bug, fxNum ?
-		_updateSpriteFlag1 = 1;
+		_updateSpriteFlag1 = true;
 	} else {
 		state = 2;
 	}
@@ -2274,7 +2274,7 @@ void TuckerEngine::updateSprite_locationNum50(int i) {
 	} else {
 		_spritesTable[i]._animationFrame = _spritesTable[i]._firstFrame - 1;
 		_spritesTable[i]._updateDelay = 5;
-		_updateSpriteFlag1 = 1;
+		_updateSpriteFlag1 = true;
 		state = i + 1;
 	}
 	_spritesTable[i]._state = state;
@@ -2394,7 +2394,7 @@ void TuckerEngine::updateSprite_locationNum54(int i) {
 void TuckerEngine::updateSprite_locationNum55(int i) {
 	if (_flagsTable[193] > 0 && _flagsTable[193] < 14) {
 		setCharacterAnimation(_flagsTable[193] - 1, i);
-		_updateSpriteFlag1 = 1;
+		_updateSpriteFlag1 = true;
 		if (_flagsTable[193] == 1 || _flagsTable[193] == 3 || _flagsTable[193] == 5 || _flagsTable[193] == 7 || _flagsTable[193] == 11 || _flagsTable[193] == 13) {
 			++_flagsTable[193];
 		}
@@ -2572,7 +2572,7 @@ void TuckerEngine::updateSprite_locationNum61_0(int i) {
 		} else {
 			state = 2;
 			_spritesTable[0]._animationFrame = 2;
-			_updateSpriteFlag1 = 1;
+			_updateSpriteFlag1 = true;
 		}
 	} else {
 		_spritesTable[i]._needUpdate = false;
@@ -3137,7 +3137,7 @@ void TuckerEngine::updateSprite_locationNum74(int i) {
 		} else {
 			_spritesTable[i]._animationFrame = _spritesTable[i]._firstFrame - 1;
 			_spritesTable[i]._updateDelay = 5;
-			_updateSpriteFlag1 = 1;
+			_updateSpriteFlag1 = true;
 		}
 	}
 	_spritesTable[i]._state = stateTable[num] + i;
@@ -3158,7 +3158,7 @@ void TuckerEngine::updateSprite_locationNum79(int i) {
 	} else {
 		_spritesTable[i]._animationFrame = _spritesTable[i]._firstFrame - 1;
 		_spritesTable[i]._updateDelay = 5;
-		_updateSpriteFlag1 = 1;
+		_updateSpriteFlag1 = true;
 		state = 3;
 	}
 	_spritesTable[i]._state = state;
@@ -3179,7 +3179,7 @@ void TuckerEngine::updateSprite_locationNum81_0(int i) {
 	} else {
 		_spritesTable[i]._animationFrame = _spritesTable[i]._firstFrame - 1;
 		_spritesTable[i]._updateDelay = 5;
-		_updateSpriteFlag1 = 1;
+		_updateSpriteFlag1 = true;
 		state = 2;
 	}
 	_spritesTable[i]._state = state;
@@ -3204,7 +3204,7 @@ void TuckerEngine::updateSprite_locationNum82(int i) {
 	} else {
 		_spritesTable[i]._animationFrame = _spritesTable[i]._firstFrame - 1;
 		_spritesTable[i]._updateDelay = 5;
-		_updateSpriteFlag1 = 1;
+		_updateSpriteFlag1 = true;
 		state = 2;
 	}
 	_spritesTable[i]._state = state;
diff --git a/engines/tucker/tucker.cpp b/engines/tucker/tucker.cpp
index e679831..1f4d8fa 100644
--- a/engines/tucker/tucker.cpp
+++ b/engines/tucker/tucker.cpp
@@ -284,15 +284,15 @@ void TuckerEngine::resetVariables() {
 	_characterBackFrontFacing = _characterPrevBackFrontFacing = 0;
 	_characterAnimationNum = 0;
 	_noCharacterAnimationChange = 0;
-	_changeBackgroundSprite = 0;
 	_characterSpriteAnimationFrameCounter = 0;
 	_locationMaskIgnore = 0;
 	_locationMaskType = 0;
 	_locationMaskCounter = 0;
-	_updateSpriteFlag1 = 0;
-	_updateSpriteFlag2 = 0;
 	_handleMapCounter = 0;
 	_noPositionChangeAfterMap = false;
+	_changeBackgroundSprite = false;
+	_updateSpriteFlag1 = false;
+	_updateSpriteFlag2 = false;
 
 	_mirroredDrawing = 0;
 	_loadLocBufPtr = 0;
@@ -2035,7 +2035,7 @@ void TuckerEngine::updateCharacterAnimation() {
 			++_spriteAnimationFrameIndex;
 		}
 		_characterFacingDirection = 0;
-		if (_changeBackgroundSprite == 1) {
+		if (_changeBackgroundSprite) {
 			if (_backgroundSpriteCurrentFrame == 0) {
 				_backgroundSpriteDataPtr = _sprA02Table[_backgroundSpriteCurrentAnimation];
 				_backgroundSpriteCurrentFrame = _backgroundSpriteLastFrame = READ_LE_UINT16(_backgroundSpriteDataPtr);
@@ -2044,7 +2044,7 @@ void TuckerEngine::updateCharacterAnimation() {
 				if (_backgroundSpriteCurrentFrame < 1) {
 					_backgroundSpriteCurrentAnimation = -1;
 					_backgroundSpriteCurrentFrame = 0;
-					_changeBackgroundSprite = 0;
+					_changeBackgroundSprite = false;
 					if (_nextAction == 0) {
 						setCursorType(0);
 					}
@@ -2310,11 +2310,11 @@ void TuckerEngine::handleMap() {
 				if (_selectedObject.locationObject_toWalkX2 > 800) {
 					_backgroundSpriteCurrentAnimation = _selectedObject.locationObject_toWalkX2 - 900;
 					if (_selectedObject.locationObject_toWalkY2 > 499) {
-						_changeBackgroundSprite = 1;
+						_changeBackgroundSprite = true;
 						_backgroundSprOffset = _selectedObject.locationObject_toWalkY2 - 500;
 					} else {
 						_backgroundSprOffset = _selectedObject.locationObject_toWalkY2;
-						_changeBackgroundSprite = 0;
+						_changeBackgroundSprite = false;
 					}
 					_backgroundSpriteCurrentFrame = 0;
 					_mirroredDrawing = 0;
@@ -2351,10 +2351,10 @@ void TuckerEngine::handleMap() {
 			if (_selectedObject.locationObject_toX2 > 800) {
 				_backgroundSpriteCurrentAnimation = _selectedObject.locationObject_toX2 - 900;
 				if (_selectedObject.locationObject_toY2 > 499) {
-					_changeBackgroundSprite = 1;
+					_changeBackgroundSprite = true;
 					_backgroundSprOffset = _selectedObject.locationObject_toY2 - 500;
 				} else {
-					_changeBackgroundSprite = 0;
+					_changeBackgroundSprite = false;
 					_backgroundSprOffset = _selectedObject.locationObject_toY2;
 				}
 				_backgroundSpriteCurrentFrame = 0;
@@ -2443,8 +2443,8 @@ void TuckerEngine::updateSprite(int i) {
 	_spritesTable[i]._prevState = _spritesTable[i]._state;
 	_spritesTable[i]._prevAnimationFrame = false;
 	_spritesTable[i]._nextAnimationFrame = false;
-	_updateSpriteFlag1 = 0;
-	_updateSpriteFlag2 = 0;
+	_updateSpriteFlag1 = false;
+	_updateSpriteFlag2 = false;
 	_spritesTable[i]._defaultUpdateDelay = 0;
 	_spritesTable[i]._updateDelay = 0;
 	switch (_locationNum) {
@@ -2822,7 +2822,7 @@ void TuckerEngine::updateSprite(int i) {
 		break;
 	}
 	if (_spritesTable[i]._stateIndex <= -1) {
-		if (_updateSpriteFlag1 == 0) {
+		if (!_updateSpriteFlag1) {
 			_spritesTable[i]._animationFrame = 1;
 		}
 		if (_spritesTable[i]._state < 0 || !_sprC02Table[_spritesTable[i]._state]) {
@@ -2831,7 +2831,7 @@ void TuckerEngine::updateSprite(int i) {
 		}
 		_spritesTable[i]._animationData = _sprC02Table[_spritesTable[i]._state];
 		_spritesTable[i]._firstFrame = READ_LE_UINT16(_spritesTable[i]._animationData);
-		if (_updateSpriteFlag2 == 1) {
+		if (_updateSpriteFlag2) {
 			_spritesTable[i]._state = _spritesTable[i]._firstFrame;
 			_spritesTable[i]._nextAnimationFrame = true;
 			_spritesTable[i]._prevAnimationFrame = true;
diff --git a/engines/tucker/tucker.h b/engines/tucker/tucker.h
index f798fac..639a4d9 100644
--- a/engines/tucker/tucker.h
+++ b/engines/tucker/tucker.h
@@ -232,7 +232,7 @@ enum CompressedSoundType {
 class CompressedSound {
 public:
 
-	CompressedSound() : _compressedSoundType(-1) {}
+	CompressedSound() : _compressedSoundType(-1), _compressedSoundFlags(0) {}
 
 	void openFile();
 	void closeFile();
@@ -814,15 +814,15 @@ protected:
 	int _characterPrevBackFrontFacing;
 	int _characterAnimationNum;
 	int _noCharacterAnimationChange;
-	int _changeBackgroundSprite;
 	int _characterSpriteAnimationFrameCounter;
 	int _locationMaskIgnore;
 	int _locationMaskType;
 	int _locationMaskCounter;
-	int _updateSpriteFlag1;
-	int _updateSpriteFlag2;
 	int _handleMapCounter;
 	bool _noPositionChangeAfterMap;
+	bool _changeBackgroundSprite;
+	bool _updateSpriteFlag1;
+	bool _updateSpriteFlag2;
 
 	int _mirroredDrawing;
 	uint8 *_loadLocBufPtr;






More information about the Scummvm-git-logs mailing list