_________ __ __ / _____// |_____________ _/ |______ ____ __ __ ______ \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \ /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > \/ \/ \//_____/ \/ ______________________ ______________________ T H E W A R B E G I N S Stratagus - A free fantasy real time strategy game engine
#include <math.h>
#include "stratagus.h"
#include "missile.h"
#include "action/action_spellcast.h"
#include "actions.h"
#include "animation.h"
#include "font.h"
#include "iolib.h"
#include "luacallback.h"
#include "map.h"
#include "player.h"
#include "sound.h"
#include "spells.h"
#include "trigger.h"
#include "ui.h"
#include "unit.h"
#include "unit_find.h"
#include "unitsound.h"
#include "unittype.h"
#include "video.h"
missile.cpp - The missiles. | |
typedef std::map< std::string, MissileType * > | MissileTypeMap |
all local missiles on map More... | |
static std::vector< Missile * > | GlobalMissiles |
static std::vector< Missile * > | LocalMissiles |
all global missiles on map More... | |
static MissileTypeMap | MissileTypes |
std::vector< BurningBuildingFrame * > | BurningBuildingFrames |
NumberDesc * | Damage |
Burning building frames. More... | |
void | LoadMissileSprites () |
load all missile sprites More... | |
MissileType * | MissileTypeByIdent (const std::string &ident) |
Get missile-type by ident. More... | |
MissileType * | NewMissileTypeSlot (const std::string &ident) |
allocate an empty missile-type slot More... | |
Missile * | MakeMissile (const MissileType &mtype, const PixelPos &startPos, const PixelPos &destPos) |
create a missile More... | |
Missile * | MakeLocalMissile (const MissileType &mtype, const PixelPos &startPos, const PixelPos &destPos) |
create a local missile More... | |
static int | CalculateDamageStats (const CUnitStats &attacker_stats, const CUnitStats &goal_stats, int bloodlust) |
int | CalculateDamage (const CUnit &attacker, const CUnit &goal, const NumberDesc *formula) |
Calculates damage done to goal by attacker using formula. More... | |
void | FireMissile (CUnit &unit, CUnit *goal, const Vec2i &goalPos) |
fire a missile More... | |
static void | GetMissileMapArea (const Missile &missile, Vec2i &boxMin, Vec2i &boxMax) |
static int | MissileVisibleInViewport (const CViewport &vp, const Missile &missile) |
static bool | MissileDrawLevelCompare (const Missile *const l, const Missile *const r) |
void | FindAndSortMissiles (const CViewport &vp, std::vector< Missile * > &table) |
bool | MissileInitMove (Missile &missile, bool pointToPoint) |
void | MissileHandlePierce (Missile &missile, const Vec2i &pos) |
bool | MissileHandleBlocking (Missile &missile, const PixelPos &position) |
bool | PointToPointMissile (Missile &missile) |
static void | MissileHitsGoal (const Missile &missile, CUnit &goal, int splash) |
static void | MissileHitsWall (const Missile &missile, const Vec2i &tilePos, int splash) |
static bool | IsPiercedUnit (const Missile &missile, const CUnit &unit) |
static void | MissilesActionLoop (std::vector< Missile * > &missiles) |
void | MissileActions () |
handle all missiles More... | |
int | ViewPointDistanceToMissile (const Missile &missile) |
distance from view point to missile More... | |
MissileType * | MissileBurningBuilding (int percent) |
Get the burning building missile based on hp percent. More... | |
static void | SavePixelPos (CFile &file, const PixelPos &pos) |
void | SaveMissiles (CFile &file) |
Save missiles. More... | |
void | InitMissileTypes () |
Initialize missile-types. More... | |
void | CleanMissileTypes () |
Clean missile-types. More... | |
void | InitMissiles () |
Initialize missiles. More... | |
void | CleanMissiles () |
Clean missiles. More... | |
void | FreeBurningBuildingFrames () |
typedef std::map<std::string, MissileType *> MissileTypeMap |
all local missiles on map
lookup table for missile names
int CalculateDamage | ( | const CUnit & | attacker, |
const CUnit & | goal, | ||
const NumberDesc * | formula | ||
) |
Calculates damage done to goal by attacker using formula.
Calculate damage.
attacker | Attacker. |
goal | Goal unit. |
formula | Formula used to calculate damage. |
|
static |
Calculate damage.
NOTE: different targets (big are hit by some missiles better)
NOTE: lower damage for hidden targets.
NOTE: lower damage for targets on higher ground.
attacker_stats | Attacker attributes. |
goal_stats | Goal attributes. |
bloodlust | If attacker has bloodlust |
xp | Experience of attacker. |
void CleanMissiles | ( | ) |
Clean missiles.
Clean up missiles.
void CleanMissileTypes | ( | ) |
Clean missile-types.
Clean up missile-types.
Sort visible missiles on map for display.
vp | Viewport pointer. |
table | OUT : array of missile to display sorted by DrawLevel. |
fire a missile
Fire missile.
unit | Unit that fires the missile. |
void FreeBurningBuildingFrames | ( | ) |
Get area of tiles covered by missile
missile | Missile to be checked and set. |
boxMin | OUT: Pointer to top left corner in map tiles. |
boxMax | OUT: Pointer to bottom right corner in map tiles. |
void InitMissiles | ( | ) |
Initialize missiles.
Initialize missiles.
void InitMissileTypes | ( | ) |
Initialize missile-types.
Initialize missile-types.
Check if missile has already pierced that unit
missile | Current missile. |
unit | Target unit. |
void LoadMissileSprites | ( | ) |
load all missile sprites
Load the graphics for all missiles types
Missile* MakeLocalMissile | ( | const MissileType & | mtype, |
const PixelPos & | startPos, | ||
const PixelPos & | destPos | ||
) |
Missile* MakeMissile | ( | const MissileType & | mtype, |
const PixelPos & | startPos, | ||
const PixelPos & | destPos | ||
) |
void MissileActions | ( | ) |
handle all missiles
Handle all missile actions.
MissileType* MissileBurningBuilding | ( | int | percent | ) |
Get the burning building missile based on hp percent.
Get the burning building missile based on hp percent.
percent | HP percent |
bool MissileInitMove | ( | Missile & | missile, |
bool | pointToPoint | ||
) |
Init the move.
missile | missile to initialise for movement. |
Handle all missile actions of global/local missiles.
missiles | Table of missiles. |
MissileType* MissileTypeByIdent | ( | const std::string & | ident | ) |
Check missile visibility in a given viewport.
vp | Viewport to be checked. |
missile | Missile pointer to check if visible. |
MissileType* NewMissileTypeSlot | ( | const std::string & | ident | ) |
allocate an empty missile-type slot
Allocate an empty missile-type slot.
ident | Identifier to identify the slot. |
bool PointToPointMissile | ( | Missile & | missile | ) |
Handle point to point missile.
missile | Missile pointer. |
Save missiles.
Save the state missiles to file.
file | Output file. |
int ViewPointDistanceToMissile | ( | const Missile & | missile | ) |
distance from view point to missile
Calculate distance from view-point to missile.
missile | Missile pointer for distance. |
std::vector<BurningBuildingFrame *> BurningBuildingFrames |
NumberDesc* Damage |
Burning building frames.
Burning building frames.
|
static |
|
static |
all global missiles on map
|
static |