aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMax Horn2008-09-01 17:47:36 +0000
committerMax Horn2008-09-01 17:47:36 +0000
commita41c681d9d722a4be3d5bdfc1db5d836b1fcbf00 (patch)
tree0bed80be673ace62dfc1c195632738bdd4d3c1e2 /engines
parent358c314381cfa8c0bcc3fe6398f02e7a2b15029c (diff)
parent852bc9dbb750b9995d31e70f4158c97d3758c46f (diff)
downloadscummvm-rg350-a41c681d9d722a4be3d5bdfc1db5d836b1fcbf00.tar.gz
scummvm-rg350-a41c681d9d722a4be3d5bdfc1db5d836b1fcbf00.tar.bz2
scummvm-rg350-a41c681d9d722a4be3d5bdfc1db5d836b1fcbf00.zip
Merging more of the GSoC 2008 RTL branch: CINE
svn-id: r34244
Diffstat (limited to 'engines')
-rw-r--r--engines/cine/anim.cpp2
-rw-r--r--engines/cine/cine.cpp4
-rw-r--r--engines/cine/detection.cpp53
-rw-r--r--engines/cine/main_loop.cpp12
-rw-r--r--engines/cine/prc.cpp5
-rw-r--r--engines/cine/various.cpp4
-rw-r--r--engines/cine/various.h2
7 files changed, 63 insertions, 19 deletions
diff --git a/engines/cine/anim.cpp b/engines/cine/anim.cpp
index e628c4512e..f5cde579e6 100644
--- a/engines/cine/anim.cpp
+++ b/engines/cine/anim.cpp
@@ -768,7 +768,7 @@ int loadResource(const char *resourceName, int16 idx) {
} else if (strstr(resourceName, ".AMI")) {
warning("loadResource: Ignoring file '%s' (Load at %d)", resourceName, idx);
} else if (strstr(resourceName, "ECHEC")) { // Echec (French) means failure
- exitEngine = 1;
+ g_cine->quitGame();
} else {
error("loadResource: Cannot determine type for '%s'", resourceName);
}
diff --git a/engines/cine/cine.cpp b/engines/cine/cine.cpp
index 9eb751835e..ea4b2512f5 100644
--- a/engines/cine/cine.cpp
+++ b/engines/cine/cine.cpp
@@ -23,7 +23,6 @@
*
*/
-#include "common/events.h"
#include "common/file.h"
#include "common/savefile.h"
#include "common/config-manager.h"
@@ -101,7 +100,8 @@ int CineEngine::go() {
delete renderer;
delete[] collisionPage;
delete g_sound;
- return 0;
+
+ return _eventMan->shouldRTL();
}
int CineEngine::getTimerDelay() const {
diff --git a/engines/cine/detection.cpp b/engines/cine/detection.cpp
index b15f30c35c..91ef964a0b 100644
--- a/engines/cine/detection.cpp
+++ b/engines/cine/detection.cpp
@@ -533,8 +533,17 @@ public:
}
virtual bool createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const;
+ virtual bool hasFeature(MetaEngineFeature f) const;
+ virtual SaveStateList listSaves(const char *target) const;
};
+bool CineMetaEngine::hasFeature(MetaEngineFeature f) const {
+ return
+ (f == kSupportsRTL) ||
+ (f == kSupportsListSaves) ||
+ (f == kSupportsDirectLoad);
+}
+
bool CineMetaEngine::createInstance(OSystem *syst, Engine **engine, const Common::ADGameDescription *desc) const {
const Cine::CINEGameDescription *gd = (const Cine::CINEGameDescription *)desc;
if (gd) {
@@ -543,6 +552,50 @@ bool CineMetaEngine::createInstance(OSystem *syst, Engine **engine, const Common
return gd != 0;
}
+SaveStateList CineMetaEngine::listSaves(const char *target) const {
+ Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
+ SaveStateList saveList;
+
+ Common::String pattern = target;
+ pattern += ".?";
+ Common::StringList filenames = saveFileMan->listSavefiles(pattern.c_str());
+ sort(filenames.begin(), filenames.end());
+ Common::StringList::const_iterator file = filenames.begin();
+
+ Common::String filename = target;
+ filename += ".dir";
+ Common::InSaveFile *in = saveFileMan->openForLoading(filename.c_str());
+ if (in) {
+ int8 ch;
+ char saveDesc[20];
+ do {
+ // Obtain the last digit of the filename, since they correspond to the save slot
+ int slotNum = atoi(file->c_str() + file->size() - 1);
+
+ uint pos = 0;
+ do {
+ ch = in->readByte();
+ if (pos < (sizeof(saveDesc) - 1)) {
+ if (ch < 32 || in->eos()) {
+ saveDesc[pos++] = '\0';
+ }
+ else if (ch >= 32) {
+ saveDesc[pos++] = ch;
+ }
+ }
+ } while (ch >= 32 && !in->eos());
+ if (saveDesc[0] != 0) {
+ saveList.push_back(SaveStateDescriptor(slotNum, Common::String(saveDesc), *file));
+ file++;
+ }
+ } while (!in->eos());
+ }
+
+ delete in;
+
+ return saveList;
+}
+
#if PLUGIN_ENABLED_DYNAMIC(CINE)
REGISTER_PLUGIN_DYNAMIC(CINE, PLUGIN_TYPE_ENGINE, CineMetaEngine);
#else
diff --git a/engines/cine/main_loop.cpp b/engines/cine/main_loop.cpp
index e2402a4c8d..04c6f5c769 100644
--- a/engines/cine/main_loop.cpp
+++ b/engines/cine/main_loop.cpp
@@ -25,7 +25,6 @@
#include "common/scummsys.h"
-#include "common/events.h"
#include "common/system.h"
#include "cine/main_loop.h"
@@ -61,9 +60,6 @@ static void processEvent(Common::Event &event) {
break;
case Common::EVENT_MOUSEMOVE:
break;
- case Common::EVENT_QUIT:
- exitEngine = 1;
- break;
case Common::EVENT_KEYDOWN:
switch (event.kbd.keycode) {
case Common::KEYCODE_RETURN:
@@ -258,13 +254,9 @@ void purgeSeqList() {
void CineEngine::mainLoop(int bootScriptIdx) {
bool playerAction;
- uint16 quitFlag;
byte di;
uint16 mouseButton;
- quitFlag = 0;
- exitEngine = 0;
-
if (_preLoad == false) {
resetBgIncrustList();
@@ -418,7 +410,7 @@ void CineEngine::mainLoop(int bootScriptIdx) {
if ("quit"[menuCommandLen] == (char)di) {
++menuCommandLen;
if (menuCommandLen == 4) {
- quitFlag = 1;
+ quitGame();
}
} else {
menuCommandLen = 0;
@@ -427,7 +419,7 @@ void CineEngine::mainLoop(int bootScriptIdx) {
manageEvents();
- } while (!exitEngine && !quitFlag && _danKeysPressed != 7);
+ } while (!quit() && _danKeysPressed != 7);
hideMouse();
g_sound->stopMusic();
diff --git a/engines/cine/prc.cpp b/engines/cine/prc.cpp
index 5d789f9b3b..797a354c4f 100644
--- a/engines/cine/prc.cpp
+++ b/engines/cine/prc.cpp
@@ -25,6 +25,7 @@
#include "common/endian.h"
+#include "common/events.h"
#include "cine/cine.h"
#include "cine/various.h"
@@ -54,7 +55,9 @@ bool loadPrc(const char *pPrcName) {
// This is copy protection. Used to hang the machine
if (!scumm_stricmp(pPrcName, COPY_PROT_FAIL_PRC_NAME)) {
- exitEngine = 1;
+ Common::Event event;
+ event.type = Common::EVENT_RTL;
+ g_system->getEventManager()->pushEvent(event);
return false;
}
diff --git a/engines/cine/various.cpp b/engines/cine/various.cpp
index 355ebc0cec..2621278c59 100644
--- a/engines/cine/various.cpp
+++ b/engines/cine/various.cpp
@@ -25,7 +25,6 @@
#include "common/endian.h"
-#include "common/events.h"
#include "common/savefile.h"
#include "cine/cine.h"
@@ -125,7 +124,6 @@ static const int16 canUseOnItemTable[] = { 1, 0, 0, 1, 1, 0, 0 };
CommandeType objectListCommand[20];
int16 objListTab[20];
-uint16 exitEngine;
Common::Array<uint16> zoneData;
Common::Array<uint16> zoneQuery; //!< Only exists in Operation Stealth
@@ -1223,7 +1221,7 @@ void CineEngine::makeSystemMenu(void) {
{
getMouseData(mouseUpdateStatus, (uint16 *)&mouseButton, (uint16 *)&mouseX, (uint16 *)&mouseY);
if (!makeMenuChoice(confirmMenu, 2, mouseX, mouseY + 8, 100)) {
- exitEngine = 1;
+ quitGame();
}
break;
}
diff --git a/engines/cine/various.h b/engines/cine/various.h
index 0ee77c1b47..b841908c65 100644
--- a/engines/cine/various.h
+++ b/engines/cine/various.h
@@ -120,8 +120,6 @@ void mainLoopSub6(void);
void checkForPendingDataLoad(void);
-extern uint16 exitEngine;
-
void hideMouse(void);
void removeExtention(char *dest, const char *source);