30 class SavedBattleGame;
33 class BattlescapeState;
41 enum BattleActionType { BA_NONE, BA_TURN, BA_WALK, BA_PRIME, BA_THROW, BA_AUTOSHOT, BA_SNAPSHOT, BA_AIMEDSHOT, BA_HIT, BA_USE, BA_LAUNCH, BA_MINDCONTROL, BA_PANIC, BA_RETHINK };
45 BattleActionType type;
49 std::list<Position> waypoints;
62 BattleAction() : type(BA_NONE), actor(0), weapon(0), TU(0), targeting(
false), value(0), strafe(
false), run(
false), diff(0), autoShotCounter(0), cameraPosition(0, 0, -1), desperate(
false), finalFacing(-1), finalAction(
false), number(0) { }
73 std::list<BattleState*> _states, _deleted;
74 bool _playerPanicHandled;
77 bool _AISecondMove, _playedAggroSound;
78 bool _endTurnRequested, _endTurnProcessed;
83 bool handlePanickingPlayer();
88 std::vector<InfoboxOKState*> _infoboxQueue;
90 void showInfoBoxQueue();
178 void tallyUnits(
int &liveAliens,
int &liveSoldiers);
179 bool convertInfected();
192 std::list<BattleState*> getStates();
void autoEndBattle()
Auto end the battle if conditions are met.
Definition: BattlescapeGame.cpp:2265
A utility class that modifies tile properties on a battlescape map.
Definition: TileEngine.h:38
void setupCursor()
Sets up the cursor taking into account the action.
Definition: BattlescapeGame.cpp:863
bool worthTaking(BattleItem *item, BattleAction *action)
Evaluates if it's worthwhile to take this item.
Definition: BattlescapeGame.cpp:1887
bool playableUnitSelected() const
Determines whether a playable unit is selected.
Definition: BattlescapeGame.cpp:899
int getDepth() const
Get the depth of the saved game.
Definition: BattlescapeGame.cpp:2251
Definition: BattlescapeGame.h:43
Pathfinding * getPathfinding()
Gets the pathfinding.
Definition: BattlescapeGame.cpp:1787
void think()
Checks for units panicking or falling and so on.
Definition: BattlescapeGame.cpp:100
TileEngine * getTileEngine()
Gets the tilengine.
Definition: BattlescapeGame.cpp:1778
~BattlescapeGame()
Cleans up the BattlescapeGame state.
Definition: BattlescapeGame.cpp:88
bool checkReservedTU(BattleUnit *bu, int tu, bool justChecking=false)
Checks reserved tu.
Definition: BattlescapeGame.cpp:1154
void statePushBack(BattleState *bs)
Pushes a state to the back of the list.
Definition: BattlescapeGame.cpp:958
void cleanupDeleted()
Cleans up all the deleted states.
Definition: BattlescapeGame.cpp:2238
void popState()
Removes current state.
Definition: BattlescapeGame.cpp:988
void secondaryAction(Position pos)
Activates secondary action (right click).
Definition: BattlescapeGame.cpp:1546
static bool _debugPlay
is debug mode enabled in the battlescape?
Definition: BattlescapeGame.h:93
Contains all the game-specific static data that never changes throughout the game, like rulesets and resources.
Definition: Mod.h:87
bool takeItem(BattleItem *item, BattleAction *action)
Assigns the item to a slot (stolen from battlescapeGenerator::addItem()).
Definition: BattlescapeGame.cpp:2030
BattlescapeGame(SavedBattleGame *save, BattlescapeState *parentState)
Creates the BattlescapeGame state.
Definition: BattlescapeGame.cpp:71
void requestEndTurn()
Requests the end of the turn (wait for explosions etc to really end the turn).
Definition: BattlescapeGame.cpp:1618
SavedBattleGame * getSave()
Gets the save.
Definition: BattlescapeGame.cpp:1769
void statePushNext(BattleState *bs)
Pushes a state to second on the list.
Definition: BattlescapeGame.cpp:940
void psiButtonAction()
Handler for the psi button.
Definition: BattlescapeGame.cpp:1573
void handleAI(BattleUnit *unit)
Handles unit AI.
Definition: BattlescapeGame.cpp:168
void moveUpDown(BattleUnit *unit, int dir)
Moves a unit up or down.
Definition: BattlescapeGame.cpp:1594
void statePushFront(BattleState *bs)
Pushes a state to the front of the list.
Definition: BattlescapeGame.cpp:930
void setStateInterval(Uint32 interval)
Sets state think interval.
Definition: BattlescapeGame.cpp:1141
Represents a single item in the battlescape.
Definition: BattleItem.h:37
bool cancelCurrentAction(bool bForce=false)
Cancels the current action.
Definition: BattlescapeGame.cpp:1331
bool kneel(BattleUnit *bu)
Handles kneeling action.
Definition: BattlescapeGame.cpp:329
Interactive map of the battlescape.
Definition: Map.h:44
bool isBusy() const
Determines whether there is an action currently going on.
Definition: BattlescapeGame.cpp:1392
This class sets the battlescape in a certain sub-state.
Definition: BattleState.h:29
void primaryAction(Position pos)
Activates primary action (left click).
Definition: BattlescapeGame.cpp:1401
void handleNonTargetAction()
Handles the result of non target actions, like priming a grenade.
Definition: BattlescapeGame.cpp:816
void setTUReserved(BattleActionType tur)
Sets the TU reserved type.
Definition: BattlescapeGame.cpp:1633
Mod * getMod()
Gets the mod.
Definition: BattlescapeGame.cpp:1796
bool checkForProximityGrenades(BattleUnit *unit)
Checks for and triggers proximity grenades.
Definition: BattlescapeGame.cpp:2198
bool getPanicHandled() const
Returns whether panic has been handled.
Definition: BattlescapeGame.h:164
void checkForCasualties(BattleItem *murderweapon, BattleUnit *origMurderer, bool hiddenExplosion=false, bool terrainExplosion=false)
Checks for casualties in battle.
Definition: BattlescapeGame.cpp:535
void handleState()
Handles states timer.
Definition: BattlescapeGame.cpp:907
BattleUnit * convertUnit(BattleUnit *unit)
Converts a unit into a unit of another type.
Definition: BattlescapeGame.cpp:1697
Battlescape game - the core game engine of the battlescape game.
Definition: BattlescapeGame.h:68
void findItem(BattleAction *action)
Tries to find an item and pick it up if possible.
Definition: BattlescapeGame.cpp:1805
A utility class that calculates the shortest path between two points on the battlescape map...
Definition: Pathfinding.h:35
The battlescape data that gets written to disk when the game is saved.
Definition: SavedBattleGame.h:47
BattleActionType getReservedAction()
Returns the type of action that is reserved.
Definition: BattlescapeGame.cpp:2109
void dropItem(Position position, BattleItem *item, bool newItem=false, bool removeItem=false)
Drops an item and affects it with gravity.
Definition: BattlescapeGame.cpp:1645
void init()
Initializes the Battlescape game.
Definition: BattlescapeGame.cpp:155
Easy handling of X-Y-Z coordinates.
Definition: Position.h:28
BattleAction * getCurrentAction()
Gets a pointer to access action members directly.
Definition: BattlescapeGame.cpp:1383
void setKneelReserved(bool reserved)
Sets the kneel reservation setting.
Definition: BattlescapeGame.cpp:2177
Map * getMap()
Gets the map.
Definition: BattlescapeGame.cpp:1760
Battlescape screen which shows the tactical battle.
Definition: BattlescapeState.h:47
BattleItem * surveyItems(BattleAction *action)
Checks through all the items on the ground and picks one.
Definition: BattlescapeGame.cpp:1845
void tallyUnits(int &liveAliens, int &liveSoldiers)
Tallies the living units, converting them if necessary.
Definition: BattlescapeGame.cpp:2120
void launchAction()
Handler for the blaster launcher button.
Definition: BattlescapeGame.cpp:1558
bool getKneelReserved() const
Checks the kneel reservation setting.
Definition: BattlescapeGame.cpp:2186
void missionComplete()
Sets up a mission complete notification.
Definition: BattlescapeGame.cpp:800
Represents a moving unit in the battlescape, player controlled or AI controlled it holds info about i...
Definition: BattleUnit.h:59
Definition: BaseInfoState.cpp:40
int takeItemFromGround(BattleItem *item, BattleAction *action)
Picks the item up from the ground.
Definition: BattlescapeGame.cpp:1982