stk-code_catmod/src/states_screens/feature_unlocked.hpp

182 lines
6.1 KiB
C++
Raw Normal View History

//
// SuperTuxKart - a fun racing game with go-kart
2015-03-29 20:31:42 -04:00
// Copyright (C) 2010-2015 SuperTuxKart-Team
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 3
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef HEADER_FEATURE_UNLOCKED_HPP
#define HEADER_FEATURE_UNLOCKED_HPP
#include "graphics/irr_driver.hpp"
#include "guiengine/screen.hpp"
#include "race/race_manager.hpp"
#include "utils/ptr_vector.hpp"
2018-01-04 12:06:58 -05:00
#include <memory>
namespace irr {
namespace scene { class ISceneNode; class ICameraSceneNode;
class ILightSceneNode; }
}
2018-01-04 12:06:58 -05:00
namespace SP
{
class SPTexture;
}
class KartModel;
class KartProperties;
class ChallengeData;
/**
* \brief Screen shown when a feature has been unlocked
* \ingroup states_screens
*/
class FeatureUnlockedCutScene : public GUIEngine::CutsceneScreen,
public GUIEngine::ScreenSingleton<FeatureUnlockedCutScene>
{
friend class GUIEngine::ScreenSingleton<FeatureUnlockedCutScene>;
FeatureUnlockedCutScene();
/** Whichever of these is non-null decides what comes out of the chest */
struct UnlockedThing
{
/** Will be non-null if this unlocked thing is a kart */
SuperTux in Story Mode (and other improvements) (#3207) * Add SuperTux difficulty & update number of karts Also make the expert challenge slightly easier to match more the difficulty of other challenges. * Add SuperTux difficulty & update number of karts & points required Also give some more time margin in easier difficulties, as it is a hard challenge compared to most. * Add SuperTux difficulty & update number of karts & points required Also change the lap count to 4 as it is a very short track (sub 30s) * Add SuperTux difficulty Also tweak the expert challenge to have a more appropriate difficulty * Add SuperTux difficulty & update number of karts * Add SuperTux difficulty & update number of karts & points required * Add SuperTux difficulty & update number of karts & points required Also correct the requirement position, since this is not a FTL race anymore. * Add SuperTux difficulty & update number of karts & points required Also slight balancing improvements for the usual difficulties. * Add SuperTux difficulty & update number of karts & points required Also adds a position requirement in expert * Add SuperTux difficulty & update number of karts & points required * Add SuperTux difficulty & update number of karts & points required * Add SuperTux difficulty & update number of karts & points required Also change the number of laps to 5, as this is a very short track. The time requirements for easier difficulties have been kept proportionally similar to before. * Add SuperTux difficulty & update number of karts & points required Also change the number of laps to 4. * Add SuperTux difficulty & update number of karts & points required Also add a position requirement to expert and intermediate. * Add SuperTux difficulty & update number of karts & points required Also change the number of laps to 4, as a lap often is 30s or less in expert/supertux * Add SuperTux difficulty & update number of karts & points required * Add SuperTux difficulty & update number of karts & points required * Rename islandtrack.challenge to gran_paradiso.challenge * Rename challenge file * Add SuperTux difficulty & update number of karts & points required Also makes the time limit in expert less easy and tweak position requirement. * Add SuperTux difficulty & update number of karts * Add SuperTux difficulty & update number of karts & points required * Add SuperTux difficulty & update number of karts & points required * Add SuperTux difficulty & update number of karts & points required * Add SuperTux difficulty & update number of karts & points required Doesn't unlock the SuperTux difficulty anymore - it's managed elsewhere. * Add SuperTux difficulty & update number of karts & points required * Add SuperTux difficulty & update number of karts & points required * Add new unlock challenges, for difficulty and karts * Add a lap to oliver's math class * Replace Northern Resort by Volcano Island * Replace Volcano Island by Candela City Candela City was in no (official) GP before this. Also sets Green Valley to 3 laps. * Add Northern Resort and remove Fort Magma In 0.9.3, this GP has only 4 races in Story Mode (5 for the other GPs) because Fort Magma is locked. Of all the tracks outside this GP before, Northern Resort is one of the hardest, the AI being rather good there. * Temporary cup for SuperTux challenges Recolored version of the gold cup * Update challenge selection UI for the SuperTux challenges * GUI used before SuperTux difficulty unlocking This is the old select_challenge.stkgui * Swap the two sara * Replace Kiki by another kart to unlock on Benau's demand * Update for improved Story Mode * Update for improved Story Mode * Add support for SuperTux challenges * Add support for SuperTux challenges * Add support for SuperTux challenges * Add support for SuperTux challenges * Update for SuperTux ; also adds the ability to unlock a challenge by points * Update for unlocking by points * Add support for SuperTux challenges * Add support for SuperTux challenges * Add support for SuperTux challenges * Minor changes to function calls * Update for SuperTux challenges * Add support for SuperTux challenges * Update for Story Mode GP changes * Allows to display the correct number of points for GP challenges * Set the unlock of the 1st bonus kart to correct non-test value * Add support for SuperTux challenges Including a bigger challenge selection diaolg * Add default value * Icon to indicate that there is an unlockable The number of points needed to unlock it are displayed next to it. * Changed format : the point requirements is now specified in the file * Changed format : the point requirements is now specified in the file * Changed format : the point requirements is now specified in the file * Function for unlock by points UI * Add default for unlock list node and use requirements node for all * Make unlockByPoints simpler and more flexible Now the code will iterate in StoryModeStatus and send the unlock_list challenges for treatment here. The question of getting the right challenge statuses beings solved, it allows for a great simplification and much more flexibility * Update unlockByPoints declaration * Adds support for next unlockable UI * Improve call of unlockByPoints Also calculations for displaying in the UI how many point the next unlockable by points requires. * Add icon for next unlockable * Displays icon/number to make the player aware of the next unlockable Also displays the number below the icon rather than on the side, for more clarity. * Changes to display karts in the unlock scene * Update unlock functions declarations * New function to clarify code and more logical recently unlocked list management In the previous version, everything was added to the recently unlocked list at some point, necessitating a clearing at the end of computeActive, which also removed from the list the non-race challenges. Checking if the feature is newly unlocked to add it to the list remove the need of that clearing. * Declaration for unlockFeatureByList * Display newly unlocked karts * Display newly unlocked karts * Clear the list of recently unlocked features at the end * Update testing code * Update unlocks finding function call * Improve UI scaling * Fixes indentation * Update the number of points before checking for unlock by points * Add const to declarations * Remove const_cast * Remove a const_cast There are other const_cast in the menu debug items (but they are unrelated to this PR) * Fix menu being bolder
2018-04-29 18:27:03 -04:00
const KartProperties* m_unlocked_kart;
std::string m_unlock_model;
/** Will be non-empty if this unlocked thing is one or many pictures */
std::vector<irr::video::ITexture*> m_pictures;
2018-01-04 12:06:58 -05:00
std::vector<std::shared_ptr<SP::SPTexture> > m_sp_pictures;
/** Will be set if this unlocked thing is a picture */
float m_w, m_h;
/** used for slideshows */
int m_curr_image;
/** Contains whatever is in the chest */
scene::ISceneNode* m_root_gift_node;
scene::ISceneNode* m_side_1;
scene::ISceneNode* m_side_2;
float m_scale;
irr::core::stringw m_unlock_message;
UnlockedThing(const std::string &model, const irr::core::stringw &msg);
UnlockedThing(const KartProperties* kart, const irr::core::stringw &msg);
/**
* 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
*/
UnlockedThing(irr::video::ITexture* pict, float w, float h,
const irr::core::stringw &msg);
/**
* 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
*/
UnlockedThing(std::vector<irr::video::ITexture*> picts, float w, float h,
const irr::core::stringw &msg);
~UnlockedThing();
};
/** The list of all unlocked things. */
PtrVector<UnlockedThing, HOLD> m_unlocked_stuff;
/** To store the copy of the KartModel for each unlocked kart. */
PtrVector<KartModel> m_all_kart_models;
/** Global evolution of time */
2014-06-05 03:07:54 -04:00
float m_global_time;
/** 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;
void continueButtonPressed();
public:
virtual void onCutsceneEnd() OVERRIDE;
/** \brief implement optional callback from parent class GUIEngine::Screen */
void onUpdate(float dt) OVERRIDE;
/** \brief implement callback from parent class GUIEngine::Screen */
virtual void loadedFromFile() OVERRIDE;
/** \brief implement callback from parent class GUIEngine::Screen */
void init() OVERRIDE;
/** \brief implement callback from parent class GUIEngine::Screen */
void tearDown() OVERRIDE;
void eventCallback(GUIEngine::Widget* widget, const std::string& name,
const int playerID) OVERRIDE;
void findWhatWasUnlocked(RaceManager::Difficulty difficulty,
std::vector<const ChallengeData*>& unlocked);
/** 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. */
SuperTux in Story Mode (and other improvements) (#3207) * Add SuperTux difficulty & update number of karts Also make the expert challenge slightly easier to match more the difficulty of other challenges. * Add SuperTux difficulty & update number of karts & points required Also give some more time margin in easier difficulties, as it is a hard challenge compared to most. * Add SuperTux difficulty & update number of karts & points required Also change the lap count to 4 as it is a very short track (sub 30s) * Add SuperTux difficulty Also tweak the expert challenge to have a more appropriate difficulty * Add SuperTux difficulty & update number of karts * Add SuperTux difficulty & update number of karts & points required * Add SuperTux difficulty & update number of karts & points required Also correct the requirement position, since this is not a FTL race anymore. * Add SuperTux difficulty & update number of karts & points required Also slight balancing improvements for the usual difficulties. * Add SuperTux difficulty & update number of karts & points required Also adds a position requirement in expert * Add SuperTux difficulty & update number of karts & points required * Add SuperTux difficulty & update number of karts & points required * Add SuperTux difficulty & update number of karts & points required Also change the number of laps to 5, as this is a very short track. The time requirements for easier difficulties have been kept proportionally similar to before. * Add SuperTux difficulty & update number of karts & points required Also change the number of laps to 4. * Add SuperTux difficulty & update number of karts & points required Also add a position requirement to expert and intermediate. * Add SuperTux difficulty & update number of karts & points required Also change the number of laps to 4, as a lap often is 30s or less in expert/supertux * Add SuperTux difficulty & update number of karts & points required * Add SuperTux difficulty & update number of karts & points required * Rename islandtrack.challenge to gran_paradiso.challenge * Rename challenge file * Add SuperTux difficulty & update number of karts & points required Also makes the time limit in expert less easy and tweak position requirement. * Add SuperTux difficulty & update number of karts * Add SuperTux difficulty & update number of karts & points required * Add SuperTux difficulty & update number of karts & points required * Add SuperTux difficulty & update number of karts & points required * Add SuperTux difficulty & update number of karts & points required Doesn't unlock the SuperTux difficulty anymore - it's managed elsewhere. * Add SuperTux difficulty & update number of karts & points required * Add SuperTux difficulty & update number of karts & points required * Add new unlock challenges, for difficulty and karts * Add a lap to oliver's math class * Replace Northern Resort by Volcano Island * Replace Volcano Island by Candela City Candela City was in no (official) GP before this. Also sets Green Valley to 3 laps. * Add Northern Resort and remove Fort Magma In 0.9.3, this GP has only 4 races in Story Mode (5 for the other GPs) because Fort Magma is locked. Of all the tracks outside this GP before, Northern Resort is one of the hardest, the AI being rather good there. * Temporary cup for SuperTux challenges Recolored version of the gold cup * Update challenge selection UI for the SuperTux challenges * GUI used before SuperTux difficulty unlocking This is the old select_challenge.stkgui * Swap the two sara * Replace Kiki by another kart to unlock on Benau's demand * Update for improved Story Mode * Update for improved Story Mode * Add support for SuperTux challenges * Add support for SuperTux challenges * Add support for SuperTux challenges * Add support for SuperTux challenges * Update for SuperTux ; also adds the ability to unlock a challenge by points * Update for unlocking by points * Add support for SuperTux challenges * Add support for SuperTux challenges * Add support for SuperTux challenges * Minor changes to function calls * Update for SuperTux challenges * Add support for SuperTux challenges * Update for Story Mode GP changes * Allows to display the correct number of points for GP challenges * Set the unlock of the 1st bonus kart to correct non-test value * Add support for SuperTux challenges Including a bigger challenge selection diaolg * Add default value * Icon to indicate that there is an unlockable The number of points needed to unlock it are displayed next to it. * Changed format : the point requirements is now specified in the file * Changed format : the point requirements is now specified in the file * Changed format : the point requirements is now specified in the file * Function for unlock by points UI * Add default for unlock list node and use requirements node for all * Make unlockByPoints simpler and more flexible Now the code will iterate in StoryModeStatus and send the unlock_list challenges for treatment here. The question of getting the right challenge statuses beings solved, it allows for a great simplification and much more flexibility * Update unlockByPoints declaration * Adds support for next unlockable UI * Improve call of unlockByPoints Also calculations for displaying in the UI how many point the next unlockable by points requires. * Add icon for next unlockable * Displays icon/number to make the player aware of the next unlockable Also displays the number below the icon rather than on the side, for more clarity. * Changes to display karts in the unlock scene * Update unlock functions declarations * New function to clarify code and more logical recently unlocked list management In the previous version, everything was added to the recently unlocked list at some point, necessitating a clearing at the end of computeActive, which also removed from the list the non-race challenges. Checking if the feature is newly unlocked to add it to the list remove the need of that clearing. * Declaration for unlockFeatureByList * Display newly unlocked karts * Display newly unlocked karts * Clear the list of recently unlocked features at the end * Update testing code * Update unlocks finding function call * Improve UI scaling * Fixes indentation * Update the number of points before checking for unlock by points * Add const to declarations * Remove const_cast * Remove a const_cast There are other const_cast in the menu debug items (but they are unrelated to this PR) * Fix menu being bolder
2018-04-29 18:27:03 -04:00
void addUnlockedKart(const KartProperties* unlocked_kart);
/** 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. */
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 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);
void addUnlockedTrack(const Track* track);
void addUnlockedGP(const GrandPrixData* gp);
/** Call before showing up the screen to make whatever the passed challenges unlocked
* come out of the chest */
// unused for now... maybe this could could useful later?
/*
void addUnlockedThings(const std::vector<const ChallengeData*> unlocked);
*/
SuperTux in Story Mode (and other improvements) (#3207) * Add SuperTux difficulty & update number of karts Also make the expert challenge slightly easier to match more the difficulty of other challenges. * Add SuperTux difficulty & update number of karts & points required Also give some more time margin in easier difficulties, as it is a hard challenge compared to most. * Add SuperTux difficulty & update number of karts & points required Also change the lap count to 4 as it is a very short track (sub 30s) * Add SuperTux difficulty Also tweak the expert challenge to have a more appropriate difficulty * Add SuperTux difficulty & update number of karts * Add SuperTux difficulty & update number of karts & points required * Add SuperTux difficulty & update number of karts & points required Also correct the requirement position, since this is not a FTL race anymore. * Add SuperTux difficulty & update number of karts & points required Also slight balancing improvements for the usual difficulties. * Add SuperTux difficulty & update number of karts & points required Also adds a position requirement in expert * Add SuperTux difficulty & update number of karts & points required * Add SuperTux difficulty & update number of karts & points required * Add SuperTux difficulty & update number of karts & points required Also change the number of laps to 5, as this is a very short track. The time requirements for easier difficulties have been kept proportionally similar to before. * Add SuperTux difficulty & update number of karts & points required Also change the number of laps to 4. * Add SuperTux difficulty & update number of karts & points required Also add a position requirement to expert and intermediate. * Add SuperTux difficulty & update number of karts & points required Also change the number of laps to 4, as a lap often is 30s or less in expert/supertux * Add SuperTux difficulty & update number of karts & points required * Add SuperTux difficulty & update number of karts & points required * Rename islandtrack.challenge to gran_paradiso.challenge * Rename challenge file * Add SuperTux difficulty & update number of karts & points required Also makes the time limit in expert less easy and tweak position requirement. * Add SuperTux difficulty & update number of karts * Add SuperTux difficulty & update number of karts & points required * Add SuperTux difficulty & update number of karts & points required * Add SuperTux difficulty & update number of karts & points required * Add SuperTux difficulty & update number of karts & points required Doesn't unlock the SuperTux difficulty anymore - it's managed elsewhere. * Add SuperTux difficulty & update number of karts & points required * Add SuperTux difficulty & update number of karts & points required * Add new unlock challenges, for difficulty and karts * Add a lap to oliver's math class * Replace Northern Resort by Volcano Island * Replace Volcano Island by Candela City Candela City was in no (official) GP before this. Also sets Green Valley to 3 laps. * Add Northern Resort and remove Fort Magma In 0.9.3, this GP has only 4 races in Story Mode (5 for the other GPs) because Fort Magma is locked. Of all the tracks outside this GP before, Northern Resort is one of the hardest, the AI being rather good there. * Temporary cup for SuperTux challenges Recolored version of the gold cup * Update challenge selection UI for the SuperTux challenges * GUI used before SuperTux difficulty unlocking This is the old select_challenge.stkgui * Swap the two sara * Replace Kiki by another kart to unlock on Benau's demand * Update for improved Story Mode * Update for improved Story Mode * Add support for SuperTux challenges * Add support for SuperTux challenges * Add support for SuperTux challenges * Add support for SuperTux challenges * Update for SuperTux ; also adds the ability to unlock a challenge by points * Update for unlocking by points * Add support for SuperTux challenges * Add support for SuperTux challenges * Add support for SuperTux challenges * Minor changes to function calls * Update for SuperTux challenges * Add support for SuperTux challenges * Update for Story Mode GP changes * Allows to display the correct number of points for GP challenges * Set the unlock of the 1st bonus kart to correct non-test value * Add support for SuperTux challenges Including a bigger challenge selection diaolg * Add default value * Icon to indicate that there is an unlockable The number of points needed to unlock it are displayed next to it. * Changed format : the point requirements is now specified in the file * Changed format : the point requirements is now specified in the file * Changed format : the point requirements is now specified in the file * Function for unlock by points UI * Add default for unlock list node and use requirements node for all * Make unlockByPoints simpler and more flexible Now the code will iterate in StoryModeStatus and send the unlock_list challenges for treatment here. The question of getting the right challenge statuses beings solved, it allows for a great simplification and much more flexibility * Update unlockByPoints declaration * Adds support for next unlockable UI * Improve call of unlockByPoints Also calculations for displaying in the UI how many point the next unlockable by points requires. * Add icon for next unlockable * Displays icon/number to make the player aware of the next unlockable Also displays the number below the icon rather than on the side, for more clarity. * Changes to display karts in the unlock scene * Update unlock functions declarations * New function to clarify code and more logical recently unlocked list management In the previous version, everything was added to the recently unlocked list at some point, necessitating a clearing at the end of computeActive, which also removed from the list the non-race challenges. Checking if the feature is newly unlocked to add it to the list remove the need of that clearing. * Declaration for unlockFeatureByList * Display newly unlocked karts * Display newly unlocked karts * Clear the list of recently unlocked features at the end * Update testing code * Update unlocks finding function call * Improve UI scaling * Fixes indentation * Update the number of points before checking for unlock by points * Add const to declarations * Remove const_cast * Remove a const_cast There are other const_cast in the menu debug items (but they are unrelated to this PR) * Fix menu being bolder
2018-04-29 18:27:03 -04:00
void addTrophy(RaceManager::Difficulty difficulty, bool is_grandprix);
/** override from base class to handle escape press */
virtual bool onEscapePressed() OVERRIDE;
virtual MusicInformation* getInGameMenuMusic() const OVERRIDE;
};
#endif