[Scummvm-cvs-logs] CVS: scummvm/simon simon.cpp,1.31,1.32
James Brown
ender at users.sourceforge.net
Wed Jun 5 20:47:03 CEST 2002
Update of /cvsroot/scummvm/scummvm/simon
In directory usw-pr-cvs1:/tmp/cvs-serv24925/simon
Modified Files:
simon.cpp
Log Message:
Remove Simons dependency on FLAG_FILE, as some dolt has broken that in the current mixer.
Index: simon.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/simon.cpp,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- simon.cpp 5 Jun 2002 02:59:35 -0000 1.31
+++ simon.cpp 6 Jun 2002 03:46:44 -0000 1.32
@@ -8247,14 +8247,20 @@
/* only read voice file in windows game */
if (_game & GAME_WIN) {
const char *s = gss->wav_filename;
+ const char *s2 = gss->wav_filename2;
const char *e = gss->effects_filename;
_voice_offsets = NULL;
_voice_file = fopen_maybe_lowercase(s);
if (_voice_file == NULL) {
- warning("Cannot open %s",s);
- return;
+ warning("Cannot open voice file %s, trying %s",s,s2);
+
+ _voice_file = fopen_maybe_lowercase(s2);
+ if (_voice_file == NULL) {
+ warning("Cannot open voice file %s",s2);
+ return;
+ }
}
_voice_offsets = (uint32*)malloc(gss->NUM_VOICE_RESOURCES * sizeof(uint32));
@@ -8328,13 +8334,12 @@
void SimonState::playVoice(uint voice) {
- WaveHeader wave_hdr;
- uint32 data[2];
+ _mixer->stop(_voice_sound);
+ fseek(_voice_file, _voice_offsets[voice], SEEK_SET);
if (!_effects_offsets) { /* WAVE audio */
- _mixer->stop(_voice_sound);
-
- fseek(_voice_file, _voice_offsets[voice], SEEK_SET);
+ WaveHeader wave_hdr;
+ uint32 data[2];
if (fread(&wave_hdr, sizeof(wave_hdr), 1, _voice_file)!=1 ||
wave_hdr.riff!=MKID('RIFF') || wave_hdr.wave!=MKID('WAVE') || wave_hdr.fmt!=MKID('fmt ') ||
@@ -8346,15 +8351,18 @@
fseek(_voice_file, READ_LE_UINT32(&wave_hdr.size) - sizeof(wave_hdr) + 20, SEEK_CUR);
- data[ 0 ] = fileReadLE32(_voice_file);
- data[ 1 ] = fileReadLE32(_voice_file);
+ data[0] = fileReadLE32(_voice_file);
+ data[1] = fileReadLE32(_voice_file);
if (//fread(data, sizeof(data), 1, _voice_file) != 1 ||
data[0] != 'atad' ) {
warning("playVoice(%d): cannot read data header",voice);
return;
}
- _mixer->play_raw(&_voice_sound, _voice_file, data[1], READ_LE_UINT32(&wave_hdr.samples_per_sec),
- SoundMixer::FLAG_FILE|SoundMixer::FLAG_UNSIGNED);
+
+ byte *buffer = (byte*)malloc(data[1]);
+ fread(buffer, data[1], 1, _voice_file);
+
+ _mixer->play_raw(&_voice_sound, buffer, data[1], READ_LE_UINT32(&wave_hdr.samples_per_sec), SoundMixer::FLAG_UNSIGNED);
} else { /* VOC audio*/
VocHeader voc_hdr;
VocBlockHeader voc_block_hdr;
@@ -8373,8 +8381,11 @@
uint32 samples_per_sec = 1000000L/(256L-(long)voc_block_hdr.tc);
- _mixer->play_raw(&_voice_sound, _voice_file, size, samples_per_sec,
- SoundMixer::FLAG_FILE|SoundMixer::FLAG_UNSIGNED);
+ byte *buffer = (byte*)malloc(size);
+ fread(buffer, size, 1, _effects_file);
+
+ _mixer->play_raw(&_effects_sound, buffer, size, samples_per_sec,
+ SoundMixer::FLAG_UNSIGNED);
}
}
@@ -8403,8 +8414,11 @@
uint32 samples_per_sec = 1000000L/(256L-(long)voc_block_hdr.tc);
- _mixer->play_raw(&_effects_sound, _effects_file, size, samples_per_sec,
- SoundMixer::FLAG_FILE|SoundMixer::FLAG_UNSIGNED);
+ byte *buffer = (byte*)malloc(size);
+ fread(buffer, size, 1, _effects_file);
+
+ _mixer->play_raw(&_effects_sound, buffer, size, samples_per_sec,
+ SoundMixer::FLAG_UNSIGNED);
} else {
byte *p;
@@ -8444,7 +8458,7 @@
/* FIXME: not properly implemented */
if (_game & GAME_WIN) {
- fseek(_game_file, _game_offsets_ptr[gss->MUSIC_INDEX_BASE + music],SEEK_SET);
+ fseek(_game_file, _game_offsets_ptr[gss->MUSIC_INDEX_BASE + music] - 1,SEEK_SET);
f = _game_file;
midi.read_all_songs(f);
More information about the Scummvm-git-logs
mailing list