diff options
author | Max Horn | 2003-05-29 02:46:06 +0000 |
---|---|---|
committer | Max Horn | 2003-05-29 02:46:06 +0000 |
commit | 0a6daf767f2647e5799dffa6af01047545445dc5 (patch) | |
tree | 0e84398a69d29ef09a157450b7c809acf935d318 | |
parent | 59acd18cee517101ad900c1522764350f198605b (diff) | |
download | scummvm-rg350-0a6daf767f2647e5799dffa6af01047545445dc5.tar.gz scummvm-rg350-0a6daf767f2647e5799dffa6af01047545445dc5.tar.bz2 scummvm-rg350-0a6daf767f2647e5799dffa6af01047545445dc5.zip |
more costume/akos changes
svn-id: r8074
-rw-r--r-- | scumm/akos.cpp | 28 | ||||
-rw-r--r-- | scumm/akos.h | 2 | ||||
-rw-r--r-- | scumm/base-costume.h | 10 | ||||
-rw-r--r-- | scumm/costume.cpp | 105 | ||||
-rw-r--r-- | scumm/costume.h | 11 |
5 files changed, 79 insertions, 77 deletions
diff --git a/scumm/akos.cpp b/scumm/akos.cpp index 923f550846..f04b2d2ac5 100644 --- a/scumm/akos.cpp +++ b/scumm/akos.cpp @@ -333,7 +333,7 @@ void AkosRenderer::codec1_genericDecode() { color = v1.repcolor; height = _height; - scaleytab = &v1.scaletable[v1.tmp_y]; + scaleytab = &v1.scaletable[v1.scaleYindex]; maskbit = revBitMask[v1.x & 7]; mask = v1.mask_ptr + (v1.x >> 3); @@ -363,9 +363,9 @@ void AkosRenderer::codec1_genericDecode() { height = _height; y = v1.y; - scaleytab = &v1.scaletable[v1.tmp_y]; + scaleytab = &v1.scaletable[v1.scaleYindex]; - if (v1.scaletable[v1.tmp_x] < _scaleX) { + if (v1.scaletable[v1.scaleXindex] < _scaleX) { v1.x += v1.scaleXstep; if (v1.x < 0 || v1.x >= _vm->_screenWidth) return; @@ -373,7 +373,7 @@ void AkosRenderer::codec1_genericDecode() { v1.destptr += v1.scaleXstep; } mask = v1.mask_ptr + (v1.x >> 3); - v1.tmp_x += v1.scaleXstep; + v1.scaleXindex += v1.scaleXstep; dst = v1.destptr; } StartPos:; @@ -396,7 +396,7 @@ void AkosRenderer::codec1_spec1() { color = v1.repcolor; height = _height; - scaleytab = &v1.scaletable[v1.tmp_y]; + scaleytab = &v1.scaletable[v1.scaleYindex]; maskbit = revBitMask[v1.x & 7]; mask = v1.mask_ptr + (v1.x >> 3); @@ -429,9 +429,9 @@ void AkosRenderer::codec1_spec1() { height = _height; y = v1.y; - scaleytab = &v1.scaletable[v1.tmp_y]; + scaleytab = &v1.scaletable[v1.scaleYindex]; - if (v1.scaletable[v1.tmp_x] < _scaleX) { + if (v1.scaletable[v1.scaleXindex] < _scaleX) { v1.x += v1.scaleXstep; if (v1.x < 0 || v1.x >= _vm->_screenWidth) return; @@ -439,7 +439,7 @@ void AkosRenderer::codec1_spec1() { v1.destptr += v1.scaleXstep; } mask = v1.mask_ptr + (v1.x >> 3); - v1.tmp_x += v1.scaleXstep; + v1.scaleXindex += v1.scaleXstep; dst = v1.destptr; } StartPos:; @@ -466,7 +466,7 @@ void AkosRenderer::codec1_spec3() { color = v1.repcolor; height = _height; - scaleytab = &v1.scaletable[v1.tmp_y]; + scaleytab = &v1.scaletable[v1.scaleYindex]; maskbit = revBitMask[v1.x & 7]; mask = v1.mask_ptr + (v1.x >> 3); @@ -502,9 +502,9 @@ void AkosRenderer::codec1_spec3() { height = _height; y = v1.y; - scaleytab = &v1.scaletable[v1.tmp_y]; + scaleytab = &v1.scaletable[v1.scaleYindex]; - if (v1.scaletable[v1.tmp_x] < _scaleX) { + if (v1.scaletable[v1.scaleXindex] < _scaleX) { v1.x += v1.scaleXstep; if (v1.x < 0 || v1.x >= _vm->_screenWidth) return; @@ -512,7 +512,7 @@ void AkosRenderer::codec1_spec3() { v1.destptr += v1.scaleXstep; } mask = v1.mask_ptr + (v1.x >> 3); - v1.tmp_x += v1.scaleXstep; + v1.scaleXindex += v1.scaleXstep; dst = v1.destptr; } StartPos:; @@ -761,8 +761,8 @@ byte AkosRenderer::codec1() { tmp_y = 0x180; } - v1.tmp_x = startScaleIndexX; - v1.tmp_y = tmp_y; + v1.scaleXindex = startScaleIndexX; + v1.scaleYindex = tmp_y; v1.skip_width = _width; v1.scaleXstep = -1; diff --git a/scumm/akos.h b/scumm/akos.h index a91dc1f459..dc8d047983 100644 --- a/scumm/akos.h +++ b/scumm/akos.h @@ -32,7 +32,6 @@ struct AkosOffset; class AkosRenderer : public BaseCostumeRenderer { protected: uint16 codec; - const byte *_srcptr; // movement of cel to decode int _xmoveCur, _ymoveCur; @@ -62,7 +61,6 @@ protected: public: AkosRenderer(Scumm *scumm) : BaseCostumeRenderer(scumm) { - _srcptr = 0; akos = 0; akhd = 0; akpl = 0; diff --git a/scumm/base-costume.h b/scumm/base-costume.h index fcd638abab..23cd56d9b0 100644 --- a/scumm/base-costume.h +++ b/scumm/base-costume.h @@ -57,7 +57,7 @@ public: int _draw_top, _draw_bottom; - // Destination params + // Destination byte *_outptr; uint _outwidth, _outheight; @@ -65,6 +65,9 @@ protected: Scumm *_vm; int32 _numStrips; + // Source pointer + const byte *_srcptr; + // current move offset int _xmove, _ymove; @@ -75,14 +78,14 @@ protected: int _width, _height; struct { - /* codec stuff */ + // Parameters for the original ("V1") costume codec. const byte *scaletable; byte mask, shr; byte repcolor; byte replen; int scaleXstep; int x, y; - int tmp_x, tmp_y; + int scaleXindex, scaleYindex; int skip_width; byte *destptr; const byte *mask_ptr; @@ -101,6 +104,7 @@ public: _vm = scumm; _numStrips = _vm->gdi._numStrips; + _srcptr = 0; _xmove = _ymove = 0; _mirror = false; _width = _height = 0; diff --git a/scumm/costume.cpp b/scumm/costume.cpp index fe7d485999..067b96be68 100644 --- a/scumm/costume.cpp +++ b/scumm/costume.cpp @@ -78,7 +78,7 @@ const byte cost_scaleTable[256] = { }; byte CostumeRenderer::mainRoutine() { - int xmove, ymove, i, s; + int xmove, ymove, i, skip; byte drawFlag = 1; uint scal; bool use_scaling; @@ -86,6 +86,7 @@ byte CostumeRenderer::mainRoutine() { int ex1, ex2; int y_top, y_bottom; int x_left, x_right; + int step; const CostumeInfo *costumeInfo; CHECK_HEAP @@ -126,26 +127,26 @@ byte CostumeRenderer::mainRoutine() { use_scaling = (_scaleX != 0xFF) || (_scaleY != 0xFF); - s = 0; + skip = 0; if (use_scaling) { - _scaleIndexXStep = -1; + v1.scaleXstep = -1; if (xmove < 0) { xmove = -xmove; - _scaleIndexXStep = 1; + v1.scaleXstep = 1; } if (_mirror) { startScaleIndexX = _scaleIndexX = 128 - xmove; for (i = 0; i < xmove; i++) { if (cost_scaleTable[_scaleIndexX++] < _scaleX) - v1.x -= _scaleIndexXStep; + v1.x -= v1.scaleXstep; } x_right = x_left = v1.x; _scaleIndexX = startScaleIndexX; for (i = 0; i < _width; i++) { if (x_right < 0) { - s++; + skip++; startScaleIndexX = _scaleIndexX; } scal = cost_scaleTable[_scaleIndexX++]; @@ -157,13 +158,13 @@ byte CostumeRenderer::mainRoutine() { for (i = 0; i < xmove; i++) { scal = cost_scaleTable[_scaleIndexX--]; if (scal < _scaleX) - v1.x += _scaleIndexXStep; + v1.x += v1.scaleXstep; } x_right = x_left = v1.x; _scaleIndexX = startScaleIndexX; for (i = 0; i < _width; i++) { if (x_left > (_vm->_screenWidth - 1)) { - s++; + skip++; startScaleIndexX = _scaleIndexX; } scal = cost_scaleTable[_scaleIndexX--]; @@ -172,18 +173,19 @@ byte CostumeRenderer::mainRoutine() { } } _scaleIndexX = startScaleIndexX; - if (s) - s--; - _scaleIndexYStep = -1; + if (skip) + skip--; + + step = -1; if (ymove < 0) { ymove = -ymove; - _scaleIndexYStep = 1; + step = 1; } _scaleIndexY = 128 - ymove; for (i = 0; i < ymove; i++) { scal = cost_scaleTable[_scaleIndexY++]; if (scal < _scaleY) - v1.y -= _scaleIndexYStep; + v1.y -= step; } y_top = y_bottom = v1.y; _scaleIndexY = 128 - ymove; @@ -209,10 +211,9 @@ byte CostumeRenderer::mainRoutine() { y_bottom = y_top + _height; } - _scaleIndexXStep = -1; + v1.scaleXstep = -1; if (_mirror) - _scaleIndexXStep = 1; - _ypostop = v1.y; + v1.scaleXstep = 1; _vm->updateDirtyRect(0, x_left, x_right + 1, y_top, y_bottom, _dirty_id); @@ -225,34 +226,34 @@ byte CostumeRenderer::mainRoutine() { if (_mirror) { if (!use_scaling) - s = -v1.x; - if (s > 0) { - _width2 -= s; - ignorePakCols(s); + skip = -v1.x; + if (skip > 0) { + _width2 -= skip; + ignorePakCols(skip); v1.x = 0; _docontinue = 1; } else { - s = x_right - _vm->_screenWidth; - if (s <= 0) { + skip = x_right - _vm->_screenWidth; + if (skip <= 0) { drawFlag = 2; } else { - _width2 -= s; + _width2 -= skip; } } } else { if (!use_scaling) - s = x_right - _vm->_screenWidth; - if (s > 0) { - _width2 -= s; - ignorePakCols(s); + skip = x_right - _vm->_screenWidth; + if (skip > 0) { + _width2 -= skip; + ignorePakCols(skip); v1.x = _vm->_screenWidth - 1; _docontinue = 1; } else { - s = -1 - x_left; - if (s <= 0) + skip = -1 - x_left; + if (skip <= 0) drawFlag = 2; else - _width2 -= s; + _width2 -= skip; } } @@ -310,7 +311,7 @@ void CostumeRenderer::proc3() { const byte *mask, *src; byte *dst; byte maskbit, len, height, pcolor, width; - int color, t; + int color; uint y; bool masked; @@ -359,17 +360,17 @@ void CostumeRenderer::proc3() { if (!--width) return; height = _height; - y = _ypostop; + y = v1.y; + _scaleIndexY = _scaleIndexYTop; - t = _scaleIndexX; - _scaleIndexX += _scaleIndexXStep; - if (_scaleX == 255 || cost_scaleTable[t] < _scaleX) { - v1.x += _scaleIndexXStep; + if (_scaleX == 255 || cost_scaleTable[_scaleIndexX] < _scaleX) { + v1.x += v1.scaleXstep; if (v1.x < 0 || v1.x >= _vm->_screenWidth) return; maskbit = revBitMask[v1.x & 7]; - v1.destptr += _scaleIndexXStep; + v1.destptr += v1.scaleXstep; } + _scaleIndexX += v1.scaleXstep; dst = v1.destptr; mask = v1.mask_ptr + (v1.x >> 3); } @@ -382,7 +383,7 @@ void CostumeRenderer::proc3_ami() { const byte *mask, *src; byte *dst; byte maskbit, len, height, width; - int color, t; + int color; uint y; bool masked; int oldXpos, oldScaleIndexX; @@ -411,13 +412,12 @@ void CostumeRenderer::proc3_ami() { *dst = _palette[color]; } - t = _scaleIndexX; - _scaleIndexX = t + _scaleIndexXStep; - if (_scaleX == 255 || cost_scaleTable[t] < _scaleX) { - v1.x += _scaleIndexXStep; - dst += _scaleIndexXStep; + if (_scaleX == 255 || cost_scaleTable[_scaleIndexX] < _scaleX) { + v1.x += v1.scaleXstep; + dst += v1.scaleXstep; maskbit = revBitMask[v1.x & 7]; } + _scaleIndexX += v1.scaleXstep; mask = v1.mask_ptr + (v1.x >> 3); } if (!--width) { @@ -487,19 +487,24 @@ void LoadedCostume::loadCostume(int id) { byte CostumeRenderer::drawLimb(const CostumeData &cost, int limb) { int i; int code; + const byte *frameptr; + // If the specified limb is stopped or not existing, do nothing. if (cost.curpos[limb] == 0xFFFF || cost.stopped & (1 << limb)) return 0; + // Determine the position the limb is at i = cost.curpos[limb] & 0x7FFF; - - _frameptr = _loaded._baseptr + READ_LE_UINT16(_loaded._ptr + _loaded._numColors + limb * 2 + 10); - - code = _loaded._dataptr[i] & 0x7F; - _srcptr = _loaded._baseptr + READ_LE_UINT16(_frameptr + code * 2); + // Get the base pointer for that limb + frameptr = _loaded._baseptr + READ_LE_UINT16(_loaded._ptr + _loaded._numColors + limb * 2 + 10); + + // Determine the offset to the costume data for the limb at position i + code = _loaded._dataptr[i] & 0x7F; + // Code 0x7B indicates a limb for which there is nothing to draw if (code != 0x7B) { + _srcptr = _loaded._baseptr + READ_LE_UINT16(frameptr + code * 2); if (!(_vm->_features & GF_OLD256) || code < 0x79) return mainRoutine(); } @@ -513,11 +518,11 @@ int Scumm::cost_frameToAnim(Actor *a, int frame) { } void Scumm::cost_decodeData(Actor *a, int frame, uint usemask) { - byte *r; + const byte *r; uint mask, j; int i; byte extra, cmd; - byte *dataptr; + const byte *dataptr; int anim; LoadedCostume lc(this); diff --git a/scumm/costume.h b/scumm/costume.h index cb1de49675..45d6abf432 100644 --- a/scumm/costume.h +++ b/scumm/costume.h @@ -28,9 +28,9 @@ protected: Scumm *_vm; public: - byte *_ptr; - byte *_baseptr; - byte *_dataptr; + const byte *_ptr; + const byte *_baseptr; + const byte *_dataptr; byte _numColors; LoadedCostume(Scumm *vm) : _vm(vm), _ptr(0), _dataptr(0), _numColors(0) {} @@ -47,16 +47,11 @@ class CostumeRenderer : public BaseCostumeRenderer { protected: LoadedCostume _loaded; - byte *_frameptr; - const byte *_srcptr; bool _use_mask, _use_charset_mask; byte _width2; - int _scaleIndexXStep; - int _scaleIndexYStep; byte _scaleIndexX; /* must wrap at 256 */ byte _scaleIndexY, _scaleIndexYTop; - int _ypostop; byte _docontinue; byte _palette[32]; |