From 85ec4ee0b50cafba5663ca91958582f60438dcc2 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 25 Nov 2004 23:36:02 +0000 Subject: Turn the v1 member in the costume renderers into a function local object (used to be a member var) svn-id: r15887 --- scumm/akos.cpp | 9 +++++---- scumm/akos.h | 2 +- scumm/base-costume.cpp | 2 +- scumm/base-costume.h | 9 ++++----- scumm/costume.cpp | 18 ++++++++++-------- scumm/costume.h | 6 +++--- 6 files changed, 24 insertions(+), 22 deletions(-) (limited to 'scumm') diff --git a/scumm/akos.cpp b/scumm/akos.cpp index 9756a1622b..bf615c6fe1 100644 --- a/scumm/akos.cpp +++ b/scumm/akos.cpp @@ -500,7 +500,7 @@ byte AkosRenderer::drawLimb(const Actor *a, int limb) { return result; } -void AkosRenderer::codec1_genericDecode() { +void AkosRenderer::codec1_genericDecode(Codec1 &v1) { const byte *mask, *src; byte *dst; byte len, maskbit; @@ -736,6 +736,7 @@ byte AkosRenderer::codec1(int xmoveCur, int ymoveCur) { Common::Rect rect; int step; byte drawFlag = 1; + Codec1 v1; const int scaletableSize = (_vm->_features & GF_HUMONGOUS) ? 128 : 384; @@ -886,7 +887,7 @@ byte AkosRenderer::codec1(int xmoveCur, int ymoveCur) { skip = -v1.x; if (skip > 0) { v1.skip_width -= skip; - codec1_ignorePakCols(skip); + codec1_ignorePakCols(v1, skip); v1.x = 0; } else { skip = rect.right - _out.w; @@ -901,7 +902,7 @@ byte AkosRenderer::codec1(int xmoveCur, int ymoveCur) { skip = rect.right - _out.w + 1; if (skip > 0) { v1.skip_width -= skip; - codec1_ignorePakCols(skip); + codec1_ignorePakCols(v1, skip) ; v1.x = _out.w - 1; } else { skip = -1 - rect.left; @@ -934,7 +935,7 @@ byte AkosRenderer::codec1(int xmoveCur, int ymoveCur) { v1.destptr = (byte *)_out.pixels + v1.y * _out.pitch + v1.x; - codec1_genericDecode(); + codec1_genericDecode(v1); return drawFlag; } diff --git a/scumm/akos.h b/scumm/akos.h index 30e24ea1ff..4985e8b46e 100644 --- a/scumm/akos.h +++ b/scumm/akos.h @@ -91,7 +91,7 @@ protected: byte drawLimb(const Actor *a, int limb); byte codec1(int xmoveCur, int ymoveCur); - void codec1_genericDecode(); + void codec1_genericDecode(Codec1 &v1); byte codec5(int xmoveCur, int ymoveCur); byte codec16(int xmoveCur, int ymoveCur); byte codec32(int xmoveCur, int ymoveCur); diff --git a/scumm/base-costume.cpp b/scumm/base-costume.cpp index 386c260de3..01ffde8e28 100644 --- a/scumm/base-costume.cpp +++ b/scumm/base-costume.cpp @@ -51,7 +51,7 @@ byte BaseCostumeRenderer::drawCostume(const VirtScreen &vs, int numStrips, const return result; } -void BaseCostumeRenderer::codec1_ignorePakCols(int num) { +void BaseCostumeRenderer::codec1_ignorePakCols(Codec1 &v1, int num) { num *= _height; do { diff --git a/scumm/base-costume.h b/scumm/base-costume.h index e08d9ba904..df00c8de22 100644 --- a/scumm/base-costume.h +++ b/scumm/base-costume.h @@ -86,7 +86,7 @@ protected: // width and height of cel to decode int _width, _height; - struct { + struct Codec1 { // Parameters for the original ("V1") costume codec. const byte *scaletable; byte mask, shr; @@ -98,8 +98,8 @@ protected: int skip_width; byte *destptr; const byte *mask_ptr; - } v1; - + }; + public: BaseCostumeRenderer(ScummEngine *scumm) { _actorID = 0; @@ -128,10 +128,9 @@ public: byte drawCostume(const VirtScreen &vs, int numStrips, const Actor *a, bool drawToBackBuf); protected: - virtual byte drawLimb(const Actor *a, int limb) = 0; - void codec1_ignorePakCols(int num); + void codec1_ignorePakCols(Codec1 &v1, int num); }; } // End of namespace Scumm diff --git a/scumm/costume.cpp b/scumm/costume.cpp index 27273b61c2..5e76341f94 100644 --- a/scumm/costume.cpp +++ b/scumm/costume.cpp @@ -83,6 +83,8 @@ byte CostumeRenderer::mainRoutine(int xmoveCur, int ymoveCur) { int ex1, ex2; Common::Rect rect; int step; + Codec1 v1; + const int scaletableSize = 128; const bool newAmiCost = (_vm->_version == 5) && (_vm->_features & GF_AMIGA); @@ -234,7 +236,7 @@ byte CostumeRenderer::mainRoutine(int xmoveCur, int ymoveCur) { if (skip > 0) { if (!newAmiCost && _loaded._format != 0x57) { v1.skip_width -= skip; - codec1_ignorePakCols(skip); + codec1_ignorePakCols(v1, skip); v1.x = 0; } } else { @@ -251,7 +253,7 @@ byte CostumeRenderer::mainRoutine(int xmoveCur, int ymoveCur) { if (skip > 0) { if (!newAmiCost && _loaded._format != 0x57) { v1.skip_width -= skip; - codec1_ignorePakCols(skip); + codec1_ignorePakCols(v1, skip); v1.x = _out.w - 1; } } else { @@ -301,11 +303,11 @@ byte CostumeRenderer::mainRoutine(int xmoveCur, int ymoveCur) { if (_loaded._format == 0x57) { // The v1 costume renderer needs the actor number, which is // the same thing as the costume renderer's _actorID. - procC64(_actorID); + procC64(v1, _actorID); } else if (newAmiCost) - proc3_ami(); + proc3_ami(v1); else - proc3(); + proc3(v1); CHECK_HEAP return drawFlag; @@ -329,7 +331,7 @@ static const int v1MMActorPalatte2[25] = { dst[p + 1] = palette[pcolor]; \ } -void CostumeRenderer::procC64(int actor) { +void CostumeRenderer::procC64(Codec1 &v1, int actor) { const byte *mask, *src; byte *dst; byte len; @@ -404,7 +406,7 @@ void CostumeRenderer::procC64(int actor) { #undef LINE #undef MASK_AT -void CostumeRenderer::proc3() { +void CostumeRenderer::proc3(Codec1 &v1) { #ifdef __PALM_OS__ ARM_START(CostumeProc3Type) ARM_ADDP(v1) @@ -499,7 +501,7 @@ void CostumeRenderer::proc3() { } while (1); } -void CostumeRenderer::proc3_ami() { +void CostumeRenderer::proc3_ami(Codec1 &v1) { const byte *mask, *src; byte *dst; byte maskbit, len, height, width; diff --git a/scumm/costume.h b/scumm/costume.h index 50a7f43b0c..1d58650ac7 100644 --- a/scumm/costume.h +++ b/scumm/costume.h @@ -71,10 +71,10 @@ public: protected: byte drawLimb(const Actor *a, int limb); - void proc3(); - void proc3_ami(); + void proc3(Codec1 &v1); + void proc3_ami(Codec1 &v1); - void procC64(int actor); + void procC64(Codec1 &v1, int actor); byte mainRoutine(int xmoveCur, int ymoveCur); }; -- cgit v1.2.3