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:1359
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:1855
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:43
void setMinimized(const bool minimized)
Sets state minimized or maximized.
Definition: DogfightState.cpp:1642
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:1827
Surface that the user can interact with.
Definition: InteractiveSurface.h:37
void btnStandoffPress(Action *action)
Handler for pressing the Standoff button.
Definition: DogfightState.cpp:1345
void drawCraftDamage()
Updates craft damage.
Definition: DogfightState.cpp:619
void maximumDistance()
Sets the craft to the maximum distance required to fire a weapon.
Definition: DogfightState.cpp:1289
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:1263
void setInterceptionsCount(const size_t count)
Sets interceptions count.
Definition: DogfightState.cpp:1708
void drawProjectile(const CraftWeaponProjectile *p)
Draws projectiles.
Definition: DogfightState.cpp:1519
void setWaitForPoly(bool wait)
Waits until the UFO reaches a polygon.
Definition: DogfightState.cpp:1860
void previewClick(Action *action)
Handler for clicking the Preview graphic.
Definition: DogfightState.cpp:1458
void ufoFireWeapon()
Each time a UFO will try to fire it's cannons a calculation is made.
Definition: DogfightState.cpp:1242
void animate()
Animates the window.
Definition: DogfightState.cpp:671
void moveWindow()
Moves window to new position.
Definition: DogfightState.cpp:1801
void animateCraftDamage()
Animates craft damage.
Definition: DogfightState.cpp:602
void btnUfoClick(Action *action)
Handler for clicking the Ufo button.
Definition: DogfightState.cpp:1439
bool dogfightEnded() const
Checks if the dogfight should be ended.
Definition: DogfightState.cpp:1818
void update()
Moves the craft.
Definition: DogfightState.cpp:739
void weapon2Click(Action *action)
Toggles usage of weapon 2.
Definition: DogfightState.cpp:1582
void btnMinimizeClick(Action *action)
Handler for clicking the Minimize button.
Definition: DogfightState.cpp:1326
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:1381
bool getWaitForPoly() const
Waits until the UFO reaches a polygon.
Definition: DogfightState.cpp:1865
bool getWaitForAltitude() const
Waits until the UFO reaches the right altutude.
Definition: DogfightState.cpp:1875
void setWaitForAltitude(bool wait)
Waits until the UFO reaches the right altitude.
Definition: DogfightState.cpp:1870
void btnMinimizedIconClick(Action *action)
Handler for clicking the minimized interception window icon.
Definition: DogfightState.cpp:1677
Element that is blit (rendered) onto the screen.
Definition: Surface.h:36
void btnDisengagePress(Action *action)
Handler for pressing the Disengage button.
Definition: DogfightState.cpp:1425
bool isMinimized() const
Returns true if state is minimized.
Definition: DogfightState.cpp:1633
void setInterceptionNumber(const int number)
Sets interception number.
Definition: DogfightState.cpp:1699
DogfightState(GeoscapeState *state, Craft *craft, Ufo *ufo)
Creates the Dogfight state.
Definition: DogfightState.cpp:235
void drawUfo()
Draws UFO.
Definition: DogfightState.cpp:1478
void weapon1Click(Action *action)
Toggles usage of weapon 1.
Definition: DogfightState.cpp:1572
Craft * getCraft() const
Gets pointer to the craft in this dogfight.
Definition: DogfightState.cpp:1836
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:1403
void setStatus(const std::string &status)
Changes the status text.
Definition: DogfightState.cpp:1316
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:1593
void calculateWindowPosition()
Calculates window position according to opened interception windows.
Definition: DogfightState.cpp:1719
~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:1187
void think()
Runs the timers.
Definition: DogfightState.cpp:586
void fireWeapon2()
Fires a shot from the second weapon equipped on the craft.
Definition: DogfightState.cpp:1214
Definition: BaseInfoState.cpp:40
Definition: CraftWeaponProjectile.h:32