aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorJulien Templier2010-11-15 15:48:08 +0000
committerJulien Templier2010-11-15 15:48:08 +0000
commita4d9d0360155a8ddadd52d3bec60c7711a411d68 (patch)
tree16c337a85d3a1e0f0187fb3c3cf20c178ae9a10f /engines
parentdbb3e1dded5df10aebc6f8f2a5027a4d8bad72dd (diff)
downloadscummvm-rg350-a4d9d0360155a8ddadd52d3bec60c7711a411d68.tar.gz
scummvm-rg350-a4d9d0360155a8ddadd52d3bec60c7711a411d68.tar.bz2
scummvm-rg350-a4d9d0360155a8ddadd52d3bec60c7711a411d68.zip
LASTEXPRESS: Update Animation::process()
- Use Common::Rational to compute the current frame - Added check for _currentChunk != NULL - Add constructor to Chunk structure svn-id: r54245
Diffstat (limited to 'engines')
-rw-r--r--engines/lastexpress/data/animation.cpp6
-rw-r--r--engines/lastexpress/data/animation.h7
2 files changed, 11 insertions, 2 deletions
diff --git a/engines/lastexpress/data/animation.cpp b/engines/lastexpress/data/animation.cpp
index 3f1383022f..5ac9f8bf00 100644
--- a/engines/lastexpress/data/animation.cpp
+++ b/engines/lastexpress/data/animation.cpp
@@ -34,6 +34,8 @@
#include "lastexpress/helpers.h"
#include "common/events.h"
+#include "common/rational.h"
+
#include "engines/engine.h"
namespace LastExpress {
@@ -104,10 +106,10 @@ bool Animation::process() {
error("Trying to show an animation before loading data");
// TODO: substract the time paused by the GUI
- uint32 currentFrame = (uint32)(((float)(g_engine->_system->getMillis() - _startTime)) / 33.33f);
+ int32 currentFrame = Common::Rational((g_engine->_system->getMillis() - _startTime) * 100, 3333).toInt();
// Process all chunks until the current frame
- while (!_changed && currentFrame > _currentChunk->frame && !hasEnded()) {
+ while (!_changed && _currentChunk != NULL && currentFrame > _currentChunk->frame && !hasEnded()) {
switch(_currentChunk->type) {
//TODO: some info chunks are probably subtitle/sync related
case kChunkTypeUnknown1:
diff --git a/engines/lastexpress/data/animation.h b/engines/lastexpress/data/animation.h
index ca1f7c6fa0..435621eb8e 100644
--- a/engines/lastexpress/data/animation.h
+++ b/engines/lastexpress/data/animation.h
@@ -69,6 +69,7 @@ private:
// despite their size field, info chunks don't have a payload
enum ChunkType {
+ kChunkTypeNone = 0,
kChunkTypeUnknown1 = 1,
kChunkTypeUnknown2 = 2,
kChunkTypeAudioInfo = 3,
@@ -91,6 +92,12 @@ private:
ChunkType type;
uint16 frame;
uint32 size;
+
+ Chunk() {
+ type = kChunkTypeNone;
+ frame = 0;
+ size = 0;
+ }
};
void reset();