AGOS: cleanup

svn-id: r47451
This commit is contained in:
Max Horn 2010-01-22 23:58:24 +00:00
parent e754d8e1d3
commit e270da88a6
4 changed files with 13 additions and 8 deletions

View file

@ -558,7 +558,7 @@ void AGOSEngine_Simon1::os1_unloadZone() {
void AGOSEngine_Simon1::os1_loadStrings() { void AGOSEngine_Simon1::os1_loadStrings() {
// 185: load sound files // 185: load sound files
_soundFileId = getVarOrWord(); _soundFileId = getVarOrWord();
if (getPlatform() == Common::kPlatformAmiga && getFeatures() & GF_TALKIE) { if (getPlatform() == Common::kPlatformAmiga && (getFeatures() & GF_TALKIE)) {
char buf[10]; char buf[10];
sprintf(buf, "%d%s", _soundFileId, "Effects"); sprintf(buf, "%d%s", _soundFileId, "Effects");
_sound->readSfxFile(buf); _sound->readSfxFile(buf);

View file

@ -574,7 +574,8 @@ void Sound::loadSfxFile(const GameSpecificSettings *gss) {
} }
} }
void Sound::readSfxFile(const char *filename) { // This method is only used by Simon1 Amiga Talkie & Windows
void Sound::readSfxFile(const Common::String &filename) {
if (_hasEffectsFile) if (_hasEffectsFile)
return; return;
@ -584,7 +585,7 @@ void Sound::readSfxFile(const char *filename) {
file->open(filename); file->open(filename);
if (file->isOpen() == false) { if (file->isOpen() == false) {
error("readSfxFile: Can't load sfx file %s", filename); error("readSfxFile: Can't load sfx file %s", filename.c_str());
} }
delete _effects; delete _effects;
@ -594,6 +595,7 @@ void Sound::readSfxFile(const char *filename) {
_effects = new WavSound(_mixer, file); _effects = new WavSound(_mixer, file);
} }
// This method is only used by Simon2
void Sound::loadSfxTable(File *gameFile, uint32 base) { void Sound::loadSfxTable(File *gameFile, uint32 base) {
stopAll(); stopAll();
@ -606,14 +608,15 @@ void Sound::loadSfxTable(File *gameFile, uint32 base) {
_effects = new VocSound(_mixer, gameFile, base); _effects = new VocSound(_mixer, gameFile, base);
} }
void Sound::readVoiceFile(const char *filename) { // This method is only used by Simon1 Amiga Talkie
void Sound::readVoiceFile(const Common::String &filename) {
_mixer->stopHandle(_voiceHandle); _mixer->stopHandle(_voiceHandle);
File *file = new File(); File *file = new File();
file->open(filename); file->open(filename);
if (file->isOpen() == false) if (file->isOpen() == false)
error("readVoiceFile: Can't load voice file %s", filename); error("readVoiceFile: Can't load voice file %s", filename.c_str());
delete _voice; delete _voice;
_voice = new RawSound(_mixer, file, 0, SOUND_BIG_ENDIAN); _voice = new RawSound(_mixer, file, 0, SOUND_BIG_ENDIAN);

View file

@ -78,12 +78,14 @@ public:
TYPE_SFX5 = 1 << 2 TYPE_SFX5 = 1 << 2
}; };
protected:
void loadVoiceFile(const GameSpecificSettings *gss); void loadVoiceFile(const GameSpecificSettings *gss);
void loadSfxFile(const GameSpecificSettings *gss); void loadSfxFile(const GameSpecificSettings *gss);
void readSfxFile(const char *filename); public:
void readSfxFile(const Common::String &filename);
void loadSfxTable(Common::File *gameFile, uint32 base); void loadSfxTable(Common::File *gameFile, uint32 base);
void readVoiceFile(const char *filename); void readVoiceFile(const Common::String &filename);
void playVoice(uint sound); void playVoice(uint sound);
void playEffects(uint sound); void playEffects(uint sound);

View file

@ -383,7 +383,7 @@ bool AGOSEngine_Waxworks::loadTablesIntoMem(uint16 subrId) {
filename.setChar('X', 4); filename.setChar('X', 4);
filename.setChar('X', 5); filename.setChar('X', 5);
if (atoi(filename.c_str() + 6) != 1 && atoi(filename.c_str() + 6) != 30) if (atoi(filename.c_str() + 6) != 1 && atoi(filename.c_str() + 6) != 30)
_sound->readSfxFile(filename.c_str()); _sound->readSfxFile(filename);
} }
alignTableMem(); alignTableMem();