aboutsummaryrefslogtreecommitdiff
path: root/saga
diff options
context:
space:
mode:
authorTorbjörn Andersson2005-08-26 12:07:31 +0000
committerTorbjörn Andersson2005-08-26 12:07:31 +0000
commitd8a96c30321c6a615689ed5137b3a26161e2d154 (patch)
tree444b027a26cfe7cf82cad98dd65261db47646466 /saga
parent41e9aa2f2c84704712abb64f8ad2110e0eab25fe (diff)
downloadscummvm-rg350-d8a96c30321c6a615689ed5137b3a26161e2d154.tar.gz
scummvm-rg350-d8a96c30321c6a615689ed5137b3a26161e2d154.tar.bz2
scummvm-rg350-d8a96c30321c6a615689ed5137b3a26161e2d154.zip
Allowed IHNM to use the opSpeak opcode. Aborting that code path early meant
that the instruction wasn't fully read, so the next opcode would be wrong. This is what caused it to crash. To keep the game from hanging, I also allowed the engine to call the _actors->direct() function for IHNM. This allows AM's intro speech to be played in its entirety. Since this includes the "hate" speech, I've removed that part from the hard-coded intro. To get the right music playing, I've enabled the sfPlayMusic() function for IHNM. This is pure guesswork, though. Once the scene changes, the wrong music plays again. However, this is scene music, i.e. not scripted. It doesn't play the background sound. Looks like _fxTable[] isn't generated for IHNM. More noticeably, until the scene changes it doesn't show any graphics apart from the subtitles, which are drawn in the wrong colour and (I believe) the wrong font. svn-id: r18712
Diffstat (limited to 'saga')
-rw-r--r--saga/ihnm_introproc.cpp85
-rw-r--r--saga/saga.cpp2
-rw-r--r--saga/sfuncs.cpp10
-rw-r--r--saga/sthread.cpp5
4 files changed, 9 insertions, 93 deletions
diff --git a/saga/ihnm_introproc.cpp b/saga/ihnm_introproc.cpp
index ab6b93af29..48d88d3385 100644
--- a/saga/ihnm_introproc.cpp
+++ b/saga/ihnm_introproc.cpp
@@ -83,7 +83,6 @@ LoadSceneParams IHNM_IntroList[] = {
{0, kLoadByDescription, &IHNM_IntroMovie1Desc, Scene::SC_IHNMIntroMovieProc1, false, kTransitionNoFade, 0, NO_CHAPTER_CHANGE},
{0, kLoadByDescription, &IHNM_IntroMovie2Desc, Scene::SC_IHNMIntroMovieProc2, false, kTransitionNoFade, 0, NO_CHAPTER_CHANGE},
{0, kLoadByDescription, &IHNM_IntroMovie3Desc, Scene::SC_IHNMIntroMovieProc3, false, kTransitionNoFade, 0, NO_CHAPTER_CHANGE},
- {0, kLoadByDescription, &IHNM_IntroMovie4Desc, Scene::SC_IHNMHateProc, false, kTransitionNoFade, 0, NO_CHAPTER_CHANGE}
};
int Scene::IHNMStartProc() {
@@ -322,88 +321,4 @@ int Scene::IHNMIntroMovieProc3(int param) {
return 0;
}
-int Scene::SC_IHNMHateProc(int param, void *refCon) {
- return ((Scene *)refCon)->IHNMHateProc(param);
-}
-
-int Scene::IHNMHateProc(int param) {
- Event event;
- Event *q_event;
-
- switch (param) {
- case SCENE_BEGIN:
- _vm->_anim->setCycles(0, -1);
-
- // Start "hate" animation
- event.type = kEvTOneshot;
- event.code = kAnimEvent;
- event.op = kEventPlay;
- event.param = 0;
- event.time = 0;
-
- q_event = _vm->_events->queue(&event);
-
- // More music
- event.type = kEvTOneshot;
- event.code = kMusicEvent;
- event.param = 32;
- event.param2 = MUSIC_LOOP;
- event.op = kEventPlay;
- event.time = 0;
-
- q_event = _vm->_events->chain(q_event, &event);
-
- // Background for intro scene is the first frame of the
- // intro animation; display it and set the palette
- event.type = kEvTOneshot;
- event.code = kBgEvent;
- event.op = kEventDisplay;
- event.param = kEvPSetPalette;
- event.time = 0;
-
- q_event = _vm->_events->chain(q_event, &event);
-
- // Play voice
- event.type = kEvTOneshot;
- event.code = kVoiceEvent;
- event.op = kEventPlay;
- event.param = 0;
- event.time = 0;
-
- q_event = _vm->_events->chain(q_event, &event);
-
- // Background sound
- event.type = kEvTOneshot;
- event.code = kSoundEvent;
- event.op = kEventPlay;
- event.param = 260;
- event.param2 = 255; // FIXME: Verify volume
- event.param3 = SOUND_LOOP;
- event.time = 0;
-
- q_event = _vm->_events->chain(q_event, &event);
-
- // End background sound after the voice has finished
- event.type = kEvTOneshot;
- event.code = kSoundEvent;
- event.op = kEventStop;
- event.time = _vm->_sndRes->getVoiceLength(0);
-
- q_event = _vm->_events->chain(q_event, &event);
-
- // End scene after the voice has finished
- event.type = kEvTOneshot;
- event.code = kSceneEvent;
- event.op = kEventEnd;
- event.time = 0;
-
- q_event = _vm->_events->chain(q_event, &event);
- break;
- default:
- break;
- }
-
- return 0;
-}
-
} // End of namespace Saga
diff --git a/saga/saga.cpp b/saga/saga.cpp
index 52c326a971..0d6b73b12e 100644
--- a/saga/saga.cpp
+++ b/saga/saga.cpp
@@ -314,7 +314,7 @@ int SagaEngine::go() {
// Since Puzzle is actorless, we do it here
if (_puzzle->isActive()) {
_actor->handleSpeech(msec);
- } else if (!_scene->isInIntro() && getGameType() == GType_ITE) {
+ } else if (!_scene->isInIntro()) {
if (_interface->getMode() == kPanelMain ||
_interface->getMode() == kPanelConverse ||
_interface->getMode() == kPanelNull)
diff --git a/saga/sfuncs.cpp b/saga/sfuncs.cpp
index a84a1b04a7..eeff7361e9 100644
--- a/saga/sfuncs.cpp
+++ b/saga/sfuncs.cpp
@@ -1640,12 +1640,12 @@ void Script::sfPlayMusic(SCRIPTFUNC_PARAMS) {
_vm->_music->stop();
}
} else {
- int16 param1 = thread->pop();
+ // TODO: Verify this
+ int16 param1 = thread->pop() + 32;
int16 param2 = thread->pop();
- debug(0, "STUB: sfPlayMusic(%d, %d)", param1, param2);
+ _vm->_music->play(param1, param2 ? MUSIC_LOOP: MUSIC_NORMAL);
}
-
}
// Script function #64 (0x40)
@@ -1738,6 +1738,10 @@ void Script::sfPlayLoopedSound(SCRIPTFUNC_PARAMS) {
int16 param = thread->pop();
int res;
+ // TODO: This doesn't work for IHNM yet. As a point of reference, when
+ // 'param' is 11, during the "hate" speech, it should probably
+ // play sound resource 260. Probably quite loudly.
+
if (param >= 0 && param < _vm->_sndRes->_fxTableLen) {
res = _vm->_sndRes->_fxTable[param].res;
if (_vm->getFeatures() & GF_CD_FX)
diff --git a/saga/sthread.cpp b/saga/sthread.cpp
index d2b0d8c8d5..1c4e0badb9 100644
--- a/saga/sthread.cpp
+++ b/saga/sthread.cpp
@@ -615,16 +615,13 @@ bool Script::runThread(ScriptThread *thread, uint instructionLimit) {
int16 first;
const char *strings[ACTOR_SPEECH_STRING_MAX];
- if (_vm->getGameType() == GType_IHNM)
- break;
-
if (_vm->_actor->isSpeaking()) {
thread->wait(kWaitTypeSpeech);
return false;
}
stringsCount = scriptS.readByte();
- actorId = scriptS.readUint16LE();
+ actorId = scriptS.readUint16LE();
speechFlags = scriptS.readByte();
scriptS.readUint16LE(); // x,y skip