aboutsummaryrefslogtreecommitdiff
path: root/queen/structs.h
blob: 4eea8176fca43835a5a06bda0b67976e8b4e1ead (plain)
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
/* 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 QUEENSTRUCTS_H
#define QUEENSTRUCTS_H

namespace Queen {


struct Box {
	uint16 x1, y1, x2, y2;

	int16 xDiff() const {
		return (int16)(x2 - x1);
	}

	int16 yDiff() const {
		return (int16)(y2 - y1);
	}

	bool intersects(uint16 x, uint16 y, uint16 w, uint16 h) const {
		return (x + w > x1) && (y + h > y1) && (x <= x2) && (y <= y2);
	}

	bool contains(uint16 x, uint16 y) const {
		return (x >= x1) && (x <= x2) && (y >= y1) && (y <= y2);
	}
};


struct Area {
	int16 mapNeighbours;
	Box box;
	uint16 bottomScaleFactor;
	uint16 topScaleFactor;
	uint16 object;

	uint16 calcScale(int16 y) const {
		uint16 dy = box.y2 - box.y1;
		int16 ds = (int16)(topScaleFactor - bottomScaleFactor);
		uint16 scale = ((((y - box.y1) * 100) / dy) * ds) / 100 + bottomScaleFactor;
		if (scale == 0) {
			scale = 100;
		}
		return scale;
	}

	int16 scaleDiff() const {
		return (int16)(topScaleFactor - bottomScaleFactor);
	}
};


struct WalkOffData {
	int16 entryObj;
	uint16 x;
	uint16 y;
};


struct GraphicData {
	uint16 x, y;
	int16 firstFrame, lastFrame;
	uint16 speed;
};


struct ObjectData {
	int16 name; // FIXME: rename to 'object'
	uint16 x;
	uint16 y;
	uint16 description;
	int16 entryObj;
	uint16 room;
	int16 state;
	int16 image;
};


struct ObjectDescription {
	uint16 object;
	uint16 type; // see select.c l.75-101
	uint16 lastDescription;
	uint16 seenCount;
};


struct ItemData {
	int16 item;
	int16 description;
	int16 state;
	uint16 bobFrame;
	uint16 sfxDescription;
};


struct ActorData {
	int16 room;
	int16 bobNum;
	uint16 name;
	int16 gameStateSlot;
	int16 gameStateValue;
	uint16 color;
	uint16 bobFrameStanding;
	uint16 x;
	uint16 y;
	uint16 anim;
	uint16 bankNum;
	uint16 actorFile;
};


struct CmdListData {
	int16 verb;
	int16 nounObj1;
	int16 nounObj2;
	int16 song; // >0: playbefore, <0: playafter
	bool setAreas;
	bool setObjects;
	bool setItems;
	bool setConditions;
	int16 image;
	int16 specialSection; // see execute.c l.423-451
};


struct CmdArea {
	int16 id;
	int16 area; // <0: turn off, >0: turn on
	int16 room;
};


struct CmdObject {
	int16 id;
	int16 dstObj; // >0: show, <0: hide
	int16 srcObj; // >0: copy from srcObj, -1: delete dstObj
};


struct CmdInventory {
	int16 id;
	int16 dstItem; // <0: delete, >0: add
	int16 srcItem; // >0: valid
};


struct CmdGameState {
	int16 id;
	int16 gameStateSlot;
	int16 gameStateValue;
	int16 speakValue;
};


struct FurnitureData {
	int16 room;
	int16 gameStateValue;
};


struct GraphicAnim {
	int16 frame1;
	int16 frame2;
	int16 frame3;
};


} // End of namespace Queen

#endif