diff options
author | Max Horn | 2003-05-15 00:03:49 +0000 |
---|---|---|
committer | Max Horn | 2003-05-15 00:03:49 +0000 |
commit | f3a5fc79c1d22338a8ed60a63b9571162a5dd581 (patch) | |
tree | de2f51e69c7670bfe15e0596b49d6696a7ba7477 /scumm | |
parent | 885f28b6aed2229c48cc1f08ba4ed59df596fb0a (diff) | |
download | scummvm-rg350-f3a5fc79c1d22338a8ed60a63b9571162a5dd581.tar.gz scummvm-rg350-f3a5fc79c1d22338a8ed60a63b9571162a5dd581.tar.bz2 scummvm-rg350-f3a5fc79c1d22338a8ed60a63b9571162a5dd581.zip |
bounds check; made data static
svn-id: r7519
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/object.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/scumm/object.cpp b/scumm/object.cpp index a44a4b7cb2..b9bb01ab0b 100644 --- a/scumm/object.cpp +++ b/scumm/object.cpp @@ -305,7 +305,7 @@ void Scumm::drawRoomObjects(int arg) { } } -const uint32 IMxx_tags[] = { +static const uint32 IMxx_tags[] = { MKID('IM00'), MKID('IM01'), MKID('IM02'), @@ -1468,7 +1468,7 @@ void Scumm::drawBlastObject(BlastObject *eo) { updateDirtyRect(vs->number, bdd.x, bdd.x + bdd.srcwidth, bdd.y, bdd.y + bdd.srcheight, 0); } -byte _bompScaleTable[] = { +static byte _bompScaleTable[] = { 0, 128, 64, 192, 32, 160, 96, 224, 16, 144, 80, 208, 48, 176, 112, 240, 8, 136, 72, 200, 40, 168, 104, 232, @@ -1536,7 +1536,7 @@ byte _bompScaleTable[] = { 31, 159, 95, 223, 63, 191, 127, 255, }; -byte _bompBitsTable[] = { +static byte _bompBitsTable[] = { 8, 7, 7, 6, 7, 6, 6, 5, 7, 6, 6, 5, 6, 5, 5, 4, 7, 6, 6, 5, 6, 5, 5, 4, 6, 5, 5, 4, 5, 4, 4, 3, 7, 6, 6, 5, 6, 5, 5, 4, 6, 5, 5, 4, 5, 4, 4, 3, @@ -1556,9 +1556,10 @@ byte _bompBitsTable[] = { }; int32 Scumm::setupBompScale(byte * scalling, int32 size, byte scale) { - uint32 tmp; + uint32 tmp = (256 - (size >> 1)); int32 count = (size + 7) >> 3; - byte * tmp_ptr = _bompScaleTable + (256 - (size >> 1)); + assert(0 <= tmp && tmp < sizeof(_bompScaleTable)); + byte * tmp_ptr = _bompScaleTable + tmp; byte * tmp_scalling = scalling; byte a = 0; @@ -1615,8 +1616,10 @@ int32 Scumm::setupBompScale(byte * scalling, int32 size, byte scale) { count = (size + 7) >> 3; byte ret_value = 0; - while((count--) != 0) { - ret_value += *(*(scalling++) + _bompBitsTable); + while(count--) { + tmp = *scalling++; + assert(0 <= tmp && tmp < sizeof(_bompBitsTable)); + ret_value += _bompBitsTable[tmp]; } return ret_value; |