aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2007-07-06 13:21:43 +0000
committerFilippos Karapetis2007-07-06 13:21:43 +0000
commit3efcdd7a4316d41fa9626ceee0f8491b463a76c7 (patch)
tree758f5ca452c5e017ce120defebb5e029cf8dc87e
parentceca6a82f1f64c3a9e950628e1930f5f18aceb23 (diff)
downloadscummvm-rg350-3efcdd7a4316d41fa9626ceee0f8491b463a76c7.tar.gz
scummvm-rg350-3efcdd7a4316d41fa9626ceee0f8491b463a76c7.tar.bz2
scummvm-rg350-3efcdd7a4316d41fa9626ceee0f8491b463a76c7.zip
Modified ticksToMSec in IHNM, so that it waits for the correct amount of time. Many animations which were not displayed quite right are fixed now, including some small syncing issues with video and sound in some places
svn-id: r27939
-rw-r--r--engines/saga/actor.cpp2
-rw-r--r--engines/saga/saga.h12
-rw-r--r--engines/saga/sfuncs.cpp17
3 files changed, 19 insertions, 12 deletions
diff --git a/engines/saga/actor.cpp b/engines/saga/actor.cpp
index 743d0cd6c5..ecf7202725 100644
--- a/engines/saga/actor.cpp
+++ b/engines/saga/actor.cpp
@@ -1130,7 +1130,7 @@ void Actor::handleSpeech(int msec) {
}
if (_activeSpeech.stringsCount == 0) {
- _vm->_script->wakeUpThreadsDelayed(kWaitTypeSpeech, ticksToMSec(kScriptTimeTicksPerSecond / 3));
+ _vm->_script->wakeUpThreadsDelayed(kWaitTypeSpeech, _vm->ticksToMSec(kScriptTimeTicksPerSecond / 3));
}
return;
diff --git a/engines/saga/saga.h b/engines/saga/saga.h
index 19d965643a..844a738418 100644
--- a/engines/saga/saga.h
+++ b/engines/saga/saga.h
@@ -339,6 +339,7 @@ enum GameObjectTypes {
enum ScriptTimings {
kScriptTimeTicksPerSecond = (728L/10L),
+ kScriptTimeTicksPerSecondIHNM = 72,
kRepeatSpeedTicks = (728L/10L)/3,
kNormalFadeDuration = 320, // 64 steps, 5 msec each
kQuickFadeDuration = 64, // 64 steps, 1 msec each
@@ -459,10 +460,6 @@ struct SaveGameHeader {
char name[SAVE_TITLE_SIZE];
};
-inline int ticksToMSec(int tick) {
- return tick * 1000 / kScriptTimeTicksPerSecond;
-}
-
inline int clamp(int minValue, int value, int maxValue) {
if (value <= minValue) {
return minValue;
@@ -595,6 +592,13 @@ public:
return _leftMouseButtonPressed || _rightMouseButtonPressed;
}
+ inline int ticksToMSec(int tick) {
+ if (getGameType() == GType_ITE)
+ return tick * 1000 / kScriptTimeTicksPerSecond;
+ else
+ return tick * 1000 / kScriptTimeTicksPerSecondIHNM;
+ }
+
private:
uint _saveFilesMaxCount;
uint _saveFilesCount;
diff --git a/engines/saga/sfuncs.cpp b/engines/saga/sfuncs.cpp
index 1556b20487..a9c4f6cad5 100644
--- a/engines/saga/sfuncs.cpp
+++ b/engines/saga/sfuncs.cpp
@@ -266,7 +266,7 @@ void Script::sfWait(SCRIPTFUNC_PARAMS) {
time = thread->pop();
if (!_skipSpeeches) {
- thread->waitDelay(ticksToMSec(time)); // put thread to sleep
+ thread->waitDelay(_vm->ticksToMSec(time)); // put thread to sleep
}
}
@@ -437,7 +437,7 @@ void Script::sfStartBgdAnim(SCRIPTFUNC_PARAMS) {
int16 cycles = thread->pop();
_vm->_anim->setCycles(animId, cycles);
- _vm->_anim->setFrameTime(animId, ticksToMSec(kRepeatSpeedTicks));
+ _vm->_anim->setFrameTime(animId, _vm->ticksToMSec(kRepeatSpeedTicks));
_vm->_anim->play(animId, 0);
debug(1, "sfStartBgdAnim(%d, %d)", animId, cycles);
@@ -695,7 +695,7 @@ void Script::sfSetBgdAnimSpeed(SCRIPTFUNC_PARAMS) {
int16 animId = thread->pop();
int16 speed = thread->pop();
- _vm->_anim->setFrameTime(animId, ticksToMSec(speed));
+ _vm->_anim->setFrameTime(animId, _vm->ticksToMSec(speed));
debug(1, "sfSetBgdAnimSpeed(%d, %d)", animId, speed);
}
@@ -723,7 +723,7 @@ void Script::sfStartBgdAnimSpeed(SCRIPTFUNC_PARAMS) {
int16 speed = thread->pop();
_vm->_anim->setCycles(animId, cycles);
- _vm->_anim->setFrameTime(animId, ticksToMSec(speed));
+ _vm->_anim->setFrameTime(animId, _vm->ticksToMSec(speed));
_vm->_anim->play(animId, 0);
debug(1, "sfStartBgdAnimSpeed(%d, %d, %d)", animId, cycles, speed);
@@ -1086,7 +1086,7 @@ void Script::sfChainBgdAnim(SCRIPTFUNC_PARAMS) {
if (speed >= 0) {
_vm->_anim->setCycles(animId, cycles);
_vm->_anim->stop(animId);
- _vm->_anim->setFrameTime(animId, ticksToMSec(speed));
+ _vm->_anim->setFrameTime(animId, _vm->ticksToMSec(speed));
}
_vm->_anim->link(animId1, animId);
@@ -2138,8 +2138,11 @@ void Script::sfQueueMusic(SCRIPTFUNC_PARAMS) {
event.param = _vm->_music->_songTable[param1];
event.param2 = param2 ? MUSIC_LOOP : MUSIC_NORMAL;
event.op = kEventPlay;
- event.time = 5 * 1000; // we wait for 5x the duration here, to let the previous music track end
- // TODO: original waits for 1000ms here, why is the 5x duration needed?
+ event.time = _vm->ticksToMSec(500); // I find the delay in the original to be too long, so I've set it to
+ // wait for half the time, which sounds better when chapter points
+ // change
+ // FIXME: If this is too short for other cases apart from chapter
+ // point change, set it back to 1000
_vm->_events->queue(&event);