ScummVM API documentation
cutaway.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 QUEEN_CUTAWAY_H
23#define QUEEN_CUTAWAY_H
24
25#include "common/util.h"
26#include "queen/structs.h"
27
28namespace Queen {
29
30class QueenEngine;
31
32class Cutaway {
33public:
34
36 static void run(const char *filename, char *nextFilename, QueenEngine *vm);
37
39 enum {
40 PREVIOUS_ROOM = 0,
41 CURRENT_ROOM = 0,
42 OBJECT_ROOMFADE = -1,
43 PERSON_JOE = -1,
44 OBJECT_JOE = 0,
45 MAX_PERSON_COUNT = 6,
46 CUTAWAY_BANK = 8,
47 MAX_BANK_NAME_COUNT = 5,
48 MAX_FILENAME_LENGTH = 12,
49 MAX_FILENAME_SIZE = (MAX_FILENAME_LENGTH + 1),
50 MAX_PERSON_FACE_COUNT = 13,
51 MAX_STRING_LENGTH = 255,
52 MAX_STRING_SIZE = (MAX_STRING_LENGTH + 1),
53 LEFT = 1,
54 RIGHT = 2,
55 FRONT = 3,
56 BACK = 4
57 };
58
61 OBJECT_TYPE_ANIMATION = 0,
62 OBJECT_TYPE_PERSON = 1,
63 OBJECT_TYPE_NO_ANIMATION = 2,
64 OBJECT_TYPE_TEXT_SPEAK = 3,
65 OBJECT_TYPE_TEXT_DISPLAY_AND_SPEAK = 4,
66 OBJECT_TYPE_TEXT_DISPLAY = 5
67 };
68
69private:
71 struct CutawayObject {
72 int16 objectNumber; // 0 = JOE, -1 = MESSAGE
73 int16 moveToX;
74 int16 moveToY;
75 int16 bank; // 0 = PBOB, 13 = Joe Bank, else BANK NAMEstr()
76 int16 animList;
77 int16 execute; // 1 Yes, 0 No
78 int16 limitBobX1;
79 int16 limitBobY1;
80 int16 limitBobX2;
81 int16 limitBobY2;
82 int16 specialMove;
83 int16 animType; // 0 - Packet, 1 - Amal, 2 - Unpack
84 int16 fromObject;
85 int16 bobStartX;
86 int16 bobStartY;
87 int16 room;
88 int16 scale;
89 // Variables derived from the variables above
90 int song;
91
93 int person[MAX_PERSON_COUNT];
94
96 int personCount;
97 };
98
99 struct CutawayAnim {
100 int16 object;
101 int16 unpackFrame; // Frame to unpack
102 int16 speed;
103 int16 bank;
104 int16 mx;
105 int16 my;
106 int16 cx;
107 int16 cy;
108 int16 scale;
109 int16 currentFrame; // Index to Current Frame
110 int16 originalFrame; // Index to Original Object Frame
111 int16 song;
112 bool flip; // set this if unpackFrame is negative
113 };
114
115 struct ObjectDataBackup {
116 int index;
117 int16 name;
118 int16 image;
119 };
120
121 struct PersonFace {
122 int16 index;
123 int16 image;
124 };
125
126 QueenEngine *_vm;
127
129 byte *_fileData;
130
132 int16 _comPanel;
133
135 byte *_gameStatePtr;
136
138 byte *_objectData;
139
141 uint16 _nextSentenceOff;
142
144 bool _roomFade;
145
147 int16 _cutawayObjectCount;
148
150 bool _anotherCutaway;
151
153 int _initialRoom;
154
156 int _temporaryRoom;
157
159 int _finalRoom;
160
162 char _bankNames[MAX_BANK_NAME_COUNT][MAX_FILENAME_SIZE];
163
165 char _basename[MAX_FILENAME_SIZE];
166
168 char _talkFile[MAX_FILENAME_SIZE];
169
171 int16 _talkTo;
172
174 ObjectDataBackup _personData[MAX_PERSON_COUNT];
175
177 int _personDataCount;
178
180 PersonFace _personFace[MAX_PERSON_FACE_COUNT];
181
183 int _personFaceCount;
184
186 int16 _lastSong;
187
189 int16 _songBeforeComic;
190
191 int16 _currentImage;
192
193 Cutaway(const char *filename, QueenEngine *vm);
194 ~Cutaway();
195
197 void run(char *nextFilename);
198
200 void load(const char *filename);
201
203 void loadStrings(uint16 offset);
204
206 const byte *turnOnPeople(const byte *ptr, CutawayObject &object);
207
209 void limitBob(CutawayObject &object);
210
212 void changeRooms(CutawayObject &object);
213
215 ObjectType getObjectType(CutawayObject &object);
216
218 const byte *handleAnimation(const byte *ptr, CutawayObject &object);
219
221 void handlePersonRecord(int index, CutawayObject &object, const char *sentence);
222
224 void handleText(int index, ObjectType type, CutawayObject &object, const char *sentence);
225
227 void restorePersonData();
228
230 void stop();
231
233 void updateGameState();
234
236 void talk(char *nextFilename);
237
239 const byte *getCutawayAnim(const byte *ptr, int header, CutawayAnim &anim);
240
242 int makeComplexAnimation(int16 currentImage, CutawayAnim *objAnim, int frameCount);
243
245 static const byte *getCutawayObject(const byte *ptr, CutawayObject &object);
246
248 void dumpCutawayObject(int index, CutawayObject &object);
249
251 int countSpaces(ObjectType type, const char *segment);
252
254 int scale(CutawayObject &object);
255
257 static void dumpCutawayAnim(CutawayAnim &anim);
258
259 bool inRange(int16 x, int16 l, int16 h) const { return (x <= h && x >= l); }
260};
261
262} // End of namespace Queen
263
264#endif
Definition: cutaway.h:32
ObjectType
Different kinds of cutaway objects.
Definition: cutaway.h:60
static void run(const char *filename, char *nextFilename, QueenEngine *vm)
Public interface to run a cutaway from a file.
Definition: queen.h:87
Definition: bankman.h:28