stop displaying 0's in tiledata debug command
This commit is contained in:
parent
d05316c67d
commit
a0461bd1c0
3 changed files with 22 additions and 28 deletions
|
|
@ -577,9 +577,6 @@ std::string DebugCmdSpawnMonster(const string_view parameter)
|
|||
std::string DebugCmdShowTileData(const string_view parameter)
|
||||
{
|
||||
std::string paramList[] = {
|
||||
"dungeon",
|
||||
"pdungeon",
|
||||
"dflags",
|
||||
"dPiece",
|
||||
"dTransVal",
|
||||
"dLight",
|
||||
|
|
@ -598,13 +595,13 @@ std::string DebugCmdShowTileData(const string_view parameter)
|
|||
return "Tile data cleared!";
|
||||
} else if (parameter == "") {
|
||||
std::string list = "clear";
|
||||
for (int i = 0; i < 14; i++) {
|
||||
for (int i = 0; i < 11; i++) {
|
||||
list += " / " + paramList[i];
|
||||
}
|
||||
return list;
|
||||
}
|
||||
bool found = false;
|
||||
for (int i = 0; i < 14; i++) {
|
||||
for (int i = 0; i < 11; i++) {
|
||||
if (parameter == paramList[i]) {
|
||||
found = true;
|
||||
DebugInfoFlag = static_cast<DebugInfoFlags>(1 << i);
|
||||
|
|
@ -753,12 +750,6 @@ bool CheckDebugTextCommand(const string_view text)
|
|||
int DebugGetTileData(Point dungeonCoords)
|
||||
{
|
||||
switch (DebugInfoFlag) {
|
||||
case DebugInfoFlags::dungeon:
|
||||
return dungeon[dungeonCoords.x][dungeonCoords.y];
|
||||
case DebugInfoFlags::pdungeon:
|
||||
return pdungeon[dungeonCoords.x][dungeonCoords.y];
|
||||
case DebugInfoFlags::dflags:
|
||||
return dflags[dungeonCoords.x][dungeonCoords.y];
|
||||
case DebugInfoFlags::dPiece:
|
||||
return dPiece[dungeonCoords.x][dungeonCoords.y];
|
||||
case DebugInfoFlags::dTransVal:
|
||||
|
|
|
|||
|
|
@ -18,20 +18,17 @@ namespace devilution {
|
|||
enum class DebugInfoFlags : uint16_t {
|
||||
// clang-format off
|
||||
empty = 0,
|
||||
dungeon = 1 << 0,
|
||||
pdungeon = 1 << 1,
|
||||
dflags = 1 << 2,
|
||||
dPiece = 1 << 3,
|
||||
dTransVal = 1 << 4,
|
||||
dLight = 1 << 5,
|
||||
dPreLight = 1 << 6,
|
||||
dFlags = 1 << 7,
|
||||
dPlayer = 1 << 8,
|
||||
dMonster = 1 << 9,
|
||||
dCorpse = 1 << 10,
|
||||
dObject = 1 << 11,
|
||||
dItem = 1 << 12,
|
||||
dSpecial = 1 << 13,
|
||||
dPiece = 1 << 0,
|
||||
dTransVal = 1 << 1,
|
||||
dLight = 1 << 2,
|
||||
dPreLight = 1 << 3,
|
||||
dFlags = 1 << 4,
|
||||
dPlayer = 1 << 5,
|
||||
dMonster = 1 << 6,
|
||||
dCorpse = 1 << 7,
|
||||
dObject = 1 << 8,
|
||||
dItem = 1 << 9,
|
||||
dSpecial = 1 << 10,
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1212,14 +1212,20 @@ void DrawView(const Surface &out, Point startPosition)
|
|||
pixelCoords *= 2;
|
||||
if (DebugCoords || (DebugCursorCoords && dunCoords == cursPosition) || debugInfo) {
|
||||
char buffer[10];
|
||||
bool drawText = true;
|
||||
if (!debugInfo)
|
||||
sprintf(buffer, "%d:%d", dunCoords.x, dunCoords.y);
|
||||
else
|
||||
sprintf(buffer, "%d", DebugGetTileData(dunCoords));
|
||||
else {
|
||||
int value = DebugGetTileData(dunCoords);
|
||||
sprintf(buffer, "%d", value);
|
||||
if (value == 0)
|
||||
drawText = false;
|
||||
}
|
||||
|
||||
Size tileSize = { TILE_WIDTH, TILE_HEIGHT };
|
||||
if (!zoomflag)
|
||||
tileSize *= 2;
|
||||
if (drawText)
|
||||
DrawString(out, buffer, { pixelCoords - Displacement { 0, tileSize.height }, tileSize }, UiFlags::ColorRed | UiFlags::AlignCenter | UiFlags::VerticalCenter);
|
||||
}
|
||||
if (DebugGrid) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue