ScummVM API documentation
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 #ifndef PELROCK_ROOM_H
22 #define PELROCK_ROOM_H
23 
24 namespace Common {
25 class File;
26 }
27 
28 namespace Pelrock {
29 
30 const int kRoomStructSize = 104;
31 
32 #define PERSIST_TEMP 1
33 #define PERSIST_PERM 2
34 #define PERSIST_BOTH 3
35 
36 class RoomManager {
37 public:
38  RoomManager();
39  ~RoomManager();
40  void clearTalkingAnims();
41  void clearAnims();
42  void clearRoomStickerPixels();
43  void loadRoomMetadata(Common::File *roomFile, int roomNumber);
47  RoomPasserBys *loadPasserByAnims(int roomNumber);
52  void loadRoomTalkingAnimations(int roomNumber);
53  void getPalette(Common::File *roomFile, int roomOffset, byte *palette);
54  void getBackground(Common::File *roomFile, int roomOffset, byte *background);
55  void loadWaterPaletteRemap();
56 
58  void addSticker(int stickerId, int persist = PERSIST_BOTH);
59  void addStickerToRoom(byte room, int stickerId, int persist = PERSIST_BOTH);
60 
61  void removeSticker(int stickerId);
62  void removeStickerFromRoom(byte room, int stickerId);
63 
64  bool hasSticker(int index);
65  bool hasSticker(byte room, int index);
66 
67  void changeExit(byte index, bool enabled, int persist = PERSIST_BOTH);
68  void changeExit(byte room, byte index, bool enabled, int persist = PERSIST_BOTH);
69 
70  void disableExit(byte index, int persist = PERSIST_BOTH);
71  void disableExit(byte room, byte index, int persist = PERSIST_BOTH);
72  void enableExit(byte index, int persist = PERSIST_BOTH);
73  void enableExit(byte room, byte index, int persist = PERSIST_BOTH);
74 
75  void changeWalkBox(WalkBox walkbox, int persist = PERSIST_BOTH);
76  void changeWalkbox(byte room, WalkBox walkbox, int persist = PERSIST_BOTH);
77 
78  void changeHotSpot(HotSpot hotspot, int persist = PERSIST_BOTH);
79  void changeHotspot(byte room, HotSpot hotspot, int persist = PERSIST_BOTH);
80 
81  void disableSprite(byte spriteIndex, int persist = PERSIST_BOTH);
82  void disableSprite(byte roomNumber, byte spriteIndex, int persist = PERSIST_BOTH);
83  void enableSprite(byte spriteIndex, byte zOrder, int persist = PERSIST_BOTH);
84  void enableSprite(byte roomNumber, byte spriteIndex, byte zOrder, int persist = PERSIST_BOTH);
88  void enableHotspot(HotSpot *hotspot, int persist = PERSIST_BOTH);
89  void enableHotspot(byte room, HotSpot *hotspot, int persist = PERSIST_BOTH);
90 
91  void disableHotspot(HotSpot *hotspot, int persist = PERSIST_BOTH);
92  void disableHotspot(byte room, HotSpot *hotspot, int persist = PERSIST_BOTH);
93 
94  void moveHotspot(HotSpot *hotspot, int16 newX, int16 newY, int persist = PERSIST_BOTH);
95  void moveHotspot(byte room, HotSpot *hotspot, int16 newX, int16 newY, int persist = PERSIST_BOTH);
96  void setActionMask(HotSpot *hotspot, byte actionMask, int persist = PERSIST_BOTH);
97 
98  void addWalkbox(WalkBox walkbox, int persist = PERSIST_BOTH);
99  void addWalkbox(byte room, WalkBox walkbox, int persist = PERSIST_BOTH);
100 
101  void applyDisabledChoices(byte roomNumber, byte *conversationData, size_t conversationDataSize);
102  void applyDisabledChoice(ResetEntry entry, byte *conversationData, size_t conversationDataSize);
103  void addDisabledChoice(ChoiceOption choice);
104 
108  bool isPickableByExtra(uint16 extra);
109 
110  Sprite *findSpriteByIndex(byte index);
111  Sprite *findSpriteByExtra(int16 extra);
112  HotSpot *findHotspotByIndex(byte index);
113  HotSpot *findHotspotByExtra(uint16 extra);
114  PaletteAnim *getPaletteAnimForRoom(int roomNumber);
115 
116  byte _currentRoomNumber = 0;
117  int _prevRoomNumber = -1;
118  Common::Array<HotSpot> _currentRoomHotspots;
119  Common::Array<Sprite> _currentRoomAnims;
120  Common::Array<Exit> _currentRoomExits;
121  Common::Array<WalkBox> _currentRoomWalkboxes;
122  Common::Array<Description> _currentRoomDescriptions;
123 
124  TalkingAnims _talkingAnims;
125  ScalingParams _scaleParams;
126  byte *_pixelsShadows = nullptr;
127  byte _roomPalette[768];
128  byte _paletteRemaps[5][256];
129  byte _musicTrack = 0;
130  Common::Array<byte> _roomSfx;
131  PaletteAnim *_currentPaletteAnim = nullptr;
132  RoomPasserBys *_passerByAnims = nullptr;
133  byte *_conversationData = nullptr;
134  size_t _conversationDataSize = 0;
135  Common::Array<Sticker> _roomStickers;
136  Common::Array<byte *> _roomStickerPixelData;
137  uint32 _conversationOffset;
138 
139 private:
140  void init();
141  void loadAnimationPixelData(Common::File *roomFile, int roomOffset, byte *&buffer, size_t &outSize);
142  void loadRoomAnimations(byte *pixelData, size_t pixelDataSize, byte *data, size_t size);
143  void loadHotspots(byte *data, size_t size);
144  void loadExits(byte *data, size_t size);
145  ScalingParams loadScalingParams(byte *data, size_t size);
146  void loadWalkboxes(byte *data, size_t size);
147  uint32 loadDescriptions(byte *pair12data, size_t pair12size, Common::Array<Description> &outDescriptions);
148  void loadConversationData(byte *pair12data, size_t pair12size, uint32 startPos, size_t &outConversationDataSize, byte *&outConversationData);
149  void resetConversationStates(byte roomNumber, byte *conversationData, size_t conversationDataSize);
150  void resetMetadataDefaults(byte room, byte *&data, size_t size);
151 
152  byte *loadShadowMap(int roomNumber);
153  void loadRemaps(int roomNumber);
154  Common::StringArray loadRoomNames();
155  byte loadMusicTrackForRoom(Common::File *roomFile, int roomOffset);
156  Common::Array<byte> loadRoomSfx(Common::File *roomFile, int roomOffset);
157 
158  byte *_resetData = nullptr;
159  Common::Array<HotSpot> _staticHotspots;
160 };
161 
162 } // End of namespace Pelrock
163 
164 #endif
Definition: types.h:381
Definition: types.h:489
Definition: types.h:515
Definition: array.h:52
Definition: types.h:467
Definition: actions.h:26
Definition: types.h:308
Definition: file.h:47
Definition: algorithm.h:29
Definition: room.h:36
Definition: types.h:289
Definition: types.h:365
Definition: types.h:501
Definition: types.h:323