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
bolt.h
Go to the documentation of this file.
1 #ifndef _CMD_BOLT_H_
2 #define _CMD_BOLT_H_
3 #include "gfxlib.h"
4 #include "gfxlib_struct.h"
5 #include "weapon_xml.h"
6 #include "gfx/matrix.h"
7 #include "gfx/quaternion.h"
8 #include "collide_map.h"
9 class Animation;
10 class Unit;
11 class StarSystem;
12 class bolt_draw ;
13 class Bolt {
14 private:
15  const weapon_info* type;//beam or bolt;
16  Matrix drawmat;
17  QVector cur_position;
18  Vector ShipSpeed;
19  QVector prev_position;//beams don't change heading.
20  void *owner;
21  float curdist;
22  int decal;//which image it uses
23  public:
25  static int AddTexture(bolt_draw *q, std::string filename);
26  static int AddAnimation(bolt_draw *q, std::string filename, QVector cur_position);
27  bool Collide (Unit * target);
28  static bool CollideAnon (Collidable::CollideRef bolt_name, Unit* target);
29  static Bolt * BoltFromIndex(StarSystem* ss,Collidable::CollideRef bolt_name);
30  static Collidable::CollideRef BoltIndex(int index, int decal, bool isBall);
31  bool operator == (const Bolt & b) const{
32 
33  return owner==b.owner
34  &&curdist==b.curdist
35  &&cur_position==b.cur_position
36  &&prev_position==b.prev_position;
37  }
38  Bolt(const weapon_info *type, const Matrix &orientationpos, const Vector & ShipSpeed, void *owner, CollideMap::iterator hint);//makes a bolt
39  void Destroy(unsigned int index);
40  static void Draw();
43  static void UpdatePhysics(StarSystem *ss);//updates all physics in the starsystem
44  void noop()const{}
45 };
46 class bolt_draw {
47 public:
50  vector <std::string> animationname;
51  vector <Animation *> animations;
52  vector <vector <Bolt> > bolts;
53  vector <vector <Bolt> > balls;
54  vector <int> cachedecals;
55  bolt_draw();
56  ~bolt_draw();
57 };
58 
59 #endif