summaryrefslogtreecommitdiff
path: root/src
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
parent495e9b9249a6f199a7b1ad0c3c0f350819f23f30 (diff)
downloadmana-client-c297ba25d7c5eef8d64500ce4f8ddc8c7f098a18.tar.gz
mana-client-c297ba25d7c5eef8d64500ce4f8ddc8c7f098a18.tar.bz2
mana-client-c297ba25d7c5eef8d64500ce4f8ddc8c7f098a18.tar.xz
mana-client-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')
-rw-r--r--src/game.cpp5
-rw-r--r--src/game.h1
-rw-r--r--src/graphic/graphic.cpp60
-rw-r--r--src/gui/window.cpp8
4 files changed, 39 insertions, 35 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 9cc2a198..9044a711 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -47,6 +47,7 @@ volatile bool action_time = false;
int current_npc, server_tick;
extern unsigned char screen_mode;
int fps = 0, frame = 0;
+bool displayPathToMouse = false;
OkDialog *deathNotice = NULL;
@@ -176,6 +177,10 @@ void do_input()
action(3, 0);
action_time = false;
}
+ else if ((keysym.sym == SDLK_F6))
+ {
+ displayPathToMouse = !displayPathToMouse;
+ }
// Emotions, Skill dialog
if (keysym.mod & KMOD_ALT && action_time)
diff --git a/src/game.h b/src/game.h
index 13e8c472..e76f4705 100644
--- a/src/game.h
+++ b/src/game.h
@@ -62,6 +62,7 @@ extern char walk_status;
extern unsigned short src_x, src_y, x, y;
extern volatile int tick_time;
extern int server_tick;
+extern bool displayPathToMouse;
/**
* Main game loop
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()) {
diff --git a/src/gui/window.cpp b/src/gui/window.cpp
index 0c15ab97..0cc4c95c 100644
--- a/src/gui/window.cpp
+++ b/src/gui/window.cpp
@@ -37,9 +37,7 @@ Window::Window(const std::string& text, bool modal, Window *parent):
modal(modal),
titlebarHeight(20)
{
-#ifdef __DEBUG
- std::cout << "Window::Window(\"" << caption << "\")\n";
-#endif
+ log("Window::Window(\"%s\")", caption.c_str());
titlebarColor.r = 203;
titlebarColor.g = 203;
@@ -73,9 +71,7 @@ Window::Window(const std::string& text, bool modal, Window *parent):
Window::~Window()
{
-#ifdef __DEBUG
- std::cout << "Window::~Window(\"" << caption << "\")\n";
-#endif
+ log("Window::~Window(\"%s\")", caption.c_str());
// Free dialog bitmaps
//release_bitmap(dLeft);