ScummVM API documentation
caldoriabomb.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  * Additional copyright for this file:
8  * Copyright (C) 1995-1997 Presto Studios, Inc.
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program. If not, see <http://www.gnu.org/licenses/>.
22  *
23  */
24 
25 #ifndef PEGASUS_NEIGHBORHOOD_CALDORIA_CALDORIABOMB_H
26 #define PEGASUS_NEIGHBORHOOD_CALDORIA_CALDORIABOMB_H
27 
28 #include "pegasus/interaction.h"
29 #include "pegasus/notification.h"
30 #include "pegasus/surface.h"
31 
32 namespace Pegasus {
33 
34 /*
35  Edge list is arranged as follows:
36 
37  all values in the edge list are bytes.
38 
39  all vertices are numbers between 0 and 24. x coordinate of vertex is vertex % 5,
40  and y coordinate is vertex / 5.
41 
42  an edge is
43  a direction code
44  a number of vertices in the edge
45  an array of vertices -- all vertices along the edge, whether or not they're
46  clickable.
47  an array of bools (bytes) indicating that a portion of the edge is
48  traversed (and should be drawn). the number of bools is one less than
49  the number of vertices.
50 
51  an edge list is
52  an array of 25 bools indicating which vertex is clickable.
53  an array of 25 bools indicating which vertex is used (drawn).
54  a number of edges
55  an array of edges.
56 
57  a hot vertex list is
58  a number of vertices
59  an array of 25 vertices
60 
61 */
62 
63 typedef int8 VertexType;
64 typedef VertexType *BombEdgeList;
65 
66 static const VertexType kEdgeOneSixteenth = 0;
67 static const VertexType kEdgeOneEighth = 1;
68 static const VertexType kEdgeThreeSixteenths = 2;
69 static const VertexType kEdgeOneFourth = 3;
70 static const VertexType kEdgeFiveSixteenths = 4;
71 static const VertexType kEdgeThreeEighths = 5;
72 static const VertexType kEdgeSevenSixteenths = 6;
73 static const VertexType kEdgeOneHalf = 7;
74 
75 class BombTimer : public IdlerAnimation {
76 public:
77  BombTimer(const DisplayElementID);
78  ~BombTimer() override {}
79 
80  void draw(const Common::Rect &) override;
81 
82 protected:
83  void timeChanged(const TimeValue) override;
84 
85  int _middle;
86  Surface _leftImage, _rightImage;
87 };
88 
89 class BombGrid : public Picture {
90 public:
91  BombGrid(const DisplayElementID);
92  ~BombGrid() override {}
93 
94  void drawEdges(BombEdgeList);
95 
96 protected:
97  Frame _yellowDot;
98  Frame _yellowOneSixteenth;
99  Frame _yellowOneEighth;
100  Frame _yellowThreeSixteenths;
101  Frame _yellowOneFourth;
102  Frame _yellowFiveSixteenths;
103  Frame _yellowThreeEighths;
104  Frame _yellowSevenSixteenths;
105  Frame _yellowOneHalf;
106  Frame _redDot;
107  Frame _redOneSixteenth;
108  Frame _redOneEighth;
109  Frame _redThreeSixteenths;
110  Frame _redOneFourth;
111  Frame _redFiveSixteenths;
112  Frame _redThreeEighths;
113  Frame _redSevenSixteenths;
114  Frame _redOneHalf;
115 };
116 
117 class Hotspot;
118 
120 public:
122  ~CaldoriaBomb() override;
123 
124  void setSoundFXLevel(const uint16) override;
125  void setAmbienceLevel(const uint16) override;
126 
127  long getNumHints() override;
128  Common::Path getHintMovie(uint) override;
129  void doSolve() override;
130  bool canSolve() override;
131 
132 protected:
133  void openInteraction() override;
134  void initInteraction() override;
135  void closeInteraction() override;
136  void receiveNotification(Notification *, const NotificationFlags) override;
137  void activateHotspots() override;
138  void clickInHotspot(const Input &, const Hotspot *) override;
139  void handleInput(const Input &, const Hotspot *) override;
140  InputBits getInputFilter() override;
141  void startBombAmbient(const Common::Path &);
142 
143  Notification *_neighborhoodNotification;
144  BombGrid _grid;
145  BombTimer _timer;
146  BombEdgeList _bombLevel[6];
147  int _currentLevel, _flashTime;
148  Hotspot *_vertexHotspot[25];
149  VertexType _lastVertex;
150  Notification _timerNotification;
151  NotificationCallBack _timerCallBack;
152 
153  TimeValue _readTime;
154 };
155 
156 } // End of namespace Pegasus
157 
158 #endif
Definition: neighborhood.h:111
Definition: caldoriabomb.h:89
Definition: caldoriabomb.h:119
Definition: rect.h:144
Definition: path.h:52
Definition: hotspot.h:85
Definition: input.h:322
Definition: caldoriabomb.h:75
Definition: surface.h:105
Definition: notification.h:53
Definition: interaction.h:37
Definition: timers.h:191
Definition: notification.h:103
Definition: surface.h:50
Definition: notification.h:83
Definition: elements.h:117
Definition: ai_action.h:33
Definition: surface.h:125