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
|
|
|
*
|
2021-12-26 18:47:58 +01: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 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
2014-02-18 02:34:24 +01: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 02:34:24 +01:00
|
|
|
*
|
2003-01-07 17:35:20 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
2021-12-26 18:47:58 +01:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
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;
|
2022-09-28 00:12:52 +02:00
|
|
|
int16 relX, relY;
|
|
|
|
int16 moveX, moveY;
|
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;
|
2022-09-28 00:12:52 +02:00
|
|
|
virtual bool 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
|
|
|
|
2022-09-28 00:12:52 +02:00
|
|
|
byte _shadowMode;
|
|
|
|
byte *_shadowTable;
|
2003-01-07 17:35:20 +00:00
|
|
|
|
|
|
|
int _actorX, _actorY;
|
|
|
|
byte _zbuf;
|
|
|
|
byte _scaleX, _scaleY;
|
|
|
|
|
2022-09-28 00:12:52 +02:00
|
|
|
int _drawTop, _drawBottom;
|
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
|
2022-09-28 00:12:52 +02:00
|
|
|
const byte *_srcPtr;
|
2003-05-29 02:46:06 +00:00
|
|
|
|
2003-01-07 17:35:20 +00:00
|
|
|
// current move offset
|
2022-09-28 00:12:52 +02:00
|
|
|
int _xMove, _yMove;
|
2003-01-07 17:35:20 +00:00
|
|
|
|
|
|
|
// 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:
|
2022-09-28 00:12:52 +02:00
|
|
|
struct ByleRLEData {
|
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;
|
2022-09-28 00:12:52 +02:00
|
|
|
const byte *scaleTable;
|
2021-05-03 22:17:52 +01:00
|
|
|
int height;
|
|
|
|
int width;
|
2022-09-28 00:12:52 +02:00
|
|
|
int skipWidth;
|
|
|
|
byte *destPtr;
|
|
|
|
const byte *maskPtr;
|
|
|
|
int scaleXStep;
|
2003-05-29 02:14:31 +00:00
|
|
|
byte mask, shr;
|
2022-09-28 00:12:52 +02:00
|
|
|
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;
|
2022-09-28 00:12:52 +02: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;
|
2022-09-28 00:12:52 +02:00
|
|
|
_shadowMode = 0;
|
|
|
|
_shadowTable = nullptr;
|
2003-01-07 17:35:20 +00:00
|
|
|
_actorX = _actorY = 0;
|
|
|
|
_zbuf = 0;
|
|
|
|
_scaleX = _scaleY = 0;
|
2022-09-28 00:12:52 +02:00
|
|
|
_drawTop = _drawBottom = 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;
|
2022-09-28 00:12:52 +02:00
|
|
|
_srcPtr = nullptr;
|
|
|
|
_xMove = _yMove = 0;
|
2003-01-07 17:35:20 +00:00
|
|
|
_mirror = false;
|
|
|
|
_width = _height = 0;
|
2022-09-28 00:12:52 +02:00
|
|
|
_skipLimbs = false;
|
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
|
|
|
|
2022-09-28 00:12:52 +02:00
|
|
|
void skipCelLines(ByleRLEData &compData, 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
|