OpenXcom
1.0
Open-source clone of the original X-Com
|
Shows a dogfight (interception) between a player craft and an UFO. More...
#include <DogfightState.h>
Public Member Functions | |
DogfightState (Game *game, Globe *globe, Craft *craft, Ufo *ufo) | |
Creates the Dogfight state. More... | |
~DogfightState () | |
Cleans up the Dogfight state. More... | |
void | think () |
Runs the timers. More... | |
void | animate () |
Animates the window. More... | |
void | move () |
Moves the craft. More... | |
void | fireWeapon1 () |
Fires a shot from the first weapon equipped on the craft. | |
void | fireWeapon2 () |
Fires a shot from the second weapon equipped on the craft. | |
void | ufoFireWeapon () |
Each time a UFO will try to fire it's cannons a calculation is made. More... | |
void | minimumDistance () |
Sets the craft to the minimum distance required to fire a weapon. | |
void | maximumDistance () |
Sets the craft to the maximum distance required to fire a weapon. | |
void | setStatus (const std::string &status) |
Changes the status text. More... | |
void | btnMinimizeClick (Action *action) |
Handler for clicking the Minimize button. More... | |
void | btnStandoffClick (Action *action) |
Handler for clicking the Standoff button. More... | |
void | btnCautiousClick (Action *action) |
Handler for clicking the Cautious Attack button. More... | |
void | btnStandardClick (Action *action) |
Handler for clicking the Standard Attack button. More... | |
void | btnAggressiveClick (Action *action) |
Handler for clicking the Aggressive Attack button. More... | |
void | btnDisengageClick (Action *action) |
Handler for clicking the Disengage button. More... | |
void | btnUfoClick (Action *action) |
Handler for clicking the Ufo button. More... | |
void | previewClick (Action *action) |
Handler for clicking the Preview graphic. More... | |
void | ufoBreakOff () |
Makes the UFO break off the interception... or at least tries to. | |
void | drawUfo () |
Draws UFO. | |
void | drawProjectile (const CraftWeaponProjectile *p) |
Draws projectiles. | |
void | animateCraftDamage () |
Animates craft damage. More... | |
void | drawCraftDamage () |
Updates craft damage. More... | |
void | weapon1Click (Action *action) |
Toggles usage of weapon 1. More... | |
void | weapon2Click (Action *action) |
Toggles usage of weapon 2. More... | |
void | recolor (const int weaponNo, const bool currentState) |
Changes colors of weapon icons, range indicators and ammo texts base on current weapon state. More... | |
bool | isMinimized () const |
Returns true if state is minimized. More... | |
void | setMinimized (const bool minimized) |
Sets state minimized or maximized. More... | |
void | btnMinimizedIconClick (Action *action) |
Handler for clicking the minimized interception window icon. More... | |
int | getInterceptionNumber () const |
Gets interception number. More... | |
void | setInterceptionNumber (const int number) |
Sets interception number. More... | |
void | setInterceptionsCount (const size_t count) |
Sets interceptions count. More... | |
void | calculateWindowPosition () |
Calculates window position according to opened interception windows. More... | |
void | moveWindow () |
Moves window to new position. More... | |
bool | dogfightEnded () const |
Checks if the dogfight should be ended. More... | |
Ufo * | getUfo () const |
Gets pointer to the UFO in this dogfight. 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... | |
virtual void | init () |
Initializes the state. More... | |
virtual void | handle (Action *action) |
Handles any events. More... | |
virtual void | blit () |
Blits the state to the 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 | resize (int &dX, int &dY) |
Let the state know the window has been resized. More... | |
virtual void | recenter (int dX, int dY) |
Re-orients all the surfaces in the state. More... | |
Shows a dogfight (interception) between a player craft and an UFO.
Creates the Dogfight state.
Initializes all the elements in the Dogfight window.
game | Pointer to the core game. |
globe | Pointer to the Geoscape globe. |
craft | Pointer to the craft intercepting. |
ufo | Pointer to the UFO being intercepted. |
OpenXcom::DogfightState::~DogfightState | ( | ) |
Cleans up the Dogfight state.
Deletes timers.
void OpenXcom::DogfightState::animate | ( | ) |
Animates the window.
Animates the window with a palette effect.
void OpenXcom::DogfightState::animateCraftDamage | ( | ) |
Animates craft damage.
Animates interceptor damage by changing the color and redrawing the image.
void OpenXcom::DogfightState::btnAggressiveClick | ( | Action * | action | ) |
Handler for clicking the Aggressive Attack button.
Switches to Aggressive mode (minimum range).
action | Pointer to an action. |
void OpenXcom::DogfightState::btnCautiousClick | ( | Action * | action | ) |
Handler for clicking the Cautious Attack button.
Switches to Cautious mode (maximum weapon range).
action | Pointer to an action. |
void OpenXcom::DogfightState::btnDisengageClick | ( | Action * | action | ) |
Handler for clicking the Disengage button.
Disengages from the UFO.
action | Pointer to an action. |
void OpenXcom::DogfightState::btnMinimizeClick | ( | Action * | action | ) |
Handler for clicking the Minimize button.
Minimizes the dogfight window.
action | Pointer to an action. |
void OpenXcom::DogfightState::btnMinimizedIconClick | ( | Action * | action | ) |
Handler for clicking the minimized interception window icon.
Maximizes the interception window.
action | Pointer to an action. |
void OpenXcom::DogfightState::btnStandardClick | ( | Action * | action | ) |
Handler for clicking the Standard Attack button.
Switches to Standard mode (minimum weapon range).
action | Pointer to an action. |
void OpenXcom::DogfightState::btnStandoffClick | ( | Action * | action | ) |
Handler for clicking the Standoff button.
Switches to Standoff mode (maximum range).
action | Pointer to an action. |
void OpenXcom::DogfightState::btnUfoClick | ( | Action * | action | ) |
Handler for clicking the Ufo button.
Shows a front view of the UFO.
action | Pointer to an action. |
void OpenXcom::DogfightState::calculateWindowPosition | ( | ) |
Calculates window position according to opened interception windows.
Calculates dogfight window position according to number of active interceptions.
bool OpenXcom::DogfightState::dogfightEnded | ( | ) | const |
Checks if the dogfight should be ended.
Checks whether the dogfight should end.
void OpenXcom::DogfightState::drawCraftDamage | ( | ) |
Updates craft damage.
Draws interceptor damage according to percentage of HP's left.
int OpenXcom::DogfightState::getInterceptionNumber | ( | ) | const |
Gets interception number.
Returns interception number.
Ufo * OpenXcom::DogfightState::getUfo | ( | ) | const |
Gets pointer to the UFO in this dogfight.
Returns the UFO associated to this dogfight.
bool OpenXcom::DogfightState::isMinimized | ( | ) | const |
Returns true if state is minimized.
Otherwise returns false.
void OpenXcom::DogfightState::move | ( | ) |
Moves the craft.
Moves the craft towards the UFO according to the current interception mode.
Handles projectile movements as well.
void OpenXcom::DogfightState::moveWindow | ( | ) |
Moves window to new position.
Relocates all dogfight window elements to calculated position.
This is used when multiple interceptions are running.
void OpenXcom::DogfightState::previewClick | ( | Action * | action | ) |
Handler for clicking the Preview graphic.
Hides the front view of the UFO.
action | Pointer to an action. |
void OpenXcom::DogfightState::recolor | ( | const int | weaponNo, |
const bool | currentState | ||
) |
Changes colors of weapon icons, range indicators and ammo texts base on current weapon state.
weaponNo | - number of weapon for which colors must be changed. |
currentState | - state of weapon (enabled = true, disabled = false). |
void OpenXcom::DogfightState::setInterceptionNumber | ( | const int | number | ) |
Sets interception number.
Used to draw proper number when window minimized.
number | ID number. |
void OpenXcom::DogfightState::setInterceptionsCount | ( | const size_t | count | ) |
Sets interceptions count.
Used to properly position the window.
count | Amount of interception windows. |
void OpenXcom::DogfightState::setMinimized | ( | const bool | minimized | ) |
Sets state minimized or maximized.
Sets the state to minimized/maximized status.
minimized | Is the dogfight minimized? |
void OpenXcom::DogfightState::setStatus | ( | const std::string & | status | ) |
Changes the status text.
Updates the status text and restarts the text timeout counter.
status | New status text. |
|
virtual |
void OpenXcom::DogfightState::ufoFireWeapon | ( | ) |
Each time a UFO will try to fire it's cannons a calculation is made.
There's only 10% chance that it will actually fire.
void OpenXcom::DogfightState::weapon1Click | ( | Action * | action | ) |
Toggles usage of weapon 1.
Toggles usage of weapon number 1.
action | Pointer to an action. |
void OpenXcom::DogfightState::weapon2Click | ( | Action * | action | ) |
Toggles usage of weapon 2.
Toggles usage of weapon number 2.
action | Pointer to an action. |