ScummVM API documentation
board.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 ASYLUM_PUZZLES_BOARD_H
23 #define ASYLUM_PUZZLES_BOARD_H
24 
25 #include "asylum/puzzles/puzzle.h"
26 
27 #include "asylum/shared.h"
28 
29 namespace Asylum {
30 
31 class AsylumEngine;
32 
33 class PuzzleBoard : public Puzzle {
34 public:
35  struct SoundResource {
36  int32 index;
37  bool played;
38  };
39 
40  struct CharMap {
41  char character;
42  int16 posX, posY;
43  };
44 
45  struct PuzzleData {
46  uint32 backgroundIndex;
47  GameFlag gameFlag;
48  uint32 maxWidth;
49  uint32 soundResourceSize;
50  SoundResource soundResources[3];
51  uint32 charMapSize;
52  CharMap charMap[11];
53  bool checkForSpace;
54  uint32 space1Pos, space2Pos;
55  char solvedText[28];
56  };
57 
58  PuzzleBoard(AsylumEngine *engine, const PuzzleData *data);
59 
60  void reset();
61 
62 protected:
63  PuzzleData _data;
64  bool _solved;
65  Common::String _text;
66  bool _charUsed[20];
67  char _solvedText[28]; // KeyHidesTo uses 28 chars, the other puzzles 20
68  uint32 _position;
69  int32 _rectIndex;
70  int32 _selectedSlot;
71  ResourceId _soundResourceId;
72 
74  // Helpers
76  void updateScreen();
77  int32 findRect();
78  bool stopSound();
79  void checkSlots();
80 
82  // Event Handling
84  bool init(const AsylumEvent &evt);
85  bool activate(const AsylumEvent &evt) { return updateScreen(), true; }
86  bool exitPuzzle();
87 
88 private:
90  // Helpers
92  void drawText();
93  void playSound();
94  int32 checkMouse();
95  void updateCursor();
96 };
97 
98 } // End of namespace Asylum
99 
100 #endif // ASYLUM_PUZZLES_BOARD_H
Definition: str.h:59
Definition: asylum.h:53
Definition: board.h:40
Definition: board.h:33
Definition: eventhandler.h:43
Definition: board.h:45
Definition: asylum.h:73
Definition: puzzle.h:41