ScummVM API documentation
bulpuzzle.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_BULPUZZLE_H
23 #define NANCY_ACTION_BULPUZZLE_H
24 
25 #include "engines/nancy/action/actionrecord.h"
26 
27 namespace Nancy {
28 namespace Action {
29 
30 // A puzzle based around a simplified version of the Mayan game Bul
31 class BulPuzzle : public RenderActionRecord {
32 public:
34  virtual ~BulPuzzle() {}
35 
36  void init() override;
37  void updateGraphics() override;
38 
39  void readData(Common::SeekableReadStream &stream) override;
40  void execute() override;
41  void handleInput(NancyInput &input) override;
42 
43 protected:
44  enum BulAction { kNone, kRoll, kPass, kReset, kCapture };
45 
46  void movePiece(bool player);
47  void reset(bool capture);
48 
49  Common::String getRecordTypeName() const override { return "BulPuzzle"; }
50  bool isViewportRelative() const override { return true; }
51 
52  Common::Path _imageName;
53 
54  uint16 _numCells = 0;
55  uint16 _numPieces = 0;
56  uint16 _numRolls = 0;
57 
58  uint16 _playerStart = 0;
59  uint16 _enemyStart = 0;
60 
61  Common::Array<Common::Rect> _diceDestsPlayer;
62  Common::Array<Common::Rect> _diceDestsEnemy;
63 
64  Common::Array<Common::Rect> _cellDests;
65 
66  Common::Array<Common::Rect> _playerBarracksDests;
67  Common::Array<Common::Rect> _playerJailDests;
68 
69  Common::Array<Common::Rect> _enemyBarracksDests;
70  Common::Array<Common::Rect> _enemyJailDests;
71 
72  Common::Rect _rollButtonDest;
73  Common::Rect _passButtonDest;
74  Common::Rect _resetButtonDest;
75  Common::Rect _playerLightDest;
76  Common::Rect _enemyLightDest;
77 
78  Common::Array<Common::Rect> _diceBlackSrcs;
79  Common::Array<Common::Rect> _diceCleanSrcs;
80 
81  Common::Rect _playerSrc;
82  Common::Rect _enemySrc;
83  Common::Rect _playerCapturedSrc;
84  Common::Rect _enemyCapturedSrc;
85 
86  Common::Rect _playerBarracksSrc;
87  Common::Rect _enemyBarracksSrc;
88  Common::Rect _playerJailSrc;
89  Common::Rect _enemyJailSrc;
90 
91  Common::Rect _rollButtonSrc;
92  Common::Rect _passButtonSrc;
93  Common::Rect _passButtonDisabledSrc;
94  Common::Rect _resetButtonSrc;
95  Common::Rect _playerLightSrc;
96  Common::Rect _enemyLightSrc;
97 
98  SoundDescription _moveSound;
99  SoundDescription _playerCapturedSound;
100  SoundDescription _enemyCapturedSound;
101  SoundDescription _rollSound;
102  SoundDescription _passSound;
103  SoundDescription _resetSound;
104 
105  SceneChangeWithFlag _solveScene;
106  uint16 _solveSoundDelay = 0;
107  SoundDescription _solveSound;
108 
109  SceneChangeWithFlag _exitScene; // also when losing
110  uint16 _loseSoundDelay = 0;
111  SoundDescription _loseSound;
112  Common::Rect _exitHotspot;
113 
115 
116  int16 _playerPos = 0;
117  int16 _playerPieces = 0;
118  int16 _enemyPos = 0;
119  int16 _enemyPieces = 0;
120 
121  uint16 _turn = 0;
122  uint16 _moveDiff = 0;
123  uint32 _nextMoveTime = 0;
124  bool _pushedButton = false;
125  bool _changeLight = false;
126  BulAction _currentAction = kNone;
127 
128  bool _playerWon = false;
129 };
130 
131 } // End of namespace Action
132 } // End of namespace Nancy
133 
134 #endif // NANCY_ACTION_BULPUZZLE_H
Definition: managed_surface.h:51
Definition: bulpuzzle.h:31
Definition: str.h:59
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: actionmanager.h:32