22 #ifndef QUEEN_STRUCTS_H 23 #define QUEEN_STRUCTS_H 25 #include "queen/defs.h" 26 #include "common/endian.h" 34 : x1(0), y1(0), x2(0), y2(0) {
37 Box(int16 xx1, int16 yy1, int16 xx2, int16 yy2)
38 : x1(xx1), y1(yy1), x2(xx2), y2(yy2) {
41 void readFromBE(byte *&ptr) {
42 x1 = (int16)READ_BE_UINT16(ptr); ptr += 2;
43 y1 = (int16)READ_BE_UINT16(ptr); ptr += 2;
44 x2 = (int16)READ_BE_UINT16(ptr); ptr += 2;
45 y2 = (int16)READ_BE_UINT16(ptr); ptr += 2;
48 void writeToBE(byte *&ptr) {
49 WRITE_BE_UINT16(ptr, x1); ptr += 2;
50 WRITE_BE_UINT16(ptr, y1); ptr += 2;
51 WRITE_BE_UINT16(ptr, x2); ptr += 2;
52 WRITE_BE_UINT16(ptr, y2); ptr += 2;
63 bool intersects(int16 x, int16 y, uint16 w, uint16 h)
const {
64 return (x + w > x1) && (y + h > y1) && (x <= x2) && (y <= y2);
67 bool contains(int16 x, int16 y)
const {
68 return (x >= x1) && (x <= x2) && (y >= y1) && (y <= y2);
71 bool operator==(
const Box &b)
const {
72 return (x1 == b.x1) && (x2 == b.x2) && (y1 == b.y1) && (y2 == b.y2);
88 : mapNeighbors(0), bottomScaleFactor(0), topScaleFactor(0), object(0) {
91 void readFromBE(byte *&ptr) {
92 mapNeighbors = (int16)READ_BE_UINT16(ptr); ptr += 2;
94 bottomScaleFactor = READ_BE_UINT16(ptr); ptr += 2;
95 topScaleFactor = READ_BE_UINT16(ptr); ptr += 2;
96 object = READ_BE_UINT16(ptr); ptr += 2;
99 void writeToBE(byte *&ptr) {
100 WRITE_BE_UINT16(ptr, mapNeighbors); ptr += 2;
102 WRITE_BE_UINT16(ptr, bottomScaleFactor); ptr += 2;
103 WRITE_BE_UINT16(ptr, topScaleFactor); ptr += 2;
104 WRITE_BE_UINT16(ptr,
object); ptr += 2;
107 uint16 calcScale(int16 y)
const {
108 uint16 dy = box.yDiff();
109 int16 ds = scaleDiff();
113 scale = ((((y - box.y1) * 100) / dy) * ds) / 100 + bottomScaleFactor;
121 int16 scaleDiff()
const {
122 return (int16)(topScaleFactor - bottomScaleFactor);
133 void readFromBE(byte *&ptr) {
134 entryObj = (int16)READ_BE_UINT16(ptr); ptr += 2;
135 x = READ_BE_UINT16(ptr); ptr += 2;
136 y = READ_BE_UINT16(ptr); ptr += 2;
139 void writeToBE(byte *&ptr) {
140 WRITE_BE_UINT16(ptr, entryObj); ptr += 2;
141 WRITE_BE_UINT16(ptr, x); ptr += 2;
142 WRITE_BE_UINT16(ptr, y); ptr += 2;
175 void readFromBE(byte *&ptr) {
176 x = READ_BE_UINT16(ptr); ptr += 2;
177 y = READ_BE_UINT16(ptr); ptr += 2;
178 firstFrame = (int16)READ_BE_UINT16(ptr); ptr += 2;
179 lastFrame = (int16)READ_BE_UINT16(ptr); ptr += 2;
180 speed = READ_BE_UINT16(ptr); ptr += 2;
241 void readFromBE(byte *&ptr) {
242 name = (int16)READ_BE_UINT16(ptr); ptr += 2;
243 x = READ_BE_UINT16(ptr); ptr += 2;
244 y = READ_BE_UINT16(ptr); ptr += 2;
245 description = READ_BE_UINT16(ptr); ptr += 2;
246 entryObj = (int16)READ_BE_UINT16(ptr); ptr += 2;
247 room = READ_BE_UINT16(ptr); ptr += 2;
248 state = READ_BE_UINT16(ptr); ptr += 2;
249 image = (int16)READ_BE_UINT16(ptr); ptr += 2;
252 void writeToBE(byte *&ptr) {
253 WRITE_BE_UINT16(ptr, name); ptr += 2;
254 WRITE_BE_UINT16(ptr, x); ptr += 2;
255 WRITE_BE_UINT16(ptr, y); ptr += 2;
256 WRITE_BE_UINT16(ptr, description); ptr += 2;
257 WRITE_BE_UINT16(ptr, entryObj); ptr += 2;
258 WRITE_BE_UINT16(ptr, room); ptr += 2;
259 WRITE_BE_UINT16(ptr, state); ptr += 2;
260 WRITE_BE_UINT16(ptr, image); ptr += 2;
299 void readFromBE(byte *&ptr) {
300 object = READ_BE_UINT16(ptr); ptr += 2;
301 type = READ_BE_UINT16(ptr); ptr += 2;
302 lastDescription = READ_BE_UINT16(ptr); ptr += 2;
303 lastSeenNumber = READ_BE_UINT16(ptr); ptr += 2;
306 void writeToBE(byte *&ptr) {
307 WRITE_BE_UINT16(ptr,
object); ptr += 2;
308 WRITE_BE_UINT16(ptr, type); ptr += 2;
309 WRITE_BE_UINT16(ptr, lastDescription); ptr += 2;
310 WRITE_BE_UINT16(ptr, lastSeenNumber); ptr += 2;
327 void readFromBE(byte *&ptr) {
328 name = (int16)READ_BE_UINT16(ptr); ptr += 2;
329 description = READ_BE_UINT16(ptr); ptr += 2;
330 state = READ_BE_UINT16(ptr); ptr += 2;
331 frame = READ_BE_UINT16(ptr); ptr += 2;
332 sfxDescription = (int16)READ_BE_UINT16(ptr); ptr += 2;
335 void writeToBE(byte *&ptr) {
336 WRITE_BE_UINT16(ptr, name); ptr += 2;
337 WRITE_BE_UINT16(ptr, description); ptr += 2;
338 WRITE_BE_UINT16(ptr, state); ptr += 2;
339 WRITE_BE_UINT16(ptr, frame); ptr += 2;
340 WRITE_BE_UINT16(ptr, sfxDescription); ptr += 2;
367 void readFromBE(byte *&ptr) {
368 room = (int16)READ_BE_UINT16(ptr); ptr += 2;
369 bobNum = (int16)READ_BE_UINT16(ptr); ptr += 2;
370 name = READ_BE_UINT16(ptr); ptr += 2;
371 gsSlot = (int16)READ_BE_UINT16(ptr); ptr += 2;
372 gsValue = (int16)READ_BE_UINT16(ptr); ptr += 2;
373 color = READ_BE_UINT16(ptr); ptr += 2;
374 bobFrameStanding = READ_BE_UINT16(ptr); ptr += 2;
375 x = READ_BE_UINT16(ptr); ptr += 2;
376 y = READ_BE_UINT16(ptr); ptr += 2;
377 anim = READ_BE_UINT16(ptr); ptr += 2;
378 bankNum = READ_BE_UINT16(ptr); ptr += 2;
379 file = READ_BE_UINT16(ptr); ptr += 2;
412 void readFromBE(byte *&ptr) {
413 verb = (Verb)READ_BE_UINT16(ptr); ptr += 2;
414 nounObj1 = (int16)READ_BE_UINT16(ptr); ptr += 2;
415 nounObj2 = (int16)READ_BE_UINT16(ptr); ptr += 2;
416 song = (int16)READ_BE_UINT16(ptr); ptr += 2;
417 setAreas = READ_BE_UINT16(ptr) != 0; ptr += 2;
418 setObjects = READ_BE_UINT16(ptr) != 0; ptr += 2;
419 setItems = READ_BE_UINT16(ptr) != 0; ptr += 2;
420 setConditions = READ_BE_UINT16(ptr) != 0; ptr += 2;
421 imageOrder = (int16)READ_BE_UINT16(ptr); ptr += 2;
422 specialSection = (int16)READ_BE_UINT16(ptr); ptr += 2;
425 bool match(
const Verb& v, int16 obj1, int16 obj2)
const {
426 return verb == v && nounObj1 == obj1 && nounObj2 == obj2;
439 void readFromBE(byte *&ptr) {
440 id = (int16)READ_BE_UINT16(ptr); ptr += 2;
441 area = (int16)READ_BE_UINT16(ptr); ptr += 2;
442 room = READ_BE_UINT16(ptr); ptr += 2;
455 void readFromBE(byte *&ptr) {
456 id = (int16)READ_BE_UINT16(ptr); ptr += 2;
457 dstObj = (int16)READ_BE_UINT16(ptr); ptr += 2;
458 srcObj = (int16)READ_BE_UINT16(ptr); ptr += 2;
471 void readFromBE(byte *&ptr) {
472 id = (int16)READ_BE_UINT16(ptr); ptr += 2;
473 dstItem = (int16)READ_BE_UINT16(ptr); ptr += 2;
474 srcItem = (int16)READ_BE_UINT16(ptr); ptr += 2;
483 int16 gameStateValue;
486 void readFromBE(byte *&ptr) {
487 id = (int16)READ_BE_UINT16(ptr); ptr += 2;
488 gameStateSlot = (int16)READ_BE_UINT16(ptr); ptr += 2;
489 gameStateValue = (int16)READ_BE_UINT16(ptr); ptr += 2;
490 speakValue = READ_BE_UINT16(ptr); ptr += 2;
517 void readFromBE(byte *&ptr) {
518 room = (int16)READ_BE_UINT16(ptr); ptr += 2;
519 objNum = (int16)READ_BE_UINT16(ptr); ptr += 2;
529 void readFromBE(byte *&ptr) {
530 keyFrame = (int16)READ_BE_UINT16(ptr); ptr += 2;
531 frame = (int16)READ_BE_UINT16(ptr); ptr += 2;
532 speed = READ_BE_UINT16(ptr); ptr += 2;
559 void readFromBE(byte *&ptr) {
560 hasTalkedTo = READ_BE_UINT16(ptr) != 0; ptr += 2;
561 for (
int i = 0; i < 4; i++) {
562 values[i] = (int16)READ_BE_UINT16(ptr); ptr += 2;
566 void writeToBE(byte *&ptr) {
567 WRITE_BE_UINT16(ptr, (uint16)hasTalkedTo); ptr += 2;
568 for (
int i = 0; i < 4; i++) {
569 WRITE_BE_UINT16(ptr, values[i]); ptr += 2;
576 uint16 width, height;
577 uint16 xhotspot, yhotspot;
uint16 bobFrame
current frame
Definition: structs.h:551
int16 id
CmdListData number.
Definition: structs.h:433
bool setConditions
if set, P1_SET_CONDITIONS must be called (using CmdGameState)
Definition: structs.h:406
bool setObjects
if set, P3_SET_OBJECTS must be called (using CmdObject)
Definition: structs.h:402
Definition: structs.h:479
const char * anim
animation string
Definition: structs.h:549
Definition: structs.h:543
uint16 file
entry in ACTOR_FILE
Definition: structs.h:365
int16 area
area to turn off/on (<0: off, >0: on)
Definition: structs.h:435
uint16 description
entry in OBJECT_DESCR
Definition: structs.h:191
int16 id
CmdListData number.
Definition: structs.h:465
const char * name
actor name
Definition: structs.h:547
int16 dstItem
<0: delete, >0: add
Definition: structs.h:467
uint16 object
entry in ObjectData, object lying in this area
Definition: structs.h:85
uint16 bobFrameStanding
bank bobframe for standing position of the actor
Definition: structs.h:357
bool setItems
if set, P4_SET_ITEMS must be called (using CmdInventory)
Definition: structs.h:404
uint16 x
coordinates of object
Definition: structs.h:149
uint16 type
type of the description
Definition: structs.h:293
uint16 room
room in which the area must be changed
Definition: structs.h:437
uint16 name
entry in ACTOR_NAME
Definition: structs.h:351
uint16 color
spoken text color
Definition: structs.h:355
int16 room
room in which the actor is
Definition: structs.h:347
const ActorData * actor
actor settings to use
Definition: structs.h:545
int16 nounObj2
second object used in the action
Definition: structs.h:396
int16 song
song to play (>0: playbefore, <0: playafter)
Definition: structs.h:398
int16 srcItem
>0: valid
Definition: structs.h:469
int16 name
entry in OBJECT_NAME
Definition: structs.h:317
int16 srcObj
>0: copy from srcObj, 0: nothing, -1: delete dstObj
Definition: structs.h:453
int16 nounObj1
first object used in the action
Definition: structs.h:394
uint16 object
entry in ObjectData or ItemData
Definition: structs.h:267
Definition: structs.h:524
uint16 room
room in which this object is available
Definition: structs.h:195
uint16 lastDescription
last entry possible in OBJECT_DESCR for this object
Definition: structs.h:295
int16 dstObj
>0: show, <0: hide
Definition: structs.h:451
int16 sfxDescription
entry in OBJECT_DESCR (>0 if available)
Definition: structs.h:325
Definition: structs.h:390
int16 entryObj
entry in ObjectData
Definition: structs.h:129
uint16 x
initial coordinates in the room
Definition: structs.h:359
Definition: structs.h:345
Definition: structs.h:265
Graphics::Surface * scale(const Graphics::Surface &srcImage, int xSize, int ySize)
int16 entryObj
associated object
Definition: structs.h:193
Definition: structs.h:495
Verb verb
action to perform
Definition: structs.h:392
int16 mapNeighbors
bitmask of connected areas
Definition: structs.h:79
Definition: structs.h:315
uint16 x
coordinates of object
Definition: structs.h:189
int16 gsSlot
gamestate entry/value, actor is valid if GAMESTATE[slot] == value
Definition: structs.h:353
uint16 anim
entry in ACTOR_ANIM
Definition: structs.h:361
int16 objNum
furniture object number
Definition: structs.h:515
uint16 bankNum
bank to use to load the actor file
Definition: structs.h:363
Definition: structs.h:575
Definition: structs.h:147
Definition: structs.h:127
int16 specialSection
special section to execute (refer to execute.c l.423-451)
Definition: structs.h:410
int16 image
entry in GraphicData
Definition: structs.h:239
int16 id
CmdListData number.
Definition: structs.h:481
int16 bobNum
bob number associated to this actor
Definition: structs.h:349
Definition: structs.h:431
uint16 lastSeenNumber
last description number used (in order to avoid re-using it)
Definition: structs.h:297
uint16 state
state of the object (grab direction, on/off, default command...)
Definition: structs.h:197
Definition: structs.h:555
bool setAreas
if set, P2_SET_AREAS must be called (using CmdArea)
Definition: structs.h:400
int16 id
CmdListData number.
Definition: structs.h:449
Definition: structs.h:185
int16 firstFrame
bank bobframes
Definition: structs.h:171
int16 imageOrder
graphic image order
Definition: structs.h:408
uint16 state
state of the object
Definition: structs.h:321
Box box
coordinates defining area limits
Definition: structs.h:81
Definition: structs.h:447
uint16 x
coordinates to reach
Definition: structs.h:131
Definition: structs.h:463
int16 room
room in which the furniture are
Definition: structs.h:497
Definition: structs.h:537
int16 name
entry in OBJECT_NAME (<0: object is hidden, 0: object has been deleted)
Definition: structs.h:187
uint16 description
entry in OBJECT_DESCR
Definition: structs.h:319
uint16 frame
bank bobframe
Definition: structs.h:323
uint16 speed
moving speed of object
Definition: structs.h:173
uint16 bottomScaleFactor
scaling factors for bobs actors
Definition: structs.h:83