OpenXcom  1.0
Open-source clone of the original X-Com
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
GeoscapeState.h
1 /*
2  * Copyright 2010-2014 OpenXcom Developers.
3  *
4  * This file is part of OpenXcom.
5  *
6  * OpenXcom is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * OpenXcom is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with OpenXcom. If not, see <http:///www.gnu.org/licenses/>.
18  */
19 #ifndef OPENXCOM_GEOSCAPESTATE_H
20 #define OPENXCOM_GEOSCAPESTATE_H
21 
22 #include "../Engine/State.h"
23 #include <list>
24 
25 namespace OpenXcom
26 {
27 
28 class Surface;
29 class Globe;
30 class TextButton;
31 class InteractiveSurface;
32 class Text;
33 class Timer;
34 class DogfightState;
35 class Ufo;
36 class TerrorSite;
37 class Base;
38 
43 class GeoscapeState : public State
44 {
45 private:
46  Surface *_bg, *_sideLine, *_sidebar;
47  Globe *_globe;
48  TextButton *_btnIntercept, *_btnBases, *_btnGraphs, *_btnUfopaedia, *_btnOptions, *_btnFunding;
49  TextButton *_timeSpeed;
50  TextButton *_btn5Secs, *_btn1Min, *_btn5Mins, *_btn30Mins, *_btn1Hour, *_btn1Day;
51  TextButton *_sideTop, *_sideBottom;
52  InteractiveSurface *_btnRotateLeft, *_btnRotateRight, *_btnRotateUp, *_btnRotateDown, *_btnZoomIn, *_btnZoomOut;
53  Text *_txtFunds, *_txtHour, *_txtHourSep, *_txtMin, *_txtMinSep, *_txtSec, *_txtWeekday, *_txtDay, *_txtMonth, *_txtYear;
54  Timer *_gameTimer, *_zoomInEffectTimer, *_zoomOutEffectTimer, *_dogfightStartTimer;
55  bool _pause, _zoomInEffectDone, _zoomOutEffectDone;
56  Text *_txtDebug;
57  std::list<State*> _popups;
58  std::list<DogfightState*> _dogfights, _dogfightsToBeStarted;
59  size_t _minimizedDogfights;
60 public:
62  GeoscapeState(Game *game);
66  void handle(Action *action);
68  void init();
70  void think();
72  void timeDisplay();
74  void timeAdvance();
76  void time5Seconds();
78  void time10Minutes();
80  void time30Minutes();
82  void time1Hour();
84  void time1Day();
86  void time1Month();
88  void timerReset();
90  void popup(State *state);
92  Globe *getGlobe() const;
94  void globeClick(Action *action);
96  void btnInterceptClick(Action *action);
98  void btnBasesClick(Action *action);
100  void btnGraphsClick(Action *action);
102  void btnUfopaediaClick(Action *action);
104  void btnOptionsClick(Action *action);
106  void btnFundingClick(Action *action);
108  void btnRotateLeftPress(Action *action);
110  void btnRotateLeftRelease(Action *action);
112  void btnRotateRightPress(Action *action);
114  void btnRotateRightRelease(Action *action);
116  void btnRotateUpPress(Action *action);
118  void btnRotateUpRelease(Action *action);
120  void btnRotateDownPress(Action *action);
122  void btnRotateDownRelease(Action *action);
124  void btnZoomInLeftClick(Action *action);
126  void btnZoomInRightClick(Action *action);
128  void btnZoomOutLeftClick(Action *action);
130  void btnZoomOutRightClick(Action *action);
132  void blit();
134  void zoomInEffect();
136  void zoomOutEffect();
138  void handleDogfights();
142  void startDogfight();
146  void btnTimerClick(Action *action);
148  bool processTerrorSite(TerrorSite *ts) const;
150  void handleBaseDefense(Base *base, Ufo *ufo);
152  void resize(int &dX, int &dY);
153 private:
155  void determineAlienMissions(bool atGameStart = false);
157  void setupTerrorMission();
158 };
159 
160 }
161 
162 #endif
Container for all the information associated with a given user action, like mouse clicks...
Definition: Action.h:34
void btnRotateLeftPress(Action *action)
Handler for pressing the Rotate Left arrow.
Definition: GeoscapeState.cpp:1879
void timeAdvance()
Advances the game timer.
Definition: GeoscapeState.cpp:621
void startDogfight()
Starts a new dogfight.
Definition: GeoscapeState.cpp:2073
void time1Day()
Trigger whenever 1 day passes.
Definition: GeoscapeState.cpp:1465
void time1Hour()
Trigger whenever 1 hour passes.
Definition: GeoscapeState.cpp:1356
Globe * getGlobe() const
Gets the Geoscape globe.
Definition: GeoscapeState.cpp:1776
void btnTimerClick(Action *action)
Handler for clicking the timer button.
Definition: GeoscapeState.cpp:2228
Geoscape screen which shows an overview of the world and lets the player manage the game...
Definition: GeoscapeState.h:43
A game state that receives user input and reacts accordingly.
Definition: State.h:44
void handleDogfights()
Multi-dogfights logic handling.
Definition: GeoscapeState.cpp:2011
Timer used to run code in fixed intervals.
Definition: Timer.h:37
Surface that the user can interact with.
Definition: InteractiveSurface.h:39
void btnUfopaediaClick(Action *action)
Handler for clicking the Ufopaedia button.
Definition: GeoscapeState.cpp:1852
void timerReset()
Resets the timer to minimum speed.
Definition: GeoscapeState.cpp:1751
Interactive globe view of the world.
Definition: Globe.h:44
Text string displayed on screen.
Definition: Text.h:41
void btnFundingClick(Action *action)
Handler for clicking the Funding button.
Definition: GeoscapeState.cpp:1870
void think()
Runs the timer.
Definition: GeoscapeState.cpp:539
void zoomOutEffect()
Globe zoom out effect for dogfights.
Definition: GeoscapeState.cpp:1998
void btnRotateUpPress(Action *action)
Handler for pressing the Rotate Up arrow.
Definition: GeoscapeState.cpp:1915
void btnZoomOutLeftClick(Action *action)
Handler for left-clicking the Zoom Out icon.
Definition: GeoscapeState.cpp:1969
void handleBaseDefense(Base *base, Ufo *ufo)
Handles base defense.
Definition: GeoscapeState.cpp:2126
void btnRotateLeftRelease(Action *action)
Handler for releasing the Rotate Left arrow.
Definition: GeoscapeState.cpp:1888
Represents an alien terror site on the world.
Definition: TerrorSite.h:32
GeoscapeState(Game *game)
Creates the Geoscape state.
Definition: GeoscapeState.cpp:119
void blit()
Blit method - renders the state and dogfights.
Definition: GeoscapeState.cpp:443
void btnBasesClick(Action *action)
Handler for clicking the Bases button.
Definition: GeoscapeState.cpp:1826
void popup(State *state)
Displays a popup window.
Definition: GeoscapeState.cpp:1765
void time30Minutes()
Trigger whenever 30 minutes pass.
Definition: GeoscapeState.cpp:1172
void btnRotateRightRelease(Action *action)
Handler for releasing the Rotate Right arrow.
Definition: GeoscapeState.cpp:1906
void time5Seconds()
Trigger whenever 5 seconds pass.
Definition: GeoscapeState.cpp:680
int minimizedDogfightsCount()
Gets the number of minimized dogfights.
Definition: GeoscapeState.cpp:2057
void time10Minutes()
Trigger whenever 10 minutes pass.
Definition: GeoscapeState.cpp:1025
void btnRotateDownRelease(Action *action)
Handler for releasing the Rotate Down arrow.
Definition: GeoscapeState.cpp:1942
void btnZoomInRightClick(Action *action)
Handler for right-clicking the Zoom In icon.
Definition: GeoscapeState.cpp:1960
void btnGraphsClick(Action *action)
Handler for clicking the Graph button.
Definition: GeoscapeState.cpp:1843
Represents a player base on the globe.
Definition: Base.h:47
void btnInterceptClick(Action *action)
Handler for clicking the Intercept button.
Definition: GeoscapeState.cpp:1817
void btnRotateUpRelease(Action *action)
Handler for releasing the Rotate Up arrow.
Definition: GeoscapeState.cpp:1924
Coloured button with a text label.
Definition: TextButton.h:40
Element that is blit (rendered) onto the screen.
Definition: Surface.h:39
void init()
Updates the palette and timer.
Definition: GeoscapeState.cpp:504
void btnZoomOutRightClick(Action *action)
Handler for right-clicking the Zoom Out icon.
Definition: GeoscapeState.cpp:1978
bool processTerrorSite(TerrorSite *ts) const
Process a terror site.
Definition: GeoscapeState.cpp:1117
void timeDisplay()
Displays the game time/date. (+Funds)
Definition: GeoscapeState.cpp:579
Represents an alien UFO on the map.
Definition: Ufo.h:41
int getFirstFreeDogfightSlot()
Get first free dogfight slot.
Definition: GeoscapeState.cpp:2108
The core of the game engine, manages the game's entire contents and structure.
Definition: Game.h:44
void globeClick(Action *action)
Handler for clicking the globe.
Definition: GeoscapeState.cpp:1787
void time1Month()
Trigger whenever 1 month passes.
Definition: GeoscapeState.cpp:1654
void btnOptionsClick(Action *action)
Handler for clicking the Options button.
Definition: GeoscapeState.cpp:1861
~GeoscapeState()
Cleans up the Geoscape state.
Definition: GeoscapeState.cpp:420
void resize(int &dX, int &dY)
Update the resolution settings, we just resized the window.
Definition: GeoscapeState.cpp:2242
void btnRotateRightPress(Action *action)
Handler for pressing the Rotate Right arrow.
Definition: GeoscapeState.cpp:1897
void btnZoomInLeftClick(Action *action)
Handler for left-clicking the Zoom In icon.
Definition: GeoscapeState.cpp:1951
void zoomInEffect()
Globe zoom in effect for dogfights.
Definition: GeoscapeState.cpp:1986
void btnRotateDownPress(Action *action)
Handler for pressing the Rotate Down arrow.
Definition: GeoscapeState.cpp:1933
void handle(Action *action)
Handle keypresses.
Definition: GeoscapeState.cpp:455