1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
|
/* ScummVM - Scumm Interpreter
* Copyright (C) 2003 The ScummVM project
*
* 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 2
* of the License, or (at your option) any later version.
* 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.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header$
*
*/
#ifndef QUEENCUTAWAY_H
#define QUEENCUTAWAY_H
#include "queen/queen.h"
namespace Queen {
class Resource;
class Logic;
class Graphics;
class Cutaway {
public:
//! Public interface to run a cutaway from a file
static void run(
const char *filename,
char *nextFilename,
Logic *logic,
Resource *resource);
private:
//! Collection of constants used by QueenCutaway
enum {
PREVIOUS_ROOM = 0,
CURRENT_ROOM = 0,
OBJECT_ROOMFADE = -1,
PERSON_JOE = -1,
OBJECT_JOE = 0,
MAX_PERSON_COUNT = 6,
CUTAWAY_BANK = 8,
MAX_BANK_NAME_COUNT = 5,
MAX_FILENAME_LENGTH = 12,
MAX_FILENAME_SIZE = (MAX_FILENAME_LENGTH + 1),
MAX_STRING_LENGTH = 255,
MAX_STRING_SIZE = (MAX_STRING_LENGTH + 1),
LEFT = 1,
RIGHT = 2,
FRONT = 3,
BACK = 4
};
//! Different kinds of cutaway objects
enum ObjectType {
OBJECT_TYPE_ANIMATION = 0,
OBJECT_TYPE_PERSON = 1,
OBJECT_TYPE_NO_ANIMATION = 2,
OBJECT_TYPE_TEXT_SPEAK = 3,
OBJECT_TYPE_TEXT_DISPLAY_AND_SPEAK = 4,
OBJECT_TYPE_TEXT_DISPLAY = 5
};
//! Data for a cutaway object
struct CutawayObject {
int16 objectNumber; // 0 = JOE, -1 = MESSAGE
int16 moveToX;
int16 moveToY;
int16 bank; // 0 = PBOB, 13 = Joe Bank, else BANK NAMEstr()
int16 animList;
int16 execute; // 1 Yes, 0 No
int16 limitBobX1;
int16 limitBobY1;
int16 limitBobX2;
int16 limitBobY2;
int16 specialMove;
int16 animType; // 0 - Packet, 1 - Amal, 2 - Unpack
int16 fromObject;
int16 bobStartX;
int16 bobStartY;
int16 room;
int16 scale;
// Variables derived from the variables above
int song;
//! People to turn on
int person[MAX_PERSON_COUNT];
//! Number of elements used in _person array
int personCount;
};
struct CutawayAnim {
int object;
int unpackFrame; // Frame to unpack
int speed;
int bank;
int mx;
int my;
int cx;
int cy;
int scale;
int currentFrame; // Index to Current Frame
int originalFrame; // Index to Original Object Frame
int song;
};
struct ObjectDataBackup {
int index;
int16 name;
int16 image;
};
Logic *_logic;
Resource *_resource;
Graphics *_graphics;
//! Raw .cut file data (without 20 byte header)
byte *_fileData;
//! Game state data inside of _fileDat
byte *_gameStatePtr;
//! Actual cutaway data inside of _fileData
byte *_objectData;
//! Pointer to next sentence string in _fileData
byte *_nextSentence;
//! Number of cutaway objects at _cutawayData
int _cutawayObjectCount;
//! This cutaway is followed by another
bool _anotherCutaway;
//! Specify if the player can quit this cutaway or not
bool _canQuit;
//! Set to true to abort the cutaway
bool _quit;
//! Room before cutaway
int _initialRoom;
//! Temporary room for cutaway
int _temporaryRoom;
//! Room to stay in
int _finalRoom;
//! Bank names
char _bankNames[MAX_BANK_NAME_COUNT][MAX_FILENAME_SIZE];
//! Filename without ".cut"
char _basename[MAX_FILENAME_SIZE];
//! Name of .dog file
char _talkFile[MAX_FILENAME_SIZE];
//! Used by changeRooms
ObjectDataBackup _personData[MAX_PERSON_COUNT];
//! Number of elements used in _personData array
int _personDataCount;
//! Play this song when leaving cutaway
int16 _lastSong;
//! Song played before running comic.cut
int16 _songBeforeComic;
Cutaway(
const char *filename,
Logic *logic,
Resource *resource);
~Cutaway();
//! Run this cutaway object
void run(char *nextFilename);
//! Load cutaway data from file
void load(const char *filename);
//! Used by load to read string data
void loadStrings(byte *ptr);
//! Do something special
void actionSpecialMove(int index);
//! Get persons
byte *turnOnPeople(byte *ptr, CutawayObject &object);
//! Limit the BOB
void limitBob(CutawayObject &object);
//! This cutaway object occurs in another room
void changeRooms(CutawayObject &object);
//! Get the object type for this CutawayObject
ObjectType getObjectType(CutawayObject &object);
//! Perform actions for an animation
byte *handleAnimation(byte *ptr, CutawayObject &object);
//! Perform actions for a person record
void handlePersonRecord(
int index,
CutawayObject &object,
const char *sentence);
//! Restore QueenLogic::_objectData from _personData
void restorePersonData();
//! Copy data from dummy object to object
void objectCopy(int dummyObjectIndex, int objectIndex);
//! Go to the final room
void goToFinalRoom();
//! Update game state after cutaway
void updateGameState();
//! Prepare for talk after cutaway
void talk(char *nextFilename);
//! Get CutawayAnim data from ptr and return new ptr
byte *getCutawayAnim(byte *ptr, int header, CutawayAnim &anim);
//! Read a CutawayObject from ptr and return new ptr
static byte *getCutawayObject(byte *ptr, CutawayObject &object);
//! Dump a CutawayObject with debug()
static void dumpCutawayObject(int index, CutawayObject &object);
//! Dump CutawayAnum data with debug()
static void dumpCutawayAnim(CutawayAnim &anim);
};
} // End of namespace Queen
#endif
|