OpenXcom  1.0
Open-source clone of the original X-Com
GeoscapeState.h
1 #pragma once
2 /*
3  * Copyright 2010-2016 OpenXcom Developers.
4  *
5  * This file is part of OpenXcom.
6  *
7  * OpenXcom 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  * OpenXcom 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 OpenXcom. If not, see <http:///www.gnu.org/licenses/>.
19  */
20 #include "../Engine/State.h"
21 #include <list>
22 
23 namespace OpenXcom
24 {
25 
26 class Surface;
27 class Globe;
28 class TextButton;
29 class InteractiveSurface;
30 class Text;
31 class Timer;
32 class DogfightState;
33 class Ufo;
34 class MissionSite;
35 class Base;
36 class RuleMissionScript;
37 
42 class GeoscapeState : public State
43 {
44 private:
45  Surface *_bg, *_sideLine, *_sidebar;
46  Globe *_globe;
47  TextButton *_btnIntercept, *_btnBases, *_btnGraphs, *_btnUfopaedia, *_btnOptions, *_btnFunding;
48  TextButton *_timeSpeed;
49  TextButton *_btn5Secs, *_btn1Min, *_btn5Mins, *_btn30Mins, *_btn1Hour, *_btn1Day;
50  TextButton *_sideTop, *_sideBottom;
51  InteractiveSurface *_btnRotateLeft, *_btnRotateRight, *_btnRotateUp, *_btnRotateDown, *_btnZoomIn, *_btnZoomOut;
52  Text *_txtFunds, *_txtHour, *_txtHourSep, *_txtMin, *_txtMinSep, *_txtSec, *_txtWeekday, *_txtDay, *_txtMonth, *_txtYear;
53  Timer *_gameTimer, *_zoomInEffectTimer, *_zoomOutEffectTimer, *_dogfightStartTimer, *_dogfightTimer;
54  bool _pause, _zoomInEffectDone, _zoomOutEffectDone;
55  Text *_txtDebug;
56  std::list<State*> _popups;
57  std::list<DogfightState*> _dogfights, _dogfightsToBeStarted;
58  size_t _minimizedDogfights;
59 public:
61  GeoscapeState();
65  void handle(Action *action);
67  void init();
69  void think();
71  void timeDisplay();
73  void timeAdvance();
75  void time5Seconds();
77  void time10Minutes();
79  void time30Minutes();
81  void time1Hour();
83  void time1Day();
85  void time1Month();
87  void timerReset();
89  void popup(State *state);
91  Globe *getGlobe() const;
93  void globeClick(Action *action);
95  void btnInterceptClick(Action *action);
97  void btnBasesClick(Action *action);
99  void btnGraphsClick(Action *action);
101  void btnUfopaediaClick(Action *action);
103  void btnOptionsClick(Action *action);
105  void btnFundingClick(Action *action);
107  void btnRotateLeftPress(Action *action);
109  void btnRotateLeftRelease(Action *action);
111  void btnRotateRightPress(Action *action);
113  void btnRotateRightRelease(Action *action);
115  void btnRotateUpPress(Action *action);
117  void btnRotateUpRelease(Action *action);
119  void btnRotateDownPress(Action *action);
121  void btnRotateDownRelease(Action *action);
123  void btnZoomInLeftClick(Action *action);
125  void btnZoomInRightClick(Action *action);
127  void btnZoomOutLeftClick(Action *action);
129  void btnZoomOutRightClick(Action *action);
131  void blit();
133  void zoomInEffect();
135  void zoomOutEffect();
137  void handleDogfights();
141  void startDogfight();
145  void btnTimerClick(Action *action);
147  bool processMissionSite(MissionSite *site) const;
149  void handleBaseDefense(Base *base, Ufo *ufo);
151  void resize(int &dX, int &dY);
152 private:
154  void determineAlienMissions();
156  bool processCommand(RuleMissionScript *command);
157  bool buttonsDisabled();
158 };
159 
160 }
Container for all the information associated with a given user action, like mouse clicks...
Definition: Action.h:32
void btnRotateLeftPress(Action *action)
Handler for pressing the Rotate Left arrow.
Definition: GeoscapeState.cpp:1960
void timeAdvance()
Advances the game timer.
Definition: GeoscapeState.cpp:631
void startDogfight()
Starts a new dogfight.
Definition: GeoscapeState.cpp:2168
void time1Day()
Trigger whenever 1 day passes.
Definition: GeoscapeState.cpp:1535
void time1Hour()
Trigger whenever 1 hour passes.
Definition: GeoscapeState.cpp:1410
void btnTimerClick(Action *action)
Handler for clicking the timer button.
Definition: GeoscapeState.cpp:2682
Geoscape screen which shows an overview of the world and lets the player manage the game...
Definition: GeoscapeState.h:42
A game state that receives user input and reacts accordingly.
Definition: State.h:44
void handleDogfights()
Multi-dogfights logic handling.
Definition: GeoscapeState.cpp:2092
Timer used to run code in fixed intervals.
Definition: Timer.h:35
Surface that the user can interact with.
Definition: InteractiveSurface.h:37
Represents an alien mission site on the world.
Definition: MissionSite.h:33
void btnUfopaediaClick(Action *action)
Handler for clicking the Ufopaedia button.
Definition: GeoscapeState.cpp:1921
void timerReset()
Resets the timer to minimum speed.
Definition: GeoscapeState.cpp:1804
Interactive globe view of the world.
Definition: Globe.h:43
Text string displayed on screen.
Definition: Text.h:40
void btnFundingClick(Action *action)
Handler for clicking the Funding button.
Definition: GeoscapeState.cpp:1947
void think()
Runs the timer.
Definition: GeoscapeState.cpp:550
void zoomOutEffect()
Globe zoom out effect for dogfights.
Definition: GeoscapeState.cpp:2079
void btnRotateUpPress(Action *action)
Handler for pressing the Rotate Up arrow.
Definition: GeoscapeState.cpp:1996
void btnZoomOutLeftClick(Action *action)
Handler for left-clicking the Zoom Out icon.
Definition: GeoscapeState.cpp:2050
void handleBaseDefense(Base *base, Ufo *ufo)
Handles base defense.
Definition: GeoscapeState.cpp:2222
void btnRotateLeftRelease(Action *action)
Handler for releasing the Rotate Left arrow.
Definition: GeoscapeState.cpp:1969
void blit()
Blit method - renders the state and dogfights.
Definition: GeoscapeState.cpp:414
GeoscapeState()
Creates the Geoscape state.
Definition: GeoscapeState.cpp:116
void btnBasesClick(Action *action)
Handler for clicking the Bases button.
Definition: GeoscapeState.cpp:1887
void popup(State *state)
Displays a popup window.
Definition: GeoscapeState.cpp:1818
void time30Minutes()
Trigger whenever 30 minutes pass.
Definition: GeoscapeState.cpp:1226
void btnRotateRightRelease(Action *action)
Handler for releasing the Rotate Right arrow.
Definition: GeoscapeState.cpp:1987
void time5Seconds()
Trigger whenever 5 seconds pass.
Definition: GeoscapeState.cpp:691
int minimizedDogfightsCount()
Gets the number of minimized dogfights.
Definition: GeoscapeState.cpp:2152
void time10Minutes()
Trigger whenever 10 minutes pass.
Definition: GeoscapeState.cpp:1076
void btnRotateDownRelease(Action *action)
Handler for releasing the Rotate Down arrow.
Definition: GeoscapeState.cpp:2023
void btnZoomInRightClick(Action *action)
Handler for right-clicking the Zoom In icon.
Definition: GeoscapeState.cpp:2041
bool processMissionSite(MissionSite *site) const
Process a mission site.
Definition: GeoscapeState.cpp:1166
void btnGraphsClick(Action *action)
Handler for clicking the Graph button.
Definition: GeoscapeState.cpp:1908
Represents a player base on the globe.
Definition: Base.h:45
void btnInterceptClick(Action *action)
Handler for clicking the Intercept button.
Definition: GeoscapeState.cpp:1874
void btnRotateUpRelease(Action *action)
Handler for releasing the Rotate Up arrow.
Definition: GeoscapeState.cpp:2005
Coloured button with a text label.
Definition: TextButton.h:38
Element that is blit (rendered) onto the screen.
Definition: Surface.h:38
void init()
Updates the palette and timer.
Definition: GeoscapeState.cpp:499
Definition: RuleMissionScript.h:30
void btnZoomOutRightClick(Action *action)
Handler for right-clicking the Zoom Out icon.
Definition: GeoscapeState.cpp:2059
void timeDisplay()
Displays the game time/date. (+Funds)
Definition: GeoscapeState.cpp:589
Represents an alien UFO on the map.
Definition: Ufo.h:40
int getFirstFreeDogfightSlot()
Get first free dogfight slot.
Definition: GeoscapeState.cpp:2204
void globeClick(Action *action)
Handler for clicking the globe.
Definition: GeoscapeState.cpp:1840
void time1Month()
Trigger whenever 1 month passes.
Definition: GeoscapeState.cpp:1752
void btnOptionsClick(Action *action)
Handler for clicking the Options button.
Definition: GeoscapeState.cpp:1934
~GeoscapeState()
Cleans up the Geoscape state.
Definition: GeoscapeState.cpp:390
void resize(int &dX, int &dY)
Update the resolution settings, we just resized the window.
Definition: GeoscapeState.cpp:2696
Globe * getGlobe() const
Gets the Geoscape globe.
Definition: GeoscapeState.cpp:1829
void btnRotateRightPress(Action *action)
Handler for pressing the Rotate Right arrow.
Definition: GeoscapeState.cpp:1978
void btnZoomInLeftClick(Action *action)
Handler for left-clicking the Zoom In icon.
Definition: GeoscapeState.cpp:2032
void zoomInEffect()
Globe zoom in effect for dogfights.
Definition: GeoscapeState.cpp:2067
Definition: BaseInfoState.cpp:40
void btnRotateDownPress(Action *action)
Handler for pressing the Rotate Down arrow.
Definition: GeoscapeState.cpp:2014
void handle(Action *action)
Handle keypresses.
Definition: GeoscapeState.cpp:427