aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Göffringmann2003-06-17 12:27:03 +0000
committerRobert Göffringmann2003-06-17 12:27:03 +0000
commit81b7b265b9c5a9106de73424cde7cf8bf6ece2c4 (patch)
tree6f34f67194492810824c666c9e2dfc0169d7b95a
parent61491fb295647462611f49752942834b3afb0273 (diff)
downloadscummvm-rg350-81b7b265b9c5a9106de73424cde7cf8bf6ece2c4.tar.gz
scummvm-rg350-81b7b265b9c5a9106de73424cde7cf8bf6ece2c4.tar.bz2
scummvm-rg350-81b7b265b9c5a9106de73424cde7cf8bf6ece2c4.zip
fixed grid position calculation
svn-id: r8529
-rw-r--r--sky/grid.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/sky/grid.cpp b/sky/grid.cpp
index 3a369db795..db08bfa9fc 100644
--- a/sky/grid.cpp
+++ b/sky/grid.cpp
@@ -180,10 +180,9 @@ bool SkyGrid::getGridValues(uint32 x, uint32 y, uint32 width, Compact *cpt, uint
bitPos += x_signed;
int32 screenGridOfs = _gridConvertTable[cpt->screen] * GRID_SIZE;
bitPos += (screenGridOfs << 3); // convert to bits
- int32 tmpBits = bitPos&0x1F;
+ uint32 tmpBits = 0x1F - (bitPos&0x1F);
bitPos &= ~0x1F; // divide into dword address and bit number
- tmpBits = ~(tmpBits-0x1F); // NOTE THE ~ !!
- bitPos += tmpBits; // anyone have an idea what this calculation is meant for?!
+ bitPos += tmpBits;
*resBitNum = bitPos;
*resWidth = width;
return true;
@@ -200,9 +199,9 @@ void SkyGrid::removeObjectFromWalk(uint32 bitNum, uint32 width) {
for (uint32 cnt = 0; cnt < width; cnt++) {
_gameGrids[bitNum >> 3] &= ~(1 << (bitNum & 0x7));
- bitNum--;
if ((bitNum & 0x1F) == 0)
bitNum += 0x3F;
+ else bitNum--;
}
}
@@ -217,9 +216,9 @@ void SkyGrid::objectToWalk(uint32 bitNum, uint32 width) {
for (uint32 cnt = 0; cnt < width; cnt++) {
_gameGrids[bitNum >> 3] |= (1 << (bitNum & 0x7));
- bitNum--;
if ((bitNum & 0x1F) == 0)
bitNum += 0x3F;
+ else bitNum--;
}
}