SuperTuxKart
referee.hpp
1 //
2 // SuperTuxKart - a fun racing game with go-kart
3 // Copyright (C) 2011-2015 Joerg Henrichs
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 3
8 // of the License, or (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 
19 #ifndef HEADER_REFEREE_HPP
20 #define HEADER_REFEREE_HPP
21 
22 namespace irr
23 {
24  namespace scene
25  {
26  class IAnimatedMesh; class IAnimatedMeshSceneNode; class ISceneNode;
27  }
28  namespace video
29  {
30  class ITexture;
31  }
32 }
33 
34 using namespace irr;
35 
36 #include "utils/vec3.hpp"
37 
38 class AbstractKart;
39 
52 class Referee
53 {
54 private:
57  static scene::IAnimatedMesh *m_st_referee_mesh;
58 
60  static video::ITexture *m_st_traffic_lights[3];
61 
63  static int m_st_traffic_buffer;
64 
67 
70 
73 
76 
80 
82  static Vec3 m_st_scale;
83 
86 
87  static float m_height;
88 
90  scene::IAnimatedMeshSceneNode *m_scene_node;
91 
92  scene::ISceneNode* m_light;
93 
94 public:
95  Referee();
96  Referee(const AbstractKart &kart);
97  ~Referee();
98  void selectReadySetGo(int rsg);
99  void attachToSceneNode();
100  static void init();
101  static void cleanup();
102  void removeFromSceneGraph();
103  // ------------------------------------------------------------------------
105  scene::IAnimatedMeshSceneNode* getSceneNode() { return m_scene_node; }
106  // ------------------------------------------------------------------------
107  void setPosition(const Vec3 &xyz);
108  // ------------------------------------------------------------------------
109  void setRotation(const Vec3 &hpr);
110  // ------------------------------------------------------------------------
111  bool isAttached() const;
112  // ------------------------------------------------------------------------
113  void setAnimationFrameWithCreatedTicks(int created_ticks);
114  // ------------------------------------------------------------------------
117  static const Vec3& getStartOffset() {return m_st_start_offset; }
118  // ------------------------------------------------------------------------
121  static const Vec3& getStartRotation() {return m_st_start_rotation; }
122  // ------------------------------------------------------------------------
124  static const float getHeight() {return m_height; }
125 }; // Referee
126 
127 #endif
128 
129 /* EOF */
An abstract interface for the actual karts.
Definition: abstract_kart.hpp:62
This implements the referee, a character that is displayed at the start of the race holding a 'ready-...
Definition: referee.hpp:53
static int m_st_traffic_buffer
Which mesh buffer to use to show the traffic light texture.
Definition: referee.hpp:63
static const float getHeight()
Returns the height of the referee.
Definition: referee.hpp:124
static int m_st_last_rescue_frame
End frame of rescue animation.
Definition: referee.hpp:75
static Vec3 m_st_start_rotation
A rotation to be applied to the referee before displaying it.
Definition: referee.hpp:85
static const Vec3 & getStartOffset()
Returns the graphical offset the referee should be drawn at at the start of a race.
Definition: referee.hpp:117
static scene::IAnimatedMesh * m_st_referee_mesh
The static mesh, which is loaded from a static function and shared between all instances.
Definition: referee.hpp:57
static int m_st_first_rescue_frame
Start frame of rescue animation.
Definition: referee.hpp:72
static int m_st_last_start_frame
End frame of start animation.
Definition: referee.hpp:69
static int m_st_first_start_frame
Start frame of start animation.
Definition: referee.hpp:66
static Vec3 m_st_scale
Scaling to be applied to the referee.
Definition: referee.hpp:82
static const Vec3 & getStartRotation()
Returns the rotation of the mesh so that it faces the kart (when applied to a kart with heading 0).
Definition: referee.hpp:121
static Vec3 m_st_start_offset
The position the referee should be shown relative to the kart when starting the race.
Definition: referee.hpp:79
scene::IAnimatedMeshSceneNode * m_scene_node
The scene node for an instance of the referee.
Definition: referee.hpp:90
scene::IAnimatedMeshSceneNode * getSceneNode()
Returns the scene node of this referee.
Definition: referee.hpp:105
A wrapper around bullets btVector3 to include conventient conversion functions (e....
Definition: vec3.hpp:35