aboutsummaryrefslogtreecommitdiff
path: root/engines/sword2
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sword2')
-rw-r--r--engines/sword2/animation.cpp4
-rw-r--r--engines/sword2/controls.cpp8
-rw-r--r--engines/sword2/function.cpp2
-rw-r--r--engines/sword2/palette.cpp2
-rw-r--r--engines/sword2/resman.cpp2
-rw-r--r--engines/sword2/screen.cpp8
-rw-r--r--engines/sword2/sword2.cpp54
-rw-r--r--engines/sword2/sword2.h3
8 files changed, 27 insertions, 56 deletions
diff --git a/engines/sword2/animation.cpp b/engines/sword2/animation.cpp
index 76f14851e7..48196a2f7d 100644
--- a/engines/sword2/animation.cpp
+++ b/engines/sword2/animation.cpp
@@ -357,8 +357,8 @@ bool MoviePlayer::userInterrupt() {
case Common::EVENT_SCREEN_CHANGED:
handleScreenChanged();
break;
- case Common::EVENT_RTL:
case Common::EVENT_QUIT:
+ _vm->closeGame();
terminate = true;
break;
case Common::EVENT_KEYDOWN:
@@ -379,7 +379,7 @@ void MoviePlayer::play(SequenceTextInfo *textList, uint32 numLines, int32 leadIn
bool startNextText = false;
// This happens if the user quits during the "eye" cutscene.
- if (_vm->quit())
+ if (_vm->_quit)
return;
_numSpeechLines = numLines;
diff --git a/engines/sword2/controls.cpp b/engines/sword2/controls.cpp
index dcacbc78d4..6b466d6be0 100644
--- a/engines/sword2/controls.cpp
+++ b/engines/sword2/controls.cpp
@@ -396,7 +396,7 @@ int Dialog::runModal() {
_vm->_system->delayMillis(20);
- if (_vm->quit())
+ if (_vm->_quit)
setResult(0);
}
@@ -842,7 +842,7 @@ int StartDialog::runModal() {
if (startDialog.runModal())
return 1;
- if (_vm->quit())
+ if (_vm->_quit)
return 0;
RestoreDialog restoreDialog(_vm);
@@ -850,7 +850,7 @@ int StartDialog::runModal() {
if (restoreDialog.runModal())
return 0;
- if (_vm->quit())
+ if (_vm->_quit)
return 0;
}
@@ -882,7 +882,7 @@ int QuitDialog::runModal() {
int result = MiniDialog::runModal();
if (result)
- _vm->quitGame();
+ _vm->closeGame();
return result;
}
diff --git a/engines/sword2/function.cpp b/engines/sword2/function.cpp
index 31b799386f..84a5b5af76 100644
--- a/engines/sword2/function.cpp
+++ b/engines/sword2/function.cpp
@@ -2388,7 +2388,7 @@ int32 Logic::fnPlayCredits(int32 *params) {
// params: none
if (readVar(DEMO)) {
- _vm->quitGame();
+ _vm->closeGame();
return IR_STOP;
}
diff --git a/engines/sword2/palette.cpp b/engines/sword2/palette.cpp
index b66a3c9a81..81f93c77ae 100644
--- a/engines/sword2/palette.cpp
+++ b/engines/sword2/palette.cpp
@@ -212,7 +212,7 @@ uint8 Screen::getFadeStatus() {
}
void Screen::waitForFade() {
- while (getFadeStatus() != RDFADE_NONE && getFadeStatus() != RDFADE_BLACK && !_vm->quit()) {
+ while (getFadeStatus() != RDFADE_NONE && getFadeStatus() != RDFADE_BLACK && !_vm->_quit) {
updateDisplay();
_vm->_system->delayMillis(20);
}
diff --git a/engines/sword2/resman.cpp b/engines/sword2/resman.cpp
index 880234aab0..8cddddff78 100644
--- a/engines/sword2/resman.cpp
+++ b/engines/sword2/resman.cpp
@@ -412,7 +412,7 @@ Common::File *ResourceManager::openCluFile(uint16 fileNum) {
// quit while the game is asking for the user to insert a CD.
// But recovering from this situation gracefully is just too
// much trouble, so quit now.
- if (_vm->quit())
+ if (_vm->_quit)
g_system->quit();
// If the file is supposed to be on hard disk, or we're
diff --git a/engines/sword2/screen.cpp b/engines/sword2/screen.cpp
index b2fcc45c9c..fdabb3ee6f 100644
--- a/engines/sword2/screen.cpp
+++ b/engines/sword2/screen.cpp
@@ -389,7 +389,7 @@ void Screen::displayMsg(byte *text, int time) {
uint32 targetTime = _vm->getMillis() + (time * 1000);
_vm->sleepUntil(targetTime);
} else {
- while (!_vm->quit()) {
+ while (!_vm->_quit) {
MouseEvent *me = _vm->mouseEvent();
if (me && (me->buttons & (RD_LEFTBUTTONDOWN | RD_RIGHTBUTTONDOWN)))
break;
@@ -1035,7 +1035,7 @@ void Screen::rollCredits() {
uint32 musicLength = MAX((int32)(1000 * (_vm->_sound->musicTimeRemaining() - 3)), 25 * (int32)scrollSteps);
- while (scrollPos < scrollSteps && !_vm->quit()) {
+ while (scrollPos < scrollSteps && !_vm->_quit) {
clearScene();
for (i = startLine; i < lineCount; i++) {
@@ -1123,13 +1123,13 @@ void Screen::rollCredits() {
// The music should either have stopped or be about to stop, so
// wait for it to really happen.
- while (_vm->_sound->musicTimeRemaining() && !_vm->quit()) {
+ while (_vm->_sound->musicTimeRemaining() && !_vm->_quit) {
updateDisplay(false);
_vm->_system->delayMillis(100);
}
}
- if (_vm->quit())
+ if (_vm->_quit)
return;
waitForFade();
diff --git a/engines/sword2/sword2.cpp b/engines/sword2/sword2.cpp
index 4f942c0d25..7331d1f761 100644
--- a/engines/sword2/sword2.cpp
+++ b/engines/sword2/sword2.cpp
@@ -33,7 +33,6 @@
#include "common/file.h"
#include "common/fs.h"
#include "common/events.h"
-#include "common/savefile.h"
#include "common/system.h"
#include "engines/metaengine.h"
@@ -80,23 +79,13 @@ public:
return "Broken Sword Games (C) Revolution";
}
- virtual bool hasFeature(MetaEngineFeature f) const;
virtual GameList getSupportedGames() const;
virtual GameDescriptor findGame(const char *gameid) const;
virtual GameList detectGames(const FSList &fslist) const;
- virtual SaveStateList listSaves(const char *target) const;
virtual PluginError createInstance(OSystem *syst, Engine **engine) const;
};
-bool Sword2MetaEngine::hasFeature(MetaEngineFeature f) const {
- return
- (f == kSupportsRTL) ||
- (f == kSupportsListSaves) ||
- (f == kSupportsDirectLoad) ||
- (f == kSupportsDeleteSave);
-}
-
GameList Sword2MetaEngine::getSupportedGames() const {
const Sword2::GameSettings *g = Sword2::sword2_settings;
GameList games;
@@ -167,35 +156,6 @@ GameList Sword2MetaEngine::detectGames(const FSList &fslist) const {
return detectedGames;
}
-SaveStateList Sword2MetaEngine::listSaves(const char *target) const {
- Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
- Common::StringList filenames;
- char saveDesc[SAVE_DESCRIPTION_LEN];
- Common::String pattern = target;
- pattern += ".???";
-
- filenames = saveFileMan->listSavefiles(pattern.c_str());
- sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)
-
- SaveStateList saveList;
- for (Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
- // Obtain the last 3 digits of the filename, since they correspond to the save slot
- int slotNum = atoi(file->c_str() + file->size() - 3);
-
- if (slotNum >= 0 && slotNum <= 999) {
- Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str());
- if (in) {
- in->readUint32LE();
- in->read(saveDesc, SAVE_DESCRIPTION_LEN);
- saveList.push_back(SaveStateDescriptor(slotNum, Common::String(saveDesc), *file));
- delete in;
- }
- }
- }
-
- return saveList;
-}
-
PluginError Sword2MetaEngine::createInstance(OSystem *syst, Engine **engine) const {
assert(syst);
assert(engine);
@@ -269,6 +229,7 @@ Sword2Engine::Sword2Engine(OSystem *syst) : Engine(syst) {
_gameCycle = 0;
_gameSpeed = 1;
+ _quit = false;
syst->getEventManager()->registerRandomSource(_rnd, "sword2");
}
@@ -410,7 +371,7 @@ int Sword2Engine::init() {
// player will kill the music for us. Otherwise, the restore
// will either have killed the music, or done a crossfade.
- if (quit())
+ if (_quit)
return 0;
if (result)
@@ -482,7 +443,7 @@ int Sword2Engine::go() {
// because we want the break to happen before updating the
// screen again.
- if (quit())
+ if (_quit)
break;
// creates the debug text blocks
@@ -499,7 +460,11 @@ int Sword2Engine::go() {
#endif
}
- return _eventMan->shouldRTL();
+ return 0;
+}
+
+void Sword2Engine::closeGame() {
+ _quit = true;
}
void Sword2Engine::restartGame() {
@@ -645,6 +610,9 @@ void Sword2Engine::parseInputEvents() {
_mouseEvent.buttons = RD_WHEELDOWN;
}
break;
+ case Common::EVENT_QUIT:
+ closeGame();
+ break;
default:
break;
}
diff --git a/engines/sword2/sword2.h b/engines/sword2/sword2.h
index 9b589c347e..05c5d7fa47 100644
--- a/engines/sword2/sword2.h
+++ b/engines/sword2/sword2.h
@@ -141,6 +141,8 @@ public:
bool getSubtitles() { return _useSubtitles; }
void setSubtitles(bool b) { _useSubtitles = b; }
+ bool _quit;
+
uint32 _features;
MemoryManager *_memory;
@@ -208,6 +210,7 @@ public:
void startGame();
void gameCycle();
+ void closeGame();
void restartGame();
void sleepUntil(uint32 time);