OpenXcom
1.0
Open-source clone of the original X-Com
|
Geoscape screen which shows an overview of the world and lets the player manage the game. More...
#include <GeoscapeState.h>
Public Member Functions | |
GeoscapeState (Game *game) | |
Creates the Geoscape state. More... | |
~GeoscapeState () | |
Cleans up the Geoscape state. More... | |
void | handle (Action *action) |
Handle keypresses. More... | |
void | init () |
Updates the palette and timer. More... | |
void | think () |
Runs the timer. More... | |
void | timeDisplay () |
Displays the game time/date. (+Funds) More... | |
void | timeAdvance () |
Advances the game timer. More... | |
void | time5Seconds () |
Trigger whenever 5 seconds pass. More... | |
void | time10Minutes () |
Trigger whenever 10 minutes pass. More... | |
void | time30Minutes () |
Trigger whenever 30 minutes pass. More... | |
void | time1Hour () |
Trigger whenever 1 hour passes. More... | |
void | time1Day () |
Trigger whenever 1 day passes. More... | |
void | time1Month () |
Trigger whenever 1 month passes. More... | |
void | timerReset () |
Resets the timer to minimum speed. More... | |
void | popup (State *state) |
Displays a popup window. More... | |
Globe * | getGlobe () const |
Gets the Geoscape globe. More... | |
void | globeClick (Action *action) |
Handler for clicking the globe. More... | |
void | btnInterceptClick (Action *action) |
Handler for clicking the Intercept button. More... | |
void | btnBasesClick (Action *action) |
Handler for clicking the Bases button. More... | |
void | btnGraphsClick (Action *action) |
Handler for clicking the Graph button. More... | |
void | btnUfopaediaClick (Action *action) |
Handler for clicking the Ufopaedia button. More... | |
void | btnOptionsClick (Action *action) |
Handler for clicking the Options button. More... | |
void | btnFundingClick (Action *action) |
Handler for clicking the Funding button. More... | |
void | btnRotateLeftPress (Action *action) |
Handler for pressing the Rotate Left arrow. More... | |
void | btnRotateLeftRelease (Action *action) |
Handler for releasing the Rotate Left arrow. More... | |
void | btnRotateRightPress (Action *action) |
Handler for pressing the Rotate Right arrow. More... | |
void | btnRotateRightRelease (Action *action) |
Handler for releasing the Rotate Right arrow. More... | |
void | btnRotateUpPress (Action *action) |
Handler for pressing the Rotate Up arrow. More... | |
void | btnRotateUpRelease (Action *action) |
Handler for releasing the Rotate Up arrow. More... | |
void | btnRotateDownPress (Action *action) |
Handler for pressing the Rotate Down arrow. More... | |
void | btnRotateDownRelease (Action *action) |
Handler for releasing the Rotate Down arrow. More... | |
void | btnZoomInLeftClick (Action *action) |
Handler for left-clicking the Zoom In icon. More... | |
void | btnZoomInRightClick (Action *action) |
Handler for right-clicking the Zoom In icon. More... | |
void | btnZoomOutLeftClick (Action *action) |
Handler for left-clicking the Zoom Out icon. More... | |
void | btnZoomOutRightClick (Action *action) |
Handler for right-clicking the Zoom Out icon. More... | |
void | blit () |
Blit method - renders the state and dogfights. More... | |
void | zoomInEffect () |
Globe zoom in effect for dogfights. More... | |
void | zoomOutEffect () |
Globe zoom out effect for dogfights. More... | |
void | handleDogfights () |
Multi-dogfights logic handling. More... | |
int | minimizedDogfightsCount () |
Gets the number of minimized dogfights. More... | |
void | startDogfight () |
Starts a new dogfight. | |
int | getFirstFreeDogfightSlot () |
Get first free dogfight slot. More... | |
void | btnTimerClick (Action *action) |
Handler for clicking the timer button. More... | |
bool | processTerrorSite (TerrorSite *ts) const |
Process a terror site. More... | |
void | handleBaseDefense (Base *base, Ufo *ufo) |
Handles base defense. More... | |
void | resize (int &dX, int &dY) |
Update the resolution settings, we just resized the window. More... | |
Public Member Functions inherited from OpenXcom::State | |
State (Game *game) | |
Creates a new state linked to a game. More... | |
virtual | ~State () |
Cleans up the state. More... | |
void | add (Surface *surface) |
Adds a child element to the state. More... | |
bool | isScreen () const |
Gets whether the state is a full-screen. More... | |
void | toggleScreen () |
Toggles whether the state is a full-screen. More... | |
void | hideAll () |
Hides all the state surfaces. More... | |
void | showAll () |
Shws all the state surfaces. More... | |
void | resetAll () |
Resets all the state surfaces. More... | |
const LocalizedText & | tr (const std::string &id) const |
Get the localized text. More... | |
LocalizedText | tr (const std::string &id, unsigned n) const |
Get the localized text. More... | |
void | redrawText () |
redraw all the text-type surfaces. | |
void | centerAllSurfaces () |
center all surfaces relative to the screen. More... | |
void | lowerAllSurfaces () |
lower all surfaces by half the screen height. More... | |
void | applyBattlescapeTheme () |
switch the colours to use the battlescape palette. More... | |
void | setModal (InteractiveSurface *surface) |
Sets a modal surface. More... | |
void | setPalette (SDL_Color *colors, int firstcolor=0, int ncolors=256, bool immediately=true) |
Changes a set of colors on the state's 8bpp palette. More... | |
void | setPalette (const std::string &palette, int backpals=-1) |
Changes the state's 8bpp palette with certain resources. More... | |
SDL_Color *const | getPalette () |
Gets the state's 8bpp palette. More... | |
virtual void | recenter (int dX, int dY) |
Re-orients all the surfaces in the state. More... | |
Geoscape screen which shows an overview of the world and lets the player manage the game.
OpenXcom::GeoscapeState::GeoscapeState | ( | Game * | game | ) |
Creates the Geoscape state.
Initializes all the elements in the Geoscape screen.
game | Pointer to the core game. |
OpenXcom::GeoscapeState::~GeoscapeState | ( | ) |
Cleans up the Geoscape state.
Deletes timers.
|
virtual |
Blit method - renders the state and dogfights.
Handle blitting of Geoscape and Dogfights.
Reimplemented from OpenXcom::State.
void OpenXcom::GeoscapeState::btnBasesClick | ( | Action * | action | ) |
Handler for clicking the Bases button.
Goes to the Basescape screen.
action | Pointer to an action. |
void OpenXcom::GeoscapeState::btnFundingClick | ( | Action * | action | ) |
Handler for clicking the Funding button.
Goes to the Funding screen.
action | Pointer to an action. |
void OpenXcom::GeoscapeState::btnGraphsClick | ( | Action * | action | ) |
Handler for clicking the Graph button.
Goes to the Graphs screen.
action | Pointer to an action. |
void OpenXcom::GeoscapeState::btnInterceptClick | ( | Action * | action | ) |
Handler for clicking the Intercept button.
Opens the Intercept window.
action | Pointer to an action. |
void OpenXcom::GeoscapeState::btnOptionsClick | ( | Action * | action | ) |
void OpenXcom::GeoscapeState::btnRotateDownPress | ( | Action * | action | ) |
Handler for pressing the Rotate Down arrow.
Starts rotating the globe downwards.
action | Pointer to an action. |
void OpenXcom::GeoscapeState::btnRotateDownRelease | ( | Action * | action | ) |
Handler for releasing the Rotate Down arrow.
Stops rotating the globe downwards.
action | Pointer to an action. |
void OpenXcom::GeoscapeState::btnRotateLeftPress | ( | Action * | action | ) |
Handler for pressing the Rotate Left arrow.
Starts rotating the globe to the left.
action | Pointer to an action. |
void OpenXcom::GeoscapeState::btnRotateLeftRelease | ( | Action * | action | ) |
Handler for releasing the Rotate Left arrow.
Stops rotating the globe to the left.
action | Pointer to an action. |
void OpenXcom::GeoscapeState::btnRotateRightPress | ( | Action * | action | ) |
Handler for pressing the Rotate Right arrow.
Starts rotating the globe to the right.
action | Pointer to an action. |
void OpenXcom::GeoscapeState::btnRotateRightRelease | ( | Action * | action | ) |
Handler for releasing the Rotate Right arrow.
Stops rotating the globe to the right.
action | Pointer to an action. |
void OpenXcom::GeoscapeState::btnRotateUpPress | ( | Action * | action | ) |
Handler for pressing the Rotate Up arrow.
Starts rotating the globe upwards.
action | Pointer to an action. |
void OpenXcom::GeoscapeState::btnRotateUpRelease | ( | Action * | action | ) |
Handler for releasing the Rotate Up arrow.
Stops rotating the globe upwards.
action | Pointer to an action. |
void OpenXcom::GeoscapeState::btnTimerClick | ( | Action * | action | ) |
Handler for clicking the timer button.
Handler for clicking on a timer button.
action | pointer to the mouse action. |
void OpenXcom::GeoscapeState::btnUfopaediaClick | ( | Action * | action | ) |
void OpenXcom::GeoscapeState::btnZoomInLeftClick | ( | Action * | action | ) |
Handler for left-clicking the Zoom In icon.
Zooms into the globe.
action | Pointer to an action. |
void OpenXcom::GeoscapeState::btnZoomInRightClick | ( | Action * | action | ) |
Handler for right-clicking the Zoom In icon.
Zooms the globe maximum.
action | Pointer to an action. |
void OpenXcom::GeoscapeState::btnZoomOutLeftClick | ( | Action * | action | ) |
Handler for left-clicking the Zoom Out icon.
Zooms out of the globe.
action | Pointer to an action. |
void OpenXcom::GeoscapeState::btnZoomOutRightClick | ( | Action * | action | ) |
Handler for right-clicking the Zoom Out icon.
Zooms the globe minimum.
action | Pointer to an action. |
int OpenXcom::GeoscapeState::getFirstFreeDogfightSlot | ( | ) |
Get first free dogfight slot.
Returns the first free dogfight slot.
Globe * OpenXcom::GeoscapeState::getGlobe | ( | ) | const |
Gets the Geoscape globe.
Returns a pointer to the Geoscape globe for access by other substates.
void OpenXcom::GeoscapeState::globeClick | ( | Action * | action | ) |
Handler for clicking the globe.
Processes any left-clicks on globe markers, or right-clicks to scroll the globe.
action | Pointer to an action. |
|
virtual |
Handle keypresses.
Handle key shortcuts.
action | Pointer to an action. |
Reimplemented from OpenXcom::State.
void OpenXcom::GeoscapeState::handleDogfights | ( | ) |
Multi-dogfights logic handling.
Dogfight logic.
Moved here to have the code clean.
|
virtual |
Updates the palette and timer.
Updates the timer display and resets the palette since it's bound to change on other screens.
Reimplemented from OpenXcom::State.
int OpenXcom::GeoscapeState::minimizedDogfightsCount | ( | ) |
Gets the number of minimized dogfights.
void OpenXcom::GeoscapeState::popup | ( | State * | state | ) |
Displays a popup window.
Adds a new popup window to the queue (this prevents popups from overlapping) and pauses the game timer respectively.
state | Pointer to popup state. |
bool OpenXcom::GeoscapeState::processTerrorSite | ( | TerrorSite * | ts | ) | const |
Process a terror site.
Process a TerrorSite.
This function object will count down towards expiring a TerrorSite, and handle expired TerrorSites.
ts | Pointer to terror site. |
|
virtual |
Update the resolution settings, we just resized the window.
Updates the scale.
dX | delta of X; |
dY | delta of Y; |
Reimplemented from OpenXcom::State.
|
virtual |
void OpenXcom::GeoscapeState::time10Minutes | ( | ) |
Trigger whenever 10 minutes pass.
Takes care of any game logic that has to run every game ten minutes, like fuel consumption.
void OpenXcom::GeoscapeState::time1Day | ( | ) |
Trigger whenever 1 day passes.
Takes care of any game logic that has to run every game day, like constructions.
void OpenXcom::GeoscapeState::time1Hour | ( | ) |
Trigger whenever 1 hour passes.
Takes care of any game logic that has to run every game hour, like transfers.
void OpenXcom::GeoscapeState::time1Month | ( | ) |
Trigger whenever 1 month passes.
Takes care of any game logic that has to run every game month, like funding.
void OpenXcom::GeoscapeState::time30Minutes | ( | ) |
Trigger whenever 30 minutes pass.
Takes care of any game logic that has to run every game half hour, like UFO detection.
void OpenXcom::GeoscapeState::time5Seconds | ( | ) |
Trigger whenever 5 seconds pass.
Takes care of any game logic that has to run every game second, like craft movement.
void OpenXcom::GeoscapeState::timeAdvance | ( | ) |
Advances the game timer.
Advances the game timer according to the timer speed set, and calls the respective triggers.
The timer always advances in "5 secs" cycles, regardless of the speed, otherwise it might skip important steps. Instead, it just keeps advancing the timer until the next speed step (eg. the next day on 1 Day speed) or until an event occurs, since updating the screen on each step would become cumbersomely slow.
void OpenXcom::GeoscapeState::timeDisplay | ( | ) |
Displays the game time/date. (+Funds)
Updates the Geoscape clock with the latest game time and date in human-readable format.
(+Funds)
void OpenXcom::GeoscapeState::timerReset | ( | ) |
Resets the timer to minimum speed.
Slows down the timer back to minimum speed, for when important events occur.
void OpenXcom::GeoscapeState::zoomInEffect | ( | ) |
void OpenXcom::GeoscapeState::zoomOutEffect | ( | ) |