[Scummvm-cvs-logs] CVS: scummvm/scumm base-costume.cpp,NONE,2.1 akos.cpp,1.61,1.62 akos.h,1.18,1.19 base-costume.h,1.6,1.7 costume.cpp,1.46,1.47 costume.h,1.14,1.15 module.mk,1.15,1.16
Max Horn
fingolfin at users.sourceforge.net
Thu May 29 03:32:02 CEST 2003
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv1362
Modified Files:
akos.cpp akos.h base-costume.h costume.cpp costume.h module.mk
Added Files:
base-costume.cpp
Log Message:
more costuem code merging
--- NEW FILE: base-costume.cpp ---
/* 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: /cvsroot/scummvm/scummvm/scumm/base-costume.cpp,v 2.1 2003/05/29 10:31:04 fingolfin Exp $
*
*/
#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);
}
Index: akos.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/akos.cpp,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- akos.cpp 29 May 2003 10:16:00 -0000 1.61
+++ akos.cpp 29 May 2003 10:31:04 -0000 1.62
@@ -875,28 +875,6 @@
}
-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;
Index: akos.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/akos.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- akos.h 29 May 2003 10:16:00 -0000 1.18
+++ akos.h 29 May 2003 10:31:04 -0000 1.19
@@ -79,7 +79,6 @@
void codec1_spec2();
void codec1_spec3();
void codec1_genericDecode();
- void codec1_ignorePakCols(int num);
byte codec5(int _xmoveCur, int _ymoveCur);
Index: base-costume.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/base-costume.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- base-costume.h 29 May 2003 02:46:05 -0000 1.6
+++ base-costume.h 29 May 2003 10:31:04 -0000 1.7
@@ -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 @@
#pragma END_PACK_STRUCTS
#endif
+class Actor;
class Scumm;
/*
@@ -117,23 +119,13 @@
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);
};
Index: costume.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/costume.cpp,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- costume.cpp 29 May 2003 10:16:00 -0000 1.46
+++ costume.cpp 29 May 2003 10:31:04 -0000 1.47
@@ -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 @@
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 @@
int y_top, y_bottom;
int x_left, x_right;
int step;
- const CostumeInfo *costumeInfo;
CHECK_HEAP
v1.mask = 0xF;
@@ -97,19 +74,6 @@
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 @@
skip = -v1.x;
if (skip > 0) {
_width2 -= skip;
- ignorePakCols(skip);
+ codec1_ignorePakCols(skip);
v1.x = 0;
_docontinue = 1;
} else {
@@ -245,7 +209,7 @@
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 @@
// 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;
Index: costume.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/costume.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- costume.h 29 May 2003 02:46:06 -0000 1.14
+++ costume.h 29 May 2003 10:31:05 -0000 1.15
@@ -67,8 +67,7 @@
void proc3();
void proc3_ami();
- byte mainRoutine();
- void ignorePakCols(int num);
+ byte mainRoutine(int xmoveCur, int ymoveCur);
};
#endif
Index: module.mk
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/module.mk,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- module.mk 26 May 2003 22:03:02 -0000 1.15
+++ module.mk 29 May 2003 10:31:05 -0000 1.16
@@ -3,6 +3,7 @@
SCUMM_OBJS = \
scumm/actor.o \
scumm/akos.o \
+ scumm/base-costume.o \
scumm/boxes.o \
scumm/bundle.o \
scumm/charset.o \
More information about the Scummvm-git-logs
mailing list