Logo Search packages:      
Sourcecode: freecraft version File versions  Download package

_missile_ Struct Reference

#include <missile.h>

List of all members.

Detailed Description

Missile on the map.

#include "missile.h"

typedef struct _missile_ Missile;

This structure contains all informations 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, an unit or a missile could be placed on the map.

The missile structure members:

Missile::X Missile::Y

Missile current map position in pixels. To convert a map tile position to pixel position use: (mapx*TileSizeX+TileSizeX/2) and (mapy*TileSizeY+TileSizeY/2)

TileSizeX2==0 && TileSizeY2==0 and TileSizeX, TileSizeY are currently fixed 32 pixels.
Missile::DX Missile::DY

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 the Missile::Controller or 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 rang 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 the MissileType::Class or Missile::Controller.

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

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


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.

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

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==1. 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 or Missile::Controller.


A function pointer to the function which controls the missile. Overwrites Missile::Type:MissileType::Class when !NULL.


Delta for Bresenham's line algorithm (point to point missiles).

Missile::Dx Missile::Dy

Delta x and y for Bresenham's line algorithm (point to point missiles).

Missile::Xstep Missile::Ystep

X and y step for Bresenham's line algorithm (point to point missiles).


This is a local missile, which can be different on all computer in play. Used for the user interface (fe the green cross).


Pointer to the slot of this missile. Used for faster freeing.

Definition at line 366 of file missile.h.

Public Attributes

void(* Controller )(Missile *)
 time to live (ticks) used for spells
int D
 used to controll spells
int Damage
 target unit, used for spells
int Delay
 delay between frames
int Dx
 for point to point missiles
int DX
 missile pixel position
int Dy
 delta x
int DY
 missile pixel destination
unsigned Local: 1
 Y step.
Missile ** MissileSlot
 missile is a local missile
 delay to showup
int SpriteFrame
 missile-type pointer
int State
 sprite frame counter
 unit that fires (could be killed)
int TTL
 direct damage that missile applies
 missile pixel destination
int Wait
int X
int Xstep
 delta y
int Y
 missile pixel position
int Ystep
 X step.

The documentation for this struct was generated from the following file:

Generated by  Doxygen 1.6.0   Back to index