aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra/kyra_v2.cpp
diff options
context:
space:
mode:
authorJohannes Schickel2007-10-13 06:57:47 +0000
committerJohannes Schickel2007-10-13 06:57:47 +0000
commitda9479dfb80d1849a75ed106564360e6978e48bb (patch)
tree4a1eeb085f90c423178e82270995640ef122d8e8 /engines/kyra/kyra_v2.cpp
parentefcc80dffaf1dcdd4d02cf4417085f9b8a37a4f9 (diff)
downloadscummvm-rg350-da9479dfb80d1849a75ed106564360e6978e48bb.tar.gz
scummvm-rg350-da9479dfb80d1849a75ed106564360e6978e48bb.tar.bz2
scummvm-rg350-da9479dfb80d1849a75ed106564360e6978e48bb.zip
- moved some voice functionallity from KyraEngine_v1 to KyraEngine
HoF: - added voice support - implemented opcodes -> o2_setVocHigh 167 -> o2_getVocHigh 168 -> o2_isVoiceEnabled 170 -> o2_isVoicePlaying 171 -> o2_stopVoicePlaying 172 -> o2_getGameLanguage 173 svn-id: r29201
Diffstat (limited to 'engines/kyra/kyra_v2.cpp')
-rw-r--r--engines/kyra/kyra_v2.cpp58
1 files changed, 48 insertions, 10 deletions
diff --git a/engines/kyra/kyra_v2.cpp b/engines/kyra/kyra_v2.cpp
index c25836c1e7..a079a83737 100644
--- a/engines/kyra/kyra_v2.cpp
+++ b/engines/kyra/kyra_v2.cpp
@@ -57,6 +57,8 @@ KyraEngine_v2::KyraEngine_v2(OSystem *system, const GameFlags &flags) : KyraEngi
_noScriptEnter = true;
_currentChapter = 0;
_newChapterFile = 1;
+ _oldTalkFile = -1;
+ _currentTalkFile = 0;
_handItemSet = -1;
_lastProcessedSceneScript = 0;
_specialSceneScriptRunFlag = false;
@@ -67,6 +69,9 @@ KyraEngine_v2::KyraEngine_v2(OSystem *system, const GameFlags &flags) : KyraEngi
_newShapeCount = 0;
_newShapeFiledata = 0;
+ _vocHigh = -1;
+ _chatVocHigh = -1;
+ _chatVocLow = -1;
_chatText = 0;
_chatObject = -1;
@@ -218,11 +223,11 @@ void KyraEngine_v2::startup() {
showMessageFromCCode(265, 150, 0);
- // XXX
-
- showMessageFromCCode(0, 0, 207);
+ openTalkFile(0);
+ _currentTalkFile = 1;
+ openTalkFile(1);
- // XXX
+ showMessage(0, 207);
_screen->setShapePages(5, 3);
@@ -1393,6 +1398,34 @@ void KyraEngine_v2::restoreGfxRect24x24(int x, int y) {
#pragma mark -
+void KyraEngine_v2::openTalkFile(int newFile) {
+ char talkFilename[16];
+
+ if (_oldTalkFile > 0) {
+ sprintf(talkFilename, "CH%dVOC.TLK", _oldTalkFile);
+ _res->unloadPakFile(talkFilename);
+ _oldTalkFile = -1;
+ }
+
+ if (newFile == 0) {
+ strcpy(talkFilename, "ANYTALK.TLK");
+ _res->loadPakFile(talkFilename);
+ } else {
+ sprintf(talkFilename, "CH%dVOC.TLK", newFile);
+ _res->loadPakFile(talkFilename);
+ }
+
+ _oldTalkFile = newFile;
+}
+
+void KyraEngine_v2::snd_playVoiceFile(int id) {
+ debugC(9, kDebugLevelMain | kDebugLevelSound, "KyraEngine_v2::snd_playVoiceFile(%d)", id);
+ char vocFile[9];
+ assert(id >= 0 && id <= 9999999);
+ sprintf(vocFile, "%07d", id);
+ _sound->voicePlay(vocFile);
+}
+
void KyraEngine_v2::snd_loadSoundFile(int id) {
if (id < 0 || !_trackMap)
return;
@@ -1403,6 +1436,11 @@ void KyraEngine_v2::snd_loadSoundFile(int id) {
_sound->loadSoundFile(file);
}
+void KyraEngine_v2::playVoice(int high, int low) {
+ int vocFile = high * 10000 + low * 10;
+ snd_playVoiceFile(vocFile);
+}
+
#pragma mark -
typedef Functor1Mem<ScriptState*, int, KyraEngine_v2> OpcodeV2;
@@ -1619,15 +1657,15 @@ void KyraEngine_v2::setupOpcodeTable() {
OpcodeUnImpl(),
OpcodeUnImpl(),
OpcodeUnImpl(),
- OpcodeUnImpl(),
+ Opcode(o2_setVocHigh),
// 0xa8
- OpcodeUnImpl(),
+ Opcode(o2_getVocHigh),
Opcode(o2_zanthiaChat),
- OpcodeUnImpl(),
- OpcodeUnImpl(),
+ Opcode(o2_isVoiceEnabled),
+ Opcode(o2_isVoicePlaying),
// 0xac
- OpcodeUnImpl(),
- OpcodeUnImpl(),
+ Opcode(o2_stopVoicePlaying),
+ Opcode(o2_getGameLanguage),
Opcode(o2_dummy),
Opcode(o2_dummy),
};