aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/tony/debugger.cpp14
-rw-r--r--engines/tony/debugger.h1
-rw-r--r--engines/tony/window.cpp16
-rw-r--r--engines/tony/window.h5
4 files changed, 33 insertions, 3 deletions
diff --git a/engines/tony/debugger.cpp b/engines/tony/debugger.cpp
index 8beb7285a4..75e58d68d4 100644
--- a/engines/tony/debugger.cpp
+++ b/engines/tony/debugger.cpp
@@ -30,6 +30,7 @@ namespace Tony {
Debugger::Debugger() : GUI::Debugger() {
DCmd_Register("continue", WRAP_METHOD(Debugger, Cmd_Exit));
DCmd_Register("scene", WRAP_METHOD(Debugger, Cmd_Scene));
+ DCmd_Register("dirty_rects", WRAP_METHOD(Debugger, Cmd_DirtyRects));
}
static int strToInt(const char *s) {
@@ -113,4 +114,17 @@ bool Debugger::Cmd_Scene(int argc, const char **argv) {
return false;
}
+/**
+ * Turns showing dirty rects on or off
+ */
+bool Debugger::Cmd_DirtyRects(int argc, const char **argv) {
+ if (argc != 2) {
+ DebugPrintf("Usage; %s [on | off]\n", argv[0]);
+ return true;
+ } else {
+ _vm->_window.showDirtyRects(strcmp(argv[1], "on") == 0);
+ return false;
+ }
+}
+
} // End of namespace Tony
diff --git a/engines/tony/debugger.h b/engines/tony/debugger.h
index c5ed5e417e..85ba9d75b6 100644
--- a/engines/tony/debugger.h
+++ b/engines/tony/debugger.h
@@ -35,6 +35,7 @@ public:
protected:
bool Cmd_Scene(int argc, const char **argv);
+ bool Cmd_DirtyRects(int argc, const char **argv);
};
} // End of namespace Tony
diff --git a/engines/tony/window.cpp b/engines/tony/window.cpp
index bf0094ff2a..a35e765b6c 100644
--- a/engines/tony/window.cpp
+++ b/engines/tony/window.cpp
@@ -27,6 +27,7 @@
*/
#include "common/scummsys.h"
+#include "graphics/surface.h"
#include "util.h"
#include "tony/window.h"
#include "tony/game.h"
@@ -40,6 +41,7 @@ namespace Tony {
\****************************************************************************/
RMWindow::RMWindow() {
+ _showDirtyRects = false;
}
RMWindow::~RMWindow() {
@@ -126,11 +128,25 @@ void RMWindow::getNewFrame(RMGfxTargetBuffer &bigBuf, Common::Rect *rcBoundEllip
Common::List<Common::Rect> dirtyRects = bigBuf.getDirtyRects();
Common::List<Common::Rect>::iterator i;
+ // If showing dirty rects, copy the entire screen background and set up a surface pointer
+ Graphics::Surface *s = NULL;
+ if (_showDirtyRects) {
+ g_system->copyRectToScreen(lpBuf, RM_SX * 2, 0, 0, RM_SX, RM_SY);
+ s = g_system->lockScreen();
+ }
+
for (i = dirtyRects.begin(); i != dirtyRects.end(); ++i) {
Common::Rect &r = *i;
const byte *lpSrc = lpBuf + (RM_SX * 2) * r.top + (r.left * 2);
g_system->copyRectToScreen(lpSrc, RM_SX * 2, r.left, r.top, r.width(), r.height());
+
+ if (_showDirtyRects)
+ // Frame the copied area with a rectangle
+ s->frameRect(r, 0xffffff);
}
+
+ if (_showDirtyRects)
+ g_system->unlockScreen();
}
if (_bGrabThumbnail) {
diff --git a/engines/tony/window.h b/engines/tony/window.h
index 6189dd391f..562e5fe062 100644
--- a/engines/tony/window.h
+++ b/engines/tony/window.h
@@ -57,14 +57,12 @@ private:
void plotLines(const byte *lpBuf, const Common::Point &center, int x, int y);
protected:
-// void * /*LPDIRECTDRAWCLIPPER*/ _MainClipper;
-// void * /*LPDIRECTDRAWCLIPPER*/ _BackClipper;
-
int fps, fcount;
int lastsecond, lastfcount;
int mskRed, mskGreen, mskBlue;
bool _wiping;
+ bool _showDirtyRects;
bool _bGrabScreenshot;
bool _bGrabThumbnail;
@@ -99,6 +97,7 @@ public:
int getFps() const {
return fps;
}
+ void showDirtyRects(bool v) { _showDirtyRects = v; }
};
} // End of namespace Tony