Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Nebula Class Reference

#include <nebula_generic.h>

Inheritance diagram for Nebula:
Unit GameUnit< Nebula > GameNebula

Public Member Functions

void InitNebula (const char *unitfile, bool SubU, int faction, Flightgroup *fg, int fg_snumber)
 
float getFade ()
 
virtual void PutInsideCam (int)
 
virtual enum clsptr isUnit () const
 
virtual void reactToCollision (Unit *smaller, const QVector &biglocation, const Vector &bignormal, const QVector &smalllocation, const Vector &smallnormal, float dist)
 
virtual void UpdatePhysics2 (const Transformation &trans, const Transformation &old_physical_state, const Vector &accel, float difficulty, const Matrix &transmat, const Vector &CumulativeVelocity, bool ResolveLast, UnitCollection *uc=NULL)
 
virtual void SetFogState ()
 
- Public Member Functions inherited from Unit
 Unit (bool kill)
 
void Kill ()
 
bool Killed ()
 
void Ref ()
 
void UnRef ()
 
 Unit ()
 
 Unit (int dummy)
 
 Unit (std::vector< Mesh * > &meshes, bool Subunit, int faction)
 
 Unit (const char *filename, bool SubUnit, int faction, std::string customizedUnit=std::string(""), Flightgroup *flightgroup=NULL, int fg_subnumber=0, std::string *netxml=NULL)
 
void Init ()
 
void Init (const char *filename, bool SubUnit, int faction, std::string customizedUnit=std::string(""), Flightgroup *flightgroup=NULL, int fg_subnumber=0, std::string *netxml=NULL)
 
void LoadRow (class CSVRow &row, std::string unitMod, std::string *netxml=NULL)
 
virtual ~Unit ()
 
void SetNetworkMode (bool mode=true)
 
ObjSerial GetSerial () const
 
void SetSerial (ObjSerial)
 
void BackupState ()
 
bool UpgradeSubUnitsWithFactory (const Unit *up, int subunitoffset, bool touchme, bool downgrade, int &numave, double &percentage, Unit *(*createupgradesubunit)(std::string s, int faction))
 
virtual bool UpgradeSubUnits (const Unit *up, int subunitoffset, bool touchme, bool downgrade, int &numave, double &percentage)
 
bool UpgradeMounts (const Unit *up, int subunitoffset, bool touchme, bool downgrade, int &numave, const Unit *templ, double &percentage)
 
un_iter getSubUnits ()
 
un_kiter viewSubUnits () const
 
bool isSubUnit () const
 
void setFaceCamera ()
 
bool UpAndDownGrade (const Unit *up, const Unit *templ, int mountoffset, int subunitoffset, bool touchme, bool downgrade, int additive, bool forcetransaction, double &percentage, const Unit *downgrade_min, bool force_change_on_nothing, bool gen_downgrade_list)
 
void ImportPartList (const std::string &category, float price, float pricedev, float quantity, float quantdev)
 
int GetNumMounts () const
 
void ClearMounts ()
 
virtual void UpgradeInterface (Unit *base)
 
bool canUpgrade (const Unit *upgrador, int mountoffset, int subunitoffset, int additive, bool force, double &percentage, const Unit *templ=NULL, bool force_change_on_nothing=false, bool gen_downgrade_list=true)
 
bool Upgrade (const Unit *upgrador, int mountoffset, int subunitoffset, int additive, bool force, double &percentage, const Unit *templ=NULL, bool force_change_on_nothing=false, bool gen_downgrade_list=true)
 
int RepairCost ()
 
int RepairUpgrade ()
 
bool RepairUpgradeCargo (Cargo *item, Unit *baseUnit, float *credits)
 
Vector MountPercentOperational (int whichmount)
 
bool ReduceToTemplate ()
 
virtual double Upgrade (const std::string &file, int mountoffset, int subunitoffset, bool force, bool loop_through_mounts)
 
bool canDowngrade (const Unit *downgradeor, int mountoffset, int subunitoffset, double &percentage, const Unit *downgradelimit, bool gen_downgrade_list=true)
 
bool Downgrade (const Unit *downgradeor, int mountoffset, int subunitoffset, double &percentage, const Unit *downgradelimit, bool gen_downgrade_list=true)
 
unsigned attackPreference () const
 
void attackPreference (unsigned char)
 
unsigned unitRole () const
 
void unitRole (unsigned char)
 
void setCombatRole (const std::string &s)
 
const std::string & getCombatRole () const
 
const std::string & getUnitRole () const
 
void setUnitRole (const std::string &s)
 
const std::string & getAttackPreference () const
 
void setAttackPreference (const std::string &s)
 
void DamageRandSys (float dam, const Vector &vec, float randum=1, float degrees=1)
 
void SetNebula (Nebula *)
 
NebulaGetNebula () const
 
const std::string & getCockpit () const
 
class CockpitGetVelocityDifficultyMult (float &) const
 
void RemoveFromSystem ()
 
void RequestPhysics ()
 
bool InCorrectStarSystem (StarSystem *)
 
virtual int nummesh () const
 
virtual void Split (int level)
 
virtual void addHalo (const char *filename, const QVector &loc, const Vector &size, const GFXColor &col, std::string halo_type, float activation)
 
std::vector< Mesh * > StealMeshes ()
 
virtual bool Explode (bool draw, float timeit)
 
void Destroy ()
 
virtual void Draw (const Transformation &quat=identity_transformation, const Matrix &m=identity_matrix)
 
virtual void DrawNow (const Matrix &m=identity_matrix, float lod=1000000000)
 
virtual void UpdateHudMatrix (int whichcam)
 
virtual VSSpritegetHudImage () const
 
virtual void applyTechniqueOverrides (const std::map< std::string, std::string > &overrides)
 
const std::vector< std::string > & GetDestinations () const
 
void AddDestination (const std::string &)
 
void SwitchCombatFlightMode ()
 
bool CombatMode ()
 
virtual bool TransferUnitToSystem (StarSystem *NewSystem)
 
virtual bool TransferUnitToSystem (unsigned int whichJumpQueue, class StarSystem *&previouslyActiveStarSystem, bool DoSightAndSound)
 
StarSystemgetStarSystem ()
 
const StarSystemgetStarSystem () const
 
const UnitJumpGetJumpStatus () const
 
float CourseDeviation (const Vector &OriginalCourse, const Vector &FinalCourse) const
 
ComputerGetComputerData ()
 
const ComputerViewComputerData () const
 
void ActivateJumpDrive (int destination=0)
 
void DeactivateJumpDrive ()
 
void beginElement (const std::string &name, const XMLSupport::AttributeList &attributes)
 
void endElement (const std::string &name)
 
void WriteUnit (const char *modificationname="")
 
std::string WriteUnitString ()
 
void LoadXML (const char *filename, const char *unitModifications="", std::string *xmlbuffer=NULL)
 
void LoadXML (VSFileSystem::VSFile &f, const char *unitModifications="", std::string *xmlbuffer=NULL)
 
bool AutoPilotToErrorMessage (Unit *un, bool automaticenergyrealloc, std::string &failuremessage, int recursive_level=2)
 
bool AutoPilotTo (Unit *un, bool automaticenergyrealloc)
 
Vector LocalCoordinates (Unit *un) const
 
float CloakVisible () const
 
virtual void Cloak (bool cloak)
 
void Kill (bool eraseFromSave=true, bool quitting=false)
 
bool Killed () const
 
bool IsExploding () const
 
float ExplodingProgress () const
 
float AfterburnData () const
 
void SetAfterBurn (float aft)
 
float FuelData () const
 
float WarpCapData () const
 
void SetFuel (float f)
 
float EnergyRechargeData () const
 
void SetEnergyRecharge (float enrech)
 
void SetMaxEnergy (float maxen)
 
float MaxEnergyData () const
 
float ShieldRechargeData () const
 
float EnergyData () const
 
float WarpEnergyData () const
 
float GetWarpEnergy () const
 
void DecreaseWarpEnergy (bool insystem, float time=1.0f)
 
void IncreaseWarpEnergy (bool insystem, float time=1.0f)
 
bool RefillWarpEnergy ()
 
float rSize () const
 
QVector Position () const
 
const MatrixGetTransformation () const
 
QVector LocalPosition () const
 
void SetPosition (const QVector &pos)
 
void SetCurPosition (const QVector &pos)
 Sets the cumulative transformation matrix's position...for setting up to be out in the middle of nowhere. More...
 
void SetPosAndCumPos (const QVector &pos)
 
void SetVisible (bool isvis)
 
void SetAllVisible (bool isvis)
 
void SetGlowVisible (bool isvis)
 
void Rotate (const Vector &axis)
 
void FireEngines (const Vector &Direction, float FuelSpeed, float FMass)
 
void ApplyForce (const Vector &Vforce)
 
void ApplyLocalForce (const Vector &Vforce)
 
void Accelerate (const Vector &Vforce)
 
void ApplyTorque (const Vector &Vforce, const QVector &Location)
 
void ApplyLocalTorque (const Vector &Vforce, const Vector &Location)
 
void ApplyBalancedLocalTorque (const Vector &Vforce, const Vector &Location)
 
void ApplyLocalTorque (const Vector &torque)
 
float ApplyLocalDamage (const Vector &pnt, const Vector &normal, float amt, Unit *affectedSubUnit, const GFXColor &, float phasedamage=0)
 
void ApplyNetDamage (Vector &pnt, Vector &normal, float amt, float ppercentage, float spercentage, GFXColor &color)
 
void ApplyDamage (const Vector &pnt, const Vector &normal, float amt, Unit *affectedSubUnit, const GFXColor &, void *ownerDoNotDereference, float phasedamage=0)
 
void LightShields (const Vector &pnt, const Vector &normal, float amt, const GFXColor &color)
 
float DealDamageToHullReturnArmor (const Vector &pnt, float Damage, float *&targ)
 
virtual void ArmorDamageSound (const Vector &pnt)
 
virtual void HullDamageSound (const Vector &pnt)
 
float DealDamageToHull (const Vector &pnt, float Damage)
 
Vector ClampThrust (const Vector &thrust, bool afterburn)
 
Vector MaxThrust (const Vector &thrust)
 
virtual void Thrust (const Vector &amt, bool afterburn=false)
 
void LateralThrust (float amt)
 
void VerticalThrust (float amt)
 
void LongitudinalThrust (float amt)
 
Vector ClampVelocity (const Vector &velocity, const bool afterburn)
 
Vector ClampAngVel (const Vector &vel)
 
Vector ClampTorque (const Vector &torque)
 
Vector MaxTorque (const Vector &torque)
 
void YawTorque (float amt)
 
void PitchTorque (float amt)
 
void RollTorque (float amt)
 
void Repair ()
 
void UpdatePhysics (const Transformation &trans, const Matrix &transmat, const Vector &CumulativeVelocity, bool ResolveLast, UnitCollection *uc, Unit *superunit)
 
virtual void UpdateSubunitPhysics (const Transformation &trans, const Matrix &transmat, const Vector &CumulativeVelocity, bool ResolveLast, UnitCollection *uc, Unit *superunit)
 
virtual void UpdateSubunitPhysics (Unit *subunit, const Transformation &trans, const Matrix &transmat, const Vector &CumulativeVelocity, bool ResolveLast, UnitCollection *uc, Unit *superunit)
 
void AddVelocity (float difficulty)
 
virtual Vector ResolveForces (const Transformation &, const Matrix &)
 
void SetOrientation (QVector q, QVector r)
 
void SetOrientation (Quaternion Q)
 
void SetOrientation (QVector p, QVector q, QVector r)
 
void GetOrientation (Vector &p, Vector &q, Vector &r) const
 
Vector GetNetAcceleration ()
 
Vector GetAcceleration () const
 
float GetMaxAccelerationInDirectionOf (const Vector &ref, bool afterburn) const
 
Vector UpCoordinateLevel (const Vector &v) const
 
Vector DownCoordinateLevel (const Vector &v) const
 
Vector ToLocalCoordinates (const Vector &v) const
 
Vector ToWorldCoordinates (const Vector &v) const
 
const VectorGetAngularVelocity () const
 
const VectorGetVelocity () const
 
Vector GetWarpVelocity () const
 
void SetVelocity (const Vector &)
 
void SetAngularVelocity (const Vector &)
 
float GetMoment () const
 
float GetMass () const
 
float GetElasticity ()
 
const LimitsLimits () const
 
void SetResolveForces (bool)
 
void setAverageGunSpeed ()
 
int LockMissile () const
 
void LockTarget (bool myboo)
 
bool TargetLocked () const
 
float TrackingGuns (bool &missileLock)
 
void ToggleWeapon (bool Missile, bool forward=true)
 
void SelectAllWeapon (bool Missile)
 
void getAverageGunSpeed (float &speed, float &grange, float &mrange) const
 
QVector PositionITTS (const QVector &firingposit, Vector firingvelocity, float gunspeed, bool smooth_itts) const
 
float FShieldData () const
 
float RShieldData () const
 
float LShieldData () const
 
float BShieldData () const
 
void ArmorData (float armor[8]) const
 
float GetHull () const
 
float GetHullPercent () const
 
void Fire (unsigned int bitmask, bool beams_target_owner=false)
 
void UnFire ()
 
void leach (float XshieldPercent, float YrechargePercent, float ZenergyPercent)
 
bool InRange (Unit *target, bool cone=true, bool cap=true) const
 
bool InRange (Unit *target, double &mm, bool cone, bool cap, bool lock) const
 
UnitTarget ()
 
UnitVelocityReference ()
 
UnitThreat ()
 
void VelocityReference (Unit *targ)
 
void TargetTurret (Unit *targ)
 
void Threaten (Unit *targ, float danger)
 
void ResetThreatLevel ()
 
float cosAngleTo (Unit *target, float &distance, float speed=0.001, float range=0.001, bool turnmargin=true) const
 
float cosAngleFromMountTo (Unit *target, float &distance) const
 
float computeLockingPercent ()
 
void Select ()
 
void Deselect ()
 
void Target (Unit *targ)
 
void setTargetFg (std::string primary, std::string secondary=std::string(), std::string tertiary=std::string())
 
void ReTargetFg (int which_target=0)
 
bool CanAddCargo (const Cargo &carg) const
 
void AddCargo (const Cargo &carg, bool sort=true)
 
int RemoveCargo (unsigned int i, int quantity, bool eraseZero=true)
 
float PriceCargo (const std::string &s)
 
CargoGetCargo (unsigned int i)
 
const CargoGetCargo (unsigned int i) const
 
void GetSortedCargoCat (const std::string &category, size_t &catbegin, size_t &catend)
 
CargoGetCargo (const std::string &s, unsigned int &i)
 
const CargoGetCargo (const std::string &s, unsigned int &i) const
 
unsigned int numCargo () const
 
std::string GetManifest (unsigned int i, Unit *scanningUnit, const Vector &original_velocity) const
 
bool SellCargo (unsigned int i, int quantity, float &creds, Cargo &carg, Unit *buyer)
 
bool SellCargo (const std::string &s, int quantity, float &creds, Cargo &carg, Unit *buyer)
 
bool BuyCargo (const Cargo &carg, float &creds)
 
bool BuyCargo (unsigned int i, unsigned int quantity, Unit *buyer, float &creds)
 
bool BuyCargo (const std::string &cargo, unsigned int quantity, Unit *buyer, float &creds)
 
void EjectCargo (unsigned int index)
 
float getEmptyCargoVolume (void) const
 
float getCargoVolume (void) const
 
float getEmptyUpgradeVolume (void) const
 
float getUpgradeVolume (void) const
 
float getHiddenCargoVolume (void) const
 
class csOPCODECollidergetCollideTree (const Vector &scale=Vector(1, 1, 1), const std::vector< struct mesh_polygon > *=NULL)
 
OrdergetAIState () const
 
void PrimeOrders ()
 
void PrimeOrdersLaunched ()
 
void PrimeOrders (Order *newAI)
 
void SetAI (Order *newAI)
 
void EnqueueAI (Order *newAI)
 
void EnqueueAIFirst (Order *newAI)
 
void LoadAIScript (const std::string &aiscript)
 
bool LoadLastPythonAIScript ()
 
bool EnqueueLastPythonAIScript ()
 
double getMinDis (const QVector &pnt)
 
void SetTurretAI ()
 
void DisableTurretAI ()
 
std::string getFullAIDescription ()
 
void eraseOrderType (unsigned int type)
 
void ExecuteAI ()
 
void SetCollisionParent (Unit *name)
 
void SetOwner (Unit *target)
 
void SetRecursiveOwner (Unit *target)
 
UnitrayCollide (const QVector &st, const QVector &end, Vector &normal, float &distance)
 
void calculate_extent (bool update_collide_queue)
 
bool Inside (const QVector &position, const float radius, Vector &normal, float &dist)
 
void UpdateCollideQueue (StarSystem *ss, CollideMap::iterator hint[NUM_COLLIDE_MAPS])
 
bool querySphere (const QVector &pnt, float err) const
 
float querySphere (const QVector &start, const QVector &end, float my_unit_radius=0) const
 
float querySphereNoRecurse (const QVector &start, const QVector &end, float my_unit_radius=0) const
 
float querySphereClickList (const QVector &st, const QVector &dir, float err) const
 
bool queryFrustum (double frustum[6][4]) const
 
virtual bool querySphereClickList (int, int, float err, Camera *activeCam)
 
bool InsideCollideTree (Unit *smaller, QVector &bigpos, Vector &bigNormal, QVector &smallpos, Vector &smallNormal, bool bigasteroid=false, bool smallasteroid=false)
 
bool jumpReactToCollision (Unit *smaller)
 
bool Collide (Unit *target)
 
void CollideAll ()
 
int CanDockWithMe (Unit *dockingunit, bool forcedock=false)
 
int ForceDock (Unit *utdw, unsigned int whichdockport)
 
void PerformDockingOperations ()
 
void FreeDockingPort (unsigned int whichport)
 
const std::vector< struct
DockingPorts > & 
DockingPortLocations () const
 
char DockedOrDocking () const
 
bool IsCleared (const Unit *dockignunit) const
 
bool isDocked (const Unit *dockingUnit) const
 
bool UnDock (Unit *unitToDockWith)
 
bool RequestClearance (Unit *dockingunit)
 
bool EndRequestClearance (Unit *dockingunit)
 
bool hasPendingClearanceRequests () const
 
int Dock (Unit *unitToDockWith)
 
void RestoreGodliness ()
 
void SetFg (Flightgroup *fg, int fg_snumber)
 
void SetFaction (int faction)
 
FlightgroupgetFlightgroup () const
 
int getFgSubnumber () const
 
const std::string getFgID ()
 
std::vector< class CargoColor > & FilterDowngradeList (std::vector< class CargoColor > &mylist, bool downgrade=true)
 
std::vector< class CargoColor > & FilterUpgradeList (std::vector< class CargoColor > &mylist)
 
bool IsBase () const
 
bool isTractorable (enum tractorHow how=tractorBoth) const
 
void setTractorability (enum tractorHow how)
 
enum tractorHow getTractorability () const
 
void setFullname (std::string name)
 
const string & getFullname () const
 
const string & getFilename () const
 
void Ref ()
 
void UnRef ()
 
UnitImages< void > & GetImageInformation ()
 
bool isStarShip () const
 
bool isPlanet () const
 
bool isJumppoint () const
 
bool isEnemy (const Unit *other) const
 
bool isFriend (const Unit *other) const
 
bool isNeutral (const Unit *other) const
 
float getRelation (const Unit *other) const
 
void TurretFAW ()
 

Protected Member Functions

void LoadXML (const char *filename)
 
void beginElem (const std::string &, const AttributeList &)
 
 Nebula (const char *unitfile, bool SubU, int faction, Flightgroup *fg=NULL, int fg_snumber=0)
 constructor only to be called by UnitFactory More...
 
 Nebula (std::vector< Mesh * >m, bool b, int i)
 
 Nebula ()
 default constructor forbidden More...
 
- Protected Member Functions inherited from Unit
 Unit (const Unit &)
 
Unitoperator= (const Unit &)
 
virtual float ExplosionRadius ()
 
void ActivateGuns (const weapon_info *, bool Missile)
 cycles through the loop twice turning on all matching to ms weapons of size or after size More...
 
float MaxShieldVal () const
 
void RegenShields ()
 
virtual float DealDamageToShield (const Vector &pnt, float &Damage)
 
bool ShieldUp (const Vector &) const
 
void SortCargo ()
 

Static Protected Member Functions

static void beginElement (void *Userdata, const XML_Char *name, const XML_Char **atts)
 
- Static Protected Member Functions inherited from Unit
static std::string massSerializer (const struct XMLType &input, void *mythis)
 
static std::string cargoSerializer (const struct XMLType &input, void *mythis)
 
static std::string mountSerializer (const struct XMLType &input, void *mythis)
 
static std::string shieldSerializer (const struct XMLType &input, void *mythis)
 
static std::string subunitSerializer (const struct XMLType &input, void *mythis)
 

Protected Attributes

Vector color
 
float Density
 
float fognear
 
float fogfar
 
int index
 
float explosiontime
 
enum FOGMODE fogmode
 
bool fogme
 
float lastfadein
 
float fadeinvalue
 
- Protected Attributes inherited from Unit
StringPool::Reference csvRow
 
bool networked
 
ObjSerial serial
 
Vector net_accel
 
unsigned char attack_preference
 
unsigned char unit_role
 
Nebulanebula
 
float shieldtight
 
float fuel
 
float afterburnenergy
 
int afterburntype
 
float Momentofinertia
 
Vector SavedAccel
 
unsigned char invisible
 
float maxhull
 
float recharge
 
float maxenergy
 
float maxwarpenergy
 
float warpenergy
 
StringPool::Reference target_fgid [3]
 
Flightgroupflightgroup
 
int flightgroup_subnumber
 
std::string fullname
 

Friends

class UnitFactory
 

Additional Inherited Members

- Public Types inherited from Unit
enum  DAMAGES {
  NO_DAMAGE =0x00, SHIELD_DAMAGED =0x01, COMPUTER_DAMAGED =0x02, MOUNT_DAMAGED =0x04,
  CARGOFUEL_DAMAGED =0x08, JUMP_DAMAGED =0x10, CLOAK_DAMAGED =0x20, LIMITS_DAMAGED =0x40,
  ARMOR_DAMAGED =0x80
}
 
enum  schedulepriorityenum { scheduleDefault, scheduleAField, scheduleRoid }
 
enum  COLLIDELOCATIONTYPES { UNIT_ONLY =0, UNIT_BOLT =1, NUM_COLLIDE_MAPS =2 }
 
enum  DOCKENUM { NOT_DOCKED =0x0, DOCKED_INSIDE =0x1, DOCKED =0x2, DOCKING_UNITS =0x4 }
 
enum  tractorHow { tractorImmune =0, tractorPush =1, tractorIn =2, tractorBoth =3 }
 
- Static Public Member Functions inherited from Unit
static void ProcessDeleteQueue ()
 
static void beginElement (void *userData, const XML_Char *name, const XML_Char **atts)
 
static void endElement (void *userData, const XML_Char *name)
 
static UnitmakeMasterPartList ()
 
- Public Attributes inherited from Unit
bool killed
 
bool zapped
 
int ucref
 
UnitSoundssound
 
StringPool::Reference name
 
StringPool::Reference filename
 
ClientState old_state
 
unsigned short damages
 
UnitCollection SubUnits
 
std::vector< Mountmounts
 
float gunspeed
 
float gunrange
 
float missilerange
 
bool inertialmode
 
char turretstatus
 
bool autopilotactive
 
class Unit::graphic_options graphicOptions
 
std::vector< Mesh * > meshdata
 
StarSystemactiveStarSystem
 
class Unit::Computer computer
 
struct Unit::UnitJump jump
 
Pilotpilot
 
bool selected
 
XMLxml
 
void * owner
 
unsigned int sim_atom_multiplier
 
unsigned int predicted_priority
 
Transformation prev_physical_state
 
Transformation curr_physical_state
 
unsigned int cur_sim_queue_slot
 
unsigned int last_processed_sqs
 
bool do_subunit_scheduling
 
enum Unit::schedulepriorityenum schedule_priority
 
Matrix cumulative_transformation_matrix
 
Transformation cumulative_transformation
 
Vector cumulative_velocity
 
Vector NetForce
 
Vector NetLocalForce
 
Vector NetTorque
 
Vector NetLocalTorque
 
Vector AngularVelocity
 
Vector Velocity
 
UnitImages< void > * pImage
 
float specInterdiction
 
float Mass
 
float HeatSink
 
class Unit::Limits limits
 
int cloaking
 
int cloakmin
 
float radial_size
 
Vector corner_min
 
Vector corner_max
 
bool resolveforces
 
Armor armor
 
Shield shield
 
float hull
 
float energy
 
Orderaistate
 
CollideMap::iterator location [2]
 
struct collideTreescolTrees
 
unsigned char docked
 
int faction
 
MeshAnimationpMeshAnimation
 
- Protected Types inherited from Unit
enum  INVIS { DEFAULTVIS =0x0, INVISGLOW =0x1, INVISUNIT =0x2, INVISCAMERA =0x4 }
 

Detailed Description

Definition at line 5 of file nebula_generic.h.

Constructor & Destructor Documentation

Nebula::Nebula ( const char *  unitfile,
bool  SubU,
int  faction,
Flightgroup fg = NULL,
int  fg_snumber = 0 
)
protected

constructor only to be called by UnitFactory

Definition at line 134 of file nebula_generic.cpp.

References InitNebula().

134  :
135  Unit( unitfile, SubU, faction, string( "" ), fg, fg_snumber )
136 {
137  this->InitNebula( unitfile, SubU, faction, fg, fg_snumber );
138 }
Nebula::Nebula ( std::vector< Mesh * >  m,
bool  b,
int  i 
)
inlineprotected

Definition at line 44 of file nebula_generic.h.

44 : Unit( m, b, i ) {}
Nebula::Nebula ( )
inlineprotected

default constructor forbidden

Definition at line 59 of file nebula_generic.h.

59 {}

Member Function Documentation

void Nebula::beginElem ( const std::string &  name,
const AttributeList atts 
)
protected

Definition at line 35 of file nebula_generic.cpp.

References NebulaXML::attribute_map(), NebulaXML::BLUE, NebulaXML::COLOR, NebulaXML::DENSITY, NebulaXML::element_map(), NebulaXML::EXPLOSIONTIME, FOG_LINEAR, NebulaXML::FOGTHIS, NebulaXML::GREEN, NebulaXML::INDEX, index, NebulaXML::LIMITS, XMLSupport::EnumMap::lookup(), NebulaXML::MODE, NebulaXML::NEBFAR, NebulaXML::NEBNEAR, NebulaXML::NEBULA, XMLSupport::parse_bool(), XMLSupport::parse_float(), NebulaXML::parse_fogmode(), XMLSupport::parse_int(), NebulaXML::RED, and NebulaXML::UNKNOWN.

36 {
37  Names elem = (Names) element_map.lookup( name );
38  AttributeList::const_iterator iter;
39  switch (elem)
40  {
41  case UNKNOWN:
42  break;
43  case NEBULA:
44  fogme = true;
45  explosiontime = 0;
46  index = 0;
48  for (iter = atts.begin(); iter != atts.end(); iter++) {
49  switch ( attribute_map.lookup( (*iter).name ) )
50  {
51  case DENSITY:
52  Density = parse_float( (*iter).value );
53  break;
54  case INDEX:
55  index = parse_int( (*iter).value );
56  break;
57  case MODE:
58  fogmode = parse_fogmode( (*iter).value );
59  break;
60  case EXPLOSIONTIME:
61  explosiontime = parse_float( (*iter).value );
62  break;
63  case FOGTHIS:
64  fogme = parse_bool( (*iter).value );
65  break;
66  }
67  }
68  break;
69  case COLOR:
70  for (iter = atts.begin(); iter != atts.end(); iter++) {
71  switch ( attribute_map.lookup( (*iter).name ) )
72  {
73  case RED:
74  color.i = parse_float( (*iter).value );
75  break;
76  case GREEN:
77  color.j = parse_float( (*iter).value );
78  break;
79  case BLUE:
80  color.k = parse_float( (*iter).value );
81  break;
82  }
83  }
84  break;
85  case LIMITS:
86  for (iter = atts.begin(); iter != atts.end(); iter++) {
87  switch ( attribute_map.lookup( (*iter).name ) )
88  {
89  case NEBNEAR:
90  fognear = parse_float( (*iter).value );
91  break;
92  case NEBFAR:
93  fogfar = parse_float( (*iter).value );
94  break;
95  }
96  }
97  break;
98  default:
99  break;
100  }
101 }
void Nebula::beginElement ( void *  Userdata,
const XML_Char *  name,
const XML_Char **  atts 
)
staticprotected

Definition at line 28 of file nebula_generic.cpp.

Referenced by LoadXML().

29 {
30  ( (Nebula*) Userdata )->beginElem( std::string( name ), AttributeList( atts ) );
31 }
float Nebula::getFade ( )
inline

Definition at line 23 of file nebula_generic.h.

References fadeinvalue.

Referenced by NebulaUpdate().

24  {
25  return fadeinvalue;
26  }
void Nebula::InitNebula ( const char *  unitfile,
bool  SubU,
int  faction,
Flightgroup fg,
int  fg_snumber 
)

Definition at line 125 of file nebula_generic.cpp.

Referenced by GameNebula::GameNebula(), and Nebula().

126 {
127  fogme = true;
128  string fullpath( unitfile );
129  fullpath += ".nebula";
130 
131  LoadXML( fullpath.c_str() );
132 }
virtual enum clsptr Nebula::isUnit ( ) const
inlinevirtual

Reimplemented from Unit.

Definition at line 28 of file nebula_generic.h.

References NEBULAPTR.

29  {
30  return NEBULAPTR;
31  }
void Nebula::LoadXML ( const char *  filename)
protected

Definition at line 104 of file nebula_generic.cpp.

References beginElement(), VSFileSystem::VSFile::Close(), f, FOG_OFF, VegaConfig::getVariable(), Nebula_endElement(), VSFileSystem::Ok, VSFileSystem::VSFile::OpenReadOnly(), XMLSupport::parse_bool(), VSFileSystem::VSFile::ReadFull(), VSFileSystem::VSFile::Size(), VSFileSystem::UnitFile, vs_config, and VSFileSystem::vs_fprintf().

105 {
106  VSFile f;
108  static bool usefog = XMLSupport::parse_bool( vs_config->getVariable( "graphics", "fog", "true" ) );
109  if (err > Ok || !usefog) {
110  if (err <= Ok)
111  f.Close();
112  else
113  VSFileSystem::vs_fprintf( stderr, "\nUnit file %s not found\n", filename );
114  fogmode = FOG_OFF;
115  return;
116  }
117  XML_Parser parser = XML_ParserCreate( NULL );
118  XML_SetUserData( parser, this );
119  XML_SetElementHandler( parser, &Nebula::beginElement, &Nebula_endElement );
120  XML_Parse( parser, ( f.ReadFull() ).c_str(), f.Size(), 1 );
121  XML_ParserFree( parser );
122  f.Close();
123 }
virtual void Nebula::PutInsideCam ( int  )
inlinevirtual

Reimplemented in GameNebula.

Definition at line 27 of file nebula_generic.h.

27 {}
void Nebula::reactToCollision ( Unit smaller,
const QVector biglocation,
const Vector bignormal,
const QVector smalllocation,
const Vector smallnormal,
float  dist 
)
virtual

Reimplemented from Unit.

Definition at line 140 of file nebula_generic.cpp.

References fogme, and Unit::SetNebula().

146 {
147  if (fogme)
148  SetNebula( this );
149  smaller->SetNebula( this );
150 }
virtual void Nebula::SetFogState ( )
inlinevirtual

Reimplemented in GameNebula.

Definition at line 55 of file nebula_generic.h.

Referenced by GameStarSystem::Draw(), Mesh::DrawNow(), and SetupFogState().

55 {}
void Nebula::UpdatePhysics2 ( const Transformation trans,
const Transformation old_physical_state,
const Vector accel,
float  difficulty,
const Matrix transmat,
const Vector CumulativeVelocity,
bool  ResolveLast,
UnitCollection uc = NULL 
)
virtual

Reimplemented from Unit.

Reimplemented in GameUnit< Nebula >, and GameNebula.

Definition at line 152 of file nebula_generic.cpp.

References Unit::UpdatePhysics2().

160 {
161  Unit::UpdatePhysics2( trans, old_physical_state, accel, difficulty, transmat, CumulativeVelocity, ResolveLast, uc );
162 }

Friends And Related Function Documentation

friend class UnitFactory
friend

Definition at line 43 of file nebula_generic.h.

Member Data Documentation

Vector Nebula::color
protected

Definition at line 9 of file nebula_generic.h.

Referenced by GameNebula::SetFogState(), and GameNebula::UpdatePhysics2().

float Nebula::Density
protected

Definition at line 10 of file nebula_generic.h.

Referenced by GameNebula::SetFogState().

float Nebula::explosiontime
protected

Definition at line 14 of file nebula_generic.h.

Referenced by GameNebula::UpdatePhysics2().

float Nebula::fadeinvalue
protected
float Nebula::fogfar
protected

Definition at line 12 of file nebula_generic.h.

Referenced by GameNebula::SetFogState().

bool Nebula::fogme
protected

Definition at line 16 of file nebula_generic.h.

Referenced by reactToCollision().

enum FOGMODE Nebula::fogmode
protected

Definition at line 15 of file nebula_generic.h.

Referenced by GameNebula::SetFogState().

float Nebula::fognear
protected

Definition at line 11 of file nebula_generic.h.

Referenced by GameNebula::SetFogState().

int Nebula::index
protected

Definition at line 13 of file nebula_generic.h.

Referenced by GameNebula::SetFogState().

float Nebula::lastfadein
protected

The documentation for this class was generated from the following files: