ACCESS: Added code to update animations each frame

This commit is contained in:
Paul Gilbert 2014-08-15 20:26:09 -04:00
parent e3687ea123
commit f8d64ae6bc
4 changed files with 36 additions and 11 deletions

View File

@ -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

View File

@ -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 {

View File

@ -144,17 +144,22 @@ void EventsManager::checkForNextFrameCounter() {
++_frameCounter;
_priorFrameTime = milli;
// Give time to the debugger
_vm->_debugger->onFrame();
// Signal the ScummVM debugger
_vm->_debugger->onFrame();
// TODO: Refactor for dirty rects
_vm->_screen->updateScreen();
nextFrame();
}
}
void EventsManager::nextFrame() {
// 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) {
g_system->delayMillis(time);
}

View File

@ -47,6 +47,8 @@ private:
uint32 _priorFrameTime;
void checkForNextFrameCounter();
void nextFrame();
public:
CursorType _cursorId;
bool _leftButton;