aboutsummaryrefslogtreecommitdiff
path: root/simon
diff options
context:
space:
mode:
authorTravis Howell2003-01-12 02:01:07 +0000
committerTravis Howell2003-01-12 02:01:07 +0000
commit93184025d912d996298b5308a50c02c24b142700 (patch)
treedf3badf5b0bab6c4d1663b2f3fe3ba71abc5694a /simon
parent47fe35819a394e84fc42227cf2c4757003bb1ae9 (diff)
downloadscummvm-rg350-93184025d912d996298b5308a50c02c24b142700.tar.gz
scummvm-rg350-93184025d912d996298b5308a50c02c24b142700.tar.bz2
scummvm-rg350-93184025d912d996298b5308a50c02c24b142700.zip
Add warning when voice files are missing in simon2amiga/mac
Work if voice file is missing in simon2amiga/mac svn-id: r6411
Diffstat (limited to 'simon')
-rw-r--r--simon/simon.cpp26
-rw-r--r--simon/sound.cpp52
-rw-r--r--simon/sound.h1
3 files changed, 58 insertions, 21 deletions
diff --git a/simon/simon.cpp b/simon/simon.cpp
index 961c03dc80..3f1c0ac183 100644
--- a/simon/simon.cpp
+++ b/simon/simon.cpp
@@ -90,6 +90,24 @@ static const GameSpecificSettings simon2win_settings = {
"GSPTR30", /* gamepc_filename */
};
+static const GameSpecificSettings simon2mac_settings = {
+ 5, /* VGA_DELAY_BASE */
+ 1580 / 4, /* TABLE_INDEX_BASE */
+ 1500 / 4, /* TEXT_INDEX_BASE */
+ 75, /* NUM_VIDEO_OP_CODES */
+ 2000000, /* VGA_MEM_SIZE */
+ 100000, /* TABLES_MEM_SIZE */
+ 1128 / 4, /* MUSIC_INDEX_BASE */
+ 1660 / 4, /* SOUND_INDEX_BASE */
+ "Simon2.gme", /* gme_filename */
+ "", /* wav_filename */
+ "", /* voc_filename */
+ "SIMON2.MP3", /* mp3_filename */
+ "", /* voc_effects_filename */
+ "", /* mp3_effects_filename */
+ "gsptr30", /* gamepc_filename */
+};
+
static const GameSpecificSettings simon2dos_settings = {
5, /* VGA_DELAY_BASE */
1580 / 4, /* TABLE_INDEX_BASE */
@@ -4496,7 +4514,9 @@ void SimonState::go()
_sdl_buf = (byte *)calloc(320 * 200, 1);
_sdl_buf_attached = (byte *)calloc(320 * 200, 1);
- if (_game == GAME_SIMON2TALKIE || _game & GAME_SIMON2WIN) {
+ if (_game == GAME_SIMON2MAC) {
+ gss = &simon2mac_settings;
+ } else if (_game == GAME_SIMON2TALKIE || _game == GAME_SIMON2WIN) {
gss = &simon2win_settings;
} else if (_game == GAME_SIMON2DOS) {
gss = &simon2dos_settings;
@@ -4511,6 +4531,8 @@ void SimonState::go()
setup_vga_file_buf_pointers();
+ _vk_t_toggle = true;
+
_sound = new SimonSound(_game, gss, _gameDataPath, _mixer);
loadGamePcFile(gss->gamepc_filename);
@@ -4535,7 +4557,7 @@ void SimonState::go()
if (_sound->hasVoice()) {
_vk_t_toggle = false;
} else {
- _vk_t_toggle = false;
+ _vk_t_toggle = true;
}
midi._midi_sfx_toggle = false;
diff --git a/simon/sound.cpp b/simon/sound.cpp
index 5e90ece0d9..2c5adf89bb 100644
--- a/simon/sound.cpp
+++ b/simon/sound.cpp
@@ -37,6 +37,8 @@ SimonSound::SimonSound(const byte game, const GameSpecificSettings *gss, const c
_ambient_playing = 0;
+ _voice_file = false;
+
File *file = new File();
File *file2 = new File();
const char *s;
@@ -44,15 +46,20 @@ SimonSound::SimonSound(const byte game, const GameSpecificSettings *gss, const c
// for simon2 mac/amiga, only read index file
if (_game == GAME_SIMON2MAC) {
file->open("voices.idx", gameDataPath);
- file->seek(0, SEEK_END);
- int end = file->pos();
- file->seek(0, SEEK_SET);
- _filenums = (uint16 *)malloc(end / 3 + 1);
- _offsets = (uint32 *)malloc((end / 6) * 4 + 1);
-
- for (int i = 1; i <= end / 6; i++) {
- _filenums[i] = file->readUint16BE();
- _offsets[i] = file->readUint32BE();
+ if (file->isOpen() == false) {
+ warning("Can't open voice index file 'voices.idx'");
+ } else {
+ file->seek(0, SEEK_END);
+ int end = file->pos();
+ file->seek(0, SEEK_SET);
+ _filenums = (uint16 *)malloc(end / 3 + 1);
+ _offsets = (uint32 *)malloc((end / 6) * 4 + 1);
+
+ for (int i = 1; i <= end / 6; i++) {
+ _filenums[i] = file->readUint16BE();
+ _offsets[i] = file->readUint32BE();
+ }
+ _voice_file = true;
}
} else {
#ifdef USE_MAD
@@ -63,21 +70,24 @@ SimonSound::SimonSound(const byte game, const GameSpecificSettings *gss, const c
s = gss->wav_filename;
file->open(s, gameDataPath);
if (file->isOpen() == false) {
- warning("Cannot open voice file %s", s);
+ warning("Can't open voice file %s", s);
} else {
+ _voice_file = true;
_voice = new WavSound(_mixer, file);
}
} else if (_game & GAME_TALKIE) {
s = gss->voc_filename;
file->open(s, gameDataPath);
if (file->isOpen() == false) {
- warning("Cannot open voice file %s", s);
+ warning("Can't open voice file %s", s);
} else {
+ _voice_file = true;
_voice = new VocSound(_mixer, file);
}
}
#ifdef USE_MAD
} else {
+ _voice_file = true;
_voice = new MP3Sound(_mixer, file);
}
#endif
@@ -90,7 +100,7 @@ SimonSound::SimonSound(const byte game, const GameSpecificSettings *gss, const c
s = gss->voc_effects_filename;
file2->open(s, gameDataPath);
if (file2->isOpen() == false) {
- warning("Cannot open effects file %s", s);
+ warning("Can't open effects file %s", s);
} else {
_effects = new VocSound(_mixer, file2);
}
@@ -119,7 +129,7 @@ void SimonSound::readSfxFile(const char *filename, const char *gameDataPath)
free(filename2);
if (file->isOpen() == false) {
if (atoi(filename + 6) != 1 && atoi(filename + 6) != 30)
- warning("readSfxFile: Cannot load sfx file %s", filename);
+ warning("readSfxFile: Can't load sfx file %s", filename);
return;
}
}
@@ -144,7 +154,11 @@ void SimonSound::playVoice(uint sound)
sprintf(filename, "voices%d.dat", _filenums[sound]);
File *file = new File();
file->open(filename, _gameDataPath);
- _voice = new WavSound(_mixer, file, _offsets);
+ if (file->isOpen() == false) {
+ warning("Can't open voice file %s", filename);
+ } else {
+ _voice = new WavSound(_mixer, file, _offsets);
+ }
}
if (!_voice)
@@ -185,7 +199,7 @@ void SimonSound::playAmbient(uint sound)
bool SimonSound::hasVoice()
{
- return _voice != NULL;
+ return _voice_file;
}
void SimonSound::stopVoice()
@@ -237,7 +251,7 @@ SimonSound::Sound::Sound(SoundMixer *mixer, File *file, uint32 base)
_file->seek(base, SEEK_SET);
if (_file->read(_offsets, size) != size)
- error("Cannot read offsets");
+ error("Can't read offsets");
for (uint i = 0; i < res; i++) {
#if defined(SCUMM_BIG_ENDIAN)
@@ -331,7 +345,7 @@ int SimonSound::VocSound::playSound(uint sound, PlayingSoundHandle *handle, byte
if (_file->read(&voc_hdr, sizeof(voc_hdr)) != sizeof(voc_hdr) ||
strncmp((char *)voc_hdr.desc, "Creative Voice File\x1A", 10) != 0) {
- error("playVoc(%d): cannot read voc header", sound);
+ error("playVoc(%d): can't read voc header", sound);
}
_file->read(&voc_block_hdr, sizeof(voc_block_hdr));
@@ -372,7 +386,7 @@ int SimonSound::WavSound::playSound(uint sound, PlayingSoundHandle *handle, byte
|| wave_hdr.fmt != MKID('fmt ') || READ_LE_UINT16(&wave_hdr.format_tag) != 1
|| READ_LE_UINT16(&wave_hdr.channels) != 1
|| READ_LE_UINT16(&wave_hdr.bits_per_sample) != 8) {
- error("playWav(%d): cannot read RIFF header", sound);
+ error("playWav(%d): can't read RIFF header", sound);
}
_file->seek(FROM_LE_32(wave_hdr.size) - sizeof(wave_hdr) + 20, SEEK_CUR);
@@ -381,7 +395,7 @@ int SimonSound::WavSound::playSound(uint sound, PlayingSoundHandle *handle, byte
data[1] = _file->readUint32LE();
if (//fread(data, sizeof(data), 1, sound_file) != 1 ||
data[0] != 'atad') {
- error("playWav(%d): cannot read data header", sound);
+ error("playWav(%d): can't read data header", sound);
}
byte *buffer = (byte *)malloc(data[1]);
diff --git a/simon/sound.h b/simon/sound.h
index 58408b2864..0cc2645822 100644
--- a/simon/sound.h
+++ b/simon/sound.h
@@ -74,6 +74,7 @@ public:
PlayingSoundHandle _effects_handle;
PlayingSoundHandle _ambient_handle;
+ bool _voice_file;
uint _ambient_playing;
SimonSound(const byte game, const GameSpecificSettings *gss, const char *gameDataPath, SoundMixer *mixer);