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
beam.h
Go to the documentation of this file.
1 #ifndef _CMD_BEAM_H_
2 #define _CMD_BEAM_H_
3 #include "weapon_xml.h"
4 #include "gfx/mesh.h"
5 #include "unit_collide.h"
6 #include "gfx/matrix.h"
7 #include "gfx/quaternion.h"
8 #include <vector>
9 class GFXVertexList;
10 class Texture;
11 struct GFXColor;
12 using std::vector;
13 
14 class Beam
15 {
16 private:
17  int sound;
18  Transformation local_transformation;
19  unsigned int decal;
20  GFXVertexList *vlist;
21  LineCollide CollideInfo;
22 
23  unsigned int numframes;
24  float speed; //lite speed
25  float texturespeed;
26  float curlength;
27  float range;
28  float radialspeed;
29  float curthick;
30  float thickness;
31  float lastthick;
32  float lastlength;
33  float stability;
34  float damagerate;
35  float phasedamage;
36  float rangepenalty;
37  float refire;
38  float refiretime;
39  float texturestretch;
40  GFXColor Col;
41  enum Impact
42  {
43  ALIVE =0,
44  IMPACT =1,
45  UNSTABLE=2,
46  IMPACTANDUNSTABLE=3
47  }; //is it right now blowing the enemy to smitheri
48  unsigned char impact;
49  bool listen_to_owner;
50  void *owner; //may be a dead pointer...never dereferenced
51  QVector center; //in world coordinates as of last physics frame...
52  Vector direction;
53 
54  void RecalculateVertices( const Matrix &trans );
55  void CollideHuge( const LineCollide&, Unit *targetToCollideWith, Unit *firer, Unit *superunit );
56 public:
57  void ListenToOwner( bool listen )
58  {
59  listen_to_owner = listen;
60  }
61  Beam( const Transformation &trans, const weapon_info &clne, void *own, Unit *firer, int sound );
62  void Init( const Transformation &trans, const weapon_info &clne, void *own, Unit *firer );
63  ~Beam();
64  void RemoveFromSystem( bool eradicate );
65  float refireTime();
67  {
68  return local_transformation.position;
69  }
70  void SetPosition( const QVector& );
71  void SetOrientation( const Vector &p, const Vector &q, const Vector &r );
72  void UpdatePhysics( const Transformation &,
73  const Matrix &,
74  class Unit*target,
75  float trackingcone,
76  Unit*targetToCollideWith /*prevent AI friendly fire--speed up app*/,
77  float HeatSink,
78  Unit*firer,
79  Unit*superunit );
80  void Draw( const Transformation &, const Matrix &, class Unit*target, float trackingcone );
81  void Destabilize()
82  {
83  impact = UNSTABLE;
84  }
85  bool Dissolved()
86  {
87  return curthick == 0;
88  }
89  bool Ready()
90  {
91  return curthick == 0 && refiretime > refire;
92  }
93  bool Collide( class Unit*target, Unit*firer, Unit*superunit /*for cargo*/ );
94  static void ProcessDrawQueue();
95 };
96 #endif
97