From 81815f0b8a9488e1627d371d07e08ff4ae0521a4 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 8 Mar 2014 18:07:24 +0100 Subject: TUCKER: Change the type of some variables to boolean --- engines/tucker/locations.cpp | 30 +++++++++++++++--------------- engines/tucker/tucker.cpp | 26 +++++++++++++------------- engines/tucker/tucker.h | 8 ++++---- 3 files changed, 32 insertions(+), 32 deletions(-) (limited to 'engines') diff --git a/engines/tucker/locations.cpp b/engines/tucker/locations.cpp index bb75f464ec..c6f727c809 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 e67983109a..1f4d8fa605 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 f798fac20f..639a4d90d3 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; -- cgit v1.2.3