From 4df049f4d7fccb794db45c932e5188296907dbc8 Mon Sep 17 00:00:00 2001 From: md5 Date: Sun, 20 Mar 2011 14:56:13 +0200 Subject: SCI: Added a new console command "window_list" or "wl" This can be used to see a list of the currently open windows. Also, added a sanity check for the "al" command and performed some minor cleanup --- engines/sci/console.cpp | 21 ++++++++++++++++----- engines/sci/console.h | 1 + engines/sci/graphics/ports.cpp | 13 +++++++++++++ engines/sci/graphics/ports.h | 2 +- 4 files changed, 31 insertions(+), 6 deletions(-) (limited to 'engines/sci') diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index 1174bf8528..93d21c32e0 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -48,6 +48,7 @@ #include "sci/graphics/paint16.h" #include "sci/graphics/paint32.h" #include "sci/graphics/palette.h" +#include "sci/graphics/ports.h" #include "sci/graphics/view.h" #include "sci/parser/vocabulary.h" @@ -128,6 +129,8 @@ Console::Console(SciEngine *engine) : GUI::Debugger(), DCmd_Register("play_video", WRAP_METHOD(Console, cmdPlayVideo)); DCmd_Register("animate_list", WRAP_METHOD(Console, cmdAnimateList)); DCmd_Register("al", WRAP_METHOD(Console, cmdAnimateList)); // alias + DCmd_Register("window_list", WRAP_METHOD(Console, cmdWindowList)); + DCmd_Register("wl", WRAP_METHOD(Console, cmdWindowList)); // alias // Segments DCmd_Register("segment_table", WRAP_METHOD(Console, cmdPrintSegmentTable)); DCmd_Register("segtable", WRAP_METHOD(Console, cmdPrintSegmentTable)); // alias @@ -1582,11 +1585,21 @@ bool Console::cmdPlayVideo(int argc, const char **argv) { } bool Console::cmdAnimateList(int argc, const char **argv) { - DebugPrintf("Animate list:\n"); - _engine->_gfxAnimate->printAnimateList(this); + if (_engine->_gfxAnimate) { + DebugPrintf("Animate list:\n"); + _engine->_gfxAnimate->printAnimateList(this); + } return true; } +bool Console::cmdWindowList(int argc, const char **argv) { + if (_engine->_gfxPorts) { + DebugPrintf("Window list:\n"); + _engine->_gfxPorts->printWindowList(this); + } + return true; + +} bool Console::cmdParseGrammar(int argc, const char **argv) { DebugPrintf("Parse grammar, in strict GNF:\n"); @@ -1721,9 +1734,7 @@ bool Console::segmentInfo(int nr) { for (uint i = 0; i < ct->_table.size(); i++) if (ct->isValidEntry(i)) { - reg_t objpos; - objpos.offset = i; - objpos.segment = nr; + reg_t objpos = make_reg(nr, i); DebugPrintf(" [%04x] %s; copy of ", i, _engine->_gamestate->_segMan->getObjectName(objpos)); // Object header const Object *obj = _engine->_gamestate->_segMan->getObject(ct->_table[i].getPos()); diff --git a/engines/sci/console.h b/engines/sci/console.h index 9247339eaf..93ccc45503 100644 --- a/engines/sci/console.h +++ b/engines/sci/console.h @@ -96,6 +96,7 @@ private: bool cmdPicVisualize(int argc, const char **argv); bool cmdPlayVideo(int argc, const char **argv); bool cmdAnimateList(int argc, const char **argv); + bool cmdWindowList(int argc, const char **argv); // Segments bool cmdPrintSegmentTable(int argc, const char **argv); bool cmdSegmentInfo(int argc, const char **argv); diff --git a/engines/sci/graphics/ports.cpp b/engines/sci/graphics/ports.cpp index 9ac8d103fc..aca278fe4a 100644 --- a/engines/sci/graphics/ports.cpp +++ b/engines/sci/graphics/ports.cpp @@ -25,6 +25,7 @@ #include "common/util.h" +#include "sci/console.h" #include "sci/sci.h" #include "sci/engine/features.h" #include "sci/engine/kernel.h" @@ -707,4 +708,16 @@ int16 GfxPorts::kernelPriorityToCoordinate(byte priority) { return _priorityBottom; } +void GfxPorts::printWindowList(Console *con) { + for (PortList::const_iterator it = _windowList.begin(); it != _windowList.end(); ++it) { + if ((*it)->isWindow()) { + Window *wnd = ((Window *)*it); + con->DebugPrintf("%d: '%s' at %d, %d, (%d, %d, %d, %d), drawn: %d, style: %d\n", + wnd->id, wnd->title.c_str(), wnd->left, wnd->top, + wnd->rect.left, wnd->rect.top, wnd->rect.right, wnd->rect.bottom, + wnd->bDrawn, wnd->wndStyle); + } + } +} + } // End of namespace Sci diff --git a/engines/sci/graphics/ports.h b/engines/sci/graphics/ports.h index 9faee2be8d..d14272791f 100644 --- a/engines/sci/graphics/ports.h +++ b/engines/sci/graphics/ports.h @@ -32,7 +32,6 @@ namespace Sci { -class SciGui; class GfxPaint16; class GfxScreen; class GfxText16; @@ -103,6 +102,7 @@ public: void kernelGraphAdjustPriority(int top, int bottom); byte kernelCoordinateToPriority(int16 y); int16 kernelPriorityToCoordinate(byte priority); + void printWindowList(Console *con); Port *_wmgrPort; Window *_picWind; -- cgit v1.2.3