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
star_system_jump.cpp File Reference
#include "vegastrike.h"
#include "star_system.h"
#include "cmd/planet.h"
#include "lin_time.h"
#include "hashtable.h"
#include "gfx/animation.h"
#include "vs_globals.h"
#include "config_xml.h"
#include "cmd/container.h"
#include "xml_support.h"
#include <assert.h>
#include "gfx/cockpit.h"
#include "audiolib.h"
#include "cmd/images.h"
#include "cmd/script/flightgroup.h"
#include <string>
#include <vector>
#include "options.h"

Go to the source code of this file.

Classes

class  ResizeAni
 

Functions

void CacheJumpStar (bool destroy)
 
AnimationGetVolatileAni (unsigned int which)
 
unsigned int AddAnimation (const QVector &pos, const float size, bool mvolatile, const std::string &name, float percentgrow)
 
static unsigned int AddJumpAnimation (const QVector &pos, const float size, bool mvolatile=false)
 

Variables

vs_options game_options
 
std::vector< unorigdest * > pendingjump
 
static std::vector< unsigned intAnimationNulls
 
static std::vector< ResizeAniJumpAnimations
 
static std::vector< ResizeAniVolatileJumpAnimations
 

Function Documentation

unsigned int AddAnimation ( const QVector pos,
const float  size,
bool  mvolatile,
const std::string &  name,
float  percentgrow 
)

Definition at line 52 of file star_system_jump.cpp.

References AnimationNulls, i, JumpAnimations, MIPMAP, and VolatileJumpAnimations.

53 {
54  std::vector< ResizeAni > *ja = mvolatile ? &VolatileJumpAnimations : &JumpAnimations;
55 
56  Animation *ani = new Animation( name.c_str(), true, .1, MIPMAP, false );
57  unsigned int i;
58  if ( mvolatile || AnimationNulls.empty() ) {
59  i = ja->size();
60  ja->push_back( ResizeAni( ani, percentgrow ) );
61  } else {
62  assert( JumpAnimations[AnimationNulls.back()].a == NULL );
63  JumpAnimations[AnimationNulls.back()] = ResizeAni( ani, percentgrow );
64  i = AnimationNulls.back();
65  AnimationNulls.pop_back();
66  }
67  (*ja)[i].a->SetDimensions( size, size );
68  (*ja)[i].a->SetPosition( pos );
69  return i;
70 }
static unsigned int AddJumpAnimation ( const QVector pos,
const float  size,
bool  mvolatile = false 
)
static

Definition at line 72 of file star_system_jump.cpp.

References AddAnimation(), and vs_options::jumpgate.

Referenced by GameStarSystem::DoJumpingComeSightAndSound(), and GameStarSystem::DoJumpingLeaveSightAndSound().

73 {
74  return AddAnimation( pos, size, mvolatile, game_options.jumpgate, .95 );
75 }
void CacheJumpStar ( bool  destroy)

Definition at line 23 of file star_system_jump.cpp.

References vs_options::jumpgate, and MIPMAP.

Referenced by GameUniverse::Init().

24 {
25  static Animation *cachedani = new Animation( game_options.jumpgate.c_str(), true, .1, MIPMAP, false );
26  if (destroy)
27  delete cachedani;
28 }
Animation* GetVolatileAni ( unsigned int  which)

Definition at line 45 of file star_system_jump.cpp.

References a, and VolatileJumpAnimations.

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

46 {
47  if ( which < VolatileJumpAnimations.size() )
48  return VolatileJumpAnimations[which].a;
49  return NULL;
50 }

Variable Documentation

std::vector< unsigned int > AnimationNulls
static

Definition at line 31 of file star_system_jump.cpp.

Referenced by AddAnimation(), and GameStarSystem::VolitalizeJumpAnimation().

vs_options game_options

Draws cockpit parts Draws gauges, info strings, radar, ...

Definition at line 83 of file main.cpp.

std::vector< ResizeAni > JumpAnimations
static
std::vector< unorigdest* > pendingjump