ScummVM API documentation
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_COSTUME_H
23 #define SCUMM_COSTUME_H
24 
25 #include "scumm/base-costume.h"
26 
27 namespace Scumm {
29 public:
30  int _id;
31  const byte *_baseptr;
32  const byte *_animCmds;
33  const byte *_dataOffsets;
34  const byte *_palette;
35  const byte *_frameOffsets;
36  byte _numColors;
37  byte _numAnim;
38  byte _format;
39  bool _mirror;
40 
43  _id(-1), _baseptr(0), _animCmds(0), _dataOffsets(0), _palette(0),
44  _frameOffsets(0), _numColors(0), _numAnim(0), _format(0), _mirror(false) {}
45 
46  void loadCostume(int id) override;
47  void costumeDecodeData(Actor *a, int frame, uint usemask) override;
48  bool increaseAnims(Actor *a) override;
49 
50 protected:
51  bool increaseAnim(Actor *a, int slot);
52 };
53 
55 public:
56  int _id;
57  const byte *_baseptr;
58  const byte *_dataOffsets;
59  byte _numAnim;
60 
61  NESCostumeLoader(ScummEngine *vm) : BaseCostumeLoader(vm), _id(0), _baseptr(nullptr), _dataOffsets(nullptr), _numAnim(0) {}
62  void loadCostume(int id) override;
63  void costumeDecodeData(Actor *a, int frame, uint usemask) override;
64  bool increaseAnims(Actor *a) override;
65 
66 protected:
67  bool increaseAnim(Actor *a, int slot);
68 };
69 
71 public:
73  void loadCostume(int id) override;
74  void costumeDecodeData(Actor *a, int frame, uint usemask) override;
75  bool increaseAnims(Actor *a) override;
76  byte getFrame(Actor *a, int limb);
77 
78 protected:
79  bool increaseAnim(Actor *a, int limb);
80 };
81 
83 protected:
84  ClassicCostumeLoader _loaded;
85 
86  byte _scaleIndexX; /* must wrap at 256 */
87  byte _scaleIndexY;
88  uint16 _palette[32];
89 
90 public:
91  ClassicCostumeRenderer(ScummEngine *vm) : BaseCostumeRenderer(vm), _loaded(vm), _scaleIndexX(0), _scaleIndexY(0) {
92  memset(_palette, 0, sizeof(_palette));
93  }
94 
95  void setPalette(uint16 *palette) override;
96  void setFacing(const Actor *a) override;
97  void setCostume(int costume, int shadow) override;
98 
99 protected:
100  byte drawLimb(const Actor *a, int limb) override;
101 
102  void proc3(ByleRLEData &v1);
103  void proc3_ami(ByleRLEData &v1);
104 
105  void procC64(ByleRLEData &v1, int actor);
106 
107  void procPCEngine(ByleRLEData &v1);
108 
109  byte mainRoutine(int xmoveCur, int ymoveCur);
110 };
111 
113 protected:
114  NESCostumeLoader _loaded;
115 
116 public:
117  NESCostumeRenderer(ScummEngine *vm) : BaseCostumeRenderer(vm), _loaded(vm) {}
118 
119  void setPalette(uint16 *palette) override;
120  void setFacing(const Actor *a) override;
121  void setCostume(int costume, int shadow) override;
122 
123 protected:
124  byte drawLimb(const Actor *a, int limb) override;
125 };
126 
127 #ifdef USE_RGB_COLOR
128 class PCEngineCostumeRenderer : public ClassicCostumeRenderer {
129 public:
130  PCEngineCostumeRenderer(ScummEngine *vm) : ClassicCostumeRenderer(vm) {}
131 
132  void setPalette(uint16 *palette) override;
133 };
134 #endif
135 
137 protected:
138  V0CostumeLoader _loaded;
139 
140 public:
141  V0CostumeRenderer(ScummEngine *vm) : BaseCostumeRenderer(vm), _loaded(vm) {}
142 
143  void setPalette(uint16 *palette) override {}
144  void setFacing(const Actor *a) override {}
145  void setCostume(int costume, int shadow) override;
146 
147 protected:
148  byte drawLimb(const Actor *a, int limb) override;
149 };
150 
151 } // End of namespace Scumm
152 
153 #endif
Definition: costume.h:70
Definition: base-costume.h:108
Definition: costume.h:82
Definition: costume.h:28
Definition: scumm.h:518
Definition: costume.h:112
Definition: actor.h:97
Definition: costume.h:136
Definition: costume.h:54
Definition: base-costume.h:68
Definition: base-costume.h:49
Definition: actor.h:30