ASYLUM: add debug command to draw action area

This commit is contained in:
alxpnv 2021-12-09 12:24:06 +03:00
parent 001426e231
commit 77cfc02f6c
3 changed files with 32 additions and 0 deletions

View File

@ -52,6 +52,7 @@ extern int g_debugActors;
extern int g_debugDrawRects;
extern int g_debugObjects;
extern int g_debugPolygons;
extern int g_debugPolygonIndex;
extern int g_debugSceneRects;
extern int g_debugScrolling;
@ -289,6 +290,7 @@ Console::Console(AsylumEngine *engine) : _vm(engine), _insertDisc(engine), _resV
registerCmd("palette", WRAP_METHOD(Console, cmdSetPalette));
registerCmd("view", WRAP_METHOD(Console, cmdViewResource));
registerCmd("draw_area", WRAP_METHOD(Console, cmdDrawActionArea));
registerCmd("toggle_flag", WRAP_METHOD(Console, cmdToggleFlag));
@ -352,6 +354,7 @@ bool Console::cmdHelp(int, const char **) {
debugPrintf("\n");
debugPrintf(" palette - set the screen palette\n");
debugPrintf(" view - view game resources\n");
debugPrintf(" draw_area - draw action area\n");
debugPrintf("\n");
debugPrintf(" toggle_flag - toggle a flag\n");
debugPrintf("\n");
@ -1089,6 +1092,30 @@ bool Console::cmdViewResource(int argc, const char **argv) {
}
}
bool Console::cmdDrawActionArea(int argc, const char **argv) {
if (argc == 1) {
if (g_debugPolygonIndex) {
g_debugPolygonIndex = 0;
return false;
} else {
debugPrintf("Syntax: %s (<area_index>)\n", argv[0]);
return true;
}
}
int areaIndex = getWorld()->getActionAreaIndexById(atoi(argv[1]));
if (areaIndex == -1) {
debugPrintf("No such area\n");
return true;
}
ActionArea *area = getWorld()->actions[areaIndex];
if (area->polygonIndex)
g_debugPolygonIndex = area->polygonIndex;
return false;
}
//////////////////////////////////////////////////////////////////////////
// Flags commands
//////////////////////////////////////////////////////////////////////////

View File

@ -95,6 +95,7 @@ private:
bool cmdSetPalette(int argc, const char **argv);
bool cmdViewResource(int argc, const char **argv);
bool cmdDrawActionArea(int argc, const char **argv);
bool cmdToggleFlag(int argc, const char **argv);
};

View File

@ -53,6 +53,7 @@ namespace Asylum {
int g_debugActors;
int g_debugObjects;
int g_debugPolygons;
int g_debugPolygonIndex;
int g_debugSceneRects;
int g_debugScrolling;
@ -74,6 +75,7 @@ Scene::Scene(AsylumEngine *engine): _vm(engine),
g_debugActors = 0;
g_debugObjects = 0;
g_debugPolygons = 0;
g_debugPolygonIndex = 0;
g_debugSceneRects = 0;
g_debugScrolling = 0;
}
@ -2450,6 +2452,8 @@ bool Scene::drawScene() {
debugShowActors();
if (g_debugPolygons)
debugShowPolygons();
if (g_debugPolygonIndex)
debugHighlightPolygon(g_debugPolygonIndex);
if (g_debugObjects)
debugShowObjects();
if (g_debugSceneRects)