SuperTuxKart
Loading...
Searching...
No Matches
check_cannon.hpp
1//
2// SuperTuxKart - a fun racing game with go-kart
3// Copyright (C) 2012-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_CHECK_CANNON_HPP
20#define HEADER_CHECK_CANNON_HPP
21
22#include "animations/animation_base.hpp"
23#include "tracks/check_line.hpp"
24#include "utils/cpp2011.hpp"
25
26#include <set>
27
28class CheckManager;
29class Flyable;
30class Ipo;
31class ShowCurve;
32class XMLNode;
33
34namespace SP
35{
36 class SPDynamicDrawCall;
37}
38
45class CheckCannon : public CheckLine
46{
47private:
50 Vec3 m_target_right;
51
54
55#if defined(DEBUG) && !defined(SERVER_ONLY)
58 ShowCurve* m_show_curve;
59
61 std::shared_ptr<SP::SPDynamicDrawCall> m_debug_target_dy_dc;
62#endif
63
64 std::set<Flyable*> m_all_flyables;
65public:
66 CheckCannon(const XMLNode &node, unsigned int index);
67 // ------------------------------------------------------------------------
68 virtual ~CheckCannon();
69 // ------------------------------------------------------------------------
70 virtual void trigger(unsigned int kart_index) OVERRIDE {}
71 // ------------------------------------------------------------------------
72 virtual void changeDebugColor(bool is_active) OVERRIDE;
73 // ------------------------------------------------------------------------
74 virtual void update(float dt) OVERRIDE;
75 // ------------------------------------------------------------------------
76 virtual bool triggeringCheckline() const OVERRIDE { return false; }
77 // ------------------------------------------------------------------------
81 void addFlyable(Flyable* flyable) { m_all_flyables.insert(flyable); }
82 // ------------------------------------------------------------------------
86 void removeFlyable(Flyable* flyable) { m_all_flyables.erase(flyable); }
87 // ------------------------------------------------------------------------
88 const Vec3& getTargetLeft() const { return m_target_left; }
89 // ------------------------------------------------------------------------
90 const Vec3& getTargetRight() const { return m_target_right; }
91 // ------------------------------------------------------------------------
92 Ipo* getIpo() const { return m_curve; }
93 // ------------------------------------------------------------------------
94 virtual CheckStructure* clone() OVERRIDE;
95}; // CheckCannon
96
97#endif
98
Implements a simple checkline that will cause a kart or flyable to be shot to a specified point.
Definition: check_cannon.hpp:46
virtual void update(float dt) OVERRIDE
Overriden to also check all flyables registered with the cannon.
Definition: check_cannon.cpp:129
virtual ~CheckCannon()
Destructor, frees the curve data (which the cannon animation objects only have a read-only copy of).
Definition: check_cannon.cpp:98
Ipo * m_curve
Stores the cannon curve data.
Definition: check_cannon.hpp:53
Vec3 m_target_left
The target point the kart will fly to.
Definition: check_cannon.hpp:49
virtual void changeDebugColor(bool is_active) OVERRIDE
Changes the colour of a check cannon depending on state.
Definition: check_cannon.cpp:111
void removeFlyable(Flyable *flyable)
Removes a flyable from the tests if it crosses a checkline.
Definition: check_cannon.hpp:86
virtual void trigger(unsigned int kart_index) OVERRIDE
Is called when this check structure is triggered.
Definition: check_cannon.hpp:70
virtual CheckStructure * clone() OVERRIDE
Clone to child process for server usage (atm no sound or scripting).
Definition: check_cannon.cpp:178
void addFlyable(Flyable *flyable)
Adds a flyable to be tested for crossing a cannon checkline.
Definition: check_cannon.hpp:81
Implements a simple checkline.
Definition: check_line.hpp:50
Controls all checks structures of a track.
Definition: check_manager.hpp:40
Virtual base class for a check structure.
Definition: check_structure.hpp:52
Definition: flyable.hpp:50
A class to manage a single blender IPO curve.
Definition: ipo.hpp:38
This class is used for debugging.
Definition: show_curve.hpp:46
A wrapper around bullets btVector3 to include conventient conversion functions (e....
Definition: vec3.hpp:35
utility class used to parse XML files
Definition: xml_node.hpp:48