diff options
author | Robert Špalek | 2009-10-03 05:16:19 +0000 |
---|---|---|
committer | Robert Špalek | 2009-10-03 05:16:19 +0000 |
commit | 43f84746bf276106b147bc9593b2a3e3ad424e4b (patch) | |
tree | b91b61bf2dccdf01bbccf95e7095d218b327ea02 /engines/draci/surface.cpp | |
parent | 548d139b48d76d391051520d828d977893c0cf28 (diff) | |
download | scummvm-rg350-43f84746bf276106b147bc9593b2a3e3ad424e4b.tar.gz scummvm-rg350-43f84746bf276106b147bc9593b2a3e3ad424e4b.tar.bz2 scummvm-rg350-43f84746bf276106b147bc9593b2a3e3ad424e4b.zip |
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
Diffstat (limited to 'engines/draci/surface.cpp')
-rw-r--r-- | engines/draci/surface.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
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; |