ScummVM API documentation
globegame.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_NORAD_DELTA_GLOBEGAME_H
26 #define PEGASUS_NEIGHBORHOOD_NORAD_DELTA_GLOBEGAME_H
27 
28 #include "pegasus/interaction.h"
29 #include "pegasus/movie.h"
30 #include "pegasus/notification.h"
31 
32 namespace Pegasus {
33 
34 enum GlobeTrackDirection {
35  kTrackLeft,
36  kTrackRight,
37  kTrackUp,
38  kTrackDown
39 };
40 
41 // This class assumes that the globe movie is built at 15 frames per second with a
42 // time scale of 600, yielding 40 time unit per frame.
43 
44 class GlobeTracker : public Tracker {
45 public:
47  ~GlobeTracker() override {}
48 
49  void setTrackParameters(const Hotspot *, GlobeTrackDirection);
50  void continueTracking(const Input &) override;
51  void startTracking(const Input &) override;
52  void stopTracking(const Input &) override;
53  void activateHotspots() override;
54  bool stopTrackingInput(const Input &) override;
55 
56 protected:
57  void trackGlobeMovie();
58  void stopGlobeMovie();
59 
60  Movie *_globeMovie;
61  Picture *_leftHighlight;
62  Picture *_rightHighlight;
63  Picture *_upHighlight;
64  Picture *_downHighlight;
65  const Hotspot *_trackSpot;
66  int _trackTime;
67  GlobeTrackDirection _trackDirection;
68 };
69 
71 public:
72  GlobeCountdown(const DisplayElementID);
73  ~GlobeCountdown() override {}
74 
75  void setCountdownTime(const int);
76  void startCountdown();
77  void stopCountdown();
78 
79  void setDisplayOrder(const DisplayOrder);
80  void show() override;
81  void hide() override;
82  void moveElementTo(const CoordType, const CoordType) override;
83 
84  void draw(const Common::Rect &) override;
85 
86 protected:
87  Surface _digits;
88  int16 _digitOffset;
89 };
90 
91 static const int16 kNumAllSilos = 40;
92 static const int16 kNumTargetSilos = 10;
93 static const int16 kNumLongSlices = 72;
94 
96 public:
98  ~GlobeGame() override {}
99 
100  void setSoundFXLevel(const uint16) override;
101 
102  void handleInput(const Input &, const Hotspot *) override;
103  void clickInHotspot(const Input &, const Hotspot *) override;
104  void activateHotspots() override;
105 
106  bool canSolve() override;
107  void doSolve() override;
108 
109  struct Point3D {
110  float x, y, z;
111  };
112 
113  struct Line3D {
114  Point3D pt1, pt2;
115  };
116 
117 protected:
118  // Latitude (-90 - 90) and longitude (-180 - 180)
119  static const int16 _siloCoords[kNumAllSilos][2];
120 
121  static const int16 _targetSilo[kNumTargetSilos];
122  static const int16 _timeLimit[kNumTargetSilos];
123  static const TimeValue _siloName[kNumTargetSilos][2];
124 
125  void openInteraction() override;
126  void initInteraction() override;
127  void closeInteraction() override;
128 
129  void receiveNotification(Notification *, const NotificationFlags) override;
130 
131  void spinGlobe(const Input &, const Hotspot *, GlobeTrackDirection);
132  void clickGlobe(const Input &);
133 
134  int16 findClickedSilo(const Input &);
135 
136  void globeMovieFrameToOrigin(int16, int16 &, int16 &);
137  void globePointToLatLong(const Point3D &, int16, int16, int16 &, int16 &);
138  void screenPointTo3DPoint(int16, int16, Point3D &);
139  bool lineHitsGlobe(const Line3D &, Point3D &);
140 
141  Movie _robotMovie;
142  Movie _monitorMovie;
143  Movie _globeMovie;
144  Movie _upperNamesMovie;
145  Movie _lowerNamesMovie;
146  Notification _globeNotification;
147  NotificationCallBack _robotCallBack;
148  NotificationCallBack _monitorCallBack;
149  GlobeTracker _globeTracker;
150  Picture _globeCircleLeft;
151  Picture _globeCircleRight;
152  Picture _globeCircleUp;
153  Picture _globeCircleDown;
154  Picture _motionHighlightLeft;
155  Picture _motionHighlightRight;
156  Picture _motionHighlightUp;
157  Picture _motionHighlightDown;
158  Picture _targetHighlightUpperLeft;
159  Picture _targetHighlightUpperRight;
160  Picture _targetHighlightLowerLeft;
161  Picture _targetHighlightLowerRight;
162  GlobeCountdown _countdown;
163  NotificationCallBack _countdownCallBack;
164  int16 _gameState;
165  int16 _currentSiloIndex;
166  Notification *_neighborhoodNotification;
167  bool _playedInstructions;
168 };
169 
170 } // End of namespace Pegasus
171 
172 #endif
Definition: neighborhood.h:111
Definition: globegame.h:44
Definition: movie.h:40
Definition: globegame.h:70
Definition: rect.h:144
Definition: hotspot.h:85
Definition: input.h:466
Definition: globegame.h:95
Definition: input.h:322
Definition: globegame.h:113
Definition: notification.h:53
Definition: interaction.h:37
Definition: timers.h:191
Definition: globegame.h:109
Definition: surface.h:50
Definition: notification.h:83
Definition: elements.h:117
Definition: ai_action.h:33
Definition: surface.h:125