aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorMax Horn2004-04-04 22:43:54 +0000
committerMax Horn2004-04-04 22:43:54 +0000
commit21b81b9ef473f97838f7fe9cb5911a962cc633bd (patch)
tree702b4f43d83014126bd61723014d3203c6e28798 /scumm
parent71bbdbfae41545f68713642bb9f395cb234bb60c (diff)
downloadscummvm-rg350-21b81b9ef473f97838f7fe9cb5911a962cc633bd.tar.gz
scummvm-rg350-21b81b9ef473f97838f7fe9cb5911a962cc633bd.tar.bz2
scummvm-rg350-21b81b9ef473f97838f7fe9cb5911a962cc633bd.zip
Fix signedness issue (lead to incorred address computations on 64 bit machines)
svn-id: r13465
Diffstat (limited to 'scumm')
-rw-r--r--scumm/akos.cpp17
-rw-r--r--scumm/base-costume.h2
-rw-r--r--scumm/costume.cpp24
3 files changed, 23 insertions, 20 deletions
diff --git a/scumm/akos.cpp b/scumm/akos.cpp
index 61b5b0aea0..35c6503e4b 100644
--- a/scumm/akos.cpp
+++ b/scumm/akos.cpp
@@ -347,7 +347,8 @@ void AkosRenderer::codec1_genericDecode() {
const byte *mask, *src;
byte *dst;
byte len, maskbit;
- uint y, color, height, pcolor;
+ int y;
+ uint color, height, pcolor;
const byte *scaleytab;
bool masked;
bool skip_column = false;
@@ -376,7 +377,7 @@ void AkosRenderer::codec1_genericDecode() {
do {
if (*scaleytab++ < _scaleY) {
if (_actorHitMode) {
- if (color && (int16) y == _actorHitY && v1.x == _actorHitX) {
+ if (color && y == _actorHitY && v1.x == _actorHitX) {
_actorHitResult = true;
return;
}
@@ -413,7 +414,7 @@ void AkosRenderer::codec1_genericDecode() {
if (v1.scaletable[v1.scaleXindex] < _scaleX) {
v1.x += v1.scaleXstep;
- if (v1.x < 0 || v1.x >= (int)_outwidth)
+ if (v1.x < 0 || v1.x >= _outwidth)
return;
maskbit = revBitMask[v1.x & 7];
v1.destptr += v1.scaleXstep;
@@ -613,7 +614,7 @@ byte AkosRenderer::codec1(int xmoveCur, int ymoveCur) {
j = startScaleIndexX;
for (i = 0, skip = 0; i < _width; i++) {
- if (rect.left >= (int)_outwidth) {
+ if (rect.left >= _outwidth) {
startScaleIndexX = j;
skip++;
}
@@ -678,10 +679,10 @@ byte AkosRenderer::codec1(int xmoveCur, int ymoveCur) {
} else
_vm->markRectAsDirty(kMainVirtScreen, rect, _actorID);
- if (rect.top >= (int)_outheight || rect.bottom <= 0)
+ if (rect.top >= _outheight || rect.bottom <= 0)
return 0;
- if (rect.left >= (int)_outwidth || rect.right <= 0)
+ if (rect.left >= _outwidth || rect.right <= 0)
return 0;
v1.replen = 0;
@@ -724,10 +725,10 @@ byte AkosRenderer::codec1(int xmoveCur, int ymoveCur) {
if (v1.skip_width <= 0 || _height <= 0)
return 0;
- if ((uint) rect.top > _outheight)
+ if (rect.top > _outheight)
rect.top = 0;
- if ((uint) rect.bottom > _outheight)
+ if (rect.bottom > _outheight)
rect.bottom = _outheight;
if (_draw_top > rect.top)
diff --git a/scumm/base-costume.h b/scumm/base-costume.h
index 29362797a8..dac42e7dc3 100644
--- a/scumm/base-costume.h
+++ b/scumm/base-costume.h
@@ -69,7 +69,7 @@ protected:
// Destination
byte *_outptr;
- uint _outwidth, _outheight;
+ int _outwidth, _outheight;
int32 _numStrips;
// Source pointer
diff --git a/scumm/costume.cpp b/scumm/costume.cpp
index 1f5e28b9c9..074dd96fc3 100644
--- a/scumm/costume.cpp
+++ b/scumm/costume.cpp
@@ -148,7 +148,7 @@ byte CostumeRenderer::mainRoutine(int xmoveCur, int ymoveCur) {
rect.right = rect.left = v1.x;
_scaleIndexX = startScaleIndexX;
for (i = 0; i < _width; i++) {
- if (rect.left >= (int)_outwidth) {
+ if (rect.left >= _outwidth) {
skip++;
startScaleIndexX = _scaleIndexX;
}
@@ -205,10 +205,10 @@ byte CostumeRenderer::mainRoutine(int xmoveCur, int ymoveCur) {
else
_vm->markRectAsDirty(kMainVirtScreen, rect.left, rect.right + 1, rect.top, rect.bottom, _actorID);
- if (rect.top >= (int)_outheight || rect.bottom <= 0)
+ if (rect.top >= _outheight || rect.bottom <= 0)
return 0;
- if (rect.left >= (int)_outwidth || rect.right <= 0)
+ if (rect.left >= _outwidth || rect.right <= 0)
return 0;
v1.replen = 0;
@@ -254,10 +254,10 @@ byte CostumeRenderer::mainRoutine(int xmoveCur, int ymoveCur) {
if (rect.left < 0)
rect.left = 0;
- if ((uint) rect.top > _outheight)
+ if (rect.top > _outheight)
rect.top = 0;
- if ((uint) rect.bottom > _outheight)
+ if (rect.bottom > _outheight)
rect.bottom = _outheight;
if (_draw_top > rect.top)
@@ -352,7 +352,8 @@ void CostumeRenderer::procC64(int actor) {
const byte *mask, *src;
byte *dst;
byte len;
- uint y, height;
+ int y;
+ uint height;
byte color, pcolor;
bool rep;
@@ -409,7 +410,7 @@ void CostumeRenderer::procC64(int actor) {
height = _height;
y = v1.y;
v1.x += 8 * v1.scaleXstep;
- if (v1.x < 0 || v1.x >= (int)_outwidth)
+ if (v1.x < 0 || v1.x >= _outwidth)
return;
mask = v1.mask_ptr;
v1.destptr += 8 * v1.scaleXstep;
@@ -426,7 +427,8 @@ void CostumeRenderer::proc3() {
const byte *mask, *src;
byte *dst;
byte len, maskbit;
- uint y, color, height, pcolor;
+ int y;
+ uint color, height, pcolor;
const byte *scaleytab;
bool masked;
@@ -482,7 +484,7 @@ void CostumeRenderer::proc3() {
if (_scaleX == 255 || v1.scaletable[_scaleIndexX] < _scaleX) {
v1.x += v1.scaleXstep;
- if (v1.x < 0 || v1.x >= (int)_outwidth)
+ if (v1.x < 0 || v1.x >= _outwidth)
return;
maskbit = revBitMask[v1.x & 7];
v1.destptr += v1.scaleXstep;
@@ -501,7 +503,7 @@ void CostumeRenderer::proc3_ami() {
byte *dst;
byte maskbit, len, height, width;
int color;
- uint y;
+ int y;
bool masked;
int oldXpos, oldScaleIndexX;
@@ -525,7 +527,7 @@ void CostumeRenderer::proc3_ami() {
if (_scaleY == 255 || cost_scaleTable[_scaleIndexY] < _scaleY) {
masked = (y >= _outheight) || v1.mask_ptr && ((mask[0] | mask[v1.imgbufoffs]) & maskbit);
- if (color && v1.x >= 0 && v1.x < (int)_outwidth && !masked) {
+ if (color && v1.x >= 0 && v1.x < _outwidth && !masked) {
*dst = _palette[color];
}