Allow to unlock all tracks in config.xml.
Can be used on android when only some tracks are included in the apk.
This commit is contained in:
parent
674e617018
commit
7b76804354
@ -23,6 +23,7 @@
|
|||||||
#include "challenges/challenge_data.hpp"
|
#include "challenges/challenge_data.hpp"
|
||||||
#include "challenges/unlock_manager.hpp"
|
#include "challenges/unlock_manager.hpp"
|
||||||
#include "config/player_manager.hpp"
|
#include "config/player_manager.hpp"
|
||||||
|
#include "config/user_config.hpp"
|
||||||
#include "io/utf_writer.hpp"
|
#include "io/utf_writer.hpp"
|
||||||
#include "io/xml_node.hpp"
|
#include "io/xml_node.hpp"
|
||||||
|
|
||||||
@ -67,6 +68,9 @@ void StoryModeStatus::addStatus(ChallengeStatus *cs)
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
bool StoryModeStatus::isLocked(const std::string& feature)
|
bool StoryModeStatus::isLocked(const std::string& feature)
|
||||||
{
|
{
|
||||||
|
if (UserConfigParams::m_everything_unlocked)
|
||||||
|
return false;
|
||||||
|
|
||||||
return m_locked_features.find(feature)!=m_locked_features.end();
|
return m_locked_features.find(feature)!=m_locked_features.end();
|
||||||
} // featureIsLocked
|
} // featureIsLocked
|
||||||
|
|
||||||
|
@ -892,6 +892,10 @@ namespace UserConfigParams
|
|||||||
PARAM_DEFAULT( BoolUserConfigParam(false, "artist_debug_mode",
|
PARAM_DEFAULT( BoolUserConfigParam(false, "artist_debug_mode",
|
||||||
"Whether to enable track debugging features") );
|
"Whether to enable track debugging features") );
|
||||||
|
|
||||||
|
PARAM_PREFIX BoolUserConfigParam m_everything_unlocked
|
||||||
|
PARAM_DEFAULT( BoolUserConfigParam(false, "everything_unlocked",
|
||||||
|
"Enable all karts and tracks") );
|
||||||
|
|
||||||
// TODO? implement blacklist for new irrlicht device and GUI
|
// TODO? implement blacklist for new irrlicht device and GUI
|
||||||
PARAM_PREFIX std::vector<std::string> m_blacklist_res;
|
PARAM_PREFIX std::vector<std::string> m_blacklist_res;
|
||||||
|
|
||||||
|
@ -244,6 +244,10 @@ void OverWorld::onFirePressed(Controller* who)
|
|||||||
|
|
||||||
const unsigned int val = challenge->getNumTrophies();
|
const unsigned int val = challenge->getNumTrophies();
|
||||||
bool unlocked = (PlayerManager::getCurrentPlayer()->getPoints() >= val);
|
bool unlocked = (PlayerManager::getCurrentPlayer()->getPoints() >= val);
|
||||||
|
|
||||||
|
if (UserConfigParams::m_everything_unlocked)
|
||||||
|
unlocked = true;
|
||||||
|
|
||||||
if (unlocked)
|
if (unlocked)
|
||||||
{
|
{
|
||||||
race_manager->setKartLastPositionOnOverworld(kart_xyz);
|
race_manager->setKartLastPositionOnOverworld(kart_xyz);
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include "animations/three_d_animation.hpp"
|
#include "animations/three_d_animation.hpp"
|
||||||
#include "challenges/unlock_manager.hpp"
|
#include "challenges/unlock_manager.hpp"
|
||||||
|
#include "config/user_config.hpp"
|
||||||
#include "graphics/central_settings.hpp"
|
#include "graphics/central_settings.hpp"
|
||||||
#include "graphics/irr_driver.hpp"
|
#include "graphics/irr_driver.hpp"
|
||||||
#include "guiengine/engine.hpp"
|
#include "guiengine/engine.hpp"
|
||||||
@ -48,13 +49,6 @@ namespace Scripting
|
|||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// --------------------------------------------------------------------
|
|
||||||
/** Get number of challenges that were completed at any difficulty */
|
|
||||||
int getCompletedChallengesCount()
|
|
||||||
{
|
|
||||||
return ::Track::getCurrentTrack()->getNumOfCompletedChallenges();
|
|
||||||
} // getCompletedChallengesCount
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
/** Get total number of challenges */
|
/** Get total number of challenges */
|
||||||
int getChallengeCount()
|
int getChallengeCount()
|
||||||
@ -62,6 +56,16 @@ namespace Scripting
|
|||||||
return ::Track::getCurrentTrack()->getChallengeList().size();
|
return ::Track::getCurrentTrack()->getChallengeList().size();
|
||||||
} // getChallengeCount
|
} // getChallengeCount
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------
|
||||||
|
/** Get number of challenges that were completed at any difficulty */
|
||||||
|
int getCompletedChallengesCount()
|
||||||
|
{
|
||||||
|
if (UserConfigParams::m_everything_unlocked)
|
||||||
|
return getChallengeCount();
|
||||||
|
|
||||||
|
return ::Track::getCurrentTrack()->getNumOfCompletedChallenges();
|
||||||
|
} // getCompletedChallengesCount
|
||||||
|
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
int getChallengeRequiredPoints(std::string* challenge_name)
|
int getChallengeRequiredPoints(std::string* challenge_name)
|
||||||
{
|
{
|
||||||
@ -81,6 +85,9 @@ namespace Scripting
|
|||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
bool isChallengeUnlocked(std::string* challenge_name)
|
bool isChallengeUnlocked(std::string* challenge_name)
|
||||||
{
|
{
|
||||||
|
if (UserConfigParams::m_everything_unlocked)
|
||||||
|
return true;
|
||||||
|
|
||||||
const ChallengeData* challenge =
|
const ChallengeData* challenge =
|
||||||
unlock_manager->getChallengeData(*challenge_name);
|
unlock_manager->getChallengeData(*challenge_name);
|
||||||
if (challenge == NULL)
|
if (challenge == NULL)
|
||||||
|
@ -432,6 +432,9 @@ void RaceGUIOverworld::drawGlobalMiniMap()
|
|||||||
bool unlocked = (PlayerManager::getCurrentPlayer()->getPoints() >= val);
|
bool unlocked = (PlayerManager::getCurrentPlayer()->getPoints() >= val);
|
||||||
int state = (unlocked ? OPEN : LOCKED);
|
int state = (unlocked ? OPEN : LOCKED);
|
||||||
|
|
||||||
|
if (UserConfigParams::m_everything_unlocked)
|
||||||
|
state = OPEN;
|
||||||
|
|
||||||
const ChallengeStatus* c = PlayerManager::getCurrentPlayer()
|
const ChallengeStatus* c = PlayerManager::getCurrentPlayer()
|
||||||
->getChallengeStatus(challenges[n].m_challenge_id);
|
->getChallengeStatus(challenges[n].m_challenge_id);
|
||||||
if (c->isSolved(RaceManager::DIFFICULTY_HARD)) state = COMPLETED_HARD;
|
if (c->isSolved(RaceManager::DIFFICULTY_HARD)) state = COMPLETED_HARD;
|
||||||
@ -475,6 +478,10 @@ void RaceGUIOverworld::drawGlobalMiniMap()
|
|||||||
const ChallengeData* challenge = unlock_manager->getChallengeData(challenges[n].m_challenge_id);
|
const ChallengeData* challenge = unlock_manager->getChallengeData(challenges[n].m_challenge_id);
|
||||||
const unsigned int val = challenge->getNumTrophies();
|
const unsigned int val = challenge->getNumTrophies();
|
||||||
bool unlocked = (PlayerManager::getCurrentPlayer()->getPoints() >= val);
|
bool unlocked = (PlayerManager::getCurrentPlayer()->getPoints() >= val);
|
||||||
|
|
||||||
|
if (UserConfigParams::m_everything_unlocked)
|
||||||
|
unlocked = true;
|
||||||
|
|
||||||
if (!unlocked)
|
if (!unlocked)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user