[Scummvm-cvs-logs] SF.net SVN: scummvm:[54673] scummvm/trunk/engines/mohawk
fuzzie at users.sourceforge.net
fuzzie at users.sourceforge.net
Tue Nov 30 15:40:51 CET 2010
Revision: 54673
http://scummvm.svn.sourceforge.net/scummvm/?rev=54673&view=rev
Author: fuzzie
Date: 2010-11-30 14:40:51 +0000 (Tue, 30 Nov 2010)
Log Message:
-----------
MOHAWK: fix LBAnimation start/seek behaviour
Modified Paths:
--------------
scummvm/trunk/engines/mohawk/livingbooks.cpp
scummvm/trunk/engines/mohawk/livingbooks.h
Modified: scummvm/trunk/engines/mohawk/livingbooks.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/livingbooks.cpp 2010-11-30 14:17:59 UTC (rev 54672)
+++ scummvm/trunk/engines/mohawk/livingbooks.cpp 2010-11-30 14:40:51 UTC (rev 54673)
@@ -1256,8 +1256,8 @@
for (uint16 i = 0; i < scriptIDs.size(); i++)
_nodes.push_back(new LBAnimationNode(_vm, this, scriptIDs[i]));
+ _currentFrame = 0;
_running = false;
- _done = false;
_tempo = 1;
}
@@ -1321,12 +1321,12 @@
_nodes[i]->draw(_bounds);
}
-void LBAnimation::update() {
+bool LBAnimation::update() {
if (!_running)
- return;
+ return false;
if (_vm->_system->getMillis() / 16 <= _lastTime + (uint32)_tempo)
- return;
+ return false;
// the second check is to try 'catching up' with lagged animations, might be crazy
if (_lastTime == 0 || (_vm->_system->getMillis() / 16) > _lastTime + (uint32)(_tempo * 2))
@@ -1351,24 +1351,20 @@
_currentFrame++;
} else if (state == kLBNodeDone) {
_running = false;
- _done = true;
+ return true;
}
+
+ return false;
}
void LBAnimation::start() {
_lastTime = 0;
- _currentFrame = 0;
_running = true;
- _done = false;
-
- for (uint32 i = 0; i < _nodes.size(); i++)
- _nodes[i]->reset();
}
void LBAnimation::seek(uint16 pos) {
_lastTime = 0;
_currentFrame = 0;
- _done = false;
for (uint32 i = 0; i < _nodes.size(); i++)
_nodes[i]->reset();
@@ -1390,17 +1386,8 @@
void LBAnimation::stop() {
_running = false;
- _done = false;
}
-bool LBAnimation::wasDone() {
- if (!_done)
- return false;
-
- _done = false;
- return true;
-}
-
bool LBAnimation::transparentAt(int x, int y) {
for (uint32 i = 0; i < _nodes.size(); i++)
if (!_nodes[i]->transparentAt(x - _bounds.left, y - _bounds.top))
@@ -2304,16 +2291,12 @@
void LBAnimationItem::update() {
if (!_neverEnabled && _enabled && _running) {
- _anim->update();
+ bool wasDone = _anim->update();
+ if (wasDone)
+ done(true);
}
LBItem::update();
-
- // TODO: where exactly does this go?
- // TODO: what checks should we have around this?
- if (!_neverEnabled && _enabled && _running && _anim->wasDone()) {
- done(true);
- }
}
bool LBAnimationItem::togglePlaying(bool playing) {
Modified: scummvm/trunk/engines/mohawk/livingbooks.h
===================================================================
--- scummvm/trunk/engines/mohawk/livingbooks.h 2010-11-30 14:17:59 UTC (rev 54672)
+++ scummvm/trunk/engines/mohawk/livingbooks.h 2010-11-30 14:40:51 UTC (rev 54673)
@@ -166,13 +166,12 @@
~LBAnimation();
void draw();
- void update();
+ bool update();
void start();
void seek(uint16 pos);
void stop();
- bool wasDone();
bool transparentAt(int x, int y);
void setTempo(uint16 tempo);
@@ -194,7 +193,7 @@
uint16 _tempo;
uint32 _lastTime, _currentFrame;
- bool _running, _done;
+ bool _running;
void loadShape(uint16 resourceId);
Common::Array<uint16> _shapeResources;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list