SuperTuxKart
Loading...
Searching...
No Matches
feature_unlocked.hpp
1//
2// SuperTuxKart - a fun racing game with go-kart
3// Copyright (C) 2010-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 HEADER_FEATURE_UNLOCKED_HPP
20#define HEADER_FEATURE_UNLOCKED_HPP
21
22#include "graphics/irr_driver.hpp"
23#include "guiengine/screen.hpp"
24#include "race/race_manager.hpp"
25#include "utils/ptr_vector.hpp"
26
27#include <memory>
28
29namespace irr {
30 namespace scene { class ISceneNode; class ICameraSceneNode;
31 class ILightSceneNode; }
32}
33
34namespace SP
35{
36 class SPTexture;
37}
38
39class KartModel;
40class KartProperties;
41class ChallengeData;
42
48 public GUIEngine::ScreenSingleton<FeatureUnlockedCutScene>
49{
51
53
56 {
59
60 std::string m_unlock_model;
61
63 std::vector<irr::video::ITexture*> m_pictures;
64
65 std::vector<std::shared_ptr<SP::SPTexture> > m_sp_pictures;
66
68 float m_w, m_h;
71
73 scene::ISceneNode* m_root_gift_node;
74
75 scene::ISceneNode* m_side_1;
76 scene::ISceneNode* m_side_2;
77
78 float m_scale;
79
80 irr::core::stringw m_unlock_message;
81
82 UnlockedThing(const std::string &model, const irr::core::stringw &msg);
83
84 UnlockedThing(const KartProperties* kart, const irr::core::stringw &msg);
85
92 UnlockedThing(irr::video::ITexture* pict, float w, float h,
93 const irr::core::stringw &msg);
94
101 UnlockedThing(std::vector<irr::video::ITexture*> picts, float w, float h,
102 const irr::core::stringw &msg);
103
105 };
106
109
112
115
118
121
122 void continueButtonPressed();
123
124public:
125
126 virtual void onCutsceneEnd() OVERRIDE;
127
129 void onUpdate(float dt) OVERRIDE;
130
132 virtual void loadedFromFile() OVERRIDE;
133
135 void init() OVERRIDE;
136
138 void tearDown() OVERRIDE;
139
140 void eventCallback(GUIEngine::Widget* widget, const std::string& name,
141 const int playerID) OVERRIDE;
142
143 void findWhatWasUnlocked(RaceManager::Difficulty difficulty,
144 std::vector<const ChallengeData*>& unlocked);
145
149 void addUnlockedKart(const KartProperties* unlocked_kart);
150
154 void addUnlockedPicture(irr::video::ITexture* picture, float w, float h,
155 const irr::core::stringw &msg);
156
160 void addUnlockedPictures(std::vector<irr::video::ITexture*> pictures,
161 float w, float h, irr::core::stringw msg);
162
163 void addUnlockedTrack(const Track* track);
164 void addUnlockedGP(const GrandPrixData* gp);
165
168 // unused for now... maybe this could could useful later?
169 /*
170 void addUnlockedThings(const std::vector<const ChallengeData*> unlocked);
171 */
172
173 void addTrophy(RaceManager::Difficulty difficulty, bool is_grandprix);
174
176 virtual bool onEscapePressed() OVERRIDE;
177
178 virtual MusicInformation* getInGameMenuMusic() const OVERRIDE;
179};
180
181#endif
the description of one challenge
Definition: challenge_data.hpp:35
Screen shown when a feature has been unlocked.
Definition: feature_unlocked.hpp:49
void tearDown() OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: feature_unlocked.cpp:483
virtual void loadedFromFile() OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: feature_unlocked.cpp:180
void addUnlockedKart(const KartProperties *unlocked_kart)
Call before showing up the screen to make a kart come out of the chest.
Definition: feature_unlocked.cpp:307
void eventCallback(GUIEngine::Widget *widget, const std::string &name, const int playerID) OVERRIDE
will be called everytime something happens.
Definition: feature_unlocked.cpp:764
void addUnlockedPicture(irr::video::ITexture *picture, float w, float h, const irr::core::stringw &msg)
Call before showing up the screen to make a picture come out of the chest 'addUnlockedThings' will in...
Definition: feature_unlocked.cpp:321
virtual bool onEscapePressed() OVERRIDE
override from base class to handle escape press
Definition: feature_unlocked.cpp:735
void init() OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: feature_unlocked.cpp:351
virtual MusicInformation * getInGameMenuMusic() const OVERRIDE
Definition: feature_unlocked.cpp:776
void addUnlockedPictures(std::vector< irr::video::ITexture * > pictures, float w, float h, irr::core::stringw msg)
Call before showing up the screen to make a picture slideshow come out of the chest 'addUnlockedThing...
Definition: feature_unlocked.cpp:341
PtrVector< KartModel > m_all_kart_models
To store the copy of the KartModel for each unlocked kart.
Definition: feature_unlocked.hpp:111
float m_key_angle
Angle of the key (from 0 to 1, simply traces progression)
Definition: feature_unlocked.hpp:120
void addTrophy(RaceManager::Difficulty difficulty, bool is_grandprix)
Call before showing up the screen to make whatever the passed challenges unlocked come out of the che...
Definition: feature_unlocked.cpp:240
float m_global_time
Global evolution of time.
Definition: feature_unlocked.hpp:114
float m_key_pos
Key position from origin (where the chest is)
Definition: feature_unlocked.hpp:117
PtrVector< UnlockedThing, HOLD > m_unlocked_stuff
The list of all unlocked things.
Definition: feature_unlocked.hpp:108
void onUpdate(float dt) OVERRIDE
implement optional callback from parent class GUIEngine::Screen
Definition: feature_unlocked.cpp:501
Definition: screen.hpp:344
Declares a class to be a singleton.
Definition: screen.hpp:59
Simple class that hold the data relevant to a 'grand_prix', aka.
Definition: grand_prix_data.hpp:36
This class stores a 3D kart model.
Definition: kart_model.hpp:168
This class stores the properties of a kart.
Definition: kart_properties.hpp:60
Wrapper around an instance of the Music interface Adds information like composer, song title,...
Definition: music_information.hpp:43
Definition: ptr_vector.hpp:44
The race manager has two functions: 1) it stores information about the race the user selected (e....
Definition: race_manager.hpp:88
Definition: track.hpp:114
Contains all GUI engine related classes and functions.
Definition: abstract_state_manager.hpp:33
Whichever of these is non-null decides what comes out of the chest.
Definition: feature_unlocked.hpp:56
const KartProperties * m_unlocked_kart
Will be non-null if this unlocked thing is a kart.
Definition: feature_unlocked.hpp:58
float m_w
Will be set if this unlocked thing is a picture.
Definition: feature_unlocked.hpp:68
std::vector< irr::video::ITexture * > m_pictures
Will be non-empty if this unlocked thing is one or many pictures.
Definition: feature_unlocked.hpp:63
scene::ISceneNode * m_root_gift_node
Contains whatever is in the chest.
Definition: feature_unlocked.hpp:73
int m_curr_image
used for slideshows
Definition: feature_unlocked.hpp:70