summaryrefslogtreecommitdiff
path: root/src/graphic
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-02-14 11:26:10 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-02-14 11:26:10 +0000
commitc297ba25d7c5eef8d64500ce4f8ddc8c7f098a18 (patch)
treeb0c76db603208316217e2d48458c44a0a74b831c /src/graphic
parent495e9b9249a6f199a7b1ad0c3c0f350819f23f30 (diff)
downloadmana-c297ba25d7c5eef8d64500ce4f8ddc8c7f098a18.tar.gz
mana-c297ba25d7c5eef8d64500ce4f8ddc8c7f098a18.tar.bz2
mana-c297ba25d7c5eef8d64500ce4f8ddc8c7f098a18.tar.xz
mana-c297ba25d7c5eef8d64500ce4f8ddc8c7f098a18.zip
Display of path to mouse now a debug feature you can toggle with F6, plus some
more log file usage.
Diffstat (limited to 'src/graphic')
-rw-r--r--src/graphic/graphic.cpp60
1 files changed, 31 insertions, 29 deletions
diff --git a/src/graphic/graphic.cpp b/src/graphic/graphic.cpp
index 3887addb..25d6e0a5 100644
--- a/src/graphic/graphic.cpp
+++ b/src/graphic/graphic.cpp
@@ -507,37 +507,39 @@ void Engine::draw()
}
}
-#ifdef __DEBUG
- // Draw a debug path
- PATH_NODE *debugPath = tiledMap.findPath(
- player_node->x, player_node->y,
- mouseX / 32 + camera_x, mouseY / 32 + camera_y);
-
- while (debugPath)
+ if (displayPathToMouse)
{
- SDL_Rect destRect;
- destRect.x = (debugPath->x - camera_x) * 32 - offset_x + 12;
- destRect.y = (debugPath->y - camera_y) * 32 - offset_y + 12;
- destRect.w = 8;
- destRect.h = 8;
- SDL_FillRect(screen, &destRect, SDL_MapRGB(screen->format, 255, 0, 0));
-
- Tile *tile = tiledMap.getTile(debugPath->x, debugPath->y);
-
- std::stringstream cost;
- cost << tile->Gcost;
- guiGraphics->_beginDraw();
- guiGraphics->drawText(cost.str(), destRect.x + 4, destRect.y + 12,
- gcn::Graphics::CENTER);
- guiGraphics->_endDraw();
-
- // Move to the next node
- PATH_NODE *temp = debugPath->next;
- delete debugPath;
- debugPath = temp;
+ // Draw a debug path
+ PATH_NODE *debugPath = tiledMap.findPath(
+ player_node->x, player_node->y,
+ mouseX / 32 + camera_x, mouseY / 32 + camera_y);
+
+ while (debugPath)
+ {
+ SDL_Rect destRect;
+ destRect.x = (debugPath->x - camera_x) * 32 - offset_x + 12;
+ destRect.y = (debugPath->y - camera_y) * 32 - offset_y + 12;
+ destRect.w = 8;
+ destRect.h = 8;
+ SDL_FillRect(screen, &destRect,
+ SDL_MapRGB(screen->format, 255, 0, 0));
+
+ Tile *tile = tiledMap.getTile(debugPath->x, debugPath->y);
+
+ std::stringstream cost;
+ cost << tile->Gcost;
+ guiGraphics->_beginDraw();
+ guiGraphics->drawText(cost.str(), destRect.x + 4, destRect.y + 12,
+ gcn::Graphics::CENTER);
+ guiGraphics->_endDraw();
+
+ // Move to the next node
+ PATH_NODE *temp = debugPath->next;
+ delete debugPath;
+ debugPath = temp;
+ }
}
-#endif
-
+
// Draw player speech
beingIterator = beings.begin();
while (beingIterator != beings.end()) {