SuperTuxKart
Loading...
Searching...
No Matches
cutscene_world.hpp
1//
2// SuperTuxKart - a fun racing game with go-kart
3// Copyright (C) 2004-2015 SuperTuxKart-Team
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 CUTSCENE_WORLD_HPP
20#define CUTSCENE_WORLD_HPP
21
22#include "modes/world_with_rank.hpp"
23#include "states_screens/race_gui_base.hpp"
24
25namespace irr
26{
27 namespace scene { class ICameraSceneNode; }
28}
29
30
31#include <string>
32
33class TrackObject;
34
39class CutsceneWorld : public World
40{
41 irr::scene::ICameraSceneNode* m_camera;
42
43 std::map<float, std::vector<TrackObject*> > m_sounds_to_trigger;
44 std::map<float, std::vector<TrackObject*> > m_sounds_to_stop;
45 std::map<float, std::vector<TrackObject*> > m_particles_to_trigger;
46
47 double m_duration;
48 bool m_aborted;
49 bool m_cleared_cutscene;
50
51 float m_fade_duration;
52
53 // TODO find a better way than static
54 static bool s_use_duration;
55
60 double m_time_at_second_reset;
61
62 std::vector<std::string> m_parts;
63
64 void clearCutscene();
65public:
66
68 virtual ~CutsceneWorld();
69
70 virtual void init() OVERRIDE;
71
72 virtual void reset(bool restart=false) OVERRIDE;
73
74 // clock events
75 virtual bool isRaceOver() OVERRIDE;
76
77 virtual const std::string& getIdent() const OVERRIDE;
78
79 virtual void update(int ticks) OVERRIDE;
80
81 virtual void createRaceGUI() OVERRIDE;
82
83 virtual void enterRaceOverState() OVERRIDE;
84
85 // ------------------------------------------------------------------------
86 virtual bool raceHasLaps() OVERRIDE { return false; }
87 // ------------------------------------------------------------------------
88 virtual unsigned int getNumberOfRescuePositions() const OVERRIDE
89 {
90 return 0;
91 } // getNumberOfRescuePositions
92 // ------------------------------------------------------------------------
93 virtual unsigned int getRescuePositionIndex(AbstractKart *kart) OVERRIDE
94 {
95 return 0;
96 } // getRescuePositionIndex
97 // ------------------------------------------------------------------------
98 virtual btTransform getRescueTransform(unsigned int index) const OVERRIDE
99 {
100 return btTransform();
101 } // getRescueTransform
102 // ------------------------------------------------------------------------
103 virtual void onFirePressed(Controller* who) OVERRIDE { abortCutscene(); }
104 // ------------------------------------------------------------------------
105 void setParts(std::vector<std::string> parts) { m_parts = parts; }
106 // ------------------------------------------------------------------------
110 std::vector<RaceGUIBase::KartIconDisplayInfo> *info) OVERRIDE
111 {
112 };
113 // ------------------------------------------------------------------------
114 virtual void escapePressed() OVERRIDE { abortCutscene(); }
115 // ------------------------------------------------------------------------
116 static void setUseDuration(bool use_duration) { s_use_duration = use_duration; }
117 // ------------------------------------------------------------------------
118 void abortCutscene() { m_aborted = true; }
119
120}; // CutsceneWorld
121
122
123#endif
An abstract interface for the actual karts.
Definition: abstract_kart.hpp:62
This is the base class for kart controller - that can be a player or a a robot.
Definition: controller.hpp:46
An implementation of World, to provide animated 3D cutscenes.
Definition: cutscene_world.hpp:40
virtual void update(int ticks) OVERRIDE
Update the world and the track.
Definition: cutscene_world.cpp:201
virtual const std::string & getIdent() const OVERRIDE
Returns the internal identifier for this race.
Definition: cutscene_world.cpp:192
virtual void getKartsDisplayInfo(std::vector< RaceGUIBase::KartIconDisplayInfo > *info) OVERRIDE
Returns the data to display in the race gui.
Definition: cutscene_world.hpp:109
bool m_second_reset
monkey tricks to get the animations in sync with irrlicht.
Definition: cutscene_world.hpp:59
virtual void init() OVERRIDE
Initialises the three strikes battle.
Definition: cutscene_world.cpp:76
virtual bool isRaceOver() OVERRIDE
The battle is over if only one kart is left, or no player kart.
Definition: cutscene_world.cpp:632
virtual void onFirePressed(Controller *who) OVERRIDE
Override if you want to know when a kart presses fire.
Definition: cutscene_world.hpp:103
virtual void enterRaceOverState() OVERRIDE
Called when the race is finished, but it still leaves some time for an end of race animation,...
Definition: cutscene_world.cpp:429
virtual unsigned int getNumberOfRescuePositions() const OVERRIDE
Returns the number of rescue positions on a given track and game mode.
Definition: cutscene_world.hpp:88
virtual bool raceHasLaps() OVERRIDE
Called when it is needed to know whether this kind of race involves counting laps.
Definition: cutscene_world.hpp:86
virtual btTransform getRescueTransform(unsigned int index) const OVERRIDE
Returns the bullet transformation for the specified rescue index.
Definition: cutscene_world.hpp:98
CutsceneWorld()
Constructor.
Definition: cutscene_world.cpp:58
virtual unsigned int getRescuePositionIndex(AbstractKart *kart) OVERRIDE
Determines the rescue position index of the specified kart.
Definition: cutscene_world.hpp:93
virtual ~CutsceneWorld()
Destructor.
Definition: cutscene_world.cpp:178
virtual void reset(bool restart=false) OVERRIDE
This function is called before a race is started (i.e.
Definition: cutscene_world.cpp:184
This is a base object for any separate object on the track, which might also have a skeletal animatio...
Definition: track_object.hpp:56
base class for all game modes This class is responsible for running the actual race.
Definition: world.hpp:88