aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2014-08-15 20:26:09 -0400
committerPaul Gilbert2014-08-15 20:26:09 -0400
commitf8d64ae6bc47c0d1ea6efea45c28dd4902780ecb (patch)
treedd5aac49f4b6fde3f3ca3000b563a88393c9609c
parente3687ea12347f65d3e6e9927e161e076774ad252 (diff)
downloadscummvm-rg350-f8d64ae6bc47c0d1ea6efea45c28dd4902780ecb.tar.gz
scummvm-rg350-f8d64ae6bc47c0d1ea6efea45c28dd4902780ecb.tar.bz2
scummvm-rg350-f8d64ae6bc47c0d1ea6efea45c28dd4902780ecb.zip
ACCESS: Added code to update animations each frame
-rw-r--r--engines/access/animation.cpp7
-rw-r--r--engines/access/animation.h17
-rw-r--r--engines/access/events.cpp19
-rw-r--r--engines/access/events.h2
4 files changed, 35 insertions, 10 deletions
diff --git a/engines/access/animation.cpp b/engines/access/animation.cpp
index 4965f41105..31e53e5cf0 100644
--- a/engines/access/animation.cpp
+++ b/engines/access/animation.cpp
@@ -331,4 +331,11 @@ void AnimationManager::animate(int animId) {
anim->animate();
}
+void AnimationManager::updateTimers() {
+ for (uint idx = 0; idx < _animationTimers.size(); ++idx) {
+ if (_animationTimers[idx]->_countdownTicks > 0)
+ _animationTimers[idx]->_countdownTicks--;
+ }
+}
+
} // End of namespace Access
diff --git a/engines/access/animation.h b/engines/access/animation.h
index c1b44a5621..f70aa3239d 100644
--- a/engines/access/animation.h
+++ b/engines/access/animation.h
@@ -49,14 +49,25 @@ public:
void freeAnimationData();
void loadAnimations(const byte *data, int size);
- void clearTimers();
-
Animation *findAnimation(int animId);
Animation *setAnimation(int animId);
+ void animate(int animId);
+
+ /**
+ * Clear the list of currently active animations
+ */
+ void clearTimers();
+
+ /**
+ * Add an animation to the list of currently animating ones
+ */
void setAnimTimer(Animation *anim);
- void animate(int animId);
+ /**
+ * Update the timing of all currently active animation
+ */
+ void updateTimers();
};
class AnimationResource {
diff --git a/engines/access/events.cpp b/engines/access/events.cpp
index 88e783e6d2..db69f7ba2d 100644
--- a/engines/access/events.cpp
+++ b/engines/access/events.cpp
@@ -144,15 +144,20 @@ void EventsManager::checkForNextFrameCounter() {
++_frameCounter;
_priorFrameTime = milli;
- // Give time to the debugger
- _vm->_debugger->onFrame();
+ nextFrame();
+ }
+}
- // Signal the ScummVM debugger
- _vm->_debugger->onFrame();
+void EventsManager::nextFrame() {
- // TODO: Refactor for dirty rects
- _vm->_screen->updateScreen();
- }
+ // Give time to the debugger
+ _vm->_debugger->onFrame();
+
+ // Update timers
+ _vm->_animation->updateTimers();
+
+ // TODO: Refactor for dirty rects
+ _vm->_screen->updateScreen();
}
void EventsManager::delay(int time) {
diff --git a/engines/access/events.h b/engines/access/events.h
index aa01543381..c3faf6333b 100644
--- a/engines/access/events.h
+++ b/engines/access/events.h
@@ -47,6 +47,8 @@ private:
uint32 _priorFrameTime;
void checkForNextFrameCounter();
+
+ void nextFrame();
public:
CursorType _cursorId;
bool _leftButton;