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 
22 #ifndef ACCESS_ROOM_H
23 #define ACCESS_ROOM_H
24 
25 #include "common/scummsys.h"
26 #include "common/array.h"
27 #include "common/rect.h"
28 #include "access/data.h"
29 #include "access/detection.h"
30 
31 #define TILE_WIDTH 16
32 #define TILE_HEIGHT 16
33 
34 namespace Access {
35 
36 class Plotter {
37 public:
40  int _blockIn;
41  int _delta;
42 public:
43  Plotter();
44 
45  void load(Common::SeekableReadStream *stream, int wallCount, int blockCount);
46 };
47 
48 class JetFrame {
49 public:
50  int _wallCode;
51  int _wallCodeOld;
52  int _wallCode1;
53  int _wallCode1Old;
54 
55  JetFrame() {
56  _wallCode = _wallCodeOld = 0;
57  _wallCode1 = _wallCode1Old = 0;
58  }
59 };
60 
61 enum Function { FN_NONE = 0, FN_CLEAR1 = 1, FN_CLEAR2 = 2, FN_RELOAD = 3, FN_BREAK = 4, FN_5 = 5 };
62 
63 // room flags for Noctropolis
64 enum RoomFlag {
65  kRoomFlagStiletto = 2,
66  kRoomFlagTopView = 4,
67  kRoomFlagNoPlayer = 0x80,
68 };
69 
70 
71 class Room : public Manager {
72 private:
73  void roomLoop();
74 
75  void cmdExitContinuance();
76  void roomLoopContinuance();
77 
78  void commandOff();
79 
80  void swapOrg();
81  int calcLR(int yp);
82  int calcUD(int xp);
83 
84  void takePicture();
85 
89  void cycleCommand(int incr);
90 
91  bool checkCode(int v1, int v2);
92 
93 protected:
94  void loadRoomData(const byte *roomData);
95 
99  void freePlayField();
100 
104  void freeTileData();
105 
106  int checkBoxes();
107  int checkBoxes2(const Common::Point &pt, int start, int count);
108  void checkBoxes3();
109 
110  virtual int validateBox(int boxId);
111 
115  void executeCommand(int commandId);
116 
117  void clearCamera();
118 
119  virtual void roomInit();
120 
121  virtual void reloadRoom() = 0;
122 
123  virtual void reloadRoom1() = 0;
124 
125  virtual void setupRoom();
126 
127  virtual void doCommands();
128 
129  virtual void mainAreaLClick() = 0;
130 
131  virtual void mainAreaRClick() {};
132 
133  virtual void walkCursor();
134 public:
135  Plotter _plotter;
136  Common::Array<JetFrame> _jetFrame;
137  Function _function;
138  int _roomFlag;
139  byte _palIntensity;
140  uint16 *_playField;
141  int _matrixSize;
142  int _playFieldWidth;
143  int _playFieldHeight;
144  byte *_tile;
145  int _selectCommand;
146  bool _conFlag; // not the same as script->_continuenceFlag which is used in Noctropolis
147  int _rMouse[10][2];
148 public:
149  Room(AccessEngine *vm);
150 
151  virtual ~Room();
152 
153  void doRoom();
154 
155  void loadRoom(int roomNumber);
156 
157  virtual void roomMenu() = 0;
158 
162  virtual void clearRoom();
163 
167  void buildScreen();
168 
172  void buildColumn(int playX, int screenX);
173 
177  void buildRow(int playY, int screenY);
178 
179  virtual void init4Quads() = 0;
180 
181  void setWallCodes();
182 
183  bool codeWalls();
184 
188  void handleCommand(int commandId);
189 
190  void loadPlayField(int fileNum, int subfile);
191 
192  int checkBoxes1(const Common::Point &pt);
193 };
194 
195 class RoomInfo {
196 public:
198  Common::String _soundFilename;
199  int _priority;
200  };
201 public:
202  byte _roomFlag;
203  int _estIndex;
204  byte _palIntensity;
205  FileIdent _musicFile;
206  int _scaleH1;
207  int _scaleH2;
208  int _scaleN1;
209  FileIdent _playFieldFile;
211  FileIdent _scriptFile;
212  FileIdent _animFile;
213  int _scaleI;
214  int _scrollThreshold;
215  FileIdent _paletteFile;
216  int _startColor;
217  int _numColors;
218  Common::Array<ExtraCell> _extraCells;
220 public:
221  RoomInfo(const byte *data, AccessGameType gameType, bool isCD, bool isDemo);
222 };
223 
224 } // End of namespace Access
225 
226 #endif /* ACCESS_ROOM_H */
Definition: files.h:36
Definition: str.h:59
Definition: room.h:36
Definition: data.h:37
Definition: access.h:141
Definition: stream.h:745
Definition: room.h:48
Definition: rect.h:144
Definition: room.h:197
Definition: room.h:195
Definition: room.h:71
Definition: access.h:62