SuperTuxKart
Loading...
Searching...
No Matches
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>
26using namespace irr;
27
28#include "items/flyable.hpp"
29
30class AbstractKart;
31class PhysicalObject;
32class RubberBand;
33class XMLNode;
34
38class Plunger : public Flyable
39{
40private:
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
51public:
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
An abstract interface for the actual karts.
Definition: abstract_kart.hpp:62
Describes a chain of 8-bit unsigned integers.
Definition: network_string.hpp:53
Definition: flyable.hpp:50
A small interface for effects to be used when a kart is hit.
Definition: hit_effect.hpp:33
Definition: physical_object.hpp:40
Definition: plunger.hpp:39
virtual HitEffect * getHitEffect() const OVERRIDE
No hit effect when it ends.
Definition: plunger.hpp:68
int16_t m_keep_alive
Ticks to keep the plunger alive while the rubber band is working.
Definition: plunger.hpp:45
virtual bool hit(AbstractKart *kart, PhysicalObject *obj=NULL) OVERRIDE
Virtual function called when the plunger hits something.
Definition: plunger.cpp:194
virtual BareNetworkString * saveState(std::vector< std::string > *ru) OVERRIDE
Provides a copy of the state of the object in one memory buffer.
Definition: plunger.cpp:257
virtual bool updateAndDelete(int ticks) OVERRIDE
Updates the plunger in each frame.
Definition: plunger.cpp:162
RubberBand * m_rubber_band
The rubber band attached to a plunger.
Definition: plunger.hpp:42
void updateGraphics(float dt) OVERRIDE
Called once per rendered frame.
Definition: plunger.cpp:142
virtual void hitTrack() OVERRIDE
Called when the plunger hits the track.
Definition: plunger.cpp:249
virtual void onFireFlyable() OVERRIDE
Call when the item is (re-)fired (during rewind if needed) by projectile_manager.
Definition: plunger.cpp:59
void setKeepAlive(int16_t ticks)
Sets the keep-alive value.
Definition: plunger.hpp:65
virtual void restoreState(BareNetworkString *buffer, int count) OVERRIDE
Called when a state needs to be replayed.
Definition: plunger.cpp:272
This class is used together with the pluger to display a rubber band from the shooting kart to the pl...
Definition: rubber_band.hpp:49
utility class used to parse XML files
Definition: xml_node.hpp:48