Skip to content

Commit

Permalink
CGE: Add to the console a function to display boundaries
Browse files Browse the repository at this point in the history
  • Loading branch information
Strangerke committed Nov 28, 2011
1 parent 64c0b0f commit b3c9b51
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 6 deletions.
3 changes: 2 additions & 1 deletion engines/cge/cge.cpp
Expand Up @@ -54,6 +54,7 @@ CGEEngine::CGEEngine(OSystem *syst, const ADGameDescription *gameDescription)
_pocPtr = 0;
_bitmapPalette = NULL;
_quitFlag = false;
_showBoundariesFl = false;
}

void CGEEngine::initSceneValues() {
Expand Down Expand Up @@ -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++)
Expand Down
6 changes: 4 additions & 2 deletions engines/cge/cge.h
Expand Up @@ -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 {
Expand Down Expand Up @@ -141,6 +142,7 @@ class CGEEngine : public Engine {

static const int _maxSceneArr[5];
bool _quitFlag;
bool _showBoundariesFl;

const ADGameDescription *_gameDescription;
int _startupMode;
Expand Down
14 changes: 14 additions & 0 deletions engines/cge/console.cpp
Expand Up @@ -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
1 change: 1 addition & 0 deletions engines/cge/console.h
Expand Up @@ -36,6 +36,7 @@ class CGEConsole : public GUI::Debugger {

private:
CGEEngine *_vm;
bool Cmd_boundaries(int argc, const char **argv);
};

} // End of namespace CGE
Expand Down
15 changes: 14 additions & 1 deletion engines/cge/vga13h.cpp
Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand Down
3 changes: 2 additions & 1 deletion engines/cge/vga13h.h
Expand Up @@ -177,6 +177,7 @@ class Queue {
};

class Vga {
CGEEngine *_vm;
bool _setPal;
Dac *_oldColors;
Dac *_newColors;
Expand All @@ -196,7 +197,7 @@ class Vga {
Graphics::Surface *_page[4];
Dac *_sysPal;

Vga();
Vga(CGEEngine *vm);
~Vga();

uint8 *glass(Dac *pal, const uint8 colR, const uint8 colG, const uint8 colB);
Expand Down
1 change: 0 additions & 1 deletion engines/cge/walk.h
Expand Up @@ -35,7 +35,6 @@
namespace CGE {

#define kMapArrSize (kMapZCnt * kMapXCnt)
#define kMapTop 80
#define kMapHig 80
#define kMapGridX (kScrWidth / kMapXCnt)
#define kMapGridZ (kMapHig / kMapZCnt)
Expand Down

0 comments on commit b3c9b51

Please sign in to comment.