____ _ __
/ __ )____ _____ | | / /___ ___________
/ __ / __ \/ ___/ | | /| / / __ `/ ___/ ___/
/ /_/ / /_/ (__ ) | |/ |/ / /_/ / / (__ )
/_____/\____/____/ |__/|__/\__,_/_/ /____/
A futuristic real-time strategy game.
This file is part of Bos Wars.
(C) Copyright 2001-2007 by the Bos Wars and Stratagus Project.
Distributed under the "GNU General Public License"
#include <missile.h>

Public Member Functions | |
| virtual | ~Missile () |
| virtual void | Action ()=0 |
| void | DrawMissile () const |
| void | SaveMissile (CFile *file) const |
Static Public Member Functions | |
| static Missile * | Init (MissileType *mtype, int sx, int sy, int dx, int dy) |
Public Attributes | |
| int | SourceX |
| Missile Source X. | |
| int | SourceY |
| Missile Source Y. | |
| int | X |
| missile pixel position | |
| int | Y |
| missile pixel position | |
| int | DX |
| missile pixel destination | |
| int | DY |
| missile pixel destination | |
| MissileType * | Type |
| missile-type pointer | |
| int | SpriteFrame |
| sprite frame counter | |
| int | State |
| state | |
| int | AnimWait |
| Animation wait. | |
| int | Wait |
| delay between frames | |
| int | Delay |
| delay to showup | |
| CUnit * | SourceUnit |
| unit that fires (could be killed) | |
| CUnit * | TargetUnit |
| target unit, used for spells | |
| int | Damage |
| direct damage that missile applies | |
| int | TTL |
| time to live (ticks) used for spells | |
| int | Hidden |
| If this is 1 then the missile is invisible. | |
| int | CurrentStep |
| Current step (0 <= x < TotalStep). | |
| int | TotalStep |
| Total step. | |
| unsigned | Local:1 |
| missile is a local missile | |
| unsigned int | Slot |
| unique number for draw level. | |
Static Public Attributes | |
| static unsigned int | Count = 0 |
| slot number generator. | |
Protected Member Functions | |
| 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. To convert a map tile position to pixel position use: (mapx * TileSizeX + TileSizeX / 2) and (mapy * TileSizeY + TileSizeY / 2)
Missile::SourceX Missile::SourceYMissile original map position in pixels. To convert a map tile position to pixel position use: (mapx*TileSizeX+TileSizeX/2) and (mapy*TileSizeY+TileSizeY/2)
Missile::DX Missile::DYMissile 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.
Definition at line 417 of file missile.h.
| Missile::Missile | ( | ) | [protected] |
| Missile * Missile::Init | ( | MissileType * | mtype, | |
| int | sx, | |||
| int | sy, | |||
| int | dx, | |||
| int | dy | |||
| ) | [static] |
Initialize a new made missile.
| mtype | Type pointer of missile. | |
| sx | Missile x start point in pixel. | |
| sy | Missile y start point in pixel. | |
| dx | Missile x destination point in pixel. | |
| dy | Missile y destination point in pixel. |
Definition at line 164 of file missile.cpp.
References MissileType::Class, Delay, DX, DY, MissileType::Height, MissileClassCycleOnce, MissileClassFire, MissileClassHit, MissileClassNone, MissileClassParabolic, MissileClassPointToPoint, MissileClassPointToPointBounce, MissileClassPointToPointCycleOnce, MissileClassPointToPointWithHit, MissileClassStay, MissileType::Sleep, SourceX, SourceY, MissileType::StartDelay, Type, Wait, MissileType::Width, X, and Y.
Referenced by MakeLocalMissile(), and MakeMissile().
| virtual void Missile::Action | ( | ) | [pure virtual] |
| void Missile::DrawMissile | ( | ) | const |
Draw missile.
Definition at line 510 of file missile.cpp.
References Assert, MissileType::Class, CurrentViewport, Damage, MissileType::DrawMissileType(), GameFont, CViewport::MapX, CViewport::MapY, MissileClassHit, CViewport::OffsetX, CViewport::OffsetY, SpriteFrame, TileSizeX, TileSizeY, Type, VideoDrawNumberClip(), CViewport::X, X, CViewport::Y, Y, and y.
Referenced by CViewport::Draw().
| void Missile::SaveMissile | ( | CFile * | file | ) | const |
Save the state of a missile to file.
| file | Output file. |
Definition at line 1057 of file missile.cpp.
References AnimWait, CurrentStep, Damage, Delay, DX, DY, Hidden, MissileType::Ident, Local, CFile::printf(), SourceUnit, SourceX, SourceY, SpriteFrame, State, TargetUnit, TotalStep, TTL, Type, UnitReference(), Wait, X, and Y.
| int Missile::SourceX |
Missile Source X.
Definition at line 431 of file missile.h.
Referenced by MissilePointToPointBounce::Action(), CclMissile(), Init(), MissileInitMove(), NextMissileFrame(), NextMissileFrameCycle(), ParabolicMissile(), PointToPointMissile(), and SaveMissile().
| int Missile::SourceY |
Missile Source Y.
Definition at line 432 of file missile.h.
Referenced by MissilePointToPointBounce::Action(), CclMissile(), Init(), MissileInitMove(), NextMissileFrame(), ParabolicMissile(), PointToPointMissile(), and SaveMissile().
| int Missile::X |
missile pixel position
Definition at line 433 of file missile.h.
Referenced by MissileFire::Action(), MissilePointToPointBounce::Action(), CclMissile(), DrawMissile(), GetMissileMapArea(), Init(), MissileHit(), MissileInitMove(), NextMissileFrame(), NextMissileFrameCycle(), ParabolicMissile(), PlayMissileSound(), PointToPointMissile(), SaveMissile(), and ViewPointDistanceToMissile().
| int Missile::Y |
missile pixel position
Definition at line 434 of file missile.h.
Referenced by MissileFire::Action(), MissilePointToPointBounce::Action(), CclMissile(), DrawMissile(), GetMissileMapArea(), Init(), MissileHit(), MissileInitMove(), NextMissileFrame(), ParabolicMissile(), PointToPointMissile(), SaveMissile(), and ViewPointDistanceToMissile().
| int Missile::DX |
missile pixel destination
Definition at line 435 of file missile.h.
Referenced by MissilePointToPointBounce::Action(), CclMissile(), Init(), MissileInitMove(), NextMissileFrame(), NextMissileFrameCycle(), ParabolicMissile(), PointToPointMissile(), and SaveMissile().
| int Missile::DY |
missile pixel destination
Definition at line 436 of file missile.h.
Referenced by MissilePointToPointBounce::Action(), CclMissile(), Init(), MissileInitMove(), NextMissileFrame(), ParabolicMissile(), PointToPointMissile(), and SaveMissile().
missile-type pointer
Definition at line 437 of file missile.h.
Referenced by MissileParabolic::Action(), MissileHit::Action(), MissileFire::Action(), MissileCycleOnce::Action(), MissilePointToPointBounce::Action(), MissileStay::Action(), MissilePointToPointCycleOnce::Action(), MissilePointToPointWithHit::Action(), MissilePointToPoint::Action(), MissileNone::Action(), CViewport::Draw(), DrawMissile(), GetMissileMapArea(), Init(), MissileDrawLevelCompare(), MissileHit(), MissileHitsGoal(), MissileInitMove(), MissileNewHeadingFromXY(), NextMissileFrame(), NextMissileFrameCycle(), ParabolicMissile(), PlayMissileSound(), PointToPointMissile(), SaveMissile(), and ViewPointDistanceToMissile().
sprite frame counter
Definition at line 438 of file missile.h.
Referenced by MissileFire::Action(), CclMissile(), DrawMissile(), MissileNewHeadingFromXY(), NextMissileFrame(), NextMissileFrameCycle(), and SaveMissile().
| int Missile::State |
state
Definition at line 439 of file missile.h.
Referenced by MissileCycleOnce::Action(), MissilePointToPointBounce::Action(), CclMissile(), MissileInitMove(), and SaveMissile().
Animation wait.
Definition at line 440 of file missile.h.
Referenced by CclMissile(), and SaveMissile().
| int Missile::Wait |
delay between frames
Definition at line 441 of file missile.h.
Referenced by MissileParabolic::Action(), MissileHit::Action(), MissileFire::Action(), MissileCycleOnce::Action(), MissilePointToPointBounce::Action(), MissileStay::Action(), MissilePointToPointCycleOnce::Action(), MissilePointToPointWithHit::Action(), MissilePointToPoint::Action(), MissileNone::Action(), CclMissile(), Init(), MissilesActionLoop(), and SaveMissile().
| int Missile::Delay |
delay to showup
Definition at line 442 of file missile.h.
Referenced by CclMissile(), Init(), MissilesActionLoop(), and SaveMissile().
unit that fires (could be killed)
Definition at line 444 of file missile.h.
Referenced by MissileFire::Action(), CclMissile(), FireMissile(), FreeMissile(), HitUnit(), MissileHit(), MissileHitsGoal(), and SaveMissile().
target unit, used for spells
Definition at line 445 of file missile.h.
Referenced by CclMissile(), FireMissile(), FreeMissile(), MissileHit(), and SaveMissile().
| int Missile::Damage |
direct damage that missile applies
Definition at line 447 of file missile.h.
Referenced by CclMissile(), DrawMissile(), HitUnit(), MissileHitsGoal(), and SaveMissile().
| int Missile::TTL |
time to live (ticks) used for spells
Definition at line 449 of file missile.h.
Referenced by MissileParabolic::Action(), MissileHit::Action(), MissileFire::Action(), MissileCycleOnce::Action(), MissilePointToPointBounce::Action(), MissileStay::Action(), MissilePointToPointCycleOnce::Action(), MissilePointToPointWithHit::Action(), MissilePointToPoint::Action(), CclMissile(), MissilesActionLoop(), and SaveMissile().
| int Missile::Hidden |
If this is 1 then the missile is invisible.
Definition at line 450 of file missile.h.
Referenced by CclMissile(), and SaveMissile().
Current step (0 <= x < TotalStep).
Definition at line 453 of file missile.h.
Referenced by CclMissile(), MissileInitMove(), ParabolicMissile(), PointToPointMissile(), and SaveMissile().
Total step.
Definition at line 454 of file missile.h.
Referenced by MissilePointToPointBounce::Action(), CclMissile(), MissileInitMove(), ParabolicMissile(), PointToPointMissile(), and SaveMissile().
| unsigned Missile::Local |
missile is a local missile
Definition at line 456 of file missile.h.
Referenced by CclMissile(), MakeLocalMissile(), and SaveMissile().
| unsigned int Missile::Slot |
unique number for draw level.
Definition at line 457 of file missile.h.
Referenced by Missile(), and MissileDrawLevelCompare().
unsigned int Missile::Count = 0 [static] |
1.5.6