19 #ifndef OPENXCOM_BATTLESCAPESTATE_H
20 #define OPENXCOM_BATTLESCAPESTATE_H
22 #include "../Engine/State.h"
34 class InteractiveSurface;
39 class SavedBattleGame;
43 class BattlescapeGame;
54 InteractiveSurface *_btnUnitUp, *_btnUnitDown, *_btnMapUp, *_btnMapDown, *_btnShowMap, *_btnKneel;
55 InteractiveSurface *_btnInventory, *_btnCenter, *_btnNextSoldier, *_btnNextStop, *_btnShowLayers, *_btnHelp;
58 ImageButton *_btnReserveNone, *_btnReserveSnap, *_btnReserveAimed, *_btnReserveAuto, *_btnReserveKneel, *_btnZeroTUs;
60 static const int VISIBLE_MAX = 10;
66 NumberText *_numTimeUnits, *_numEnergy, *_numHealth, *_numMorale, *_numLayers, *_numAmmoLeft, *_numAmmoRight;
67 Bar *_barTimeUnits, *_barEnergy, *_barHealth, *_barMorale;
68 Timer *_animTimer, *_gameTimer;
70 Text *_txtDebug, *_txtTooltip;
71 std::vector<State*> _popups;
74 bool _isMouseScrolling, _isMouseScrolled;
75 int _xBeforeMouseScrolling, _yBeforeMouseScrolling;
76 Position _mapOffsetBeforeMouseScrolling;
77 Uint32 _mouseScrollingStartTime;
78 int _totalMouseMoveX, _totalMouseMoveY;
79 bool _mouseMovedOverThreshold;
81 std::string _currentTooltip;
86 void blinkVisibleUnitButtons();
89 void selectNextPlayerUnit(
bool checkReselect =
false,
bool setReselect =
false,
bool checkInventory =
false);
92 static const int DEFAULT_ANIM_SPEED = 100;
172 void debug(
const std::wstring &message);
174 void warning(
const std::string &message);
212 void resize(
int &dX,
int &dY);
void stopScrolling(Action *action)
Move the mouse back to where it started after we finish drag scrolling.
Definition: BattlescapeState.cpp:2156
void btnHelpClick(Action *action)
Handler for clicking the Help button.
Definition: BattlescapeState.cpp:1007
Container for all the information associated with a given user action, like mouse clicks...
Definition: Action.h:34
void btnInventoryClick(Action *action)
Handler for clicking the Soldier button.
Definition: BattlescapeState.cpp:884
void btnNextSoldierClick(Action *action)
Handler for clicking the Next Soldier button.
Definition: BattlescapeState.cpp:929
void mouseOutIcons(Action *action)
Handler for the mouse going out of the icons, enabling the tile selection cube.
Definition: BattlescapeState.cpp:1996
void debug(const std::wstring &message)
Show debug message.
Definition: BattlescapeState.cpp:1437
void btnReserveClick(Action *action)
Handler for clicking a reserved button.
Definition: BattlescapeState.cpp:1175
BattlescapeGame * getBattleGame()
Returns a pointer to the battlegame, in case we need its functions.
Definition: BattlescapeState.cpp:1978
A game state that receives user input and reacts accordingly.
Definition: State.h:44
Timer used to run code in fixed intervals.
Definition: Timer.h:37
void saveVoxelMap()
Saves each layer of voxels on the bettlescape as a png.
Definition: BattlescapeState.cpp:1806
Surface that the user can interact with.
Definition: InteractiveSurface.h:39
void btnMapUpClick(Action *action)
Handler for clicking the Map Up button.
Definition: BattlescapeState.cpp:828
void saveVoxelView()
Saves a first-person voxel view of the battlescape.
Definition: BattlescapeState.cpp:1678
void handle(Action *action)
Handles keypresses.
Definition: BattlescapeState.cpp:1458
void think()
Runs the timers and handles popups.
Definition: BattlescapeState.cpp:551
void selectPreviousPlayerUnit(bool checkReselect=false, bool setReselect=false, bool checkInventory=false)
Selects the previous soldier.
Definition: BattlescapeState.cpp:981
void mapClick(Action *action)
Handler for clicking the map.
Definition: BattlescapeState.cpp:706
Text string displayed on screen.
Definition: Text.h:41
Bar graphic that represents a certain value.
Definition: Bar.h:33
void txtTooltipIn(Action *action)
Handler for showing tooltip.
Definition: BattlescapeState.cpp:2077
void mapIn(Action *action)
Handler for entering with mouse to the map surface.
Definition: BattlescapeState.cpp:792
void btnLeftHandItemClick(Action *action)
Handler for clicking the left hand item button.
Definition: BattlescapeState.cpp:1076
void mapPress(Action *action)
Handler for pressing the map.
Definition: BattlescapeState.cpp:677
Map * getMap() const
Gets map.
Definition: BattlescapeState.cpp:1428
void btnRightHandItemClick(Action *action)
Handler for clicking the right hand item button.
Definition: BattlescapeState.cpp:1103
void btnAbortClick(Action *action)
Handler for clicking the Abort button.
Definition: BattlescapeState.cpp:1030
void setStateInterval(Uint32 interval)
Sets the state timer interval.
Definition: BattlescapeState.cpp:1410
void btnLaunchClick(Action *action)
Handler for clicking the launch rocket button.
Definition: BattlescapeState.cpp:1155
void init()
Initilizes the battlescapestate.
Definition: BattlescapeState.cpp:506
void finishBattle(bool abort, int inExitArea)
Finishes a battle.
Definition: BattlescapeState.cpp:1889
void btnReloadClick(Action *action)
Handler for clicking the reload button.
Definition: BattlescapeState.cpp:1207
bool playableUnitSelected()
Determines whether a playable unit is selected.
Definition: BattlescapeState.cpp:1231
void clearMouseScrollingState()
Clears mouse-scrolling state.
Definition: BattlescapeState.cpp:1970
void btnShowMapClick(Action *action)
Handler for clicking the Show Map button.
Definition: BattlescapeState.cpp:848
Represents a single item in the battlescape.
Definition: BattleItem.h:39
void btnShowLayersClick(Action *action)
Handler for clicking the Show Layers button.
Definition: BattlescapeState.cpp:998
Interactive map of the battlescape.
Definition: Map.h:46
void warning(const std::string &message)
Show warning message.
Definition: BattlescapeState.cpp:1449
void resize(int &dX, int &dY)
Update the resolution settings, we just resized the window.
Definition: BattlescapeState.cpp:2106
void mapOver(Action *action)
Handler for moving mouse over the map.
Definition: BattlescapeState.cpp:584
void btnKneelClick(Action *action)
Handler for clicking the Kneel button.
Definition: BattlescapeState.cpp:859
void saveAIMap()
Saves a map as used by the AI.
Definition: BattlescapeState.cpp:1550
void btnNextStopClick(Action *action)
Handler for clicking the Next Stop button.
Definition: BattlescapeState.cpp:939
void showPsiButton(bool show)
Shows the PSI button.
Definition: BattlescapeState.cpp:1962
void btnEndTurnClick(Action *action)
Handler for clicking the End Turn button.
Definition: BattlescapeState.cpp:1018
void btnUnitDownClick(Action *action)
Handler for clicking the Unit Down button.
Definition: BattlescapeState.cpp:815
Coloured box with text inside that fades out after it is displayed.
Definition: WarningMessage.h:35
void popup(State *state)
Displays a popup window.
Definition: BattlescapeState.cpp:1878
Element that is blit (rendered) onto the screen.
Definition: Surface.h:39
void updateSoldierInfo()
Updates soldier name/rank/tu/energy/health/morale.
Definition: BattlescapeState.cpp:1239
~BattlescapeState()
Cleans up the Battlescape state.
Definition: BattlescapeState.cpp:496
void animate()
Animates map objects on the map, also smoke,fire, ...
Definition: BattlescapeState.cpp:1391
void btnUnitUpClick(Action *action)
Handler for clicking the Unit Up button.
Definition: BattlescapeState.cpp:802
void btnPersonalLightingClick(Action *action)
Handler for clicking the lighting button.
Definition: BattlescapeState.cpp:1220
void mouseInIcons(Action *action)
Handler for the mouse moving over the icons, disables the tile selection cube.
Definition: BattlescapeState.cpp:1987
void btnPrevSoldierClick(Action *action)
Handler for clicking the Previous Soldier button.
Definition: BattlescapeState.cpp:949
void btnVisibleUnitClick(Action *action)
Handler for clicking a visible unit button.
Definition: BattlescapeState.cpp:1130
bool allowButtons(bool allowSaving=false) const
Is the player allowed to press buttons?
Definition: BattlescapeState.cpp:2019
Battlescape game - the core game engine of the battlescape game.
Definition: BattlescapeGame.h:70
void selectNextPlayerUnit(bool checkReselect=false, bool setReselect=false, bool checkInventory=false)
Selects the next soldier.
Definition: BattlescapeState.cpp:961
void showLaunchButton(bool show)
Show the launch button.
Definition: BattlescapeState.cpp:1953
bool getMouseOverIcons() const
Checks if the mouse is over the icons.
Definition: BattlescapeState.cpp:2005
The battlescape data that gets written to disk when the game is saved.
Definition: SavedBattleGame.h:50
void txtTooltipOut(Action *action)
Handler for hiding tooltip.
Definition: BattlescapeState.cpp:2090
void btnReserveKneelClick(Action *action)
Handler for clicking the reserve TUs to kneel button.
Definition: BattlescapeState.cpp:2030
The core of the game engine, manages the game's entire contents and structure.
Definition: Game.h:44
Easy handling of X-Y-Z coordinates.
Definition: Position.h:30
Game * getGame() const
Gets game.
Definition: BattlescapeState.cpp:1419
Number digits displayed on the screen.
Definition: NumberText.h:31
Battlescape screen which shows the tactical battle.
Definition: BattlescapeState.h:48
void btnMapDownClick(Action *action)
Handler for clicking the Map Down button.
Definition: BattlescapeState.cpp:838
void btnZeroTUsClick(Action *action)
Handler for clicking the expend all TUs button.
Definition: BattlescapeState.cpp:2056
void handleState()
Handles the battle game state.
Definition: BattlescapeState.cpp:1401
void btnPsiClick(Action *action)
Handler for clicking the use psi button.
Definition: BattlescapeState.cpp:1165
BattlescapeState(Game *game)
Creates the Battlescape state.
Definition: BattlescapeState.cpp:95
Represents a moving unit in the battlescape, player controlled or AI controlled it holds info about i...
Definition: BattleUnit.h:58
void btnStatsClick(Action *action)
Handler for clicking the stats.
Definition: BattlescapeState.cpp:1040
void btnCenterClick(Action *action)
Handler for clicking the Center button.
Definition: BattlescapeState.cpp:917