diff --git a/game/engine/Tooltip.lua b/game/engine/Tooltip.lua index 7443fd40689b0dc038669e142321f6d0f557b9b1..d93c43d3abee55c93d2fe176e10196825ddb2be1 100644 --- a/game/engine/Tooltip.lua +++ b/game/engine/Tooltip.lua @@ -134,6 +134,8 @@ function _M:displayAtMap(tmx, tmy, mx, my) my = my - self.h if mx < 0 then mx = 0 end if my < 0 then my = 0 end + if mx > game.w - self.w then mx = game.w - self.w end + if my > game.h - self.h then my = game.h - self.h end self.surface:toScreenWithTexture(self.texture, mx, my) end end diff --git a/game/engine/interface/GameTargeting.lua b/game/engine/interface/GameTargeting.lua index 44b05b116d1ecace88d41b9e4b49c327adbfb5c5..c96809dca607608d88151d0c73ae63fd15b912f6 100644 --- a/game/engine/interface/GameTargeting.lua +++ b/game/engine/interface/GameTargeting.lua @@ -41,11 +41,14 @@ function _M:targetOnTick() end --- Display the tooltip, if any -function _M:targetDisplayTooltip() +function _M:targetDisplayTooltip(dx, dy) -- Tooltip is displayed over all else if self.level and self.level.map and self.level.map.finished then -- Display a tooltip if available - if self.tooltip_x then self.tooltip:displayAtMap(self.level.map:getMouseTile(self.tooltip_x , self.tooltip_y)) end + if self.tooltip_x then + local tmx, tmy = self.level.map:getMouseTile(self.tooltip_x , self.tooltip_y) + self.tooltip:displayAtMap(tmx, tmy, dx, dy) + end -- Move target around if self.old_tmx ~= tmx or self.old_tmy ~= tmy then diff --git a/game/modules/tome/class/Game.lua b/game/modules/tome/class/Game.lua index 9caf2ba8c47a3643defce6630cc90bd8289e5a50..d9d47e1eb1bc8d08773f781eb3b45b549e7a8cf9 100644 --- a/game/modules/tome/class/Game.lua +++ b/game/modules/tome/class/Game.lua @@ -450,7 +450,7 @@ function _M:display() if self.player then self.player.changed = false end -- Tooltip is displayed over all else - self:targetDisplayTooltip() + self:targetDisplayTooltip(game.w, game.h) engine.GameTurnBased.display(self) end