SuperTuxKart
plunger.hpp
1 //
2 // SuperTuxKart - a fun racing game with go-kart
3 // Copyright (C) 2007-2015 Joerg Henrichs
4 //
5 // Physics improvements and linear intersection algorithm by
6 // Copyright (C) 2009-2015 David Mikos.
7 //
8 // This program is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU General Public License
10 // as published by the Free Software Foundation; either version 3
11 // of the License, or (at your option) any later version.
12 //
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
17 //
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the Free Software
20 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 
22 #ifndef HEADER_MISSILE_HPP
23 #define HEADER_MISSILE_HPP
24 
25 #include <irrString.h>
26 using namespace irr;
27 
28 #include "items/flyable.hpp"
29 
30 class AbstractKart;
31 class PhysicalObject;
32 class RubberBand;
33 class XMLNode;
34 
38 class Plunger : public Flyable
39 {
40 private:
43 
45  int16_t m_keep_alive;
46 
47  btVector3 m_initial_velocity;
48 
49  bool m_reverse_mode, m_has_locally_played_sound, m_moved_to_infinity;
50 
51 public:
52  Plunger(AbstractKart *kart);
53  ~Plunger();
54  static void init(const XMLNode &node, scene::IMesh* missile);
55  virtual bool updateAndDelete(int ticks) OVERRIDE;
56  virtual void hitTrack () OVERRIDE;
57  virtual bool hit (AbstractKart *kart, PhysicalObject *obj=NULL)
58  OVERRIDE;
59  // ------------------------------------------------------------------------
60  void updateGraphics(float dt) OVERRIDE;
61  // ------------------------------------------------------------------------
65  void setKeepAlive(int16_t ticks) { m_keep_alive = ticks; }
66  // ------------------------------------------------------------------------
68  virtual HitEffect *getHitEffect() const OVERRIDE { return NULL; }
69  // ------------------------------------------------------------------------
70  virtual BareNetworkString* saveState(std::vector<std::string>* ru)
71  OVERRIDE;
72  // ------------------------------------------------------------------------
73  virtual void restoreState(BareNetworkString *buffer, int count) OVERRIDE;
74  // ------------------------------------------------------------------------
75  virtual void onFireFlyable() OVERRIDE;
76  // ------------------------------------------------------------------------
77  virtual void onDeleteFlyable() OVERRIDE;
78 
79 }; // Plunger
80 
81 #endif
int16_t m_keep_alive
Ticks to keep the plunger alive while the rubber band is working.
Definition: plunger.hpp:45
A small interface for effects to be used when a kart is hit.
Definition: hit_effect.hpp:32
virtual HitEffect * getHitEffect() const OVERRIDE
No hit effect when it ends.
Definition: plunger.hpp:68
Definition: physical_object.hpp:40
RubberBand * m_rubber_band
The rubber band attached to a plunger.
Definition: plunger.hpp:42
Definition: plunger.hpp:38
Describes a chain of 8-bit unsigned integers.
Definition: network_string.hpp:52
utility class used to parse XML files
Definition: xml_node.hpp:47
Definition: flyable.hpp:47
An abstract interface for the actual karts.
Definition: abstract_kart.hpp:61
This class is used together with the pluger to display a rubber band from the shooting kart to the pl...
Definition: rubber_band.hpp:40