_________ __                 __
        /   _____//  |_____________ _/  |______     ____  __ __  ______
        \_____  \\   __\_  __ \__  \\   __\__  \   / ___\|  |  \/  ___/
        /        \|  |  |  | \// __ \|  |  / __ \_/ /_/  >  |  /\___ \
       /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
               \/                  \/          \//_____/            \/
    ______________________                           ______________________
                          T H E   W A R   B E G I N S
                   Stratagus - A free fantasy real time strategy game engine

Public Member Functions | Public Attributes | List of all members
Missile Class Referenceabstract

Missile on the map. More...

#include <missile.h>

Inheritance diagram for Missile:
MissileClipToTarget MissileContinious MissileCycleOnce MissileDeathCoil MissileFire MissileFlameShield MissileHit MissileLandMine MissileNone MissileParabolic MissilePointToPoint MissilePointToPointBounce MissilePointToPointCycleOnce MissilePointToPointWithHit MissileStay MissileStraightFly MissileTracer MissileWhirlwind

Public Member Functions

virtual void Action ()=0
 

Public Attributes

PixelPos source
 
PixelPos position
 Missile source position. More...
 
PixelPos destination
 missile pixel position More...
 
const MissileTypeType
 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 MissileInit (const MissileType &mtype, const PixelPos &startPos, const PixelPos &destPos)
 

Detailed Description

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::position

Missile current map position in pixels.

Missile::source

Missile original map position in pixels.

Missile::destination

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.

Missile::Type

MissileType pointer of the missile, contains the shared information of all missiles of the same type.

Missile::SpriteFrame

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

Note
If wanted, we can add animation scripts support to the engine.

Missile::State

Current state of the missile. Used for a simple state machine.

Missile::AnimWait

Animation wait. Used internally by missile actions, to run the animation in parallel with the rest.

Missile::Wait

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.

Missile::Delay

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.

Note
This can also be used by MissileType::Class for temporary removement of the missile.

Missile::SourceUnit

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.

Missile::TargetUnit

The target of the missile. Normally the unit which should be hit by the missile.

Missile::Damage

Damage done by missile. See also MissileType::Range, which denoted the 100% damage in center.

Missile::TTL

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

Missile::Hidden

When you set this to 1 the unit becomes hidden for a while.

Missile::CurrentStep

Movement step. Used for the different trajectories.

Missile::TotalStep

Maximum number of step. When CurrentStep >= TotalStep, the movement is finished.

Missile::Local

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.

Constructor & Destructor Documentation

◆ Missile()

Missile::Missile ( )
protected

Constructor

◆ ~Missile()

Missile::~Missile ( )
virtual

Missile destructior.

Member Function Documentation

◆ Action()

virtual void Missile::Action ( )
pure virtual

◆ DrawMissile()

void Missile::DrawMissile ( const CViewport vp) const

Draw missile.

◆ Init()

Missile * Missile::Init ( const MissileType mtype,
const PixelPos startPos,
const PixelPos destPos 
)
static

Initialize a new made missile.

Parameters
mtypeType pointer of missile.
sourcePosMissile start point in pixel.
destPosMissile destination point in pixel.
Returns
created missile.

◆ MissileHit()

void Missile::MissileHit ( CUnit unit = NULL)

Work for missile hit.

◆ MissileNewHeadingFromXY()

void Missile::MissileNewHeadingFromXY ( const PixelPos delta)

Change missile heading from x,y.

Parameters
deltaDelta movement

◆ NextMissileFrame()

bool Missile::NextMissileFrame ( char  sign,
char  longAnimation 
)

Pass to the next frame for animation.

Parameters
sign1 for next frame, -1 for previous frame.
longAnimation1 if Frame is conditioned by covered distance, 0 else.
Returns
true if animation is finished, false else.

◆ NextMissileFrameCycle()

void Missile::NextMissileFrameCycle ( )

Pass the next frame of the animation. This animation goes from start to finish ONCE on the way

◆ SaveMissile()

void Missile::SaveMissile ( CFile file) const

Save the state of a missile to file.

Parameters
fileOutput file.

Member Data Documentation

◆ AnimWait

int Missile::AnimWait

state

◆ Count

unsigned int Missile::Count = 0
static

unique number for draw level.

◆ CurrentStep

int Missile::CurrentStep

this tells missile-class-straight-fly, that it's time to die

◆ Damage

int Missile::Damage

Units which are already pierced by this missile.

◆ Delay

int Missile::Delay

delay between frames

◆ destination

PixelPos Missile::destination

missile pixel position

◆ DestroyMissile

int Missile::DestroyMissile

If this is 1 then the missile is invisible.

◆ Hidden

int Missile::Hidden

time to live (ticks) used for spells

◆ Local

unsigned Missile::Local

Total step.

◆ PiercedUnits

std::vector<CUnit *> Missile::PiercedUnits

target unit, used for spells

◆ position

PixelPos Missile::position

Missile source position.

◆ Slot

unsigned int Missile::Slot

missile is a local missile

◆ source

PixelPos Missile::source

◆ SourceUnit

CUnitPtr Missile::SourceUnit

delay to show up

◆ SpriteFrame

int Missile::SpriteFrame

missile-type pointer

◆ State

int Missile::State

sprite frame counter

◆ TargetUnit

CUnitPtr Missile::TargetUnit

unit that fires (could be killed)

◆ TotalStep

int Missile::TotalStep

Current step (0 <= x < TotalStep).

◆ TTL

int Missile::TTL

direct damage that missile applies

◆ Type

const MissileType* Missile::Type

missile pixel destination

◆ Wait

int Missile::Wait

Animation wait.


The documentation for this class was generated from the following files:
(C) Copyright 1998-2012 by The Stratagus Project under the GNU General Public License.
All trademarks and copyrights on this page are owned by their respective owners.