ScummVM API documentation
diving.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_DIVING_H
29 #define GOB_MINIGAMES_GEISHA_DIVING_H
30 
31 #include "common/system.h"
32 
33 #include "gob/util.h"
34 
35 #include "gob/sound/sounddesc.h"
36 
37 namespace Gob {
38 
39 class GobEngine;
40 class Surface;
41 class DECFile;
42 class ANIFile;
43 class ANIObject;
44 
45 namespace Geisha {
46 
47 class EvilFish;
48 class Oko;
49 class Meter;
50 
52 class Diving {
53 public:
54  Diving(GobEngine *vm);
55  ~Diving();
56 
57  bool play(uint16 playerCount, bool hasPearlLocation);
58 
59  bool isPlaying() const;
60  void cheatWin();
61 
62 private:
63  static const uint kEvilFishCount = 3;
64  static const uint kDecorFishCount = 3;
65  static const uint kMaxShotCount = 10;
66 
67  static const uint kEvilFishTypeCount = 3;
68  static const uint16 kEvilFishTypes[kEvilFishTypeCount][5];
69 
70  struct PlantLevel {
71  int16 y;
72  uint plantCount;
73  const uint16 *plants;
74  };
75 
76  static const uint kPlantLevelCount = 3;
77  static const uint kPlantPerLevelCount = 5;
78 
79  static const uint16 kPlantLevel1[];
80  static const uint16 kPlantLevel2[];
81  static const uint16 kPlantLevel3[];
82 
83  static const PlantLevel kPlantLevels[kPlantLevelCount];
84 
85  static const uint kPlantCount = kPlantLevelCount * kPlantPerLevelCount;
86 
87  struct ManagedEvilFish {
88  EvilFish *evilFish;
89 
90  uint32 enterAt;
91  uint32 leaveAt;
92  };
93 
94  struct ManagedDecorFish {
95  ANIObject *decorFish;
96 
97  uint32 enterAt;
98  int8 deltaX;
99  };
100 
101  struct ManagedPlant {
102  ANIObject *plant;
103 
104  uint level;
105  int8 deltaX;
106  int16 x, y;
107  };
108 
109  struct ManagedPearl {
110  ANIObject *pearl;
111 
112  bool picked;
113  bool black;
114  };
115 
116  GobEngine *_vm;
117 
118  DECFile *_background;
119  ANIFile *_objects;
120  ANIFile *_gui;
121  ANIFile *_okoAnim;
122 
123  ANIObject *_water;
124  ANIObject *_lungs;
125  ANIObject *_heart;
126 
127  ManagedEvilFish _evilFish[kEvilFishCount];
128  ManagedDecorFish _decorFish[kDecorFishCount];
129  ManagedPlant _plant[kPlantCount];
130  ManagedPearl _pearl;
131 
132  Oko *_oko;
133 
134  ANIObject *_shot[kMaxShotCount];
135 
136  Common::List<int> _activeShots;
137 
139 
140  Surface *_blackPearl;
141 
142  uint8 _whitePearlCount;
143  uint8 _blackPearlCount;
144 
145  Meter *_airMeter;
146  Meter *_healthMeter;
147 
148  uint8 _airCycle;
149  uint8 _hurtGracePeriod;
150 
151  uint8 _currentShot;
152 
153  SoundDesc _soundShoot;
154  SoundDesc _soundBreathe;
155  SoundDesc _soundWhitePearl;
156  SoundDesc _soundBlackPearl;
157 
158  bool _hasPearlLocation;
159  bool _isPlaying;
160 
161 
162  void init();
163  void deinit();
164 
165  void initScreen();
166  void initCursor();
167  void initPlants();
168 
169  void enterPlant(ManagedPlant &plant, int16 prevPlantX);
170  void enterPearl(int16 x);
171 
172  void getPearl();
173 
174  void foundBlackPearl();
175  void foundWhitePearl();
176 
177  void updateAirMeter();
178  void updateEvilFish();
179  void updateDecorFish();
180  void updatePlants();
181  void updatePearl();
182  void updateAnims();
183 
184  int16 checkInput(int16 &mouseX, int16 &mouseY, MouseButtons &mouseButtons);
185 
186  void shoot(int16 mouseX, int16 mouseY);
187  void checkShots();
188 
189  void handleOko(int16 key);
190 
191  void checkOkoHurt();
192 };
193 
194 } // End of namespace Geisha
195 
196 } // End of namespace Gob
197 
198 #endif // GOB_MINIGAMES_GEISHA_DIVING_H
Definition: meter.h:40
Definition: decfile.h:51
Definition: gob.h:163
Definition: aniobject.h:42
Definition: diving.h:52
Definition: evilfish.h:38
Definition: anifile.h:40
Definition: surface.h:100
Definition: sounddesc.h:43
Definition: anifile.h:53
Definition: oko.h:41