diff options
author | Strangerke | 2013-03-24 19:38:48 +0100 |
---|---|---|
committer | Strangerke | 2013-03-24 22:12:44 +0100 |
commit | b46f2ccdc72c9cc9a53e4cf07efd502f21cc144c (patch) | |
tree | 67eca148c20c44eb5f76807e6a2a83941d013cd9 /engines/hopkins | |
parent | b8e504518ea77e8106d7dd8be087c5f51c8dff01 (diff) | |
download | scummvm-rg350-b46f2ccdc72c9cc9a53e4cf07efd502f21cc144c.tar.gz scummvm-rg350-b46f2ccdc72c9cc9a53e4cf07efd502f21cc144c.tar.bz2 scummvm-rg350-b46f2ccdc72c9cc9a53e4cf07efd502f21cc144c.zip |
HOPKINS: Move 2 variables from Globals to ObjectsManager and LinesManager
Diffstat (limited to 'engines/hopkins')
-rw-r--r-- | engines/hopkins/globals.cpp | 4 | ||||
-rw-r--r-- | engines/hopkins/globals.h | 2 | ||||
-rw-r--r-- | engines/hopkins/lines.cpp | 7 | ||||
-rw-r--r-- | engines/hopkins/lines.h | 1 | ||||
-rw-r--r-- | engines/hopkins/objects.cpp | 65 | ||||
-rw-r--r-- | engines/hopkins/objects.h | 3 |
6 files changed, 42 insertions, 40 deletions
diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 87efe9925d..9fdba0b050 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -102,7 +102,6 @@ Globals::Globals(HopkinsEngine *vm) { _linuxEndDemoFl = false; _speed = 1; - _oldFrameIndex = 0; _oldDirection = DIR_NONE; _oldDirectionSpriteIdx = 59; _lastDirection = DIR_NONE; @@ -169,7 +168,6 @@ Globals::Globals(HopkinsEngine *vm) { _oldZoneNum = 0; _oldMouseX = 0; _oldMouseY = 0; - _forceHideText = false; } Globals::~Globals() { @@ -261,7 +259,7 @@ void Globals::loadCharacterData() { _hopkinsItem[idx]._speedY = *srcP++; } - _oldFrameIndex = -1; + _vm->_objectsManager->resetOldFrameIndex(); _oldDirection = DIR_NONE; } diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 2a27d59c1b..3a84ddb244 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -236,14 +236,12 @@ public: bool _censorshipFl; bool _introSpeechOffFl; bool _hidingActiveFl; - bool _forceHideText; int _exitId; Directions _oceanDirection; Directions _oldDirection; int _oldDirectionSpriteIdx; int _actionDirection; Directions _lastDirection; - int _oldFrameIndex; int _hotspotTextColor; int _inventory[36]; int _objectWidth, _objectHeight; diff --git a/engines/hopkins/lines.cpp b/engines/hopkins/lines.cpp index f47a444427..3571cbcb04 100644 --- a/engines/hopkins/lines.cpp +++ b/engines/hopkins/lines.cpp @@ -75,6 +75,7 @@ LinesManager::LinesManager(HopkinsEngine *vm) { _currentSegmentId = 0; _largeBuf = g_PTRNUL; _zoneSkipCount = 0; + _forceHideText = false; } LinesManager::~LinesManager() { @@ -2846,9 +2847,9 @@ void LinesManager::checkZone() { _vm->_graphicsManager->SETCOLOR4(251, 100, 100, 100); _vm->_eventsManager->_mouseCursorId = 4; _vm->_eventsManager->changeMouseCursor(4); - if (_vm->_globals->_forceHideText) { + if (_forceHideText) { _vm->_fontManager->hideText(5); - _vm->_globals->_forceHideText = false; + _forceHideText = false; return; } } @@ -2861,7 +2862,7 @@ void LinesManager::checkZone() { if (_vm->_globals->_oldMouseZoneId != zoneId) { _vm->_fontManager->initTextBuffers(5, ZONEP[zoneId]._messageId, _vm->_globals->_zoneFilename, 0, 430, 0, 0, 252); _vm->_fontManager->showText(5); - _vm->_globals->_forceHideText = true; + _forceHideText = true; } _vm->_globals->_hotspotTextColor += 25; if (_vm->_globals->_hotspotTextColor > 100) diff --git a/engines/hopkins/lines.h b/engines/hopkins/lines.h index 2d0b3b0fad..ed7e2f0817 100644 --- a/engines/hopkins/lines.h +++ b/engines/hopkins/lines.h @@ -106,6 +106,7 @@ class LinesManager { private: HopkinsEngine *_vm; + bool _forceHideText; int _pathFindingMaxDepth; SmoothItem _smoothRoute[4000]; Directions _smoothMoveDirection; diff --git a/engines/hopkins/objects.cpp b/engines/hopkins/objects.cpp index 83c11588aa..4b7a66a6d8 100644 --- a/engines/hopkins/objects.cpp +++ b/engines/hopkins/objects.cpp @@ -75,6 +75,7 @@ ObjectsManager::ObjectsManager(HopkinsEngine *vm) { _jumpVerb = 0; _jumpZone = 0; _oldSpriteIndex = 0; + _oldFrameIndex = 0; _oldFlipFl = false; _curObjectIndex = 0; _forestFl = false; @@ -1275,7 +1276,7 @@ void ObjectsManager::GOHOME() { if (newPosX != -1 || newPosY != -1) { _vm->_globals->_oldDirection = newDirection; _vm->_globals->_oldDirectionSpriteIdx = newDirection + 59; - _vm->_globals->_oldFrameIndex = 0; + _oldFrameIndex = 0; _oldCharacterPosX = newPosX; _oldCharacterPosY = newPosY; } else { @@ -1309,13 +1310,13 @@ void ObjectsManager::GOHOME() { return; } if (_vm->_globals->_oldDirection == DIR_RIGHT) { - if (_vm->_globals->_oldFrameIndex < 24 || _vm->_globals->_oldFrameIndex > 35) { + if (_oldFrameIndex < 24 || _oldFrameIndex > 35) { oldPosX = _oldCharacterPosX; oldPosY = _oldCharacterPosY; oldFrameIdx = 24; } else { - int deltaX = _vm->_globals->_hopkinsItem[_vm->_globals->_oldFrameIndex]._speedX; - int deltaY = _vm->_globals->_hopkinsItem[_vm->_globals->_oldFrameIndex]._speedY; + int deltaX = _vm->_globals->_hopkinsItem[_oldFrameIndex]._speedX; + int deltaY = _vm->_globals->_hopkinsItem[_oldFrameIndex]._speedY; if (_sprite[0]._zoomFactor < 0) { deltaX = _vm->_graphicsManager->zoomOut(deltaX, -_sprite[0]._zoomFactor); @@ -1326,20 +1327,20 @@ void ObjectsManager::GOHOME() { } oldPosX = _oldCharacterPosX + deltaX; oldPosY = _oldCharacterPosY + deltaY; - oldFrameIdx = _vm->_globals->_oldFrameIndex + 1; + oldFrameIdx = _oldFrameIndex + 1; if (oldFrameIdx > 35) oldFrameIdx = 24; } _homeRateCounter = 5 / _vm->_globals->_speed; } if (_vm->_globals->_oldDirection == DIR_LEFT) { - if (_vm->_globals->_oldFrameIndex < 24 || _vm->_globals->_oldFrameIndex > 35) { + if (_oldFrameIndex < 24 || _oldFrameIndex > 35) { oldPosX = _oldCharacterPosX; oldPosY = _oldCharacterPosY; oldFrameIdx = 24; } else { - int deltaX = _vm->_globals->_hopkinsItem[_vm->_globals->_oldFrameIndex]._speedX; - int deltaY = _vm->_globals->_hopkinsItem[_vm->_globals->_oldFrameIndex]._speedY; + int deltaX = _vm->_globals->_hopkinsItem[_oldFrameIndex]._speedX; + int deltaY = _vm->_globals->_hopkinsItem[_oldFrameIndex]._speedY; if (_sprite[0]._zoomFactor < 0) { deltaX = _vm->_graphicsManager->zoomOut(deltaX, -_sprite[0]._zoomFactor); deltaY = _vm->_graphicsManager->zoomOut(deltaY, -_sprite[0]._zoomFactor); @@ -1349,19 +1350,19 @@ void ObjectsManager::GOHOME() { } oldPosX = _oldCharacterPosX - deltaX; oldPosY = _oldCharacterPosY - deltaY; - oldFrameIdx = _vm->_globals->_oldFrameIndex + 1; + oldFrameIdx = _oldFrameIndex + 1; if (oldFrameIdx > 35) oldFrameIdx = 24; } _homeRateCounter = 5 / _vm->_globals->_speed; } if (_vm->_globals->_oldDirection == DIR_UP) { - if (_vm->_globals->_oldFrameIndex > 11) { + if (_oldFrameIndex > 11) { oldPosX = _oldCharacterPosX; oldPosY = _oldCharacterPosY; oldFrameIdx = 0; } else { - int deltaY = abs(_vm->_globals->_hopkinsItem[_vm->_globals->_oldFrameIndex]._speedY); + int deltaY = abs(_vm->_globals->_hopkinsItem[_oldFrameIndex]._speedY); if (_sprite[0]._zoomFactor < 0) { deltaY = _vm->_graphicsManager->zoomOut(deltaY, -_sprite[0]._zoomFactor); } else if (_sprite[0]._zoomFactor > 0) { @@ -1369,7 +1370,7 @@ void ObjectsManager::GOHOME() { } oldPosX = _oldCharacterPosX; oldPosY = _oldCharacterPosY - deltaY; - oldFrameIdx = _vm->_globals->_oldFrameIndex + 1; + oldFrameIdx = _oldFrameIndex + 1; if (oldFrameIdx > 11) oldFrameIdx = 0; } @@ -1377,12 +1378,12 @@ void ObjectsManager::GOHOME() { } if (_vm->_globals->_oldDirection == DIR_DOWN) { - if (_vm->_globals->_oldFrameIndex < 48 || _vm->_globals->_oldFrameIndex > 59) { + if (_oldFrameIndex < 48 || _oldFrameIndex > 59) { oldPosX = _oldCharacterPosX; oldPosY = _oldCharacterPosY; oldFrameIdx = 48; } else { - int deltaY = abs(_vm->_globals->_hopkinsItem[_vm->_globals->_oldFrameIndex]._speedY); + int deltaY = abs(_vm->_globals->_hopkinsItem[_oldFrameIndex]._speedY); if (_sprite[0]._zoomFactor < 0) { deltaY = _vm->_graphicsManager->zoomOut(deltaY, -_sprite[0]._zoomFactor); } else if (_sprite[0]._zoomFactor > 0) { @@ -1390,20 +1391,20 @@ void ObjectsManager::GOHOME() { } oldPosX = _oldCharacterPosX; oldPosY = deltaY + _oldCharacterPosY; - oldFrameIdx = _vm->_globals->_oldFrameIndex + 1; + oldFrameIdx = _oldFrameIndex + 1; if (oldFrameIdx > 59) oldFrameIdx = 48; } _homeRateCounter = 4 / _vm->_globals->_speed; } if (_vm->_globals->_oldDirection == DIR_UP_RIGHT) { - if (_vm->_globals->_oldFrameIndex < 12 || _vm->_globals->_oldFrameIndex > 23) { + if (_oldFrameIndex < 12 || _oldFrameIndex > 23) { oldPosX = _oldCharacterPosX; oldPosY = _oldCharacterPosY; oldFrameIdx = 12; } else { - int deltaX = _vm->_globals->_hopkinsItem[_vm->_globals->_oldFrameIndex]._speedX; - int deltaY = _vm->_globals->_hopkinsItem[_vm->_globals->_oldFrameIndex]._speedY; + int deltaX = _vm->_globals->_hopkinsItem[_oldFrameIndex]._speedX; + int deltaY = _vm->_globals->_hopkinsItem[_oldFrameIndex]._speedY; if (_sprite[0]._zoomFactor < 0) { deltaX = _vm->_graphicsManager->zoomOut(deltaX, -_sprite[0]._zoomFactor); deltaY = _vm->_graphicsManager->zoomOut(deltaY, -_sprite[0]._zoomFactor); @@ -1414,20 +1415,20 @@ void ObjectsManager::GOHOME() { } oldPosX = deltaX + _oldCharacterPosX; oldPosY = _oldCharacterPosY + deltaY; - oldFrameIdx = _vm->_globals->_oldFrameIndex + 1; + oldFrameIdx = _oldFrameIndex + 1; if (oldFrameIdx > 23) oldFrameIdx = 12; } _homeRateCounter = 5 / _vm->_globals->_speed; } if (_vm->_globals->_oldDirection == DIR_UP_LEFT) { - if (_vm->_globals->_oldFrameIndex < 12 || _vm->_globals->_oldFrameIndex > 23) { + if (_oldFrameIndex < 12 || _oldFrameIndex > 23) { oldPosX = _oldCharacterPosX; oldPosY = _oldCharacterPosY; oldFrameIdx = 12; } else { - int deltaX = _vm->_globals->_hopkinsItem[_vm->_globals->_oldFrameIndex]._speedX; - int deltaY = _vm->_globals->_hopkinsItem[_vm->_globals->_oldFrameIndex]._speedY; + int deltaX = _vm->_globals->_hopkinsItem[_oldFrameIndex]._speedX; + int deltaY = _vm->_globals->_hopkinsItem[_oldFrameIndex]._speedY; if (_sprite[0]._zoomFactor < 0) { deltaX = _vm->_graphicsManager->zoomOut(deltaX, -_sprite[0]._zoomFactor); deltaY = _vm->_graphicsManager->zoomOut(deltaY, -_sprite[0]._zoomFactor); @@ -1437,20 +1438,20 @@ void ObjectsManager::GOHOME() { } oldPosX = _oldCharacterPosX - deltaX; oldPosY = _oldCharacterPosY + deltaY; - oldFrameIdx = _vm->_globals->_oldFrameIndex + 1; + oldFrameIdx = _oldFrameIndex + 1; if (oldFrameIdx > 23) oldFrameIdx = 12; } _homeRateCounter = 5 / _vm->_globals->_speed; } if (_vm->_globals->_oldDirection == DIR_DOWN_RIGHT) { - if (_vm->_globals->_oldFrameIndex < 36 || _vm->_globals->_oldFrameIndex > 47) { + if (_oldFrameIndex < 36 || _oldFrameIndex > 47) { oldPosX = _oldCharacterPosX; oldPosY = _oldCharacterPosY; oldFrameIdx = 36; } else { - int deltaX = _vm->_globals->_hopkinsItem[_vm->_globals->_oldFrameIndex]._speedX; - int deltaY = _vm->_globals->_hopkinsItem[_vm->_globals->_oldFrameIndex]._speedY; + int deltaX = _vm->_globals->_hopkinsItem[_oldFrameIndex]._speedX; + int deltaY = _vm->_globals->_hopkinsItem[_oldFrameIndex]._speedY; if (_sprite[0]._zoomFactor < 0) { deltaX = _vm->_graphicsManager->zoomOut(deltaX, -_sprite[0]._zoomFactor); deltaY = _vm->_graphicsManager->zoomOut(deltaY, -_sprite[0]._zoomFactor); @@ -1461,20 +1462,20 @@ void ObjectsManager::GOHOME() { } oldPosX = deltaX + _oldCharacterPosX; oldPosY = _oldCharacterPosY + deltaY; - oldFrameIdx = _vm->_globals->_oldFrameIndex + 1; + oldFrameIdx = _oldFrameIndex + 1; if (oldFrameIdx > 47) oldFrameIdx = 36; } _homeRateCounter = 5 / _vm->_globals->_speed; } if (_vm->_globals->_oldDirection == DIR_DOWN_LEFT) { - if (_vm->_globals->_oldFrameIndex < 36 || _vm->_globals->_oldFrameIndex > 47) { + if (_oldFrameIndex < 36 || _oldFrameIndex > 47) { oldPosX = _oldCharacterPosX; oldPosY = _oldCharacterPosY; oldFrameIdx = 36; } else { - int deltaX = _vm->_globals->_hopkinsItem[_vm->_globals->_oldFrameIndex]._speedX; - int deltaY = _vm->_globals->_hopkinsItem[_vm->_globals->_oldFrameIndex]._speedY; + int deltaX = _vm->_globals->_hopkinsItem[_oldFrameIndex]._speedX; + int deltaY = _vm->_globals->_hopkinsItem[_oldFrameIndex]._speedY; if (_sprite[0]._zoomFactor < 0) { deltaX = _vm->_graphicsManager->zoomOut(deltaX, -_sprite[0]._zoomFactor); deltaY = _vm->_graphicsManager->zoomOut(deltaY, -_sprite[0]._zoomFactor); @@ -1485,7 +1486,7 @@ void ObjectsManager::GOHOME() { } oldPosX = _oldCharacterPosX - deltaX; oldPosY = _oldCharacterPosY + deltaY; - oldFrameIdx = _vm->_globals->_oldFrameIndex + 1; + oldFrameIdx = _oldFrameIndex + 1; if (oldFrameIdx > 47) oldFrameIdx = 36; } @@ -1560,7 +1561,7 @@ void ObjectsManager::GOHOME() { } _vm->_globals->_oldDirection = newDirection; _vm->_globals->_oldDirectionSpriteIdx = newDirection + 59; - _vm->_globals->_oldFrameIndex = oldFrameIdx; + _oldFrameIndex = oldFrameIdx; _oldCharacterPosX = newPosX; _oldCharacterPosY = newPosY; } diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 9e22a5286d..34764f501f 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -92,6 +92,7 @@ private: const byte *_oldSpriteData; int _verb; int _oldSpriteIndex; + int _oldFrameIndex; bool _oldFlipFl; int _curGestureFile; byte *_gestureBuf; @@ -241,6 +242,8 @@ public: void OPTI_BOBON(int idx1, int idx2, int idx3, int anim1Idx, int anim2Idx, int anim3Idx); void SPACTION1(byte *spriteData, const Common::String &animString, int speed); void PARADISE(); + + void resetOldFrameIndex() { _oldFrameIndex = -1; } }; } // End of namespace Hopkins |