diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/mads/events.cpp | 1 | ||||
-rw-r--r-- | engines/mads/events.h | 1 | ||||
-rw-r--r-- | engines/mads/game.cpp | 62 | ||||
-rw-r--r-- | engines/mads/game.h | 5 | ||||
-rw-r--r-- | engines/mads/mads.cpp | 1 | ||||
-rw-r--r-- | engines/mads/mads.h | 8 | ||||
-rw-r--r-- | engines/mads/player.cpp | 21 | ||||
-rw-r--r-- | engines/mads/player.h | 13 | ||||
-rw-r--r-- | engines/mads/scene.cpp | 15 | ||||
-rw-r--r-- | engines/mads/scene.h | 8 |
10 files changed, 132 insertions, 3 deletions
diff --git a/engines/mads/events.cpp b/engines/mads/events.cpp index 5d905ca8d6..56bd87cbc6 100644 --- a/engines/mads/events.cpp +++ b/engines/mads/events.cpp @@ -39,6 +39,7 @@ EventsManager::EventsManager(MADSEngine *vm) { _priorFrameTime = 0; _keyPressed = false; _mouseClicked = false; + _currentTimer = 0; } EventsManager::~EventsManager() { diff --git a/engines/mads/events.h b/engines/mads/events.h index 2a8ae84e6a..c4fb8786cb 100644 --- a/engines/mads/events.h +++ b/engines/mads/events.h @@ -60,6 +60,7 @@ public: SpriteAsset *_cursorSprites; bool _mouseClicked; bool _keyPressed; + uint32 _currentTimer; public: /** * Constructor diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 2fa701093e..64b41d23c3 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -54,6 +54,8 @@ Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr), _objects(vm), _v5 = _v6 = 0; _aaName = "*I0.AA"; _playerSpritesFlag = false; + _currentTimer = 0; + _updateSceneFlag = false; } Game::~Game() { @@ -181,7 +183,65 @@ void Game::sectionLoop() { _player._direction = _player._newDirection; _player.moveComplete(); - // TODO: main section loop logic goes here + switch (_vm->_screenFade) { + case SCREEN_FADE_SMOOTH: + _abortTimers2 = 2; + break; + case SCREEN_FADE_FAST: + _abortTimers2 = 20; + break; + default: + _abortTimers2 = 21; + break; + } + _abortTimers = 0; + _abortTimersMode2 = ABORTMODE_1; + _currentTimer = _vm->_events->_currentTimer; + + // Call the scene logic for entering the given scene + _scene._sceneLogic->enter(); + + // Set player data + _player._destPos = _player._playerPos; + _player._newDirection = _player._direction; + _player._destFacing = _player._direction; + _player.setupFrame(); + _player.updateFrame(); + _player._visible3 = _player._visible; + _player._special = _scene.getDepthHighBits(_player._playerPos); + _player._priorTimer = _vm->_events->_currentTimer + _player._ticksAmount; + _player.idle(); + + warning("TODO: _selectedObject IF block"); + + _v1 = 5; + _scene._roomChanged = false; + + if ((_v5 || _v6) && !_updateSceneFlag) { + _scene._currentSceneId = _scene._priorSceneId; + _updateSceneFlag = true; + } + else { + _updateSceneFlag = false; + _scene.loop(); + } + + _vm->_events->resetCursor(); + _v1 = 3; + + delete _quotes; + _quotes = nullptr; + delete _scene._animation; + _scene._animation = nullptr; + + _scene._reloadSceneFlag = false; + + warning("TODO: sub_1DD8C, sub_1DD7E"); + + if (!_playerSpritesFlag) { + _player._spritesLoaded = false; + _player._spritesChanged = true; + } // Clear the scene _scene.free(); diff --git a/engines/mads/game.h b/engines/mads/game.h index 88c5bebf63..cd727af902 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -65,6 +65,7 @@ protected: int _v3; int _v5; int _v6; + bool _updateSceneFlag; Common::String _aaName; bool _playerSpritesFlag; int _objectHiliteVocabIdx; @@ -111,6 +112,10 @@ public: Scene _scene; int _v2; int _v4; + int _abortTimers; + int _abortTimers2; + AbortTimerMode _abortTimersMode2; + uint32 _currentTimer; public: virtual ~Game(); diff --git a/engines/mads/mads.cpp b/engines/mads/mads.cpp index d78f37dd8b..e9fbf918c4 100644 --- a/engines/mads/mads.cpp +++ b/engines/mads/mads.cpp @@ -41,6 +41,7 @@ MADSEngine::MADSEngine(OSystem *syst, const MADSGameDescription *gameDesc) : _easyMouse = true; _invObjectStill = false; _textWindowStill = false; + _screenFade = SCREEN_FADE_FAST; _debugger = nullptr; _dialogs = nullptr; diff --git a/engines/mads/mads.h b/engines/mads/mads.h index 92758b72a5..2d85236d8d 100644 --- a/engines/mads/mads.h +++ b/engines/mads/mads.h @@ -67,6 +67,12 @@ enum { GType_Riddle = 3 }; +enum ScreenFade { + SCREEN_FADE_SMOOTH = 0, + SCREEN_FADE_MEDIUM = 1, + SCREEN_FADE_FAST = 2 +}; + struct MADSGameDescription; @@ -97,7 +103,7 @@ public: bool _easyMouse; bool _invObjectStill; bool _textWindowStill; - + ScreenFade _screenFade; public: MADSEngine(OSystem *syst, const MADSGameDescription *gameDesc); virtual ~MADSEngine(); diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp index d88feea0d8..e09549c6d9 100644 --- a/engines/mads/player.cpp +++ b/engines/mads/player.cpp @@ -35,6 +35,10 @@ Player::Player(MADSEngine *vm): _vm(vm) { _spritesStart = _numSprites = 0; _stepEnabled = false; _visible = false; + _visible3 = false; + _special = 0; + _ticksAmount = 0; + _priorTimer = 0; } void Player::reset() { @@ -66,4 +70,21 @@ void Player::moveComplete() { _action->_inProgress = false; } +void Player::setupFrame() { + resetActionList(); + warning("TODO: Player::setupFrame"); +} + +void Player::updateFrame() { + warning("TODO: Player::updateFrame"); +} + +void Player::resetActionList() { + warning("TODO: Player::resetActionList"); +} + +void Player::idle() { + warning("TODO: Player::idle"); +} + } // End of namespace MADS diff --git a/engines/mads/player.h b/engines/mads/player.h index 0466f7aeee..67766d8572 100644 --- a/engines/mads/player.h +++ b/engines/mads/player.h @@ -37,6 +37,8 @@ private: MADSAction *_action; void reset(); + + void resetActionList(); public: int _direction; int _newDirection; @@ -47,13 +49,16 @@ public: bool _stepEnabled; bool _spritesChanged; bool _visible; + bool _visible3; Common::Point _playerPos; Common::Point _destPos; bool _moving; int _v844C0, _v844BE; int _next; int _routeCount; - + int _special; + int _ticksAmount; + uint32 _priorTimer; public: Player(MADSEngine *vm); @@ -62,6 +67,12 @@ public: void turnToDestFacing(); void moveComplete(); + + void setupFrame(); + + void updateFrame(); + + void idle(); }; } // End of namespace MADS diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 2f12139246..2c6cb8a112 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -39,6 +39,8 @@ Scene::Scene(MADSEngine *vm): _vm(vm), _spriteSlots(vm), _action(_vm) { _animVal1 = 0; _depthStyle = 0; _v1A = _v1C = 0; + _roomChanged = false; + _reloadSceneFlag = false; _verbList.push_back(VerbInit(VERB_LOOK, 2, 0)); _verbList.push_back(VerbInit(VERB_TAKE, 2, 0)); @@ -254,6 +256,19 @@ void Scene::initPaletteAnimation(Common::Array<RGB4> &animData, bool animFlag) { _animFlag = animFlag; } +bool Scene::getDepthHighBits(const Common::Point &pt) { + if (_sceneInfo->_depthStyle == 2) { + return 0; + } else { + const byte *p = _depthSurface.getBasePtr(pt.x, pt.y); + return (*p & 0x70) >> 4; + } +} + +void Scene::loop() { + +} + void Scene::free() { warning("TODO: Scene::free"); } diff --git a/engines/mads/scene.h b/engines/mads/scene.h index d3a6aeeb6d..4da6fb297e 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -98,6 +98,8 @@ public: int _v1A; int _v1C; MADSAction _action; + bool _roomChanged; + bool _reloadSceneFlag; /** * Constructor @@ -157,6 +159,12 @@ public: */ void loadVocab(); + bool getDepthHighBits(const Common::Point &pt); + + /** + * Main scene loop + */ + void loop(); /** * Clear the data for the scene |