diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/mads/game.cpp | 69 | ||||
-rw-r--r-- | engines/mads/game.h | 19 | ||||
-rw-r--r-- | engines/mads/phantom/phantom_scenes2.cpp | 2 | ||||
-rw-r--r-- | engines/mads/phantom/phantom_scenes3.cpp | 2 |
4 files changed, 82 insertions, 10 deletions
diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 71750075a9..5ffe3ec9e6 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -58,7 +58,7 @@ Game *Game::init(MADSEngine *vm) { Game::Game(MADSEngine *vm) : _vm(vm), _surface(nullptr), _objects(vm), _scene(vm), - _screenObjects(vm), _player(vm) { + _screenObjects(vm), _player(vm) { _sectionNumber = 1; _priorSectionNumber = 0; _loadGameSlot = -1; @@ -82,6 +82,7 @@ Game::Game(MADSEngine *vm) _winStatus = 0; _widepipeCtr = 0; _fx = kTransitionNone; + _panningSpeed = 1; // Medium speed // Load the inventory object list _objects.load(); @@ -218,6 +219,10 @@ void Game::sectionLoop() { } _scene.loadScene(_scene._nextSceneId, _aaName, 0); + camInitDefault(); + camSetSpeed(); + + _vm->_sound->pauseNewCommands(); if (!_player._spritesLoaded) { @@ -640,10 +645,64 @@ void Game::syncTimers(SyncType slaveType, int slaveId, SyncType masterType, int } void Game::camPanTo(Camera *camera, int target) { - warning("TODO: Game::camPanTo"); - if (camera) { - // Incomplete - camera->_panMode = 1; + if (!camera) + return; + + if (camera->_panAllowedFl) { + camera->_activeFl = true; + camera->_manualFl = true; + camera->_target = target; + camera->_timer = _scene._frameStartTime; } } + +void Game::camInitDefault() { + _camX._activeFl = false; + _camY._activeFl = false; + + _camX._panAllowedFl = (_scene._sceneInfo->_width > MADS_SCREEN_WIDTH); + _camY._panAllowedFl = (_scene._sceneInfo->_height > MADS_SCENE_HEIGHT); + + if (_camX._panAllowedFl) { + _camX._manualFl = false; + _camX._rate = 4; + _camX._speed = 4; + _camX._target = 0; + _camX._distOffCenter = 80; + _camX._startTolerance = 80; + _camX._endTolerance = 4; + _camX._timer = _scene._frameStartTime; + } + + if (_camY._panAllowedFl) { + _camY._manualFl = true; + _camY._rate = 4; + _camY._speed = 2; + _camY._target = 0; + _camY._distOffCenter = 80; + _camY._startTolerance = 60; + _camY._endTolerance = 4; + _camY._timer = _scene._frameStartTime; + } +} + +void Game::camSetSpeed() { + switch (_panningSpeed) { + case 1: + _camX._speed = 8; + _camY._speed = 4; + break; + + case 2: + _camX._speed = 320; + _camY._speed = 160; + break; + + default: + _camX._speed = 4; + _camY._speed = 2; + break; + } +} + } // End of namespace MADS diff --git a/engines/mads/game.h b/engines/mads/game.h index c1cd4fd4c0..fa6444a834 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -147,6 +147,7 @@ public: int _winStatus; int _widepipeCtr; int _loadGameSlot; + int _panningSpeed; public: virtual ~Game(); @@ -244,13 +245,25 @@ public: void syncTimers(SyncType slaveType, int slaveId, SyncType masterType, int masterId); typedef struct { - //TODO - bool _panFrame; - int _panMode; + bool _panAllowedFl; + bool _activeFl; + bool _currentFrameFl; + bool _manualFl; + + int _speed; + int _rate; + int _target; + int _distOffCenter; + int _startTolerance; + int _endTolerance; + int _direction; + uint32 _timer; } Camera; Camera _camX, _camY; void camPanTo(Camera *camera, int target); + void camInitDefault(); + void camSetSpeed(); }; diff --git a/engines/mads/phantom/phantom_scenes2.cpp b/engines/mads/phantom/phantom_scenes2.cpp index 22a26ee9ca..9a9f825fdc 100644 --- a/engines/mads/phantom/phantom_scenes2.cpp +++ b/engines/mads/phantom/phantom_scenes2.cpp @@ -732,7 +732,7 @@ void Scene202::enter() { } void Scene202::step() { - if (_game._camX._panFrame) + if (_game._camX._currentFrameFl) handleChandeliersPositions(); if (_anim0ActvFl) diff --git a/engines/mads/phantom/phantom_scenes3.cpp b/engines/mads/phantom/phantom_scenes3.cpp index 77ef15579f..7047c4e06e 100644 --- a/engines/mads/phantom/phantom_scenes3.cpp +++ b/engines/mads/phantom/phantom_scenes3.cpp @@ -2601,7 +2601,7 @@ void Scene310::enter() { _game._player._visible = false; _globals._animationIndexes[0] = _scene->loadAnimation(formAnimName('l', 1), 80); _scene->_animation[_globals._animationIndexes[0]]->_canChangeView = true; - _game._camX._panMode = 1; + _game._camX._manualFl = true; _raoulMessageColor = 0x102; _chrisMessageColor = 0x1110; |