aboutsummaryrefslogtreecommitdiff
path: root/engines/mads/scene.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2014-04-19 14:46:28 -0400
committerPaul Gilbert2014-04-19 14:46:28 -0400
commit559efad195b2ec7e77bd9192328d9e48b2a81e29 (patch)
treea592e6d7849515250b797c6fe952eac4aff6d762 /engines/mads/scene.cpp
parent3fa488db3a9174607d066c017a3f923e1919fd51 (diff)
downloadscummvm-rg350-559efad195b2ec7e77bd9192328d9e48b2a81e29.tar.gz
scummvm-rg350-559efad195b2ec7e77bd9192328d9e48b2a81e29.tar.bz2
scummvm-rg350-559efad195b2ec7e77bd9192328d9e48b2a81e29.zip
MADS: Moved Animation::free to be Scene::freeAnimation
Diffstat (limited to 'engines/mads/scene.cpp')
-rw-r--r--engines/mads/scene.cpp38
1 files changed, 33 insertions, 5 deletions
diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp
index 99151c1267..65d1c04c0c 100644
--- a/engines/mads/scene.cpp
+++ b/engines/mads/scene.cpp
@@ -396,11 +396,8 @@ void Scene::doFrame() {
_cyclingActive = true;
_vm->_game->_fx = kTransitionNone;
- if (_freeAnimationFlag && _activeAnimation) {
- _activeAnimation->free();
- _freeAnimationFlag = false;
- _activeAnimation = nullptr;
- }
+ if (_freeAnimationFlag)
+ freeAnimation();
}
void Scene::drawElements(ScreenTransition transitionType, bool surfaceFlag) {
@@ -600,4 +597,35 @@ void Scene::resetScene() {
_sequences.clear();
}
+void Scene::freeAnimation() {
+ if (_activeAnimation) {
+ Player &player = _vm->_game->_player;
+
+ if (!_freeAnimationFlag) {
+ _spriteSlots.fullRefresh(true);
+ _sequences.scan();
+ }
+
+ // Refresh the player
+ if (player._visible) {
+ player._forceRefresh = true;
+ player.update();
+ }
+
+ // Remove any kernel messages in use by the animation
+ for (uint i = 0; i < _activeAnimation->_messages.size(); ++i) {
+ int msgIndex = _activeAnimation->_messages[i]._kernelMsgIndex;
+ if (msgIndex >= 0)
+ _kernelMessages.remove(msgIndex);
+ }
+
+ // Delete the animation
+ delete _activeAnimation;
+ _activeAnimation = nullptr;
+ }
+
+ _freeAnimationFlag = false;
+}
+
+
} // End of namespace MADS