From 5200b8f1fa8df767cc74bc7df0f2429a6d984624 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 17 Jan 2005 18:49:00 +0000 Subject: o Proper implementation of sfPlaySound() which knows about CD<->floppy difference o Fix regression in Mac titles where scene LUT wasn't conversed o Fix sound types in many games. Old Win demo is still wrong. svn-id: r16586 --- saga/game.cpp | 20 ++++++++++---------- saga/resnames.h | 35 ++++++++++++++++++----------------- saga/saga.h | 3 ++- saga/scene.cpp | 4 ++-- saga/sfuncs.cpp | 14 ++++++++++---- 5 files changed, 42 insertions(+), 34 deletions(-) diff --git a/saga/game.cpp b/saga/game.cpp index 4c8aebcff8..6dd41638ad 100644 --- a/saga/game.cpp +++ b/saga/game.cpp @@ -432,7 +432,7 @@ static GameDescription gameDescriptions[] = { ARRAYSIZE(ITEMACDEMO_GameFonts), ITEMACDEMO_GameFonts, &ITECD_GameSound, - GF_VOX_VOICES | GF_BIG_ENDIAN_DATA | GF_MAC_RESOURCES | GF_WYRMKEEP + GF_VOX_VOICES | GF_BIG_ENDIAN_DATA | GF_MAC_RESOURCES | GF_WYRMKEEP | GF_CD_FX }, // Inherit the earth - early MAC Demo version @@ -449,7 +449,7 @@ static GameDescription gameDescriptions[] = { ARRAYSIZE(ITEMACDEMO_GameFonts), ITEMACDEMO_GameFonts, &ITECD_GameSound, - GF_BIG_ENDIAN_DATA | GF_MAC_RESOURCES | GF_WYRMKEEP + GF_VOX_VOICES | GF_BIG_ENDIAN_DATA | GF_MAC_RESOURCES | GF_WYRMKEEP | GF_CD_FX }, // Inherit the earth - MAC CD Wyrmkeep version @@ -466,7 +466,7 @@ static GameDescription gameDescriptions[] = { ARRAYSIZE(ITEMACDEMO_GameFonts), ITEMACDEMO_GameFonts, &ITECD_GameSound, - GF_BIG_ENDIAN_DATA | GF_MAC_RESOURCES | GF_WYRMKEEP + GF_BIG_ENDIAN_DATA | GF_MAC_RESOURCES | GF_WYRMKEEP | GF_CD_FX }, // Inherit the earth - Linux Demo version @@ -484,7 +484,7 @@ static GameDescription gameDescriptions[] = { ARRAYSIZE(ITECD_GameFonts), ITECD_GameFonts, &ITECD_GameSound, - GF_VOX_VOICES | GF_WYRMKEEP + GF_VOX_VOICES | GF_WYRMKEEP | GF_CD_FX }, // Inherit the earth - Linux Demo version @@ -501,7 +501,7 @@ static GameDescription gameDescriptions[] = { ARRAYSIZE(ITECD_GameFonts), ITECD_GameFonts, &ITECD_GameSound, - GF_VOX_VOICES | GF_WYRMKEEP + GF_VOX_VOICES | GF_WYRMKEEP | GF_CD_FX }, // Inherit the earth - Win32 Demo version @@ -518,7 +518,7 @@ static GameDescription gameDescriptions[] = { ARRAYSIZE(ITEWINDEMO_GameFonts), ITEWINDEMO_GameFonts, &ITECD_GameSound, - GF_VOX_VOICES | GF_WYRMKEEP + GF_VOX_VOICES | GF_WYRMKEEP | GF_CD_FX }, // Inherit the earth - Wyrmkeep Linux CD version @@ -536,7 +536,7 @@ static GameDescription gameDescriptions[] = { ARRAYSIZE(ITECD_GameFonts), ITECD_GameFonts, &ITECD_GameSound, - GF_WYRMKEEP + GF_WYRMKEEP | GF_CD_FX }, // Inherit the earth - DOS CD version @@ -553,7 +553,7 @@ static GameDescription gameDescriptions[] = { ARRAYSIZE(ITECD_GameFonts), ITECD_GameFonts, &ITECD_GameSound, - 0 + GF_CD_FX }, // Inherit the earth - DOS CD German version @@ -570,7 +570,7 @@ static GameDescription gameDescriptions[] = { ARRAYSIZE(ITECD_GameFonts), ITECD_GameFonts, &ITECD_GameSound, - GF_LANG_DE + GF_LANG_DE | GF_CD_FX }, // Inherit the earth - CD version @@ -587,7 +587,7 @@ static GameDescription gameDescriptions[] = { ARRAYSIZE(ITECD_GameFonts), ITECD_GameFonts, &ITECD_GameSound, - 0 + GF_CD_FX }, // Inherit the earth - German Floppy version diff --git a/saga/resnames.h b/saga/resnames.h index 9767b906b5..f3723c989a 100644 --- a/saga/resnames.h +++ b/saga/resnames.h @@ -172,26 +172,27 @@ namespace Saga { #define FX_DOOR_OPEN_2 53 #define FX_JAIL_DOOR 54 #define FX_KILN_FIRE 55 +#define FX_DUMMY 56 // These are only in the CD version -#define FX_CROWD_01 56 -#define FX_CROWD_02 57 -#define FX_CROWD_03 58 -#define FX_CROWD_04 59 -#define FX_CROWD_05 60 -#define FX_CROWD_06 61 -#define FX_CROWD_07 62 -#define FX_CROWD_08 63 -#define FX_CROWD_09 64 -#define FX_CROWD_10 65 -#define FX_CROWD_11 66 -#define FX_CROWD_12 67 -#define FX_CROWD_13 68 -#define FX_CROWD_14 69 -#define FX_CROWD_15 70 -#define FX_CROWD_16 71 -#define FX_CROWD_17 72 +#define FX_CROWD_01 57 +#define FX_CROWD_02 58 +#define FX_CROWD_03 59 +#define FX_CROWD_04 60 +#define FX_CROWD_05 61 +#define FX_CROWD_06 62 +#define FX_CROWD_07 63 +#define FX_CROWD_08 64 +#define FX_CROWD_09 65 +#define FX_CROWD_10 66 +#define FX_CROWD_11 67 +#define FX_CROWD_12 68 +#define FX_CROWD_13 69 +#define FX_CROWD_14 70 +#define FX_CROWD_15 71 +#define FX_CROWD_16 72 +#define FX_CROWD_17 73 } // End of namespace Saga diff --git a/saga/saga.h b/saga/saga.h index bde42bc1d7..7f17aa2e5d 100644 --- a/saga/saga.h +++ b/saga/saga.h @@ -271,7 +271,8 @@ enum GameFeatures { GF_BIG_ENDIAN_DATA = 1 << 1, GF_MAC_RESOURCES = 1 << 2, GF_LANG_DE = 1 << 3, - GF_WYRMKEEP = 1 << 4 + GF_WYRMKEEP = 1 << 4, + GF_CD_FX = 1 << 5 }; struct GameSoundInfo { diff --git a/saga/scene.cpp b/saga/scene.cpp index 179b2ebbfa..37ed57290b 100644 --- a/saga/scene.cpp +++ b/saga/scene.cpp @@ -66,8 +66,8 @@ Scene::Scene(SagaEngine *vm) : _vm(vm), _initialized(false) { // Load scene lookup table - debug(0, "Loading scene LUT from resource %u.", _vm->getResourceDescription()->scene_lut_rn); - result = RSC_LoadResource(_sceneContext, _vm->getResourceDescription()->scene_lut_rn, &scene_lut_p, &scene_lut_len); + debug(0, "Loading scene LUT from resource %u.", RSC_ConvertID(_vm->getResourceDescription()->scene_lut_rn)); + result = RSC_LoadResource(_sceneContext, RSC_ConvertID(_vm->getResourceDescription()->scene_lut_rn), &scene_lut_p, &scene_lut_len); if (result != SUCCESS) { warning("Scene::Scene(): Error: couldn't load scene LUT"); return; diff --git a/saga/sfuncs.cpp b/saga/sfuncs.cpp index 31ae5fd28e..c951692e51 100644 --- a/saga/sfuncs.cpp +++ b/saga/sfuncs.cpp @@ -1453,12 +1453,18 @@ static struct { // Script function #70 (0x46) int Script::sfPlaySound(SCRIPTFUNC_PARAMS) { - ScriptDataWord param = thread->pop() - 13; + int param = getSWord(thread->pop()); + int res; - if (/* param >= 0 && */ param < ARRAYSIZE(sfxTable)) - _vm->_sndRes->playSound(sfxTable[param].res, sfxTable[param].vol, false); - else + if (param < ARRAYSIZE(sfxTable)) { + res = sfxTable[param].res; + if (_vm->getFeatures() & GF_CD_FX) + res -= 14; + + _vm->_sndRes->playSound(res, sfxTable[param].vol, false); + } else { _vm->_sound->stopSound(); + } return SUCCESS; } -- cgit v1.2.3