ScummVM API documentation
door.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  * Additional copyright for this file:
8  * Copyright (C) 1995-1997 Presto Studios, Inc.
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program. If not, see <http://www.gnu.org/licenses/>.
22  *
23  */
24 
25 #ifndef PEGASUS_NEIGHBORHOOD_DOOR_H
26 #define PEGASUS_NEIGHBORHOOD_DOOR_H
27 
28 #include "common/array.h"
29 #include "common/endian.h"
30 
31 #include "pegasus/constants.h"
32 
33 namespace Common {
34  class SeekableReadStream;
35 }
36 
37 namespace Pegasus {
38 
39 typedef byte DoorFlags;
40 
41 enum {
42  kDoorPresentBit, // Bit set if there is a door here.
43  kDoorLockedBit // Bit set if door is locked, clear if unlocked.
44 };
45 
46 static const DoorFlags kNoDoorFlags = 0;
47 static const DoorFlags kDoorPresentMask = 1 << kDoorPresentBit;
48 static const DoorFlags kDoorLockedMask = 1 << kDoorLockedBit;
49 
50 class DoorTable {
51 public:
52  DoorTable() {}
53  ~DoorTable() {}
54 
55  static uint32 getResTag() { return MKTAG('D', 'o', 'o', 'r'); }
56 
57  void loadFromStream(Common::SeekableReadStream *stream);
58  void clear();
59 
60  struct Entry {
61  Entry() { clear(); }
62  bool isEmpty() { return movieStart == 0xffffffff; }
63  void clear() {
64  room = kNoRoomID;
65  direction = kNoDirection;
66  altCode = kNoAlternateID;
67  movieStart = 0xffffffff;
68  movieEnd = 0xffffffff;
69  flags = kNoDoorFlags;
70  }
71 
72  RoomID room;
73  DirectionConstant direction;
74  AlternateID altCode;
75  TimeValue movieStart;
76  TimeValue movieEnd;
77  DoorFlags flags;
78  };
79 
80  Entry findEntry(RoomID room, DirectionConstant direction, AlternateID altCode);
81 
82 private:
83  Common::Array<Entry> _entries;
84 };
85 
86 } // End of namespace Pegasus
87 
88 #endif
Definition: door.h:60
Definition: stream.h:745
Definition: algorithm.h:29
Definition: door.h:50
#define MKTAG(a0, a1, a2, a3)
Definition: endian.h:188
Definition: ai_action.h:33