[Scummvm-cvs-logs] CVS: scummvm/simon items.cpp,1.85,1.86 simon.cpp,1.256,1.257 sound.cpp,1.28,1.29 sound.h,1.10,1.11 vga.cpp,1.71,1.72
Travis Howell
kirben at users.sourceforge.net
Sun Jul 20 21:01:03 CEST 2003
Update of /cvsroot/scummvm/scummvm/simon
In directory sc8-pr-cvs1:/tmp/cvs-serv30123/simon
Modified Files:
items.cpp simon.cpp sound.cpp sound.h vga.cpp
Log Message:
Add sfx/voice support for simon1cd32, thanks to olki.
Adjust a few debugs
Add hack to allow load/save in simon1cd32 via keyboard
Index: items.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/items.cpp,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -d -r1.85 -r1.86
--- items.cpp 20 Jul 2003 15:17:11 -0000 1.85
+++ items.cpp 21 Jul 2003 04:00:04 -0000 1.86
@@ -1049,7 +1049,15 @@
case 185:{ /* midi sfx file number */
if (_game & GF_SIMON2)
goto invalid_opcode;
- _midi_sfx = getVarOrWord();
+ _midi_sfx = getVarOrWord();
+ if (_game == GAME_SIMON1CD32) {
+ char buf[10];
+ sprintf(buf, "%d%s", _midi_sfx, "Effects");
+ _sound->readSfxFile(buf, _gameDataPath);
+ sprintf(buf, "%d%s", _midi_sfx, "simon");
+ _sound->readVoiceFile(buf, _gameDataPath);
+ }
+
}
break;
@@ -1374,6 +1382,9 @@
start_over:;
_key_pressed = 0;
+ if (_game == GAME_SIMON1CD32)
+ goto start_over_3;
+
start_over_2:;
_last_hitarea = _last_hitarea_3 = 0;
@@ -1419,6 +1430,49 @@
if (ha->id >= 214)
goto start_over_2;
return ha->id - 208;
+
+//FIXME Hack to allow load and save file selection in simon1cd32
+// Uses the follow keys for moving around
+// 1 - 6 to select slot to load/save
+// Up Arrow to move up slots
+// Down Arrow to move down slots
+// X to exit
+start_over_3:;
+ if (_saveload_flag) {
+ *b = false;
+ delay(1);
+ return _key_pressed;
+ }
+
+ if (_key_pressed == 17) {
+ if (_saveload_row_curpos == 1)
+ goto start_over_3;
+ if (_saveload_row_curpos < 7)
+ _saveload_row_curpos = 1;
+ else
+ _saveload_row_curpos -= 6;
+
+ goto strange_jump;
+ }
+
+ if (_key_pressed == 18) {
+ if (!_savedialog_flag)
+ goto start_over_3;
+ _saveload_row_curpos += 6;
+ goto strange_jump;
+ }
+
+ if (_key_pressed == 120)
+ return 205;
+
+ if (_key_pressed > 48 && _key_pressed < 55) {
+ return _key_pressed - 49;
+ }
+
+
+ delay(1);
+ goto start_over_3;
+
}
void SimonEngine::o_unk_132_helper_3() {
Index: simon.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/simon.cpp,v
retrieving revision 1.256
retrieving revision 1.257
diff -u -d -r1.256 -r1.257
--- simon.cpp 20 Jul 2003 15:31:47 -0000 1.256
+++ simon.cpp 21 Jul 2003 04:00:04 -0000 1.257
@@ -1079,8 +1079,6 @@
if (_game == GAME_SIMON1WIN) {
memcpy(filename, "SFXXXX", 6);
_sound->readSfxFile(filename, _gameDataPath);
- } else if (_game == GAME_SIMON1CD32) {
- //TODO Add loading of simon1cd32 sound effects and voice files.
} else if (_game & GF_SIMON2) {
_sound->loadSfxTable(_game_file, _game_offsets_ptr[atoi(filename + 6) - 1 + gss->SOUND_INDEX_BASE]);
}
@@ -4745,10 +4743,10 @@
if (_game & GF_AMIGA) {
if (_game != GAME_SIMON1CD32) {
// TODO Add support for decruncher
- debug(1,"playMusic - Decrunch %dtune attempt", music);
+ debug(5,"playMusic - Decrunch %dtune attempt", music);
}
// TODO Add Protracker support for simon1amiga/cd32
- debug(1,"playMusic - Load %dtune attempt", music);
+ debug(5,"playMusic - Load %dtune attempt", music);
} else {
midi.stop();
midi.setLoop (true); // Must do this BEFORE loading music. (GMF may have its own override.)
Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/sound.cpp,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- sound.cpp 24 Jun 2003 21:52:52 -0000 1.28
+++ sound.cpp 21 Jul 2003 04:00:04 -0000 1.29
@@ -22,6 +22,9 @@
#include "common/file.h"
#include "common/engine.h"
+#define SOUND_BIG_ENDIAN true
+#define FLAG_SIGNED 0
+
class BaseSound {
protected:
File *_file;
@@ -29,26 +32,32 @@
SoundMixer *_mixer;
public:
- BaseSound(SoundMixer *mixer, File *file, uint32 base = 0);
- BaseSound(SoundMixer *mixer, File *file, uint32 *offsets);
+ BaseSound(SoundMixer *mixer, File *file, uint32 base = 0, bool bigendian = false);
+ BaseSound(SoundMixer *mixer, File *file, uint32 *offsets, bool bigendian = false);
virtual ~BaseSound();
- virtual int playSound(uint sound, PlayingSoundHandle *handle, byte flags = 0) = 0;
+ virtual int playSound(uint sound, PlayingSoundHandle *handle, byte flags = SoundMixer::FLAG_UNSIGNED) = 0;
};
class WavSound : public BaseSound {
public:
- WavSound(SoundMixer *mixer, File *file, uint32 base = 0) : BaseSound(mixer, file, base) {};
+ WavSound(SoundMixer *mixer, File *file, uint32 base = 0, bool bigendian = false) : BaseSound(mixer, file, base, bigendian) {};
WavSound(SoundMixer *mixer, File *file, uint32 *offsets) : BaseSound(mixer, file, offsets) {};
- int playSound(uint sound, PlayingSoundHandle *handle, byte flags = 0);
+ int playSound(uint sound, PlayingSoundHandle *handle, byte flags = SoundMixer::FLAG_UNSIGNED);
};
class VocSound : public BaseSound {
public:
- VocSound(SoundMixer *mixer, File *file, uint32 base = 0) : BaseSound(mixer, file, base) {};
- int playSound(uint sound, PlayingSoundHandle *handle, byte flags = 0);
+ VocSound(SoundMixer *mixer, File *file, uint32 base = 0, bool bigendian = false) : BaseSound(mixer, file, base, bigendian) {};
+ int playSound(uint sound, PlayingSoundHandle *handle, byte flags = SoundMixer::FLAG_UNSIGNED);
+};
+class RawSound : public BaseSound {
+public:
+ RawSound(SoundMixer *mixer, File *file, uint32 base = 0, bool bigendian = false) : BaseSound(mixer, file, base, bigendian) {};
+ int playSound(uint sound, PlayingSoundHandle *handle, byte flags = SoundMixer::FLAG_UNSIGNED);
};
-BaseSound::BaseSound(SoundMixer *mixer, File *file, uint32 base) {
+
+BaseSound::BaseSound(SoundMixer *mixer, File *file, uint32 base, bool bigendian) {
_mixer = mixer;
_file = file;
@@ -56,7 +65,10 @@
uint32 size;
_file->seek(base + sizeof(uint32), SEEK_SET);
- size = _file->readUint32LE();
+ if (bigendian)
+ size = _file->readUint32BE();
+ else
+ size = _file->readUint32LE();
res = size / sizeof(uint32);
@@ -69,8 +81,11 @@
for (uint i = 0; i < res; i++) {
#if defined(SCUMM_BIG_ENDIAN)
+ if (!(bigendian))
_offsets[i] = FROM_LE_32(_offsets[i]);
#endif
+ if (bigendian)
+ _offsets[i] = TO_BE_32(_offsets[i]);
_offsets[i] += base;
}
@@ -79,7 +94,7 @@
_offsets[res] = _file->pos();
}
-BaseSound::BaseSound(SoundMixer *mixer, File *file, uint32 *offsets) {
+BaseSound::BaseSound(SoundMixer *mixer, File *file, uint32 *offsets, bool bigendian) {
_mixer = mixer;
_file = file;
_offsets = offsets;
@@ -136,7 +151,7 @@
WaveHeader wave_hdr;
uint32 data[2];
- flags |= SoundMixer::FLAG_UNSIGNED|SoundMixer::FLAG_AUTOFREE;
+ flags |= SoundMixer::FLAG_AUTOFREE;
_file->seek(_offsets[sound], SEEK_SET);
@@ -171,7 +186,7 @@
VocBlockHeader voc_block_hdr;
uint32 size;
- flags |= SoundMixer::FLAG_UNSIGNED|SoundMixer::FLAG_AUTOFREE;
+ flags |= SoundMixer::FLAG_AUTOFREE;
_file->seek(_offsets[sound], SEEK_SET);
@@ -201,11 +216,25 @@
return _mixer->playRaw(handle, buffer, size, samples_per_sec, flags);
}
+int RawSound::playSound(uint sound, PlayingSoundHandle *handle, byte flags) {
+ if (_offsets == NULL)
+ return 0;
+
+ flags |= SoundMixer::FLAG_AUTOFREE;
+
+ _file->seek(_offsets[sound], SEEK_SET);
+ uint size = _file->readUint32BE();
+ byte *buffer = (byte *)malloc(size);
+ _file->read(buffer, size);
+
+ return _mixer->playRaw(handle, buffer, size, 22050, flags);
+}
+
#ifdef USE_MAD
class MP3Sound : public BaseSound {
public:
MP3Sound(SoundMixer *mixer, File *file, uint32 base = 0) : BaseSound(mixer, file, base) {};
- int playSound(uint sound, PlayingSoundHandle *handle, byte flags = 0);
+ int playSound(uint sound, PlayingSoundHandle *handle, byte flags = SoundMixer::FLAG_UNSIGNED);
};
int MP3Sound::playSound(uint sound, PlayingSoundHandle *handle, byte flags)
@@ -289,6 +318,9 @@
_voice_file = true;
_voice = new WavSound(_mixer, file);
}
+ } else if (_game == GAME_SIMON1CD32) {
+ // simon1cd32 uses separate voice files
+ return;
} else if (_game & GF_TALKIE) {
s = gss->voc_filename;
file->open(s, gameDataPath);
@@ -355,7 +387,10 @@
}
}
- _effects = new WavSound(_mixer, file);
+ if (_game == GAME_SIMON1CD32) {
+ _effects = new VocSound(_mixer, file, 0, SOUND_BIG_ENDIAN);
+ } else
+ _effects = new WavSound(_mixer, file);
}
void SimonSound::loadSfxTable(File *gameFile, uint32 base) {
@@ -367,6 +402,29 @@
_effects = new VocSound(_mixer, gameFile, base);
}
+void SimonSound::readVoiceFile(const char *filename, const char *gameDataPath) {
+ stopAll();
+
+ File *file = new File();
+ file->open(filename, gameDataPath);
+
+ if (file->isOpen() == false) {
+ char *filename2;
+ filename2 = (char *)malloc(strlen(filename) + 2);
+ strcpy(filename2, filename);
+ strcat(filename2, ".");
+ file->open(filename2, gameDataPath);
+ free(filename2);
+ if (file->isOpen() == false) {
+ if (atoi(filename + 6) != 1 && atoi(filename + 6) != 30)
+ warning("readVoiceFile: Can't load voice file %s", filename);
+ return;
+ }
+ }
+
+ _voice = new RawSound(_mixer, file, 0, SOUND_BIG_ENDIAN);
+}
+
void SimonSound::playVoice(uint sound) {
if (_game == GAME_SIMON2MAC && _filenums) {
char filename[16];
@@ -383,8 +441,11 @@
if (!_voice)
return;
-
- _voice_index = _voice->playSound(sound, &_voice_handle);
+
+ if (_game == GAME_SIMON1CD32)
+ _voice_index = _voice->playSound(sound, &_voice_handle, FLAG_SIGNED);
+ else
+ _voice_index = _voice->playSound(sound, &_voice_handle);
}
void SimonSound::playEffects(uint sound) {
@@ -394,7 +455,10 @@
if (_effects_paused)
return;
- _effects->playSound(sound, &_effects_handle);
+ if (_game == GAME_SIMON1CD32)
+ _effects->playSound(sound, &_effects_handle, FLAG_SIGNED);
+ else
+ _effects->playSound(sound, &_effects_handle);
}
void SimonSound::playAmbient(uint sound) {
@@ -412,7 +476,7 @@
if (_ambient_handle)
_mixer->stop(_ambient_index);
- _ambient_index = _effects->playSound(sound, &_ambient_handle, SoundMixer::FLAG_LOOP);
+ _ambient_index = _effects->playSound(sound, &_ambient_handle, SoundMixer::FLAG_LOOP|SoundMixer::FLAG_UNSIGNED);
}
bool SimonSound::hasVoice() {
Index: sound.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/sound.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- sound.h 21 Jun 2003 15:36:19 -0000 1.10
+++ sound.h 21 Jul 2003 04:00:04 -0000 1.11
@@ -54,6 +54,7 @@
void readSfxFile(const char *filename, const char *gameDataPath);
void loadSfxTable(File *gameFile, uint32 base);
+ void readVoiceFile(const char *filename, const char *gameDataPath);
void playVoice(uint sound);
void playEffects(uint sound);
Index: vga.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/vga.cpp,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -d -r1.71 -r1.72
--- vga.cpp 20 Jul 2003 15:17:11 -0000 1.71
+++ vga.cpp 21 Jul 2003 04:00:04 -0000 1.72
@@ -658,7 +658,7 @@
} else if (state.e & 1) {
// FIXME: vc_10_no_depack_swap should be called but is currently not supported
//state.depack_src = vc_10_no_depack_swap(state.depack_src);
- debug(1,"vc_10_no_depack_swap unimpl");
+ debug(5,"vc_10_no_depack_swap unimpl");
state.depack_src = vc_10_depack_swap(state.depack_src, width, height);
}
More information about the Scummvm-git-logs
mailing list