From 6c0b7b6deb994b0d57d8dc858ee10a71cebfc4cb Mon Sep 17 00:00:00 2001
From: Bertrand Augereau
Date: Thu, 1 Sep 2011 01:27:59 +0200
Subject: DREAMWEB: Fix of the bug when you are in the inventory and drag the
 gun agains the upper border of the screen

---
 engines/dreamweb/stubs.cpp | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

(limited to 'engines/dreamweb')

diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index 3a01872542..89df661974 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -1611,9 +1611,11 @@ void DreamGenContext::showpointer() {
 			height = 12;
 		data.byte(kPointerxs) = width;
 		data.byte(kPointerys) = height;
-		data.word(kOldpointerx) -= width / 2;
-		data.word(kOldpointery) -= height / 2;
-		multiget(segRef(data.word(kBuffers)).ptr(kPointerback, 0), x - width / 2, y - height / 2, width, height);
+		uint16 xMin = (x >= width / 2) ? x - width / 2 : 0;
+		uint16 yMin = (y >= height / 2) ? y - height / 2 : 0;
+		data.word(kOldpointerx) = xMin;
+		data.word(kOldpointery) = yMin;
+		multiget(segRef(data.word(kBuffers)).ptr(kPointerback, 0), xMin, yMin, width, height);
 		showframe(frames, x, y, 3 * data.byte(kItemframe) + 1, 128);
 		showframe(icons1, x, y, 3, 128);
 	} else {
-- 
cgit v1.2.3