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)

Note:
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.

Missile::Type

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

Missile::SpriteFrame

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.

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

Missile::Controller

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

Missile::D

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).

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.

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
UnitSourceUnit
 delay to showup
int SpriteFrame
 missile-type pointer
int State
 sprite frame counter
UnitTargetUnit
 unit that fires (could be killed)
int TTL
 direct damage that missile applies
MissileTypeType
 missile pixel destination
int Wait
 state
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