aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorMax Horn2003-05-31 14:24:06 +0000
committerMax Horn2003-05-31 14:24:06 +0000
commit6762073acd4982708fd00677f676c2d07c5ead3a (patch)
tree1ae99cbac6d254826ae62d9569a7441f1cdcee5b /scumm
parent7b96eb0c2afae21c24d4c601401bd6f67c3042f7 (diff)
downloadscummvm-rg350-6762073acd4982708fd00677f676c2d07c5ead3a.tar.gz
scummvm-rg350-6762073acd4982708fd00677f676c2d07c5ead3a.tar.bz2
scummvm-rg350-6762073acd4982708fd00677f676c2d07c5ead3a.zip
perform y ciping for box polygons, too (avoids crashes)
svn-id: r8177
Diffstat (limited to 'scumm')
-rw-r--r--scumm/debugger.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/scumm/debugger.cpp b/scumm/debugger.cpp
index 512527d1cc..635d068a9b 100644
--- a/scumm/debugger.cpp
+++ b/scumm/debugger.cpp
@@ -762,19 +762,24 @@ static void hlineColor(Scumm *scumm, int x1, int x2, int y, byte color)
VirtScreen *vs = &scumm->virtscr[0];
byte *ptr;
+ // Clip y
+ y += scumm->_screenTop;
+ if (y < 0 || y >= scumm->_screenHeight)
+ return;
+
if (x2 < x1)
SWAP(x2, x1);
// Clip x1 / x2
const int left = scumm->_screenStartStrip * 8;
- const int right = left + scumm->_screenWidth;
+ const int right = scumm->_screenEndStrip * 8;
if (x1 < left)
x1 = left;
if (x2 >= right)
x2 = right - 1;
+
- ptr = vs->screenPtr + x1
- + (y + scumm->camera._cur.y - scumm->_screenHeight / 2) * scumm->_screenWidth;
+ ptr = vs->screenPtr + x1 + y * scumm->_screenWidth;
while (x1++ <= x2) {
*ptr++ = color;