diff --git a/Gui.cpp b/Gui.cpp index f956b49..72a59cc 100644 --- a/Gui.cpp +++ b/Gui.cpp @@ -124,7 +124,9 @@ void Gui::message(const TCOD_ColorRGB& col, const char* text, ...) { } while (lineEnd); } void Gui::renderMouseLook() { - if (!engine->map->isInFov(engine->mouse.cx, engine->mouse.cy)) { + int offset_x = engine->player->x - Engine::VIEW_WIDTH / 2; + int offset_y = engine->player->y - Engine::VIEW_HEIGHT / 2; + if (!engine->map->isInFov(engine->mouse.cx + offset_x, engine->mouse.cy + offset_y)) { // if mouse is out of fov, nothing to render return; } @@ -134,7 +136,7 @@ void Gui::renderMouseLook() { for (Actor** it = engine->actors.begin(); it != engine->actors.end(); it++) { Actor* actor = *it; // find actors under the mouse cursor - if (actor->x == engine->mouse.cx && actor->y == engine->mouse.cy) { + if (actor->x == engine->mouse.cx + offset_x && actor->y == engine->mouse.cy + offset_y) { if (!first) { ss << ", "; }