From b3c9b51e4638afa3fb2afd32d2a9b3e16153d0e3 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 28 Nov 2011 18:54:01 +0100 Subject: CGE: Add to the console a function to display boundaries --- engines/cge/cge.cpp | 3 ++- engines/cge/cge.h | 6 ++++-- engines/cge/console.cpp | 14 ++++++++++++++ engines/cge/console.h | 1 + engines/cge/vga13h.cpp | 15 ++++++++++++++- engines/cge/vga13h.h | 3 ++- engines/cge/walk.h | 1 - 7 files changed, 37 insertions(+), 6 deletions(-) (limited to 'engines') diff --git a/engines/cge/cge.cpp b/engines/cge/cge.cpp index 87654c53f4..34e7d3f2f9 100644 --- a/engines/cge/cge.cpp +++ b/engines/cge/cge.cpp @@ -54,6 +54,7 @@ CGEEngine::CGEEngine(OSystem *syst, const ADGameDescription *gameDescription) _pocPtr = 0; _bitmapPalette = NULL; _quitFlag = false; + _showBoundariesFl = false; } void CGEEngine::initSceneValues() { @@ -89,7 +90,7 @@ void CGEEngine::init() { _font = new Font(this, "CGE"); _text = new Text(this, "CGE"); _talk = NULL; - _vga = new Vga(); + _vga = new Vga(this); _sys = new System(this); _pocLight = new PocLight(this); for (int i = 0; i < kPocketNX; i++) diff --git a/engines/cge/cge.h b/engines/cge/cge.h index 2aada420ed..d494af0700 100644 --- a/engines/cge/cge.h +++ b/engines/cge/cge.h @@ -73,8 +73,9 @@ class Talk; #define kPathMax 128 #define kCryptSeed 0xA5 #define kMaxFile 128 -#define kMapXCnt 40 -#define kMapZCnt 20 +#define kMapXCnt 40 +#define kMapZCnt 20 +#define kMapTop 80 // our engine debug channels enum { @@ -141,6 +142,7 @@ public: static const int _maxSceneArr[5]; bool _quitFlag; + bool _showBoundariesFl; const ADGameDescription *_gameDescription; int _startupMode; diff --git a/engines/cge/console.cpp b/engines/cge/console.cpp index 71eedf34ea..105f241944 100644 --- a/engines/cge/console.cpp +++ b/engines/cge/console.cpp @@ -26,9 +26,23 @@ namespace CGE { CGEConsole::CGEConsole(CGEEngine *vm) : GUI::Debugger(), _vm(vm) { + DCmd_Register("Boundaries", WRAP_METHOD(CGEConsole, Cmd_boundaries)); } CGEConsole::~CGEConsole() { } +/** + * This command shows and hides boundaries + */ +bool CGEConsole::Cmd_boundaries(int argc, const char **argv) { + if (argc != 1) { + DebugPrintf("Usage: %s\n", argv[0]); + return true; + } + + _vm->_showBoundariesFl = !_vm->_showBoundariesFl; + return false; +} + } // End of namespace CGE diff --git a/engines/cge/console.h b/engines/cge/console.h index 25a1a4fae3..ea36dfbaae 100644 --- a/engines/cge/console.h +++ b/engines/cge/console.h @@ -36,6 +36,7 @@ public: private: CGEEngine *_vm; + bool Cmd_boundaries(int argc, const char **argv); }; } // End of namespace CGE diff --git a/engines/cge/vga13h.cpp b/engines/cge/vga13h.cpp index e271895935..fb81925a7f 100644 --- a/engines/cge/vga13h.cpp +++ b/engines/cge/vga13h.cpp @@ -625,7 +625,7 @@ Sprite *Queue::locate(int ref) { return NULL; } -Vga::Vga() : _frmCnt(0), _msg(NULL), _name(NULL), _setPal(false), _mono(0) { +Vga::Vga(CGEEngine *vm) : _frmCnt(0), _msg(NULL), _name(NULL), _setPal(false), _mono(0), _vm(vm) { _oldColors = NULL; _newColors = NULL; _showQ = new Queue(true); @@ -822,6 +822,19 @@ void Vga::update() { updateColors(); _setPal = false; } + if (_vm->_showBoundariesFl) { + Vga::_page[0]->hLine(0, 200 - kPanHeight, 320, 0xee); + if (_vm->_barriers[_vm->_now]._horz != 255) { + warning("hBar %d", _vm->_barriers[_vm->_now]._horz); + for (int i = 0; i < 8; i++) + Vga::_page[0]->vLine((_vm->_barriers[_vm->_now]._horz * 8) + i, 0, 200, 0xff); + } + if (_vm->_barriers[_vm->_now]._vert != 255) { + warning("vBar %d", _vm->_barriers[_vm->_now]._vert); + for (int i = 0; i < 4; i++) + Vga::_page[0]->hLine(0, 80 + (_vm->_barriers[_vm->_now]._vert * 4) + i, 320, 0xff); + } + } g_system->copyRectToScreen((const byte *)Vga::_page[0]->getBasePtr(0, 0), kScrWidth, 0, 0, kScrWidth, kScrHeight); g_system->updateScreen(); diff --git a/engines/cge/vga13h.h b/engines/cge/vga13h.h index 50cf5dea0d..beca19f667 100644 --- a/engines/cge/vga13h.h +++ b/engines/cge/vga13h.h @@ -177,6 +177,7 @@ public: }; class Vga { + CGEEngine *_vm; bool _setPal; Dac *_oldColors; Dac *_newColors; @@ -196,7 +197,7 @@ public: Graphics::Surface *_page[4]; Dac *_sysPal; - Vga(); + Vga(CGEEngine *vm); ~Vga(); uint8 *glass(Dac *pal, const uint8 colR, const uint8 colG, const uint8 colB); diff --git a/engines/cge/walk.h b/engines/cge/walk.h index 99dc362eec..00ec080416 100644 --- a/engines/cge/walk.h +++ b/engines/cge/walk.h @@ -35,7 +35,6 @@ namespace CGE { #define kMapArrSize (kMapZCnt * kMapXCnt) -#define kMapTop 80 #define kMapHig 80 #define kMapGridX (kScrWidth / kMapXCnt) #define kMapGridZ (kMapHig / kMapZCnt) -- cgit v1.2.3