KYRA: (LoK) - fix animation glitch when skipping over scene
(When skipping over a scene by left-clicking, sometimes parts of the ongoing animation would remain visible on screen, e. g. some of Herman's body parts in the cave at the beginning)
This commit is contained in:
parent
9d12e006fd
commit
e4d132395c
3 changed files with 16 additions and 10 deletions
|
@ -498,21 +498,25 @@ void KyraEngine_LoK::mainLoop() {
|
|||
}
|
||||
|
||||
void KyraEngine_LoK::delayUntil(uint32 timestamp, bool updateTimers, bool update, bool isMainLoop) {
|
||||
while (_system->getMillis() < timestamp && !shouldQuit() && !skipFlag()) {
|
||||
uint32 ct = _system->getMillis();
|
||||
while (ct < timestamp && !shouldQuit()) {
|
||||
if (updateTimers)
|
||||
_timer->update();
|
||||
|
||||
if (timestamp - _system->getMillis() >= 10)
|
||||
ct = skipFlag() ? ct + _tickLength : _system->getMillis();
|
||||
|
||||
if (timestamp - ct >= 10)
|
||||
delay(10, update, isMainLoop);
|
||||
}
|
||||
}
|
||||
|
||||
void KyraEngine_LoK::delay(uint32 amount, bool update, bool isMainLoop) {
|
||||
uint32 start = _system->getMillis();
|
||||
uint32 ct = start;
|
||||
do {
|
||||
if (update) {
|
||||
_sprites->updateSceneAnims();
|
||||
_animator->updateAllObjectShapes();
|
||||
_animator->updateAllObjectShapes(!skipFlag());
|
||||
updateTextFade();
|
||||
updateMousePointer();
|
||||
} else {
|
||||
|
@ -546,7 +550,8 @@ void KyraEngine_LoK::delay(uint32 amount, bool update, bool isMainLoop) {
|
|||
|
||||
if (skipFlag())
|
||||
snd_stopVoice();
|
||||
} while (!skipFlag() && _system->getMillis() < start + amount && !shouldQuit());
|
||||
ct = skipFlag() ? ct + _tickLength : _system->getMillis();
|
||||
} while (ct < start + amount && !shouldQuit());
|
||||
}
|
||||
|
||||
bool KyraEngine_LoK::skipFlag() const {
|
||||
|
|
|
@ -338,7 +338,7 @@ void Animator_LoK::prepDrawAllObjects() {
|
|||
}
|
||||
}
|
||||
|
||||
void Animator_LoK::copyChangedObjectsForward(int refreshFlag) {
|
||||
void Animator_LoK::copyChangedObjectsForward(int refreshFlag, bool refreshScreen) {
|
||||
for (AnimObject *curObject = _objectQueue; curObject; curObject = curObject->nextAnimObject) {
|
||||
if (curObject->active) {
|
||||
if (curObject->refreshFlag || refreshFlag) {
|
||||
|
@ -370,14 +370,15 @@ void Animator_LoK::copyChangedObjectsForward(int refreshFlag) {
|
|||
}
|
||||
}
|
||||
|
||||
_screen->updateScreen();
|
||||
if (refreshScreen)
|
||||
_screen->updateScreen();
|
||||
}
|
||||
|
||||
void Animator_LoK::updateAllObjectShapes() {
|
||||
void Animator_LoK::updateAllObjectShapes(bool refreshScreen) {
|
||||
restoreAllObjectBackgrounds();
|
||||
preserveAnyChangedBackgrounds();
|
||||
prepDrawAllObjects();
|
||||
copyChangedObjectsForward(0);
|
||||
copyChangedObjectsForward(0, refreshScreen);
|
||||
}
|
||||
|
||||
void Animator_LoK::animRemoveGameItem(int index) {
|
||||
|
|
|
@ -69,9 +69,9 @@ public:
|
|||
void restoreAllObjectBackgrounds();
|
||||
void preserveAnyChangedBackgrounds();
|
||||
virtual void prepDrawAllObjects();
|
||||
void copyChangedObjectsForward(int refreshFlag);
|
||||
void copyChangedObjectsForward(int refreshFlag, bool refreshScreen = true);
|
||||
|
||||
void updateAllObjectShapes();
|
||||
void updateAllObjectShapes(bool refreshScreen = true);
|
||||
void animRemoveGameItem(int index);
|
||||
void animAddGameItem(int index, uint16 sceneId);
|
||||
void animAddNPC(int character);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue