massive update : more work to support several challenge difficulties; remove a huge lot of code that is no more needed thanks to the new points system; start work on the challenge-solved cutscene

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@10848 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2012-02-15 01:58:24 +00:00
parent b6e898876a
commit 2d926bbfcd
13 changed files with 227 additions and 130 deletions

View File

@ -45,19 +45,50 @@ void Challenge::load(const XMLNode* challengesNode)
m_data->getId().c_str());
return;
}
// See if the challenge is solved (it's activated later from the
// unlock_manager).
bool finished=false;
node->get("solved", &finished);
const XMLNode* easy = node->getNode("easy");
const XMLNode* medium = node->getNode("medium");
const XMLNode* hard = node->getNode("hard");
m_state[0] = CH_INACTIVE;
m_state[1] = CH_INACTIVE;
m_state[2] = CH_INACTIVE;
if (easy != NULL)
{
bool finished = false;
easy->get("solved", &finished);
m_state = finished ? CH_SOLVED : CH_INACTIVE;
if (finished) m_state[0] = CH_SOLVED;
}
if (medium != NULL)
{
bool finished = false;
medium->get("solved", &finished);
if (finished) m_state[1] = CH_SOLVED;
}
if (hard != NULL)
{
bool finished = false;
hard->get("solved", &finished);
if (finished) m_state[2] = CH_SOLVED;
}
} // load
//-----------------------------------------------------------------------------
const wchar_t* boolstr(bool b)
{
return (b ? L"true" : L"false");
}
void Challenge::save(XMLWriter& writer)
{
writer << L" <" << core::stringw(m_data->getId().c_str()) << L" solved=\""
<< (isSolved() ? L"true" : L"false") << L"\"";
writer << L" />\n";
writer << L" <" << core::stringw(m_data->getId().c_str()) << L">\n"
<< L" <easy solved=\"" << boolstr(isSolved(RaceManager::RD_EASY)) << L"\"/>\n"
<< L" <medium solved=\"" << boolstr(isSolved(RaceManager::RD_MEDIUM)) << L"\"/>\n"
<< L" <hard solved=\"" << boolstr(isSolved(RaceManager::RD_HARD)) << L"\"/>\n"
<< L" </" << core::stringw(m_data->getId().c_str()) << L">\n";
} // save

View File

@ -30,6 +30,7 @@
#include <fstream>
#include <irrString.h>
#include "race/race_manager.hpp"
#include "utils/no_copy.hpp"
#include "utils/translation.hpp"
@ -46,25 +47,35 @@ class Challenge : public NoCopy
private:
enum {CH_INACTIVE, // challenge not yet possible
CH_ACTIVE, // challenge possible, but not yet solved
CH_SOLVED} m_state; // challenge was solved
CH_SOLVED} // challenge was solved
m_state[RaceManager::DIFFICULTY_COUNT];
ChallengeData* m_data;
public:
Challenge(ChallengeData* data) : m_state(CH_INACTIVE)
{ m_data = data; }
Challenge(ChallengeData* data)
{
m_data = data;
m_state[RaceManager::RD_EASY] = CH_INACTIVE;
m_state[RaceManager::RD_MEDIUM] = CH_INACTIVE;
m_state[RaceManager::RD_HARD] = CH_INACTIVE;
}
virtual ~Challenge() {};
void load(const XMLNode* config);
void save(XMLWriter& writer);
// ------------------------------------------------------------------------
bool isSolved() const {return m_state==CH_SOLVED; }
bool isSolved(RaceManager::Difficulty d) const {return m_state[d]==CH_SOLVED; }
// ------------------------------------------------------------------------
bool isActive() const {return m_state==CH_ACTIVE; }
bool isSolvedAtAnyDifficulty() const {return m_state[0]==CH_SOLVED ||
m_state[1]==CH_SOLVED ||
m_state[2]==CH_SOLVED; }
// ------------------------------------------------------------------------
void setSolved() {m_state = CH_SOLVED; }
bool isActive(RaceManager::Difficulty d) const {return m_state[d]==CH_ACTIVE; }
// ------------------------------------------------------------------------
void setActive() {m_state = CH_ACTIVE; }
void setSolved(RaceManager::Difficulty d) {m_state[d] = CH_SOLVED; }
// ------------------------------------------------------------------------
void setActive(RaceManager::Difficulty d) {m_state[d] = CH_ACTIVE; }
// ------------------------------------------------------------------------
ChallengeData* getData() { return m_data; }
};

View File

@ -356,12 +356,13 @@ bool ChallengeData::raceFinished()
int d = race_manager->getDifficulty();
Kart* kart = world->getPlayerKart(0);
if (track_name != m_track_id ) return false;
if ((int)world->getNumKarts() < m_num_karts[d] ) return false;
Kart* kart = world->getPlayerKart(0);
if (m_energy[d] > 0 && kart->getEnergy() < m_energy[d] ) return false;
if (m_position[d] > 0 && kart->getPosition() > m_position[d]) return false;
// Follow the leader
// -----------------
if(m_minor==RaceManager::MINOR_MODE_FOLLOW_LEADER)

View File

@ -29,35 +29,6 @@ bool GameSlot::isLocked(const std::string& feature)
{
return m_locked_features.find(feature)!=m_locked_features.end();
} // featureIsLocked
//-----------------------------------------------------------------------------
const std::vector<const ChallengeData*> GameSlot::getUnlockedFeatures()
{
std::vector<const ChallengeData*> out;
std::map<std::string, Challenge*>::const_iterator i;
for(i = m_challenges_state.begin();
i != m_challenges_state.end(); i++)
{
if (i->second->isSolved()) out.push_back(i->second->getData());
}
return out;
}
//-----------------------------------------------------------------------------
const std::vector<const ChallengeData*> GameSlot::getLockedChallenges()
{
std::vector<const ChallengeData*> out;
std::map<std::string, Challenge*>::const_iterator i;
for(i = m_challenges_state.begin();
i != m_challenges_state.end(); i++)
{
if (!i->second->isSolved()) out.push_back(i->second->getData());
}
return out;
}
//-----------------------------------------------------------------------------
void GameSlot::computeActive()
@ -70,21 +41,53 @@ void GameSlot::computeActive()
{
// Changed challenge
// -----------------
if((i->second)->isSolved())
if((i->second)->isSolvedAtAnyDifficulty())
{
// The constructor calls computeActive, which actually locks
// all features, so unlock the solved ones (and don't try to
// save the state, since we are currently reading it)
unlockFeature(i->second, /*save*/ false);
if (i->second->isSolved(RaceManager::RD_EASY))
{
unlockFeature(i->second, RaceManager::RD_EASY, /*save*/ false);
}
if (i->second->isSolved(RaceManager::RD_MEDIUM))
{
unlockFeature(i->second, RaceManager::RD_MEDIUM, /*save*/ false);
}
if (i->second->isSolved(RaceManager::RD_HARD))
{
unlockFeature(i->second, RaceManager::RD_HARD, /*save*/ false);
}
m_points++;
continue;
}
else
{
// Otherwise lock the feature
// --------------------------
lockFeature(i->second);
}
// Otherwise lock the feature
// --------------------------
lockFeature(i->second);
i->second->setActive();
if (i->second->isSolved(RaceManager::RD_HARD))
{
// challenge beaten at hardest, nothing more to do here
continue;
}
else if (i->second->isSolved(RaceManager::RD_MEDIUM))
{
i->second->setActive(RaceManager::RD_HARD);
}
else if (i->second->isSolved(RaceManager::RD_EASY))
{
i->second->setActive(RaceManager::RD_HARD);
i->second->setActive(RaceManager::RD_MEDIUM);
}
else
{
i->second->setActive(RaceManager::RD_HARD);
i->second->setActive(RaceManager::RD_MEDIUM);
i->second->setActive(RaceManager::RD_EASY);
}
} // for i
clearUnlocked();
} // computeActive
@ -102,7 +105,7 @@ void GameSlot::lockFeature(Challenge *challenge)
//-----------------------------------------------------------------------------
void GameSlot::unlockFeature(Challenge* c, bool do_save)
void GameSlot::unlockFeature(Challenge* c, RaceManager::Difficulty d, bool do_save)
{
const unsigned int amount = (unsigned int)c->getData()->getFeatures().size();
for(unsigned int n=0; n<amount; n++)
@ -120,7 +123,7 @@ void GameSlot::unlockFeature(Challenge* c, bool do_save)
// Add to list of recently unlocked features
m_unlocked_features.push_back(c->getData());
c->setSolved(); // reset isActive flag
c->setSolved(d); // reset isActive flag
// Save the new unlock information
if(do_save) unlock_manager->save();
@ -128,24 +131,6 @@ void GameSlot::unlockFeature(Challenge* c, bool do_save)
//-----------------------------------------------------------------------------
std::vector<const ChallengeData*> GameSlot::getActiveChallenges()
{
computeActive();
std::vector<const ChallengeData*> out;
std::map<std::string, Challenge*>::const_iterator i;
for(i = m_challenges_state.begin();
i != m_challenges_state.end(); i++)
{
if (i->second->isActive()) out.push_back(i->second->getData());
}
return out;
} // getActiveChallenges
//-----------------------------------------------------------------------------
/** This is called when a race is finished. Call all active challenges
*/
void GameSlot::raceFinished()
@ -156,9 +141,9 @@ void GameSlot::raceFinished()
for(i = m_challenges_state.begin();
i != m_challenges_state.end(); i++)
{
if(i->second->isActive() && i->second->getData()->raceFinished())
if(i->second->isActive(race_manager->getDifficulty()) && i->second->getData()->raceFinished())
{
unlockFeature(i->second);
unlockFeature(i->second, race_manager->getDifficulty());
} // if isActive && challenge solved
}
//race_manager->setCoinTarget(0); //reset
@ -172,10 +157,11 @@ void GameSlot::grandPrixFinished()
for(i = m_challenges_state.begin();
i != m_challenges_state.end(); i++)
{
if(i->second->isActive() && i->second->getData()->grandPrixFinished())
if(i->second->isActive(race_manager->getDifficulty()) &&
i->second->getData()->grandPrixFinished())
{
printf("===== A FEATURE WAS UNLOCKED BECAUSE YOU WON THE GP!! ==\n");
unlockFeature(i->second);
unlockFeature(i->second, race_manager->getDifficulty());
}
}
race_manager->setCoinTarget(0);

View File

@ -25,6 +25,8 @@
#include <vector>
#include <irrString.h>
#include "race/race_manager.hpp"
class ChallengeData;
class Challenge;
class XMLWriter;
@ -70,26 +72,17 @@ public:
/** Returns the list of recently unlocked features (e.g. call at the end of a
race to know if any features were unlocked) */
const std::vector<const ChallengeData*>
getRecentlyUnlockedFeatures() {return m_unlocked_features;}
getRecentlyCompletedChallenges() {return m_unlocked_features;}
/** Clear the list of recently unlocked challenges */
void clearUnlocked () {m_unlocked_features.clear(); }
/** Returns a complete list of all solved challenges */
const std::vector<const ChallengeData*> getUnlockedFeatures();
/** Returns the list of currently inaccessible (locked) challenges */
const std::vector<const ChallengeData*> getLockedChallenges();
bool isLocked (const std::string& feature);
void lockFeature (Challenge *challenge);
void unlockFeature (Challenge* c, bool do_save=true);
std::vector<const ChallengeData*> getActiveChallenges();
void unlockFeature (Challenge* c, RaceManager::Difficulty d, bool do_save=true);
void raceFinished ();
void grandPrixFinished ();

View File

@ -309,7 +309,7 @@ RaceOverDialog::RaceOverDialog(const float percentWidth,
}
// ---- Buttons at the bottom
if (unlock_manager->getCurrentSlot()->getRecentlyUnlockedFeatures().size() > 0)
if (unlock_manager->getCurrentSlot()->getRecentlyCompletedChallenges().size() > 0)
{
const int label_y = m_area.getHeight() - (button_h + margin_between_buttons)*2;
@ -480,14 +480,14 @@ GUIEngine::EventPropagation RaceOverDialog::processEvent(const std::string& even
else if (eventSource == "seeunlocked")
{
std::vector<const ChallengeData*> unlocked =
unlock_manager->getCurrentSlot()->getRecentlyUnlockedFeatures();
unlock_manager->getCurrentSlot()->getRecentlyCompletedChallenges();
unlock_manager->getCurrentSlot()->clearUnlocked();
FeatureUnlockedCutScene* scene =
FeatureUnlockedCutScene::getInstance();
assert(unlocked.size() > 0);
scene->addUnlockedThings(unlocked);
scene->addTrophy(race_manager->getDifficulty());
ModalDialog::dismiss();
@ -505,7 +505,7 @@ GUIEngine::EventPropagation RaceOverDialog::processEvent(const std::string& even
void RaceOverDialog::escapePressed()
{
if (unlock_manager->getCurrentSlot()->getRecentlyUnlockedFeatures().size() > 0)
if (unlock_manager->getCurrentSlot()->getRecentlyCompletedChallenges().size() > 0)
{
std::string what = "seeunlocked";
processEvent(what);

View File

@ -54,6 +54,18 @@ DEFINE_SCREEN_SINGLETON( FeatureUnlockedCutScene );
#pragma mark FeatureUnlockedCutScene::UnlockedThing
#endif
FeatureUnlockedCutScene::UnlockedThing::UnlockedThing(std::string model,
irr::core::stringw msg)
{
m_unlocked_kart = NULL;
m_unlock_message = msg;
m_unlock_model = model;
m_curr_image = -1;
}
// -------------------------------------------------------------------------------------
FeatureUnlockedCutScene::UnlockedThing::UnlockedThing(KartProperties* kart,
irr::core::stringw msg)
{
@ -125,6 +137,48 @@ void FeatureUnlockedCutScene::loadedFromFile()
// ----------------------------------------------------------------------------
void FeatureUnlockedCutScene::addTrophy(RaceManager::Difficulty difficulty)
{
core::stringw msg;
switch (difficulty)
{
case RaceManager::RD_EASY:
msg = _("You completed the easy challenge!");
break;
case RaceManager::RD_MEDIUM:
msg = _("You completed the intermediate challenge!");
break;
case RaceManager::RD_HARD:
msg = _("You completed the difficult challenge!");
break;
default:
assert(false);
}
std::string model;
switch (difficulty)
{
case RaceManager::RD_EASY:
model = file_manager->getModelFile("trophy_bronze.b3d");
break;
case RaceManager::RD_MEDIUM:
model = file_manager->getModelFile("trophy_silver.b3d");
break;
case RaceManager::RD_HARD:
model = file_manager->getModelFile("trophy_gold.b3d");
break;
default:
assert(false);
return;
}
m_unlocked_stuff.push_back( new UnlockedThing(model, msg) );
}
// ----------------------------------------------------------------------------
// unused for now, maybe will be useful later?
/*
void FeatureUnlockedCutScene::addUnlockedKart(KartProperties* unlocked_kart,
irr::core::stringw msg)
{
@ -159,7 +213,7 @@ void FeatureUnlockedCutScene::addUnlockedPictures(std::vector<irr::video::ITextu
m_unlocked_stuff.push_back( new UnlockedThing(pictures, w, h, msg) );
} // addUnlockedPictures
*/
// ----------------------------------------------------------------------------
const float CAMERA_INITIAL_X = 0.0f;
@ -232,7 +286,11 @@ void FeatureUnlockedCutScene::init()
m_all_kart_models.clearAndDeleteAll();
for (int n=0; n<unlockedStuffCount; n++)
{
if (m_unlocked_stuff[n].m_unlocked_kart != NULL)
if (m_unlocked_stuff[n].m_unlock_model.size() > 0)
{
m_unlocked_stuff[n].m_root_gift_node = irr_driver->addMesh( irr_driver->getMesh(m_unlocked_stuff[n].m_unlock_model) );
}
else if (m_unlocked_stuff[n].m_unlocked_kart != NULL)
{
KartModel *kart_model =
m_unlocked_stuff[n].m_unlocked_kart->getKartModelCopy();
@ -499,6 +557,8 @@ void FeatureUnlockedCutScene::onUpdate(float dt,
// ----------------------------------------------------------------------------
// unused for now... maybe this could could useful later?
/*
void FeatureUnlockedCutScene::addUnlockedThings(const std::vector<const ChallengeData*> unlocked)
{
for (unsigned int n=0; n<unlocked.size(); n++)
@ -613,6 +673,7 @@ void FeatureUnlockedCutScene::addUnlockedThings(const std::vector<const Challeng
} // next feature
} // next challenge
} // addUnlockedThings
*/
// ----------------------------------------------------------------------------

View File

@ -21,6 +21,7 @@
#include "graphics/irr_driver.hpp"
#include "guiengine/screen.hpp"
#include "race/race_manager.hpp"
#include "utils/ptr_vector.hpp"
namespace irr {
@ -47,6 +48,8 @@ class FeatureUnlockedCutScene : public GUIEngine::Screen, public GUIEngine::Scre
/** Will be non-null if this unlocked thing is a kart */
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;
/** Will be set if this unlocked thing is a picture */
@ -59,6 +62,8 @@ class FeatureUnlockedCutScene : public GUIEngine::Screen, public GUIEngine::Scre
irr::core::stringw m_unlock_message;
UnlockedThing(std::string model, irr::core::stringw msg);
UnlockedThing(KartProperties* kart, irr::core::stringw msg);
/**
@ -136,21 +141,28 @@ public:
/** 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. */
void addUnlockedKart(KartProperties* unlocked_kart, irr::core::stringw msg);
// unused for now, maybe will be useful later?
//void addUnlockedKart(KartProperties* unlocked_kart, irr::core::stringw msg);
/** 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, irr::core::stringw msg);
// unused for now, maybe will be useful later?
//void addUnlockedPicture(irr::video::ITexture* picture, float w, float h, 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);
// unused for now, maybe will be useful later?
//void addUnlockedPictures(std::vector<irr::video::ITexture*> pictures,
// float w, float h, irr::core::stringw msg);
/** 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);
*/
void addTrophy(RaceManager::Difficulty difficulty);
/** override from base class to handle escape press */
virtual bool onEscapePressed();

View File

@ -271,17 +271,17 @@ void GrandPrixLose::eventCallback(GUIEngine::Widget* widget,
// un-set the GP mode so that after unlocking, it doesn't try to continue the GP
race_manager->setMajorMode (RaceManager::MAJOR_MODE_SINGLE);
if (unlock_manager->getCurrentSlot()->getRecentlyUnlockedFeatures().size() > 0)
if (unlock_manager->getCurrentSlot()->getRecentlyCompletedChallenges().size() > 0)
{
std::vector<const ChallengeData*> unlocked =
unlock_manager->getCurrentSlot()->getRecentlyUnlockedFeatures();
unlock_manager->getCurrentSlot()->getRecentlyCompletedChallenges();
unlock_manager->getCurrentSlot()->clearUnlocked();
FeatureUnlockedCutScene* scene =
FeatureUnlockedCutScene::getInstance();
assert(unlocked.size() > 0);
scene->addUnlockedThings(unlocked);
scene->addTrophy(race_manager->getDifficulty());
StateManager::get()->replaceTopMostScreen(scene);
}

View File

@ -95,7 +95,7 @@ void GrandPrixWin::loadedFromFile()
void GrandPrixWin::init()
{
Screen::init();
if (unlock_manager->getCurrentSlot()->getRecentlyUnlockedFeatures().size() > 0)
if (unlock_manager->getCurrentSlot()->getRecentlyCompletedChallenges().size() > 0)
{
const core::dimension2d<u32>& frame_size = GUIEngine::getDriver()->getCurrentRenderTargetSize();
@ -393,17 +393,17 @@ void GrandPrixWin::eventCallback(GUIEngine::Widget* widget,
// un-set the GP mode so that after unlocking, it doesn't try to continue the GP
race_manager->setMajorMode (RaceManager::MAJOR_MODE_SINGLE);
if (unlock_manager->getCurrentSlot()->getRecentlyUnlockedFeatures().size() > 0)
if (unlock_manager->getCurrentSlot()->getRecentlyCompletedChallenges().size() > 0)
{
std::vector<const ChallengeData*> unlocked =
unlock_manager->getCurrentSlot()->getRecentlyUnlockedFeatures();
unlock_manager->getCurrentSlot()->getRecentlyCompletedChallenges();
unlock_manager->getCurrentSlot()->clearUnlocked();
FeatureUnlockedCutScene* scene =
FeatureUnlockedCutScene::getInstance();
assert(unlocked.size() > 0);
scene->addUnlockedThings(unlocked);
scene->addTrophy(race_manager->getDifficulty());
StateManager::get()->replaceTopMostScreen(scene);
}

View File

@ -51,7 +51,9 @@ using namespace irr;
const int LOCKED = 0;
const int OPEN = 1;
const int COMPLETED = 2;
const int COMPLETED_EASY = 2;
const int COMPLETED_MEDIUM = 3;
const int COMPLETED_HARD = 4;
/** The constructor is called before anything is attached to the scene node.
* So rendering to a texture can be done here. But world is not yet fully
@ -60,8 +62,10 @@ const int COMPLETED = 2;
RaceGUIOverworld::RaceGUIOverworld()
{
m_enabled = true;
m_trophy = irr_driver->getTexture( file_manager->getTextureFile("cup_gold.png") );
m_trophy1 = irr_driver->getTexture( file_manager->getTextureFile("cup_bronze.png") );
m_trophy2 = irr_driver->getTexture( file_manager->getTextureFile("cup_silver.png") );
m_trophy3 = irr_driver->getTexture( file_manager->getTextureFile("cup_gold.png") );
const float scaling = irr_driver->getFrameSize().Height / 420.0f;
// Marker texture has to be power-of-two for (old) OpenGL compliance
m_marker_rendered_size = 2 << ((int) ceil(1.0 + log(32.0 * scaling)));
@ -101,18 +105,14 @@ RaceGUIOverworld::RaceGUIOverworld()
gui::ScalableFont* font = GUIEngine::getFont();
m_trophy_points_width = font->getDimension(L"100").Width;
const std::vector<const ChallengeData*>& v = unlock_manager->getCurrentSlot()->getLockedChallenges();
for (unsigned int n=0; n<v.size(); n++)
{
m_locked_challenges.insert(v[n]);
}
m_lock = irr_driver->getTexture( file_manager->getTextureFile("gui_lock.png") );
m_open_challenge = irr_driver->getTexture( file_manager->getGUIDir() + "challenge.png" );
m_icons[0] = m_lock;
m_icons[1] = m_open_challenge;
m_icons[2] = m_trophy;
m_icons[2] = m_trophy1;
m_icons[3] = m_trophy2;
m_icons[4] = m_trophy3;
} // RaceGUIOverworld
//-----------------------------------------------------------------------------
@ -217,9 +217,9 @@ void RaceGUIOverworld::drawTrophyPoints()
const int size = UserConfigParams::m_width/20;
core::rect<s32> dest(pos.UpperLeftCorner.X - size - 5, pos.UpperLeftCorner.Y,
pos.UpperLeftCorner.X - 5, pos.UpperLeftCorner.Y + size);
core::rect<s32> source(core::position2di(0, 0), m_trophy->getSize());
core::rect<s32> source(core::position2di(0, 0), m_trophy3->getSize());
irr_driver->getVideoDriver()->draw2DImage(m_trophy, dest, source, NULL,
irr_driver->getVideoDriver()->draw2DImage(m_trophy3, dest, source, NULL,
NULL, true /* alpha */);
pos.LowerRightCorner.Y = dest.LowerRightCorner.Y;
@ -321,8 +321,10 @@ void RaceGUIOverworld::drawGlobalMiniMap()
int state = (challenges[n].m_force_field.m_is_locked ? LOCKED : OPEN);
const Challenge* c = unlock_manager->getCurrentSlot()->getChallenge(challenges[n].m_challenge_id);
if (c->isSolved()) state = COMPLETED;
if (c->isSolved(RaceManager::RD_HARD)) state = COMPLETED_HARD;
else if (c->isSolved(RaceManager::RD_MEDIUM)) state = COMPLETED_MEDIUM;
else if (c->isSolved(RaceManager::RD_EASY)) state = COMPLETED_EASY;
const core::rect<s32> source(core::position2d<s32>(0,0),
m_icons[state]->getOriginalSize());

View File

@ -61,11 +61,13 @@ private:
/** The mini map of the track. */
video::ITexture *m_mini_map;
video::ITexture *m_trophy;
video::ITexture *m_trophy1;
video::ITexture *m_trophy2;
video::ITexture *m_trophy3;
video::ITexture *m_lock;
video::ITexture *m_open_challenge;
video::ITexture* m_icons[3];
video::ITexture* m_icons[5];
/** The size of a single marker on the screen for AI karts,
* need not be a power of 2. */
@ -95,8 +97,6 @@ private:
int m_trophy_points_width;
std::set<const ChallengeData*> m_locked_challenges;
/* Display informat for one player on the screen. */
void drawEnergyMeter (int x, int y, const Kart *kart,
const core::recti &viewport,

View File

@ -90,7 +90,7 @@ void RaceResultGUI::enableAllButtons()
// If something was unlocked
// -------------------------
int n = unlock_manager->getCurrentSlot()->getRecentlyUnlockedFeatures().size();
int n = unlock_manager->getCurrentSlot()->getRecentlyCompletedChallenges().size();
if(n>0)
{
top->setText(n==1 ? _("See unlocked feature")
@ -137,7 +137,7 @@ void RaceResultGUI::eventCallback(GUIEngine::Widget* widget,
// If something was unlocked, the 'continue' button was
// actually used to display "Show unlocked feature(s)" text.
// ---------------------------------------------------------
int n = unlock_manager->getCurrentSlot()->getRecentlyUnlockedFeatures().size();
int n = unlock_manager->getCurrentSlot()->getRecentlyCompletedChallenges().size();
if(n>0)
{
if(name=="top")
@ -148,11 +148,11 @@ void RaceResultGUI::eventCallback(GUIEngine::Widget* widget,
}
std::vector<const ChallengeData*> unlocked =
unlock_manager->getCurrentSlot()->getRecentlyUnlockedFeatures();
unlock_manager->getCurrentSlot()->getRecentlyCompletedChallenges();
unlock_manager->getCurrentSlot()->clearUnlocked();
FeatureUnlockedCutScene* scene =
FeatureUnlockedCutScene::getInstance();
scene->addUnlockedThings(unlocked);
scene->addTrophy(race_manager->getDifficulty());
StateManager::get()->popMenu();
StateManager::get()->pushScreen(scene);
World::deleteWorld();