[Scummvm-git-logs] scummvm master -> 90084caa745c4e9432321913fbb99b22ad6c77d1
AndywinXp
noreply at scummvm.org
Tue Dec 26 20:11:53 UTC 2023
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
9a742b0c36 SCUMM: Colorize debugger box output
90084caa74 SCUMM: Change DEBUG_COLOR_COUNT from static const to define
Commit: 9a742b0c3680f48509dd5e5c13dd377f82a8469d
https://github.com/scummvm/scummvm/commit/9a742b0c3680f48509dd5e5c13dd377f82a8469d
Author: Harri Pellikka (harri_pellikka at hotmail.com)
Date: 2023-12-26T21:10:15+01:00
Commit Message:
SCUMM: Colorize debugger box output
Draw boxes in scumm debugger with different colors to make them
easier to separate visually. Also, draw object rectangles with
different colors.
Changed paths:
engines/scumm/debugger.cpp
engines/scumm/debugger.h
diff --git a/engines/scumm/debugger.cpp b/engines/scumm/debugger.cpp
index bb42c414bad..514df849968 100644
--- a/engines/scumm/debugger.cpp
+++ b/engines/scumm/debugger.cpp
@@ -59,6 +59,11 @@ ScummDebugger::ScummDebugger(ScummEngine *s)
: GUI::Debugger() {
_vm = s;
+ // Initialize the debug colors
+ for (int i = 0; i < DEBUG_COLOR_COUNT; ++i) {
+ _debugColors[i] = 0x01 + i;
+ }
+
// Register variables
registerVar("scumm_speed", &_vm->_fastMode);
registerVar("scumm_room", &_vm->_currentRoom);
@@ -962,6 +967,7 @@ bool ScummDebugger::Cmd_PrintObjects(int argc, const char **argv) {
debugPrintf("|%4d|%-12.12s|%4d|%4d|%5d|%6d|%5d|%2d|$%08x|$%08x|$%08x|\n",
o->obj_nr, name, o->x_pos, o->y_pos, o->width, o->height, o->state,
o->fl_object_index, classData, o->OBIMoffset, o->OBCDoffset);
+ drawRect(o->x_pos, o->y_pos, o->width, o->height, getNextColor());
}
debugPrintf("\n");
@@ -1124,7 +1130,7 @@ void ScummDebugger::printBox(int box) {
flags, mask, scale);
// Draw the box
- drawBox(box);
+ drawBox(box, getNextColor());
}
/************ ENDER: Temporary debug code for boxen **************/
@@ -1216,7 +1222,7 @@ static void fillQuad(ScummEngine *scumm, Common::Point v[4], int color) {
return;
}
-void ScummDebugger::drawBox(int box) {
+void ScummDebugger::drawBox(int box, int color) {
BoxCoords coords;
Common::Point r[4];
@@ -1234,8 +1240,8 @@ void ScummDebugger::drawBox(int box) {
}
}
- // TODO - maybe use different colors for each box, and/or print the box number inside it?
- fillQuad(_vm, r, 13);
+ // TODO - maybe also print the box number inside it?
+ fillQuad(_vm, r, color);
VirtScreen *vs = _vm->findVirtScreen(coords.ul.y);
if (vs != nullptr)
@@ -1244,6 +1250,28 @@ void ScummDebugger::drawBox(int box) {
_vm->_system->updateScreen();
}
+void ScummDebugger::drawRect(int x, int y, int width, int height, int color) {
+ Common::Point r[4];
+ r[0] = Common::Point(x, y);
+ r[1] = Common::Point(x + width, y);
+ r[2] = Common::Point(x + width, y + height);
+ r[3] = Common::Point(x, y + height);
+
+ fillQuad(_vm, r, color);
+
+ VirtScreen *vs = _vm->findVirtScreen(y);
+ if (vs != nullptr)
+ _vm->markRectAsDirty(vs->number, 0, vs->w, 0, vs->h);
+ _vm->drawDirtyScreenParts();
+ _vm->_system->updateScreen();
+}
+
+int ScummDebugger::getNextColor() {
+ int color = _debugColors[_nextColorIndex++];
+ _nextColorIndex %= DEBUG_COLOR_COUNT;
+ return color;
+}
+
bool ScummDebugger::Cmd_PrintDraft(int argc, const char **argv) {
const char *names[] = {
"Opening", "Straw Into Gold", "Dyeing",
diff --git a/engines/scumm/debugger.h b/engines/scumm/debugger.h
index 75303652e2c..132c00d87d8 100644
--- a/engines/scumm/debugger.h
+++ b/engines/scumm/debugger.h
@@ -35,6 +35,10 @@ public:
private:
ScummEngine *_vm;
+ static const int DEBUG_COLOR_COUNT = 32;
+ int _nextColorIndex = 0;
+ int _debugColors[DEBUG_COLOR_COUNT];
+
void preEnter() override;
void postEnter() override;
void onFrame() override;
@@ -72,7 +76,9 @@ private:
bool Cmd_ResetCursors(int argc, const char **argv);
void printBox(int box);
- void drawBox(int box);
+ void drawBox(int box, int color);
+ void drawRect(int x, int y, int width, int height, int color);
+ int getNextColor();
};
} // End of namespace Scumm
Commit: 90084caa745c4e9432321913fbb99b22ad6c77d1
https://github.com/scummvm/scummvm/commit/90084caa745c4e9432321913fbb99b22ad6c77d1
Author: AndywinXp (andywinxp at gmail.com)
Date: 2023-12-26T21:11:30+01:00
Commit Message:
SCUMM: Change DEBUG_COLOR_COUNT from static const to define
Changed paths:
engines/scumm/debugger.h
diff --git a/engines/scumm/debugger.h b/engines/scumm/debugger.h
index 132c00d87d8..ef45c25578d 100644
--- a/engines/scumm/debugger.h
+++ b/engines/scumm/debugger.h
@@ -26,6 +26,8 @@
namespace Scumm {
+#define DEBUG_COLOR_COUNT 32
+
class ScummEngine;
class ScummDebugger : public GUI::Debugger {
@@ -35,7 +37,6 @@ public:
private:
ScummEngine *_vm;
- static const int DEBUG_COLOR_COUNT = 32;
int _nextColorIndex = 0;
int _debugColors[DEBUG_COLOR_COUNT];
More information about the Scummvm-git-logs
mailing list