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 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (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, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 */ 22 23 #ifndef PLUMBERS_PLUMBERS_H 24 #define PLUMBERS_PLUMBERS_H 25 26 #include "engines/engine.h" 27 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/3do_decoder.h" 36 37 struct ADGameDescription; 38 39 namespace Image { 40 class ImageDecoder; 41 } 42 43 namespace Graphics { 44 struct Surface; 45 } 46 47 namespace Plumbers { 48 49 class Console; 50 51 enum PlumbersDebugChannels { 52 kDebugGeneral = 1 << 0 53 }; 54 55 static const int kMaxChoice = 3; 56 57 struct Choice { 58 long _points; 59 int _skipScene; 60 Common::Rect _region; 61 Common::String _sceneName; 62 }; 63 64 struct Scene { 65 int _bitmapNum; 66 int _startBitmap; 67 int _decisionChoices; 68 Common::String _sceneName; 69 Common::String _waveFilename; 70 Common::String _decisionBitmap; 71 enum { 72 STYLE_PC = 0, 73 STYLE_DECISION_MIKE = 1, 74 STYLE_DECISION_TUN = 2, 75 STYLE_VIDEO = 3 76 } _style; 77 Choice _choices[kMaxChoice]; 78 }; 79 80 class PlumbersGame : public Engine { 81 public: 82 PlumbersGame(OSystem *syst, const ADGameDescription *gameDesc); 83 ~PlumbersGame() override; 84 85 Common::Error run() override; 86 87 // Detection related functions 88 const ADGameDescription *_gameDescription; 89 const char *getGameId() const; 90 Common::Platform getPlatform() const; 91 92 private: 93 static const int kMaxName = 13 + 1; 94 static const int kMaxBitmaps = 2000; 95 static const int kMaxScene = 100; 96 97 struct { 98 int _duration; 99 Common::String _filename; 100 } _bitmaps[kMaxBitmaps]; 101 102 Scene _scenes[kMaxScene]; 103 104 Image::ImageDecoder *_image; 105 Image::ImageDecoder *_ctrlHelpImage; 106 Console *_console; 107 108 bool _showScoreFl; 109 bool _setDurationFl; 110 bool _leftButtonDownFl; 111 bool _endGameFl; 112 bool _timerInstalled; 113 int _curSceneIdx, _prvSceneIdx; 114 int _curBitmapIdx; 115 int _curChoice; 116 int _totScene; 117 long _totScore; 118 int _screenW, _screenH; 119 int _kbdHiLite; 120 int _mouseHiLite; 121 int _hiLite; 122 bool _hiLiteEnabled; 123 bool _cheatEnabled; 124 int _cheatFSM; 125 bool _leftShoulderPressed; 126 127 enum Action { 128 Redraw, 129 ShowScene, 130 UpdateScene, 131 ChangeScene, 132 PlaySound 133 }; 134 135 Common::Queue<Action> _actions; 136 Graphics::Surface *_compositeSurface; 137 138 void loadImage(const Common::String &name); 139 void loadMikeDecision(const Common::String &dirname, const Common::String &baseFilename, uint num); 140 void drawScreen(); 141 void updateHiLite(); 142 143 Audio::SoundHandle _soundHandle; 144 Video::ThreeDOMovieDecoder *_videoDecoder; 145 146 void playSound(const Common::String &name); 147 void stopSound(); 148 149 void showScene(); 150 void updateScene(); 151 void changeScene(); 152 153 void processTimer(); 154 static void onTimer(void *arg); 155 156 void initTables(); 157 void readTablesPC(const Common::String &fileName); 158 void readTables3DO(const Common::String &fileName); 159 int getSceneNumb(const Common::String &sName); 160 int getMouseHiLite(); 161 162 void joyUp(); 163 void joyDown(); 164 void joyA(); 165 void skipVideo(); 166 }; 167 } // End of namespace Plumbers 168 169 #endif 170