ScummVM API documentation
cubepuzzle.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_CUBEPUZZLE_H
23 #define NANCY_ACTION_CUBEPUZZLE_H
24 
25 #include "engines/nancy/action/actionrecord.h"
26 #include "engines/nancy/misc/mousefollow.h"
27 
28 namespace Nancy {
29 namespace Action {
30 
31 // Similar idea to AssemblyPuzzle; the player is provided with broken pieces of
32 // a cube, and has to assemble it back together. However, the data is completely
33 // different to AssemblyPuzzle's, so we need separate implementations.
35 public:
37  virtual ~CubePuzzle() {}
38 
39  void init() override;
40  void registerGraphics() override;
41 
42  void readData(Common::SeekableReadStream &stream) override;
43  void execute() override;
44  void handleInput(NancyInput &input) override;
45 
46 protected:
47  Common::String getRecordTypeName() const override { return "CubePuzzle"; };
48  bool isViewportRelative() const override { return true; }
49 
50  void rotateBase(int dir);
51 
52  Common::Path _imageName;
53 
54  Common::Rect _cwCursorDest;
55  Common::Rect _ccwCursorDest;
56 
57  Common::Rect _placedDest;
58 
59  Common::Array<Common::Rect> _pieceSrcs; // Used only when not placed
60  Common::Array<Common::Rect> _pieceDests; // Used only when not placed
61 
62  // 4 arrays with 9 rects each; every rect corresponds to a specific permutation of placed pieces:
63  // - bottom piece only (start state)
64  // - bottom & top piece
65  // - front piece placed
66  // - left piece placed
67  // - back piece placed
68  // - right piece placed
69  // - left + back piece placed
70  // - right + back piece placed
71  // - left + right piece placed
73 
74  uint16 _startRotation = 0;
75 
76  SoundDescription _rotateSound;
77  SoundDescription _pickUpSound;
78  SoundDescription _placeDownSound;
79 
80  // Multiple solve scenes, one for each cube orientation
81  Common::Array<uint> _solveSceneIDs;
82  SceneChangeWithFlag _solveScene;
83  SoundDescription _solveSound;
84 
85  SceneChangeWithFlag _exitScene;
86  Common::Rect _exitHotspot;
87 
89  Misc::MouseFollowObject _curPiece;
90 
91  Common::Array<bool> _placedPieces;
92  int _pickedUpPiece = -1;
93 
94  int _curRotation = 0;
95  bool _completed = false;
96 };
97 
98 } // End of namespace Action
99 } // End of namespace Nancy
100 
101 #endif // NANCY_ACTION_CUBEPUZZLE_H
Definition: managed_surface.h:51
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: commontypes.h:254
Definition: cubepuzzle.h:34
Definition: actionmanager.h:32