____ _ __
/ __ )____ _____ | | / /___ ___________
/ __ / __ \/ ___/ | | /| / / __ `/ ___/ ___/
/ /_/ / /_/ (__ ) | |/ |/ / /_/ / / (__ )
/_____/\____/____/ |__/|__/\__,_/_/ /____/
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 | |
| MissileType (const std::string &ident) | |
| ~MissileType () | |
| load the graphics for a missile type | |
| void | LoadMissileSprite () |
| void | Init (void) |
| void | DrawMissileType (int frame, int x, int y) const |
Public Attributes | |
| std::string | Ident |
| missile name | |
| int | Transparency |
| missile transparency | |
| int | Width |
| missile width in pixels | |
| int | Height |
| missile height in pixels | |
| int | DrawLevel |
| Level to draw missile at. | |
| int | SpriteFrames |
| number of sprite frames in graphic | |
| int | NumDirections |
| number of directions missile can face | |
| SoundConfig | FiredSound |
| fired sound | |
| SoundConfig | ImpactSound |
| impact sound for this missile-type | |
| bool | Flip |
| flip image when facing left | |
| bool | CanHitOwner |
| missile can hit the owner | |
| bool | FriendlyFire |
| missile can't hit own units | |
| MissileClass | Class |
| missile class | |
| int | NumBounces |
| number of bounces | |
| int | StartDelay |
| missile start delay | |
| int | Sleep |
| missile sleep | |
| int | Speed |
| missile speed | |
| int | Range |
| missile damage range | |
| int | SplashFactor |
| missile splash divisor | |
| std::string | ImpactName |
| impact missile-type name | |
| MissileType * | ImpactMissile |
| missile produces an impact | |
| std::string | SmokeName |
| impact missile-type name | |
| MissileType * | SmokeMissile |
| Trailling missile. | |
| LuaCallback * | ImpactParticle |
| impact particle | |
| CGraphic * | G |
| missile graphic | |
This structure defines the base type information of all missiles. It contains all information that all missiles of the same type shares. The fields are filled from the configuration files.
The missile-type structure members:
Unique identifier of the missile-type, used to reference it in config files and during startup.
The Level/Order to draw the missile in, usually 0-255
MissileType::Width MissileType::Height
Size (width and height) of a frame in the image. All sprite frames of the missile-type must have the same size.
Total number of sprite frames in the graphic image.
There is currently a limit of 127 sprite frames, which can be lifted if needed.
Number of directions missile can face.
Set a missile transparency. Current supported value is 50 only.
Sound of the missile, if fired.
Impact sound for this missile.
Can hit the unit that have fired the missile.
Can't hit the units of the same player, that has the missile fired.
Class of the missile-type, defines the basic effects of the missile. Look at the different class identifiers for more informations (_missile_class_, MissileClassNone, ...).
This is the number of bounces, and it is only valid with MissileClassBounce. The missile will hit this many times in a row.
Delay in game cycles after the missile generation, until the missile animation and effects starts. Delay denotes the number of display cycles to skip before drawing the first sprite frame and only happens once at start.
This are the number of game cycles to wait for the next animation or the sleeping between the animation steps. All animations steps use the same delay. 0 is the fastest and 255 the slowest animation.
The speed how fast the missile moves. 0 the missile didn't move, 1 is the slowest speed and 32 s the fastest supported speed. This is how many pixels the missiles moves with each animation step. The real use of this member depends on the MissileType::Class
Determines the range in which a projectile will deal its damage. A range of 0 will mean that the damage will be limited to the targetted unit only. So if you shot a missile at a unit, it would only damage that unit. A value of 1 only affects the field where the missile hits. A value of 2 would mean that the damage for that particular missile would be dealt for a range of 1 around the impact spot. All fields that aren't the center get only 1/SpashFactor of the damage. Fields 2 away get 1/(SplashFactor*2), and following...
Determines The Splash damage divisor, see Range
The name of the next (other) missile to generate, when this missile reached its end point or its life time is over. So it can be used to generate a chain of missiles.
Pointer to the impact missile-type. Used during run time.
The name of the next (other) missile to generate a trailing smoke. So it can be used to generate a chain of missiles.
Pointer to the smoke missile-type. Used during run time.
MissileType::Sprite
Missile sprite image loaded from MissileType::File
File containing the image (sprite) graphics of the missile. The file can contain multiple sprite frames. The sprite frames for the different directions are placed in the row. The different animations steps are placed in the column. But the correct order depends on MissileType::Class. Missiles like fire have no directions, missiles like arrows have a direction.
Definition at line 367 of file missile.h.
| MissileType::MissileType | ( | const std::string & | ident | ) |
| MissileType::~MissileType | ( | ) |
load the graphics for a missile type
Destructor.
Definition at line 1151 of file missile.cpp.
References CGraphic::Free(), G, and ImpactParticle.
| void MissileType::LoadMissileSprite | ( | ) |
Load the graphics for a missile type
Definition at line 86 of file missile.cpp.
References Assert, CGraphic::Flip(), Flip, G, CGraphic::IsLoaded(), CGraphic::Load(), CGraphic::NumFrames, and SpriteFrames.
| void MissileType::Init | ( | void | ) |
Initialize missile type.
Definition at line 1110 of file missile.cpp.
References FiredSound, ImpactMissile, ImpactName, ImpactSound, MissileTypeByIdent(), SoundConfig::Name, SmokeMissile, SmokeName, SoundConfig::Sound, and SoundForName().
| void MissileType::DrawMissileType | ( | int | frame, | |
| int | x, | |||
| int | y | |||
| ) | const |
Draw missile.
| frame | Animation frame | |
| x | Screen pixel X position | |
| y | Screen pixel Y position |
Definition at line 474 of file missile.cpp.
References CGraphic::DrawFrameClip(), CGraphic::DrawFrameClipTrans(), CGraphic::DrawFrameClipTransX(), CGraphic::DrawFrameClipX(), Flip, G, NumDirections, and Transparency.
Referenced by Missile::DrawMissile().
| std::string MissileType::Ident |
missile transparency
Definition at line 379 of file missile.h.
Referenced by CclDefineMissileType(), and DrawMissileType().
missile width in pixels
Definition at line 380 of file missile.h.
Referenced by MissileFire::Action(), CclDefineMissileType(), GetMissileMapArea(), Missile::Init(), MissileHit(), ParabolicMissile(), PointToPointMissile(), and ViewPointDistanceToMissile().
missile height in pixels
Definition at line 381 of file missile.h.
Referenced by MissileFire::Action(), CclDefineMissileType(), GetMissileMapArea(), Missile::Init(), MissileHit(), ParabolicMissile(), PointToPointMissile(), and ViewPointDistanceToMissile().
Level to draw missile at.
Definition at line 382 of file missile.h.
Referenced by CclDefineMissileType(), CViewport::Draw(), and MissileDrawLevelCompare().
number of sprite frames in graphic
Definition at line 383 of file missile.h.
Referenced by CclDefineMissileType(), LoadMissileSprite(), NextMissileFrame(), and NextMissileFrameCycle().
number of directions missile can face
Definition at line 384 of file missile.h.
Referenced by CclDefineMissileType(), DrawMissileType(), MissileNewHeadingFromXY(), NextMissileFrame(), and NextMissileFrameCycle().
fired sound
Definition at line 387 of file missile.h.
Referenced by CclDefineMissileType(), and Init().
impact sound for this missile-type
Definition at line 388 of file missile.h.
Referenced by CclDefineMissileType(), Init(), and MissileHit().
| bool MissileType::Flip |
flip image when facing left
Definition at line 390 of file missile.h.
Referenced by CclDefineMissileType(), DrawMissileType(), and LoadMissileSprite().
missile can hit the owner
Definition at line 391 of file missile.h.
Referenced by CclDefineMissileType(), and MissileHitsGoal().
missile can't hit own units
Definition at line 392 of file missile.h.
Referenced by CclDefineMissileType().
missile class
Definition at line 394 of file missile.h.
Referenced by ActionStillGeneric(), CclDefineMissileType(), Missile::DrawMissile(), FireMissile(), and Missile::Init().
number of bounces
Definition at line 395 of file missile.h.
Referenced by MissilePointToPointBounce::Action(), and CclDefineMissileType().
missile start delay
Definition at line 396 of file missile.h.
Referenced by CclDefineMissileType(), and Missile::Init().
missile sleep
Definition at line 397 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(), CclDefineMissileType(), and Missile::Init().
missile speed
Definition at line 398 of file missile.h.
Referenced by CclDefineMissileType(), and MissileInitMove().
missile damage range
Definition at line 400 of file missile.h.
Referenced by AttackUnitsInDistance(), CclDefineMissileType(), FindRangeAttack(), and MissileHit().
missile splash divisor
Definition at line 401 of file missile.h.
Referenced by CclDefineMissileType(), and MissileHit().
| std::string MissileType::ImpactName |
impact missile-type name
Definition at line 402 of file missile.h.
Referenced by CclDefineMissileType(), and Init().
missile produces an impact
Definition at line 403 of file missile.h.
Referenced by Init(), and MissileHit().
| std::string MissileType::SmokeName |
impact missile-type name
Definition at line 404 of file missile.h.
Referenced by CclDefineMissileType(), and Init().
Trailling missile.
Definition at line 405 of file missile.h.
Referenced by Init(), ParabolicMissile(), and PointToPointMissile().
impact particle
Definition at line 406 of file missile.h.
Referenced by CclDefineMissileType(), MissileHit(), and ~MissileType().
missile graphic
Definition at line 409 of file missile.h.
Referenced by CclDefineMissileType(), DrawMissileType(), LoadMissileSprite(), PlayMissileSound(), and ~MissileType().
1.5.6