mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-25 13:42:37 +00:00
Add sound effects code for Amiga and AtariST versions of Elvira 2.
svn-id: r26989
This commit is contained in:
parent
0d789e074e
commit
9d041cc059
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -186,6 +186,8 @@ void AGOSEngine::vc52_playSound() {
|
||||
_sound->playEffects(sound);
|
||||
} else if (getGameId() == GID_SIMON1DOS) {
|
||||
playSting(sound);
|
||||
} else {
|
||||
loadSound(sound);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user