OpenXcom
1.0
Open-source clone of the original X-Com
|
A class that represents a projectile. More...
#include <Projectile.h>
Public Member Functions | |
Projectile (ResourcePack *res, SavedBattleGame *save, BattleAction action, Position origin, Position target) | |
Creates a new Projectile. More... | |
~Projectile () | |
Cleans up the Projectile. More... | |
int | calculateTrajectory (double accuracy) |
Calculates the trajectory for a straight path. More... | |
int | calculateThrow (double accuracy) |
Calculates the trajectory for a curved path. More... | |
bool | move () |
Moves the projectile one step in its trajectory. More... | |
Position | getPosition (int offset=0) const |
Gets the current position in voxel space. More... | |
int | getParticle (int i) const |
Gets a particle from the particle array. More... | |
BattleItem * | getItem () const |
Gets the item. More... | |
Surface * | getSprite () const |
Gets the sprite. More... | |
void | skipTrajectory () |
Skips the bullet flight. More... | |
Position | getOrigin () |
Gets the Position of origin for the projectile. More... | |
Position | getTarget () |
Gets the targetted tile for the projectile. More... | |
A class that represents a projectile.
Map is the owner of an instance of this class during its short life. It calculates its own trajectory and then moves along this precalculated trajectory in voxel space.
OpenXcom::Projectile::Projectile | ( | ResourcePack * | res, |
SavedBattleGame * | save, | ||
BattleAction | action, | ||
Position | origin, | ||
Position | targetVoxel | ||
) |
Creates a new Projectile.
Sets up a UnitSprite with the specified size and position.
OpenXcom::Projectile::~Projectile | ( | ) |
Cleans up the Projectile.
Deletes the Projectile.
int OpenXcom::Projectile::calculateThrow | ( | double | accuracy | ) |
Calculates the trajectory for a curved path.
accuracy | The unit's accuracy. |
int OpenXcom::Projectile::calculateTrajectory | ( | double | accuracy | ) |
Calculates the trajectory for a straight path.
accuracy | The unit's accuracy. |
BattleItem * OpenXcom::Projectile::getItem | ( | ) | const |
Gets the item.
Gets the project tile item.
Returns 0 when there is no item thrown.
Position OpenXcom::Projectile::getOrigin | ( | ) |
Gets the Position of origin for the projectile.
int OpenXcom::Projectile::getParticle | ( | int | i | ) | const |
Gets a particle from the particle array.
Gets a particle reference from the projectile surfaces.
i | Index. |
Position OpenXcom::Projectile::getPosition | ( | int | offset = 0 | ) | const |
Surface * OpenXcom::Projectile::getSprite | ( | ) | const |
Position OpenXcom::Projectile::getTarget | ( | ) |
Gets the targetted tile for the projectile.
Gets the INTENDED target for this projectile it is important to note that we do not use the final position of the projectile here, but rather the targetted tile.
bool OpenXcom::Projectile::move | ( | ) |
Moves the projectile one step in its trajectory.
Moves further in the trajectory.
void OpenXcom::Projectile::skipTrajectory | ( | ) |
Skips the bullet flight.
Skips to the end of the trajectory.