aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Kurushin2005-02-11 20:59:29 +0000
committerAndrew Kurushin2005-02-11 20:59:29 +0000
commit5239c2f4777d7f06fae59dd1750d70c4e56a855c (patch)
treea2d033aa8f81882246b8b45cc8c04d2c0593127c
parent9497fddcf05a22e22f614d8b88e2c6226e52cd36 (diff)
downloadscummvm-rg350-5239c2f4777d7f06fae59dd1750d70c4e56a855c.tar.gz
scummvm-rg350-5239c2f4777d7f06fae59dd1750d70c4e56a855c.tar.bz2
scummvm-rg350-5239c2f4777d7f06fae59dd1750d70c4e56a855c.zip
- fix min->MIN
- implemented horizontal tile cliping svn-id: r16774
-rw-r--r--saga/isomap.cpp26
1 files changed, 15 insertions, 11 deletions
diff --git a/saga/isomap.cpp b/saga/isomap.cpp
index 314e3c31d0..eeca38ea30 100644
--- a/saga/isomap.cpp
+++ b/saga/isomap.cpp
@@ -393,7 +393,7 @@ void IsoMap::drawTile(SURFACE *ds, uint16 tileIndex, const Point &point) {
Point drawPoint;
int height;
int widthCount = 0;
- int row, col, lowBound;
+ int row, col, count, lowBound;
int bgRunCount;
int fgRunCount;
@@ -403,13 +403,11 @@ void IsoMap::drawTile(SURFACE *ds, uint16 tileIndex, const Point &point) {
}
- /* temporary x clip */
- if (point.x < 0) {
+ if (point.x + SAGA_ISOTILE_WIDTH < _tileClip.left) {
return;
}
- /* temporary x clip */
- if (point.x >= _tileClip.right - 32) {
+ if (point.x - SAGA_ISOTILE_WIDTH >= _tileClip.right) {
return;
}
@@ -430,7 +428,7 @@ void IsoMap::drawTile(SURFACE *ds, uint16 tileIndex, const Point &point) {
}
readPointer = tilePointer;
- lowBound = min(drawPoint.y + height, _tileClip.bottom);
+ lowBound = MIN((int)(drawPoint.y + height), (int)_tileClip.bottom);
for (row = drawPoint.y; row < lowBound; row++) {
widthCount = 0;
if (row >= _tileClip.top) {
@@ -448,12 +446,18 @@ void IsoMap::drawTile(SURFACE *ds, uint16 tileIndex, const Point &point) {
fgRunCount = *readPointer++;
widthCount += fgRunCount;
-
- while(fgRunCount-- > 0) {
- *drawPointer++ = *readPointer++;
+ count = 0;
+ while ((col < _tileClip.left) && (count < fgRunCount)) {
+ count++;
+ col++;
+ }
+ while ((col < _tileClip.right) && (count < fgRunCount)) {
+ drawPointer[count] = readPointer[count];
+ count++;
+ col++;
}
-// readPointer += fgRunCount;
-// drawPointer += fgRunCount;
+ readPointer += fgRunCount;
+ drawPointer += fgRunCount;
}
} else {
for (;;) {