ScummVM API documentation
scenery.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 * This file is dual-licensed.
22 * In addition to the GPLv3 license mentioned above, this code is also
23 * licensed under LGPL 2.1. See LICENSES/COPYING.LGPL file for the
24 * full text of the license.
25 *
26 */
27
28#ifndef GOB_SCENERY_H
29#define GOB_SCENERY_H
30
31namespace Gob {
32
33class Scenery {
34public:
35
36#include "common/pack-start.h" // START STRUCT PACKING
37
38 struct PieceDesc {
39 int16 left;
40 int16 right;
41 int16 top;
42 int16 bottom;
43 } PACKED_STRUCT;
44
45 struct StaticPlane {
46 uint8 pictIndex;
47 uint8 pieceIndex;
48 uint8 drawOrder;
49 int16 destX;
50 int16 destY;
51 int8 transp;
52 } PACKED_STRUCT;
53
54 struct StaticLayer {
55 int16 backResId;
56 int16 planeCount;
57 StaticPlane *planes;
58 } PACKED_STRUCT;
59
60 // Animations
61
63 byte pictIndex;
64 byte pieceIndex;
65 int8 destX;
66 int8 destY;
67 int8 notFinal;
68 } PACKED_STRUCT;
69
70 struct AnimLayer {
71 int16 unknown0;
72 int16 posX;
73 int16 posY;
74 int16 animDeltaX;
75 int16 animDeltaY;
76 int8 transp;
77 int16 framesCount;
78 AnimFramePiece *frames;
79 } PACKED_STRUCT;
80
81#include "common/pack-end.h" // END STRUCT PACKING
82
83 struct Static {
84 int16 layersCount;
85 StaticLayer *layers;
86 PieceDesc **pieces;
87 uint32 *piecesCount;
88 Static() : layersCount(0), layers(0), pieces(0), piecesCount(0) {}
89 };
90
91 struct Animation {
92 int16 layersCount;
93 AnimLayer *layers;
94 PieceDesc **pieces;
95 uint32 *piecesCount;
96 Animation() : layersCount(0), layers(0), pieces(0), piecesCount(0) {}
97 };
98
99 int16 _curStatic;
100 int16 _curStaticLayer;
101
102 int16 _maxDrawOrder;
103
104 int16 _toRedrawLeft;
105 int16 _toRedrawRight;
106 int16 _toRedrawTop;
107 int16 _toRedrawBottom;
108
109 int16 _animTop;
110 int16 _animLeft;
111 int16 _animBottom;
112 int16 _animRight;
113
114 int16 *_pCaptureCounter;
115
116 void init();
117 int16 loadStatic(char search);
118 void freeStatic(int16 index);
119 void renderStatic(int16 scenery, int16 layer);
120 void updateStatic(int16 orderFrom);
121 void freeAnim(int16 index);
122 void updateAnim(int16 layer, int16 frame, int16 animation,
123 int16 flags, int16 drawDeltaX, int16 drawDeltaY, char doDraw);
124 void updateAnimObjectVideo(int16 layer, int16 frame, int16 animation,
125 int16 flags, int16 drawDeltaX, int16 drawDeltaY, char doDraw);
126
127 void writeAnimLayerInfo(uint16 index, uint16 layer,
128 int16 varDX, int16 varDY, int16 varUnk0, int16 varFrames);
129 int16 getStaticLayersCount(uint16 index);
130 int16 getAnimLayersCount(uint16 index);
131 StaticLayer *getStaticLayer(uint16 index, uint16 layer);
132 AnimLayer *getAnimLayer(uint16 index, uint16 layer);
133
134 virtual int16 loadAnim(char search);
135
136 Scenery(GobEngine *vm);
137 virtual ~Scenery();
138
139protected:
140 char _spriteRefs[20];
141 int16 _spriteResId[20];
142
143 int16 _staticPictCount[10];
144 int16 _staticResId[10];
145
146 int16 _animPictCount[10];
147 int16 _animResId[10];
148
149 char _staticPictToSprite[70];
150 char _animPictToSprite[70];
151
152 Static _statics[10];
153 Animation _animations[10];
154
155 GobEngine *_vm;
156
157 void loadPieces(int16 pictDescId, PieceDesc *&pieceDesc, uint32 &piecesCount);
158
159 void updateStatic(int16 orderFrom, byte index, byte layer);
160};
161
162class Scenery_v1 : public Scenery {
163public:
164 int16 loadAnim(char search) override;
165
167 ~Scenery_v1() override {}
168};
169
170class Scenery_v2 : public Scenery_v1 {
171public:
172 int16 loadAnim(char search) override;
173
175 ~Scenery_v2() override {}
176};
177
178} // End of namespace Gob
179
180#endif // GOB_SCENERY_H
Definition: gob.h:166
Definition: scenery.h:162
Definition: scenery.h:170
Definition: scenery.h:33
Definition: scenery.h:62
Definition: scenery.h:70
Definition: scenery.h:91
Definition: scenery.h:38
Definition: scenery.h:83
Definition: scenery.h:54
Definition: scenery.h:45