aboutsummaryrefslogtreecommitdiff
path: root/engines/sword1
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sword1')
-rw-r--r--engines/sword1/animation.cpp22
-rw-r--r--engines/sword1/detection.cpp14
-rw-r--r--engines/sword1/router.cpp2
-rw-r--r--engines/sword1/sword1.h2
-rw-r--r--engines/sword1/sworddefs.h4
5 files changed, 20 insertions, 24 deletions
diff --git a/engines/sword1/animation.cpp b/engines/sword1/animation.cpp
index b66cc6b5a7..7e9d1142be 100644
--- a/engines/sword1/animation.cpp
+++ b/engines/sword1/animation.cpp
@@ -85,7 +85,7 @@ MoviePlayer::~MoviePlayer() {
*/
bool MoviePlayer::load(uint32 id) {
Common::File f;
- char filename[20];
+ Common::String filename;
if (_decoderType == kVideoDecoderDXA)
_bgSoundStream = Audio::SeekableAudioStream::openStreamFile(sequenceList[id]);
@@ -93,7 +93,7 @@ bool MoviePlayer::load(uint32 id) {
_bgSoundStream = NULL;
if (SwordEngine::_systemVars.showText) {
- sprintf(filename, "%s.txt", sequenceList[id]);
+ filename = Common::String::format("%s.txt", sequenceList[id]);
if (f.open(filename)) {
Common::String line;
int lineNo = 0;
@@ -117,12 +117,12 @@ bool MoviePlayer::load(uint32 id) {
ptr++;
if (startFrame > endFrame) {
- warning("%s:%d: startFrame (%d) > endFrame (%d)", filename, lineNo, startFrame, endFrame);
+ warning("%s:%d: startFrame (%d) > endFrame (%d)", filename.c_str(), lineNo, startFrame, endFrame);
continue;
}
if (startFrame <= lastEnd) {
- warning("%s:%d startFrame (%d) <= lastEnd (%d)", filename, lineNo, startFrame, lastEnd);
+ warning("%s:%d startFrame (%d) <= lastEnd (%d)", filename.c_str(), lineNo, startFrame, lastEnd);
continue;
}
@@ -135,14 +135,14 @@ bool MoviePlayer::load(uint32 id) {
switch (_decoderType) {
case kVideoDecoderDXA:
- snprintf(filename, sizeof(filename), "%s.dxa", sequenceList[id]);
+ filename = Common::String::format("%s.dxa", sequenceList[id]);
break;
case kVideoDecoderSMK:
- snprintf(filename, sizeof(filename), "%s.smk", sequenceList[id]);
+ filename = Common::String::format("%s.smk", sequenceList[id]);
break;
}
- return _decoder->loadFile(filename);
+ return _decoder->loadFile(filename.c_str());
}
void MoviePlayer::play() {
@@ -323,18 +323,18 @@ uint32 DXADecoderWithSound::getElapsedTime() const {
///////////////////////////////////////////////////////////////////////////////
MoviePlayer *makeMoviePlayer(uint32 id, SwordEngine *vm, Text *textMan, Audio::Mixer *snd, OSystem *system) {
- char filename[20];
+ Common::String filename;
char buf[60];
Audio::SoundHandle *bgSoundHandle = new Audio::SoundHandle;
- snprintf(filename, sizeof(filename), "%s.smk", sequenceList[id]);
+ filename = Common::String::format("%s.smk", sequenceList[id]);
if (Common::File::exists(filename)) {
Video::SmackerDecoder *smkDecoder = new Video::SmackerDecoder(snd);
return new MoviePlayer(vm, textMan, snd, system, bgSoundHandle, smkDecoder, kVideoDecoderSMK);
}
- snprintf(filename, sizeof(filename), "%s.dxa", sequenceList[id]);
+ filename = Common::String::format("%s.dxa", sequenceList[id]);
if (Common::File::exists(filename)) {
#ifdef USE_ZLIB
@@ -348,7 +348,7 @@ MoviePlayer *makeMoviePlayer(uint32 id, SwordEngine *vm, Text *textMan, Audio::M
}
// Old MPEG2 cutscenes
- snprintf(filename, sizeof(filename), "%s.mp2", sequenceList[id]);
+ filename = Common::String::format("%s.mp2", sequenceList[id]);
if (Common::File::exists(filename)) {
GUI::MessageDialog dialog("MPEG2 cutscenes are no longer supported", "OK");
diff --git a/engines/sword1/detection.cpp b/engines/sword1/detection.cpp
index 9fb6cbb76e..48c3a0d14d 100644
--- a/engines/sword1/detection.cpp
+++ b/engines/sword1/detection.cpp
@@ -79,7 +79,7 @@ static const char *g_filesToCheck[NUM_FILES_TO_CHECK] = { // these files have to
class SwordMetaEngine : public MetaEngine {
public:
virtual const char *getName() const {
- return "Broken Sword";
+ return "Sword1";
}
virtual const char *getOriginalCopyright() const {
return "Broken Sword Games (C) Revolution";
@@ -249,15 +249,11 @@ SaveStateList SwordMetaEngine::listSaves(const char *target) const {
int SwordMetaEngine::getMaximumSaveSlot() const { return 999; }
void SwordMetaEngine::removeSaveState(const char *target, int slot) const {
- char fileName[12];
- snprintf(fileName, 12, "sword1.%03d", slot);
-
- g_system->getSavefileManager()->removeSavefile(fileName);
+ g_system->getSavefileManager()->removeSavefile(Common::String::format("sword1.%03d", slot));
}
SaveStateDescriptor SwordMetaEngine::querySaveMetaInfos(const char *target, int slot) const {
- char fileName[12];
- snprintf(fileName, 12, "sword1.%03d", slot);
+ Common::String fileName = Common::String::format("sword1.%03d", slot);
char name[40];
uint32 playTime = 0;
byte versionSave;
@@ -340,8 +336,8 @@ bool SwordEngine::canLoadGameStateCurrently() {
return (mouseIsActive() && !_control->isPanelShown()); // Disable GMM loading when game panel is shown
}
-Common::Error SwordEngine::saveGameState(int slot, const char *desc) {
- _control->setSaveDescription(slot, desc);
+Common::Error SwordEngine::saveGameState(int slot, const Common::String &desc) {
+ _control->setSaveDescription(slot, desc.c_str());
_control->saveGameToFile(slot);
return Common::kNoError; // TODO: return success/failure
}
diff --git a/engines/sword1/router.cpp b/engines/sword1/router.cpp
index e3b6ab3343..aaf475912d 100644
--- a/engines/sword1/router.cpp
+++ b/engines/sword1/router.cpp
@@ -261,7 +261,7 @@ int32 Router::getRoute() {
// of a line
// scan through the nodes linking each node to its nearest
- // neighbour until no more nodes change
+ // neighbor until no more nodes change
// This is the routine that finds a route using scan()
diff --git a/engines/sword1/sword1.h b/engines/sword1/sword1.h
index c83cb76461..2d6db21d19 100644
--- a/engines/sword1/sword1.h
+++ b/engines/sword1/sword1.h
@@ -110,7 +110,7 @@ protected:
Common::Error loadGameState(int slot);
bool canLoadGameStateCurrently();
- Common::Error saveGameState(int slot, const char *desc);
+ Common::Error saveGameState(int slot, const Common::String &desc);
bool canSaveGameStateCurrently();
private:
diff --git a/engines/sword1/sworddefs.h b/engines/sword1/sworddefs.h
index 460b4dd2d1..15736dcae0 100644
--- a/engines/sword1/sworddefs.h
+++ b/engines/sword1/sworddefs.h
@@ -499,7 +499,7 @@ enum ScriptVariableNames {
CASE_2_LOCKED_FLAG,
CASE_3_LOCKED_FLAG,
CASE_4_LOCKED_FLAG,
- SEEN_ARMOUR_28_FLAG,
+ SEEN_ARMOR_28_FLAG,
CLOSED_WINDOW_28_FLAG,
WINDOW_28_FLAG,
WINDOW_DRAUGHT_FLAG,
@@ -1405,7 +1405,7 @@ enum ScriptVariableNames {
SEEN_STATUE_FLAG,
SYRIA_DEAD_FLAG,
SYRIA_NICHE_FLAG,
- ARMOUR_HIDE_FLAG,
+ ARMOR_HIDE_FLAG,
CANDLE59_FLAG,
CANDLE_BURNT,
CHALICE_FLAG,