diff options
-rw-r--r-- | src/game.cpp | 5 | ||||
-rw-r--r-- | src/game.h | 1 | ||||
-rw-r--r-- | src/graphic/graphic.cpp | 60 | ||||
-rw-r--r-- | src/gui/window.cpp | 8 |
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) @@ -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); |