aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authoruruk2014-05-06 21:02:58 +0200
committeruruk2014-05-06 21:02:58 +0200
commit0cbed1f53bc5caf936b21fc65080479f4be22c32 (patch)
tree700111a8f03df83783ae7d0b096fdd29aebede8f /engines
parenta0c5805c8efba2e184b737dc7869092318743004 (diff)
downloadscummvm-rg350-0cbed1f53bc5caf936b21fc65080479f4be22c32.tar.gz
scummvm-rg350-0cbed1f53bc5caf936b21fc65080479f4be22c32.tar.bz2
scummvm-rg350-0cbed1f53bc5caf936b21fc65080479f4be22c32.zip
CGE2: Start implementation of movie() and connected functions.
Diffstat (limited to 'engines')
-rw-r--r--engines/cge2/cge2.cpp1
-rw-r--r--engines/cge2/cge2.h3
-rw-r--r--engines/cge2/cge2_main.cpp97
3 files changed, 100 insertions, 1 deletions
diff --git a/engines/cge2/cge2.cpp b/engines/cge2/cge2.cpp
index bc2ce5615d..853f84f25d 100644
--- a/engines/cge2/cge2.cpp
+++ b/engines/cge2/cge2.cpp
@@ -50,6 +50,7 @@ CGE2Engine::CGE2Engine(OSystem *syst, const ADGameDescription *gameDescription)
_mode = 0;
_music = true;
_startupMode = 1;
+ _now = 1;
}
void CGE2Engine::init() {
diff --git a/engines/cge2/cge2.h b/engines/cge2/cge2.h
index 2c06832edd..01c38fa881 100644
--- a/engines/cge2/cge2.h
+++ b/engines/cge2/cge2.h
@@ -64,6 +64,8 @@ public:
void inf(const char *text, bool wideSpace = false);
void movie(const char *ext);
void runGame();
+ void loadScript(const char *fname);
+ void loadSprite(const char *fname, int ref, int scene, int col, int row, int pos);
const ADGameDescription *_gameDescription;
@@ -72,6 +74,7 @@ public:
int _mode;
bool _music;
int _startupMode;
+ int _now;
ResourceManager *_resman;
Vga *_vga;
diff --git a/engines/cge2/cge2_main.cpp b/engines/cge2/cge2_main.cpp
index d3feb0a49f..34946c7c4b 100644
--- a/engines/cge2/cge2_main.cpp
+++ b/engines/cge2/cge2_main.cpp
@@ -33,8 +33,103 @@
namespace CGE2 {
+void CGE2Engine::loadSprite(const char *fname, int ref, int scene, int col = 0, int row = 0, int pos = 0) {
+ warning("STUB: CGE2Engine::loadSprite");
+}
+
+void CGE2Engine::loadScript(const char *fname) {
+ EncryptedStream scrf(this, fname);
+
+ if (scrf.err())
+ return;
+
+ bool ok = true;
+ int lcnt = 0;
+
+ char tmpStr[kLineMax + 1];
+ Common::String line;
+
+ int lineNum = 0;
+ for (line = scrf.readLine(); !scrf.eos(); line = scrf.readLine()) {
+ lineNum++;
+
+ char *p;
+
+ lcnt++;
+ Common::strlcpy(tmpStr, line.c_str(), sizeof(tmpStr));
+ if ((line.size() == 0) || (*tmpStr == ';')) // Comments start with ';' - don't bother with them.
+ continue;
+
+ ok = false; // not OK if break
+
+ // sprite ident number
+ if ((p = strtok(tmpStr, " \t\n")) == NULL)
+ break;
+ int SpI = scrf.number(p);
+
+ // sprite file name
+ char *SpN;
+ if ((SpN = strtok(NULL, " ,;/\t\n")) == NULL)
+ break;
+
+ // sprite scene
+ if ((p = strtok(NULL, " ,;/\t\n")) == NULL)
+ break;
+ int SpA = scrf.number(p);
+
+ // sprite column
+ if ((p = strtok(NULL, " ,;/\t\n")) == NULL)
+ break;
+ int SpX = scrf.number(p);
+
+ // sprite row
+ if ((p = strtok(NULL, " ,;/\t\n")) == NULL)
+ break;
+ int SpY = scrf.number(p);
+
+ // sprite Z pos
+ if ((p = strtok(NULL, " ,;/\t\n")) == NULL)
+ break;
+ int SpZ = scrf.number(p);
+
+ // sprite life
+ if ((p = strtok(NULL, " ,;/\t\n")) == NULL)
+ break;
+ bool BkG = scrf.number(p) == 0;
+
+ ok = true; // no break: OK
+
+ _sprite = NULL;
+ loadSprite(SpN, SpI, SpA, SpX, SpY, SpZ);
+ if (_sprite) {
+ warning("STUB: CGE2Engine::loadScript - SPARE:: thing");
+ if (BkG)
+ _sprite->_flags._back = true;
+ }
+ }
+
+ if (!ok)
+ error("Bad INI line %d [%s]", lineNum, fname); // Counting starts from 0!
+}
+
void CGE2Engine::movie(const char *ext) {
- warning("STUB: CGE2Engine::movie()");
+ assert(ext);
+
+ if (_quitFlag)
+ return;
+
+ char fn[12];
+ sprintf(fn, "CGE.%s", (*ext == '.') ? ext + 1 : ext);
+
+ if (_resman->exist(fn)) {
+ int now = _now;
+ _now = atoi(ext + 1);
+ loadScript(fn);
+
+ warning("STUB: CGE2Engine::movie()");
+
+ _now = now;
+ }
}
void CGE2Engine::runGame() {