diff options
-rw-r--r-- | engines/tucker/locations.cpp | 10 | ||||
-rw-r--r-- | engines/tucker/resource.cpp | 2 | ||||
-rw-r--r-- | engines/tucker/tucker.cpp | 106 | ||||
-rw-r--r-- | engines/tucker/tucker.h | 16 |
4 files changed, 67 insertions, 67 deletions
diff --git a/engines/tucker/locations.cpp b/engines/tucker/locations.cpp index 4601d11b10..b5fb10c59e 100644 --- a/engines/tucker/locations.cpp +++ b/engines/tucker/locations.cpp @@ -1589,7 +1589,7 @@ void TuckerEngine::updateSprite_locationNum24_3(int i) { } void TuckerEngine::execData3PreUpdate_locationNum24() { - _characterPrevBackFrontFacing = 0; + _characterPrevBackFrontFacing = false; if (_flagsTable[112] == 0) { _yPosCurrent = 132; _xPosCurrent = 112; @@ -1640,7 +1640,7 @@ void TuckerEngine::updateSprite_locationNum26_1(int i) { } void TuckerEngine::execData3PreUpdate_locationNum26() { - _characterPrevBackFrontFacing = 1; + _characterPrevBackFrontFacing = true; _spritesTable[1]._gfxBackgroundOffset = _flagsTable[125]; _spritesTable[0]._gfxBackgroundOffset = _flagsTable[125]; if (_flagsTable[125] > 0 && _flagsTable[125] < 300) { @@ -1688,7 +1688,7 @@ void TuckerEngine::updateSprite_locationNum27(int i) { } void TuckerEngine::execData3PreUpdate_locationNum27() { - _characterPrevBackFrontFacing = 0; + _characterPrevBackFrontFacing = false; } void TuckerEngine::execData3PostUpdate_locationNum27() { @@ -3132,8 +3132,8 @@ void TuckerEngine::updateSprite_locationNum74(int i) { static const uint8 stateTable[] = { 1, 3, 5, 5, 10, 16, 16 }; int num = _flagsTable[236] - 74; if (stateTable[num] + i == 21) { - if (_updateLocationFlag == 0) { - _updateLocationFlag = 1; + if (!_updateLocationFlag) { + _updateLocationFlag = true; } else { _spritesTable[i]._animationFrame = _spritesTable[i]._firstFrame - 1; _spritesTable[i]._updateDelay = 5; diff --git a/engines/tucker/resource.cpp b/engines/tucker/resource.cpp index 31a34cd5f5..c8ed0737f9 100644 --- a/engines/tucker/resource.cpp +++ b/engines/tucker/resource.cpp @@ -1031,7 +1031,7 @@ void TuckerEngine::loadActionsTable() { _panelState = 0; setCursorType(0); _csDataHandled = false; - _actionVerbLocked = 0; + _actionVerbLocked = false; _mouseClick = 1; } } diff --git a/engines/tucker/tucker.cpp b/engines/tucker/tucker.cpp index ae8a39cedf..64908bdb5c 100644 --- a/engines/tucker/tucker.cpp +++ b/engines/tucker/tucker.cpp @@ -227,7 +227,7 @@ void TuckerEngine::resetVariables() { _actionObj1Type = _actionObj2Type = 0; _actionObj1Num = _actionObj2Num = 0; _actionRequiresTwoObjects = false; - _actionVerbLocked = 0; + _actionVerbLocked = false; _actionPosX = 0; _actionPosY = 0; _selectedObjectLocationMask = false; @@ -253,7 +253,7 @@ void TuckerEngine::resetVariables() { _tableInstructionsPtr = nullptr; memset(_tableInstructionObj1Table, 0, sizeof(_tableInstructionObj1Table)); memset(_tableInstructionObj2Table, 0, sizeof(_tableInstructionObj2Table)); - _tableInstructionFlag = 0; + _tableInstructionFlag = false; _tableInstructionItemNum1 = _tableInstructionItemNum2 = 0; memset(_instructionsActionsTable, 0, sizeof(_instructionsActionsTable)); _validInstructionId = false; @@ -282,11 +282,11 @@ void TuckerEngine::resetVariables() { _currentSpriteAnimationFrame2 = 0; _characterAnimationIndex = -1; _characterFacingDirection = _characterPrevFacingDirection = 0; - _characterBackFrontFacing = _characterPrevBackFrontFacing = 0; + _characterBackFrontFacing = _characterPrevBackFrontFacing = false; _characterAnimationNum = 0; _noCharacterAnimationChange = 0; _characterSpriteAnimationFrameCounter = 0; - _locationMaskIgnore = 0; + _locationMaskIgnore = false; _locationMaskType = 0; _locationMaskCounter = 0; _handleMapCounter = 0; @@ -295,7 +295,7 @@ void TuckerEngine::resetVariables() { _updateSpriteFlag1 = false; _updateSpriteFlag2 = false; - _mirroredDrawing = 0; + _mirroredDrawing = false; _loadLocBufPtr = nullptr; _backgroundSpriteDataPtr = nullptr; _locationHeight = 0; @@ -322,7 +322,7 @@ void TuckerEngine::resetVariables() { memset(_updateLocation14ObjNum, 0, sizeof(_updateLocation14ObjNum)); memset(_updateLocation14Delay, 0, sizeof(_updateLocation14Delay)); _updateLocationCounter2 = 0; - _updateLocationFlag = 0; + _updateLocationFlag = false; _updateLocation70StringLen = 0; memset(_updateLocation70String, 0, sizeof(_updateLocation70String)); } @@ -692,8 +692,8 @@ void TuckerEngine::setupNewLocation() { _mainLoopCounter2 = 0; _mainLoopCounter1 = 0; _characterFacingDirection = 0; - _actionVerbLocked = 0; - _locationMaskIgnore = 0; + _actionVerbLocked = false; + _locationMaskIgnore = false; _backgroundSprOffset = 0; if (_backgroundSpriteCurrentAnimation > 0 && _backgroundSpriteCurrentFrame > 0) { _backgroundSpriteCurrentAnimation = -1; @@ -895,13 +895,13 @@ void TuckerEngine::updateCharPosition() { if (action->_speech < 100) { _spriteAnimationFrameIndex = _spriteAnimationsTable[action->_speech]._firstFrameIndex; _currentSpriteAnimationLength = _spriteAnimationsTable[action->_speech]._numParts; - _mirroredDrawing = action->_flipX; + _mirroredDrawing = (action->_flipX != 0); _characterFacingDirection = 5; _mainLoopCounter2 = 0; } else { _backgroundSpriteCurrentAnimation = action->_speech - 100; _backgroundSpriteCurrentFrame = 0; - _mirroredDrawing = 0; + _mirroredDrawing = false; } } _pendingActionDelay = action->_delay; @@ -998,13 +998,13 @@ void TuckerEngine::updateCursor() { _actionVerb = 0; } _updateCursorFlag = true; - _actionVerbLocked = 1; + _actionVerbLocked = true; _actionRequiresTwoObjects = false; } } else { _updateCursorFlag = false; } - if (_actionVerbLocked == 0) { + if (!_actionVerbLocked) { setActionVerbUnderCursor(); if (_actionVerb == 0 && _locationNum == 63) { _actionVerb = 8; @@ -1032,7 +1032,7 @@ void TuckerEngine::updateCursor() { _selectedObjectNum = 0; _selectedObjectType = 0; } - if (_actionVerbLocked == 0 && _selectedObjectType == 2 && _selectedObjectNum != 21) { + if (!_actionVerbLocked && _selectedObjectType == 2 && _selectedObjectNum != 21) { _actionVerb = 2; } if (!_actionRequiresTwoObjects) { @@ -1060,7 +1060,7 @@ void TuckerEngine::updateCursor() { if (_mousePosY >= 150 && _mousePosX < 212) { if (_mousePosX < 200) { setActionVerbUnderCursor(); - _actionVerbLocked = 1; + _actionVerbLocked = true; _actionRequiresTwoObjects = false; } else if (_mousePosY < 175) { moveDownInventoryObjects(); @@ -1071,13 +1071,13 @@ void TuckerEngine::updateCursor() { if (_selectedObjectType == 3) { setActionForInventoryObject(); } else if (_actionVerb != 0) { - _actionVerbLocked = 0; + _actionVerbLocked = false; setActionState(); } else if (_actionObj1Num == 261 || (_actionObj1Num == 205 && _flagsTable[143] == 0)) { - _actionVerbLocked = 0; + _actionVerbLocked = false; setActionState(); } else { - _actionVerbLocked = 0; + _actionVerbLocked = false; _actionRequiresTwoObjects = false; _currentActionVerb = 0; setSelectedObjectKey(); @@ -1143,14 +1143,14 @@ void TuckerEngine::updateCharactersPath() { if (testLocationMask(_xPosCurrent - 1, _yPosCurrent)) { --_xPosCurrent; _characterFacingDirection = 3; - _characterBackFrontFacing = 0; + _characterBackFrontFacing = false; flag = true; } } else if (_xPosCurrent < _selectedObject._xPos) { if (testLocationMask(_xPosCurrent + 1, _yPosCurrent)) { ++_xPosCurrent; _characterFacingDirection = 1; - _characterBackFrontFacing = 1; + _characterBackFrontFacing = true; flag = true; } } @@ -1168,7 +1168,7 @@ void TuckerEngine::updateCharactersPath() { } } if (_locationNum == 25) { - if ((_backgroundSpriteCurrentAnimation != 3 || _characterBackFrontFacing != 0) && (_backgroundSpriteCurrentAnimation != 6 || _characterBackFrontFacing != 1)) { + if ((_backgroundSpriteCurrentAnimation != 3 || _characterBackFrontFacing) && (_backgroundSpriteCurrentAnimation != 6 || !_characterBackFrontFacing)) { _xPosCurrent = xPos; _yPosCurrent = yPos; return; @@ -1182,7 +1182,7 @@ void TuckerEngine::updateCharactersPath() { } _locationMaskCounter = 1; _panelLockedFlag = false; - _locationMaskIgnore = 0; + _locationMaskIgnore = false; if (_characterPrevFacingDirection <= 0 || _characterPrevFacingDirection >= 5) { return; } @@ -1427,7 +1427,7 @@ void TuckerEngine::redrawPanelOverBackground() { void TuckerEngine::drawConversationTexts() { int y = 141; - int flag = 0; + bool flag = false; for (int i = 0; i < _conversationOptionsCount; ++i) { int color = 108; if ((_mousePosY > y && _mousePosY < y + 11) || _nextTableToLoadIndex == i) { @@ -1436,11 +1436,11 @@ void TuckerEngine::drawConversationTexts() { drawSpeechText(0, y, _characterSpeechDataPtr, _instructionsActionsTable[i], color); if (_mousePosY > y && _mousePosY < _conversationOptionLinesCount * 10 + y + 1) { _nextTableToLoadIndex = i; - flag = 1; + flag = true; } y += _conversationOptionLinesCount * 10; } - if (flag == 0) { + if (!flag) { _nextTableToLoadIndex = -1; } } @@ -1757,25 +1757,25 @@ void TuckerEngine::drawCurrentSprite() { SpriteFrame *chr = &_spriteFramesTable[_currentSpriteAnimationFrame]; int yPos = _yPosCurrent + _mainSpritesBaseOffset - 54 + chr->_yOffset; int xPos = _xPosCurrent; - if (_mirroredDrawing == 0) { + if (!_mirroredDrawing) { xPos += chr->_xOffset - 14; } else { xPos -= chr->_xSize + chr->_xOffset - 14; } Graphics::decodeRLE_248(_locationBackgroundGfxBuf + yPos * 640 + xPos, _spritesGfxBuf + chr->_sourceOffset, chr->_xSize, chr->_ySize, - chr->_yOffset, _locationHeightTable[_locationNum], _mirroredDrawing != 0, color248Only); + chr->_yOffset, _locationHeightTable[_locationNum], _mirroredDrawing, color248Only); addDirtyRect(xPos, yPos, chr->_xSize, chr->_ySize); if (_currentSpriteAnimationLength > 1) { SpriteFrame *chr2 = &_spriteFramesTable[_currentSpriteAnimationFrame2]; yPos = _yPosCurrent + _mainSpritesBaseOffset - 54 + chr2->_yOffset; xPos = _xPosCurrent; - if (_mirroredDrawing == 0) { + if (!_mirroredDrawing) { xPos += chr2->_xOffset - 14; } else { xPos -= chr2->_xSize + chr2->_xOffset - 14; } Graphics::decodeRLE_248(_locationBackgroundGfxBuf + yPos * 640 + xPos, _spritesGfxBuf + chr2->_sourceOffset, chr2->_xSize, chr2->_ySize, - chr2->_yOffset, _locationHeightTable[_locationNum], _mirroredDrawing != 0, color248Only); + chr2->_yOffset, _locationHeightTable[_locationNum], _mirroredDrawing, color248Only); addDirtyRect(xPos, yPos, chr2->_xSize, chr2->_ySize); } } @@ -2112,7 +2112,7 @@ void TuckerEngine::updateCharacterAnimation() { } } else if (_locationNum == 25) { if (_backgroundSpriteCurrentFrame == 0) { - if (_characterBackFrontFacing == 0) { + if (!_characterBackFrontFacing) { if (_characterBackFrontFacing != _characterPrevBackFrontFacing) { _backgroundSpriteCurrentAnimation = 10; } else if (_panelLockedFlag) { @@ -2162,7 +2162,7 @@ void TuckerEngine::updateCharacterAnimation() { } int num = 0; if (frame == 999 || (_characterFacingDirection != _characterPrevFacingDirection && _characterFacingDirection < 5)) { - _mirroredDrawing = 0; + _mirroredDrawing = false; if (_characterFacingDirection == 6) { if (_csDataHandled) { switch (_selectedCharacterDirection) { @@ -2177,7 +2177,7 @@ void TuckerEngine::updateCharacterAnimation() { break; default: num = 16; - _mirroredDrawing = 1; + _mirroredDrawing = true; break; } } else { @@ -2189,7 +2189,7 @@ void TuckerEngine::updateCharacterAnimation() { } if (_characterFacingDirection == 0) { if (_csDataHandled) { - _mirroredDrawing = 0; + _mirroredDrawing = false; switch (_selectedCharacterDirection) { case 1: num = 3; @@ -2199,7 +2199,7 @@ void TuckerEngine::updateCharacterAnimation() { break; case 3: num = 1; - _mirroredDrawing = 1; + _mirroredDrawing = true; break; default: num = 5; @@ -2225,7 +2225,7 @@ void TuckerEngine::updateCharacterAnimation() { break; case 3: num = 0; - _mirroredDrawing = 1; + _mirroredDrawing = true; break; case 4: num = 2; @@ -2320,7 +2320,7 @@ void TuckerEngine::handleMap() { _changeBackgroundSprite = false; } _backgroundSpriteCurrentFrame = 0; - _mirroredDrawing = 0; + _mirroredDrawing = false; if (_locationNum == 25) { _backgroundSpriteDataPtr = _sprA02Table[_backgroundSpriteCurrentAnimation]; _backgroundSpriteLastFrame = READ_LE_UINT16(_backgroundSpriteDataPtr); @@ -2919,8 +2919,8 @@ void TuckerEngine::updateItemsGfxColors(int color1, int color128) { } bool TuckerEngine::testLocationMask(int x, int y) { - if (_locationMaskType > 0 || _locationMaskIgnore > 0) { - return 1; + if (_locationMaskType > 0 || _locationMaskIgnore) { + return true; } if (_locationNum == 26 || _locationNum == 32) { y -= 3; @@ -3168,7 +3168,7 @@ int TuckerEngine::executeTableInstruction() { case kCode_buw: _selectedObject._xPos = readTableInstructionParam(3); _selectedObject._yPos = readTableInstructionParam(3); - _locationMaskIgnore = 1; + _locationMaskIgnore = true; _panelLockedFlag = true; return 0; case kCode_bux: @@ -3194,7 +3194,7 @@ int TuckerEngine::executeTableInstruction() { startSpeechSound(_partNum * 3000 + _ptTextOffset + _speechSoundNum - 3000, kMaxSoundVolume); _charSpeechSoundCounter = kDefaultCharSpeechSoundCounter; _actionTextColor = 181 + index; - if (_tableInstructionFlag == 0) { + if (!_tableInstructionFlag) { _actionPosX = _tableInstructionItemNum1; _actionPosY = _tableInstructionItemNum2; } else { @@ -3291,12 +3291,12 @@ int TuckerEngine::executeTableInstruction() { _csDataLoaded = false; return 3; case kCode_ssp: - _tableInstructionFlag = 0; + _tableInstructionFlag = false; _tableInstructionItemNum1 = readTableInstructionParam(3); _tableInstructionItemNum2 = readTableInstructionParam(3); return 0; case kCode_s0p: - _tableInstructionFlag = 1; + _tableInstructionFlag = true; _tableInstructionObj1Table[index] = readTableInstructionParam(3); _tableInstructionObj2Table[index] = readTableInstructionParam(3); return 0; @@ -3555,7 +3555,7 @@ void TuckerEngine::handleMouseClickOnInventoryObject() { _selectedObjectType = 0; _selectedObjectNum = 0; _actionVerb = 0; - _actionVerbLocked = 0; + _actionVerbLocked = false; _forceRedrawPanelItems = true; _panelState = 2; setCursorType(1); @@ -3580,7 +3580,7 @@ void TuckerEngine::handleMouseClickOnInventoryObject() { _actionVerb = 0; _selectedObjectType = 0; _selectedObjectNum = 0; - _actionVerbLocked = 0; + _actionVerbLocked = false; } } break; @@ -3649,14 +3649,14 @@ int TuckerEngine::setLocationAnimationUnderCursor() { void TuckerEngine::setActionForInventoryObject() { if (_actionVerb == 0 || _actionVerb == 2 || _actionVerb == 6 || _actionVerb == 7) { playSpeechForAction(_actionVerb); - _actionVerbLocked = 0; + _actionVerbLocked = false; _actionRequiresTwoObjects = false; return; } if (_actionVerb == 3 || _actionVerb == 4) { if (!(_partNum == 2 && _selectedObjectNum == 19) && !(_partNum == 3 && _selectedObjectNum == 42)) { playSpeechForAction(_actionVerb); - _actionVerbLocked = 0; + _actionVerbLocked = false; _actionRequiresTwoObjects = false; return; } @@ -3685,7 +3685,7 @@ void TuckerEngine::setActionForInventoryObject() { _actionCharacterNum = 99; setCursorType(2); _charSpeechSoundCounter = kDefaultCharSpeechSoundCounter; - _actionVerbLocked = 0; + _actionVerbLocked = false; _actionRequiresTwoObjects = false; return; } @@ -3693,7 +3693,7 @@ void TuckerEngine::setActionForInventoryObject() { if ((_partNum == 3 && (_actionObj1Num == 6 || _actionObj1Num == 3 || _actionObj1Num == 17 || _actionObj1Num == 33)) || (_partNum == 2 && _actionObj1Num == 19) || (_partNum == 3 && (_actionObj1Num == 42 && _selectedObjectNum == 18)) ) { - _actionVerbLocked = 0; + _actionVerbLocked = false; _actionRequiresTwoObjects = false; _locationMaskCounter = 1; setActionState(); @@ -3702,7 +3702,7 @@ void TuckerEngine::setActionForInventoryObject() { if (!_actionRequiresTwoObjects) { _actionRequiresTwoObjects = true; } else { - _actionVerbLocked = 0; + _actionVerbLocked = false; _actionRequiresTwoObjects = false; _locationMaskCounter = 1; setActionState(); @@ -3762,12 +3762,12 @@ void TuckerEngine::drawSpeechText(int xStart, int y, const uint8 *dataPtr, int n } } int count = 0; - int flag = 0; + bool flag = false; struct { int w, count, offset; } lines[5]; lines[0].offset = getPositionForLine(num, dataPtr); - while (flag == 0 && count < 4) { + while (!flag && count < 4) { int lineCharsCount, lineWidth; flag = splitSpeechTextLines(dataPtr, lines[count].offset, x, lineCharsCount, lineWidth); lines[count].w = lineWidth; @@ -3796,7 +3796,7 @@ void TuckerEngine::drawSpeechText(int xStart, int y, const uint8 *dataPtr, int n } } -int TuckerEngine::splitSpeechTextLines(const uint8 *dataPtr, int pos, int x, int &lineCharsCount, int &lineWidth) { +bool TuckerEngine::splitSpeechTextLines(const uint8 *dataPtr, int pos, int x, int &lineCharsCount, int &lineWidth) { int count = 0; int w = 0; lineCharsCount = 0; @@ -3810,11 +3810,11 @@ int TuckerEngine::splitSpeechTextLines(const uint8 *dataPtr, int pos, int x, int ++count; ++pos; } - int ret = 0; + bool ret = false; if (x + 1 > w) { lineCharsCount = count; lineWidth = w; - ret = 1; + ret = true; } return ret; } diff --git a/engines/tucker/tucker.h b/engines/tucker/tucker.h index 013f023987..b6a17728e4 100644 --- a/engines/tucker/tucker.h +++ b/engines/tucker/tucker.h @@ -377,7 +377,7 @@ protected: void setActionState(); void playSpeechForAction(int i); void drawSpeechText(int xStart, int y, const uint8 *dataPtr, int num, int color); - int splitSpeechTextLines(const uint8 *dataPtr, int pos, int x, int &lineCharsCount, int &lineWidth); + bool splitSpeechTextLines(const uint8 *dataPtr, int pos, int x, int &lineCharsCount, int &lineWidth); void drawSpeechTextLine(const uint8 *dataPtr, int pos, int count, int x, int y, uint8 color); void redrawScreen(int offset); void redrawScreenRect(const Common::Rect &clip, const Common::Rect &dirty); @@ -742,7 +742,7 @@ protected: int _actionObj1Type, _actionObj2Type; int _actionObj1Num, _actionObj2Num; bool _actionRequiresTwoObjects; - int _actionVerbLocked; + bool _actionVerbLocked; int _actionPosX; int _actionPosY; bool _selectedObjectLocationMask; @@ -780,7 +780,7 @@ protected: const uint8 *_tableInstructionsPtr; int _tableInstructionObj1Table[6]; int _tableInstructionObj2Table[6]; - int _tableInstructionFlag; + bool _tableInstructionFlag; int _tableInstructionItemNum1, _tableInstructionItemNum2; int _instructionsActionsTable[6]; bool _validInstructionId; @@ -810,12 +810,12 @@ protected: int _characterAnimationIndex; int _characterFacingDirection; int _characterPrevFacingDirection; - int _characterBackFrontFacing; - int _characterPrevBackFrontFacing; + bool _characterBackFrontFacing; + bool _characterPrevBackFrontFacing; int _characterAnimationNum; int _noCharacterAnimationChange; int _characterSpriteAnimationFrameCounter; - int _locationMaskIgnore; + bool _locationMaskIgnore; int _locationMaskType; int _locationMaskCounter; int _handleMapCounter; @@ -824,7 +824,7 @@ protected: bool _updateSpriteFlag1; bool _updateSpriteFlag2; - int _mirroredDrawing; + bool _mirroredDrawing; uint8 *_loadLocBufPtr; uint8 *_backgroundSpriteDataPtr; int _locationHeight; @@ -848,7 +848,7 @@ protected: int _updateLocation14ObjNum[10]; int _updateLocation14Delay[10]; int _updateLocationCounter2; - int _updateLocationFlag; + bool _updateLocationFlag; int _updateLocation70StringLen; uint8 _updateLocation70String[20]; |