aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/gob/coktelvideo.cpp14
-rw-r--r--engines/gob/coktelvideo.h8
2 files changed, 13 insertions, 9 deletions
diff --git a/engines/gob/coktelvideo.cpp b/engines/gob/coktelvideo.cpp
index ef89bc2c19..be639fae9f 100644
--- a/engines/gob/coktelvideo.cpp
+++ b/engines/gob/coktelvideo.cpp
@@ -123,8 +123,9 @@ bool Imd::load(Common::SeekableReadStream &stream) {
return false;
}
- _soundSliceLength = 1000 / (_soundFreq / _soundSliceSize);
- _frameLength = _soundSliceLength;
+ _soundSliceLength = (uint32) (((double) (1000 << 16)) /
+ ((double) _soundFreq / (double) _soundSliceSize));
+ _frameLength = _soundSliceLength >> 16;
_soundStage = 1;
_hasSound = true;
@@ -325,8 +326,8 @@ void Imd::waitEndFrame() {
return;
if (_skipFrames == 0) {
- int32 waitTime = (_curFrame * _soundSliceLength) -
- (g_system->getMillis() - _soundStartTime);
+ int32 waitTime = ((_curFrame * _soundSliceLength) -
+ ((g_system->getMillis() - _soundStartTime) << 16)) >> 16;
if (waitTime < 0) {
_skipFrames = -waitTime / _soundSliceLength;
@@ -943,10 +944,9 @@ bool Vmd::load(Common::SeekableReadStream &stream) {
_soundSliceSize = -_soundSliceSize;
}
- _soundSliceLength = (uint16) (1000.0 /
+ _soundSliceLength = (uint32) (((double) (1000 << 16)) /
((double) _soundFreq / (double) _soundSliceSize));
-
- _frameLength = _soundSliceLength;
+ _frameLength = _soundSliceLength >> 16;
_soundStage = 1;
_audioStream = Audio::makeAppendableAudioStream(_soundFreq,
diff --git a/engines/gob/coktelvideo.h b/engines/gob/coktelvideo.h
index 31b220cd56..348e5e3ab1 100644
--- a/engines/gob/coktelvideo.h
+++ b/engines/gob/coktelvideo.h
@@ -190,7 +190,11 @@ public:
int16 getHeight() const { return _height; }
uint16 getFramesCount() const { return _framesCount; }
uint16 getCurrentFrame() const { return _curFrame; }
- int16 getFrameRate() const { if (_hasSound) return 1000 / _soundSliceLength; return _frameRate; }
+ int16 getFrameRate() const {
+ if (_hasSound)
+ return 1000 / (_soundSliceLength >> 16);
+ return _frameRate;
+ }
uint32 getSyncLag() const { return _skipFrames; }
const byte *getPalette() const { return _palette; }
@@ -260,7 +264,7 @@ protected:
int16 _soundFreq;
int16 _soundSliceSize;
int16 _soundSlicesCount;
- uint16 _soundSliceLength;
+ uint32 _soundSliceLength;
Audio::AppendableAudioStream *_audioStream;
Audio::SoundHandle _audioHandle;