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
GameUnit< UnitType > Class Template Reference

#include <unit.h>

Inheritance diagram for GameUnit< UnitType >:

Public Member Functions

 GameUnit (int dummy)
 
 GameUnit (std::vector< Mesh * > &meshes, bool Subunit, int faction)
 
 GameUnit (const char *filename, bool SubUnit, int faction, std::string customizedUnit=std::string(""), Flightgroup *flightgroup=NULL, int fg_subnumber=0, std::string *netxml=NULL)
 
virtual ~GameUnit ()
 
int nummesh () const
 
UnitImages< void > & GetImageInformation ()
 
bool RequestClearance (Unit *dockingunit)
 
void UpgradeInterface (Unit *base)
 Loads a user interface for the user to upgrade his ship. More...
 
virtual void Cloak (bool cloak)
 The name (type) of this unit shouldn't be public. More...
 
void Split (int level)
 
void FixGauges ()
 
void UpdateHudMatrix (int whichcam)
 Sets the camera to be within this unit. More...
 
VSSpritegetHudImage () const
 What's the HudImage of this unit. More...
 
virtual void Draw (const Transformation &quat, const Matrix &m)
 Draws this unit with the transformation and matrix (should be equiv) separately. More...
 
virtual void Draw (const Transformation &quat)
 
virtual void Draw ()
 
virtual void DrawNow (const Matrix &m, float lod=1000000000)
 
virtual void DrawNow ()
 
void addHalo (const char *filename, const QVector &loc, const Vector &size, const GFXColor &col, std::string halo_type, float halo_speed)
 Deprecated. More...
 
virtual void applyTechniqueOverrides (const std::map< std::string, std::string > &overrides)
 
bool TransferUnitToSystem (unsigned int whichJumpQueue, StarSystem *&previouslyActiveStarSystem, bool DoSightAndSound)
 
bool Explode (bool draw, float timeit)
 Begin and continue explosion. More...
 
bool queryFrustum (double frustum[6][4]) const
 
*bool querySphereClickList (int, int, float err, Camera *activeCam)
 
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)
 returns true if jump possible even if not taken More...
 
void Thrust (const Vector &amt, bool afterburn=false)
 Thrusts by ammt and clamps accordingly (afterburn or not) More...
 
Vector ResolveForces (const Transformation &, const Matrix &)
 Resolves forces of given unit on a physics frame. More...
 
virtual void ArmorDamageSound (const Vector &pnt)
 
virtual void HullDamageSound (const Vector &pnt)
 
float DealDamageToShield (const Vector &pnt, float &Damage)
 applies damage from the given pnt to the shield, and returns % damage applied and applies lighitn More...
 
bool UpgradeSubUnits (const Unit *up, int subunitoffset, bool touchme, bool downgrade, int &numave, double &percentage)
 
double Upgrade (const std::string &file, int mountoffset, int subunitoffset, bool force, bool loop_through_mounts)
 
Matrix WarpMatrix (const Matrix &ctm) const
 Holds temporary values for inter-function XML communication Saves deprecated restr info. More...
 

Public Attributes

double sparkle_accum
 
std::auto_ptr< HaloSystemphalos
 

Friends

class UnitFactory
 

Detailed Description

template<class UnitType>
class GameUnit< UnitType >

GameUnit contains any physical object that may collide with something And may be physically affected by forces. Units are assumed to have various damage and explode when they are dead. Units may have any number of weapons which, themselves may be units the aistate indicates how the unit will behave in the upcoming phys frame

Definition at line 58 of file unit.h.

Constructor & Destructor Documentation

template<class UnitType >
GameUnit< UnitType >::GameUnit ( int  dummy)

Definition at line 80 of file unit.cpp.

References Unit::Init().

80  : sparkle_accum( 0 )
81  , phalos( new HaloSystem() )
82 {
83  this->Unit::Init();
84 }
template<class UnitType >
GameUnit< UnitType >::GameUnit ( std::vector< Mesh * > &  meshes,
bool  Subunit,
int  faction 
)

Definition at line 86 of file unit.cpp.

86  :
87  UnitType( meshes, SubU, fact )
88  , sparkle_accum( 0 )
89  , phalos( new HaloSystem() )
90 {}
template<class UnitType>
GameUnit< UnitType >::GameUnit ( const char *  filename,
bool  SubUnit,
int  faction,
std::string  customizedUnit = std::string(""),
Flightgroup flightgroup = NULL,
int  fg_subnumber = 0,
std::string *  netxml = NULL 
)
template<class UnitType >
GameUnit< UnitType >::~GameUnit ( )
virtual

Definition at line 104 of file unit.cpp.

105 {
106  for (unsigned int meshcount = 0; meshcount < this->meshdata.size(); meshcount++)
107  if (this->meshdata[meshcount])
108  delete this->meshdata[meshcount];
109  this->meshdata.clear();
110  //delete phalos;
111 }

Member Function Documentation

template<class UnitType >
void GameUnit< UnitType >::addHalo ( const char *  filename,
const QVector loc,
const Vector size,
const GFXColor col,
std::string  halo_type,
float  halo_speed 
)

Deprecated.

Definition at line 145 of file unit.cpp.

References GameUnit< UnitType >::phalos.

151 {
152  phalos->AddHalo( filename, loc, size, col, halo_type, halo_speed );
153 }
template<class UnitType>
void GameUnit< UnitType >::applyTechniqueOverrides ( const std::map< std::string, std::string > &  overrides)
virtual

Definition at line 619 of file unit.cpp.

References Technique::Pass::getNumShaderParams(), Technique::Pass::getShaderParam(), Technique::Pass::ShaderParam::name, override, parseFloat4(), and Technique::Pass::ShaderParam::value.

620 {
621  for (vector<Mesh*>::iterator mesh = this->meshdata.begin(); mesh != this->meshdata.end(); ++mesh) {
622  if (*mesh != NULL) {
623  // First check to see if the technique holds any parameter being overridden
624  TechniquePtr technique = (*mesh)->getTechnique();
625  if (technique.get() != NULL) {
626  bool doOverride = false;
627  for (int passno = 0; !doOverride && passno < technique->getNumPasses(); ++passno) {
628  const Technique::Pass &pass = technique->getPass(passno);
629  for (size_t paramno = 0; !doOverride && paramno < pass.getNumShaderParams(); ++paramno) {
630  if (overrides.count(pass.getShaderParam(paramno).name) > 0)
631  doOverride = true;
632  }
633  }
634 
635  if (doOverride) {
636  // Prepare a new technique with the overrides
637  // (make sure the technique has been compiled though -
638  // parameter values don't really need recompilation)
639  TechniquePtr newtechnique = TechniquePtr(new Technique(*technique));
640  for (int passno = 0; passno < technique->getNumPasses(); ++passno) {
641  Technique::Pass &pass = technique->getPass(passno);
642  for (size_t paramno = 0; paramno < pass.getNumShaderParams(); ++paramno) {
643  Technique::Pass::ShaderParam &param = pass.getShaderParam(paramno);
644  map<string, string>::const_iterator override = overrides.find(param.name);
645  if (override != overrides.end())
646  parseFloat4(override->second, param.value);
647  }
648  }
649 
650  (*mesh)->setTechnique(newtechnique);
651  }
652  }
653  }
654  }
655 }
template<class UnitType >
void GameUnit< UnitType >::ArmorDamageSound ( const Vector pnt)
virtual

Definition at line 152 of file unit_damage.h.

References _Universe, AUDCreateSoundWAV(), AUDIsPlaying(), AUDPlay(), AUDStopPlaying(), VegaConfig::getVariable(), Universe::isPlayerStarship(), XMLSupport::parse_bool(), and vs_config.

153 {
154  if ( !_Universe->isPlayerStarship( this ) ) {
155  static bool ai_sound = XMLSupport::parse_bool( vs_config->getVariable( "audio", "ai_sound", "true" ) );
156  if ( AUDIsPlaying( this->sound->armor ) )
157  AUDStopPlaying( this->sound->armor );
158  if (ai_sound)
159  AUDPlay( this->sound->armor, this->ToWorldCoordinates(
160  pnt ).Cast()+this->cumulative_transformation.position, this->Velocity, 1 );
161  } else {
162  static int playerarmorsound =
163  AUDCreateSoundWAV( vs_config->getVariable( "unitaudio", "player_armor_hit", "bigarmor.wav" ) );
164  int sound = playerarmorsound != -1 ? playerarmorsound : this->sound->armor;
165  if ( AUDIsPlaying( sound ) )
166  AUDStopPlaying( sound );
167  AUDPlay( sound, this->ToWorldCoordinates(
168  pnt ).Cast()+this->cumulative_transformation.position, this->Velocity, 1 );
169  }
170 }
template<class UnitType >
void GameUnit< UnitType >::Cloak ( bool  cloak)
virtual

The name (type) of this unit shouldn't be public.

Definition at line 156 of file unit.cpp.

References UnitUtil::isPlayerStarship(), Network, NetClient::sendCloak(), and SERVER.

157 {
158  if (Network != NULL && !SERVER) {
159  int which = UnitUtil::isPlayerStarship( this );
160  if (which >= 0)
161  Network[which].sendCloak( engage );
162  else
163  UnitType::Cloak( engage ); //client side unit
164  } else {
165  UnitType::Cloak( engage ); //client side unit
166  }
167 }
template<class UnitType >
float GameUnit< UnitType >::DealDamageToShield ( const Vector pnt,
float Damage 
)

applies damage from the given pnt to the shield, and returns % damage applied and applies lighitn

Definition at line 193 of file unit_damage.h.

References _Universe, AUDCreateSoundWAV(), AUDIsPlaying(), AUDPlay(), AUDStopPlaying(), VegaConfig::getVariable(), Universe::isPlayerStarship(), XMLSupport::parse_bool(), and vs_config.

194 {
195  float percent = UnitType::DealDamageToShield( pnt, damage );
196  if ( !_Universe->isPlayerStarship( this ) ) {
197  static bool ai_sound = XMLSupport::parse_bool( vs_config->getVariable( "audio", "ai_sound", "true" ) );
198  if (percent) {
199  if ( AUDIsPlaying( this->sound->shield ) )
200  AUDStopPlaying( this->sound->shield );
201  if (ai_sound)
202  AUDPlay( this->sound->shield, this->ToWorldCoordinates(
203  pnt ).Cast()+this->cumulative_transformation.position, this->Velocity, 1 );
204  }
205  } else {
206  static int playerhullsound =
207  AUDCreateSoundWAV( vs_config->getVariable( "unitaudio", "player_shield_hit", "shieldhit.wav" ) );
208  int sound = playerhullsound != -1 ? playerhullsound : this->sound->hull;
209  if (percent) {
210  if ( AUDIsPlaying( sound ) )
211  AUDStopPlaying( sound );
212  AUDPlay( sound, this->ToWorldCoordinates(
213  pnt ).Cast()+this->cumulative_transformation.position, this->Velocity, 1 );
214  }
215  }
216  return percent;
217 }
template<class UnitType >
void GameUnit< UnitType >::Draw ( const Transformation quat,
const Matrix m 
)
virtual

Draws this unit with the transformation and matrix (should be equiv) separately.

this is the final, smoothly calculated cam

Reimplemented in AtmosphereHalo, and GamePlanet.

Definition at line 333 of file unit.cpp.

References _Universe, Universe::AccessCamera(), Universe::AccessCockpit(), Universe::activeStarSystem(), AUDAdjustSound(), weapon_info::AUTOTRACKING, weapon_info::BEAM, calc_blend_factor(), CalculateOrientation(), cam_setup_phase, cloakVal(), Transformation::Compose(), Unit::computer, Unit::cur_sim_queue_slot, d, damagelevel, game_data_t::detaillevel, GameUnit< UnitType >::Draw(), Mesh::Draw(), GameUnit< UnitType >::Explode(), StarSystemGent::faction, flickerDamage(), float, g_game, StarSystem::getCurrentSimFrame(), GetElapsedTime(), Camera::GetNebula(), Matrix::getP(), Cockpit::GetParent(), Camera::GetPosition(), Matrix::getQ(), Matrix::getR(), VegaConfig::getVariable(), Camera::GetVelocity(), GFXSphereInFrustum(), i, int, interpolation_blend_factor, LaunchOneParticle(), linear_interpolate(), Magnitude(), GameUnit< UnitType >::nummesh(), ONE, Matrix::p, XMLSupport::parse_bool(), XMLSupport::parse_float(), perspectiveFactor(), GameUnit< UnitType >::phalos, q, QVector, Unit::Computer::radar, Mesh::rSize(), saved_interpolation_blend_factor, ScaleMatrix(), Mesh::setCurrentFrame(), Cockpit::SetupViewPort(), Unit::sim_atom_multiplier, SIMULATION_ATOM, size, GameUnit< UnitType >::sparkle_accum, Unit::Target(), Unit::Computer::RADARLIM::trackingcone, Transform(), Mount::UNCHOSEN, Vector, VectorAndPositionToMatrix(), vs_config, GameUnit< UnitType >::WarpMatrix(), and game_data_t::znear.

334 {
335  //Quick shortcut for camera setup phase
336  bool myparent = ( this == _Universe->AccessCockpit()->GetParent() );
337 
338 #ifdef VARIABLE_LENGTH_PQR
339  const float vlpqrScaleFactor = SizeScaleFactor;
340 #else
341  const float vlpqrScaleFactor = 1.f;
342 #endif
343 
344  Matrix *ctm;
345  Matrix invview;
346  Transformation *ct;
347 
348  this->cumulative_transformation = linear_interpolate( this->prev_physical_state,
349  this->curr_physical_state,
351  this->cumulative_transformation.Compose( parent, parentMatrix );
352  this->cumulative_transformation.to_matrix( this->cumulative_transformation_matrix );
353 
354  ctm = &this->cumulative_transformation_matrix;
355  ct = &this->cumulative_transformation;
356  if (this->graphicOptions.FaceCamera == 1) {
357  Vector p, q, r;
358  QVector pos( ctm->p );
359  float wid, hei;
360  float magr = parentMatrix.getR().Magnitude();
361  float magp = parentMatrix.getP().Magnitude();
362  float magq = parentMatrix.getQ().Magnitude();
363  CalculateOrientation( pos, p, q, r, wid, hei, 0, false, ctm );
364  VectorAndPositionToMatrix( invview, p*magp, q*magq, r*magr, ctm->p );
365  ctm = &invview;
366  }
367 
368 #ifdef PERFRAMESOUND
369  AUDAdjustSound( sound.engine, cumulative_transformation.position, GetVelocity() );
370 #endif
371 
372  int cloak = this->cloaking;
373  if (this->cloaking > this->cloakmin) {
374  cloak = (int) (this->cloaking-interpolation_blend_factor*this->pImage->cloakrate*SIMULATION_ATOM);
375  cloak = cloakVal( cloak, this->cloakmin, this->pImage->cloakrate, this->pImage->cloakglass );
376  }
377 
378  unsigned int i;
379  if ( (this->hull < 0) && (!cam_setup_phase) )
380  Explode( true, GetElapsedTime() );
381 
382  float damagelevel = 1.0f;
383  unsigned char chardamage = 0;
384  if (this->hull < this->maxhull && !cam_setup_phase) {
385  damagelevel = this->hull/this->maxhull;
386  chardamage = ( 255-(unsigned char) (damagelevel*255) );
387  }
388 
389  bool On_Screen = false;
390  if ( ( !(this->invisible&UnitType::INVISUNIT) ) && ( ( !(this->invisible&UnitType::INVISCAMERA) ) || (!myparent) ) ) {
391  if (!cam_setup_phase) {
392  Camera *camera = _Universe->AccessCamera();
393  QVector camerapos = camera->GetPosition();
394 
395  float minmeshradius =
396  ( camera->GetVelocity().Magnitude()+this->Velocity.Magnitude() )*SIMULATION_ATOM;
397 
398  unsigned int numKeyFrames = this->graphicOptions.NumAnimationPoints;
399  for (i = 0; i < this->meshdata.size(); i++) {
400  //NOTE LESS THAN OR EQUALS...to cover shield mesh
401  if (this->meshdata[i] == NULL)
402  continue;
403  if ( (int) i == this->nummesh() && (this->meshdata[i]->numFX() == 0 || this->hull < 0) )
404  continue;
405  if (this->meshdata[i]->getBlendDst() == ONE) {
406  if ( (this->invisible&UnitType::INVISGLOW) != 0 )
407  continue;
408  if (damagelevel < .9)
409  if ( flickerDamage( this, damagelevel ) )
410  continue;
411  }
412  QVector TransformedPosition = Transform( *ctm, this->meshdata[i]->Position().Cast() );
413 
414  double d = GFXSphereInFrustum( TransformedPosition,
415  minmeshradius+this->meshdata[i]->clipRadialSize()*vlpqrScaleFactor );
416  if (d) {
417  //d can be used for level of detail shit
418  d = ( TransformedPosition-camerapos ).Magnitude();
419  double rd = d-this->meshdata[i]->rSize();
420  double pixradius = this->meshdata[i]->rSize()*perspectiveFactor(
421  (rd < g_game.znear) ? g_game.znear : rd );
422  double lod = pixradius*g_game.detaillevel;
423  if (lod >= 0.5 && pixradius >= 2.5) {
424  //if the radius is at least half a pixel at detail 1 (equivalent to pixradius >= 0.5 / detail)
425  float currentFrame = this->meshdata[i]->getCurrentFrame();
426  this->meshdata[i]->Draw( lod, this->WarpMatrix( *ctm ), d,
427  i == this->meshdata.size()-1 ? -1 : cloak,
428  (camera->GetNebula() == this->nebula && this->nebula != NULL) ? -1 : 0,
429  chardamage ); //cloakign and nebula
430  On_Screen = true;
431  unsigned int numAnimFrames = 0;
432  static const string default_animation;
433  if ( this->meshdata[i]->getFramesPerSecond()
434  && ( numAnimFrames = this->meshdata[i]->getNumAnimationFrames( default_animation ) ) ) {
435  float currentprogress = floor(
436  this->meshdata[i]->getCurrentFrame()*numKeyFrames/(float) numAnimFrames );
437  if (numKeyFrames
438  && floor( currentFrame*numKeyFrames/(float) numAnimFrames ) != currentprogress)
439  {
440  this->graphicOptions.Animating = 0;
441  this->meshdata[i]->setCurrentFrame( .1+currentprogress*numAnimFrames/(float) numKeyFrames );
442  } else if (!this->graphicOptions.Animating) {
443  this->meshdata[i]->setCurrentFrame( currentFrame ); //dont' budge
444  }
445  }
446  }
447  }
448  }
449  }
450  {
451  Unit *un;
452  double backup = interpolation_blend_factor;
453  int cur_sim_frame = _Universe->activeStarSystem()->getCurrentSimFrame();
454  for (un_kiter iter = this->SubUnits.constIterator(); (un = *iter); ++iter) {
455  float backup = SIMULATION_ATOM;
456  if (this->sim_atom_multiplier && un->sim_atom_multiplier)
457  SIMULATION_ATOM = SIMULATION_ATOM*un->sim_atom_multiplier/this->sim_atom_multiplier;
460  un->cur_sim_queue_slot,
461  cur_sim_frame );
462  (un)->Draw( *ct, *ctm );
463 
464  SIMULATION_ATOM = backup;
465  }
467  }
468  } else {
470  //UpdateHudMatrix();
471  }
472  /***DEBUGGING cosAngleFromMountTo
473  * UnitCollection *dL = _Universe->activeStarSystem()->getUnitList();
474  * UnitCollection::UnitIterator *tmpiter = dL->createIterator();
475  * GameUnit<UnitType> * curun;
476  * while (curun = tmpiter->current()) {
477  * if (curun->selected) {
478  * float tmpdis;
479  * float tmpf = cosAngleFromMountTo (curun, tmpdis);
480  * VSFileSystem::vs_fprintf (stderr,"%s: <%f d: %f\n", curun->name.c_str(), tmpf, tmpdis);
481  *
482  * }
483  * tmpiter->advance();
484  * }
485  * delete tmpiter;
486  **/
487  if (cam_setup_phase) return;
488  int nummounts = this->GetNumMounts();
489  for (i = 0; (int) i < nummounts; i++) {
490  static bool draw_mounts = XMLSupport::parse_bool( vs_config->getVariable( "graphics", "draw_weapons", "false" ) );
491  Mount *mahnt = &this->mounts[i];
492  if (draw_mounts && On_Screen)
493  if (mahnt->xyscale != 0 && mahnt->zscale != 0) {
494  Mesh *gun = mahnt->type->gun;
495  if (gun && mahnt->status != Mount::UNCHOSEN) {
496  Transformation mountLocation( mahnt->GetMountOrientation(), mahnt->GetMountLocation().Cast() );
497  mountLocation.Compose( *ct, this->WarpMatrix( *ctm ) );
498  Matrix mat;
499  mountLocation.to_matrix( mat );
500  if (GFXSphereInFrustum( mountLocation.position, gun->rSize()*vlpqrScaleFactor ) > 0) {
501  float d = ( mountLocation.position-_Universe->AccessCamera()->GetPosition() ).Magnitude();
502  float lod = gun->rSize()*g_game.detaillevel*perspectiveFactor(
503  (d-gun->rSize() < g_game.znear) ? g_game.znear : d-gun->rSize() );
504  ScaleMatrix( mat, Vector( mahnt->xyscale, mahnt->xyscale, mahnt->zscale ) );
505  gun->setCurrentFrame( this->mounts[i].ComputeAnimatedFrame( gun ) );
506  gun->Draw( lod, mat, d, cloak,
507  (_Universe->AccessCamera()->GetNebula() == this->nebula && this->nebula != NULL) ? -1 : 0,
508  chardamage,
509  true ); //cloakign and nebula
510  if (mahnt->type->gun1) {
511  gun = mahnt->type->gun1;
512  gun->setCurrentFrame( this->mounts[i].ComputeAnimatedFrame( gun ) );
513  gun->Draw( lod, mat, d, cloak,
514  (_Universe->AccessCamera()->GetNebula() == this->nebula && this->nebula
515  != NULL) ? -1 : 0,
516  chardamage, true ); //cloakign and nebula
517  }
518  }
519  }
520  }
521  if (this->mounts[i].type->type == weapon_info::BEAM)
522  if (this->mounts[i].ref.gun)
523  this->mounts[i].ref.gun->Draw( *ct, this->WarpMatrix( *ctm ),
524  ( (this->mounts[i].size&weapon_info::AUTOTRACKING)
525  && (this->mounts[i].time_to_lock <= 0)
526  && (this->computer.radar.trackingactive) ) ? Unit::Target() : NULL,
527  this->computer.radar.trackingcone );
528  }
529  float haloalpha = 1;
530  if (cloak >= 0)
531  haloalpha = ( (float) cloak )/2147483647;
532  if ( On_Screen && (phalos->NumHalos() > 0) && !( this->docked&(UnitType::DOCKED|UnitType::DOCKED_INSIDE) ) ) {
533  Vector accel = this->GetAcceleration();
534  float maxaccel = this->GetMaxAccelerationInDirectionOf( this->WarpMatrix( *ctm ).getR(), true );
535  Vector velocity = this->GetVelocity();
536 
537 #ifdef CAR_SIM
538  Vector Scale( 1, pImage->ecm, computer.set_speed );
539 #else
540  float cmas = this->computer.max_ab_speed()*this->computer.max_ab_speed();
541  if (cmas == 0)
542  cmas = 1;
543  Vector Scale( 1, 1, 1 ); //Now, HaloSystem handles that
544 #endif
545  //WARNING: cmas is not a valid maximum speed for the upcoming multi-direction thrusters,
546  //nor is maxaccel. Instead, each halo should have its own limits specified in units.csv
547  if ( phalos->ShouldDraw( this->WarpMatrix( *ctm ), velocity, accel, maxaccel, cmas ) )
548  phalos->Draw( this->WarpMatrix( *ctm ), Scale, cloak,
549  (_Universe->AccessCamera()->GetNebula() == this->nebula && this->nebula != NULL) ? -1 : 0,
550  this->GetHull() > 0 ? damagelevel : 1.0, velocity, accel, maxaccel, cmas, this->faction );
551  }
552  if ( On_Screen && !UnitType::graphicOptions.NoDamageParticles
553  && !( this->docked&(UnitType::DOCKED|UnitType::DOCKED_INSIDE) ) ) {
554  int numm = this->nummesh();
555  if (damagelevel < .99 && numm > 0 && this->GetHull() > 0) {
556  unsigned int switcher = (damagelevel > .8) ? 1
557  : (damagelevel > .6) ? 2 : (damagelevel > .4) ? 3 : (damagelevel > .2) ? 4 : 5;
558  static float sparklerate = XMLSupport::parse_float( vs_config->getVariable( "graphics", "sparklerate", "5" ) );
559  sparkle_accum += GetElapsedTime()*sparklerate;
560  int spawn = (int) (sparkle_accum);
561  sparkle_accum -= spawn;
562  while (spawn-- > 0) {
563  switch (switcher)
564  {
565  case 5:
566  LaunchOneParticle( *ctm, this->GetVelocity(), ( (long) this )+165, this, damagelevel, this->faction );
567  case 4:
568  LaunchOneParticle( *ctm, this->GetVelocity(), ( (long) this )+47, this, damagelevel, this->faction );
569  case 3:
570  LaunchOneParticle( *ctm, this->GetVelocity(), ( (long) this )+61, this, damagelevel, this->faction );
571  case 2:
572  LaunchOneParticle( *ctm, this->GetVelocity(), ( (long) this )+65537, this, damagelevel, this->faction );
573  default:
574  LaunchOneParticle( *ctm, this->GetVelocity(), ( (long) this )+257, this, damagelevel, this->faction );
575  }
576  }
577  }
578  }
579 }
template<class UnitType >
void GameUnit< UnitType >::Draw ( const Transformation quat)
virtual

Definition at line 582 of file unit.cpp.

References GameUnit< UnitType >::Draw(), and identity_matrix().

583 {
584  Draw( quat, identity_matrix );
585 }
template<class UnitType >
void GameUnit< UnitType >::Draw ( )
virtual
template<class UnitType >
void GameUnit< UnitType >::DrawNow ( const Matrix m,
float  lod = 1000000000 
)
virtual

Definition at line 219 of file unit.cpp.

References _Universe, Universe::AccessCamera(), CalculateOrientation(), cloakVal(), Transformation::Compose(), Unit::curr_physical_state, d, damagelevel, game_data_t::detaillevel, Mesh::Draw(), GameUnit< UnitType >::DrawNow(), StarSystemGent::faction, float, Transformation::from_matrix(), g_game, Camera::GetNebula(), Camera::GetPosition(), Matrix::getR(), VegaConfig::getVariable(), GFXSphereInFrustum(), i, int, Magnitude(), MultMatrix(), GameUnit< UnitType >::nummesh(), Matrix::p, XMLSupport::parse_bool(), perspectiveFactor(), GameUnit< UnitType >::phalos, Mesh::ProcessUndrawnMeshes(), Mesh::ProcessZFarMeshes(), q, QVector, Mesh::rSize(), ScaleMatrix(), Mesh::setCurrentFrame(), Transformation::to_matrix(), Transform(), Mount::UNCHOSEN, Vector, VectorAndPositionToMatrix(), vs_config, GameUnit< UnitType >::WarpMatrix(), and game_data_t::znear.

220 {
221  static const void *rootunit = NULL;
222  if (rootunit == NULL) rootunit = (const void*) this;
223  float damagelevel = 1.0;
224  unsigned char chardamage = 0;
225  if (this->hull < this->maxhull) {
226  damagelevel = this->hull/this->maxhull;
227  chardamage = ( 255-(unsigned char) (damagelevel*255) );
228  }
229 #ifdef VARIABLE_LENGTH_PQR
230  const float vlpqrScaleFactor = SizeScaleFactor;
231 #else
232  const float vlpqrScaleFactor = 1.f;
233 #endif
234  unsigned int i;
235  Matrix mat( mato );
236  if (this->graphicOptions.FaceCamera) {
237  Vector p, q, r;
238  QVector pos( mato.p );
239  float wid, hei;
240  CalculateOrientation( pos, p, q, r, wid, hei, 0, false, &mat );
241  pos = mato.p;
242  VectorAndPositionToMatrix( mat, p, q, r, pos );
243  }
244  int cloak = this->cloaking;
245  if (this->cloaking > this->cloakmin)
246  cloak = cloakVal( cloak, this->cloakmin, this->pImage->cloakrate, this->pImage->cloakglass );
247  for (i = 0; (int) i < this->nummesh(); i++) {
248  //NOTE LESS THAN OR EQUALS...to cover shield mesh
249  if (this->meshdata[i] == NULL)
250  continue;
251  QVector TransformedPosition = Transform( mat,
252  this->meshdata[i]->Position().Cast() );
253  float d = GFXSphereInFrustum( TransformedPosition, this->meshdata[i]->clipRadialSize()*vlpqrScaleFactor );
254  if (d) //d can be used for level of detail
255  //this->meshdata[i]->DrawNow(lod,false,mat,cloak);//cloakign and nebula
256  this->meshdata[i]->Draw( lod, mat, d, cloak );
257  }
258  Unit *un;
259  for (un_kiter iter = this->SubUnits.constIterator(); (un = *iter); ++iter) {
260  Matrix temp;
261  un->curr_physical_state.to_matrix( temp );
262  Matrix submat;
263  MultMatrix( submat, mat, temp );
264  (un)->DrawNow( submat, lod );
265  }
266  float haloalpha = 1;
267  if (cloak >= 0)
268  haloalpha = ( (float) cloak )/2147483647;
269 #ifdef CAR_SIM
270  Vector Scale( 1, pImage->ecm, computer.set_speed );
271 #else
272  float cmas = this->computer.max_ab_speed()*this->computer.max_ab_speed();
273  if (cmas == 0)
274  cmas = 1;
275  Vector Scale( 1, 1, 1 ); //Now, HaloSystem handles that
276 #endif
277  int nummounts = this->GetNumMounts();
278  for (i = 0; (int) i < nummounts; i++) {
279  static bool draw_mounts = XMLSupport::parse_bool( vs_config->getVariable( "graphics", "draw_weapons", "false" ) );
280  Mount *mahnt = &this->mounts[i];
281  if (draw_mounts)
282  if (mahnt->xyscale != 0 && mahnt->zscale != 0) {
283  Mesh *gun = mahnt->type->gun;
284  if (gun && mahnt->status != Mount::UNCHOSEN) {
285  Transformation mountLocation( mahnt->GetMountOrientation(), mahnt->GetMountLocation().Cast() );
286  mountLocation.Compose( Transformation::from_matrix( mat ), this->WarpMatrix( mat ) );
287  Matrix mmat;
288  mountLocation.to_matrix( mmat );
289  if (GFXSphereInFrustum( mountLocation.position, gun->rSize()*vlpqrScaleFactor ) > 0) {
290  float d = ( mountLocation.position-_Universe->AccessCamera()->GetPosition() ).Magnitude();
291  float lod = gun->rSize()*g_game.detaillevel*perspectiveFactor(
292  (d-gun->rSize() < g_game.znear) ? g_game.znear : d-gun->rSize() );
293  ScaleMatrix( mmat, Vector( mahnt->xyscale, mahnt->xyscale, mahnt->zscale ) );
294  gun->setCurrentFrame( this->mounts[i].ComputeAnimatedFrame( gun ) );
295  gun->Draw( lod, mmat, d, cloak,
296  (_Universe->AccessCamera()->GetNebula() == this->nebula && this->nebula != NULL) ? -1 : 0,
297  chardamage,
298  true ); //cloakign and nebula
299  if (mahnt->type->gun1) {
300  gun = mahnt->type->gun1;
301  gun->setCurrentFrame( this->mounts[i].ComputeAnimatedFrame( gun ) );
302  gun->Draw( lod, mmat, d, cloak,
303  (_Universe->AccessCamera()->GetNebula() == this->nebula && this->nebula
304  != NULL) ? -1 : 0,
305  chardamage, true ); //cloakign and nebula
306  }
307  }
308  }
309  }
310  }
311  Vector accel = this->GetAcceleration();
312  float maxaccel = this->GetMaxAccelerationInDirectionOf( mat.getR(), true );
313  Vector velocity = this->GetVelocity();
314  if ( phalos->ShouldDraw( mat, velocity, accel, maxaccel,
315  cmas ) && !( this->docked&(UnitType::DOCKED|UnitType::DOCKED_INSIDE) ) )
316  phalos->Draw( mat, Scale, cloak, 0, this->GetHullPercent(), velocity, accel, maxaccel, cmas, this->faction );
317  if (rootunit == (const void*) this) {
320  rootunit = NULL;
321  }
322 }
template<class UnitType >
void GameUnit< UnitType >::DrawNow ( )
virtual

Definition at line 325 of file unit.cpp.

References identity_matrix().

Referenced by GameUnit< UnitType >::DrawNow().

326 {
327  DrawNow( identity_matrix, 1000000000 );
328 }
template<class UnitType >
bool GameUnit< UnitType >::Explode ( bool  draw,
float  timeit 
)

Begin and continue explosion.

Definition at line 227 of file unit_damage.h.

References _Universe, Universe::AccessCockpit(), Universe::activeStarSystem(), AddAnimation(), StarSystem::AddMissileToQueue(), AUDPlay(), BILINEAR, bleh, BaseInterface::CurrentBase, Mission::DirectorShipDestroyed(), disableSubUnits(), Unit::Explode(), UnitImages< BOGUS >::explosion_type, StarSystemGent::faction, Unit::GetImageInformation(), getNewTime(), Cockpit::GetParent(), FactionUtil::GetRandExplosionAnimation(), getRandomCachedAniString(), Unit::getRelation(), FactionUtil::GetUpgradeFaction(), VegaConfig::getVariable(), GetVolatileAni(), i, Universe::isPlayerStarship(), lasttime, Music::LOSSLIST, MIPMAP, MISSILEPTR, mission, muzak, newtime, XMLSupport::parse_bool(), XMLSupport::parse_float(), UnitImages< BOGUS >::pExplosion, Unit::Position(), q, QVector, Animation::SetDimensions(), Animation::SetFaceCam(), Animation::SetOrientation(), Music::SkipRandSong(), UNITPTR, Vector, Music::VICTORYLIST, and vs_config.

Referenced by GameUnit< UnitType >::Draw().

228 {
229  if (this->pImage->pExplosion == NULL && this->pImage->timeexplode == 0) {
230  //no explosion in unit data file && explosions haven't started yet
231 
232  //notify the director that a ship got destroyed
234  disableSubUnits( this );
235  this->pImage->timeexplode = 0;
236  static string expani = vs_config->getVariable( "graphics", "explosion_animation", "explosion_orange.ani" );
237 
238  string bleh = this->pImage->explosion_type;
239  if ( bleh.empty() )
241  if ( bleh.empty() ) {
242  static Animation cache( expani.c_str(), false, .1, BILINEAR, false );
243  bleh = getRandomCachedAniString();
244  if (bleh.size() == 0)
245  bleh = expani;
246  }
247  static bool explosion_face_player =
248  XMLSupport::parse_bool( vs_config->getVariable( "graphics", "explosion_face_player", "true" ) );
249  this->pImage->pExplosion = new Animation( bleh.c_str(), explosion_face_player, .1, BILINEAR, true );
250  this->pImage->pExplosion->SetDimensions( this->ExplosionRadius(), this->ExplosionRadius() );
251  Vector p, q, r;
252  this->GetOrientation( p, q, r );
253  this->pImage->pExplosion->SetOrientation( p, q, r );
254  if (this->isUnit() != MISSILEPTR) {
255  static float expdamagecenter =
256  XMLSupport::parse_float( vs_config->getVariable( "physics", "explosion_damage_center", "1" ) );
257  static float damageedge =
258  XMLSupport::parse_float( vs_config->getVariable( "graphics", "explosion_damage_edge", ".125" ) );
259  _Universe->activeStarSystem()->AddMissileToQueue( new MissileEffect( this->Position().Cast(), this->MaxShieldVal(),
260  0, this->ExplosionRadius()*expdamagecenter,
261  this->ExplosionRadius()*expdamagecenter
262  *damageedge, NULL ) );
263  }
264  QVector exploc = this->cumulative_transformation.position;
265  bool sub = this->isSubUnit();
266  Unit *un = NULL;
267  if (!sub)
268  if (( un = _Universe->AccessCockpit( 0 )->GetParent() )) {
269  static float explosion_closeness =
270  XMLSupport::parse_float( vs_config->getVariable( "audio", "explosion_closeness", ".8" ) );
271  exploc = un->Position()*explosion_closeness+exploc*(1-explosion_closeness);
272  }
273  AUDPlay( this->sound->explode, exploc, this->Velocity, 1 );
274  if (!sub) {
275  un = _Universe->AccessCockpit()->GetParent();
276  if (this->isUnit() == UNITPTR) {
277  static float percentage_shock =
278  XMLSupport::parse_float( vs_config->getVariable( "graphics", "percent_shockwave", ".5" ) );
279  if ( rand() < RAND_MAX*percentage_shock && ( !this->isSubUnit() ) ) {
280  static float shockwavegrowth =
281  XMLSupport::parse_float( vs_config->getVariable( "graphics", "shockwave_growth", "1.05" ) );
282  static string shockani( vs_config->getVariable( "graphics", "shockwave_animation", "explosion_wave.ani" ) );
283 
284  static Animation *__shock__ani = new Animation( shockani.c_str(), true, .1, MIPMAP, false );
285  __shock__ani->SetFaceCam( false );
286  unsigned int which = AddAnimation( this->Position(),
287  this->ExplosionRadius(), true, shockani, shockwavegrowth );
288  Animation *ani = GetVolatileAni( which );
289  if (ani) {
290  ani->SetFaceCam( false );
291  Vector p, q, r;
292  this->GetOrientation( p, q, r );
293  int tmp = rand();
294  if (tmp < RAND_MAX/24)
295  ani->SetOrientation( Vector( 0, 0, 1 ), Vector( 1, 0, 0 ), Vector( 0, 1, 0 ) );
296  else if (tmp < RAND_MAX/16)
297  ani->SetOrientation( Vector( 0, 1, 0 ), Vector( 0, 0, 1 ), Vector( 1, 0, 0 ) );
298  else if (tmp < RAND_MAX/8)
299  ani->SetOrientation( Vector( 1, 0, 0 ), Vector( 0, 1, 0 ), Vector( 0, 0, 1 ) );
300  else
301  ani->SetOrientation( p, q, r );
302  }
303  }
304  if (un) {
305  int upgradesfaction = FactionUtil::GetUpgradeFaction();
306  static float badrel =
307  XMLSupport::parse_float( vs_config->getVariable( "sound", "loss_relationship", "-.1" ) );
308  static float goodrel =
309  XMLSupport::parse_float( vs_config->getVariable( "sound", "victory_relationship", ".5" ) );
310  static float timelapse =
311  XMLSupport::parse_float( vs_config->getVariable( "sound", "time_between_music", "180" ) );
312  float rel = un->getRelation( this );
314  static float lasttime = 0;
315  float newtime = getNewTime();
316  if ( newtime-lasttime > timelapse
317  || (_Universe->isPlayerStarship( this ) && this->isUnit() != MISSILEPTR && this->faction
318  != upgradesfaction) ) {
319  //No victory for missiles or spawned explosions
320  if (rel > goodrel) {
321  lasttime = newtime;
323  } else if (rel < badrel) {
324  lasttime = newtime;
326  }
327  }
328  }
329  }
330  }
331  }
332  }
333  static float timebeforeexplodedone = XMLSupport::parse_float( vs_config->getVariable( "physics", "debris_time", "500" ) );
334  bool timealldone =
335  ( this->pImage->timeexplode > timebeforeexplodedone || this->isUnit() == MISSILEPTR
336  || _Universe->AccessCockpit()->GetParent() == this || this->SubUnits.empty() );
337  if (this->pImage->pExplosion) {
338  this->pImage->timeexplode += timeit;
339  this->pImage->pExplosion->SetPosition( this->Position() );
340  Vector p, q, r;
341  this->GetOrientation( p, q, r );
342  this->pImage->pExplosion->SetOrientation( p, q, r );
343  if (this->pImage->pExplosion->Done() && timealldone) {
344  delete this->pImage->pExplosion;
345  this->pImage->pExplosion = NULL;
346  }
347  if (drawit && this->pImage->pExplosion)
348  this->pImage->pExplosion->Draw(); //puts on draw queue... please don't delete
349  }
350  bool alldone = this->pImage->pExplosion ? !this->pImage->pExplosion->Done() : false;
351  if ( !this->SubUnits.empty() ) {
352  Unit *su;
353  for (un_iter ui = this->getSubUnits(); (su = *ui); ++ui) {
354  bool temp = su->Explode( drawit, timeit );
356  alldone |= temp;
357  }
358  }
359  static float phatloot = XMLSupport::parse_float( vs_config->getVariable( "physics", "eject_cargo_on_blowup", "0" ) );
360  if ( (phatloot > 0) && (this->numCargo() > 0) ) {
361  size_t dropcount = (size_t) floor( this->numCargo()/phatloot )+1;
362  if ( dropcount > this->numCargo() ) dropcount = this->numCargo();
363  for (size_t i = 0; i < dropcount; i++)
364  this->EjectCargo( this->numCargo()-1 ); //Ejecting the last one is somewhat faster
365  }
366  return alldone || (!timealldone);
367 }
template<class UnitType>
void GameUnit< UnitType >::FixGauges ( )
template<class UnitType >
VSSprite * GameUnit< UnitType >::getHudImage ( ) const

What's the HudImage of this unit.

Definition at line 139 of file unit.cpp.

140 {
141  return this->pImage->pHudImage;
142 }
template<class UnitType>
UnitImages< void >& GameUnit< UnitType >::GetImageInformation ( )

fils in corner_min,corner_max and radial_size returns -1 if unit cannot dock, otherwise returns which dock it can dock at

template<class UnitType >
void GameUnit< UnitType >::HullDamageSound ( const Vector pnt)
virtual

Definition at line 173 of file unit_damage.h.

References _Universe, AUDCreateSoundWAV(), AUDIsPlaying(), AUDPlay(), AUDStopPlaying(), VegaConfig::getVariable(), Universe::isPlayerStarship(), XMLSupport::parse_bool(), and vs_config.

174 {
175  if ( !_Universe->isPlayerStarship( this ) ) {
176  static bool ai_sound = XMLSupport::parse_bool( vs_config->getVariable( "audio", "ai_sound", "true" ) );
177  if ( AUDIsPlaying( this->sound->hull ) )
178  AUDStopPlaying( this->sound->hull );
179  if (ai_sound)
180  AUDPlay( this->sound->hull, this->ToWorldCoordinates(
181  pnt ).Cast()+this->cumulative_transformation.position, this->Velocity, 1 );
182  } else {
183  static int playerhullsound = AUDCreateSoundWAV( vs_config->getVariable( "unitaudio", "player_hull_hit", "bigarmor.wav" ) );
184  int sound = playerhullsound != -1 ? playerhullsound : this->sound->hull;
185  if ( AUDIsPlaying( sound ) )
186  AUDStopPlaying( sound );
187  AUDPlay( sound, this->ToWorldCoordinates(
188  pnt ).Cast()+this->cumulative_transformation.position, this->Velocity, 1 );
189  }
190 }
template<class UnitType >
int GameUnit< UnitType >::nummesh ( ) const

Definition at line 114 of file unit.cpp.

Referenced by GameUnit< UnitType >::Draw(), GameUnit< UnitType >::DrawNow(), and GameUnit< UnitType >::queryFrustum().

115 {
116  return ( (int) this->meshdata.size() )-1;
117 }
template<class UnitType >
bool GameUnit< UnitType >::queryFrustum ( double  frustum[6][4]) const

Updates the collide Queue with any possible change in sectors Queries if this unit is within a given frustum

Definition at line 170 of file unit.cpp.

References GFXSphereInFrustum(), i, GameUnit< UnitType >::nummesh(), Transform(), and Vector.

171 {
172  int i;
173 #ifdef VARIABLE_LENGTH_PQR
174  Vector TargetPoint( cumulative_transformation_matrix[0],
175  cumulative_transformation_matrix[1],
176  cumulative_transformation_matrix[2] );
177  float SizeScaleFactor = sqrtf( TargetPoint.Dot( TargetPoint ) );
178 #else
179  Vector TargetPoint;
180 #endif
181  for (i = 0; i < nummesh(); i++) {
182  TargetPoint = Transform( this->cumulative_transformation_matrix, this->meshdata[i]->Position() );
183  if ( GFXSphereInFrustum( frustum,
184  TargetPoint,
185  this->meshdata[i]->rSize()
186 #ifdef VARIABLE_LENGTH_PQR
187  *SizeScaleFactor
188 #endif
189  ) )
190  return true;
191  }
192  const Unit *un;
193  for (un_fkiter iter = this->SubUnits.constFastIterator(); (un = *iter); ++iter)
194  if ( ( (GameUnit< UnitType >*)un )->queryFrustum( frustum ) )
195  return true;
196  return false;
197 }
template<class UnitType >
bool GameUnit< UnitType >::querySphereClickList ( int  mouseX,
int  mouseY,
float  err,
Camera activeCam 
)

Queries the bounding sphere with a duo of mouse coordinates that project to the center of a ship and compare with a sphere...pretty fast

Definition at line 13 of file unit_click.h.

References _Universe, Universe::AccessCamera(), Camera::GetPosition(), Camera::GetPQR(), Camera::GetView(), i, MouseCoordinate(), Transform(), and Vector.

14 {
15  int i;
16  Matrix vw;
17  _Universe->AccessCamera()->GetView( vw );
18  Vector mousePoint;
19 #ifdef VARIABLE_LENGTH_PQR
20  Vector TargetPoint( cumulative_transformation_matrix[0],
21  cumulative_transformation_matrix[1],
22  cumulative_transformation_matrix[2] );
23  float SizeScaleFactor = sqrtf( TargetPoint.Dot( TargetPoint ) );
24 #else
25  Vector TargetPoint;
26 #endif
27 
28  Vector CamP, CamQ, CamR;
29  for (i = 0; i < nummesh(); i++) {
30  TargetPoint = Transform( this->cumulative_transformation_matrix, this->meshdata[i]->Position() );
31 
32  mousePoint = Transform( vw, TargetPoint );
33  if (mousePoint.k > 0) //z coordinate reversed - is in front of camera
34  continue;
35  mousePoint = MouseCoordinate( mouseX, mouseY );
36 
37  activeCam->GetPQR( CamP, CamQ, CamR );
38  mousePoint = Transform( CamP, CamQ, CamR, mousePoint );
39  CamP = activeCam->GetPosition().Cast();
40  mousePoint += CamP;
41 
42  TargetPoint = TargetPoint-mousePoint;
43  if (TargetPoint.Dot( TargetPoint )
44  < err*err
45  +this->meshdata[i]->rSize()*this->meshdata[i]->rSize()
46 #ifdef VARIABLE_LENGTH_PQR
47  *SizeScaleFactor*SizeScaleFactor
48 #endif
49  +
50 #ifdef VARIABLE_LENGTH_PQR
51  SizeScaleFactor*
52 #endif
53  2*err*this->meshdata[i]->rSize()
54  )
55  return true;
56  }
57  Unit *su;
58  for (un_iter ui = this->getSubUnits(); (su = *ui); ++ui)
59  if ( (su)->querySphereClickList( mouseX, mouseY, err, activeCam ) )
60  return true;
61  return false;
62 }
template<class UnitType>
bool GameUnit< UnitType >::RequestClearance ( Unit dockingunit)
template<class UnitType >
Vector GameUnit< UnitType >::ResolveForces ( const Transformation trans,
const Matrix transmat 
)

Resolves forces of given unit on a physics frame.

Definition at line 177 of file unit_physics.h.

References AUDAdjustSound(), and Unit::ResolveForces().

178 {
179 #ifndef PERFRAMESOUND
180  AUDAdjustSound( this->sound->engine, this->cumulative_transformation.position, this->cumulative_velocity );
181 #endif
182  return Unit::ResolveForces( trans, transmat );
183 }
template<class UnitType >
void GameUnit< UnitType >::Split ( int  level)

Process all meshes to be deleted Split this mesh with into 2^level submeshes at arbitrary planes

Definition at line 37 of file unit_damage.h.

References AddMeshes(), Unit::ApplyForce(), Unit::ApplyLocalTorque(), UnitFactory::createUnit(), VSFileSystem::current_path, VSFileSystem::current_subdirectory, VSFileSystem::current_type, StarSystemGent::faction, FactionUtil::GetFaction(), Unit::GetMass(), Unit::GetMoment(), CSVRow::getRoot(), VegaConfig::getVariable(), Unit::hull, i, int, j, k, BeamXML::level, LookupUnitRow(), UniverseUtil::LookupUnitStat(), Unit::Mass, Unit::meshdata, Unit::name, ONE, XMLSupport::parse_bool(), XMLSupport::parse_float(), Unit::pImage, split(), CSVRow::success(), UnitImages< BOGUS >::timeexplode, XMLSupport::tostring(), VSFileSystem::UnitFile, Vector, and vs_config.

38 {
39  static bool split_subunits = XMLSupport::parse_bool( vs_config->getVariable( "graphics", "split_dead_subunits", "true" ) );
40  if (split_subunits)
41  for (un_iter su = this->getSubUnits(); *su; ++su)
42  (*su)->Split( level );
43  static float debrismassmult = XMLSupport::parse_float( vs_config->getVariable( "physics", "debris_mass", ".00001" ) );
44  Vector PlaneNorm;
45  for (int i = 0; i < nummesh();) {
46  if (this->meshdata[i]) {
47  if (this->meshdata[i]->getBlendDst() == ONE) {
48  delete this->meshdata[i];
49  this->meshdata.erase( this->meshdata.begin()+i );
50  } else {i++; }} else {this->meshdata.erase( this->meshdata.begin()+i ); }}
51  int nm = this->nummesh();
52  string fac = FactionUtil::GetFaction( this->faction );
53 
54  CSVRow unit_stats( LookupUnitRow( this->name, fac ) );
55  unsigned int num_chunks = unit_stats.success() ? atoi( unit_stats["Num_Chunks"].c_str() ) : 0;
56  if (nm <= 0 && num_chunks == 0)
57  return;
58  vector< Mesh* >old = this->meshdata;
59  Mesh *shield = old.back();
60  old.pop_back();
61 
62  vector< unsigned int >meshsizes;
63  if ( num_chunks && unit_stats.success() ) {
64  size_t i;
65  vector< Mesh* >nw;
66  unsigned int which_chunk = rand()%num_chunks;
67  string chunkname = UniverseUtil::LookupUnitStat( this->name, fac, "Chunk_"+XMLSupport::tostring( which_chunk ) );
68  string dir = UniverseUtil::LookupUnitStat( this->name, fac, "Directory" );
69  VSFileSystem::current_path.push_back( unit_stats.getRoot() );
70  VSFileSystem::current_subdirectory.push_back( "/"+dir );
72  float randomstartframe = 0;
73  float randomstartseconds = 0;
74  string scalestr = UniverseUtil::LookupUnitStat( this->name, fac, "Unit_Scale" );
75  int scale = atoi( scalestr.c_str() );
76  if (scale == 0) scale = 1;
77  AddMeshes( nw, randomstartframe, randomstartseconds, scale, chunkname, this->faction,
78  this->getFlightgroup(), &meshsizes );
79  VSFileSystem::current_type.pop_back();
81  VSFileSystem::current_path.pop_back();
82  for (i = 0; i < old.size(); ++i)
83  delete old[i];
84  old.clear();
85  old = nw;
86  } else {
87  for (int split = 0; split < level; split++) {
88  vector< Mesh* >nw;
89  size_t oldsize = old.size();
90  for (size_t i = 0; i < oldsize; i++) {
91  PlaneNorm.Set( rand()-RAND_MAX/2, rand()-RAND_MAX/2, rand()-RAND_MAX/2+.5 );
92  PlaneNorm.Normalize();
93  nw.push_back( NULL );
94  nw.push_back( NULL );
95  old[i]->Fork( nw[nw.size()-2], nw.back(), PlaneNorm.i, PlaneNorm.j, PlaneNorm.k,
96  -PlaneNorm.Dot( old[i]->Position() ) ); //splits somehow right down the middle.
97  delete old[i];
98  old[i] = NULL;
99  if (nw[nw.size()-2] == NULL) {
100  nw[nw.size()-2] = nw.back();
101  nw.pop_back();
102  }
103  if (nw.back() == NULL)
104  nw.pop_back();
105  }
106  old = nw;
107  }
108  meshsizes.reserve( old.size() );
109  for (size_t i = 0; i < old.size(); ++i)
110  meshsizes.push_back( 1 );
111  }
112  old.push_back( NULL ); //push back shield
113  if (shield)
114  delete shield;
115  nm = old.size()-1;
116  unsigned int k = 0;
117  vector< Mesh* >tempmeshes;
118  for (vector<Mesh *>::size_type i=0;i<meshsizes.size();i++) {
119  Unit *splitsub;
120  tempmeshes.clear();
121  tempmeshes.reserve( meshsizes[i] );
122  for (unsigned int j = 0; j < meshsizes[i] && k < old.size(); ++j, ++k)
123  tempmeshes.push_back( old[k] );
124  this->SubUnits.prepend( splitsub = UnitFactory::createUnit( tempmeshes, true, this->faction ) );
125  splitsub->hull = 1000;
126  splitsub->name = "debris";
127  splitsub->Mass = debrismassmult*splitsub->Mass/level;
128  splitsub->pImage->timeexplode = .1;
129  if (splitsub->meshdata[0]) {
130  Vector loc = splitsub->meshdata[0]->Position();
131  static float explosion_force = XMLSupport::parse_float( vs_config->getVariable( "graphics", "explosionforce", ".5" ) ); //10 seconds for auto to kick in;
132  float locm = loc.Magnitude();
133  if (locm < .0001)
134  locm = 1;
135  splitsub->ApplyForce( splitsub->meshdata[0]->rSize()*explosion_force*10*splitsub->GetMass()*loc/locm );
136  loc.Set( rand(), rand(), rand()+.1 );
137  loc.Normalize();
138  static float explosion_torque =
139  XMLSupport::parse_float( vs_config->getVariable( "graphics", "explosiontorque", ".001" ) ); //10 seconds for auto to kick in;
140  splitsub->ApplyLocalTorque( loc*splitsub->GetMoment()*explosion_torque*( 1+rand()%(int) ( 1+this->rSize() ) ) );
141  }
142  }
143  old.clear();
144  this->meshdata.clear();
145  this->meshdata.push_back( NULL ); //the shield
146  this->Mass *= debrismassmult;
147 }
template<class UnitType >
void GameUnit< UnitType >::Thrust ( const Vector amt,
bool  afterburn = false 
)

Thrusts by ammt and clamps accordingly (afterburn or not)

Definition at line 126 of file unit_physics.h.

References _Universe, Universe::AccessCockpit(), AUDCreateSound(), AUDIsPlaying(), AUDPlay(), AUDStopPlaying(), UnitUtil::getDistance(), getNewTime(), Cockpit::GetParent(), VegaConfig::getVariable(), Unit::GetVelocity(), Universe::isPlayerStarship(), Unit::owner, XMLSupport::parse_bool(), XMLSupport::parse_float(), Unit::Position(), QVector, SIMULATION_ATOM, Unit::Thrust(), Vector, and vs_config.

127 {
128  if (this->afterburntype == 0)
129  afterburn = afterburn && this->energy > this->afterburnenergy*SIMULATION_ATOM;
130  if (this->afterburntype == 1)
131  afterburn = afterburn && this->fuel > 0;
132  if (this->afterburntype == 2)
133  afterburn = afterburn && this->warpenergy > 0;
134  Unit::Thrust( amt1, afterburn );
135 
136  static bool must_afterburn_to_buzz =
137  XMLSupport::parse_bool( vs_config->getVariable( "audio", "buzzing_needs_afterburner", "false" ) );
138  if (_Universe->isPlayerStarship( this ) != NULL) {
139  static int playerengine = AUDCreateSound( vs_config->getVariable( "unitaudio",
140  "player_afterburner",
141  "sfx10.wav" ), true );
142  static float enginegain = XMLSupport::parse_float( vs_config->getVariable( "audio", "afterburner_gain", ".5" ) );
143  if ( afterburn != AUDIsPlaying( playerengine ) ) {
144  if (afterburn)
145  AUDPlay( playerengine, QVector( 0, 0, 0 ), Vector( 0, 0, 0 ), enginegain );
146  else
147  AUDStopPlaying( playerengine );
148  }
149  } else if (afterburn || !must_afterburn_to_buzz) {
150  static float buzzingtime = XMLSupport::parse_float( vs_config->getVariable( "audio", "buzzing_time", "5" ) );
151  static float buzzingdistance = XMLSupport::parse_float( vs_config->getVariable( "audio", "buzzing_distance", "5" ) );
152  static float lastbuzz = getNewTime();
153  Unit *playa = _Universe->AccessCockpit()->GetParent();
154  if (playa) {
155  Vector diff = this->Position()-playa->Position();
156  if (UnitUtil::getDistance( this,
157  playa ) < buzzingdistance && playa->owner != this && this->owner != playa
158  && this->owner != playa->owner) {
159  float ttime = getNewTime();
160  if (ttime-lastbuzz > buzzingtime) {
161  Vector pvel = playa->GetVelocity();
162  Vector vel = this->GetVelocity();
163  pvel.Normalize();
164  vel.Normalize();
165  float dotprod = vel.Dot( pvel );
166  if (dotprod < .86) {
167  lastbuzz = ttime;
168  AUDPlay( this->sound->engine, this->Position(), this->GetVelocity(), 1 );
169  } else {}
170  }
171  }
172  }
173  }
174 }
template<class UnitType >
bool GameUnit< UnitType >::TransferUnitToSystem ( unsigned int  whichJumpQueue,
StarSystem *&  previouslyActiveStarSystem,
bool  DoSightAndSound 
)

eradicating from system, leaving no trace

Definition at line 34 of file unit_jump.h.

References _Universe, Universe::AccessCockpit(), ActivateAnimation(), Unit::ActivateJumpDrive(), Universe::activeStarSystem(), AUDCreateSound(), AUDPlay(), AUDStopAllSounds(), ComparePrimaries(), UnitCollection::createIterator(), DealPossibleJumpDamage(), Flightgroup::directive, Unit::getFlightgroup(), Cockpit::GetParent(), UnitContainer::GetUnit(), StarSystem::getUnitList(), VegaConfig::getVariable(), i, is_null(), Unit::isUnit(), Flightgroup::leader, Unit::LocalPosition(), Unit::location, Magnitude(), pendingjump, Unit::Position(), primary, QVector, Unit::rSize(), Universe::setActiveStarSystem(), StarSystem::SwapOut(), Unit::Target(), Unit::Threat(), Unit::Threaten(), Unit::TransferUnitToSystem(), Unit::UNIT_BOLT, Unit::UNIT_ONLY, UNITPTR, Unit::VelocityReference(), vs_config, VSFileSystem::vs_fprintf(), and WarpPursuit().

35 {
36  bool ret = false;
37  if (pendingjump[kk]->orig == this->activeStarSystem || this->activeStarSystem == NULL) {
38  if ( Unit::TransferUnitToSystem( pendingjump[kk]->dest ) ) {
40  ret = true;
41 
42  Unit *unit;
43  for (un_iter iter = pendingjump[kk]->orig->getUnitList().createIterator(); (unit = *iter); ++iter) {
44  if (unit->Threat() == this)
45  unit->Threaten( NULL, 0 );
46  if (unit->VelocityReference() == this)
47  unit->VelocityReference( NULL );
48  if (unit->Target() == this) {
49  if ( pendingjump[kk]->jumppoint.GetUnit() ) {
50  unit->Target( pendingjump[kk]->jumppoint.GetUnit() );
51  unit->ActivateJumpDrive( 0 );
52  } else {
53  WarpPursuit( unit, pendingjump[kk]->orig, pendingjump[kk]->dest->getFileName() );
54  }
55  } else {
56  Flightgroup *ff = unit->getFlightgroup();
57  if (ff)
58  if ( this == ff->leader.GetUnit() && (ff->directive == "f" || ff->directive == "F") ) {
59  unit->Target( pendingjump[kk]->jumppoint.GetUnit() );
60  unit->getFlightgroup()->directive = "F";
61  unit->ActivateJumpDrive( 0 );
62  }
63  }
64  }
65  if ( this == _Universe->AccessCockpit()->GetParent() ) {
66  VSFileSystem::vs_fprintf( stderr, "Unit is the active player character...changing scene graph\n" );
67  savedStarSystem->SwapOut();
69  savedStarSystem = pendingjump[kk]->dest;
70  pendingjump[kk]->dest->SwapIn();
71  }
73  vector< Unit* >possibilities;
74  Unit *primary;
75  if (pendingjump[kk]->final_location.i == 0
76  && pendingjump[kk]->final_location.j == 0
77  && pendingjump[kk]->final_location.k == 0)
78  for (un_iter iter = pendingjump[kk]->dest->getUnitList().createIterator(); (primary = *iter); ++iter) {
79  vector< Unit* >tmp;
80  tmp = ComparePrimaries( primary, pendingjump[kk]->orig );
81  if ( !tmp.empty() )
82  possibilities.insert( possibilities.end(), tmp.begin(), tmp.end() );
83  }
84  else
85  this->SetCurPosition( pendingjump[kk]->final_location );
86  if ( !possibilities.empty() ) {
87  static int jumpdest = 235034;
88  Unit *jumpnode = possibilities[jumpdest%possibilities.size()];
89  QVector pos = jumpnode->Position();
90 
91  this->SetCurPosition( pos );
92  ActivateAnimation( jumpnode );
93  if (jumpnode->isUnit() == UNITPTR) {
94  QVector Offset( pos.i < 0 ? 1 : -1,
95  pos.j < 0 ? 1 : -1,
96  pos.k < 0 ? 1 : -1 );
97  Offset *= jumpnode->rSize()*2+this->rSize()*2;
98  this->SetPosAndCumPos( pos+Offset );
99  if (is_null( jumpnode->location[Unit::UNIT_ONLY] ) == false
100  && is_null( jumpnode->location[Unit::UNIT_BOLT] ) == false)
101  this->UpdateCollideQueue( pendingjump[kk]->dest, jumpnode->location );
102  }
103  jumpdest += 23231;
104  }
105  Unit *tester;
106  for (unsigned int jjj = 0; jjj < 2; ++jjj)
108  (tester = *i) != NULL; ++i)
109  if (tester->isUnit() == UNITPTR && tester != this)
110  if ( ( this->LocalPosition()-tester->LocalPosition() ).Magnitude() < this->rSize()+tester->rSize() )
111  SetCurPosition( this->LocalPosition()+this->cumulative_transformation_matrix.getR()
112  *( 4*( this->rSize()+tester->rSize() ) ) );
113  DealPossibleJumpDamage( this );
114  static int jumparrive = AUDCreateSound( vs_config->getVariable( "unitaudio", "jumparrive", "sfx43.wav" ), false );
115  if (dosightandsound)
116  AUDPlay( jumparrive, this->LocalPosition(), this->GetVelocity(), 1 );
117  } else {
118 #ifdef JUMP_DEBUG
119  VSFileSystem::vs_fprintf( stderr, "Unit FAILED remove from star system\n" );
120 #endif
121  }
122  if (this->docked&UnitType::DOCKING_UNITS)
123  for (unsigned int i = 0; i < this->pImage->dockedunits.size(); i++) {
124  Unit *unut;
125  if ( NULL != ( unut = this->pImage->dockedunits[i]->uc.GetUnit() ) )
126  unut->TransferUnitToSystem( kk, savedStarSystem, dosightandsound );
127  }
128  if ( this->docked&(UnitType::DOCKED|UnitType::DOCKED_INSIDE) ) {
129  Unit *un = this->pImage->DockedTo.GetUnit();
130  if (!un) {
131  this->docked &= ( ~(UnitType::DOCKED|UnitType::DOCKED_INSIDE) );
132  } else {
133  Unit *targ = NULL;
134  for (un_iter i = pendingjump[kk]->dest->getUnitList().createIterator();
135  ( targ = (*i) );
136  ++i)
137  if (targ == un)
138  break;
139  if (targ != un)
140  this->UnDock( un );
141  }
142  }
143  } else {
144  VSFileSystem::vs_fprintf( stderr, "Already jumped\n" );
145  }
146  return ret;
147 }
template<class UnitType >
void GameUnit< UnitType >::UpdateHudMatrix ( int  whichcam)

Sets the camera to be within this unit.

Definition at line 200 of file unit.cpp.

References _Universe, Universe::AccessCamera(), Matrix::getQ(), Matrix::getR(), q, Camera::SetOrientation(), Camera::SetPosition(), Transform(), and Vector.

201 {
202  Matrix m;
203  Matrix ctm = this->cumulative_transformation_matrix;
204  Vector q( ctm.getQ() );
205  Vector r( ctm.getR() );
206  Vector tmp;
207  CrossProduct( r, q, tmp );
208  _Universe->AccessCamera( whichcam )->SetOrientation( tmp, q, r );
209 
210  _Universe->AccessCamera( whichcam )->SetPosition( Transform( ctm,
211  this->pImage->CockpitCenter.Cast() ),
212  this->GetWarpVelocity(), this->GetAngularVelocity(), this->GetAcceleration() );
213 }
template<class UnitType >
void GameUnit< UnitType >::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

returns true if jump possible even if not taken

Updates physics given unit space transformations and if this is the last physics frame in the current gfx frame

Reimplemented in GameMissile, GameBuilding, GameAsteroid, and GameNebula.

Definition at line 49 of file unit_physics.h.

References _Universe, blah, c, Transformation::from_matrix(), i, NetClient::Interpolate(), MatrixToVectors(), Network, UniverseUtil::networked(), q, queryTime(), NetClient::sendPosition(), SIMULATION_ATOM, TransformNormal(), Vector, and Universe::whichPlayerStarship().

Referenced by GameAsteroid::UpdatePhysics2(), GameNebula::UpdatePhysics2(), GameBuilding::UpdatePhysics2(), and GameMissile::UpdatePhysics2().

57 {
58  int player = -1;
59 
60  UnitType::UpdatePhysics2( trans, old_physical_state, accel, difficulty, transmat, cum_vel, lastframe, uc );
61  //Here send (new position + direction = curr_physical_state.position and .orientation)
62  //+ speed to server (which velocity is to consider ?)
63  //+ maybe Angular velocity to anticipate rotations in the other network clients
64  if (Network != NULL) {
65  //Check if this is a player, because in network mode we should only send updates of our moves
66  player = _Universe->whichPlayerStarship( this );
67  if (player >= 0 /* && this->networked */) {
68  if ( Network[0].isTime() ) {
69  /* If you're going to send an alive message, you might as well send your position while you're at it. */
70  ClientState cstmp( this->serial, this->curr_physical_state, this->Velocity, accel, this->AngularVelocity, 0 );
71  Network[player].sendPosition( &cstmp );
72  }
73  this->AddVelocity( difficulty );
74  } else {
75  //Not a player so update the unit's position and stuff with the last received snapshot from the server
76  //This may be be a bot or a unit controlled by the server
77  if (!this->networked) {
78  //Case it is a local unit
79  this->AddVelocity( difficulty );
80  } else {
81  //Networked unit so interpolate its position
82  this->AddVelocity( difficulty );
83 
84  this->curr_physical_state = Network[0].Interpolate( this, SIMULATION_ATOM );
85  }
86  }
87  } else {
88  this->AddVelocity( difficulty );
89  }
90 #ifdef DEPRECATEDPLANETSTUFF
91  if (planet) {
92  Matrix basis;
93  curr_physical_state.to_matrix( this->cumulative_transformation_matrix );
94  Vector p, q, r, c;
95  MatrixToVectors( this->cumulative_transformation_matrix, p, q, r, c );
96  planet->trans->InvTransformBasis( this->cumulative_transformation_matrix, p, q, r, c );
97  planet->cps = Transformation::from_matrix( this->cumulative_transformation_matrix );
98  }
99 #endif
100  this->cumulative_transformation = this->curr_physical_state;
101  this->cumulative_transformation.Compose( trans, transmat );
102  this->cumulative_transformation.to_matrix( this->cumulative_transformation_matrix );
103  this->cumulative_velocity = TransformNormal( transmat, this->Velocity )+cum_vel;
104  unsigned int i;
105  if (lastframe) {
106  char tmp = 0;
107  double blah = queryTime();
108  for (i = 0; i < this->meshdata.size(); i++) {
109  if (!this->meshdata[i])
110  continue;
111  tmp |= this->meshdata[i]->HasBeenDrawn();
112  if ( !this->meshdata[i]->HasBeenDrawn() )
113  this->meshdata[i]->UpdateFX( SIMULATION_ATOM );
114  this->meshdata[i]->UnDraw();
115  }
116  double blah1 = queryTime();
117  if (!tmp && this->hull < 0)
118  Explode( false, SIMULATION_ATOM );
119  double blah2 = queryTime();
120  }
121 }
template<class UnitType >
double GameUnit< UnitType >::Upgrade ( const std::string &  file,
int  mountoffset,
int  subunitoffset,
bool  force,
bool  loop_through_mounts 
)

Definition at line 42 of file unit_customize.h.

References Unit::Upgrade().

47 {
48  return Unit::Upgrade( file, mountoffset, subunitoffset, force, loop_through_mounts );
49 }
template<class UnitType >
void GameUnit< UnitType >::UpgradeInterface ( Unit base)

Loads a user interface for the user to upgrade his ship.

Definition at line 120 of file unit.cpp.

References getCargoUnitName(), Unit::getFullname(), Unit::isUnit(), BaseUtil::LoadBaseInterfaceAtDock(), Unit::name, and PLANETPTR.

121 {
122  string basename = ( ::getCargoUnitName( baseun->getFullname().c_str() ) );
123  if (baseun->isUnit() != PLANETPTR)
124  basename = baseun->name;
125  BaseUtil::LoadBaseInterfaceAtDock( basename, baseun, this );
126 }
template<class UnitType >
bool GameUnit< UnitType >::UpgradeSubUnits ( const Unit up,
int  subunitoffset,
bool  touchme,
bool  downgrade,
int numave,
double &  percentage 
)

Definition at line 26 of file unit_customize.h.

References CreateGameTurret(), UnitCollection::empty(), and Unit::SubUnits.

32 {
33  bool bl = this->UpgradeSubUnitsWithFactory( up, subunitoffset, touchme, downgrade, numave, percentage, &CreateGameTurret );
34  if ( !up->SubUnits.empty() )
35  this->DisableTurretAI();
36  return bl;
37 }
template<class UnitType >
Matrix GameUnit< UnitType >::WarpMatrix ( const Matrix ctm) const

Holds temporary values for inter-function XML communication Saves deprecated restr info.

Definition at line 658 of file unit.cpp.

References VegaConfig::getVariable(), k, StarSystemGent::maxspeed, XMLSupport::parse_bool(), XMLSupport::parse_float(), ScaleMatrix(), speed, Vector, and vs_config.

Referenced by GameUnit< UnitType >::Draw(), and GameUnit< UnitType >::DrawNow().

659 {
660  static float cutoff =
661  XMLSupport::parse_float( vs_config->getVariable( "graphics", "warp_stretch_cutoff",
662  "50000" ) )*XMLSupport::parse_float(
663  vs_config->getVariable( "physics", "game_speed", "1" ) );
664  static float cutoffcutoff = cutoff*cutoff;
665  static bool only_stretch_in_warp =
666  XMLSupport::parse_bool( vs_config->getVariable( "graphics", "only_stretch_in_warp", "true" ) );
667  if ( this->GetWarpVelocity().MagnitudeSquared() < cutoffcutoff
668  || (only_stretch_in_warp && this->graphicOptions.InWarp == 0) ) {
669  return ctm;
670  } else {
671  Matrix k( ctm );
672 
673  float speed = this->GetWarpVelocity().Magnitude();
674  static float maxregion0stretch =
675  XMLSupport::parse_float( vs_config->getVariable( "graphics", "warp_stretch_region0_max", "1" ) );
676 
677  static float maxstretch = XMLSupport::parse_float( vs_config->getVariable( "graphics", "warp_stretch_max", "4" ) );
678  static float maxspeed =
679  XMLSupport::parse_float( vs_config->getVariable( "graphics", "warp_stretch_max_speed",
680  "1000000" ) )
681  *XMLSupport::parse_float( vs_config->getVariable( "physics", "game_speed", "1" ) );
682  static float maxregion0speed =
683  XMLSupport::parse_float( vs_config->getVariable( "graphics", "warp_stretch_max_region0_speed",
684  "100000" ) )
685  *XMLSupport::parse_float( vs_config->getVariable( "physics", "game_speed", "1" ) );
686  float stretchregion0length = maxregion0stretch*(speed-cutoff)/(maxregion0speed-cutoff);
687  float stretchlength =
688  (maxstretch
689  -maxregion0stretch)*(speed-maxregion0speed)/(maxspeed-maxregion0speed+.06125)+maxregion0stretch;
690  if (stretchlength > maxstretch)
691  stretchlength = maxstretch;
692  if (stretchregion0length > maxregion0stretch)
693  stretchregion0length = maxregion0stretch;
694  ScaleMatrix( k, Vector( 1, 1, 1+(speed > maxregion0speed ? stretchlength : stretchregion0length) ) );
695  return k;
696  }
697 }

Friends And Related Function Documentation

template<class UnitType>
friend class UnitFactory
friend

Definition at line 60 of file unit.h.

Member Data Documentation

template<class UnitType>
std::auto_ptr< HaloSystem > GameUnit< UnitType >::phalos
template<class UnitType>
double GameUnit< UnitType >::sparkle_accum

Definition at line 89 of file unit.h.

Referenced by GameUnit< UnitType >::Draw().


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