20 #include "../Engine/State.h" 27 const int STANDOFF_DIST = 560;
28 enum ColorNames { CRAFT_MIN, CRAFT_MAX, RADAR_MIN, RADAR_MAX, DAMAGE_MIN, DAMAGE_MAX, BLOB_MIN, RANGE_METER, DISABLED_WEAPON, DISABLED_AMMO, DISABLED_RANGE };
33 class InteractiveSurface;
38 class CraftWeaponProjectile;
48 Timer *_craftDamageAnimTimer;
49 Surface *_window, *_battle, *_range1, *_range2, *_damage;
51 ImageButton *_btnStandoff, *_btnCautious, *_btnStandard, *_btnAggressive, *_btnDisengage, *_btnUfo;
54 Text *_txtAmmo1, *_txtAmmo2, *_txtDistance, *_txtStatus, *_txtInterceptionNumber;
57 int _timeout, _currentDist, _targetDist, _w1FireInterval, _w2FireInterval, _w1FireCountdown, _w2FireCountdown;
58 bool _end, _destroyUfo, _destroyCraft, _ufoBreakingOff, _weapon1Enabled, _weapon2Enabled;
59 bool _minimized, _endDogfight, _animatingHit, _waitForPoly, _waitForAltitude;
60 std::vector<CraftWeaponProjectile*> _projectiles;
61 static const int _ufoBlobs[8][13][13];
62 static const int _projectileBlobs[4][6][3];
63 int _ufoSize, _craftHeight, _currentCraftDamageColor, _interceptionNumber;
64 size_t _interceptionsCount;
65 int _x, _y, _minimizedIconX, _minimizedIconY;
92 void setStatus(
const std::string &status);
122 void recolor(
const int weaponNo,
const bool currentState);
void btnCautiousPress(Action *action)
Handler for pressing the Cautious Attack button.
Definition: DogfightState.cpp:1345
Represents a craft stored in a base.
Definition: Craft.h:45
Container for all the information associated with a given user action, like mouse clicks...
Definition: Action.h:32
int getInterceptionNumber() const
Gets interception number.
Definition: DogfightState.cpp:1849
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 setMinimized(const bool minimized)
Sets state minimized or maximized.
Definition: DogfightState.cpp:1628
Timer used to run code in fixed intervals.
Definition: Timer.h:35
Ufo * getUfo() const
Gets pointer to the UFO in this dogfight.
Definition: DogfightState.cpp:1813
Surface that the user can interact with.
Definition: InteractiveSurface.h:37
void btnStandoffPress(Action *action)
Handler for pressing the Standoff button.
Definition: DogfightState.cpp:1331
void drawCraftDamage()
Updates craft damage.
Definition: DogfightState.cpp:611
void maximumDistance()
Sets the craft to the maximum distance required to fire a weapon.
Definition: DogfightState.cpp:1275
Text string displayed on screen.
Definition: Text.h:40
void minimumDistance()
Sets the craft to the minimum distance required to fire a weapon.
Definition: DogfightState.cpp:1249
void setInterceptionsCount(const size_t count)
Sets interceptions count.
Definition: DogfightState.cpp:1694
void drawProjectile(const CraftWeaponProjectile *p)
Draws projectiles.
Definition: DogfightState.cpp:1505
void setWaitForPoly(bool wait)
Waits until the UFO reaches a polygon.
Definition: DogfightState.cpp:1854
void previewClick(Action *action)
Handler for clicking the Preview graphic.
Definition: DogfightState.cpp:1444
void ufoFireWeapon()
Each time a UFO will try to fire it's cannons a calculation is made.
Definition: DogfightState.cpp:1228
void animate()
Animates the window.
Definition: DogfightState.cpp:663
void moveWindow()
Moves window to new position.
Definition: DogfightState.cpp:1787
void animateCraftDamage()
Animates craft damage.
Definition: DogfightState.cpp:594
void btnUfoClick(Action *action)
Handler for clicking the Ufo button.
Definition: DogfightState.cpp:1425
bool dogfightEnded() const
Checks if the dogfight should be ended.
Definition: DogfightState.cpp:1804
void update()
Moves the craft.
Definition: DogfightState.cpp:731
void weapon2Click(Action *action)
Toggles usage of weapon 2.
Definition: DogfightState.cpp:1568
void btnMinimizeClick(Action *action)
Handler for clicking the Minimize button.
Definition: DogfightState.cpp:1312
Shows a dogfight (interception) between a player craft and an UFO.
Definition: DogfightState.h:44
void btnStandardPress(Action *action)
Handler for pressing the Standard Attack button.
Definition: DogfightState.cpp:1367
bool getWaitForPoly() const
Waits until the UFO reaches a polygon.
Definition: DogfightState.cpp:1859
bool getWaitForAltitude() const
Waits until the UFO reaches the right altutude.
Definition: DogfightState.cpp:1869
void setWaitForAltitude(bool wait)
Waits until the UFO reaches the right altitude.
Definition: DogfightState.cpp:1864
void btnMinimizedIconClick(Action *action)
Handler for clicking the minimized interception window icon.
Definition: DogfightState.cpp:1663
Element that is blit (rendered) onto the screen.
Definition: Surface.h:38
void btnDisengagePress(Action *action)
Handler for pressing the Disengage button.
Definition: DogfightState.cpp:1411
bool isMinimized() const
Returns true if state is minimized.
Definition: DogfightState.cpp:1619
void setInterceptionNumber(const int number)
Sets interception number.
Definition: DogfightState.cpp:1685
DogfightState(GeoscapeState *state, Craft *craft, Ufo *ufo)
Creates the Dogfight state.
Definition: DogfightState.cpp:235
void drawUfo()
Draws UFO.
Definition: DogfightState.cpp:1464
void weapon1Click(Action *action)
Toggles usage of weapon 1.
Definition: DogfightState.cpp:1558
Craft * getCraft() const
Gets pointer to the craft in this dogfight.
Definition: DogfightState.cpp:1822
Represents an alien UFO on the map.
Definition: Ufo.h:40
void btnAggressivePress(Action *action)
Handler for pressing the Aggressive Attack button.
Definition: DogfightState.cpp:1389
void setStatus(const std::string &status)
Changes the status text.
Definition: DogfightState.cpp:1302
void recolor(const int weaponNo, const bool currentState)
Changes colors of weapon icons, range indicators and ammo texts base on current weapon state...
Definition: DogfightState.cpp:1579
void calculateWindowPosition()
Calculates window position according to opened interception windows.
Definition: DogfightState.cpp:1705
~DogfightState()
Cleans up the Dogfight state.
Definition: DogfightState.cpp:565
void fireWeapon1()
Fires a shot from the first weapon equipped on the craft.
Definition: DogfightState.cpp:1179
void think()
Runs the timers.
Definition: DogfightState.cpp:578
void fireWeapon2()
Fires a shot from the second weapon equipped on the craft.
Definition: DogfightState.cpp:1203
Definition: BaseInfoState.cpp:40
Definition: CraftWeaponProjectile.h:32