aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra
diff options
context:
space:
mode:
authorJohannes Schickel2007-10-10 09:06:15 +0000
committerJohannes Schickel2007-10-10 09:06:15 +0000
commitd896894631c8996d2e232ff56e0791ff5564f096 (patch)
tree468cffb06d1806a95cb7459013aa3948fc359edc /engines/kyra
parent598e35bab8b6ea6dc96fa7355f578f0c07acab52 (diff)
downloadscummvm-rg350-d896894631c8996d2e232ff56e0791ff5564f096.tar.gz
scummvm-rg350-d896894631c8996d2e232ff56e0791ff5564f096.tar.bz2
scummvm-rg350-d896894631c8996d2e232ff56e0791ff5564f096.zip
- Made some sound functions a bit more generic for use with Kyra1 and Kyra2
HoF: - Added sound support (sfx sound wrong currently though) - Implemented opcodes: -> o2_loadMusicTrack -> o2_playWanderScoreViaMap -> o2_playSoundEffect -> o2t_playSoundEffect svn-id: r29183
Diffstat (limited to 'engines/kyra')
-rw-r--r--engines/kyra/items_v2.cpp16
-rw-r--r--engines/kyra/kyra.cpp5
-rw-r--r--engines/kyra/kyra.h13
-rw-r--r--engines/kyra/kyra_v1.cpp8
-rw-r--r--engines/kyra/kyra_v1.h8
-rw-r--r--engines/kyra/kyra_v2.cpp28
-rw-r--r--engines/kyra/kyra_v2.h14
-rw-r--r--engines/kyra/scene_v2.cpp18
-rw-r--r--engines/kyra/script_v2.cpp24
-rw-r--r--engines/kyra/sequences_v1.cpp4
-rw-r--r--engines/kyra/sound.cpp44
-rw-r--r--engines/kyra/sound_v1.cpp46
-rw-r--r--engines/kyra/staticres.cpp72
13 files changed, 226 insertions, 74 deletions
diff --git a/engines/kyra/items_v2.cpp b/engines/kyra/items_v2.cpp
index 37261e1706..2b6114ed29 100644
--- a/engines/kyra/items_v2.cpp
+++ b/engines/kyra/items_v2.cpp
@@ -98,7 +98,7 @@ bool KyraEngine_v2::dropItem(int unk1, uint16 item, int x, int y, int unk2) {
bool success = processItemDrop(_mainCharacter.sceneId, item, x, y, unk1, unk2);
if (!success) {
- //snd_playSfx(0x0d);
+ snd_playSoundEffect(0x0d);
if (countAllItems() >= 30)
showMessageFromCCode(5, 0x84, 0);
}
@@ -218,7 +218,7 @@ void KyraEngine_v2::itemDropDown(int startX, int startY, int dstX, int dstY, int
if (startX == dstX && startY == dstY) {
if (_layerFlagTable[_screen->getLayer(dstX, dstY)] && item != 13) {
updateCharFacing();
- //snd_playSfx(0x2d);
+ snd_playSoundEffect(0x2d);
removeHandItem();
//XXX sub_277FA(getTableString(0xFF, _cCodeBuffer), 1, 0, 0x83, 0xFF);
} else {
@@ -226,7 +226,7 @@ void KyraEngine_v2::itemDropDown(int startX, int startY, int dstX, int dstY, int
_itemList[itemSlot].y = dstY;
_itemList[itemSlot].id = item;
_itemList[itemSlot].sceneId = _mainCharacter.sceneId;
- //snd_playSfx(0x0c);
+ snd_playSoundEffect(0x0c);
addItemToAnimList(itemSlot);
}
} else {
@@ -256,7 +256,7 @@ void KyraEngine_v2::itemDropDown(int startX, int startY, int dstX, int dstY, int
}
if (dstX != dstY || (dstY - startY > 16)) {
- //snd_playSfx(0x69);
+ snd_playSoundEffect(0x69);
speed = MAX(speed, 6);
int speedX = ((dstX - startX) << 4) / speed;
int origSpeed = speed;
@@ -300,7 +300,7 @@ void KyraEngine_v2::itemDropDown(int startX, int startY, int dstX, int dstY, int
if (_layerFlagTable[_screen->getLayer(dstX, dstY)] && item != 13) {
updateCharFacing();
- //snd_playSfx(0x2d);
+ snd_playSoundEffect(0x2d);
removeHandItem();
_screen->showMouse();
//XXX sub_277FA(getTableString(0xFF, _cCodeBuffer), 1, 0, 0x83, 0xFF);
@@ -309,7 +309,7 @@ void KyraEngine_v2::itemDropDown(int startX, int startY, int dstX, int dstY, int
_itemList[itemSlot].y = dstY;
_itemList[itemSlot].id = item;
_itemList[itemSlot].sceneId = _mainCharacter.sceneId;
- //snd_playSfx(0x0c);
+ snd_playSoundEffect(0x0c);
addItemToAnimList(itemSlot);
_screen->showMouse();
}
@@ -326,7 +326,7 @@ void KyraEngine_v2::exchangeMouseItem(int itemPos) {
_itemInHand = itemId;
addItemToAnimList(itemPos);
- //snd_playSfx(0x0b);
+ snd_playSoundEffect(0x0b);
setMouseCursor(_itemInHand);
int str2 = 7;
@@ -352,7 +352,7 @@ bool KyraEngine_v2::pickUpItem(int x, int y) {
deleteItemAnimEntry(itemPos);
int itemId = _itemList[itemPos].id;
_itemList[itemPos].id = 0xFFFF;
- //snd_playSfx(0x0b);
+ snd_playSoundEffect(0x0b);
setMouseCursor(itemId);
int str2 = 7;
diff --git a/engines/kyra/kyra.cpp b/engines/kyra/kyra.cpp
index b8c8795c71..29945f70f4 100644
--- a/engines/kyra/kyra.cpp
+++ b/engines/kyra/kyra.cpp
@@ -57,6 +57,11 @@ KyraEngine::KyraEngine(OSystem *system, const GameFlags &flags)
_skipFlag = false;
+ _trackMap = 0;
+ _trackMapSize = 0;
+ _lastMusicCommand = -1;
+ _curSfxFile = _curMusicTheme = -1;
+
memset(_flagsTable, 0, sizeof(_flagsTable));
// sets up all engine specific debug levels
diff --git a/engines/kyra/kyra.h b/engines/kyra/kyra.h
index 8ed546d1ce..95e48474ac 100644
--- a/engines/kyra/kyra.h
+++ b/engines/kyra/kyra.h
@@ -112,6 +112,11 @@ public:
int setGameFlag(int flag);
int queryGameFlag(int flag) const;
int resetGameFlag(int flag);
+
+ // sound
+ virtual void snd_playTheme(int file, int track = 0);
+ virtual void snd_playSoundEffect(int id);
+ virtual void snd_playWanderScoreViaMap(int command, int restart);
// delay functionallity
virtual void delayUntil(uint32 timestamp, bool updateGameTimers = false, bool update = false, bool isMainLoop = false);
@@ -148,6 +153,14 @@ protected:
// game flags
uint8 _flagsTable[100]; // TODO: check this value
+
+ // sound
+ int _curMusicTheme;
+ int _curSfxFile;
+ int16 _lastMusicCommand;
+
+ const int8 *_trackMap;
+ int _trackMapSize;
// input
Common::Point getMousePos() const;
diff --git a/engines/kyra/kyra_v1.cpp b/engines/kyra/kyra_v1.cpp
index c994325ca9..7a15fe848f 100644
--- a/engines/kyra/kyra_v1.cpp
+++ b/engines/kyra/kyra_v1.cpp
@@ -98,8 +98,6 @@ KyraEngine_v1::KyraEngine_v1(OSystem *system, const GameFlags &flags)
memset(_sceneAnimTable, 0, sizeof(_sceneAnimTable));
_currHeadShape = 0;
- _curSfxFile = _curMusicTheme = 0;
-
memset(&_itemBkgBackUp, 0, sizeof(_itemBkgBackUp));
}
@@ -184,12 +182,16 @@ int KyraEngine_v1::init() {
_sound->setSoundFileList(_soundFilesTowns, _soundFilesTownsCount);
else
_sound->setSoundFileList(_soundFiles, _soundFilesCount);
+
+ _trackMap = _dosTrackMap;
+ _trackMapSize = _dosTrackMapSize;
if (!_sound->init())
error("Couldn't init sound");
_sound->setVolume(255);
- _sound->loadSoundFile(0);
+ if (_flags.platform != Common::kPlatformFMTowns && _flags.platform != Common::kPlatformPC98)
+ _sound->loadSoundFile(9);
setupTimers();
setupButtonData();
diff --git a/engines/kyra/kyra_v1.h b/engines/kyra/kyra_v1.h
index 6e5ba98d3c..a7371ac510 100644
--- a/engines/kyra/kyra_v1.h
+++ b/engines/kyra/kyra_v1.h
@@ -275,7 +275,6 @@ public:
void readSettings();
void writeSettings();
- void snd_playTheme(int file, int track = 0);
void snd_playVoiceFile(int id);
void snd_voiceWaitForFinish(bool ingame = true);
bool snd_voiceIsPlaying();
@@ -602,10 +601,6 @@ protected:
bool _configSounds;
uint8 _configVoice;
- int _curMusicTheme;
- int _curSfxFile;
- int16 _lastMusicCommand;
-
ScreenAnimator *_animator;
SeqPlayer *_seq;
Sprites *_sprites;
@@ -644,6 +639,9 @@ protected:
uint32 timerCount;
} _kyragemFadingState;
+ static const int8 _dosTrackMap[];
+ static const int _dosTrackMapSize;
+
// TODO: get rid of all variables having pointers to the static resources if possible
// i.e. let them directly use the _staticres functions
void initStaticResource();
diff --git a/engines/kyra/kyra_v2.cpp b/engines/kyra/kyra_v2.cpp
index bb2bd4bf23..55cf843085 100644
--- a/engines/kyra/kyra_v2.cpp
+++ b/engines/kyra/kyra_v2.cpp
@@ -182,6 +182,10 @@ void KyraEngine_v2::mainMenu() {
}
void KyraEngine_v2::startup() {
+ _sound->setSoundFileList(_dosSoundFileList, _dosSoundFileListSize);
+ _trackMap = _dosTrackMap;
+ _trackMapSize = _dosTrackMapSize;
+
_screen->_curPage = 0;
delete [] _mouseSHPBuf;
_mouseSHPBuf = 0;
@@ -273,6 +277,8 @@ void KyraEngine_v2::startup() {
loadNPCScript();
// XXX
+ snd_playWanderScoreViaMap(52, 1);
+ // XXX
enterNewScene(_mainCharacter.sceneId, _mainCharacter.facing, 0, 0, 1);
_screen->showMouse();
@@ -315,7 +321,7 @@ void KyraEngine_v2::handleInput(int x, int y) {
return;
if (_unk3 == -2) {
- //snd_playSfx(13);
+ snd_playSoundEffect(13);
return;
}
@@ -1353,6 +1359,18 @@ void KyraEngine_v2::restoreGfxRect24x24(int x, int y) {
#pragma mark -
+void KyraEngine_v2::snd_loadSoundFile(int id) {
+ if (id < 0 || !_trackMap)
+ return;
+
+ assert(id < _trackMapSize);
+ int file = _trackMap[id*2];
+ _curSfxFile = _curMusicTheme = file;
+ _sound->loadSoundFile(file);
+}
+
+#pragma mark -
+
typedef Functor1Mem<ScriptState*, int, KyraEngine_v2> OpcodeV2;
#define Opcode(x) OpcodeV2(this, &KyraEngine_v2::x)
#define OpcodeUnImpl() OpcodeV2(this, 0)
@@ -1425,7 +1443,7 @@ void KyraEngine_v2::setupOpcodeTable() {
OpcodeUnImpl(),
// 0x34
OpcodeUnImpl(),
- OpcodeUnImpl(),
+ Opcode(o2_playSoundEffect),
OpcodeUnImpl(),
Opcode(o2_delay),
// 0x38
@@ -1467,10 +1485,10 @@ void KyraEngine_v2::setupOpcodeTable() {
OpcodeUnImpl(),
Opcode(o2_setLayerFlag),
Opcode(o2_setZanthiaPos),
- OpcodeUnImpl(),
+ Opcode(o2_loadMusicTrack),
// 0x58
- OpcodeUnImpl(),
- OpcodeUnImpl(),
+ Opcode(o2_playWanderScoreViaMap),
+ Opcode(o2_playSoundEffect),
OpcodeUnImpl(),
OpcodeUnImpl(),
// 0x5c
diff --git a/engines/kyra/kyra_v2.h b/engines/kyra/kyra_v2.h
index 221c0b89c5..ab3e401eaa 100644
--- a/engines/kyra/kyra_v2.h
+++ b/engines/kyra/kyra_v2.h
@@ -143,6 +143,11 @@ protected:
ActiveChat *_activeChat;
uint8 *_mouseSHPBuf;
+ static const char *_dosSoundFileList[];
+ static const int _dosSoundFileListSize;
+ static const int8 _dosTrackMap[];
+ static const int _dosTrackMapSize;
+
static const char *_introSoundList[];
static const int _introSoundListSize;
static const char *_introStrings[];
@@ -486,6 +491,9 @@ protected:
byte _messagePal[3];
int _msgUnk1;
+
+ // sound
+ void snd_loadSoundFile(int id);
// timer
void timerFunc2(int);
@@ -519,6 +527,7 @@ protected:
int o2_hideMouse(ScriptState *script);
int o2_addSpecialExit(ScriptState *script);
int o2_showMouse(ScriptState *script);
+ //int o2_playSoundEffect(ScriptState *script);
int o2_delay(ScriptState *script);
int o2_setScaleTableItem(ScriptState *script);
int o2_setDrawLayerTableItem(ScriptState *script);
@@ -533,6 +542,9 @@ protected:
int o2_getShapeFlag1(ScriptState *script);
int o2_setLayerFlag(ScriptState *script);
int o2_setZanthiaPos(ScriptState *script);
+ int o2_loadMusicTrack(ScriptState *script);
+ int o2_playWanderScoreViaMap(ScriptState *script);
+ int o2_playSoundEffect(ScriptState *script);
int o2_getRand(ScriptState *script);
int o2_encodeShape(ScriptState *script);
int o2_defineRoomEntrance(ScriptState *script);
@@ -547,8 +559,10 @@ protected:
int o2_dummy(ScriptState *script);
// opcodes temporary
+ // TODO: rename it from temporary to something more appropriate
int o2t_defineNewShapes(ScriptState *script);
int o2t_setCurrentFrame(ScriptState *script);
+ int o2t_playSoundEffect(ScriptState *script);
int o2t_setShapeFlag(ScriptState *script);
// script
diff --git a/engines/kyra/scene_v2.cpp b/engines/kyra/scene_v2.cpp
index da0828057c..6a588178d4 100644
--- a/engines/kyra/scene_v2.cpp
+++ b/engines/kyra/scene_v2.cpp
@@ -25,6 +25,7 @@
#include "kyra/kyra_v2.h"
#include "kyra/screen_v2.h"
+#include "kyra/sound.h"
#include "kyra/wsamovie.h"
#include "common/func.h"
@@ -68,7 +69,12 @@ void KyraEngine_v2::enterNewScene(uint16 newScene, int facing, int unk1, int unk
moveCharacter(facing, x, y);
}
- //XXX sound
+ bool newSoundFile = false;
+ if (_sceneList[newScene].sound != _lastMusicCommand) {
+ newSoundFile = true;
+ //XXX
+ _sound->beginFadeOut();
+ }
_unkFlag1 = false;
@@ -95,7 +101,10 @@ void KyraEngine_v2::enterNewScene(uint16 newScene, int facing, int unk1, int unk
_sceneExit3 = scene.exit3;
_sceneExit4 = scene.exit4;
- //XXX sound
+ if (newSoundFile) {
+ //XXX while (snd_isPlaying()) ;
+ snd_loadSoundFile(_sceneList[newScene].sound);
+ }
startSceneScript(unk3);
@@ -204,9 +213,8 @@ void KyraEngine_v2::enterNewSceneUnk1(int facing, int unk1, int unk2) {
_mainCharacter.y1 = _mainCharacter.y2 = y2;
initSceneAnims(unk2);
- if (!unk2) {
- //XXX sound
- }
+ if (!unk2)
+ snd_playWanderScoreViaMap(_sceneList[_mainCharacter.sceneId].sound, 0);
if (unk1 && !unk2 && _mainCharacter.animFrame != 32)
moveCharacter(facing, x, y);
diff --git a/engines/kyra/script_v2.cpp b/engines/kyra/script_v2.cpp
index 4599d0347d..0a23a53ce8 100644
--- a/engines/kyra/script_v2.cpp
+++ b/engines/kyra/script_v2.cpp
@@ -440,6 +440,24 @@ int KyraEngine_v2::o2_setZanthiaPos(ScriptState *script) {
return 0;
}
+int KyraEngine_v2::o2_loadMusicTrack(ScriptState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "o2_loadMusicTrack(%p) (%d)", (const void *)script, stackPos(0));
+ snd_loadSoundFile(stackPos(0));
+ return 0;
+}
+
+int KyraEngine_v2::o2_playWanderScoreViaMap(ScriptState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "o2_playWanderScoreViaMap(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
+ snd_playWanderScoreViaMap(stackPos(0), stackPos(1));
+ return 0;
+}
+
+int KyraEngine_v2::o2_playSoundEffect(ScriptState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "o2_playSoundEffect(%p) (%d)", (const void *)script, stackPos(0));
+ snd_playSoundEffect(stackPos(0));
+ return 0;
+}
+
int KyraEngine_v2::o2_getRand(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "o2_getRand(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
assert(stackPos(0) < stackPos(1));
@@ -607,6 +625,12 @@ int KyraEngine_v2::o2t_setCurrentFrame(ScriptState *script) {
return 0;
}
+int KyraEngine_v2::o2t_playSoundEffect(ScriptState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "o2t_playSoundEffect(%p) (%d)", (const void *)script, stackPos(0));
+ snd_playSoundEffect(stackPos(0));
+ return 0;
+}
+
int KyraEngine_v2::o2t_setShapeFlag(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "o2t_setShapeFlag(%p) (%d)", (const void *)script, stackPos(0));
_newShapeFlag = stackPos(0);
diff --git a/engines/kyra/sequences_v1.cpp b/engines/kyra/sequences_v1.cpp
index 00aac6cfb4..bed01f7775 100644
--- a/engines/kyra/sequences_v1.cpp
+++ b/engines/kyra/sequences_v1.cpp
@@ -43,7 +43,7 @@ namespace Kyra {
void KyraEngine_v1::seq_demo() {
debugC(9, kDebugLevelMain, "KyraEngine_v1::seq_demo()");
- snd_playTheme(0, 2);
+ snd_playTheme(9, 2);
_screen->loadBitmap("START.CPS", 7, 7, _screen->_currentPalette);
_screen->copyRegion(0, 0, 0, 0, 320, 200, 6, 0);
@@ -114,7 +114,7 @@ void KyraEngine_v1::seq_intro() {
_seq->setCopyViewOffs(true);
_screen->setFont(Screen::FID_8_FNT);
if (_flags.platform != Common::kPlatformFMTowns && _flags.platform != Common::kPlatformPC98)
- snd_playTheme(0, 2);
+ snd_playTheme(9, 2);
_text->setTalkCoords(144);
for (int i = 0; i < ARRAYSIZE(introProcTable) && !seq_skipSequence(); ++i)
diff --git a/engines/kyra/sound.cpp b/engines/kyra/sound.cpp
index 20a90c2c32..d9a3517519 100644
--- a/engines/kyra/sound.cpp
+++ b/engines/kyra/sound.cpp
@@ -434,6 +434,50 @@ void SoundMidiPC::beginFadeOut() {
_fadeStartTime = _vm->_system->getMillis();
}
+void KyraEngine::snd_playTheme(int file, int track) {
+ debugC(9, kDebugLevelMain | kDebugLevelSound, "KyraEngine::snd_playTheme(%d)", file);
+ _curSfxFile = _curMusicTheme = file;
+ _sound->loadSoundFile(_curMusicTheme);
+ _sound->playTrack(track);
+}
+
+void KyraEngine::snd_playSoundEffect(int track) {
+ debugC(9, kDebugLevelMain | kDebugLevelSound, "KyraEngine::snd_playSoundEffect(%d)", track);
+ _sound->playSoundEffect(track);
+}
+
+void KyraEngine::snd_playWanderScoreViaMap(int command, int restart) {
+ debugC(9, kDebugLevelMain | kDebugLevelSound, "KyraEngine::snd_playWanderScoreViaMap(%d, %d)", command, restart);
+ if (restart)
+ _lastMusicCommand = -1;
+
+ // no track mapping given
+ // so don't do anything here
+ if (!_trackMap || !_trackMapSize)
+ return;
+
+ //if (!_disableSound) {
+ // XXX
+ //}
+
+ assert(command*2+1 < _trackMapSize);
+ if (_curMusicTheme != _trackMap[command*2]) {
+ if (_trackMap[command*2] != -1 && _trackMap[command*2] != -2)
+ snd_playTheme(_trackMap[command*2]);
+ }
+
+ if (command != 1) {
+ if (_lastMusicCommand != command) {
+ _sound->haltTrack();
+ _sound->playTrack(_trackMap[command*2+1]);
+ }
+ } else {
+ _sound->beginFadeOut();
+ }
+
+ _lastMusicCommand = command;
+}
+
// static res
const Sound::SpeechCodecs Sound::_supportedCodes[] = {
diff --git a/engines/kyra/sound_v1.cpp b/engines/kyra/sound_v1.cpp
index 032e3eda44..3ac28701e1 100644
--- a/engines/kyra/sound_v1.cpp
+++ b/engines/kyra/sound_v1.cpp
@@ -36,20 +36,14 @@ bool KyraEngine_v1::textEnabled() {
return !_flags.isTalkie || (_configVoice == 0 || _configVoice == 2);
}
-void KyraEngine_v1::snd_playTheme(int file, int track) {
- debugC(9, kDebugLevelMain | kDebugLevelSound, "KyraEngine_v1::snd_playTheme(%d)", file);
- _curSfxFile = _curMusicTheme = file;
- _sound->loadSoundFile(_curMusicTheme);
- _sound->playTrack(track);
-}
-
void KyraEngine_v1::snd_playSoundEffect(int track) {
debugC(9, kDebugLevelMain | kDebugLevelSound, "KyraEngine_v1::snd_playSoundEffect(%d)", track);
if ((_flags.platform == Common::kPlatformFMTowns || _flags.platform == Common::kPlatformPC98) && track == 49) {
snd_playWanderScoreViaMap(56, 1);
return;
}
- _sound->playSoundEffect(track);
+
+ KyraEngine::snd_playSoundEffect(track);
}
void KyraEngine_v1::snd_playWanderScoreViaMap(int command, int restart) {
@@ -71,42 +65,8 @@ void KyraEngine_v1::snd_playWanderScoreViaMap(int command, int restart) {
_sound->haltTrack();
}
} else {
- static const int8 soundTable[] = {
- -1, 0, -1, 1, 0, 3, 0, 2,
- 0, 4, 1, 2, 1, 3, 1, 4,
- 1, 92, 1, 6, 1, 7, 2, 2,
- 2, 3, 2, 4, 2, 5, 2, 6,
- 2, 7, 3, 3, 3, 4, 1, 8,
- 1, 9, 4, 2, 4, 3, 4, 4,
- 4, 5, 4, 6, 4, 7, 4, 8,
- 1, 11, 1, 12, 1, 14, 1, 13,
- 4, 9, 5, 12, 6, 2, 6, 6,
- 6, 7, 6, 8, 6, 9, 6, 3,
- 6, 4, 6, 5, 7, 2, 7, 3,
- 7, 4, 7, 5, 7, 6, 7, 7,
- 7, 8, 7, 9, 8, 2, 8, 3,
- 8, 4, 8, 5, 6, 11, 5, 11
- };
- //if (!_disableSound) {
- // XXX
- //}
- assert(command*2+1 < ARRAYSIZE(soundTable));
- if (_curMusicTheme != soundTable[command*2]+1) {
- if (soundTable[command*2] != -1)
- snd_playTheme(soundTable[command*2]+1);
- }
-
- if (command != 1) {
- if (_lastMusicCommand != command) {
- _sound->haltTrack();
- _sound->playTrack(soundTable[command*2+1]);
- }
- } else {
- _sound->beginFadeOut();
- }
+ KyraEngine::snd_playWanderScoreViaMap(command, restart);
}
-
- _lastMusicCommand = command;
}
void KyraEngine_v1::snd_playVoiceFile(int id) {
diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp
index 793528f550..77855aab9f 100644
--- a/engines/kyra/staticres.cpp
+++ b/engines/kyra/staticres.cpp
@@ -905,7 +905,6 @@ const int8 KyraEngine::_addYPosTable[] = {
};
const char *KyraEngine_v1::_soundFiles[] = {
- "INTRO",
"KYRA1A",
"KYRA1B",
"KYRA2A",
@@ -914,7 +913,8 @@ const char *KyraEngine_v1::_soundFiles[] = {
"KYRA4B",
"KYRA5A",
"KYRA5B",
- "KYRAMISC"
+ "KYRAMISC",
+ "INTRO"
};
const int KyraEngine_v1::_soundFilesCount = ARRAYSIZE(KyraEngine_v1::_soundFiles);
@@ -925,7 +925,7 @@ const char *KyraEngine_v1::_soundFilesTowns[] = {
"TW_SCEN2.SFX",
"TW_SCEN3.SFX",
"TW_SCEN4.SFX",
- "TW_SCEN5.SFX",
+ "TW_SCEN5.SFX"
};
const int KyraEngine_v1::_soundFilesTownsCount = ARRAYSIZE(KyraEngine_v1::_soundFilesTowns);
@@ -1115,6 +1115,25 @@ const uint16 KyraEngine_v1::_amuletY[] = { 170, 170, 159, 181 };
const uint16 KyraEngine_v1::_amuletX2[] = { 0x000, 0x0FD, 0x0E7, 0x0FD, 0x113, 0x000 };
const uint16 KyraEngine_v1::_amuletY2[] = { 0x000, 0x09F, 0x0AA, 0x0B5, 0x0AA, 0x000 };
+const int8 KyraEngine_v1::_dosTrackMap[] = {
+ -1, 0, -1, 1, 0, 3, 0, 2,
+ 0, 4, 1, 2, 1, 3, 1, 4,
+ 1, 92, 1, 6, 1, 7, 2, 2,
+ 2, 3, 2, 4, 2, 5, 2, 6,
+ 2, 7, 3, 3, 3, 4, 1, 8,
+ 1, 9, 4, 2, 4, 3, 4, 4,
+ 4, 5, 4, 6, 4, 7, 4, 8,
+ 1, 11, 1, 12, 1, 14, 1, 13,
+ 4, 9, 5, 12, 6, 2, 6, 6,
+ 6, 7, 6, 8, 6, 9, 6, 3,
+ 6, 4, 6, 5, 7, 2, 7, 3,
+ 7, 4, 7, 5, 7, 6, 7, 7,
+ 7, 8, 7, 9, 8, 2, 8, 3,
+ 8, 4, 8, 5, 6, 11, 5, 11
+};
+
+const int KyraEngine_v1::_dosTrackMapSize = ARRAYSIZE(KyraEngine_v1::_dosTrackMap);
+
// Kyra 2 and 3 main menu
const char *KyraEngine_v2::_mainMenuStrings[] = {
@@ -1266,8 +1285,55 @@ const byte KyraEngine_v2::_itemStringMap[] = {
0, 2, 0, 0, 0, 0, 0, 0
};
+const char *KyraEngine_v2::_dosSoundFileList[] = {
+ "K2TEST1",
+ "K2TEST2",
+ "K2TEST3",
+ "K2TEST4",
+ "K2TEST5",
+ "K2TEST6",
+ "K2TEST7",
+ "K2TEST8",
+ "K2TEST9",
+ "K2TEST10",
+ "K2TEST11",
+ "K2TEST12",
+ "K2TEST13",
+ "K2TEST14",
+ "K2TEST15"
+};
+
+const int KyraEngine_v2::_dosSoundFileListSize = ARRAYSIZE(KyraEngine_v2::_dosSoundFileList);
+
const int KyraEngine_v2::_itemStringMapSize = ARRAYSIZE(KyraEngine_v2::_itemStringMap);
+const int8 KyraEngine_v2::_dosTrackMap[] = {
+ -1, 0, -1, 1, 9, 6, 5, 4,
+ 8, 3, -2, 0, -2, 0, 2, 3,
+ -2, 0, -2, 0, -2, 0, -2, 0,
+ 0, 2, 0, 3, 1, 2, 1, 3,
+ 2, 2, 2, 0, 3, 2, 3, 3,
+ 3, 4, 4, 2, 5, 2, 5, 3,
+ 5, 4, 6, 2, 6, 3, 6, 4,
+ 6, 5, 6, 6, 6, 7, 6, 8,
+ 6, 0, 6, 9, 7, 2, 7, 3,
+ 7, 4, 7, 5, 8, 6, 7, 6,
+ 7, 7, 7, 8, 7, 9, 8, 2,
+ 14, 2, 8, 4, 8, 7, 8, 8,
+ 8, 9, 9, 2, 9, 3, 9, 4,
+ 9, 5, 9, 7, 9, 8, 9, 9,
+ 10, 2, 10, 3, 10, 4, 10, 5,
+ 10, 6, 10, 7, 11, 2, 11, 3,
+ 11, 4, 11, 5, 11, 6, 11, 7,
+ 11, 8, 11, 9, 12, 2, 12, 3,
+ 12, 4, 12, 5, 12, 6, 12, 7,
+ 12, 8, 12, 9, 13, 2, 4, 7,
+ 14, 3, 14, 4, 14, 5, 4, 2,
+ 4, 3, 4, 4, 4, 5, 4, 6
+};
+
+const int KyraEngine_v2::_dosTrackMapSize = ARRAYSIZE(KyraEngine_v2::_dosTrackMap);
+
// kyra 3 static res
const char *KyraEngine_v3::_soundList[] = {