2009-10-03 21:16:00 -04:00
|
|
|
#ifndef HEADER_FEATURE_UNLOCKED_HPP
|
|
|
|
#define HEADER_FEATURE_UNLOCKED_HPP
|
|
|
|
|
2010-04-26 10:41:23 -04:00
|
|
|
#include "graphics/irr_driver.hpp"
|
2009-10-04 19:59:05 -04:00
|
|
|
#include "guiengine/screen.hpp"
|
2010-03-01 20:25:29 -05:00
|
|
|
#include "utils/ptr_vector.hpp"
|
2009-10-03 21:16:00 -04:00
|
|
|
|
2009-10-04 16:20:41 -04:00
|
|
|
namespace irr { namespace scene { class ISceneNode; class ICameraSceneNode; class ILightSceneNode; } }
|
2009-12-05 20:30:39 -05:00
|
|
|
class KartProperties;
|
2010-03-08 12:04:05 -05:00
|
|
|
class Challenge;
|
2009-10-03 21:16:00 -04:00
|
|
|
|
2010-04-23 16:48:56 -04:00
|
|
|
/**
|
|
|
|
* \brief Screen shown when a feature has been unlocked
|
|
|
|
* \ingroup states_screens
|
|
|
|
*/
|
2009-10-13 15:14:17 -04:00
|
|
|
class FeatureUnlockedCutScene : public GUIEngine::Screen, public GUIEngine::ScreenSingleton<FeatureUnlockedCutScene>
|
2009-10-03 21:16:00 -04:00
|
|
|
{
|
2009-10-04 19:59:05 -04:00
|
|
|
friend class GUIEngine::ScreenSingleton<FeatureUnlockedCutScene>;
|
|
|
|
|
2009-10-03 21:16:00 -04:00
|
|
|
FeatureUnlockedCutScene();
|
|
|
|
|
2010-03-01 20:25:29 -05:00
|
|
|
/** Whichever of these is non-null decides what comes out of the chest */
|
|
|
|
struct UnlockedThing
|
|
|
|
{
|
2010-03-04 20:28:23 -05:00
|
|
|
/** Will be non-null if this unlocked thing is a kart */
|
2010-03-01 20:25:29 -05:00
|
|
|
KartProperties* m_unlocked_kart;
|
2010-03-04 20:28:23 -05:00
|
|
|
|
2010-04-21 15:19:42 -04:00
|
|
|
/** Will be non-empty if this unlocked thing is one or many pictures */
|
|
|
|
std::vector<irr::video::ITexture*> m_pictures;
|
2010-03-04 20:28:23 -05:00
|
|
|
/** Will be set if this unlocked thing is a picture */
|
|
|
|
float m_w, m_h;
|
2010-04-21 15:19:42 -04:00
|
|
|
/** used for slideshows */
|
|
|
|
int m_curr_image;
|
2010-03-01 20:25:29 -05:00
|
|
|
|
|
|
|
/** Contains whatever is in the chest */
|
|
|
|
scene::ISceneNode* m_root_gift_node;
|
|
|
|
|
|
|
|
irr::core::stringw m_unlock_message;
|
|
|
|
|
2010-04-26 10:41:23 -04:00
|
|
|
UnlockedThing(KartProperties* kart, irr::core::stringw msg);
|
2010-04-21 15:19:42 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates a 'picture' reward.
|
|
|
|
* \param pict the picture to display as reward.
|
|
|
|
* \param w width of the picture to display
|
|
|
|
* \param y height of the picture to display
|
|
|
|
*/
|
2010-04-26 10:41:23 -04:00
|
|
|
UnlockedThing(irr::video::ITexture* pict, float w, float h, irr::core::stringw msg);
|
2010-04-21 15:19:42 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates a 'picture slideshow' reward.
|
|
|
|
* \param picts the pictures to display as reward.
|
|
|
|
* \param w width of the pictures to display
|
|
|
|
* \param y height of the pictures to display
|
|
|
|
*/
|
2010-04-26 10:41:23 -04:00
|
|
|
UnlockedThing(std::vector<irr::video::ITexture*> picts, float w, float h, irr::core::stringw msg);
|
2010-04-21 15:19:42 -04:00
|
|
|
|
2010-04-26 10:41:23 -04:00
|
|
|
~UnlockedThing();
|
2010-03-01 20:25:29 -05:00
|
|
|
};
|
|
|
|
ptr_vector<UnlockedThing, HOLD> m_unlocked_stuff;
|
2009-12-05 20:30:39 -05:00
|
|
|
|
|
|
|
|
2009-10-04 16:20:41 -04:00
|
|
|
/** sky angle, 0-360 */
|
2009-12-05 20:30:39 -05:00
|
|
|
float m_sky_angle;
|
|
|
|
|
|
|
|
/** Global evolution of time */
|
|
|
|
double m_global_time;
|
2009-10-04 16:20:41 -04:00
|
|
|
|
|
|
|
/** Key position from origin (where the chest is) */
|
|
|
|
float m_key_pos;
|
|
|
|
|
|
|
|
/** Angle of the key (from 0 to 1, simply traces progression) */
|
|
|
|
float m_key_angle;
|
|
|
|
|
2010-08-06 09:59:03 -04:00
|
|
|
/** The scene node for the sky box. */
|
|
|
|
irr::scene::ISceneNode *m_sky;
|
|
|
|
|
|
|
|
/** The scene node for the camera. */
|
|
|
|
irr::scene::ICameraSceneNode *m_camera;
|
|
|
|
|
|
|
|
/** The scene node for the animated mesh. */
|
|
|
|
irr::scene::IAnimatedMeshSceneNode *m_chest;
|
|
|
|
|
|
|
|
/** The scene node for the light. */
|
2009-10-04 16:20:41 -04:00
|
|
|
irr::scene::ILightSceneNode* m_light;
|
2010-08-15 16:24:51 -04:00
|
|
|
|
|
|
|
//#define USE_IRRLICHT_BUG_WORKAROUND
|
|
|
|
|
2010-08-06 09:59:03 -04:00
|
|
|
#ifdef USE_IRRLICHT_BUG_WORKAROUND
|
|
|
|
scene::IMeshSceneNode *m_avoid_irrlicht_bug;
|
|
|
|
#endif
|
2010-03-01 18:40:20 -05:00
|
|
|
|
|
|
|
void continueButtonPressed();
|
|
|
|
|
2009-10-03 21:16:00 -04:00
|
|
|
public:
|
2009-10-04 19:59:05 -04:00
|
|
|
|
2010-05-01 15:16:38 -04:00
|
|
|
/** \brief implement optional callback from parent class GUIEngine::Screen */
|
2009-10-03 21:16:00 -04:00
|
|
|
void onUpdate(float dt, irr::video::IVideoDriver*);
|
2009-10-04 19:59:05 -04:00
|
|
|
|
2010-05-01 15:16:38 -04:00
|
|
|
/** \brief implement callback from parent class GUIEngine::Screen */
|
|
|
|
virtual void loadedFromFile();
|
|
|
|
|
|
|
|
/** \brief implement callback from parent class GUIEngine::Screen */
|
2009-10-04 19:59:05 -04:00
|
|
|
void init();
|
2010-05-01 15:16:38 -04:00
|
|
|
|
|
|
|
/** \brief implement callback from parent class GUIEngine::Screen */
|
2009-10-04 19:59:05 -04:00
|
|
|
void tearDown();
|
|
|
|
|
2009-10-28 19:04:38 -04:00
|
|
|
void eventCallback(GUIEngine::Widget* widget, const std::string& name, const int playerID);
|
2009-12-05 20:30:39 -05:00
|
|
|
|
2010-04-21 15:19:42 -04:00
|
|
|
/** Call before showing up the screen to make a kart come out of the chest.
|
|
|
|
'addUnlockedThings' will invoke this, so you generally don't need to call this directly. */
|
2010-03-01 20:25:29 -05:00
|
|
|
void addUnlockedKart(KartProperties* unlocked_kart, irr::core::stringw msg);
|
2009-12-05 20:30:39 -05:00
|
|
|
|
2010-04-21 15:19:42 -04:00
|
|
|
/** Call before showing up the screen to make a picture come out of the chest
|
|
|
|
'addUnlockedThings' will invoke this, so you generally don't need to call this directly. */
|
2010-03-04 20:28:23 -05:00
|
|
|
void addUnlockedPicture(irr::video::ITexture* picture, float w, float h, irr::core::stringw msg);
|
2010-03-01 18:40:20 -05:00
|
|
|
|
2010-04-21 15:19:42 -04:00
|
|
|
/** Call before showing up the screen to make a picture slideshow come out of the chest
|
|
|
|
'addUnlockedThings' will invoke this, so you generally don't need to call this directly. */
|
|
|
|
void addUnlockedPictures(std::vector<irr::video::ITexture*> pictures,
|
|
|
|
float w, float h, irr::core::stringw msg);
|
|
|
|
|
2010-03-08 12:04:05 -05:00
|
|
|
/** Call before showing up the screen to make whatever the passed challenges unlocked
|
|
|
|
* come out of the chest */
|
|
|
|
void addUnlockedThings(const std::vector<const Challenge*> unlocked);
|
|
|
|
|
2010-04-21 15:19:42 -04:00
|
|
|
|
2010-03-01 18:40:20 -05:00
|
|
|
/** override from base class to handle escape press */
|
|
|
|
virtual bool onEscapePressed();
|
2009-10-03 21:16:00 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|