From 43f84746bf276106b147bc9593b2a3e3ad424e4b Mon Sep 17 00:00:00 2001 From: Robert Špalek Date: Sat, 3 Oct 2009 05:16:19 +0000 Subject: Fixed positioning and update of the title under the mouse pointer. Clamping on the border of the screen works precisely. When switched to the inventory, titles of game items are displayed instead of a (sticky) title of the last object before entering the inventory. Put some const's where appropriate. svn-id: r44550 --- engines/draci/surface.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'engines/draci/surface.cpp') diff --git a/engines/draci/surface.cpp b/engines/draci/surface.cpp index 069c501cab..6330c17cb3 100644 --- a/engines/draci/surface.cpp +++ b/engines/draci/surface.cpp @@ -133,11 +133,11 @@ void Surface::fill(uint colour) { * * @return The centered x coordinate */ -uint Surface::centerOnX(uint x, uint width) const { +uint Surface::centerOnX(int x, int width) const { int newX = x - width / 2; - if (newX + width >= (uint)w - 1) - newX = (w - 1) - width; + if (newX + width > w) + newX = w - width; if (newX < 0) newX = 0; @@ -153,11 +153,11 @@ uint Surface::centerOnX(uint x, uint width) const { * * @return The centered y coordinate */ -uint Surface::centerOnY(uint y, uint height) const { - int newY = y - height / 2; +uint Surface::putAboveY(int y, int height) const { + int newY = y - height; - if (newY + height >= (uint)h - 1) - newY = (h - 1) - height; + if (newY + height > h) + newY = h - height; if (newY < 0) newY = 0; -- cgit v1.2.3