ScummVM API documentation
object.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_OBJECT_H
23#define SCUMM_OBJECT_H
24
25namespace Scumm {
26
27static inline int OBJECT_V0(int id, byte type) {
28 assert(id < 256);
29 return (type << 8 | id);
30}
31#define OBJECT_V0_ID(obj) (obj & 0xFF)
32#define OBJECT_V0_TYPE(obj) ((obj >> 8) & 0xFF)
33
34enum ObjectV0Type {
35 kObjectV0TypeFG = 0, // foreground object
36 // - with owner/state, might (but has not to) be pickupable
37 // -> with entry in _objectOwner/StateTable
38 // -> all objects in _inventory have this type
39 // - image can be exchanged (background overlay)
40 kObjectV0TypeBG = 1, // background object
41 // - without owner/state, not pickupable (room only)
42 // -> without entry in _objectOwner/StateTable
43 // - image cannot be exchanged (part of background image)
44 kObjectV0TypeActor = 2 // object is an actor
45};
46
47enum ObjectClass {
48 kObjectClassNeverClip = 20,
49 kObjectClassAlwaysClip = 21,
50 kObjectClassIgnoreBoxes = 22,
51 kObjectClassYFlip = 29,
52 kObjectClassXFlip = 30,
53 kObjectClassPlayer = 31, // Actor is controlled by the player
54 kObjectClassUntouchable = 32
55};
56
57enum ObjectStateV2 {
58 kObjectStatePickupable = 1,
59 kObjectStateUntouchable = 2,
60 kObjectStateLocked = 4,
61 kObjectStateIntrinsic = 8 // Some kind of general ON/OFF property for an object
62};
63
64struct ObjectData {
65 uint32 OBIMoffset;
66 uint32 OBCDoffset;
67 int16 walk_x, walk_y;
68 uint16 obj_nr;
69 int16 x_pos;
70 int16 y_pos;
71 uint16 width;
72 uint16 height;
73 byte actordir;
74 byte parent;
75 byte parentstate;
76 byte state;
77 byte fl_object_index;
78 byte flags;
79};
80
81#include "common/pack-start.h" // START STRUCT PACKING
82
83struct RoomHeader {
84 union {
85 struct {
86 uint16 width, height;
87 uint16 numObjects;
88 } old;
89
90 struct {
91 uint32 version;
92 uint16 width, height;
93 uint16 numObjects;
94 } v7;
95
96 struct {
97 uint32 version;
98 uint32 width, height;
99 uint32 numObjects;
100 uint32 numZBuffer;
101 uint32 transparency;
102 } v8;
103 };
104} PACKED_STRUCT;
105
107 union {
108 struct {
109 uint16 obj_id;
110 byte x, y, w, h;
111 byte flags;
112 byte parent;
113 int16 walk_x;
114 int16 walk_y;
115 byte actordir;
116 } v5;
117
118 struct {
119 uint16 obj_id;
120 int16 x, y;
121 uint16 w, h;
122 byte flags, parent;
123 uint16 unk1;
124 uint16 unk2;
125 byte actordir;
126 } v6;
127
128 struct {
129 uint32 version;
130 uint16 obj_id;
131 byte parent;
132 byte parentstate;
133 } v7;
134
135 };
136} PACKED_STRUCT;
137
138struct ImageHeader { /* file format */
139 union {
140 struct {
141 uint16 obj_id;
142 uint16 image_count;
143 uint16 unk[1];
144 byte flags;
145 byte unk1;
146 uint16 unk2[2];
147 uint16 width;
148 uint16 height;
149 uint16 hotspot_num;
150 struct {
151 int16 x, y;
152 } hotspot[15];
153 } old;
154
155 struct {
156 uint32 version;
157 uint16 obj_id;
158 uint16 image_count;
159 int16 x_pos, y_pos;
160 uint16 width, height;
161 byte unk2[3];
162 byte actordir;
163 uint16 hotspot_num;
164 struct {
165 int16 x, y;
166 } hotspot[15];
167 } v7;
168
169 struct {
170 char name[32];
171 uint32 unk_1[2];
172 uint32 version; // 801 in COMI, 800 in the COMI demo
173 uint32 image_count;
174 uint32 x_pos;
175 uint32 y_pos;
176 uint32 width;
177 uint32 height;
178 uint32 actordir;
179 uint32 flags; // This field is missing in the COMI demo (version == 800) !
180 struct {
181 int32 x, y;
182 } hotspot[15];
183 } v8;
184 };
185} PACKED_STRUCT;
186
187#include "common/pack-end.h" // END STRUCT PACKING
188
190 const CodeHeader *cdhd;
191 const byte *obcd;
192 const byte *obim;
193 const byte *roomptr;
194};
195
196enum FindObjectWhat {
197 foCodeHeader = 1,
198 foImageHeader = 2,
199 foCheckAlreadyLoaded = 4
200};
201
202} // End of namespace Scumm
203
204
205#endif
Definition: actor.h:30
Definition: object.h:106
Definition: object.h:189
Definition: object.h:138
Definition: object.h:64
Definition: object.h:83