From ef7a17a64a9d3781108ccdf2c7338b02bf3b3aa6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 13 Aug 2011 16:44:48 +1000 Subject: 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. --- engines/cge/cge.cpp | 6 +++++- engines/cge/cge.h | 1 + engines/cge/cge_main.cpp | 18 +++++++++++------- 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); -- cgit v1.2.3