diff options
-rw-r--r-- | engines/mads/game.cpp | 4 | ||||
-rw-r--r-- | engines/mads/nebular/game_nebular.cpp | 2 | ||||
-rw-r--r-- | engines/mads/player.cpp | 15 | ||||
-rw-r--r-- | engines/mads/player.h | 5 | ||||
-rw-r--r-- | engines/mads/scene.cpp | 16 | ||||
-rw-r--r-- | engines/mads/sprites.cpp | 14 | ||||
-rw-r--r-- | engines/mads/sprites.h | 5 |
7 files changed, 38 insertions, 23 deletions
diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 33cb52cec9..fd0379972b 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -143,7 +143,7 @@ void Game::gameLoop() { sectionLoop(); } - // TODO: Extra reset methods + _player.releasePlayerSprites(); _vm->_palette->unlock(); _vm->_events->waitCursor(); _vm->_events->freeCursors(); @@ -181,7 +181,7 @@ void Game::sectionLoop() { _scene._sceneLogic->setup(); if (_player._spritesChanged || _player._loadsFirst) { if (_player._spritesLoaded) - _scene._spriteSlots.releasePlayerSprites(); + _player.releasePlayerSprites(); _vm->_palette->resetGamePalette(18, 10); _scene._spriteSlots.reset(); } else { diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index 34af685981..638432ae1a 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -270,7 +270,7 @@ void GameNebular::setSectionHandler() { void GameNebular::checkShowDialog() { if (_vm->_dialogs->_pendingDialog && _player._stepEnabled && !_globals[5]) { - _scene._spriteSlots.releasePlayerSprites(); + _player.releasePlayerSprites(); _vm->_dialogs->showDialog(); _vm->_dialogs->_pendingDialog = DIALOG_NONE; } diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp index e726c800fd..5546784083 100644 --- a/engines/mads/player.cpp +++ b/engines/mads/player.cpp @@ -662,4 +662,19 @@ void Player::addWalker(int walker, int trigger) { } } + +/** +* Releases any sprites used by the player +*/ +void Player::releasePlayerSprites() { + Scene &scene = _vm->_game->_scene; + + if (_spritesLoaded && _numSprites > 0) { + int spriteEnd = _spritesStart + _numSprites - 1; + do { + scene._sprites.remove(spriteEnd); + } while (--spriteEnd >= _spritesStart); + } +} + } // End of namespace MADS diff --git a/engines/mads/player.h b/engines/mads/player.h index 986971bbc1..8315206fc3 100644 --- a/engines/mads/player.h +++ b/engines/mads/player.h @@ -205,6 +205,11 @@ public: * Add a walker to the current queue */ void addWalker(int walker, int trigger); + + /** + * Delete any sprites used by the player + */ + void releasePlayerSprites(); }; } // End of namespace MADS diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 83c059444d..21d09fb056 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -555,7 +555,21 @@ void Scene::updateCursor() { } void Scene::free() { - warning("TODO: Scene::free"); + if (_animationData) { + delete _animationData; + _animationData = nullptr; + } + if (_activeAnimation) { + delete _activeAnimation; + _activeAnimation = nullptr; + } + + _hotspots.clear(); + _backgroundSurface.free(); + _depthSurface.free(); + + delete _sceneInfo; + _sceneInfo = nullptr; } void Scene::changeDepthSurface(int arg1) { diff --git a/engines/mads/sprites.cpp b/engines/mads/sprites.cpp index c0467ff95f..226835bb23 100644 --- a/engines/mads/sprites.cpp +++ b/engines/mads/sprites.cpp @@ -186,20 +186,6 @@ void SpriteSlots::reset(bool flag) { push_back(SpriteSlot(ST_FULL_SCREEN_REFRESH, -1)); } -/** -* Releases any sprites used by the player -*/ -void SpriteSlots::releasePlayerSprites() { - Player &player = _vm->_game->_player; - - if (player._spritesLoaded && player._numSprites > 0) { - int spriteEnd = player._spritesStart + player._numSprites - 1; - do { - deleteEntry(spriteEnd); - } while (--spriteEnd >= player._spritesStart); - } -} - void SpriteSlots::deleteEntry(int index) { remove_at(index); } diff --git a/engines/mads/sprites.h b/engines/mads/sprites.h index 2017961d29..a9b4e97d40 100644 --- a/engines/mads/sprites.h +++ b/engines/mads/sprites.h @@ -153,11 +153,6 @@ public: void reset(bool flag = true); /** - * Delete any sprites used by the player - */ - void releasePlayerSprites(); - - /** * Delete a sprite entry * @param index Specifies the index in the array */ |