ScummVM API documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
room.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 DARKSEED_ROOM_H
23 #define DARKSEED_ROOM_H
24 
25 #include "common/rect.h"
26 #include "darkseed/nsp.h"
27 #include "darkseed/pal.h"
28 #include "darkseed/pic.h"
29 #include "sound.h"
30 
31 namespace Darkseed {
32 
33 struct RoomExit {
34  uint16 x = 0;
35  uint16 y = 0;
36  uint16 width = 0;
37  uint16 height = 0;
38  uint16 roomNumber = 0;
39  uint8 direction = 0;
40 };
41 
42 struct RoomStruct2 {
43  uint8 strip[40];
44 };
45 
47  uint16 type = 0;
48  uint16 objNum = 0;
49  uint16 xOffset = 0;
50  uint16 yOffset = 0;
51  uint16 width = 0;
52  uint16 height = 0;
53  uint8 depth = 0;
54  uint8 spriteNum = 0;
55 };
56 
57 class Room {
58  bool _palLoaded = false;
59 
60 public:
61  static constexpr int MAX_CONNECTORS = 12;
62  uint8 _roomNumber;
63  Pic _pic;
64  Pal _pal;
65  Pal _workPal; // used to darken the sky.
66  Nsp _locationSprites;
67  Common::Array<int16> _locObjFrame;
68  Common::Array<int16> _locObjFrameTimer;
69 
71  Common::Array<RoomStruct2> _walkableLocationsMap;
73  Common::Array<Common::Point> _connectors;
74 
75  uint16 _selectedObjIndex = 0;
76  int16 _collisionType = 0;
77 
78  explicit Room(int roomNumber);
79 
80  void initRoom();
81  void draw();
82 
83  void update();
84 
85  int checkCursorAndMoveableObjects();
86  int checkCursorAndStaticObjects(int x, int y);
87  int CheckCursorAndMovedObjects();
88  int getRoomExitAtCursor();
89  void getWalkTargetForObjectType_maybe(int objId);
90  int getObjectUnderCursor();
91  uint16 getDoorTargetRoom(int objId);
92  int getExitRoomNumberAtPoint(int x, int y);
93  bool exitRoom();
94  Common::String getRoomFilenameBase(int roomNumber);
95  bool canWalkAtLocation(int x, int y);
96  bool canWalkInLineToTarget(int x, int y, int targetX, int targetY);
97  void printRoomDescriptionText() const;
98  void calculateScaledSpriteDimensions(int width, int height, int curYPosition);
99  bool isOutside() const;
100  bool isGiger();
101  void runRoomObjects();
102  void removeObjectFromRoom(int16 objNum);
103  void updateRoomObj(int16 objNum, int16 x, int16 width, int16 y, int16 height);
104  bool advanceFrame(int animIdx);
105  void mikeStickThrowAnim();
106  void loadRoom61AWalkableLocations();
107  void restorePalette();
108  void installPalette();
109  void darkenSky();
110  void loadLocationSprites(const Common::Path &path);
111  Common::Point getExitPointForRoom(uint8 roomNumber);
112  static MusicId getMusicIdForRoom(uint8 roomNumber);
113  void loadRoomMusic();
114 
115 private:
116  bool load();
117  static Common::String stripSpaces(const Common::String &source);
118  void drawTrunk();
119  void advanceLocAnimFrame(int roomObjIdx);
120  void dosDemoFixupRoomObjects();
121 };
122 
123 } // namespace Darkseed
124 
125 #endif // DARKSEED_ROOM_H
Definition: str.h:59
Definition: path.h:52
Definition: room.h:57
Definition: room.h:42
Definition: pal.h:34
Definition: nsp.h:61
Definition: rect.h:45
Definition: room.h:33
Definition: pic.h:31
Definition: adlib_dsf.h:27
Definition: room.h:46