_________ __ __ / _____// |_____________ _/ |______ ____ __ __ ______ \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \ /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > \/ \/ \//_____/ \/ ______________________ ______________________ T H E W A R B E G I N S Stratagus - A free fantasy real time strategy game engine
#include <missile.h>
Public Member Functions | |
virtual void | Action ()=0 |
Public Attributes | |
PixelPos | source |
PixelPos | position |
Missile source position. More... | |
PixelPos | destination |
missile pixel position More... | |
const MissileType * | Type |
missile pixel destination More... | |
int | SpriteFrame |
missile-type pointer More... | |
int | State |
sprite frame counter More... | |
int | AnimWait |
state More... | |
int | Wait |
Animation wait. More... | |
int | Delay |
delay between frames More... | |
CUnitPtr | SourceUnit |
delay to show up More... | |
CUnitPtr | TargetUnit |
unit that fires (could be killed) More... | |
std::vector< CUnit * > | PiercedUnits |
target unit, used for spells More... | |
int | Damage |
Units which are already pierced by this missile. More... | |
int | TTL |
direct damage that missile applies More... | |
int | Hidden |
time to live (ticks) used for spells More... | |
int | DestroyMissile |
If this is 1 then the missile is invisible. More... | |
int | CurrentStep |
this tells missile-class-straight-fly, that it's time to die More... | |
int | TotalStep |
Current step (0 <= x < TotalStep). More... | |
unsigned | Local: 1 |
Total step. More... | |
unsigned int | Slot |
missile is a local missile More... | |
missile.cpp - The missiles. | |
static unsigned int | Count = 0 |
unique number for draw level. More... | |
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) |
Missile on the map.
#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==Missile::DX and Missile::Y==Missile::DY the missile stays at its position. But the movement also depends on MissileType::Class.
MissileType pointer of the missile, contains the shared information 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.
|
protected |
Constructor
|
virtual |
Missile destructior.
|
pure virtual |
Implemented in MissileStraightFly, MissileContinious, MissileClipToTarget, MissileTracer, MissileDeathCoil, MissileFlameShield, MissileWhirlwind, MissileLandMine, MissileParabolic, MissileHit, MissileFire, MissileCycleOnce, MissileStay, MissilePointToPointBounce, MissilePointToPointCycleOnce, MissilePointToPointWithHit, MissilePointToPoint, and MissileNone.
|
static |
Change missile heading from x,y.
delta | Delta movement |
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
Save the state of a missile to file.
file | Output file. |
int Missile::AnimWait |
state
|
static |
unique number for draw level.
int Missile::CurrentStep |
this tells missile-class-straight-fly, that it's time to die
int Missile::Damage |
Units which are already pierced by this missile.
int Missile::Delay |
delay between frames
PixelPos Missile::destination |
missile pixel position
int Missile::DestroyMissile |
If this is 1 then the missile is invisible.
int Missile::Hidden |
time to live (ticks) used for spells
unsigned Missile::Local |
Total step.
std::vector<CUnit *> Missile::PiercedUnits |
target unit, used for spells
unsigned int Missile::Slot |
missile is a local missile
PixelPos Missile::source |
CUnitPtr Missile::SourceUnit |
delay to show up
int Missile::SpriteFrame |
missile-type pointer
int Missile::State |
sprite frame counter
CUnitPtr Missile::TargetUnit |
unit that fires (could be killed)
int Missile::TotalStep |
Current step (0 <= x < TotalStep).
int Missile::TTL |
direct damage that missile applies
const MissileType* Missile::Type |
missile pixel destination
int Missile::Wait |
Animation wait.