diff options
author | Eugene Sandulenko | 2005-05-22 01:20:47 +0000 |
---|---|---|
committer | Eugene Sandulenko | 2005-05-22 01:20:47 +0000 |
commit | cf9049811e4be373d5100350cebb86db70f3eb8b (patch) | |
tree | 2c70cbeef6f9cea23731080a8462415cbb97d689 | |
parent | 0b1094ef045be590b66c5e1e530fc29ab1969785 (diff) | |
download | scummvm-rg350-cf9049811e4be373d5100350cebb86db70f3eb8b.tar.gz scummvm-rg350-cf9049811e4be373d5100350cebb86db70f3eb8b.tar.bz2 scummvm-rg350-cf9049811e4be373d5100350cebb86db70f3eb8b.zip |
Implement sfSimulSpeech2 which is used in lodge when talking to Sakka.
Fixed sfSimulSpeech(), so it plays voices with CD version.
svn-id: r18212
-rw-r--r-- | saga/actor.cpp | 4 | ||||
-rw-r--r-- | saga/actor.h | 2 | ||||
-rw-r--r-- | saga/script.h | 2 | ||||
-rw-r--r-- | saga/sfuncs.cpp | 44 |
4 files changed, 42 insertions, 10 deletions
diff --git a/saga/actor.cpp b/saga/actor.cpp index 5b0baf10b3..fc89d06934 100644 --- a/saga/actor.cpp +++ b/saga/actor.cpp @@ -1749,7 +1749,7 @@ void Actor::nonActorSpeech(const char **strings, int stringsCount, int speechFla _activeSpeech.slowModeCharIndex = 0; } -void Actor::simulSpeech(const char *string, uint16 *actorIds, int actorIdsCount, int speechFlags) { +void Actor::simulSpeech(const char *string, uint16 *actorIds, int actorIdsCount, int speechFlags, int sampleResourceId) { int i; if (_vm->getGameType() == GType_IHNM) { @@ -1769,7 +1769,7 @@ void Actor::simulSpeech(const char *string, uint16 *actorIds, int actorIdsCount, _activeSpeech.strings[0] = string; _activeSpeech.stringsCount = 1; _activeSpeech.speechFlags = speechFlags; - _activeSpeech.sampleResourceId = -1; + _activeSpeech.sampleResourceId = sampleResourceId; _activeSpeech.playing = false; _activeSpeech.slowModeCharIndex = 0; diff --git a/saga/actor.h b/saga/actor.h index 73b584f37b..d1d53e73d7 100644 --- a/saga/actor.h +++ b/saga/actor.h @@ -486,7 +486,7 @@ public: // speech void actorSpeech(uint16 actorId, const char **strings, int stringsCount, uint16 sampleResourceId, int speechFlags); void nonActorSpeech(const char **strings, int stringsCount, int speechFlags); - void simulSpeech(const char *string, uint16 *actorIds, int actorIdsCount, int speechFlags); + void simulSpeech(const char *string, uint16 *actorIds, int actorIdsCount, int speechFlags, int sampleResourceId); void setSpeechColor(int speechColor, int outlineColor) { _activeSpeech.speechColor[0] = speechColor; _activeSpeech.outlineColor[0] = outlineColor; diff --git a/saga/script.h b/saga/script.h index 7e8973e1f5..1639249a57 100644 --- a/saga/script.h +++ b/saga/script.h @@ -509,7 +509,7 @@ private: void sfCheckUserInterrupt(SCRIPTFUNC_PARAMS); void sfScriptWalkRelative(SCRIPTFUNC_PARAMS); void sfScriptMoveRelative(SCRIPTFUNC_PARAMS); - void SF_simulSpeech2(SCRIPTFUNC_PARAMS); + void sfSimulSpeech2(SCRIPTFUNC_PARAMS); void sfPlacard(SCRIPTFUNC_PARAMS); void sfPlacardOff(SCRIPTFUNC_PARAMS); void sfSetProtagState(SCRIPTFUNC_PARAMS); diff --git a/saga/sfuncs.cpp b/saga/sfuncs.cpp index 3b8dd9a3a9..9ef537e1c3 100644 --- a/saga/sfuncs.cpp +++ b/saga/sfuncs.cpp @@ -97,7 +97,7 @@ void Script::setupScriptFuncList(void) { OPCODE(sfCheckUserInterrupt), OPCODE(sfScriptWalkRelative), OPCODE(sfScriptMoveRelative), - OPCODE(SF_simulSpeech2), + OPCODE(sfSimulSpeech2), OPCODE(sfPlacard), OPCODE(sfPlacardOff), OPCODE(sfSetProtagState), @@ -808,6 +808,7 @@ void Script::sfSimulSpeech(SCRIPTFUNC_PARAMS) { int i; uint16 actorsIds[ACTOR_SPEECH_ACTORS_MAX]; const char *string; + int16 sampleResourceId = -1; stringId = thread->pop(); actorsCount = thread->pop(); @@ -820,7 +821,14 @@ void Script::sfSimulSpeech(SCRIPTFUNC_PARAMS) { string = thread->_strings->getString(stringId); - _vm->_actor->simulSpeech(string, actorsIds, actorsCount, 0); + if (thread->_voiceLUT->voices) { + sampleResourceId = thread->_voiceLUT->voices[stringId]; + if (sampleResourceId <= 0 || sampleResourceId > 4000) + sampleResourceId = -1; + } + + _vm->_actor->simulSpeech(string, actorsIds, actorsCount, 0, sampleResourceId); + thread->wait(kWaitTypeSpeech); } // Script function #36 (0x24) ? @@ -1118,11 +1126,35 @@ void Script::sfScriptMoveRelative(SCRIPTFUNC_PARAMS) { } // Script function #47 (0x2F) -void Script::SF_simulSpeech2(SCRIPTFUNC_PARAMS) { - for (int i = 0; i < nArgs; i++) - thread->pop(); +void Script::sfSimulSpeech2(SCRIPTFUNC_PARAMS) { + int16 stringId; + int16 actorsCount; + int16 speechFlags; + int i; + uint16 actorsIds[ACTOR_SPEECH_ACTORS_MAX]; + const char *string; + int16 sampleResourceId = -1; + + stringId = thread->pop(); + actorsCount = thread->pop(); + speechFlags = thread->pop(); + + if (actorsCount > ACTOR_SPEECH_ACTORS_MAX) + error("sfSimulSpeech2 actorsCount=0x%X exceed ACTOR_SPEECH_ACTORS_MAX", actorsCount); + + for (i = 0; i < actorsCount; i++) + actorsIds[i] = thread->pop(); + + string = thread->_strings->getString(stringId); + + if (thread->_voiceLUT->voices) { + sampleResourceId = thread->_voiceLUT->voices[stringId]; + if (sampleResourceId <= 0 || sampleResourceId > 4000) + sampleResourceId = -1; + } - error(0, "STUB: SF_simulSpeech2(), %d args", nArgs); + _vm->_actor->simulSpeech(string, actorsIds, actorsCount, speechFlags, sampleResourceId); + thread->wait(kWaitTypeSpeech); } static TEXTLIST_ENTRY *placardTextEntry; |