aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorsylvaintv2016-05-29 23:16:28 +0200
committersylvaintv2016-05-29 23:16:28 +0200
commit05ebbd88a6f7bf7f01f899d9f5aad2519ddfa154 (patch)
treebe091e67a17bc971649e177da75497c651ec027a /engines
parent2c96073650013f982bf4e550fd32e45bfa9be0c3 (diff)
downloadscummvm-rg350-05ebbd88a6f7bf7f01f899d9f5aad2519ddfa154.tar.gz
scummvm-rg350-05ebbd88a6f7bf7f01f899d9f5aad2519ddfa154.tar.bz2
scummvm-rg350-05ebbd88a6f7bf7f01f899d9f5aad2519ddfa154.zip
GNAP: Fix waitForUpdate behavior
Diffstat (limited to 'engines')
-rw-r--r--engines/gnap/gamesys.cpp13
-rw-r--r--engines/gnap/gamesys.h2
2 files changed, 15 insertions, 0 deletions
diff --git a/engines/gnap/gamesys.cpp b/engines/gnap/gamesys.cpp
index e59662f08a..d1f2c8944f 100644
--- a/engines/gnap/gamesys.cpp
+++ b/engines/gnap/gamesys.cpp
@@ -48,6 +48,7 @@ GameSys::GameSys(GnapEngine *vm) : _vm(vm) {
_removeSequenceItemValue = 0;
_gfxItemsCount = 0;
_animationsCount = 0;
+ _animationsDone = false;
_backgroundImageValue3 = 0;
_backgroundImageValue1 = 0;
_backgroundImageValue4 = 1000;
@@ -167,6 +168,9 @@ void GameSys::requestRemoveSequence(int sequenceId, int id) {
void GameSys::waitForUpdate() {
//ResetEvent(updateEvent);
//WaitForSingleObject(updateEvent, INFINITE);
+ while ( !_animationsDone) {
+ _vm->gameUpdateTick();
+ }
}
int GameSys::isSequenceActive(int sequenceId, int id) {
@@ -1006,6 +1010,8 @@ void GameSys::fatUpdateFrame() {
if (clockDelta <= 0)
return;
+ _animationsDone = true;
+
int duration, currFrameNum;
for (int i = 0; i < _gfxItemsCount; ++i) {
@@ -1091,10 +1097,12 @@ void GameSys::fatUpdateFrame() {
} else {
gfxItem->_prevFrame._duration -= duration;
gfxItem->_updFlag = false;
+ _animationsDone = false;
}
} else {
gfxItem->_delayTicks -= clockDelta;
gfxItem->_updFlag = false;
+ _animationsDone = false;
}
}
} else {
@@ -1132,6 +1140,7 @@ void GameSys::fatUpdateFrame() {
gfxItem->_currFrame._rect = _newSpriteDrawItems[k]._rect;
gfxItem->_currFrame._spriteId = _newSpriteDrawItems[k]._surface ? 0xCAFEBABE : -1;// TODO
gfxItem->_currFrame._soundId = -1;
+ _animationsDone = false;
}
}
_newSpriteDrawItemsCount = 0;
@@ -1149,6 +1158,7 @@ void GameSys::fatUpdateFrame() {
gfxItem->_currFrame._soundId = -1;
gfxItem->_updFlag = true;
gfxItem->_surface = _grabSpriteSurface2;
+ _animationsDone = false;
break;
}
}
@@ -1175,6 +1185,7 @@ void GameSys::fatUpdateFrame() {
found = true;
}
if (found) {
+ _animationsDone = false;
seqRemoveGfx(seqItem->_sequenceId2, seqItem->_id2);
seqRemoveGfx(seqItem->_sequenceId, seqItem->_id);
_fatSequenceItems.remove_at(i);
@@ -1197,6 +1208,7 @@ void GameSys::fatUpdateFrame() {
found = true;
}
if (found) {
+ _animationsDone = false;
seqRemoveGfx(seqItem->_sequenceId, seqItem->_id);
_fatSequenceItems.remove_at(i);
--i;
@@ -1220,6 +1232,7 @@ void GameSys::fatUpdateFrame() {
seqRemoveGfx(seqItem->_sequenceId, seqItem->_id);
seqInsertGfx(i, gfxDuration);
}
+ _animationsDone = false;
}
} else {
_seqItems.remove_at(i);
diff --git a/engines/gnap/gamesys.h b/engines/gnap/gamesys.h
index 98014f1bac..b9752bde06 100644
--- a/engines/gnap/gamesys.h
+++ b/engines/gnap/gamesys.h
@@ -167,6 +167,8 @@ public:
int _backgroundImageValue4, _backgroundImageValue2;
int32 _gameSysClock, _lastUpdateClock;
+ bool _animationsDone;
+
Graphics::Surface *_backgroundSurface;
Graphics::Surface *_frontSurface;