From e4cbc67493d9e596f1cd455619f81f529989ba5f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 9 Mar 2014 00:35:06 +0100 Subject: TUCKER: Some more refactoring --- engines/tucker/tucker.cpp | 35 ++++++++++++++++++----------------- engines/tucker/tucker.h | 6 +++--- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/engines/tucker/tucker.cpp b/engines/tucker/tucker.cpp index 5b8ea579c5..bf3befc917 100644 --- a/engines/tucker/tucker.cpp +++ b/engines/tucker/tucker.cpp @@ -133,15 +133,16 @@ void TuckerEngine::resetVariables() { _nextLocationNum = (_gameFlags & kGameFlagDemo) == 0 ? kStartupLocationGame : kStartupLocationDemo; _gamePaused = false; _gameDebug = false; - _displayGameHints = false; _displaySpeechText = (_gameFlags & kGameFlagNoSubtitles) == 0 ? ConfMan.getBool("subtitles") : false; memset(_flagsTable, 0, sizeof(_flagsTable)); _gameHintsIndex = 0; _gameHintsCounter = 0; - _gameHintsDisplayText = 0; _gameHintsStringNum = 0; + _displayGameHints = false; + _displayHintsText = false; + if ((_gameFlags & kGameFlagDemo) == 0) { _locationWidthTable = _locationWidthTableGame; _locationHeightTable = _locationHeightTableGame; @@ -452,7 +453,7 @@ void TuckerEngine::mainLoop() { clearItemsGfx(); if (_gamePaused) { drawPausedInfoBar(); - } else if (_gameHintsDisplayText == 1 && _mouseIdleCounter > 1000) { + } else if (_displayHintsText && _mouseIdleCounter > 1000) { drawGameHintString(); } else { drawInfoString(); @@ -567,7 +568,7 @@ void TuckerEngine::mainLoop() { } if (_inputKeys[kInputKeyHelp]) { _inputKeys[kInputKeyHelp] = false; - if (_displayGameHints && _gameHintsDisplayText == 1) { + if (_displayGameHints && _displayHintsText) { _gameHintsStringNum = _gameHintsIndex + 1; _mouseIdleCounter = 1100; } @@ -1122,18 +1123,18 @@ void TuckerEngine::updateCharactersPath() { if (_characterFacingDirection == 5) { _characterPrevFacingDirection = 5; } - int flag = 0; + bool flag = false; if (_yPosCurrent > _selectedObject._yPos) { if (testLocationMask(_xPosCurrent, _yPosCurrent - 1) == 1) { --_yPosCurrent; _characterFacingDirection = 4; - flag = 1; + flag = true; } } else if (_yPosCurrent < _selectedObject._yPos) { if (testLocationMask(_xPosCurrent, _yPosCurrent + 1) == 1) { ++_yPosCurrent; _characterFacingDirection = 2; - flag = 1; + flag = true; } } if (_xPosCurrent > _selectedObject._xPos) { @@ -1141,17 +1142,17 @@ void TuckerEngine::updateCharactersPath() { --_xPosCurrent; _characterFacingDirection = 3; _characterBackFrontFacing = 0; - flag = 1; + flag = true; } } else if (_xPosCurrent < _selectedObject._xPos) { if (testLocationMask(_xPosCurrent + 1, _yPosCurrent) == 1) { ++_xPosCurrent; _characterFacingDirection = 1; _characterBackFrontFacing = 1; - flag = 1; + flag = true; } } - if (flag == 0) { + if (!flag) { if (_selectedObjectLocationMask == 1) { _selectedObjectLocationMask = 0; _selectedObject._xPos = _selectedObject._xDefaultPos; @@ -1473,31 +1474,31 @@ void TuckerEngine::updateGameHints() { if (_gameHintsIndex == 0 && _flagsTable[3] > 0) { _gameHintsIndex = 1; _gameHintsCounter = 0; - _gameHintsDisplayText = 0; + _displayHintsText = false; } else if (_gameHintsIndex == 1 && _flagsTable[12] > 0) { _gameHintsIndex = 2; _gameHintsCounter = 0; - _gameHintsDisplayText = 0; + _displayHintsText = false; } else if (_gameHintsIndex == 2 && _flagsTable[20] > 0) { _gameHintsIndex = 3; _gameHintsCounter = 0; - _gameHintsDisplayText = 0; + _displayHintsText = false; } else if (_gameHintsIndex == 3 && _flagsTable[9] > 0) { _gameHintsIndex = 4; _gameHintsCounter = 0; - _gameHintsDisplayText = 0; + _displayHintsText = false; } else if (_gameHintsIndex == 4 && _flagsTable[23] > 0) { _gameHintsIndex = 5; _gameHintsCounter = 0; - _gameHintsDisplayText = 0; + _displayHintsText = false; } else if (_flagsTable[19] > 0) { _gameHintsIndex = 6; _gameHintsCounter = 0; - _gameHintsDisplayText = 0; + _displayHintsText = false; } ++_gameHintsCounter; if (_gameHintsCounter > 1500) { - _gameHintsDisplayText = 1; + _displayHintsText = true; } } diff --git a/engines/tucker/tucker.h b/engines/tucker/tucker.h index 5a6976b2fd..86f38fcae4 100644 --- a/engines/tucker/tucker.h +++ b/engines/tucker/tucker.h @@ -630,14 +630,14 @@ protected: bool _gameDebug; bool _displayGameHints; int _execData3Counter; - bool _displaySpeechText; int _currentSaveLoadGameState; - int _gameHintsIndex; int _gameHintsCounter; - int _gameHintsDisplayText; int _gameHintsStringNum; + bool _displaySpeechText; + bool _displayHintsText; + int _fileLoadSize; uint8 *_loadTempBuf; uint8 *_cursorGfxBuf; -- cgit v1.2.3