diff options
author | Max Horn | 2004-09-02 23:16:58 +0000 |
---|---|---|
committer | Max Horn | 2004-09-02 23:16:58 +0000 |
commit | 8f6e066374bf783dcfbb7c4f4e374b68db9df5da (patch) | |
tree | aeb871cc7a45b6997b429dcf457f952e4a0717e5 /scumm | |
parent | ae4cb96f3940ae36947dad953ef22b535a3a6813 (diff) | |
download | scummvm-rg350-8f6e066374bf783dcfbb7c4f4e374b68db9df5da.tar.gz scummvm-rg350-8f6e066374bf783dcfbb7c4f4e374b68db9df5da.tar.bz2 scummvm-rg350-8f6e066374bf783dcfbb7c4f4e374b68db9df5da.zip |
Cleanup: renamed 'value' to 'scaletableSize' and made akos codec1 & the old costume code look even more alike
svn-id: r14868
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/akos.cpp | 60 | ||||
-rw-r--r-- | scumm/costume.cpp | 40 |
2 files changed, 48 insertions, 52 deletions
diff --git a/scumm/akos.cpp b/scumm/akos.cpp index b2f579b879..d5f7eb683a 100644 --- a/scumm/akos.cpp +++ b/scumm/akos.cpp @@ -604,16 +604,15 @@ const byte defaultScaleTable[768] = { #endif byte AkosRenderer::codec1(int xmoveCur, int ymoveCur) { - int num_colors, value; + int num_colors; bool use_scaling; int i, j; int skip = 0, startScaleIndexX, startScaleIndexY; Common::Rect rect; - int cur_x, cur_y; int step; byte drawFlag = 1; - value = (_vm->_features & GF_HUMONGOUS) ? 0x80 : 0x180; + const int scaletableSize = (_vm->_features & GF_HUMONGOUS) ? 128 : 384; /* implement custom scale table */ v1.scaletable = (_vm->_features & GF_HUMONGOUS) ? oldScaleTable : defaultScaleTable; @@ -636,8 +635,8 @@ byte AkosRenderer::codec1(int xmoveCur, int ymoveCur) { use_scaling = (_scaleX != 0xFF) || (_scaleY != 0xFF); - cur_x = _actorX; - cur_y = _actorY; + v1.x = _actorX; + v1.y = _actorY; if (use_scaling) { @@ -650,13 +649,13 @@ byte AkosRenderer::codec1(int xmoveCur, int ymoveCur) { if (_mirror) { /* Adjust X position */ - startScaleIndexX = j = value - xmoveCur; + startScaleIndexX = j = scaletableSize - xmoveCur; for (i = 0; i < xmoveCur; i++) { if (v1.scaletable[j++] < _scaleX) - cur_x -= v1.scaleXstep; + v1.x -= v1.scaleXstep; } - rect.left = rect.right = cur_x; + rect.left = rect.right = v1.x; j = startScaleIndexX; for (i = 0, skip = 0; i < _width; i++) { @@ -670,13 +669,13 @@ byte AkosRenderer::codec1(int xmoveCur, int ymoveCur) { } else { /* No mirror */ /* Adjust X position */ - startScaleIndexX = j = value + xmoveCur; + startScaleIndexX = j = scaletableSize + xmoveCur; for (i = 0; i < xmoveCur; i++) { if (v1.scaletable[j--] < _scaleX) - cur_x += v1.scaleXstep; + v1.x += v1.scaleXstep; } - rect.left = rect.right = cur_x; + rect.left = rect.right = v1.x; j = startScaleIndexX; for (i = 0; i < _width; i++) { @@ -699,40 +698,40 @@ byte AkosRenderer::codec1(int xmoveCur, int ymoveCur) { step = -step; } - startScaleIndexY = value - ymoveCur; + startScaleIndexY = scaletableSize - ymoveCur; for (i = 0; i < ymoveCur; i++) { if (v1.scaletable[startScaleIndexY++] < _scaleY) - cur_y -= step; + v1.y -= step; } - rect.top = rect.bottom = cur_y; - startScaleIndexY = value - ymoveCur; + rect.top = rect.bottom = v1.y; + startScaleIndexY = scaletableSize - ymoveCur; for (i = 0; i < _height; i++) { if (v1.scaletable[startScaleIndexY++] < _scaleY) rect.bottom++; } - startScaleIndexY = value - ymoveCur; + startScaleIndexY = scaletableSize - ymoveCur; } else { if (!_mirror) xmoveCur = -xmoveCur; - cur_x += xmoveCur; - cur_y += ymoveCur; + v1.x += xmoveCur; + v1.y += ymoveCur; if (_mirror) { - rect.left = cur_x; - rect.right = cur_x + _width; + rect.left = v1.x; + rect.right = v1.x + _width; } else { - rect.right = cur_x; - rect.left = cur_x - _width; + rect.left = v1.x - _width; + rect.right = v1.x; } - rect.top = cur_y; - rect.bottom = cur_y + _height; + rect.top = v1.y; + rect.bottom = rect.top + _height; - startScaleIndexX = value; - startScaleIndexY = value; + startScaleIndexX = scaletableSize; + startScaleIndexY = scaletableSize; } v1.scaleXindex = startScaleIndexX; @@ -756,11 +755,11 @@ byte AkosRenderer::codec1(int xmoveCur, int ymoveCur) { if (_mirror) { if (!use_scaling) - skip = -cur_x; + skip = -v1.x; if (skip > 0) { v1.skip_width -= skip; codec1_ignorePakCols(skip); - cur_x = 0; + v1.x = 0; } else { skip = rect.right - _outwidth; if (skip <= 0) { @@ -775,7 +774,7 @@ byte AkosRenderer::codec1(int xmoveCur, int ymoveCur) { if (skip > 0) { v1.skip_width -= skip; codec1_ignorePakCols(skip); - cur_x = _outwidth - 1; + v1.x = _outwidth - 1; } else { skip = -1 - rect.left; if (skip <= 0) @@ -785,9 +784,6 @@ byte AkosRenderer::codec1(int xmoveCur, int ymoveCur) { } } - v1.x = cur_x; - v1.y = cur_y; - if (v1.skip_width <= 0 || _height <= 0) return 0; diff --git a/scumm/costume.cpp b/scumm/costume.cpp index 127787fd4f..7b9f4282ff 100644 --- a/scumm/costume.cpp +++ b/scumm/costume.cpp @@ -74,12 +74,12 @@ byte CostumeRenderer::mainRoutine(int xmoveCur, int ymoveCur) { byte drawFlag = 1; bool use_scaling; byte startScaleIndexX; - byte newAmiCost; int ex1, ex2; Common::Rect rect; int step; - newAmiCost = (_vm->_version == 5) && (_vm->_features & GF_AMIGA); + const int scaletableSize = 128; + const bool newAmiCost = (_vm->_version == 5) && (_vm->_features & GF_AMIGA); CHECK_HEAP @@ -89,7 +89,7 @@ byte CostumeRenderer::mainRoutine(int xmoveCur, int ymoveCur) { v1.mask = 7; v1.shr = 3; } else { - v1.mask = 0xF; + v1.mask = 15; v1.shr = 4; } @@ -106,11 +106,11 @@ byte CostumeRenderer::mainRoutine(int xmoveCur, int ymoveCur) { } } + use_scaling = (_scaleX != 0xFF) || (_scaleY != 0xFF); + v1.x = _actorX; v1.y = _actorY; - use_scaling = (_scaleX != 0xFF) || (_scaleY != 0xFF); - if (use_scaling) { /* Scale direction */ @@ -122,13 +122,13 @@ byte CostumeRenderer::mainRoutine(int xmoveCur, int ymoveCur) { if (_mirror) { /* Adjust X position */ - startScaleIndexX = _scaleIndexX = 128 - xmoveCur; + startScaleIndexX = _scaleIndexX = scaletableSize - xmoveCur; for (i = 0; i < xmoveCur; i++) { - if (cost_scaleTable[_scaleIndexX++] < _scaleX) + if (v1.scaletable[_scaleIndexX++] < _scaleX) v1.x -= v1.scaleXstep; } - rect.right = rect.left = v1.x; + rect.left = rect.right = v1.x; _scaleIndexX = startScaleIndexX; for (i = 0; i < _width; i++) { @@ -136,19 +136,19 @@ byte CostumeRenderer::mainRoutine(int xmoveCur, int ymoveCur) { skip++; startScaleIndexX = _scaleIndexX; } - if (cost_scaleTable[_scaleIndexX++] < _scaleX) + if (v1.scaletable[_scaleIndexX++] < _scaleX) rect.right++; } } else { /* No mirror */ /* Adjust X position */ - startScaleIndexX = _scaleIndexX = xmoveCur + 128; + startScaleIndexX = _scaleIndexX = xmoveCur + scaletableSize; for (i = 0; i < xmoveCur; i++) { - if (cost_scaleTable[_scaleIndexX--] < _scaleX) + if (v1.scaletable[_scaleIndexX--] < _scaleX) v1.x += v1.scaleXstep; } - rect.right = rect.left = v1.x; + rect.left = rect.right = v1.x; _scaleIndexX = startScaleIndexX; for (i = 0; i < _width; i++) { @@ -156,7 +156,7 @@ byte CostumeRenderer::mainRoutine(int xmoveCur, int ymoveCur) { startScaleIndexX = _scaleIndexX; skip++; } - if (cost_scaleTable[_scaleIndexX--] < _scaleX) + if (v1.scaletable[_scaleIndexX--] < _scaleX) rect.left--; } } @@ -171,20 +171,20 @@ byte CostumeRenderer::mainRoutine(int xmoveCur, int ymoveCur) { step = 1; } - _scaleIndexY = 128 - ymoveCur; + _scaleIndexY = scaletableSize - ymoveCur; for (i = 0; i < ymoveCur; i++) { - if (cost_scaleTable[_scaleIndexY++] < _scaleY) + if (v1.scaletable[_scaleIndexY++] < _scaleY) v1.y -= step; } rect.top = rect.bottom = v1.y; - _scaleIndexY = 128 - ymoveCur; + _scaleIndexY = scaletableSize - ymoveCur; for (i = 0; i < _height; i++) { - if (cost_scaleTable[_scaleIndexY++] < _scaleY) + if (v1.scaletable[_scaleIndexY++] < _scaleY) rect.bottom++; } - _scaleIndexY = 128 - ymoveCur; + _scaleIndexY = scaletableSize - ymoveCur; } else { if (!_mirror) xmoveCur = -xmoveCur; @@ -498,14 +498,14 @@ void CostumeRenderer::proc3_ami() { if (!len) len = *src++; do { - if (_scaleY == 255 || cost_scaleTable[_scaleIndexY] < _scaleY) { + if (_scaleY == 255 || v1.scaletable[_scaleIndexY] < _scaleY) { masked = (y < 0 || y >= _outheight) || (v1.mask_ptr && (mask[0] & maskbit)); if (color && v1.x >= 0 && v1.x < _outwidth && !masked) { *dst = _palette[color]; } - if (_scaleX == 255 || cost_scaleTable[_scaleIndexX] < _scaleX) { + if (_scaleX == 255 || v1.scaletable[_scaleIndexX] < _scaleX) { v1.x += v1.scaleXstep; dst += v1.scaleXstep; maskbit = revBitMask[v1.x & 7]; |