diff options
author | Max Horn | 2003-05-29 10:31:05 +0000 |
---|---|---|
committer | Max Horn | 2003-05-29 10:31:05 +0000 |
commit | c62c448a35c0c0b044b953c901ae4d47fe362957 (patch) | |
tree | 8832d1c148856ee3ae2e28600a721d7ba6ad5c3b | |
parent | b69ea5bec88e534ae31a1e20511fe66dec18e44f (diff) | |
download | scummvm-rg350-c62c448a35c0c0b044b953c901ae4d47fe362957.tar.gz scummvm-rg350-c62c448a35c0c0b044b953c901ae4d47fe362957.tar.bz2 scummvm-rg350-c62c448a35c0c0b044b953c901ae4d47fe362957.zip |
more costuem code merging
svn-id: r8088
-rw-r--r-- | scumm/akos.cpp | 22 | ||||
-rw-r--r-- | scumm/akos.h | 1 | ||||
-rw-r--r-- | scumm/base-costume.cpp | 62 | ||||
-rw-r--r-- | scumm/base-costume.h | 20 | ||||
-rw-r--r-- | scumm/costume.cpp | 65 | ||||
-rw-r--r-- | scumm/costume.h | 3 | ||||
-rw-r--r-- | scumm/module.mk | 1 |
7 files changed, 93 insertions, 81 deletions
diff --git a/scumm/akos.cpp b/scumm/akos.cpp index be05b45a8b..9789e69a15 100644 --- a/scumm/akos.cpp +++ b/scumm/akos.cpp @@ -875,28 +875,6 @@ byte AkosRenderer::codec1(int xmoveCur, int ymoveCur) { } -void AkosRenderer::codec1_ignorePakCols(int num) { - int n; - - n = _height; - if (num > 1) - n *= num; - - do { - v1.repcolor = *_srcptr++; - v1.replen = v1.repcolor & v1.mask; - if (v1.replen == 0) { - v1.replen = *_srcptr++; - } - do { - if (!--n) { - v1.repcolor >>= v1.shr; - return; - } - } while (--v1.replen); - } while (1); -} - byte AkosRenderer::codec5(int xmoveCur, int ymoveCur) { int32 clip_left, clip_right, clip_top, clip_bottom, maxw, maxh, tmp_x, tmp_y; diff --git a/scumm/akos.h b/scumm/akos.h index 6dc8a11062..4229e8c6b1 100644 --- a/scumm/akos.h +++ b/scumm/akos.h @@ -79,7 +79,6 @@ protected: void codec1_spec2(); void codec1_spec3(); void codec1_genericDecode(); - void codec1_ignorePakCols(int num); byte codec5(int _xmoveCur, int _ymoveCur); diff --git a/scumm/base-costume.cpp b/scumm/base-costume.cpp new file mode 100644 index 0000000000..f1838efbdd --- /dev/null +++ b/scumm/base-costume.cpp @@ -0,0 +1,62 @@ +/* ScummVM - Scumm Interpreter + * Copyright (C) 2001 Ludvig Strigeus + * Copyright (C) 2001-2003 The ScummVM project + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Header$ + * + */ + +#include "base-costume.h" + + +byte BaseCostumeRenderer::drawCostume(const CostumeData &cost) { + int i; + byte result = 0; + + if (_vm->_features & GF_OLD_BUNDLE) { + _xmove = -72; + _ymove = -100; + } else { + _xmove = _ymove = 0; + } + for (i = 0; i < 16; i++) + result |= drawLimb(cost, i); + return result; +} + +void BaseCostumeRenderer::codec1_ignorePakCols(int num) { + int n; + + n = _height; + if (num > 1) + n *= num; + + do { + v1.repcolor = *_srcptr++; + v1.replen = v1.repcolor & v1.mask; + if (v1.replen == 0) { + v1.replen = *_srcptr++; + } + do { + if (!--n) { + v1.repcolor >>= v1.shr; + return; + } + } while (--v1.replen); + } while (1); +} + diff --git a/scumm/base-costume.h b/scumm/base-costume.h index 23cd56d9b0..4211a954d7 100644 --- a/scumm/base-costume.h +++ b/scumm/base-costume.h @@ -24,6 +24,7 @@ #define BASE_COSTUME_H #include "scummsys.h" +#include "actor.h" // for CostumeData #if !defined(__GNUC__) #pragma START_PACK_STRUCTS @@ -39,6 +40,7 @@ struct CostumeInfo { #pragma END_PACK_STRUCTS #endif +class Actor; class Scumm; /* @@ -117,24 +119,14 @@ public: virtual void setFacing(Actor *a) = 0; virtual void setCostume(int costume) = 0; - byte drawCostume(const CostumeData &cost) { - int i; - byte result = 0; - - if (_vm->_features & GF_OLD_BUNDLE) { - _xmove = -72; - _ymove = -100; - } else { - _xmove = _ymove = 0; - } - for (i = 0; i < 16; i++) - result |= drawLimb(cost, i); - return result; - } + byte drawCostume(const CostumeData &cost); protected: + virtual byte drawLimb(const CostumeData &cost, int limb) = 0; + void codec1_ignorePakCols(int num); + }; #endif diff --git a/scumm/costume.cpp b/scumm/costume.cpp index d4b692c710..817e551952 100644 --- a/scumm/costume.cpp +++ b/scumm/costume.cpp @@ -28,28 +28,6 @@ const byte revBitMask[8] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 }; -void CostumeRenderer::ignorePakCols(int num) { - int n; - - n = _height; - if (num > 1) - n *= num; - - do { - v1.repcolor = *_srcptr++; - v1.replen = v1.repcolor & v1.mask; - if (v1.replen == 0) { - v1.replen = *_srcptr++; - } - do { - if (!--n) { - v1.repcolor >>= v1.shr; - return; - } - } while (--v1.replen); - } while (1); -} - const byte cost_scaleTable[256] = { 255, 253, 125, 189, 61, 221, 93, 157, 29, 237, 109, 173, 45, 205, 77, 141, 13, 245, 117, 181, @@ -77,8 +55,8 @@ const byte cost_scaleTable[256] = { 238, 30, 158, 94, 222, 62, 190, 126, 254 }; -byte CostumeRenderer::mainRoutine() { - int xmoveCur, ymoveCur, i, skip; +byte CostumeRenderer::mainRoutine(int xmoveCur, int ymoveCur) { + int i, skip; byte drawFlag = 1; uint scal; bool use_scaling; @@ -87,7 +65,6 @@ byte CostumeRenderer::mainRoutine() { int y_top, y_bottom; int x_left, x_right; int step; - const CostumeInfo *costumeInfo; CHECK_HEAP v1.mask = 0xF; @@ -97,19 +74,6 @@ byte CostumeRenderer::mainRoutine() { v1.shr = 3; } - // FIXME: those are here just in case... you never now... - assert(_srcptr[1] == 0); - assert(_srcptr[3] == 0); - - costumeInfo = (const CostumeInfo *)_srcptr; - _width = _width2 = READ_LE_UINT16(&costumeInfo->width); - _height = READ_LE_UINT16(&costumeInfo->height); - xmoveCur = _xmove + (int16)READ_LE_UINT16(&costumeInfo->rel_x); - ymoveCur = _ymove + (int16)READ_LE_UINT16(&costumeInfo->rel_y); - _xmove += (int16)READ_LE_UINT16(&costumeInfo->move_x); - _ymove -= (int16)READ_LE_UINT16(&costumeInfo->move_y); - _srcptr += 12; - switch (_loaded._ptr[7] & 0x7F) { case 0x60: case 0x61: @@ -229,7 +193,7 @@ byte CostumeRenderer::mainRoutine() { skip = -v1.x; if (skip > 0) { _width2 -= skip; - ignorePakCols(skip); + codec1_ignorePakCols(skip); v1.x = 0; _docontinue = 1; } else { @@ -245,7 +209,7 @@ byte CostumeRenderer::mainRoutine() { skip = x_right - _vm->_screenWidth; if (skip > 0) { _width2 -= skip; - ignorePakCols(skip); + codec1_ignorePakCols(skip); v1.x = _vm->_screenWidth - 1; _docontinue = 1; } else { @@ -505,8 +469,25 @@ byte CostumeRenderer::drawLimb(const CostumeData &cost, int limb) { // 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(); + if (!(_vm->_features & GF_OLD256) || code < 0x79) { + const CostumeInfo *costumeInfo; + int xmoveCur, ymoveCur; + + // FIXME: those are here just in case... you never now... + assert(_srcptr[1] == 0); + assert(_srcptr[3] == 0); + + costumeInfo = (const CostumeInfo *)_srcptr; + _width = _width2 = READ_LE_UINT16(&costumeInfo->width); + _height = READ_LE_UINT16(&costumeInfo->height); + xmoveCur = _xmove + (int16)READ_LE_UINT16(&costumeInfo->rel_x); + ymoveCur = _ymove + (int16)READ_LE_UINT16(&costumeInfo->rel_y); + _xmove += (int16)READ_LE_UINT16(&costumeInfo->move_x); + _ymove -= (int16)READ_LE_UINT16(&costumeInfo->move_y); + _srcptr += 12; + + return mainRoutine(xmoveCur, ymoveCur); + } } return 0; diff --git a/scumm/costume.h b/scumm/costume.h index 45d6abf432..1c147dd4ed 100644 --- a/scumm/costume.h +++ b/scumm/costume.h @@ -67,8 +67,7 @@ protected: void proc3(); void proc3_ami(); - byte mainRoutine(); - void ignorePakCols(int num); + byte mainRoutine(int xmoveCur, int ymoveCur); }; #endif diff --git a/scumm/module.mk b/scumm/module.mk index 82f3d25837..33e2efb282 100644 --- a/scumm/module.mk +++ b/scumm/module.mk @@ -3,6 +3,7 @@ MODULE := scumm SCUMM_OBJS = \ scumm/actor.o \ scumm/akos.o \ + scumm/base-costume.o \ scumm/boxes.o \ scumm/bundle.o \ scumm/charset.o \ |