aboutsummaryrefslogtreecommitdiff
path: root/engines/cge
diff options
context:
space:
mode:
Diffstat (limited to 'engines/cge')
-rw-r--r--engines/cge/cge.cpp2
-rw-r--r--engines/cge/cge.h3
-rw-r--r--engines/cge/cge_main.cpp22
-rw-r--r--engines/cge/cge_main.h5
-rw-r--r--engines/cge/general.cpp13
-rw-r--r--engines/cge/general.h13
-rw-r--r--engines/cge/snail.cpp16
-rw-r--r--engines/cge/talk.cpp2
8 files changed, 37 insertions, 39 deletions
diff --git a/engines/cge/cge.cpp b/engines/cge/cge.cpp
index 7a181a58be..944413471b 100644
--- a/engines/cge/cge.cpp
+++ b/engines/cge/cge.cpp
@@ -90,7 +90,7 @@ void CGEEngine::init() {
Cluster::init(this);
// Initialise engine objects
- _text = new Text(this, progName(), 128);
+ _text = new Text(this, "CGE", 128);
_vga = new Vga();
_sys = new System(this);
_pocLight = new PocLight(this);
diff --git a/engines/cge/cge.h b/engines/cge/cge.h
index 66811a9a10..5a4c0bf86d 100644
--- a/engines/cge/cge.h
+++ b/engines/cge/cge.h
@@ -212,7 +212,8 @@ public:
void initCaveValues();
void snBackPt(Sprite *spr, int stp);
- void snBarrier(int cav, int bar, bool horz);
+ void snHBarrier(const int cave, const int barX);
+ void snVBarrier(const int cave, const int barY);
void snCover(Sprite *spr, int xref);
void snFlag(int indx, bool v);
void snFlash(bool on);
diff --git a/engines/cge/cge_main.cpp b/engines/cge/cge_main.cpp
index c4719fe287..e3f0e610bd 100644
--- a/engines/cge/cge_main.cpp
+++ b/engines/cge/cge_main.cpp
@@ -474,7 +474,7 @@ void CGEEngine::tooFar() {
void CGEEngine::loadHeroXY() {
debugC(1, kCGEDebugEngine, "CGEEngine::loadHeroXY()");
- VFile cf(progName(".HXY"));
+ VFile cf("CGE.HXY");
uint16 x, y;
memset(_heroXY, 0, sizeof(_heroXY));
@@ -493,7 +493,7 @@ void CGEEngine::loadMapping() {
debugC(1, kCGEDebugEngine, "CGEEngine::loadMapping()");
if (_now <= kCaveMax) {
- VFile cf(progName(".TAB"));
+ VFile cf("CGE.TAB");
if (!cf._error) {
// Move to the data for the given room
cf.seek((_now - 1) * kMapArrSize);
@@ -1295,7 +1295,7 @@ void CGEEngine::loadUser() {
} else {
error("Creating setup savegames not supported");
}
- loadScript(progName(kIn0Ext));
+ loadScript("CGE.IN0");
}
void CGEEngine::runGame() {
@@ -1422,10 +1422,14 @@ void CGEEngine::runGame() {
}
void CGEEngine::movie(const char *ext) {
+ assert(ext);
+
if (_eventManager->_quitFlag)
return;
- const char *fn = progName(ext);
+ char fn[12];
+ sprintf(fn, "CGE.%s", (*ext == '.') ? ext +1 : ext);
+
if (VFile::exist(fn)) {
loadScript(fn);
expandSprite(_vga->_spareQ->locate(999));
@@ -1492,7 +1496,7 @@ bool CGEEngine::showTitle(const char *name) {
if (_mode < 2) {
// At this point the game originally set the protection variables
// used by the copy protection check
- movie("X00"); // paylist
+ movie(kPaylistExt); // paylist
_vga->copyPage(1, 2);
_vga->copyPage(0, 1);
_vga->_showQ->append(_mouse);
@@ -1520,7 +1524,7 @@ bool CGEEngine::showTitle(const char *name) {
}
if (_mode < 2)
- movie("X01"); // wink
+ movie(kWinkExt);
_vga->copyPage(0, 2);
@@ -1550,18 +1554,18 @@ void CGEEngine::cge_main() {
_startupMode = 2;
if (_flag[3]) // Flag FINIS
- movie("X03");
+ movie(kEndgExt);
} else {
if (_mode < 2)
movie(kLgoExt);
if (showTitle("WELCOME")) {
if (_mode == 1)
- movie("X02"); // intro
+ movie(kIntroExt);
runGame();
_startupMode = 2;
if (_flag[3]) // Flag FINIS
- movie("X03");
+ movie(kEndgExt);
} else
_vga->sunset();
}
diff --git a/engines/cge/cge_main.h b/engines/cge/cge_main.h
index d91fabc875..d6f1a996d1 100644
--- a/engines/cge/cge_main.h
+++ b/engines/cge/cge_main.h
@@ -47,9 +47,12 @@ namespace CGE {
#define kMiniY 162
#define kLineMax 512
#define kDistMax 3
-#define kIn0Ext ".IN0"
#define kLgoExt ".LGO"
#define kSvgExt ".SVG"
+#define kPaylistExt ".X00"
+#define kWinkExt ".X01"
+#define kIntroExt ".X02"
+#define kEndgExt ".X03"
#define kWalkSide 10
#define kBusyRef 500
#define kSystemRate 6 // 12 Hz
diff --git a/engines/cge/general.cpp b/engines/cge/general.cpp
index 13a92d38c2..5c113bd1e1 100644
--- a/engines/cge/general.cpp
+++ b/engines/cge/general.cpp
@@ -31,19 +31,6 @@
namespace CGE {
-const char *progName(const char *ext) {
- static char buf[kMaxFile];
- strcpy(buf, "CGE");
- if (ext) {
- strcat(buf, ".");
- if (*ext == '.')
- ext++;
- strcat(buf, ext);
- }
-
- return buf;
-}
-
char *mergeExt(char *buf, const char *name, const char *ext) {
strcpy(buf, name);
char *dot = strrchr(buf, '.');
diff --git a/engines/cge/general.h b/engines/cge/general.h
index b9e8e27be4..8c0432b763 100644
--- a/engines/cge/general.h
+++ b/engines/cge/general.h
@@ -47,14 +47,11 @@ struct Dac {
typedef uint16 Crypt(void *buf, uint16 siz, uint16 seed);
-int takeEnum(const char **tab, const char *text);
-uint16 chkSum(void *m, uint16 n);
-char *mergeExt(char *buf, const char *name, const char *ext);
-char *forceExt(char *buf, const char *name, const char *ext);
-
-// MISSING FUNCTIONS
-const char *progName(const char *ext = NULL);
-int newRandom(int range);
+int takeEnum(const char **tab, const char *text);
+uint16 chkSum(void *m, uint16 n);
+char *mergeExt(char *buf, const char *name, const char *ext);
+char *forceExt(char *buf, const char *name, const char *ext);
+int newRandom(int range);
} // End of namespace CGE
#endif
diff --git a/engines/cge/snail.cpp b/engines/cge/snail.cpp
index 0e0606706b..3605ad94bd 100644
--- a/engines/cge/snail.cpp
+++ b/engines/cge/snail.cpp
@@ -897,10 +897,16 @@ void CGEEngine::snLight(bool in) {
_dark = !in;
}
-void CGEEngine::snBarrier(int cav, int bar, bool horz) {
- debugC(1, kCGEDebugEngine, "CGEEngine::snBarrier(%d, %d, %s)", cav, bar, horz ? "true" : "false");
+void CGEEngine::snHBarrier(const int cave, const int barX) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::snHBarrier(%d, %d)", cave, barX);
- ((uint8 *)(_barriers + ((cav > 0) ? cav : _now)))[horz] = bar;
+ _barriers[(cave > 0) ? cave : _now]._horz = barX;
+}
+
+void CGEEngine::snVBarrier(const int cave, const int barY) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::snVBarrier(%d, %d)", cave, barY);
+
+ _barriers[(cave > 0) ? cave : _now]._vert = barY;
}
void CGEEngine::snWalk(Sprite *spr, int x, int y) {
@@ -1113,10 +1119,10 @@ void Snail::runCom() {
_vm->snLight(snc->_val != 0);
break;
case kSnSetHBarrier:
- _vm->snBarrier(snc->_ref, snc->_val, true);
+ _vm->snHBarrier(snc->_ref, snc->_val);
break;
case kSnSetVBarrier:
- _vm->snBarrier(snc->_ref, snc->_val, false);
+ _vm->snVBarrier(snc->_ref, snc->_val);
break;
case kSnWalk:
_vm->snWalk(spr, snc->_ref, snc->_val);
diff --git a/engines/cge/talk.cpp b/engines/cge/talk.cpp
index 9a4cd7caf5..2d9c17c73d 100644
--- a/engines/cge/talk.cpp
+++ b/engines/cge/talk.cpp
@@ -93,7 +93,7 @@ Talk::Talk(CGEEngine *vm)
Font *Talk::_font;
void Talk::init() {
- _font = new Font(progName());
+ _font = new Font("CGE");
}
void Talk::deinit() {