diff options
author | Travis Howell | 2007-05-28 11:22:53 +0000 |
---|---|---|
committer | Travis Howell | 2007-05-28 11:22:53 +0000 |
commit | 9d041cc0598212bb2ef95584f0213aa4d286e2a6 (patch) | |
tree | 6e46d52bf8521f66ff811981bbb425de6d8edc20 /engines/agos | |
parent | 0d789e074e6ff1ed76e75619eae9d337d3faad29 (diff) | |
download | scummvm-rg350-9d041cc0598212bb2ef95584f0213aa4d286e2a6.tar.gz scummvm-rg350-9d041cc0598212bb2ef95584f0213aa4d286e2a6.tar.bz2 scummvm-rg350-9d041cc0598212bb2ef95584f0213aa4d286e2a6.zip |
Add sound effects code for Amiga and AtariST versions of Elvira 2.
svn-id: r26989
Diffstat (limited to 'engines/agos')
-rw-r--r-- | engines/agos/agos.h | 1 | ||||
-rw-r--r-- | engines/agos/res_snd.cpp | 32 | ||||
-rw-r--r-- | engines/agos/script_e2.cpp | 8 | ||||
-rw-r--r-- | engines/agos/vga.cpp | 33 | ||||
-rw-r--r-- | engines/agos/vga_e2.cpp | 2 | ||||
-rw-r--r-- | engines/agos/zones.cpp | 10 |
6 files changed, 54 insertions, 32 deletions
diff --git a/engines/agos/agos.h b/engines/agos/agos.h index 2913671cb6..c737217e03 100644 --- a/engines/agos/agos.h +++ b/engines/agos/agos.h @@ -571,6 +571,7 @@ protected: void readGamePcFile(Common::SeekableReadStream *in); void decompressData(const char *srcName, byte *dst, uint32 offset, uint32 srcSize, uint32 dstSize); void loadOffsets(const char *filename, int number, uint32 &file, uint32 &offset, uint32 &compressedSize, uint32 &size); + void loadSound(uint sound); void loadSound(uint sound, int pan, int vol, uint type); void loadVoice(uint speechId); diff --git a/engines/agos/res_snd.cpp b/engines/agos/res_snd.cpp index 41c3dce075..73eab46cbf 100644 --- a/engines/agos/res_snd.cpp +++ b/engines/agos/res_snd.cpp @@ -397,6 +397,38 @@ void AGOSEngine::loadSoundFile(const char* filename) { _sound->playSfxData(dst, 0, 0, 0); } +void AGOSEngine::loadSound(uint sound) { + byte *dst; + uint32 offs, size; + + if (_curSfxFile == NULL) + return; + + dst = _curSfxFile; + if (getGameType() == GType_WW) { + uint tmp = sound; + while (tmp--) + dst += READ_LE_UINT16(dst) + 4; + + size = READ_LE_UINT16(dst); + offs = 4; + } else if (getGameType() == GType_ELVIRA2) { + while (READ_BE_UINT32(dst + 4) != sound) + dst += 12; + + size = READ_BE_UINT32(dst); + offs = READ_BE_UINT32(dst + 8); + } else { + while (READ_BE_UINT16(dst + 6) != sound) + dst += 12; + + size = READ_BE_UINT16(dst + 2); + offs = READ_BE_UINT32(dst + 8); + } + + _sound->playRawData(dst + offs, sound, size); +} + void AGOSEngine::loadSound(uint sound, int pan, int vol, uint type) { byte *dst; diff --git a/engines/agos/script_e2.cpp b/engines/agos/script_e2.cpp index 2ffb60731f..6f6df06eb8 100644 --- a/engines/agos/script_e2.cpp +++ b/engines/agos/script_e2.cpp @@ -599,9 +599,11 @@ void AGOSEngine_Elvira2::oe2_ifExitLocked() { } void AGOSEngine_Elvira2::oe2_playEffect() { - // 174: - uint a = getVarOrWord(); - debug(0, "oe2_playEffect: stub (%d)", a); + // 174: play sound + uint soundId = getVarOrWord(); + loadSound(soundId); + + debug(0, "oe2_playEffect: stub (%d)", soundId); } void AGOSEngine_Elvira2::oe2_getDollar2() { diff --git a/engines/agos/vga.cpp b/engines/agos/vga.cpp index be76b69c64..ee3881ac52 100644 --- a/engines/agos/vga.cpp +++ b/engines/agos/vga.cpp @@ -1072,37 +1072,14 @@ void AGOSEngine::vc27_resetSprite() { } void AGOSEngine::vc28_playSFX() { - byte *dst; - uint sound, channels, frequency, flags; - uint offs, size; + uint16 sound = vcReadNextWord(); + uint16 channels = vcReadNextWord(); + uint16 frequency = vcReadNextWord(); + uint16 flags = vcReadNextWord(); - sound = vcReadNextWord(); - channels = vcReadNextWord(); - frequency = vcReadNextWord(); - flags = vcReadNextWord(); + loadSound(sound); debug(0, "vc28_playSFX: (%d, %d, %d, %d)", sound, channels, frequency, flags); - - if (_curSfxFile == NULL) - return; - - dst = _curSfxFile; - if (getGameType() == GType_WW) { - uint tmp = sound; - while (tmp--) - dst += READ_LE_UINT16(dst) + 4; - - size = READ_LE_UINT16(dst); - offs = 4; - } else { - while (READ_BE_UINT16(dst + 6) != sound) - dst += 12; - - size = READ_BE_UINT16(dst + 2); - offs = READ_BE_UINT32(dst + 8); - } - - _sound->playRawData(dst + offs, sound, size); } void AGOSEngine::vc29_stopAllSounds() { diff --git a/engines/agos/vga_e2.cpp b/engines/agos/vga_e2.cpp index ee6afd09e6..e2603a4c53 100644 --- a/engines/agos/vga_e2.cpp +++ b/engines/agos/vga_e2.cpp @@ -186,6 +186,8 @@ void AGOSEngine::vc52_playSound() { _sound->playEffects(sound); } else if (getGameId() == GID_SIMON1DOS) { playSting(sound); + } else { + loadSound(sound); } } diff --git a/engines/agos/zones.cpp b/engines/agos/zones.cpp index 630d85d145..dd0d48d912 100644 --- a/engines/agos/zones.cpp +++ b/engines/agos/zones.cpp @@ -63,7 +63,15 @@ void AGOSEngine::loadZone(uint zoneNum) { vpe->vgaFile1End = _blockEnd; vpe->sfxFile = NULL; - if (!(getFeatures() & GF_ZLIBCOMP)) { + + if ((getPlatform() == Common::kPlatformAmiga || getPlatform() == Common::kPlatformAtariST) && + getGameType() == GType_ELVIRA2) { + // A singe sound file is used for Amiga and AtariST versions + if (loadVGASoundFile(1, 3)) { + vpe->sfxFile = _block; + vpe->sfxFileEnd = _blockEnd; + } + } else if (!(getFeatures() & GF_ZLIBCOMP)) { if (loadVGASoundFile(zoneNum, 3)) { vpe->sfxFile = _block; vpe->sfxFileEnd = _blockEnd; |