aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/toltecs/TODO.txt23
-rw-r--r--engines/toltecs/script.cpp20
-rw-r--r--engines/toltecs/sound.cpp9
-rw-r--r--engines/toltecs/sound.h1
-rw-r--r--engines/toltecs/toltecs.cpp3
5 files changed, 46 insertions, 10 deletions
diff --git a/engines/toltecs/TODO.txt b/engines/toltecs/TODO.txt
index 45b7b6d4e5..6317f4af4e 100644
--- a/engines/toltecs/TODO.txt
+++ b/engines/toltecs/TODO.txt
@@ -5,21 +5,36 @@ NOTES
TODO
------
-- Finish music support (game seems to use XMIDI, MIDI and headerless music...figure out more)
+- Finish music support (volume, looping perhaps?)
+- Check if background resources are used before purging them when changing scenes - check
+ the comments inside sfLoadScene.
+- Sometimes, some stray lines are drawn below fonts - probably because the text doesn't
+ fit inside the screen and the surface is cut off incorrectly.
+- Load/start sound and music of the saved scene when loading.
+- The animation changes in commit 105 (probably) seem to be insufficient - some animations
+ exceed the screen height (together with the interface) - perhaps the interface height
+ should not be saved?
+- Some sounds are cut off prematurely (e.g. when an animation finishes before the sound
+ sample, when changing scenes and a dialog is immediately started afterwards).
- When saving a game, save the whole screen when an animation is playing
e.g. when playing animations (the script controlled ones, not the movies) it should save
the whole screen when the game is saved when such an animation is running since it uses
delta-frames so currently, once restored, the screen is wrong. This is only observed in
a few places.
+
BUGS
------
-- Crashes sometimes on scene changes
- (I guess because some talktext is still running although the slot used by it has changed)
-- Crashes sometimes (e.g. when inside the barn and going up the ladder)
+None known (see TODO).
DONE
------
+- Crashes sometimes on scene changes
+ (I guess because some talktext is still running although the slot used by it has changed)
+ Crashes sometimes (e.g. when inside the barn and going up the ladder)
+ These crashes are caused by non-stopping background sounds, see TODO above.
+- The game music is in XMIDI. I'm assuming that the rest of the formats were because of badly
+ dumped resources - finalize() Calls were missing and the resulting music could contain anything.
- Implement dirty rectangles (low priority)
- Optimize segment mask redrawing (only redraw what's neccessary)
- Add movie playback functionality (movie format is known, needs implementing)
diff --git a/engines/toltecs/script.cpp b/engines/toltecs/script.cpp
index d95ac0ec06..d0bf39bb0f 100644
--- a/engines/toltecs/script.cpp
+++ b/engines/toltecs/script.cpp
@@ -896,7 +896,17 @@ void ScriptInterpreter::sfLoadAddPalette() {
void ScriptInterpreter::sfLoadScene() {
if (arg8(3) == 0) {
- _vm->_sound->stopSpeech();
+ // FIXME: Originally, this was stopSpeech(). However, we need to stop
+ // ALL sounds here (including sound effects and background sounds)
+ // before purgeCache() is called, otherwise the sound buffers will be
+ // invalidated. This is apparent when moving from a scene that has
+ // background sounds (such as the canyon at the beginning), to another
+ // one that doesn't (such as the map), and does not stop the sounds
+ // already playing. In this case, the engine will either crash or
+ // garbage will be heard through the speakers.
+ // TODO: We should either move purgeCache() elsewhere, or monitor
+ // which resources are still used before purging the cache.
+ _vm->_sound->stopAll();
_vm->_res->purgeCache();
_vm->loadScene(arg16(4));
} else {
@@ -1053,8 +1063,8 @@ void ScriptInterpreter::sfStartSequence() {
// TODO: It seems that music is always looping?
_vm->_musicPlayer->playMIDI(data, resourceSize, true);
} else {
- // TODO: Where does this occur? Are these SMF MIDI files?
- warning("sfStartSequence: resource %d isn't XMIDI", sequenceResIndex);
+ // Sanity check: this should never occur
+ error("sfStartSequence: resource %d isn't XMIDI", sequenceResIndex);
}
delete[] data;
@@ -1080,8 +1090,8 @@ void ScriptInterpreter::sfPlaySound2() {
}
void ScriptInterpreter::sfClearScreen() {
- // TODO
- debug("ScriptInterpreter::sfClearScreen");
+ // TODO: Occurs on every scene change, but seems unneeded
+ //debug("ScriptInterpreter::sfClearScreen");
}
void ScriptInterpreter::sfHandleInput() {
diff --git a/engines/toltecs/sound.cpp b/engines/toltecs/sound.cpp
index 3bebd81345..47d52637fb 100644
--- a/engines/toltecs/sound.cpp
+++ b/engines/toltecs/sound.cpp
@@ -176,4 +176,13 @@ void Sound::stopSpeech() {
}
}
+void Sound::stopAll() {
+ for (int i = 0; i < kMaxChannels; i++) {
+ _vm->_mixer->stopHandle(channels[i].handle);
+ _vm->_screen->keepTalkTextItemsAlive();
+ channels[i].type = kChannelTypeEmpty;
+ channels[i].resIndex = -1;
+ }
+}
+
} // End of namespace Toltecs
diff --git a/engines/toltecs/sound.h b/engines/toltecs/sound.h
index 1414631c6d..e4580effa1 100644
--- a/engines/toltecs/sound.h
+++ b/engines/toltecs/sound.h
@@ -57,6 +57,7 @@ public:
void playSoundAtPos(int16 resIndex, int16 x, int16 y);
void updateSpeech();
void stopSpeech();
+ void stopAll();
protected:
ToltecsEngine *_vm;
diff --git a/engines/toltecs/toltecs.cpp b/engines/toltecs/toltecs.cpp
index c3bb69c60b..c268b13563 100644
--- a/engines/toltecs/toltecs.cpp
+++ b/engines/toltecs/toltecs.cpp
@@ -309,7 +309,8 @@ void ToltecsEngine::drawScreen() {
// Update the GUI when needed and it's visible
if (_cameraHeight + _guiHeight > 400) {
// HACK: Sanity check - happens when smoking the peace pipe in the
- // Indian village.
+ // Indian village, when cheating at the game of cards and when
+ // the ladies find out that the sergeant is drinking again.
// FIXME: why does this happen? Fix the actual cause.
warning("Scene height (%d) and GUI height (%d) exceed the screen "
"height, cutting off the screen", _cameraHeight, _guiHeight);