ScummVM API documentation
base-costume.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef SCUMM_BASE_COSTUME_H
23 #define SCUMM_BASE_COSTUME_H
24 
25 #include "common/scummsys.h"
26 #include "scumm/actor.h" // for CostumeData
27 
28 namespace Scumm {
29 
30 #include "common/pack-start.h" // START STRUCT PACKING
31 
32 struct CostumeInfo {
33  uint16 width, height;
34  int16 relX, relY;
35  int16 moveX, moveY;
36 } PACKED_STRUCT;
37 
38 #include "common/pack-end.h" // END STRUCT PACKING
39 
40 
41 extern const byte smallCostumeScaleTable[256];
42 extern const byte bigCostumeScaleTable[768];
43 
44 
45 class Actor;
46 class ScummEngine;
47 struct VirtScreen;
48 
50 protected:
51  ScummEngine *_vm;
52 
53 public:
54  BaseCostumeLoader(ScummEngine *vm) : _vm(vm) {}
55  virtual ~BaseCostumeLoader() {}
56 
57  virtual void loadCostume(int id) = 0;
58  virtual bool increaseAnims(Actor *a) = 0;
59  virtual void costumeDecodeData(Actor *a, int frame, uint usemask) = 0;
60 
61  virtual bool hasManyDirections(int id) { return false; }
62 };
63 
64 
69 public:
70  Common::Rect _clipOverride;
71  byte _actorID;
72 
73  byte _shadowMode;
74  byte *_shadowTable;
75 
76  int _actorX, _actorY;
77  byte _zbuf;
78  byte _scaleX, _scaleY;
79 
80  int _drawTop, _drawBottom;
81  byte _paletteNum;
82  bool _skipLimbs;
83  bool _actorDrawVirScr;
84 
85 
86 protected:
87  ScummEngine *_vm;
88 
89  // Destination
90  Graphics::Surface _out;
91  int32 _numStrips;
92 
93  // Source pointer
94  const byte *_srcPtr;
95 
96  // current move offset
97  int _xMove, _yMove;
98 
99  // whether to draw the actor mirrored
100  bool _mirror;
101 
102  int _numBlocks;
103 
104  // width and height of cel to decode
105  int _width, _height;
106 
107 public:
108  struct ByleRLEData {
109  // Parameters for the original ("V1") costume codec.
110  // These ones are accessed from ARM code. Don't reorder.
111  int x;
112  int y;
113  const byte *scaleTable;
114  int height;
115  int width;
116  int skipWidth;
117  byte *destPtr;
118  const byte *maskPtr;
119  int scaleXStep;
120  byte mask, shr;
121  byte repColor;
122  byte repLen;
123  // These ones aren't accessed from ARM code.
124  Common::Rect boundsRect;
125  int scaleXIndex, scaleYIndex;
126  };
127 
129  _actorID = 0;
130  _shadowMode = 0;
131  _shadowTable = nullptr;
132  _actorX = _actorY = 0;
133  _zbuf = 0;
134  _scaleX = _scaleY = 0;
135  _drawTop = _drawBottom = 0;
136 
137  _vm = scumm;
138  _numStrips = -1;
139  _srcPtr = nullptr;
140  _xMove = _yMove = 0;
141  _mirror = false;
142  _width = _height = 0;
143  _skipLimbs = false;
144  _paletteNum = 0;
145  _actorDrawVirScr = false;
146  _numBlocks = 0;
147  }
148  virtual ~BaseCostumeRenderer() {}
149 
150  virtual void setPalette(uint16 *palette) = 0;
151  virtual void setFacing(const Actor *a) = 0;
152  virtual void setCostume(int costume, int shadow) = 0;
153 
154 
155  byte drawCostume(const VirtScreen &vs, int numStrips, const Actor *a, bool drawToBackBuf);
156 
157 protected:
158  virtual byte drawLimb(const Actor *a, int limb) = 0;
159 
160  void skipCelLines(ByleRLEData &compData, int num);
161 };
162 
163 } // End of namespace Scumm
164 
165 #endif
Definition: surface.h:67
Definition: base-costume.h:108
Definition: rect.h:144
Definition: scumm.h:519
Definition: gfx.h:185
Definition: base-costume.h:32
Definition: actor.h:97
Definition: base-costume.h:68
Definition: base-costume.h:49
Definition: actor.h:30