ScummVM API documentation
plumbers.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 PLUMBERS_PLUMBERS_H
23 #define PLUMBERS_PLUMBERS_H
24 
25 #include "engines/engine.h"
26 
27 #include "common/events.h"
28 #include "common/platform.h"
29 #include "common/queue.h"
30 #include "common/rect.h"
31 #include "common/str.h"
32 
33 #include "audio/mixer.h"
34 
35 #include "video/video_decoder.h"
36 #include "image/image_decoder.h"
37 
38 struct ADGameDescription;
39 
40 namespace Graphics {
41 struct Surface;
42 }
43 
44 namespace Plumbers {
45 
46 class Console;
47 
48 enum PlumbersDebugChannels {
49  kDebugGeneral = 1 << 0
50 };
51 
52 static const int kMaxChoice = 3;
53 
54 struct Choice {
55  long _points;
56  int _skipScene;
57  Common::Rect _region;
58  Common::String _sceneName;
59 };
60 
61 struct Scene {
62  int _bitmapNum;
63  int _startBitmap;
64  int _decisionChoices;
65  Common::String _sceneName;
66  Common::String _waveFilename;
67  Common::String _decisionBitmap;
68  enum {
69  STYLE_PC = 0,
70  STYLE_DECISION_MIKE = 1,
71  STYLE_DECISION_TUN = 2,
72  STYLE_VIDEO = 3
73  } _style;
74  Choice _choices[kMaxChoice];
75 };
76 
77 class PlumbersGame : public Engine {
78 public:
79  PlumbersGame(OSystem *syst, const ADGameDescription *gameDesc);
80  ~PlumbersGame() override;
81 
82  Common::Error run() override;
83 
84  // Detection related functions
85  const ADGameDescription *_gameDescription;
86  const char *getGameId() const;
87  Common::Platform getPlatform() const;
88 
89 protected:
90  virtual void readTables() = 0;
91  virtual void postSceneBitmaps() = 0;
92  virtual bool handlePlatformJoyButton(int button) { return false; }
93  virtual bool handlePlatformKeyDown(int button) { return false; }
94  virtual void loadImage(const Common::String &name);
95  virtual void startGraphics() = 0;
96  void blitImageSurface(const Graphics::Surface *surface);
97  virtual void blitImage();
98  virtual void handleEvent(const Common::Event &event);
99  virtual int getSceneNumb(const Common::String &sName);
100  virtual void preActions() {}
101 
102  static const int kMaxName = 13 + 1;
103  static const int kMaxBitmaps = 2000;
104  static const int kMaxScene = 100;
105  void initTables();
106 
107  struct {
108  int _duration;
109  Common::String _filename;
110  } _bitmaps[kMaxBitmaps];
111 
112  Scene _scenes[kMaxScene];
113  int _totScene;
114  long _totScore;
115 
116  Graphics::PixelFormat _targetFormat;
117 
118  Image::ImageDecoder *_image;
119  Console *_console;
120  Video::VideoDecoder *_videoDecoder;
121  bool _showScoreFl;
122  bool _setDurationFl;
123  bool _leftButtonDownFl;
124  bool _endGameFl;
125  bool _timerInstalled;
126  int _curSceneIdx, _prvSceneIdx;
127  int _curBitmapIdx;
128  int _curChoice;
129  int _screenW, _screenH;
130  bool _quit;
131 
132  enum Action {
133  Redraw,
134  ShowScene,
135  UpdateScene,
136  ChangeScene,
137  PlaySound
138  };
139 
140  Common::Queue<Action> _actions;
141  Graphics::Surface *_compositeSurface;
142 
143  void drawScreen();
144 
145  Audio::SoundHandle _soundHandle;
146 
147  void playSound(const Common::String &name);
148  void stopSound();
149 
150  void showScene();
151  void updateScene();
152  void changeScene();
153 
154  void processTimer();
155  static void onTimer(void *arg);
156 
157  int getMouseHiLite();
158 };
159 
161 public:
162  PlumbersGame3DO(OSystem *syst, const ADGameDescription *gameDesc);
163 
164 protected:
165  void readTables() override;
166  void postSceneBitmaps() override;
167  void startGraphics() override;
168  void handleEvent(const Common::Event &event) override;
169  void blitImage() override;
170  int getSceneNumb(const Common::String &sName) override;
171  void preActions() override;
172 
173 private:
174  void skipVideo();
175  void loadMikeDecision(const Common::String &dirname, const Common::String &baseFilename, uint num);
176  void joyUp();
177  void joyDown();
178  void joyA();
179  void updateHiLite();
180 
181  bool _cheatEnabled;
182  int _cheatFSM;
183  bool _leftShoulderPressed;
184  int _kbdHiLite;
185  int _mouseHiLite;
186  int _hiLite;
187  Image::ImageDecoder *_ctrlHelpImage;
188 };
189 
191 public:
192  PlumbersGameWindows(OSystem *syst, const ADGameDescription *gameDesc);
193 
194 protected:
195  void readTables() override;
196  void postSceneBitmaps() override;
197  void loadImage(const Common::String &name) override;
198  void startGraphics() override;
199 
200 private:
201  bool _halfSize;
202 };
203 
204 } // End of namespace Plumbers
205 
206 #endif
Definition: plumbers.h:61
Definition: plumbers.h:54
Definition: image_decoder.h:52
Definition: plumbers.h:190
Definition: str.h:59
Definition: surface.h:67
Definition: error.h:84
Definition: pixelformat.h:138
Definition: advancedDetector.h:163
Definition: plumbers.h:160
Definition: rect.h:144
Definition: mixer.h:49
Definition: video_decoder.h:53
Definition: events.h:199
Definition: formatinfo.h:28
Definition: system.h:161
Definition: console.h:29
Definition: engine.h:144
Definition: plumbers.h:77
Platform
Definition: platform.h:46
Definition: console.h:27