ScummVM API documentation
driller.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 #include "audio/audiostream.h"
23 #include "audio/mixer.h"
24 #include "audio/softsynth/sid.h"
25 
26 #include "engines/freescape/games/driller/c64.music.h"
27 
28 namespace Freescape {
29 
30 enum DrillerFontSize {
31  kDrillerFontSmall,
32  kDrillerFontNormal,
33 };
34 
36 public:
37  DrillerEngine(OSystem *syst, const ADGameDescription *gd);
38  ~DrillerEngine();
39 
40  uint32 _initialJetEnergy;
41  uint32 _initialJetShield;
42 
43  uint32 _initialTankEnergy;
44  uint32 _initialTankShield;
45 
46  bool _useAutomaticDrilling;
47 
48  DrillerSIDPlayer *_playerSid;
49 
50  // Only used for Amiga and Atari ST
51  Font _fontSmall;
52  void drawString(const DrillerFontSize size, const Common::String &str, int x, int y, uint32 primaryColor, uint32 secondaryColor, uint32 backColor, Graphics::Surface *surface);
53 
54  Common::HashMap<uint16, uint32> _drillStatusByArea;
55  Common::HashMap<uint16, uint32> _drillMaxScoreByArea;
56  Common::HashMap<uint16, uint32> _drillSuccessByArea;
57 
58  void initKeymaps(Common::Keymap *engineKeyMap, Common::Keymap *infoScreenKeyMap, const char *target) override;
59  void initGameState() override;
60  bool checkIfGameEnded() override;
61  void endGame() override;
62 
63  void gotoArea(uint16 areaID, int entranceID) override;
64 
65  void drawInfoMenu() override;
66  void drawSensorShoot(Sensor *sensor) override;
67  void drawCompass(Graphics::Surface *surface, int x, int y, double degrees, double magnitude, double fov, uint32 color);
68 
69  void pressedKey(const int keycode) override;
70  Common::Error saveGameStreamExtended(Common::WriteStream *stream, bool isAutosave = false) override;
71  Common::Error loadGameStreamExtended(Common::SeekableReadStream *stream) override;
72 
73 private:
74  bool drillDeployed(Area *area);
75  GeometricObject *_drillBase;
76  Math::Vector3d drillPosition();
77  void addDrill(const Math::Vector3d position, bool gasFound);
78  bool checkDrill(const Math::Vector3d position);
79  void removeDrill(Area *area);
80  void addSkanner(Area *area);
81 
82  void loadAssets() override;
83  void loadAssetsAtariFullGame() override;
84  void loadAssetsAtariDemo() override;
85  void loadAssetsAmigaFullGame() override;
86  void loadAssetsAmigaDemo() override;
87  void loadAssetsDOSFullGame() override;
88  void loadAssetsDOSDemo() override;
89  void loadAssetsZXFullGame() override;
90  void loadAssetsCPCFullGame() override;
91  void loadAssetsC64FullGame() override;
92 
93  void drawDOSUI(Graphics::Surface *surface) override;
94  void drawZXUI(Graphics::Surface *surface) override;
95  void drawCPCUI(Graphics::Surface *surface) override;
96  void drawC64UI(Graphics::Surface *surface) override;
97  void drawAmigaAtariSTUI(Graphics::Surface *surface) override;
98  bool onScreenControls(Common::Point mouse) override;
99  void initAmigaAtari();
100  void initDOS();
101  void initZX();
102  void initCPC();
103  void initC64();
104 
105  void updateTimeVariables() override;
106 
107  Common::Rect _moveFowardArea;
108  Common::Rect _moveLeftArea;
109  Common::Rect _moveRightArea;
110  Common::Rect _moveBackArea;
111  Common::Rect _moveUpArea;
112  Common::Rect _moveDownArea;
113  Common::Rect _deployDrillArea;
114  Common::Rect _infoScreenArea;
115  Common::Rect _saveGameArea;
116  Common::Rect _loadGameArea;
117 
118  Graphics::ManagedSurface *load8bitTitleImage(Common::SeekableReadStream *file, int offset);
119  Graphics::ManagedSurface *load8bitDemoImage(Common::SeekableReadStream *file, int offset);
120 
121  uint32 getPixel8bitTitleImage(int index);
122  void renderPixels8bitTitleImage(Graphics::ManagedSurface *surface, int &i, int &j, int pixels);
123  Graphics::ManagedSurface *_borderExtra;
124  Texture *_borderExtraTexture;
125 
126  Common::SeekableReadStream *decryptFileAtari(const Common::Path &filename);
127 };
128 
129 enum DrillerReleaseFlags {
130  GF_AMIGA_MAGAZINE_DEMO = (1 << 0),
131  GF_ATARI_MAGAZINE_DEMO = (1 << 1),
132 };
133 
134 }
Definition: geometricobject.h:34
Definition: managed_surface.h:51
Definition: keymap.h:66
Definition: str.h:59
Definition: surface.h:67
Definition: stream.h:77
Definition: error.h:81
Definition: area.h:36
Definition: advancedDetector.h:164
Definition: rect.h:524
Definition: area.h:40
Definition: path.h:52
Definition: stream.h:745
Definition: freescape.h:170
Definition: c64.music.h:29
Definition: sensor.h:34
Definition: driller.h:35
Definition: rect.h:144
Definition: font.h:32
Definition: system.h:163
Definition: gfx.h:47