Locked skidding (which can now be selected as the hardest difficulty).

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1792 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2008-05-01 14:41:15 +00:00
parent a381a2ed94
commit cc51a56827
7 changed files with 43 additions and 9 deletions

View File

@ -24,9 +24,9 @@
WorldsEndGP::WorldsEndGP() : Challenge("worldsendgp","Win the At World's End Grand Prix")
{
setChallengeDescription("Come first in the At World's End\nGrand Prix with 3 'Racer' Level AI karts.");
setFeatureDescription("New Grand Prix: All Track's GP\nand Bonus Preview: Skidding\nnow available");
setFeatureDescription("New Grand Prix: All Track's GP\nand Bonus Preview: Skidding\nnow available.\nSelect 'skidding' as difficulty.");
setFeature("All tracks");
//TODO setFeature(""); Add Skidding Preview
setFeature("skidding"); // Add Skidding Preview
addDependency("islandfollow");
addDependency("racetracktime");
addDependency("tollwaytime");

View File

@ -18,8 +18,10 @@
#include "race_manager.hpp"
#include "race_options.hpp"
#include "widget_manager.hpp"
#include "user_config.hpp"
#include "menu_manager.hpp"
#include "material_manager.hpp"
#include "unlock_manager.hpp"
#include "translation.hpp"
#if defined(WIN32) && !defined(__CYGWIN__)
# define snprintf _snprintf
@ -133,7 +135,12 @@ void RaceOptions::select()
switch ( widget_manager->getSelectedWgt() )
{
case WTOK_DIFFICULTY_UP:
if( m_difficulty == RaceManager::RD_MEDIUM )
if( m_difficulty == RaceManager::RD_HARD && !unlock_manager->isLocked("skidding"))
{
m_difficulty = RaceManager::RD_SKIDDING;
widget_manager->setWgtText( WTOK_DIFFICULTY, _("Skidding Preview") );
}
else if( m_difficulty == RaceManager::RD_MEDIUM )
{
m_difficulty = RaceManager::RD_HARD;
widget_manager->setWgtText( WTOK_DIFFICULTY, _("Racer") );
@ -146,7 +153,13 @@ void RaceOptions::select()
break;
case WTOK_DIFFICULTY_DOWN:
if( m_difficulty == RaceManager::RD_HARD )
if( m_difficulty == RaceManager::RD_SKIDDING )
{
m_difficulty = RaceManager::RD_HARD;
widget_manager->setWgtText( WTOK_DIFFICULTY, _("Racer") );
}
else if( m_difficulty == RaceManager::RD_HARD )
{
m_difficulty = RaceManager::RD_MEDIUM;
widget_manager->setWgtText( WTOK_DIFFICULTY, _("Driver") );
@ -214,7 +227,11 @@ void RaceOptions::select()
case WTOK_START:
if( race_manager->getRaceMode() != RaceManager::RM_TIME_TRIAL )
{
if( m_difficulty == RaceManager::RD_HARD )
if( m_difficulty == RaceManager::RD_SKIDDING )
{
race_manager->setDifficulty( RaceManager::RD_SKIDDING );
}
else if( m_difficulty == RaceManager::RD_HARD )
{
race_manager->setDifficulty( RaceManager::RD_HARD );
}

View File

@ -598,7 +598,7 @@ void Kart::update(float dt)
// track again)
if (material->isReset() && isOnGround()) forceRescue();
else if(material->isZipper() && isOnGround()) handleZipper();
else // neither zipper nor reset --> set friction
else if(user_config->m_skidding) // set friction otherwise if it's enabled
{
for(int i=0; i<m_vehicle->getNumWheels(); i++)
{
@ -712,7 +712,7 @@ float Kart::handleWheelie(float dt)
{
// Disable the upright constraint, since it will otherwise
// work against the wheelie
m_uprightConstraint->setLimit(m_kart_properties->getUprightTolerance());
m_uprightConstraint->setLimit(M_PI);
if ( m_wheelie_angle < getWheelieMaxPitch() )
m_wheelie_angle += getWheeliePitchRate() * dt;

View File

@ -85,6 +85,21 @@ void RaceManager::setNumPlayers(int num)
}
} // setNumPlayers
//-----------------------------------------------------------------------------
void RaceManager::setDifficulty(Difficulty diff)
{
if(diff==RD_SKIDDING)
{
m_difficulty = RD_HARD;
user_config->m_skidding = true;
}
else
{
m_difficulty = diff;
user_config->m_skidding = false;
}
} // setDifficulty
//-----------------------------------------------------------------------------
void RaceManager::setTrack(const std::string& track)
{

View File

@ -48,7 +48,7 @@ class RaceManager
public:
enum RaceModeType { RM_TIME_TRIAL, RM_QUICK_RACE, RM_GRAND_PRIX,
RM_FOLLOW_LEADER };
enum Difficulty { RD_EASY, RD_MEDIUM, RD_HARD };
enum Difficulty { RD_EASY, RD_MEDIUM, RD_HARD, RD_SKIDDING };
private:
struct KartStatus
@ -105,7 +105,7 @@ public:
void setNumPlayers(int num);
void reset();
void setGrandPrix(const CupData &cup) { m_cup = cup; }
void setDifficulty(Difficulty diff) { m_difficulty = diff; }
void setDifficulty(Difficulty diff);
void setNumLaps(int num) { m_num_laps.clear();
m_num_laps.push_back(num); }
void setTrack(const std::string& track);

View File

@ -104,6 +104,7 @@ void UserConfig::setDefaults()
m_herring_style = "new";
m_background_music = "";
m_profile = 0;
m_skidding = false;
m_use_kph = false;
m_replay_history = false;
m_width = 800;

View File

@ -169,6 +169,7 @@ public:
bool m_display_fps;
int m_profile; // Positive number: time in seconds, neg: # laps
// 0 if no profiling. Never saved in config file!
bool m_skidding;
std::string m_herring_style;
std::string m_username;
std::string m_background_music;