ScummVM API documentation
penetration.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 * This file is dual-licensed.
22 * In addition to the GPLv3 license mentioned above, this code is also
23 * licensed under LGPL 2.1. See LICENSES/COPYING.LGPL file for the
24 * full text of the license.
25 *
26 */
27
28#ifndef GOB_MINIGAMES_GEISHA_PENETRATION_H
29#define GOB_MINIGAMES_GEISHA_PENETRATION_H
30
31#include "common/system.h"
32#include "common/list.h"
33
34#include "gob/sound/sounddesc.h"
35
36#include "gob/minigames/geisha/submarine.h"
37
38namespace Gob {
39
40class GobEngine;
41class Surface;
42class CMPFile;
43class ANIFile;
44
45namespace Geisha {
46
47class Meter;
48class Mouth;
49
52public:
55
56 bool play(bool hasAccessPass, bool hasMaxEnergy, bool testMode);
57
58 bool isPlaying() const;
59 void cheatWin();
60
61private:
62 static const int kModeCount = 2;
63 static const int kFloorCount = 3;
64
65 static const int kMapWidth = 17;
66 static const int kMapHeight = 13;
67
68 static const int kPaletteSize = 16;
69
70 static const byte kPalettes[kFloorCount][3 * kPaletteSize];
71 static const byte kMaps[kModeCount][kFloorCount][kMapWidth * kMapHeight];
72
73 static const int kEnemyCount = 9;
74 static const int kMaxBulletCount = 10;
75
76 struct MapObject {
77 uint16 tileX;
78 uint16 tileY;
79
80 uint16 mapX;
81 uint16 mapY;
82
83 uint16 width;
84 uint16 height;
85
86 bool isBlocking;
87
88 MapObject(uint16 tX, uint16 tY, uint16 mX, uint16 mY, uint16 w, uint16 h);
89 MapObject(uint16 tX, uint16 tY, uint16 w, uint16 h);
90
91 void setTileFromMapPosition();
92 void setMapFromTilePosition();
93
94 bool isIn(uint16 mX, uint16 mY) const;
95 bool isIn(uint16 mX, uint16 mY, uint16 w, uint16 h) const;
96 bool isIn(const MapObject &obj) const;
97 };
98
99 enum MouthType {
100 kMouthTypeBite,
101 kMouthTypeKiss
102 };
103
104 struct ManagedMouth : public MapObject {
105 Mouth *mouth;
106
107 MouthType type;
108
109 ManagedMouth(uint16 tX, uint16 tY, MouthType t);
110 ~ManagedMouth();
111 };
112
113 struct ManagedSub : public MapObject {
114 Submarine *sub;
115
116 ManagedSub(uint16 tX, uint16 tY);
117 ~ManagedSub();
118 };
119
120 struct ManagedEnemy : public MapObject {
121 ANIObject *enemy;
122
123 bool dead;
124
125 ManagedEnemy();
126 ~ManagedEnemy();
127
128 void clear();
129 };
130
131 struct ManagedBullet : public MapObject {
132 ANIObject *bullet;
133
134 int16 deltaX;
135 int16 deltaY;
136
137 ManagedBullet();
138 ~ManagedBullet();
139
140 void clear();
141 };
142
143 enum Keys {
144 kKeyUp = 0,
145 kKeyDown,
146 kKeyLeft,
147 kKeyRight,
148 kKeySpace,
149 kKeyCount
150 };
151
152 GobEngine *_vm;
153
154 bool _hasAccessPass;
155 bool _hasMaxEnergy;
156 bool _testMode;
157
158 bool _needFadeIn;
159
160 bool _quit;
161 bool _keys[kKeyCount];
162
163 Surface *_background;
164 CMPFile *_sprites;
165 ANIFile *_objects;
166
169
170 Meter *_shieldMeter;
171 Meter *_healthMeter;
172
173 uint8 _floor;
174
175 Surface *_map;
176
177 ManagedSub *_sub;
178
183
184 ManagedEnemy _enemies[kEnemyCount];
185 ManagedBullet _bullets[kMaxBulletCount];
186
187 Common::List<MapObject *> _blockingObjects;
188
189 uint8 _shotCoolDown;
190
191 SoundDesc _soundShield;
192 SoundDesc _soundBite;
193 SoundDesc _soundKiss;
194 SoundDesc _soundShoot;
195 SoundDesc _soundExit;
196 SoundDesc _soundExplode;
197
198 bool _isPlaying;
199
200
201 void init();
202 void deinit();
203
204 void clearMap();
205 void createMap();
206
207 void initScreen();
208
209 void setPalette();
210 void fadeIn();
211
212 void drawFloorText();
213 void drawEndText();
214
215 bool isBlocked(const MapObject &self, int16 x, int16 y, MapObject **blockedBy = 0);
216 void findPath(MapObject &obj, int x, int y, MapObject **blockedBy = 0);
217
218 void updateAnims();
219
220 void checkInput();
221
222 Submarine::Direction getDirection(int &x, int &y) const;
223
224 void handleSub();
225 void subMove(int x, int y, Submarine::Direction direction);
226 void subShoot();
227
228 int findEmptyBulletSlot() const;
229 uint16 directionToBullet(Submarine::Direction direction) const;
230 void setBulletPosition(const ManagedSub &sub, ManagedBullet &bullet) const;
231
232 void bulletsMove();
233 void bulletMove(ManagedBullet &bullet);
234 void checkShotEnemy(MapObject &shotObject);
235
236 void checkExits();
237 void checkShields();
238 void checkMouths();
239
240 void healthGain(int amount);
241 void healthLose(int amount);
242
243 void checkExited();
244
245 void enemiesCreate();
246 void enemiesMove();
247 void enemyMove(ManagedEnemy &enemy, int x, int y);
248 void enemyAttack(ManagedEnemy &enemy);
249 void enemyExplode(ManagedEnemy &enemy);
250
251 bool isDead() const;
252 bool hasWon() const;
253
254 int getLanguage() const;
255};
256
257} // End of namespace Geisha
258
259} // End of namespace Gob
260
261#endif // GOB_MINIGAMES_GEISHA_PENETRATION_H
Definition: list.h:44
Definition: anifile.h:53
Definition: aniobject.h:42
Definition: cmpfile.h:49
Definition: meter.h:40
Definition: mouth.h:38
Definition: penetration.h:51
Definition: submarine.h:38
Definition: gob.h:166
Definition: sounddesc.h:43
Definition: surface.h:106