[Scummvm-cvs-logs] SF.net SVN: scummvm: [21871] scummvm/trunk/engines/simon
kirben at users.sourceforge.net
kirben at users.sourceforge.net
Thu Apr 13 22:15:03 CEST 2006
Revision: 21871
Author: kirben
Date: 2006-04-13 22:13:59 -0700 (Thu, 13 Apr 2006)
ViewCVS: http://svn.sourceforge.net/scummvm/?rev=21871&view=rev
Log Message:
-----------
Add speech support for Amiga verison of FF
Modified Paths:
--------------
scummvm/trunk/engines/simon/res.cpp
scummvm/trunk/engines/simon/simon.cpp
scummvm/trunk/engines/simon/simon.h
scummvm/trunk/engines/simon/sound.cpp
scummvm/trunk/engines/simon/sound.h
Modified: scummvm/trunk/engines/simon/res.cpp
===================================================================
--- scummvm/trunk/engines/simon/res.cpp 2006-04-14 04:22:49 UTC (rev 21870)
+++ scummvm/trunk/engines/simon/res.cpp 2006-04-14 05:13:59 UTC (rev 21871)
@@ -706,4 +706,28 @@
}
}
+void SimonEngine::loadVoice(uint speechId) {
+ if (getFeatures() & GF_ZLIBCOMP) {
+ char filename[15];
+
+ uint32 file, offset, srcSize, dstSize;
+ if (getPlatform() == Common::kPlatformAmiga) {
+ loadOffsets((const char*)"spindex.dat", speechId, file, offset, srcSize, dstSize);
+ } else {
+ loadOffsets((const char*)"speech.wav", speechId, file, offset, srcSize, dstSize);
+ }
+
+ if (getPlatform() == Common::kPlatformAmiga)
+ sprintf(filename, "sp%d.wav", file);
+ else
+ sprintf(filename, "speech.wav");
+
+ byte *dst = (byte *)malloc(dstSize);
+ decompressData(filename, dst, offset, srcSize, dstSize);
+ _sound->playVoiceData(dst, speechId);
+ } else {
+ _sound->playVoice(speechId);
+ }
+}
+
} // End of namespace Simon
Modified: scummvm/trunk/engines/simon/simon.cpp
===================================================================
--- scummvm/trunk/engines/simon/simon.cpp 2006-04-14 04:22:49 UTC (rev 21870)
+++ scummvm/trunk/engines/simon/simon.cpp 2006-04-14 05:13:59 UTC (rev 21871)
@@ -3240,7 +3240,7 @@
kill_sprite_simon1(204);
}
kill_sprite_simon1(vgaSpriteId + 201);
- _sound->playVoice(speech_id);
+ loadVoice(speech_id);
loadSprite(4, 2, vgaSpriteId + 201, 0, 0, 0);
}
} else {
@@ -3256,7 +3256,7 @@
_skipVgaWait = true;
} else {
if (_subtitles && _language != Common::HB_ISR) {
- _sound->playVoice(speech_id);
+ loadVoice(speech_id);
return;
} else if (_subtitles && _scriptVar2) {
loadSprite(4, 2, 5, 0, 0, 0);
@@ -3265,7 +3265,7 @@
}
kill_sprite_simon2(2, vgaSpriteId + 2);
- _sound->playVoice(speech_id);
+ loadVoice(speech_id);
loadSprite(4, 2, vgaSpriteId + 2, 0, 0, 0);
}
}
Modified: scummvm/trunk/engines/simon/simon.h
===================================================================
--- scummvm/trunk/engines/simon/simon.h 2006-04-14 04:22:49 UTC (rev 21870)
+++ scummvm/trunk/engines/simon/simon.h 2006-04-14 05:13:59 UTC (rev 21871)
@@ -483,6 +483,7 @@
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, uint pan, uint vol, bool ambient);
+ void loadVoice(uint speechId);
void palette_fadeout(uint32 *pal_values, uint num);
Modified: scummvm/trunk/engines/simon/sound.cpp
===================================================================
--- scummvm/trunk/engines/simon/sound.cpp 2006-04-14 04:22:49 UTC (rev 21870)
+++ scummvm/trunk/engines/simon/sound.cpp 2006-04-14 05:13:59 UTC (rev 21871)
@@ -494,6 +494,23 @@
}
}
+void Sound::playVoiceData(byte *soundData, uint sound) {
+ byte flags;
+ int rate;
+
+ int size = READ_LE_UINT32(soundData + 4);
+ Common::MemoryReadStream stream(soundData, size);
+ if (!loadWAVFromStream(stream, size, rate, flags)) {
+ error("playSoundData: Not a valid WAV data");
+ }
+
+ byte *buffer = (byte *)malloc(size);
+ memcpy(buffer, soundData + stream.pos(), size);
+
+ _mixer->stopHandle(_voiceHandle);
+ _mixer->playRaw(&_voiceHandle, buffer, size, rate, flags);
+}
+
void Sound::playEffects(uint sound) {
if (!_effects)
return;
Modified: scummvm/trunk/engines/simon/sound.h
===================================================================
--- scummvm/trunk/engines/simon/sound.h 2006-04-14 04:22:49 UTC (rev 21870)
+++ scummvm/trunk/engines/simon/sound.h 2006-04-14 05:13:59 UTC (rev 21871)
@@ -65,7 +65,10 @@
void playVoice(uint sound);
void playEffects(uint sound);
void playAmbient(uint sound);
+
+ // Feeble Files specific
void playSoundData(byte *soundData, uint sound, uint pan, uint vol, bool ambient);
+ void playVoiceData(byte *soundData, uint sound);
bool hasVoice() const;
bool isVoiceActive() const;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list