19 #ifndef OPENXCOM_BATTLESCAPEGAME_H
20 #define OPENXCOM_BATTLESCAPEGAME_H
32 class SavedBattleGame;
35 class BattlescapeState;
43 enum BattleActionType { BA_NONE, BA_TURN, BA_WALK, BA_PRIME, BA_THROW, BA_AUTOSHOT, BA_SNAPSHOT, BA_AIMEDSHOT, BA_STUN, BA_HIT, BA_USE, BA_LAUNCH, BA_MINDCONTROL, BA_PANIC, BA_RETHINK };
47 BattleActionType type;
51 std::list<Position> waypoints;
64 BattleAction() : type(BA_NONE), actor(0), weapon(0), TU(0), targeting(
false), value(0), result(
""), strafe(
false), run(
false), diff(0), autoShotCounter(0), cameraPosition(0, 0, -1), desperate(
false), finalFacing(-1), finalAction(
false), number(0) { }
75 std::list<BattleState*> _states, _deleted;
76 BattleActionType _tuReserved, _playerTUReserved;
77 bool _playerPanicHandled;
85 bool handlePanickingPlayer();
90 std::vector<InfoboxOKState*> _infoboxQueue;
92 void showInfoBoxQueue();
93 bool _playedAggroSound, _endTurnRequested, _kneelReserved;
167 static bool _debugPlay;
183 void tallyUnits(
int &liveAliens,
int &liveSoldiers,
bool convert);
190 void cleanupDeleted();
A utility class that modifies tile properties on a battlescape map.
Definition: TileEngine.h:40
void tallyUnits(int &liveAliens, int &liveSoldiers, bool convert)
Tallies the living units, converting them if necessary.
Definition: BattlescapeGame.cpp:1949
void primaryAction(const Position &pos)
Activates primary action (left click).
Definition: BattlescapeGame.cpp:1211
void setupCursor()
Sets up the cursor taking into account the action.
Definition: BattlescapeGame.cpp:663
bool worthTaking(BattleItem *item, BattleAction *action)
Evaluates if it's worthwhile to take this item.
Definition: BattlescapeGame.cpp:1713
Definition: BattlescapeGame.h:45
Pathfinding * getPathfinding()
Gets the pathfinding.
Definition: BattlescapeGame.cpp:1606
void think()
Checks for units panicking or falling and so on.
Definition: BattlescapeGame.cpp:104
TileEngine * getTileEngine()
Gets the tilengine.
Definition: BattlescapeGame.cpp:1598
~BattlescapeGame()
Cleans up the BattlescapeGame state.
Definition: BattlescapeGame.cpp:92
ResourcePack * getResourcePack()
Gets the resourcepack.
Definition: BattlescapeGame.cpp:1614
bool checkReservedTU(BattleUnit *bu, int tu, bool justChecking=false)
Checks reserved tu.
Definition: BattlescapeGame.cpp:950
void statePushBack(BattleState *bs)
Pushes a state to the back of the list.
Definition: BattlescapeGame.cpp:758
void popState()
Removes current state.
Definition: BattlescapeGame.cpp:788
bool playableUnitSelected()
Determines whether a playable unit is selected.
Definition: BattlescapeGame.cpp:699
void checkForCasualties(BattleItem *murderweapon, BattleUnit *murderer, bool hiddenExplosion=false, bool terrainExplosion=false)
Checks for casualties in battle.
Definition: BattlescapeGame.cpp:487
bool isBusy()
Determines whether there is an action currently going on.
Definition: BattlescapeGame.cpp:1202
bool takeItem(BattleItem *item, BattleAction *action)
Assigns the item to a slot (stolen from battlescapeGenerator::addItem()).
Definition: BattlescapeGame.cpp:1859
BattlescapeGame(SavedBattleGame *save, BattlescapeState *parentState)
Creates the BattlescapeGame state.
Definition: BattlescapeGame.cpp:72
void setTUReserved(BattleActionType tur, bool player)
Sets the TU reserved type.
Definition: BattlescapeGame.cpp:1450
void requestEndTurn()
Requests the end of the turn (wait for explosions etc to really end the turn).
Definition: BattlescapeGame.cpp:1435
BattleUnit * convertUnit(BattleUnit *unit, std::string newType)
Converts a unit into a unit of another type.
Definition: BattlescapeGame.cpp:1520
SavedBattleGame * getSave()
Gets the save.
Definition: BattlescapeGame.cpp:1590
void statePushNext(BattleState *bs)
Pushes a state to second on the list.
Definition: BattlescapeGame.cpp:740
void psiButtonAction()
Handler for the psi button.
Definition: BattlescapeGame.cpp:1396
void handleAI(BattleUnit *unit)
Handles unit AI.
Definition: BattlescapeGame.cpp:170
void moveUpDown(BattleUnit *unit, int dir)
Moves a unit up or down.
Definition: BattlescapeGame.cpp:1411
void statePushFront(BattleState *bs)
Pushes a state to the front of the list.
Definition: BattlescapeGame.cpp:730
void setStateInterval(Uint32 interval)
Sets state think interval.
Definition: BattlescapeGame.cpp:937
Represents a single item in the battlescape.
Definition: BattleItem.h:39
Set of rules and stats for a game.
Definition: Ruleset.h:69
bool cancelCurrentAction(bool bForce=false)
Cancels the current action.
Definition: BattlescapeGame.cpp:1142
bool kneel(BattleUnit *bu)
Handles kneeling action.
Definition: BattlescapeGame.cpp:342
Interactive map of the battlescape.
Definition: Map.h:46
This class sets the battlescape in a certain sub-state.
Definition: BattleState.h:34
void handleNonTargetAction()
Handles the result of non target actions, like priming a grenade.
Definition: BattlescapeGame.cpp:607
bool checkForProximityGrenades(BattleUnit *unit)
Checks for and triggers proximity grenades.
Definition: BattlescapeGame.cpp:2023
void checkForPanic(BattleUnit *unit)
Checks if a unit panics.
Packs of external game media.
Definition: ResourcePack.h:50
void handleState()
Handles states timer.
Definition: BattlescapeGame.cpp:707
Battlescape game - the core game engine of the battlescape game.
Definition: BattlescapeGame.h:70
void findItem(BattleAction *action)
Tries to find an item and pick it up if possible.
Definition: BattlescapeGame.cpp:1631
A utility class that calculates the shortest path between two points on the battlescape map...
Definition: Pathfinding.h:37
The battlescape data that gets written to disk when the game is saved.
Definition: SavedBattleGame.h:50
bool getPanicHandled()
Returns whether panic has been handled.
Definition: BattlescapeGame.h:169
BattleActionType getReservedAction()
Returns the type of action that is reserved.
Definition: BattlescapeGame.cpp:1938
void init()
Initializes the Battlescape game.
Definition: BattlescapeGame.cpp:157
const Ruleset * getRuleset() const
Gets the ruleset.
Definition: BattlescapeGame.cpp:1622
Easy handling of X-Y-Z coordinates.
Definition: Position.h:30
BattleAction * getCurrentAction()
Gets a pointer to access action members directly.
Definition: BattlescapeGame.cpp:1193
void setKneelReserved(bool reserved)
Sets the kneel reservation setting.
Definition: BattlescapeGame.cpp:1997
void dropItem(const Position &position, BattleItem *item, bool newItem=false, bool removeItem=false)
Drops an item and affects it with gravity.
Definition: BattlescapeGame.cpp:1467
bool getKneelReserved()
Checks the kneel reservation setting.
Definition: BattlescapeGame.cpp:2007
Map * getMap()
Gets the map.
Definition: BattlescapeGame.cpp:1582
Battlescape screen which shows the tactical battle.
Definition: BattlescapeState.h:48
BattleItem * surveyItems(BattleAction *action)
Checks through all the items on the ground and picks one.
Definition: BattlescapeGame.cpp:1671
void launchAction()
Handler for the blaster launcher button.
Definition: BattlescapeGame.cpp:1381
Represents a moving unit in the battlescape, player controlled or AI controlled it holds info about i...
Definition: BattleUnit.h:58
int takeItemFromGround(BattleItem *item, BattleAction *action)
Picks the item up from the ground.
Definition: BattlescapeGame.cpp:1808
void secondaryAction(const Position &pos)
Activates secondary action (right click).
Definition: BattlescapeGame.cpp:1369