aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2011-08-13 16:44:48 +1000
committerPaul Gilbert2011-08-13 16:44:48 +1000
commitef7a17a64a9d3781108ccdf2c7338b02bf3b3aa6 (patch)
treec8dad847d70facac5b4be15bcbe5b826e716c6db
parent161a39e9fe0bfdbb1d96a6bb4c88b83d3f073ad0 (diff)
downloadscummvm-rg350-ef7a17a64a9d3781108ccdf2c7338b02bf3b3aa6.tar.gz
scummvm-rg350-ef7a17a64a9d3781108ccdf2c7338b02bf3b3aa6.tar.bz2
scummvm-rg350-ef7a17a64a9d3781108ccdf2c7338b02bf3b3aa6.zip
CGE: Fix for HLINE not being available for demo
The HorizLine class is really only used for on-screen debugging information anyway, so it's not a problem.
-rw-r--r--engines/cge/cge.cpp6
-rw-r--r--engines/cge/cge.h1
-rw-r--r--engines/cge/cge_main.cpp18
3 files changed, 17 insertions, 8 deletions
diff --git a/engines/cge/cge.cpp b/engines/cge/cge.cpp
index cfd941017e..936aeea75a 100644
--- a/engines/cge/cge.cpp
+++ b/engines/cge/cge.cpp
@@ -131,7 +131,7 @@ void CGEEngine::setup() {
_pocLight = new PocLight(this);
for (int i = 0; i < kPocketNX; i++)
_pocket[i] = NULL;
- _horzLine = new HorizLine(this);
+ _horzLine = isDemo() ? NULL : new HorizLine(this);
_infoLine = new InfoLine(this, kInfoW);
_cavLight = new CavLight(this);
_debugLine = new InfoLine(this, kScrWidth);
@@ -247,4 +247,8 @@ bool CGEEngine::canSaveGameStateCurrently() {
return (_startupMode == 0) && _mouse->_active;
}
+bool CGEEngine::isDemo() const {
+ return _gameDescription->flags & ADGF_DEMO;
+}
+
} // End of namespace CGE
diff --git a/engines/cge/cge.h b/engines/cge/cge.h
index bd347c6e26..8aff3334a0 100644
--- a/engines/cge/cge.h
+++ b/engines/cge/cge.h
@@ -104,6 +104,7 @@ public:
virtual bool hasFeature(EngineFeature f) const;
virtual bool canLoadGameStateCurrently();
virtual bool canSaveGameStateCurrently();
+ bool isDemo() const;
virtual Common::Error loadGameState(int slot);
virtual Common::Error saveGameState(int slot, const Common::String &desc);
diff --git a/engines/cge/cge_main.cpp b/engines/cge/cge_main.cpp
index 1dd6e49650..24cdaf5e92 100644
--- a/engines/cge/cge_main.cpp
+++ b/engines/cge/cge_main.cpp
@@ -651,7 +651,7 @@ void CGEEngine::caveDown() {
debugC(1, kCGEDebugEngine, "CGEEngine::caveDown()");
Sprite *spr;
- if (!_horzLine->_flags._hide)
+ if (_horzLine && !_horzLine->_flags._hide)
switchMapping();
for (spr = _vga->_showQ->first(); spr;) {
@@ -858,7 +858,7 @@ void System::touch(uint16 mask, int x, int y) {
if (cav && _snail->idle() && _hero->_tracePtr < 0)
_vm->switchCave(cav);
- if (!_horzLine->_flags._hide) {
+ if (_horzLine && !_horzLine->_flags._hide) {
if (y >= kMapTop && y < kMapTop + kMapHig) {
int8 x1, z1;
XZ(x, y).split(x1, z1);
@@ -958,9 +958,10 @@ void CGEEngine::takeName() {
}
void CGEEngine::switchMapping() {
+ assert(_horzLine);
debugC(1, kCGEDebugEngine, "CGEEngine::switchMapping()");
- if (_horzLine->_flags._hide) {
+ if (_horzLine && _horzLine->_flags._hide) {
int i;
for (i = 0; i < kMapZCnt; i++) {
int j;
@@ -1559,9 +1560,11 @@ void CGEEngine::runGame() {
_debugLine->_z = 126;
_vga->_showQ->insert(_debugLine);
- _horzLine->_y = kMapTop - (kMapTop > 0);
- _horzLine->_z = 126;
- _vga->_showQ->insert(_horzLine);
+ if (_horzLine) {
+ _horzLine->_y = kMapTop - (kMapTop > 0);
+ _horzLine->_z = 126;
+ _vga->_showQ->insert(_horzLine);
+ }
_mouse->_busy = _vga->_spareQ->locate(kBusyRef);
if (_mouse->_busy)
@@ -1739,7 +1742,8 @@ void CGEEngine::cge_main() {
_mode = 2;
_debugLine->_flags._hide = true;
- _horzLine->_flags._hide = true;
+ if (_horzLine)
+ _horzLine->_flags._hide = true;
if (_music && _soundOk)
_midiPlayer.loadMidi(0);