2007-05-30 21:56:52 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
2003-01-07 17:35:20 +00:00
|
|
|
*
|
|
|
|
* 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.
|
2014-02-18 01:34:24 +00:00
|
|
|
*
|
2003-01-07 17:35:20 +00:00
|
|
|
* 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.
|
2014-02-18 01:34:24 +00:00
|
|
|
*
|
2003-01-07 17:35:20 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2005-10-18 01:30:26 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2003-01-07 17:35:20 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2007-02-19 17:48:19 +00:00
|
|
|
#ifndef SCUMM_BASE_COSTUME_H
|
|
|
|
#define SCUMM_BASE_COSTUME_H
|
2003-01-07 17:35:20 +00:00
|
|
|
|
2003-08-01 12:21:04 +00:00
|
|
|
#include "common/scummsys.h"
|
2003-10-03 18:33:57 +00:00
|
|
|
#include "scumm/actor.h" // for CostumeData
|
|
|
|
|
|
|
|
namespace Scumm {
|
2003-05-28 21:08:56 +00:00
|
|
|
|
2006-07-23 16:13:26 +00:00
|
|
|
#include "common/pack-start.h" // START STRUCT PACKING
|
2003-05-28 21:08:56 +00:00
|
|
|
|
|
|
|
struct CostumeInfo {
|
|
|
|
uint16 width, height;
|
|
|
|
int16 rel_x, rel_y;
|
|
|
|
int16 move_x, move_y;
|
2007-07-01 18:18:43 +00:00
|
|
|
} PACKED_STRUCT;
|
2003-01-07 17:35:20 +00:00
|
|
|
|
2006-07-23 16:13:26 +00:00
|
|
|
#include "common/pack-end.h" // END STRUCT PACKING
|
2003-01-07 17:35:20 +00:00
|
|
|
|
2005-05-15 10:02:13 +00:00
|
|
|
|
|
|
|
extern const byte smallCostumeScaleTable[256];
|
|
|
|
extern const byte bigCostumeScaleTable[768];
|
|
|
|
|
|
|
|
|
2003-05-29 10:31:05 +00:00
|
|
|
class Actor;
|
2003-10-02 22:42:03 +00:00
|
|
|
class ScummEngine;
|
2004-01-05 16:19:14 +00:00
|
|
|
struct VirtScreen;
|
2003-05-28 21:08:56 +00:00
|
|
|
|
2005-03-27 00:42:53 +00:00
|
|
|
class BaseCostumeLoader {
|
|
|
|
protected:
|
|
|
|
ScummEngine *_vm;
|
|
|
|
|
2005-03-27 00:23:38 +00:00
|
|
|
public:
|
2005-03-27 00:42:53 +00:00
|
|
|
BaseCostumeLoader(ScummEngine *vm) : _vm(vm) {}
|
|
|
|
virtual ~BaseCostumeLoader() {}
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2005-03-27 00:23:38 +00:00
|
|
|
virtual void loadCostume(int id) = 0;
|
|
|
|
virtual byte increaseAnims(Actor *a) = 0;
|
2005-03-27 00:42:53 +00:00
|
|
|
virtual void costumeDecodeData(Actor *a, int frame, uint usemask) = 0;
|
2005-03-28 20:34:18 +00:00
|
|
|
|
|
|
|
bool hasManyDirections(int id) { return false; }
|
2005-03-27 00:23:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2003-05-29 17:14:47 +00:00
|
|
|
/**
|
2005-03-27 00:23:38 +00:00
|
|
|
* Base class for both ClassicCostumeRenderer and AkosRenderer.
|
2003-05-28 21:08:56 +00:00
|
|
|
*/
|
2003-06-05 02:46:08 +00:00
|
|
|
class BaseCostumeRenderer {
|
2003-01-07 17:35:20 +00:00
|
|
|
public:
|
2004-09-04 00:18:55 +00:00
|
|
|
Common::Rect _clipOverride;
|
2004-01-05 16:19:14 +00:00
|
|
|
byte _actorID;
|
2003-01-07 17:35:20 +00:00
|
|
|
|
|
|
|
byte _shadow_mode;
|
|
|
|
byte *_shadow_table;
|
|
|
|
|
|
|
|
int _actorX, _actorY;
|
|
|
|
byte _zbuf;
|
|
|
|
byte _scaleX, _scaleY;
|
|
|
|
|
|
|
|
int _draw_top, _draw_bottom;
|
2004-10-12 04:26:02 +00:00
|
|
|
byte _paletteNum;
|
2004-10-12 14:12:20 +00:00
|
|
|
bool _skipLimbs;
|
2004-06-29 11:02:15 +00:00
|
|
|
bool _actorDrawVirScr;
|
2004-01-12 14:09:39 +00:00
|
|
|
|
2003-01-07 17:35:20 +00:00
|
|
|
|
2004-01-05 16:19:14 +00:00
|
|
|
protected:
|
|
|
|
ScummEngine *_vm;
|
|
|
|
|
2003-05-29 02:46:06 +00:00
|
|
|
// Destination
|
2004-10-09 00:06:36 +00:00
|
|
|
Graphics::Surface _out;
|
2003-01-07 17:35:20 +00:00
|
|
|
int32 _numStrips;
|
|
|
|
|
2003-05-29 02:46:06 +00:00
|
|
|
// Source pointer
|
|
|
|
const byte *_srcptr;
|
|
|
|
|
2003-01-07 17:35:20 +00:00
|
|
|
// current move offset
|
|
|
|
int _xmove, _ymove;
|
|
|
|
|
|
|
|
// whether to draw the actor mirrored
|
|
|
|
bool _mirror;
|
|
|
|
|
2009-10-25 14:20:47 +00:00
|
|
|
int _numBlocks;
|
|
|
|
|
2003-01-07 17:35:20 +00:00
|
|
|
// width and height of cel to decode
|
|
|
|
int _width, _height;
|
|
|
|
|
2008-02-03 01:26:12 +00:00
|
|
|
public:
|
2004-11-25 23:36:02 +00:00
|
|
|
struct Codec1 {
|
2003-05-29 02:46:06 +00:00
|
|
|
// Parameters for the original ("V1") costume codec.
|
2008-02-03 01:26:12 +00:00
|
|
|
// These ones are accessed from ARM code. Don't reorder.
|
|
|
|
int x;
|
|
|
|
int y;
|
2003-05-29 02:14:31 +00:00
|
|
|
const byte *scaletable;
|
2008-02-03 01:26:12 +00:00
|
|
|
int skip_width;
|
|
|
|
byte *destptr;
|
|
|
|
const byte *mask_ptr;
|
|
|
|
int scaleXstep;
|
2003-05-29 02:14:31 +00:00
|
|
|
byte mask, shr;
|
|
|
|
byte repcolor;
|
|
|
|
byte replen;
|
2008-02-03 01:26:12 +00:00
|
|
|
// These ones aren't accessed from ARM code.
|
2006-06-16 11:30:23 +00:00
|
|
|
Common::Rect boundsRect;
|
2003-05-29 02:46:06 +00:00
|
|
|
int scaleXindex, scaleYindex;
|
2004-11-25 23:36:02 +00:00
|
|
|
};
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2003-10-02 22:42:03 +00:00
|
|
|
BaseCostumeRenderer(ScummEngine *scumm) {
|
2004-01-05 16:19:14 +00:00
|
|
|
_actorID = 0;
|
2003-01-07 17:35:20 +00:00
|
|
|
_shadow_mode = 0;
|
|
|
|
_shadow_table = 0;
|
|
|
|
_actorX = _actorY = 0;
|
|
|
|
_zbuf = 0;
|
|
|
|
_scaleX = _scaleY = 0;
|
|
|
|
_draw_top = _draw_bottom = 0;
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2003-01-07 17:35:20 +00:00
|
|
|
_vm = scumm;
|
2004-09-24 20:37:24 +00:00
|
|
|
_numStrips = -1;
|
2003-05-29 02:46:06 +00:00
|
|
|
_srcptr = 0;
|
2003-01-07 17:35:20 +00:00
|
|
|
_xmove = _ymove = 0;
|
|
|
|
_mirror = false;
|
|
|
|
_width = _height = 0;
|
2004-10-12 14:12:20 +00:00
|
|
|
_skipLimbs = 0;
|
2004-10-12 04:26:02 +00:00
|
|
|
_paletteNum = 0;
|
2003-01-07 17:35:20 +00:00
|
|
|
}
|
2005-03-27 00:23:38 +00:00
|
|
|
virtual ~BaseCostumeRenderer() {}
|
2003-01-07 17:35:20 +00:00
|
|
|
|
2009-06-04 11:03:45 +00:00
|
|
|
virtual void setPalette(uint16 *palette) = 0;
|
2004-09-30 23:49:46 +00:00
|
|
|
virtual void setFacing(const Actor *a) = 0;
|
2005-10-29 01:59:18 +00:00
|
|
|
virtual void setCostume(int costume, int shadow) = 0;
|
2003-06-05 02:46:08 +00:00
|
|
|
|
2003-01-07 17:35:20 +00:00
|
|
|
|
2004-09-24 21:36:04 +00:00
|
|
|
byte drawCostume(const VirtScreen &vs, int numStrips, const Actor *a, bool drawToBackBuf);
|
2003-01-07 17:35:20 +00:00
|
|
|
|
|
|
|
protected:
|
2004-09-08 21:14:12 +00:00
|
|
|
virtual byte drawLimb(const Actor *a, int limb) = 0;
|
2003-01-07 17:35:20 +00:00
|
|
|
|
2004-11-25 23:36:02 +00:00
|
|
|
void codec1_ignorePakCols(Codec1 &v1, int num);
|
2003-01-07 17:35:20 +00:00
|
|
|
};
|
|
|
|
|
2003-10-03 18:33:57 +00:00
|
|
|
} // End of namespace Scumm
|
|
|
|
|
2005-09-03 20:02:49 +00:00
|
|
|
#endif
|