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 NANCY_ACTION_LEVERPUZZLE_H 24 #define NANCY_ACTION_LEVERPUZZLE_H 25 26 #include "engines/nancy/renderobject.h" 27 28 #include "engines/nancy/action/actionrecord.h" 29 30 namespace Nancy { 31 namespace Action { 32 33 class LeverPuzzle : public ActionRecord, public RenderObject { 34 public: 35 enum SolveState { kNotSolved, kPlaySound, kWaitForSound }; LeverPuzzle(RenderObject & redrawFrom)36 LeverPuzzle(RenderObject &redrawFrom) : RenderObject(redrawFrom, 7) {} ~LeverPuzzle()37 virtual ~LeverPuzzle() {} 38 39 virtual void init() override; 40 41 virtual void readData(Common::SeekableReadStream &stream) override; 42 virtual void execute() override; 43 virtual void handleInput(NancyInput &input) override; 44 virtual void onPause(bool pause) override; 45 46 Common::String _imageName; // 0x0 47 Common::Array<Common::Array<Common::Rect>> _srcRects; // 0xA, 0xC0 bytes 48 Common::Array<Common::Rect> _destRects; // 0xCA, 0x30 bytes 49 Common::Array<byte> _correctSequence; // 0xFA, 3 bytes 50 SoundDescription _moveSound; // 0x100 51 SoundDescription _noMoveSound; // 0x122 52 SceneChangeDescription _solveExitScene; // 0x144 53 EventFlagDescription _flagOnSolve; // 0x14E 54 uint16 _solveSoundDelay = 0; // 0x151 55 SoundDescription _solveSound; // 0x153 56 SceneChangeDescription _exitScene; // 0x175 57 EventFlagDescription _flagOnExit; // 0x17F 58 Common::Rect _exitHotspot; // 0x182 59 60 Common::Array<byte> _playerSequence; 61 Common::Array<bool> _leverDirection; 62 Graphics::ManagedSurface _image; 63 Time _solveSoundPlayTime; 64 SolveState _solveState = kNotSolved; 65 66 protected: getRecordTypeName()67 virtual Common::String getRecordTypeName() const override { return "LeverPuzzle"; } isViewportRelative()68 virtual bool isViewportRelative() const override { return true; } 69 70 void drawLever(uint id); 71 }; 72 73 } // End of namespace Action 74 } // End of namespace Nancy 75 76 #endif // NANCY_ACTION_LEVERPUZZLE_H 77