$treeview $search $mathjax
Stratagus
2.2.7
$projectbrief
|
$projectbrief
|
$searchbox |
_________ __ __ / _____// |_____________ _/ |______ ____ __ __ ______ \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \ /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > \/ \/ \//_____/ \/ ______________________ ______________________ T H E W A R B E G I N S Stratagus - A free fantasy real time strategy game engine
#include <missile.h>
missile.cpp - The missiles. | |
static unsigned int | Count = 0 |
unique number for draw level. | |
Missile () | |
virtual | ~Missile () |
void | DrawMissile (const CViewport &vp) const |
void | SaveMissile (CFile &file) const |
void | MissileHit (CUnit *unit=NULL) |
bool | NextMissileFrame (char sign, char longAnimation) |
void | NextMissileFrameCycle () |
void | MissileNewHeadingFromXY (const PixelPos &delta) |
static Missile * | Init (const MissileType &mtype, const PixelPos &startPos, const PixelPos &destPos) |
Public Member Functions | |
virtual void | Action ()=0 |
Public Attributes | |
PixelPos | source |
PixelPos | position |
Missile source position. | |
PixelPos | destination |
missile pixel position | |
const MissileType * | Type |
missile pixel destination | |
int | SpriteFrame |
missile-type pointer | |
int | State |
sprite frame counter | |
int | AnimWait |
state | |
int | Wait |
Animation wait. | |
int | Delay |
delay between frames | |
CUnitPtr | SourceUnit |
delay to show up | |
CUnitPtr | TargetUnit |
unit that fires (could be killed) | |
std::vector< CUnit * > | PiercedUnits |
target unit, used for spells | |
int | Damage |
Units which are already pierced by this missile. | |
int | TTL |
direct damage that missile applies | |
int | Hidden |
time to live (ticks) used for spells | |
int | CurrentStep |
If this is 1 then the missile is invisible. | |
int | TotalStep |
Current step (0 <= x < TotalStep). | |
unsigned | Local: 1 |
Total step. | |
unsigned int | Slot |
missile is a local missile |
#include "missile.h"
This structure contains all information about a missile in game. A missile could have different effects, based on its missile-type. Missiles could be saved and stored with CCL. See (missile). Currently only a tile, a unit or a missile could be placed on the map.
The missile structure members:
Missile current map position in pixels.
Missile original map position in pixels.
Missile destination on the map in pixels. If Missile::X==MissileDX and Missile::Y==MissileDY the missile stays at its position. But the movement also depends on MissileType::Class.
MissileType pointer of the missile, contains the shared informations of all missiles of the same type.
Current sprite frame of the missile. The range is from 0 to MissileType::SpriteFrames-1. The topmost bit (128) is used as flag to mirror the sprites in X direction. Animation scripts aren't currently supported for missiles, everything is handled by MissileType::Class
Current state of the missile. Used for a simple state machine.
Animation wait. Used internally by missile actions, to run the animation in parallel with the rest.
Wait this number of game cycles until the next state or animation of this missile is handled. This counts down from MissileType::Sleep to 0.
Number of game cycles the missile isn't shown on the map. This counts down from MissileType::StartDelay to 0, before this happens the missile isn't shown and has no effects.
The owner of the missile. Normally the one who fired the missile. Used to check units, to prevent hitting the owner when field MissileType::CanHitOwner==true. Also used for kill and experience points.
The target of the missile. Normally the unit which should be hit by the missile.
Damage done by missile. See also MissileType::Range, which denoted the 100% damage in center.
Time to live in game cycles of the missile, if it reaches zero the missile is automatic removed from the map. If -1 the missile lives for ever and the lifetime is handled by Missile::Type:MissileType::Class
When you set this to 1 the unit becomes hidden for a while.
Movement step. Used for the different trajectories.
Maximum number of step. When CurrentStep >= TotalStep, the movement is finished.
This is a local missile, which can be different on all computer in play. Used for the user interface (fe the green cross).
Missile::MissileSlot
Pointer to the slot of this missile. Used for faster freeing.
Missile::Missile | ( | ) | [protected] |
Constructor
Missile::~Missile | ( | ) | [virtual] |
Missile destructior.
Missile * Missile::Init | ( | const MissileType & | mtype, | |
const PixelPos & | startPos, | |||
const PixelPos & | destPos | |||
) | [static] |
virtual void Missile::Action | ( | ) | [pure virtual] |
Implemented in MissileNone, MissilePointToPoint, MissilePointToPointWithHit, MissilePointToPointCycleOnce, MissilePointToPointBounce, MissileStay, MissileCycleOnce, MissileFire, MissileHit, MissileParabolic, MissileLandMine, MissileWhirlwind, MissileFlameShield, MissileDeathCoil, MissileTracer, and MissileClipToTarget.
void Missile::DrawMissile | ( | const CViewport & | vp | ) | const |
Draw missile.
void Missile::SaveMissile | ( | CFile & | file | ) | const |
Save the state of a missile to file.
file | Output file. |
void Missile::MissileHit | ( | CUnit * | unit = NULL |
) |
Work for missile hit.
bool Missile::NextMissileFrame | ( | char | sign, | |
char | longAnimation | |||
) |
Pass to the next frame for animation.
sign | 1 for next frame, -1 for previous frame. | |
longAnimation | 1 if Frame is conditioned by covered distance, 0 else. |
void Missile::NextMissileFrameCycle | ( | ) |
Pass the next frame of the animation. This animation goes from start to finish ONCE on the way
void Missile::MissileNewHeadingFromXY | ( | const PixelPos & | delta | ) |
Change missile heading from x,y.
delta | Delta movement |
Missile source position.
missile pixel position
const MissileType* Missile::Type |
missile pixel destination
missile-type pointer
int Missile::State |
sprite frame counter
state
int Missile::Wait |
Animation wait.
int Missile::Delay |
delay between frames
delay to show up
unit that fires (could be killed)
std::vector<CUnit *> Missile::PiercedUnits |
target unit, used for spells
int Missile::Damage |
Units which are already pierced by this missile.
int Missile::TTL |
direct damage that missile applies
int Missile::Hidden |
time to live (ticks) used for spells
If this is 1 then the missile is invisible.
Current step (0 <= x < TotalStep).
unsigned Missile::Local |
Total step.
unsigned int Missile::Slot |
missile is a local missile
unsigned int Missile::Count = 0 [static] |
unique number for draw level.