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
This commit is contained in:
md5 2011-03-20 14:56:13 +02:00
parent a43689550e
commit 4df049f4d7
4 changed files with 31 additions and 6 deletions

View file

@ -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) {
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());

View file

@ -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);

View file

@ -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

View file

@ -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;