![]() |
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 (GeoscapeState *state, 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 | update () |
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 | btnStandoffPress (Action *action) |
Handler for pressing the Standoff button. More... | |
void | btnCautiousPress (Action *action) |
Handler for pressing the Cautious Attack button. More... | |
void | btnStandardPress (Action *action) |
Handler for pressing the Standard Attack button. More... | |
void | btnAggressivePress (Action *action) |
Handler for pressing the Aggressive Attack button. More... | |
void | btnDisengagePress (Action *action) |
Handler for pressing 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 | 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... | |
Craft * | getCraft () const |
Gets pointer to the craft in this dogfight. More... | |
void | setWaitForPoly (bool wait) |
Waits until the UFO reaches a polygon. | |
bool | getWaitForPoly () const |
Waits until the UFO reaches a polygon. | |
void | setWaitForAltitude (bool wait) |
Waits until the UFO reaches the right altitude. | |
bool | getWaitForAltitude () const |
Waits until the UFO reaches the right altutude. | |
![]() | |
State () | |
Creates a new state linked to a game. More... | |
virtual | ~State () |
Cleans up the state. More... | |
void | setInterface (const std::string &s, bool alterPal=false, SavedBattleGame *battleGame=0) |
Set interface rules. More... | |
void | add (Surface *surface) |
Adds a child element to the state. More... | |
void | add (Surface *surface, const std::string &id, const std::string &category, Surface *parent=0) |
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... | |
const LocalizedText & | tr (const std::string &id, SoldierGender gender) 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 * | 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... | |
Additional Inherited Members | |
![]() | |
static void | setGamePtr (Game *game) |
Sets game object pointer. | |
![]() | |
static Game * | _game = 0 |
Initializes static member. | |
Shows a dogfight (interception) between a player craft and an UFO.
OpenXcom::DogfightState::DogfightState | ( | GeoscapeState * | state, |
Craft * | craft, | ||
Ufo * | ufo | ||
) |
Creates the Dogfight state.
Initializes all the elements in the Dogfight window.
game | Pointer to the core game. |
state | Pointer to the Geoscape. |
craft | Pointer to the craft intercepting. |
ufo | Pointer to the UFO being intercepted. |
OpenXcom::DogfightState::~DogfightState | ( | ) |
Cleans up the Dogfight state.
Cleans up the dogfight state.
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::btnAggressivePress | ( | Action * | action | ) |
Handler for pressing the Aggressive Attack button.
Switches to Aggressive mode (minimum range).
action | Pointer to an action. |
void OpenXcom::DogfightState::btnCautiousPress | ( | Action * | action | ) |
Handler for pressing the Cautious Attack button.
Switches to Cautious mode (maximum weapon range).
action | Pointer to an action. |
void OpenXcom::DogfightState::btnDisengagePress | ( | Action * | action | ) |
Handler for pressing 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::btnStandardPress | ( | Action * | action | ) |
Handler for pressing the Standard Attack button.
Switches to Standard mode (minimum weapon range).
action | Pointer to an action. |
void OpenXcom::DogfightState::btnStandoffPress | ( | Action * | action | ) |
Handler for pressing 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.
Craft * OpenXcom::DogfightState::getCraft | ( | ) | const |
Gets pointer to the craft in this dogfight.
Returns the craft associated to this dogfight.
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::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::update | ( | ) |
Moves the craft.
Updates all the elements in the dogfight, including ufo movement, weapons fire, projectile movement, ufo escape conditions, craft and ufo destruction conditions, and retaliation mission generation, as applicable.
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. |