diff options
Diffstat (limited to 'engines/sword1')
-rw-r--r-- | engines/sword1/animation.cpp | 14 | ||||
-rw-r--r-- | engines/sword1/control.cpp | 12 | ||||
-rw-r--r-- | engines/sword1/detection.cpp | 48 | ||||
-rw-r--r-- | engines/sword1/logic.cpp | 3 | ||||
-rw-r--r-- | engines/sword1/music.cpp | 68 | ||||
-rw-r--r-- | engines/sword1/music.h | 2 |
6 files changed, 71 insertions, 76 deletions
diff --git a/engines/sword1/animation.cpp b/engines/sword1/animation.cpp index 7e9d1142be..f19efd2635 100644 --- a/engines/sword1/animation.cpp +++ b/engines/sword1/animation.cpp @@ -24,6 +24,7 @@ #include "common/events.h" #include "common/keyboard.h" #include "common/textconsole.h" +#include "common/translation.h" #include "sword1/sword1.h" #include "sword1/animation.h" #include "sword1/text.h" @@ -113,7 +114,7 @@ bool MoviePlayer::load(uint32 id) { int startFrame = strtoul(ptr, const_cast<char **>(&ptr), 10); int endFrame = strtoul(ptr, const_cast<char **>(&ptr), 10); - while (*ptr && isspace(*ptr)) + while (*ptr && isspace(static_cast<unsigned char>(*ptr))) ptr++; if (startFrame > endFrame) { @@ -260,7 +261,7 @@ bool MoviePlayer::playVideo() { uint32 minWeight = 0xFFFFFFFF; uint32 weight; byte r, g, b; - + const byte *palette = _decoder->getPalette(); for (int i = 0; i < 256; i++) { @@ -324,7 +325,6 @@ uint32 DXADecoderWithSound::getElapsedTime() const { MoviePlayer *makeMoviePlayer(uint32 id, SwordEngine *vm, Text *textMan, Audio::Mixer *snd, OSystem *system) { Common::String filename; - char buf[60]; Audio::SoundHandle *bgSoundHandle = new Audio::SoundHandle; filename = Common::String::format("%s.smk", sequenceList[id]); @@ -341,7 +341,7 @@ MoviePlayer *makeMoviePlayer(uint32 id, SwordEngine *vm, Text *textMan, Audio::M DXADecoderWithSound *dxaDecoder = new DXADecoderWithSound(snd, bgSoundHandle); return new MoviePlayer(vm, textMan, snd, system, bgSoundHandle, dxaDecoder, kVideoDecoderDXA); #else - GUI::MessageDialog dialog("DXA cutscenes found but ScummVM has been built without zlib support", "OK"); + GUI::MessageDialog dialog(_("DXA cutscenes found but ScummVM has been built without zlib support"), _("OK")); dialog.runModal(); return NULL; #endif @@ -351,13 +351,13 @@ MoviePlayer *makeMoviePlayer(uint32 id, SwordEngine *vm, Text *textMan, Audio::M filename = Common::String::format("%s.mp2", sequenceList[id]); if (Common::File::exists(filename)) { - GUI::MessageDialog dialog("MPEG2 cutscenes are no longer supported", "OK"); + GUI::MessageDialog dialog(_("MPEG2 cutscenes are no longer supported"), _("OK")); dialog.runModal(); return NULL; } - sprintf(buf, "Cutscene '%s' not found", sequenceList[id]); - GUI::MessageDialog dialog(buf, "OK"); + Common::String buf = Common::String::format(_("Cutscene '%s' not found"), sequenceList[id]); + GUI::MessageDialog dialog(buf, _("OK")); dialog.runModal(); return NULL; diff --git a/engines/sword1/control.cpp b/engines/sword1/control.cpp index 86947db8ae..36d5a24e99 100644 --- a/engines/sword1/control.cpp +++ b/engines/sword1/control.cpp @@ -27,6 +27,7 @@ #include "common/system.h" #include "common/config-manager.h" #include "common/textconsole.h" +#include "common/translation.h" #include "graphics/palette.h" #include "graphics/thumbnail.h" @@ -859,9 +860,9 @@ void Control::checkForOldSaveGames() { } GUI::MessageDialog dialog0( - "ScummVM found that you have old savefiles for Broken Sword 1 that should be converted.\n" + _("ScummVM found that you have old savefiles for Broken Sword 1 that should be converted.\n" "The old save game format is no longer supported, so you will not be able to load your games if you don't convert them.\n\n" - "Press OK to convert them now, otherwise you will be asked again the next time you start the game.\n", "OK", "Cancel"); + "Press OK to convert them now, otherwise you will be asked again the next time you start the game.\n"), _("OK"), _("Cancel")); int choice = dialog0.runModal(); if (choice == GUI::kMessageCancel) { @@ -1228,11 +1229,10 @@ bool Control::convertSaveGame(uint8 slot, char* desc) { if (testSave) { delete testSave; - char msg[200]; - sprintf(msg, "Target new save game already exists!\n" - "Would you like to keep the old save game (%s) or the new one (%s)?\n", + Common::String msg = Common::String::format(_("Target new save game already exists!\n" + "Would you like to keep the old save game (%s) or the new one (%s)?\n"), oldFileName, newFileName); - GUI::MessageDialog dialog0(msg, "Keep the old one", "Keep the new one"); + GUI::MessageDialog dialog0(msg, _("Keep the old one"), _("Keep the new one")); int choice = dialog0.runModal(); if (choice == GUI::kMessageCancel) { diff --git a/engines/sword1/detection.cpp b/engines/sword1/detection.cpp index 48c3a0d14d..0c1e74082f 100644 --- a/engines/sword1/detection.cpp +++ b/engines/sword1/detection.cpp @@ -33,18 +33,18 @@ #include "engines/metaengine.h" /* Broken Sword */ -static const PlainGameDescriptorGUIOpts sword1FullSettings = - {"sword1", "Broken Sword: The Shadow of the Templars", Common::GUIO_NOMIDI}; -static const PlainGameDescriptorGUIOpts sword1DemoSettings = - {"sword1demo", "Broken Sword: The Shadow of the Templars (Demo)", Common::GUIO_NOMIDI}; -static const PlainGameDescriptorGUIOpts sword1MacFullSettings = - {"sword1mac", "Broken Sword: The Shadow of the Templars (Mac)", Common::GUIO_NOMIDI}; -static const PlainGameDescriptorGUIOpts sword1MacDemoSettings = - {"sword1macdemo", "Broken Sword: The Shadow of the Templars (Mac demo)", Common::GUIO_NOMIDI}; -static const PlainGameDescriptorGUIOpts sword1PSXSettings = - {"sword1psx", "Broken Sword: The Shadow of the Templars (PlayStation)", Common::GUIO_NOMIDI}; -static const PlainGameDescriptorGUIOpts sword1PSXDemoSettings = - {"sword1psxdemo", "Broken Sword: The Shadow of the Templars (PlayStation demo)", Common::GUIO_NOMIDI}; +static const PlainGameDescriptor sword1FullSettings = + {"sword1", "Broken Sword: The Shadow of the Templars"}; +static const PlainGameDescriptor sword1DemoSettings = + {"sword1demo", "Broken Sword: The Shadow of the Templars (Demo)"}; +static const PlainGameDescriptor sword1MacFullSettings = + {"sword1mac", "Broken Sword: The Shadow of the Templars (Mac)"}; +static const PlainGameDescriptor sword1MacDemoSettings = + {"sword1macdemo", "Broken Sword: The Shadow of the Templars (Mac demo)"}; +static const PlainGameDescriptor sword1PSXSettings = + {"sword1psx", "Broken Sword: The Shadow of the Templars (PlayStation)"}; +static const PlainGameDescriptor sword1PSXDemoSettings = + {"sword1psxdemo", "Broken Sword: The Shadow of the Templars (PlayStation demo)"}; // check these subdirectories (if present) @@ -117,12 +117,12 @@ bool Sword1::SwordEngine::hasFeature(EngineFeature f) const { GameList SwordMetaEngine::getSupportedGames() const { GameList games; - games.push_back(sword1FullSettings); - games.push_back(sword1DemoSettings); - games.push_back(sword1MacFullSettings); - games.push_back(sword1MacDemoSettings); - games.push_back(sword1PSXSettings); - games.push_back(sword1PSXDemoSettings); + games.push_back(GameDescriptor(sword1FullSettings, Common::GUIO_NOMIDI)); + games.push_back(GameDescriptor(sword1DemoSettings, Common::GUIO_NOMIDI)); + games.push_back(GameDescriptor(sword1MacFullSettings, Common::GUIO_NOMIDI)); + games.push_back(GameDescriptor(sword1MacDemoSettings, Common::GUIO_NOMIDI)); + games.push_back(GameDescriptor(sword1PSXSettings, Common::GUIO_NOMIDI)); + games.push_back(GameDescriptor(sword1PSXDemoSettings, Common::GUIO_NOMIDI)); return games; } @@ -198,17 +198,17 @@ GameList SwordMetaEngine::detectGames(const Common::FSList &fslist) const { psxDemoFilesFound = false; if (mainFilesFound && pcFilesFound && demoFilesFound) - detectedGames.push_back(sword1DemoSettings); + detectedGames.push_back(GameDescriptor(sword1DemoSettings, Common::GUIO_NOMIDI)); else if (mainFilesFound && pcFilesFound && psxFilesFound) - detectedGames.push_back(sword1PSXSettings); + detectedGames.push_back(GameDescriptor(sword1PSXSettings, Common::GUIO_NOMIDI)); else if (mainFilesFound && pcFilesFound && psxDemoFilesFound) - detectedGames.push_back(sword1PSXDemoSettings); + detectedGames.push_back(GameDescriptor(sword1PSXDemoSettings, Common::GUIO_NOMIDI)); else if (mainFilesFound && pcFilesFound && !psxFilesFound) - detectedGames.push_back(sword1FullSettings); + detectedGames.push_back(GameDescriptor(sword1FullSettings, Common::GUIO_NOMIDI)); else if (mainFilesFound && macFilesFound) - detectedGames.push_back(sword1MacFullSettings); + detectedGames.push_back(GameDescriptor(sword1MacFullSettings, Common::GUIO_NOMIDI)); else if (mainFilesFound && macDemoFilesFound) - detectedGames.push_back(sword1MacDemoSettings); + detectedGames.push_back(GameDescriptor(sword1MacDemoSettings, Common::GUIO_NOMIDI)); return detectedGames; } diff --git a/engines/sword1/logic.cpp b/engines/sword1/logic.cpp index 00f7112c05..5b42c9340e 100644 --- a/engines/sword1/logic.cpp +++ b/engines/sword1/logic.cpp @@ -23,6 +23,7 @@ #include "common/endian.h" #include "common/util.h" #include "common/textconsole.h" +#include "common/translation.h" #include "sword1/logic.h" #include "sword1/text.h" @@ -1629,7 +1630,7 @@ int Logic::fnRestartGame(Object *cpt, int32 id, int32 a, int32 b, int32 c, int32 int Logic::fnQuitGame(Object *cpt, int32 id, int32 a, int32 b, int32 c, int32 d, int32 z, int32 x) { if (SwordEngine::_systemVars.isDemo) { - GUI::MessageDialog dialog("This is the end of the Broken Sword 1 Demo", "OK", NULL); + GUI::MessageDialog dialog(_("This is the end of the Broken Sword 1 Demo"), _("OK"), NULL); dialog.runModal(); Engine::quitGame(); } else diff --git a/engines/sword1/music.cpp b/engines/sword1/music.cpp index a291d80f85..b4656ff89f 100644 --- a/engines/sword1/music.cpp +++ b/engines/sword1/music.cpp @@ -47,68 +47,65 @@ namespace Sword1 { // These functions are only called from Music, so I'm just going to // assume that if locking is needed it has already been taken care of. -bool MusicHandle::play(const char *fileBase, bool loop) { - char fileName[30]; +bool MusicHandle::play(const Common::String &filename, bool loop) { stop(); // FIXME: How about using AudioStream::openStreamFile instead of the code below? // I.e.: //_audioSource = Audio::AudioStream::openStreamFile(fileBase, 0, 0, loop ? 0 : 1); + Audio::RewindableAudioStream *stream = 0; + #ifdef USE_FLAC - if (!_audioSource) { - sprintf(fileName, "%s.flac", fileBase); - if (_file.open(fileName)) { - _audioSource = Audio::makeLoopingAudioStream(Audio::makeFLACStream(&_file, DisposeAfterUse::NO), loop ? 0 : 1); - if (!_audioSource) + if (!stream) { + if (_file.open(filename + ".flac")) { + stream = Audio::makeFLACStream(&_file, DisposeAfterUse::NO); + if (!stream) _file.close(); } } - if (!_audioSource) { - sprintf(fileName, "%s.fla", fileBase); - if (_file.open(fileName)) { - _audioSource = Audio::makeLoopingAudioStream(Audio::makeFLACStream(&_file, DisposeAfterUse::NO), loop ? 0 : 1); - if (!_audioSource) + if (!stream) { + if (_file.open(filename + ".fla")) { + stream = Audio::makeFLACStream(&_file, DisposeAfterUse::NO); + if (!stream) _file.close(); } } #endif #ifdef USE_VORBIS - if (!_audioSource) { - sprintf(fileName, "%s.ogg", fileBase); - if (_file.open(fileName)) { - _audioSource = Audio::makeLoopingAudioStream(Audio::makeVorbisStream(&_file, DisposeAfterUse::NO), loop ? 0 : 1); - if (!_audioSource) + if (!stream) { + if (_file.open(filename + ".ogg")) { + stream = Audio::makeVorbisStream(&_file, DisposeAfterUse::NO); + if (!stream) _file.close(); } } #endif #ifdef USE_MAD - if (!_audioSource) { - sprintf(fileName, "%s.mp3", fileBase); - if (_file.open(fileName)) { - _audioSource = Audio::makeLoopingAudioStream(Audio::makeMP3Stream(&_file, DisposeAfterUse::NO), loop ? 0 : 1); - if (!_audioSource) + if (!stream) { + if (_file.open(filename + ".mp3")) { + stream = Audio::makeMP3Stream(&_file, DisposeAfterUse::NO); + if (!stream) _file.close(); } } #endif - if (!_audioSource) { - sprintf(fileName, "%s.wav", fileBase); - if (_file.open(fileName)) - _audioSource = Audio::makeLoopingAudioStream(Audio::makeWAVStream(&_file, DisposeAfterUse::NO), loop ? 0 : 1); + if (!stream) { + if (_file.open(filename + ".wav")) + stream = Audio::makeWAVStream(&_file, DisposeAfterUse::NO); } - if (!_audioSource) { - sprintf(fileName, "%s.aif", fileBase); - if (_file.open(fileName)) - _audioSource = Audio::makeLoopingAudioStream(Audio::makeAIFFStream(&_file, DisposeAfterUse::NO), loop ? 0 : 1); + if (!stream) { + if (_file.open(filename + ".aif")) + stream = Audio::makeAIFFStream(&_file, DisposeAfterUse::NO); } - if (!_audioSource) + if (!stream) return false; + _audioSource = Audio::makeLoopingAudioStream(stream, loop ? 0 : 1); + fadeUp(); return true; } @@ -219,12 +216,9 @@ int MusicHandle::readBuffer(int16 *buffer, const int numSamples) { } void MusicHandle::stop() { - if (_audioSource) { - delete _audioSource; - _audioSource = NULL; - } - if (_file.isOpen()) - _file.close(); + delete _audioSource; + _audioSource = NULL; + _file.close(); _fading = 0; } diff --git a/engines/sword1/music.h b/engines/sword1/music.h index 104bc1c536..4207019c13 100644 --- a/engines/sword1/music.h +++ b/engines/sword1/music.h @@ -43,7 +43,7 @@ private: public: MusicHandle() : _fading(0), _audioSource(NULL) {} virtual int readBuffer(int16 *buffer, const int numSamples); - bool play(const char *filename, bool loop); + bool play(const Common::String &filename, bool loop); bool playPSX(uint16 id, bool loop); void stop(); void fadeUp(); |