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:
Deve 2016-12-23 23:36:39 +01:00
parent 674e617018
commit 7b76804354
5 changed files with 33 additions and 7 deletions

View File

@ -23,6 +23,7 @@
#include "challenges/challenge_data.hpp"
#include "challenges/unlock_manager.hpp"
#include "config/player_manager.hpp"
#include "config/user_config.hpp"
#include "io/utf_writer.hpp"
#include "io/xml_node.hpp"
@ -67,6 +68,9 @@ void StoryModeStatus::addStatus(ChallengeStatus *cs)
//-----------------------------------------------------------------------------
bool StoryModeStatus::isLocked(const std::string& feature)
{
if (UserConfigParams::m_everything_unlocked)
return false;
return m_locked_features.find(feature)!=m_locked_features.end();
} // featureIsLocked

View File

@ -892,6 +892,10 @@ namespace UserConfigParams
PARAM_DEFAULT( BoolUserConfigParam(false, "artist_debug_mode",
"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
PARAM_PREFIX std::vector<std::string> m_blacklist_res;

View File

@ -244,6 +244,10 @@ void OverWorld::onFirePressed(Controller* who)
const unsigned int val = challenge->getNumTrophies();
bool unlocked = (PlayerManager::getCurrentPlayer()->getPoints() >= val);
if (UserConfigParams::m_everything_unlocked)
unlocked = true;
if (unlocked)
{
race_manager->setKartLastPositionOnOverworld(kart_xyz);

View File

@ -20,6 +20,7 @@
#include "animations/three_d_animation.hpp"
#include "challenges/unlock_manager.hpp"
#include "config/user_config.hpp"
#include "graphics/central_settings.hpp"
#include "graphics/irr_driver.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 */
int getChallengeCount()
@ -62,6 +56,16 @@ namespace Scripting
return ::Track::getCurrentTrack()->getChallengeList().size();
} // 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)
{
@ -81,6 +85,9 @@ namespace Scripting
// --------------------------------------------------------------------
bool isChallengeUnlocked(std::string* challenge_name)
{
if (UserConfigParams::m_everything_unlocked)
return true;
const ChallengeData* challenge =
unlock_manager->getChallengeData(*challenge_name);
if (challenge == NULL)

View File

@ -432,6 +432,9 @@ void RaceGUIOverworld::drawGlobalMiniMap()
bool unlocked = (PlayerManager::getCurrentPlayer()->getPoints() >= val);
int state = (unlocked ? OPEN : LOCKED);
if (UserConfigParams::m_everything_unlocked)
state = OPEN;
const ChallengeStatus* c = PlayerManager::getCurrentPlayer()
->getChallengeStatus(challenges[n].m_challenge_id);
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 unsigned int val = challenge->getNumTrophies();
bool unlocked = (PlayerManager::getCurrentPlayer()->getPoints() >= val);
if (UserConfigParams::m_everything_unlocked)
unlocked = true;
if (!unlocked)
continue;
}