ScummVM API documentation
assemblypuzzle.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 NANCY_ACTION_ASSEMBLYPUZZLE_H
23 #define NANCY_ACTION_ASSEMBLYPUZZLE_H
24 
25 #include "engines/nancy/action/actionrecord.h"
26 #include "engines/nancy/misc/mousefollow.h"
27 
28 namespace Nancy {
29 
30 struct AssemblyPuzzleData;
31 
32 namespace Action {
33 
34 // Minigame where the player is provided with the broken pieces of something
35 // (a piece of pottery in nancy6), and has to assemble it.
37 public:
39  virtual ~AssemblyPuzzle() {}
40 
41  void init() override;
42  void registerGraphics() override;
43 
44  void readData(Common::SeekableReadStream &stream) override;
45  void execute() override;
46  void handleInput(NancyInput &input) override;
47 
48 protected:
49  Common::String getRecordTypeName() const override { return "AssemblyPuzzle"; };
50  bool isViewportRelative() const override { return true; }
51 
52  void rotateBase(bool ccw);
53 
57 
58  Common::Rect startRect;
59  uint16 correctRotation = 0;
60  uint16 layer = 0;
61  bool placed = false;
62 
63  int curRotation = 0;
64  };
65 
66  Common::Path _imageName;
67 
68  uint16 _height = 0;
69 
70  Common::Rect _cwCursorDest;
71  Common::Rect _ccwCursorDest;
72 
73  Common::Array<Piece> _pieces;
74 
75  SoundDescription _rotateSound;
76  SoundDescription _pickUpSound;
77  SoundDescription _placeDownSound;
78 
79  bool _allowWrongPieceHotspot = false;
80 
81  Common::Array<SoundDescription> _wrongPieceSounds;
82  Common::Array<Common::String> _wrongPieceTexts;
83 
84  SceneChangeWithFlag _solveScene; // has 9999 in nancy6, so the puzzle doesn't auto-exit
85  SoundDescription _solveSound;
86  Common::String _solveText;
87 
88  SceneChangeWithFlag _exitScene;
89  Common::Rect _exitHotspot;
90 
92 
93  int _pickedUpPiece = -1;
94  int _curRotation = 0;
95  uint _layersAssembled = 0;
96  bool _completed = false;
97 
98  AssemblyPuzzleData *_puzzleState = nullptr;
99 };
100 
101 } // End of namespace Action
102 } // End of namespace Nancy
103 
104 #endif // NANCY_ACTION_ASSEMBLYPUZZLE_H
Definition: managed_surface.h:51
Definition: puzzledata.h:113
Definition: str.h:59
Definition: mousefollow.h:42
Definition: rect.h:144
Definition: path.h:52
Definition: stream.h:745
Definition: input.h:41
Definition: commontypes.h:171
Definition: actionrecord.h:149
Definition: assemblypuzzle.h:36
Definition: assemblypuzzle.h:54
Definition: commontypes.h:254
Definition: actionmanager.h:32