Missing updates in previous commit.
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@2189 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
88c0b07f69
commit
d6490dc48c
17
data/followtheleader.challenge
Normal file
17
data/followtheleader.challenge
Normal file
@ -0,0 +1,17 @@
|
||||
;; -*- mode: lisp -*-
|
||||
|
||||
(challenge
|
||||
(id "penguinplaygroundgp")
|
||||
(name _("Win Penguin Playground Grand\nPrix"))
|
||||
(description _("Win Penguin Playground Grand\nPrix with 3 'Racer' Level AI karts."))
|
||||
(unlock-mode "followtheleader" _("Follow the Leader"))
|
||||
(major "grandprix")
|
||||
(minor "quickrace")
|
||||
(gp "penguinplayground")
|
||||
(difficulty "hard")
|
||||
(karts 4)
|
||||
(position 1)
|
||||
)
|
||||
|
||||
;; EOF ;;
|
||||
|
@ -22,6 +22,8 @@
|
||||
#include "world.hpp"
|
||||
#include "race_manager.hpp"
|
||||
#include "track_manager.hpp"
|
||||
#include "kart_properties_manager.hpp"
|
||||
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
# define snprintf _snprintf
|
||||
#endif
|
||||
@ -93,6 +95,15 @@ void Challenge::addUnlockDifficultyReward(std::string internal_name, std::string
|
||||
m_feature.push_back(feature);
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void Challenge::addUnlockKartReward(std::string internal_name, std::string user_name)
|
||||
{
|
||||
UnlockableFeature feature;
|
||||
feature.name = internal_name;
|
||||
feature.type = UNLOCK_KART;
|
||||
feature.user_name = user_name;
|
||||
m_feature.push_back(feature);
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
const std::string Challenge::getUnlockedMessage() const
|
||||
{
|
||||
std::string unlocked_message;
|
||||
@ -109,10 +120,10 @@ const std::string Challenge::getUnlockedMessage() const
|
||||
switch(m_feature[n].type)
|
||||
{
|
||||
case UNLOCK_TRACK:
|
||||
{
|
||||
{ // {} avoids compiler warning
|
||||
Track* track = track_manager->getTrack( m_feature[n].name );
|
||||
snprintf(message, 127, _("New track '%s'\nnow available"), _(track->getName()) );
|
||||
break;
|
||||
break;
|
||||
}
|
||||
case UNLOCK_MODE:
|
||||
snprintf(message, 127, _("New game mode\n'%s'\nnow available"), m_feature[n].user_name.c_str() );
|
||||
@ -123,9 +134,13 @@ const std::string Challenge::getUnlockedMessage() const
|
||||
case UNLOCK_DIFFICULTY:
|
||||
snprintf(message, 127, _("New difficulty\n'%s'\nnow available"), m_feature[n].user_name.c_str() );
|
||||
break;
|
||||
}
|
||||
case UNLOCK_KART:
|
||||
const KartProperties *kp=kart_properties_manager->getKart(m_feature[n].name );
|
||||
snprintf(message, 127, _("New kart\n'%s'\nnow available"), kp->getName());
|
||||
break;
|
||||
} // switch
|
||||
unlocked_message += message;
|
||||
}
|
||||
} // for n
|
||||
|
||||
return unlocked_message;
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ enum REWARD_TYPE
|
||||
{UNLOCK_TRACK,
|
||||
UNLOCK_GP,
|
||||
UNLOCK_MODE,
|
||||
UNLOCK_KART,
|
||||
UNLOCK_DIFFICULTY};
|
||||
|
||||
struct UnlockableFeature
|
||||
@ -53,18 +54,21 @@ class Challenge
|
||||
std::vector<std::string> m_prerequisites; // what needs to be done before accessing this challenge
|
||||
public:
|
||||
Challenge(std::string id, std::string name);
|
||||
Challenge() {m_Id=""; m_Name="";}
|
||||
virtual ~Challenge() {};
|
||||
const std::string& getId() const {return m_Id; }
|
||||
const std::string& getName() const {return m_Name; }
|
||||
|
||||
const std::string& getId() const { return m_Id; }
|
||||
const std::string& getName() const { return m_Name; }
|
||||
void setName(const std::string& s) { m_Name = s; }
|
||||
void setId(const std::string& s) { m_Id = s; }
|
||||
void addUnlockTrackReward(std::string track_name);
|
||||
void addUnlockModeReward(std::string internal_mode_name, std::string user_mode_name);
|
||||
void addUnlockGPReward(std::string gp_name);
|
||||
void addUnlockDifficultyReward(std::string internal_name, std::string user_name);
|
||||
void addUnlockKartReward(std::string internal_name, std::string user_name);
|
||||
|
||||
const std::string getUnlockedMessage() const;
|
||||
const std::vector<UnlockableFeature>&
|
||||
getFeatures() const {return m_feature; }
|
||||
getFeatures() const { return m_feature; }
|
||||
void setChallengeDescription(const std::string& d)
|
||||
{m_challenge_description=d; }
|
||||
const std::string&
|
||||
|
252
src/challenges/challenge_data.cpp
Executable file
252
src/challenges/challenge_data.cpp
Executable file
@ -0,0 +1,252 @@
|
||||
// $Id: challenge_data.cpp 2173 2008-07-21 01:55:41Z auria $
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2008 Joerg Henrichs
|
||||
//
|
||||
// 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.
|
||||
#include <stdexcept>
|
||||
|
||||
#include "challenges/challenge_data.hpp"
|
||||
#include "lisp/lisp.hpp"
|
||||
#include "lisp/parser.hpp"
|
||||
#include "translation.hpp"
|
||||
#include "world.hpp"
|
||||
#include "cup_data.hpp"
|
||||
#include "grand_prix_manager.hpp"
|
||||
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
# define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
|
||||
ChallengeData::ChallengeData(const std::string& filename)
|
||||
{
|
||||
m_filename = filename;
|
||||
m_major = RaceManager::RM_SINGLE;
|
||||
m_minor = RaceManager::RM_SINGLE;
|
||||
m_difficulty = RaceManager::RD_EASY;
|
||||
m_num_laps = -1;
|
||||
m_num_karts = -1;
|
||||
|
||||
m_time = -1.0f;
|
||||
m_track_name = "";
|
||||
m_gp_id = "";
|
||||
m_energy = -1;
|
||||
|
||||
lisp::Parser parser;
|
||||
const lisp::Lisp* const ROOT = parser.parse(filename);
|
||||
|
||||
const lisp::Lisp* const lisp = ROOT->getLisp("challenge");
|
||||
if(!lisp)
|
||||
{
|
||||
delete ROOT;
|
||||
char msg[MAX_ERROR_MESSAGE_LENGTH];
|
||||
snprintf(msg, sizeof(msg),
|
||||
"Couldn't load challenge '%s': no challenge node.",
|
||||
filename.c_str());
|
||||
throw std::runtime_error(msg);
|
||||
}
|
||||
|
||||
std::string mode;
|
||||
lisp->get("major", mode);
|
||||
|
||||
if(mode=="grandprix")
|
||||
m_major = RaceManager::RM_GRAND_PRIX;
|
||||
else if(mode=="single")
|
||||
m_major = RaceManager::RM_SINGLE;
|
||||
else
|
||||
error("major");
|
||||
|
||||
lisp->get ("minor", mode);
|
||||
if(mode=="timetrial")
|
||||
m_minor = RaceManager::RM_TIME_TRIAL;
|
||||
else if(mode=="quickrace")
|
||||
m_minor = RaceManager::RM_QUICK_RACE;
|
||||
else if(mode=="followtheleader")
|
||||
m_minor = RaceManager::RM_FOLLOW_LEADER;
|
||||
else
|
||||
error("minor");
|
||||
std::string s;
|
||||
if(!lisp->get("name", s) ) error("name");
|
||||
setName(s);
|
||||
if(!lisp->get("id", s) ) error("id");
|
||||
setId(s);
|
||||
if(!lisp->get("description", s) ) error("description");
|
||||
setChallengeDescription(s);
|
||||
if(!lisp->get("karts", m_num_karts) ) error("karts");
|
||||
// Position is optional except in GP and FTL
|
||||
if(!lisp->get("position", m_position) &&
|
||||
(m_minor==RaceManager::RM_FOLLOW_LEADER ||
|
||||
m_major==RaceManager::RM_GRAND_PRIX))
|
||||
error("position");
|
||||
lisp->get("difficulty", s);
|
||||
if(s=="easy")
|
||||
m_difficulty = RaceManager::RD_EASY;
|
||||
else if(s=="medium")
|
||||
m_difficulty = RaceManager::RD_MEDIUM;
|
||||
else if(s=="hard")
|
||||
m_difficulty = RaceManager::RD_HARD;
|
||||
else
|
||||
error("difficulty");
|
||||
|
||||
lisp->get("time", m_time ); // one of time/position
|
||||
lisp->get("position", m_position ); // must be set
|
||||
if(m_time<0 && m_position<0) error("position/time");
|
||||
lisp->get("energy", m_energy ); // This is optional
|
||||
if(m_major==RaceManager::RM_SINGLE)
|
||||
{
|
||||
if(!lisp->get("track", m_track_name )) error("track");
|
||||
if(!lisp->get("laps", m_num_laps ) &&
|
||||
m_minor!=RaceManager::RM_FOLLOW_LEADER)
|
||||
error("laps");
|
||||
}
|
||||
else // GP
|
||||
{
|
||||
if(!lisp->get("gp", m_gp_id )) error("gp");
|
||||
}
|
||||
|
||||
getUnlocks(lisp, "unlock-track", UNLOCK_TRACK);
|
||||
getUnlocks(lisp, "unlock-gp", UNLOCK_GP );
|
||||
getUnlocks(lisp, "unlock-mode", UNLOCK_MODE );
|
||||
getUnlocks(lisp, "unlock-difficulty", UNLOCK_DIFFICULTY);
|
||||
getUnlocks(lisp, "unlock-kart", UNLOCK_KART);
|
||||
|
||||
std::vector<std::string> vec;
|
||||
lisp->getVector("depend-on", vec);
|
||||
for(unsigned int i=0; i<vec.size(); i++) addDependency(vec[i]);
|
||||
delete ROOT;
|
||||
|
||||
} // ChallengeData
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void ChallengeData::error(const char *id)
|
||||
{
|
||||
char msg[MAX_ERROR_MESSAGE_LENGTH];
|
||||
snprintf(msg, sizeof(msg), "Undefined or incorrect value for '%s' in challenge file '%s'.",
|
||||
id, m_filename.c_str());
|
||||
throw std::runtime_error(msg);
|
||||
} // error
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
|
||||
void ChallengeData::getUnlocks(const lisp::Lisp *lisp, const char* type,
|
||||
REWARD_TYPE reward)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
v.clear();
|
||||
|
||||
lisp->getVector(type, v);
|
||||
for(unsigned int i=0; i<v.size(); i++)
|
||||
{
|
||||
switch(reward)
|
||||
{
|
||||
case UNLOCK_TRACK: addUnlockTrackReward (v[i] ); break;
|
||||
case UNLOCK_GP: addUnlockGPReward (v[i] ); break;
|
||||
case UNLOCK_MODE: if(i+1<v.size())
|
||||
{
|
||||
addUnlockModeReward (v[i], v[i+1]);
|
||||
i++; break;
|
||||
}
|
||||
else
|
||||
fprintf(stderr, "Unlock mode name missing.\n");
|
||||
break;
|
||||
case UNLOCK_DIFFICULTY: if(i+1<v.size())
|
||||
{
|
||||
addUnlockDifficultyReward(v[i], v[i+1]);
|
||||
i++;
|
||||
}
|
||||
else
|
||||
fprintf(stderr, "Difficult name missing.\n");
|
||||
break;
|
||||
case UNLOCK_KART: if(i+1<v.size())
|
||||
{
|
||||
addUnlockKartReward(v[i], v[i+1]);
|
||||
i++;
|
||||
}
|
||||
else
|
||||
fprintf(stderr, "Kart name missing.\n");
|
||||
break;
|
||||
} // switch
|
||||
}
|
||||
} // getUnlocks
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void ChallengeData::setRace() const
|
||||
{
|
||||
race_manager->setMajorMode(m_major);
|
||||
if(m_major==RaceManager::RM_SINGLE)
|
||||
{
|
||||
race_manager->setMinorMode(m_minor);
|
||||
race_manager->setTrack(m_track_name);
|
||||
race_manager->setDifficulty(m_difficulty);
|
||||
race_manager->setNumLaps(m_num_laps);
|
||||
race_manager->setNumKarts(m_num_karts);
|
||||
race_manager->setNumPlayers(1);
|
||||
}
|
||||
else // GP
|
||||
{
|
||||
race_manager->setMinorMode(m_minor);
|
||||
const CupData *cup = grand_prix_manager->getCup(m_gp_id);
|
||||
race_manager->setGrandPrix(*cup);
|
||||
race_manager->setDifficulty(m_difficulty);
|
||||
race_manager->setNumKarts(m_num_karts);
|
||||
race_manager->setNumPlayers(1);
|
||||
//race_manager->setGrandPrix();
|
||||
}
|
||||
} // setRace
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
bool ChallengeData::raceFinished()
|
||||
{
|
||||
// GP's use the grandPrixFinished() function, so they can't be fulfilled here.
|
||||
if(m_major==RaceManager::RM_GRAND_PRIX) return false;
|
||||
|
||||
// Single races
|
||||
// ------------
|
||||
std::string track_name = world->getTrack()->getIdent();
|
||||
if(track_name!=m_track_name ) return false; // wrong track
|
||||
if((int)race_manager->getNumKarts()<m_num_karts) return false; // not enough AI karts
|
||||
|
||||
Kart* kart=world->getPlayerKart(0);
|
||||
if(m_energy>0 && kart->getNumHerring()<m_energy) return false; // not enough energy
|
||||
if(m_position>0 && kart->getPosition()>m_position) return false; // too far behind
|
||||
|
||||
// Follow the leader
|
||||
// -----------------
|
||||
if(m_minor==RaceManager::RM_FOLLOW_LEADER)
|
||||
{
|
||||
// All possible conditions were already checked, so: must have been successful
|
||||
return true;
|
||||
}
|
||||
// Quickrace / Timetrial
|
||||
// ---------------------
|
||||
if(kart->getLap()!=m_num_laps) return false; // wrong number of laps
|
||||
if(m_time>0.0f && kart->getFinishTime()>m_time) return false; // too slow
|
||||
return true;
|
||||
} // raceFinished
|
||||
// ----------------------------------------------------------------------------
|
||||
bool ChallengeData::grandPrixFinished()
|
||||
{
|
||||
if (race_manager->getMajorMode() != RaceManager::RM_GRAND_PRIX ||
|
||||
race_manager->getMinorMode() != m_minor ||
|
||||
race_manager->getGrandPrix()->getId() != m_gp_id ||
|
||||
race_manager->getDifficulty()!= m_difficulty ||
|
||||
race_manager->getNumKarts() < (unsigned int)m_num_karts ||
|
||||
race_manager->getNumPlayers() > 1) return false;
|
||||
|
||||
Kart* kart=world->getPlayerKart(0);
|
||||
if(kart->getPosition()>m_position) return false;
|
||||
return true;
|
||||
} // grandPrixFinished
|
57
src/challenges/challenge_data.hpp
Executable file
57
src/challenges/challenge_data.hpp
Executable file
@ -0,0 +1,57 @@
|
||||
// $Id: challenge_data.hpp 2173 2008-07-21 01:55:41Z auria $
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2008 Joerg Henrichs
|
||||
//
|
||||
// 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_CHALLENGE_DATA_H
|
||||
#define HEADER_CHALLENGE_DATA_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "challenges/challenge.hpp"
|
||||
#include "race_manager.hpp"
|
||||
|
||||
class ChallengeData : public Challenge
|
||||
{
|
||||
private:
|
||||
RaceManager::RaceModeType m_major;
|
||||
RaceManager::RaceModeType m_minor;
|
||||
RaceManager::Difficulty m_difficulty;
|
||||
int m_num_laps;
|
||||
int m_position;
|
||||
int m_num_karts;
|
||||
float m_time;
|
||||
std::string m_gp_id;
|
||||
std::string m_track_name;
|
||||
int m_energy;
|
||||
std::vector<std::string> m_depends_on;
|
||||
std::vector<UnlockableFeature> m_unlock;
|
||||
|
||||
std::string m_filename;
|
||||
void getUnlocks(const lisp::Lisp *lisp, const char* type, REWARD_TYPE reward);
|
||||
void error(const char *id);
|
||||
|
||||
public:
|
||||
ChallengeData(const std::string& filename);
|
||||
void setRace() const;
|
||||
virtual bool raceFinished();
|
||||
virtual bool grandPrixFinished();
|
||||
}; // ChallengeData
|
||||
|
||||
#endif
|
@ -1,53 +0,0 @@
|
||||
// $Id$
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2008 Joerg Henrichs
|
||||
//
|
||||
// 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 ruseful,
|
||||
// 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.
|
||||
|
||||
#include "translation.hpp"
|
||||
#include "challenges/city_time.hpp"
|
||||
#include "world.hpp"
|
||||
#include "race_manager.hpp"
|
||||
|
||||
CityTime::CityTime() : Challenge("citytime", _("Finish the City track in 5:20"))
|
||||
{
|
||||
setChallengeDescription(_("Finish 3 laps on the City track\nwith 3 AI karts\nin under 5:20 minutes."));
|
||||
addUnlockTrackReward("snowtuxpeak");
|
||||
addDependency("junglefollow");
|
||||
} // CityTime
|
||||
//-----------------------------------------------------------------------------
|
||||
void CityTime::setRace() const {
|
||||
race_manager->setMajorMode(RaceManager::RM_SINGLE);
|
||||
race_manager->setMinorMode(RaceManager::RM_QUICK_RACE);
|
||||
race_manager->setTrack("city");
|
||||
race_manager->setDifficulty(RaceManager::RD_EASY);
|
||||
race_manager->setNumLaps(3);
|
||||
race_manager->setNumKarts(4);
|
||||
race_manager->setNumPlayers(1);
|
||||
} // setRace
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CityTime::raceFinished()
|
||||
{
|
||||
std::string track_name = world->getTrack()->getIdent();
|
||||
if(track_name!="city" ) return false; // wrong track
|
||||
Kart* kart=world->getPlayerKart(0);
|
||||
if(kart->getFinishTime()>320) return false; // too slow
|
||||
if(kart->getLap()!=3 ) return false; // wrong number of laps
|
||||
if(race_manager->getNumKarts()<4) return false; //not enough AI karts
|
||||
return true;
|
||||
} // raceFinished
|
||||
//-----------------------------------------------------------------------------
|
@ -1,37 +0,0 @@
|
||||
// $Id$
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2008 Joerg Henrichs
|
||||
//
|
||||
// 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 CITY_TIME_H
|
||||
#define CITY_TIME_H
|
||||
|
||||
|
||||
#include "challenges/challenge.hpp"
|
||||
|
||||
class CityTime : public Challenge
|
||||
{
|
||||
public:
|
||||
CityTime();
|
||||
virtual bool raceFinished();
|
||||
virtual void setRace() const;
|
||||
}; // CityTime
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /*CITY_TIME_H*/
|
@ -1,55 +0,0 @@
|
||||
// $Id: energy_math_class.cpp 1259 2007-09-24 12:28:19Z hiker $
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2008 Joerg Henrichs
|
||||
//
|
||||
// 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 ruseful,
|
||||
// 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.
|
||||
|
||||
#include <algorithm>
|
||||
#include "translation.hpp"
|
||||
#include "challenges/energy_math_class.hpp"
|
||||
#include "race_manager.hpp"
|
||||
#include "world.hpp"
|
||||
|
||||
EnergyMathClass::EnergyMathClass() : Challenge("energymathclass", _("Collect Coins in Math Class"))
|
||||
{
|
||||
setChallengeDescription(_("Collect at least 6 points\nworth of coins\non three laps of\nOliver's Math Class\nin under 1 minute."));
|
||||
addUnlockTrackReward("crescentcrossing");
|
||||
} // EnergyMathClass
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void EnergyMathClass::setRace() const {
|
||||
race_manager->setMajorMode(RaceManager::RM_SINGLE);
|
||||
race_manager->setMajorMode(RaceManager::RM_QUICK_RACE);
|
||||
race_manager->setTrack("olivermath");
|
||||
race_manager->setDifficulty(RaceManager::RD_EASY);
|
||||
race_manager->setNumLaps(3);
|
||||
race_manager->setNumKarts(1);
|
||||
race_manager->setNumPlayers(1);
|
||||
race_manager->setCoinTarget(6);
|
||||
} // setRace
|
||||
\
|
||||
//-----------------------------------------------------------------------------
|
||||
bool EnergyMathClass::raceFinished()
|
||||
{
|
||||
std::string track_name = world->getTrack()->getIdent();
|
||||
if(track_name!="olivermath") return false; // wrong track
|
||||
Kart* kart=world->getPlayerKart(0);
|
||||
if(kart->getFinishTime()>60) return false; // too slow
|
||||
if(kart->getLap()!=3 ) return false; // wrong number of laps
|
||||
if(kart->getNumHerring()<6 ) return false; // not enough herrings
|
||||
return true;
|
||||
} // raceFinished
|
||||
//-----------------------------------------------------------------------------
|
@ -1,36 +0,0 @@
|
||||
// $Id: energy_math_class.hpp 1259 2007-09-24 12:28:19Z hiker $
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2008 Joerg Henrichs
|
||||
//
|
||||
// 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_ENERGY_MATH_CLASS_H
|
||||
#define HEADER_ENERGY_MATH_CLASS_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "challenges/challenge.hpp"
|
||||
|
||||
class EnergyMathClass : public Challenge
|
||||
{
|
||||
public:
|
||||
EnergyMathClass();
|
||||
virtual bool raceFinished();
|
||||
virtual void setRace() const;
|
||||
}; // EnergyMathClass
|
||||
|
||||
#endif
|
@ -1,58 +0,0 @@
|
||||
// $Id$
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2008 Joerg Henrichs
|
||||
//
|
||||
// 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 ruseful,
|
||||
// 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.
|
||||
|
||||
#include "translation.hpp"
|
||||
#include "challenges/energy_shifting_sands.hpp"
|
||||
#include "race_manager.hpp"
|
||||
#include "world.hpp"
|
||||
|
||||
EnergyShiftingSands::EnergyShiftingSands() : Challenge("energyshiftingsands", _("Collect the Pharaohs Treasure"))
|
||||
{
|
||||
setChallengeDescription(_("Collect at least 9 coins\non 3 laps of Shifting Sands\nin under 2:20 minutes."));
|
||||
addUnlockGPReward("To the Moon and Back");
|
||||
// The energymathclass challenge must be done, otherwise GP can't be selected
|
||||
addDependency("energymathclass");
|
||||
addDependency("racetracktime");
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void EnergyShiftingSands::setRace() const {
|
||||
race_manager->setMajorMode(RaceManager::RM_SINGLE);
|
||||
race_manager->setMinorMode(RaceManager::RM_QUICK_RACE);
|
||||
race_manager->setTrack("sandtrack");
|
||||
race_manager->setDifficulty(RaceManager::RD_EASY);
|
||||
race_manager->setNumLaps(3);
|
||||
race_manager->setNumKarts(1);
|
||||
race_manager->setNumPlayers(1);
|
||||
race_manager->setCoinTarget(9);
|
||||
} // setRace
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool EnergyShiftingSands::raceFinished()
|
||||
{
|
||||
std::string track_name = world->getTrack()->getIdent();
|
||||
if(track_name!="sandtrack") return false; // wrong track
|
||||
Kart* kart=world->getPlayerKart(0);
|
||||
if(kart->getFinishTime()>140) return false; // too slow
|
||||
if(kart->getLap()!=3 ) return false; // wrong number of laps
|
||||
if(kart->getNumHerring()<9 ) return false; // not enough herrings
|
||||
return true;
|
||||
|
||||
} // raceFinished
|
||||
//-----------------------------------------------------------------------------
|
@ -1,36 +0,0 @@
|
||||
// $Id$
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2008 Joerg Henrichs
|
||||
//
|
||||
// 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 ENERGY_SHIFTING_SANDS_H
|
||||
#define ENERGY_SHIFTING_SANDS_H
|
||||
|
||||
|
||||
#include "challenges/challenge.hpp"
|
||||
|
||||
class EnergyShiftingSands : public Challenge
|
||||
{
|
||||
public:
|
||||
EnergyShiftingSands();
|
||||
virtual bool raceFinished();
|
||||
virtual void setRace() const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif /*ENERGY_SHIFTING_SANDS_H*/
|
@ -1,60 +0,0 @@
|
||||
// $Id$
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2008 Joerg Henrichs
|
||||
//
|
||||
// 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 ruseful,
|
||||
// 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.
|
||||
|
||||
#include "translation.hpp"
|
||||
#include "challenges/island_follow.hpp"
|
||||
#include "world.hpp"
|
||||
#include "race_manager.hpp"
|
||||
|
||||
IslandFollow::IslandFollow() : Challenge("islandfollow", _("Follow the Leader on a\nDesert Island"))
|
||||
{
|
||||
setChallengeDescription(_("Win a Follow the Leader race\nwith 3 AI karts\non a Desert Island."));
|
||||
addUnlockGPReward("At world's end");
|
||||
addDependency("moonandbackgp");
|
||||
addDependency("tollwaytime");
|
||||
addDependency("citytime");
|
||||
} // IslandFollow
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void IslandFollow::setRace() const {
|
||||
race_manager->setMajorMode(RaceManager::RM_SINGLE);
|
||||
race_manager->setMinorMode(RaceManager::RM_FOLLOW_LEADER);
|
||||
race_manager->setTrack("islandtrack");
|
||||
race_manager->setDifficulty(RaceManager::RD_EASY);
|
||||
race_manager->setNumLaps(3);
|
||||
race_manager->setNumKarts(4);
|
||||
race_manager->setNumPlayers(1);
|
||||
} // setRace
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool IslandFollow::raceFinished()
|
||||
{
|
||||
std::string track_name = world->getTrack()->getIdent();
|
||||
if(track_name!="islandtrack" ) return false; // wrong track
|
||||
if(race_manager->getNumKarts()<4) return false; //not enough AI karts
|
||||
//Check if player came first
|
||||
for(int i=0; i<(int)race_manager->getNumKarts(); i++)
|
||||
{
|
||||
const Kart* k=world->getKart(i);
|
||||
if(k->isPlayerKart()) return k->getPosition()==2;
|
||||
}
|
||||
return false;
|
||||
|
||||
} // raceFinished
|
||||
//-----------------------------------------------------------------------------
|
@ -1,34 +0,0 @@
|
||||
// $Id$
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2008 Joerg Henrichs
|
||||
//
|
||||
// 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 ISLAND_FOLLOW_H
|
||||
#define ISLAND_FOLLOW_H
|
||||
|
||||
#include "challenges/challenge.hpp"
|
||||
|
||||
class IslandFollow : public Challenge
|
||||
{
|
||||
public:
|
||||
IslandFollow();
|
||||
virtual bool raceFinished();
|
||||
virtual void setRace() const;
|
||||
}; // IslandFollow
|
||||
|
||||
|
||||
#endif /*ISLAND_FOLLOW_H*/
|
@ -1,59 +0,0 @@
|
||||
// $Id$
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2008 Joerg Henrichs
|
||||
//
|
||||
// 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 ruseful,
|
||||
// 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.
|
||||
|
||||
#include "translation.hpp"
|
||||
#include "challenges/jungle_follow.hpp"
|
||||
#include "world.hpp"
|
||||
#include "race_manager.hpp"
|
||||
|
||||
JungleFollow::JungleFollow() : Challenge("junglefollow", _("Follow the Leader in the Jungle"))
|
||||
{
|
||||
setChallengeDescription(_("Win a Follow the Leader race\nwith 3 AI karts\nin the Amazonian Jungle."));
|
||||
addUnlockTrackReward("city");
|
||||
addDependency("penguinplaygroundgp");
|
||||
addDependency("racetracktime");
|
||||
} // JungleFollow
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void JungleFollow::setRace() const {
|
||||
race_manager->setMajorMode(RaceManager::RM_SINGLE);
|
||||
race_manager->setMinorMode(RaceManager::RM_FOLLOW_LEADER);
|
||||
race_manager->setTrack("jungle");
|
||||
race_manager->setDifficulty(RaceManager::RD_EASY);
|
||||
race_manager->setNumLaps(3);
|
||||
race_manager->setNumKarts(4);
|
||||
race_manager->setNumPlayers(1);
|
||||
} // setRace
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool JungleFollow::raceFinished()
|
||||
{
|
||||
std::string track_name = world->getTrack()->getIdent();
|
||||
if(track_name!="jungle" ) return false; // wrong track
|
||||
if(race_manager->getNumKarts()<4) return false; //not enough AI karts
|
||||
//Check if player came first
|
||||
for(int i=0; i<(int)race_manager->getNumKarts(); i++)
|
||||
{
|
||||
const Kart* k=world->getKart(i);
|
||||
if(k->isPlayerKart()) return k->getPosition()==2;
|
||||
}
|
||||
return false;
|
||||
|
||||
} // raceFinished
|
||||
//-----------------------------------------------------------------------------
|
@ -1,33 +0,0 @@
|
||||
// $Id$
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2008 Joerg Henrichs
|
||||
//
|
||||
// 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 JUNGLE_FOLLOW_H
|
||||
#define JUNGLE_FOLLOW_H
|
||||
|
||||
#include "challenges/challenge.hpp"
|
||||
|
||||
class JungleFollow : public Challenge
|
||||
{
|
||||
public:
|
||||
JungleFollow();
|
||||
virtual bool raceFinished();
|
||||
virtual void setRace() const;
|
||||
}; // JungleFollow
|
||||
|
||||
#endif /*JUNGLE_FOLLOW_H*/
|
@ -1,64 +0,0 @@
|
||||
// $Id$
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2008 Joerg Henrichs
|
||||
//
|
||||
// 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 ruseful,
|
||||
// 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.
|
||||
|
||||
#include "translation.hpp"
|
||||
#include "challenges/moon_and_back_gp.hpp"
|
||||
#include "race_manager.hpp"
|
||||
#include "world.hpp"
|
||||
|
||||
MoonAndBackGP::MoonAndBackGP() : Challenge("moonandbackgp",_("Win To the Moon and Back\nGrand Prix"))
|
||||
{
|
||||
setChallengeDescription(_("Win the To the Moon and Back\nGrand Prix with 3 'Racer'\nLevel AI karts."));
|
||||
addUnlockGPReward("Snag Drive");
|
||||
// The energyshiftingsands challenge must be done, otherwise gp2 can't be selected
|
||||
// Thejunglefollow challenge must be done, to get city for gp3
|
||||
addDependency("energyshiftingsands");
|
||||
addDependency("junglefollow");
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void MoonAndBackGP::setRace() const {
|
||||
race_manager->setMajorMode(RaceManager::RM_GRAND_PRIX);
|
||||
race_manager->setMinorMode(RaceManager::RM_QUICK_RACE);
|
||||
CupData cup("gp2.cup");
|
||||
race_manager->setGrandPrix(cup);
|
||||
race_manager->setDifficulty(RaceManager::RD_HARD);
|
||||
race_manager->setNumKarts(4);
|
||||
race_manager->setNumPlayers(1);
|
||||
} // setRace
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool MoonAndBackGP::grandPrixFinished()
|
||||
{
|
||||
if (race_manager->getMajorMode() != RaceManager::RM_GRAND_PRIX ||
|
||||
race_manager->getMinorMode() != RaceManager::RM_QUICK_RACE ||
|
||||
race_manager->getGrandPrix()->getName() != _("To the Moon and Back") ||
|
||||
race_manager->getDifficulty()!= RaceManager::RD_HARD ||
|
||||
race_manager->getNumKarts() < 4 ||
|
||||
race_manager->getNumPlayers() > 1) return false;
|
||||
// Check if the player was in top 3:
|
||||
for(int i=0; i<(int)race_manager->getNumKarts(); i++)
|
||||
{
|
||||
const Kart* k=world->getKart(i);
|
||||
if(k->isPlayerKart() && !k->isEliminated()) return k->getPosition()==1;
|
||||
}
|
||||
return false;
|
||||
|
||||
} // grandPrixFinished
|
||||
//-----------------------------------------------------------------------------
|
@ -1,36 +0,0 @@
|
||||
// $Id$
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2008 Joerg Henrichs
|
||||
//
|
||||
// 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 MOON_AND_BACK_GP_H
|
||||
#define MOON_AND_BACK_GP_H
|
||||
|
||||
|
||||
#include "challenges/challenge.hpp"
|
||||
|
||||
class MoonAndBackGP : public Challenge
|
||||
{
|
||||
public:
|
||||
MoonAndBackGP();
|
||||
virtual bool grandPrixFinished();
|
||||
virtual void setRace() const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif /*MOON_AND_BACK_GP_H*/
|
@ -1,54 +0,0 @@
|
||||
// $Id: race_track_time.cpp 1259 2007-09-24 12:28:19Z hiker $
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2008 Joerg Henrichs
|
||||
//
|
||||
// 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 ruseful,
|
||||
// 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.
|
||||
|
||||
#include <algorithm>
|
||||
#include "translation.hpp"
|
||||
#include "challenges/race_track_time.hpp"
|
||||
#include "world.hpp"
|
||||
#include "race_manager.hpp"
|
||||
|
||||
RaceTrackTime::RaceTrackTime() : Challenge("racetracktime", _("Finish Race track in 1:15"))
|
||||
{
|
||||
setChallengeDescription(_("Finish 3 laps in the Race track\nwith 3 AI karts\nin under 1:15 minutes."));
|
||||
addUnlockTrackReward("jungle");
|
||||
} // RaceTrackTime
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void RaceTrackTime::setRace() const {
|
||||
race_manager->setMajorMode(RaceManager::RM_SINGLE);
|
||||
race_manager->setMinorMode(RaceManager::RM_QUICK_RACE);
|
||||
race_manager->setTrack("race");
|
||||
race_manager->setDifficulty(RaceManager::RD_EASY);
|
||||
race_manager->setNumLaps(3);
|
||||
race_manager->setNumKarts(4);
|
||||
race_manager->setNumPlayers(1);
|
||||
} // setRace
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool RaceTrackTime::raceFinished()
|
||||
{
|
||||
std::string track_name = world->getTrack()->getIdent();
|
||||
if(track_name!="race" ) return false; // wrong track
|
||||
Kart* kart=world->getPlayerKart(0);
|
||||
if(kart->getFinishTime()>75) return false; // too slow
|
||||
if(kart->getLap()!=3 ) return false; // wrong number of laps
|
||||
if(race_manager->getNumKarts()<4) return false; //not enough AI karts
|
||||
return true;
|
||||
} // raceFinished
|
||||
//-----------------------------------------------------------------------------
|
@ -1,36 +0,0 @@
|
||||
// $Id: race_track_time.hpp 1259 2007-09-24 12:28:19Z hiker $
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2008 Joerg Henrichs
|
||||
//
|
||||
// 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_RACE_TRACK_TIME_H
|
||||
#define HEADER_RACE_TRACK_TIME_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "challenges/challenge.hpp"
|
||||
|
||||
class RaceTrackTime : public Challenge
|
||||
{
|
||||
public:
|
||||
RaceTrackTime();
|
||||
virtual bool raceFinished();
|
||||
virtual void setRace() const;
|
||||
}; // RaceTrackTime
|
||||
|
||||
#endif
|
@ -1,57 +0,0 @@
|
||||
// $Id$
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2008 Joerg Henrichs
|
||||
//
|
||||
// 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 ruseful,
|
||||
// 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.
|
||||
|
||||
#include "translation.hpp"
|
||||
#include "tollway_head2head.hpp"
|
||||
#include "world.hpp"
|
||||
#include "race_manager.hpp"
|
||||
|
||||
TollwayHead2Head::TollwayHead2Head() : Challenge("tollwayhead", _("Win a Head to Head on\nTux Tollway"))
|
||||
{
|
||||
setChallengeDescription(_("Win a 1 lap Head to Head\non Tux Tollway against 1 'Racer'\nlevel AI kart."));
|
||||
addUnlockTrackReward("fortmagma");
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void TollwayHead2Head::setRace() const {
|
||||
race_manager->setMajorMode(RaceManager::RM_SINGLE);
|
||||
race_manager->setMinorMode(RaceManager::RM_TIME_TRIAL);
|
||||
race_manager->setTrack("tuxtrack");
|
||||
race_manager->setDifficulty(RaceManager::RD_HARD);
|
||||
race_manager->setNumLaps(1);
|
||||
race_manager->setNumKarts(2);
|
||||
race_manager->setNumPlayers(1);
|
||||
} // setRace
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool TollwayHead2Head::raceFinished()
|
||||
{
|
||||
std::string track_name = world->getTrack()->getIdent();
|
||||
if(track_name!="tuxtrack" ) return false; // wrong track
|
||||
Kart* kart=world->getPlayerKart(0);
|
||||
if(kart->getLap()!=1 ) return false; // wrong number of laps
|
||||
if(race_manager->getNumKarts()!=2 ) return false; //wrong number of AI karts
|
||||
// Check if the player was first:
|
||||
for(int i=0; i<(int)race_manager->getNumKarts(); i++)
|
||||
{
|
||||
const Kart* k=world->getKart(i);
|
||||
if(k->isPlayerKart() && !k->isEliminated()) return k->getPosition()==1;
|
||||
}
|
||||
return false;
|
||||
} // raceFinished
|
@ -1,35 +0,0 @@
|
||||
// $Id$
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2008 Joerg Henrichs
|
||||
//
|
||||
// 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 TOLLWAY_HEAD2HEAD_H
|
||||
#define TOLLWAY_HEAD2HEAD_H
|
||||
|
||||
|
||||
#include "challenge.hpp"
|
||||
|
||||
class TollwayHead2Head : public Challenge
|
||||
{
|
||||
public:
|
||||
TollwayHead2Head();
|
||||
virtual bool raceFinished();
|
||||
virtual void setRace() const;
|
||||
}; // TollwayHead2Head
|
||||
|
||||
|
||||
#endif /*TOLLWAY_HEAD2HHEAD*/
|
@ -1,53 +0,0 @@
|
||||
// $Id$
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2008 Joerg Henrichs
|
||||
//
|
||||
// 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 ruseful,
|
||||
// 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.
|
||||
|
||||
#include "translation.hpp"
|
||||
#include "challenges/tollway_time.hpp"
|
||||
#include "world.hpp"
|
||||
#include "race_manager.hpp"
|
||||
|
||||
TollwayTime::TollwayTime() : Challenge("tollwaytime", _("Finish Tux Tollway track in 3:00"))
|
||||
{
|
||||
setChallengeDescription(_("Finish 3 laps on the Tux Tollway\ntrack with 3 AI karts\nin under 3:00 minutes."));
|
||||
addUnlockTrackReward("canyon");
|
||||
} // TollwayTime
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void TollwayTime::setRace() const {
|
||||
race_manager->setMajorMode(RaceManager::RM_SINGLE);
|
||||
race_manager->setMinorMode(RaceManager::RM_QUICK_RACE);
|
||||
race_manager->setTrack("tuxtrack");
|
||||
race_manager->setDifficulty(RaceManager::RD_EASY);
|
||||
race_manager->setNumLaps(3);
|
||||
race_manager->setNumKarts(4);
|
||||
race_manager->setNumPlayers(1);
|
||||
} // setRace
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool TollwayTime::raceFinished()
|
||||
{
|
||||
std::string track_name = world->getTrack()->getIdent();
|
||||
if(track_name!="tuxtrack" ) return false; // wrong track
|
||||
Kart* kart=world->getPlayerKart(0);
|
||||
if(kart->getFinishTime()>180) return false; // too slow
|
||||
if(kart->getLap()!=3 ) return false; // wrong number of laps
|
||||
if(race_manager->getNumKarts()<4) return false; //not enough AI karts
|
||||
return true;
|
||||
} // raceFinished
|
||||
//-----------------------------------------------------------------------------
|
@ -1,36 +0,0 @@
|
||||
// $Id$
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2008 Joerg Henrichs
|
||||
//
|
||||
// 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 TOLLWAY_TIME_H
|
||||
#define TOLLWAY_TIME_H
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "challenges/challenge.hpp"
|
||||
|
||||
class TollwayTime : public Challenge
|
||||
{
|
||||
public:
|
||||
TollwayTime();
|
||||
virtual bool raceFinished();
|
||||
virtual void setRace() const;
|
||||
}; // TollwayTime
|
||||
|
||||
|
||||
#endif /*TOLLWAY_TIME_H*/
|
@ -149,30 +149,30 @@ CharSel::~CharSel()
|
||||
//-----------------------------------------------------------------------------
|
||||
void CharSel::updateScrollPosition()
|
||||
{
|
||||
// Handle the special case of less karts (plus groups) than widgets.
|
||||
// Some of the widgets then need to be disabled.
|
||||
unsigned int start = 0, end=m_max_entries;
|
||||
if(m_index_avail_karts.size()<m_max_entries)
|
||||
// Handle the special case of less karts (plus groups) than widgets.
|
||||
// Some of the widgets then need to be disabled.
|
||||
unsigned int start = 0, end=m_max_entries;
|
||||
if(m_index_avail_karts.size()<m_max_entries)
|
||||
{
|
||||
start = (unsigned int)(m_max_entries-m_index_avail_karts.size()+1)/2;
|
||||
end = start+m_index_avail_karts.size()-1;
|
||||
}
|
||||
|
||||
for(unsigned int i=0; i<m_max_entries; i++)
|
||||
{
|
||||
if(i<start || i>end)
|
||||
{
|
||||
start = (unsigned int)(m_max_entries-m_index_avail_karts.size()+1)/2;
|
||||
end = start+m_index_avail_karts.size()-1;
|
||||
widget_manager->hideWgtRect (WTOK_NAME0 +i);
|
||||
widget_manager->hideWgtRect (WTOK_RACER0+i);
|
||||
widget_manager->hideWgtText (WTOK_NAME0 +i);
|
||||
widget_manager->hideWgtTexture(WTOK_RACER0+i);
|
||||
continue;
|
||||
}
|
||||
|
||||
for(unsigned int i=0; i<m_max_entries; i++)
|
||||
{
|
||||
if(i<start || i>end)
|
||||
{
|
||||
widget_manager->hideWgtRect (WTOK_NAME0 +i);
|
||||
widget_manager->hideWgtRect (WTOK_RACER0+i);
|
||||
widget_manager->hideWgtText (WTOK_NAME0 +i);
|
||||
widget_manager->hideWgtTexture(WTOK_RACER0+i);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Otherwise enable the widgets again (just in case that they
|
||||
// had been disabled before)
|
||||
widget_manager->showWgtRect (WTOK_NAME0 +i);
|
||||
widget_manager->showWgtText (WTOK_NAME0 +i);
|
||||
// Otherwise enable the widgets again (just in case that they
|
||||
// had been disabled before)
|
||||
widget_manager->showWgtRect (WTOK_NAME0 +i);
|
||||
widget_manager->showWgtText (WTOK_NAME0 +i);
|
||||
|
||||
int indx = (i+m_offset)%m_index_avail_karts.size();
|
||||
indx = m_index_avail_karts[indx];
|
||||
@ -183,15 +183,15 @@ void CharSel::updateScrollPosition()
|
||||
if(unlock_manager->isLocked(kp->getIdent())) continue;
|
||||
widget_manager->setWgtText(WTOK_NAME0 + i, kp->getName());
|
||||
widget_manager->setWgtTexture(WTOK_RACER0 + i, kp->getIconFile() );
|
||||
widget_manager->showWgtTexture(WTOK_RACER0 + i);
|
||||
widget_manager->showWgtRect(WTOK_RACER0 + i);
|
||||
widget_manager->showWgtTexture(WTOK_RACER0 + i);
|
||||
widget_manager->showWgtRect(WTOK_RACER0 + i);
|
||||
}
|
||||
else
|
||||
{
|
||||
const std::vector<std::string> &groups=kart_properties_manager->getAllGroups();
|
||||
widget_manager->setWgtText(WTOK_NAME0+i, groups[-indx-1]);
|
||||
widget_manager->hideWgtTexture(WTOK_RACER0 + i);
|
||||
widget_manager->hideWgtRect(WTOK_RACER0 + i);
|
||||
widget_manager->hideWgtTexture(WTOK_RACER0 + i);
|
||||
widget_manager->hideWgtRect(WTOK_RACER0 + i);
|
||||
}
|
||||
} // for i
|
||||
// set the 'selection changed' flag in the widget_manager, since update
|
||||
@ -205,7 +205,7 @@ void CharSel::updateScrollPosition()
|
||||
//-----------------------------------------------------------------------------
|
||||
void CharSel::switchGroup()
|
||||
{
|
||||
m_index_avail_karts.clear();
|
||||
m_index_avail_karts.clear();
|
||||
// This loop is too long (since getNumberOfKarts returns all karts in all groups),
|
||||
// but the loop is left if no more kart is found.
|
||||
const std::vector<int> &karts =
|
||||
@ -223,28 +223,28 @@ void CharSel::switchGroup()
|
||||
const std::vector<std::string> groups=kart_properties_manager->getAllGroups();
|
||||
for(int i =0; i<(int)groups.size(); i++)
|
||||
{
|
||||
// Only add groups other than the current one
|
||||
if(groups[i]!=user_config->m_kart_group) m_index_avail_karts.push_back(-i-1);
|
||||
// Only add groups other than the current one
|
||||
if(groups[i]!=user_config->m_kart_group) m_index_avail_karts.push_back(-i-1);
|
||||
}
|
||||
if(m_index_avail_karts.size()>=m_max_entries)
|
||||
{
|
||||
m_offset = 0;
|
||||
widget_manager->showWgtRect(WTOK_DOWN);
|
||||
widget_manager->showWgtText(WTOK_DOWN);
|
||||
widget_manager->showWgtRect(WTOK_UP);
|
||||
widget_manager->showWgtText(WTOK_UP);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Less entries than maximum -> set m_offset to a negative number, so
|
||||
// that the actual existing entries are displayed
|
||||
m_offset = - (int)(m_max_entries-m_index_avail_karts.size())/2-1;
|
||||
widget_manager->hideWgtRect(WTOK_DOWN);
|
||||
widget_manager->hideWgtText(WTOK_DOWN);
|
||||
widget_manager->hideWgtRect(WTOK_UP);
|
||||
widget_manager->hideWgtText(WTOK_UP);
|
||||
}
|
||||
|
||||
{
|
||||
m_offset = 0;
|
||||
widget_manager->showWgtRect(WTOK_DOWN);
|
||||
widget_manager->showWgtText(WTOK_DOWN);
|
||||
widget_manager->showWgtRect(WTOK_UP);
|
||||
widget_manager->showWgtText(WTOK_UP);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Less entries than maximum -> set m_offset to a negative number, so
|
||||
// that the actual existing entries are displayed
|
||||
m_offset = - (int)(m_max_entries-m_index_avail_karts.size())/2-1;
|
||||
widget_manager->hideWgtRect(WTOK_DOWN);
|
||||
widget_manager->hideWgtText(WTOK_DOWN);
|
||||
widget_manager->hideWgtRect(WTOK_UP);
|
||||
widget_manager->hideWgtText(WTOK_UP);
|
||||
}
|
||||
|
||||
} // switchGroup
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -423,7 +423,7 @@ void CharSel::handle(GameAction action, int value)
|
||||
// Function checks the vector of previously selected karts and returns true if
|
||||
// kart i is in the vector and false if it is not.
|
||||
|
||||
bool CharSel::kartAvailable(int kart)
|
||||
bool CharSel::kartAvailable(int kartid)
|
||||
{
|
||||
if (!kart_properties_manager->m_selected_karts.empty())
|
||||
{
|
||||
@ -431,9 +431,10 @@ bool CharSel::kartAvailable(int kart)
|
||||
for (it = kart_properties_manager->m_selected_karts.begin();
|
||||
it < kart_properties_manager->m_selected_karts.end(); it++)
|
||||
{
|
||||
if ( kart == *it)
|
||||
if ( kartid == *it)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
const KartProperties *kartprop=kart_properties_manager->getKartById(kartid);
|
||||
return !unlock_manager->isLocked(kartprop->getIdent());
|
||||
} // kartAvailable
|
||||
|
@ -104,19 +104,25 @@ GameMode::GameMode()
|
||||
widget_manager->deactivateWgt(i);
|
||||
|
||||
widget_manager->setWgtColor(i, WGT_WHITE);
|
||||
widget_manager->setWgtTexture(i, "gui_lock.rgb", false);
|
||||
widget_manager->setWgtLockTexture(i);
|
||||
widget_manager->showWgtTexture(i);
|
||||
}
|
||||
}
|
||||
|
||||
if(unlock_manager->isLocked("followleader"))
|
||||
if(unlock_manager->isLocked("followtheleader"))
|
||||
{
|
||||
widget_manager->hideWgtText(WTOK_FOLLOW_LEADER_SINGLE);
|
||||
widget_manager->setWgtColor(WTOK_FOLLOW_LEADER_SINGLE, WGT_GRAY);
|
||||
widget_manager->setWgtTexture(WTOK_FOLLOW_LEADER_SINGLE, "gui_lock.rgb", false );
|
||||
widget_manager->deactivateWgt(WTOK_FOLLOW_LEADER_SINGLE);
|
||||
widget_manager->setWgtLockTexture(WTOK_FOLLOW_LEADER_SINGLE);
|
||||
widget_manager->showWgtTexture(WTOK_FOLLOW_LEADER_SINGLE);
|
||||
widget_manager->setWgtText(WTOK_FOLLOW_LEADER_SINGLE,
|
||||
_("Fulfil challenge to unlock"));
|
||||
//widget_manager->setWgtText(WTOK_FOLLOW_LEADER_SINGLE,
|
||||
// _("Fulfil challenge to unlock"));
|
||||
widget_manager->hideWgtText(WTOK_FOLLOW_LEADER_GP);
|
||||
widget_manager->deactivateWgt(WTOK_FOLLOW_LEADER_GP);
|
||||
widget_manager->setWgtLockTexture(WTOK_FOLLOW_LEADER_GP);
|
||||
widget_manager->showWgtTexture(WTOK_FOLLOW_LEADER_GP);
|
||||
//widget_manager->setWgtText(WTOK_FOLLOW_LEADER_GP,
|
||||
// _("Fulfil challenge to unlock"));
|
||||
}
|
||||
|
||||
w=widget_manager->addTextButtonWgt( WTOK_HELP, WIDTH, HEIGHT, _("Game mode help"));
|
||||
|
@ -18,17 +18,15 @@
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include <set>
|
||||
#include "file_manager.hpp"
|
||||
#include "string_utils.hpp"
|
||||
#include "grand_prix_select.hpp"
|
||||
#include "widget_manager.hpp"
|
||||
#include "menu_manager.hpp"
|
||||
#include "race_manager.hpp"
|
||||
#include "track_manager.hpp"
|
||||
#include "material_manager.hpp"
|
||||
#include "user_config.hpp"
|
||||
#include "unlock_manager.hpp"
|
||||
#include "translation.hpp"
|
||||
#include "grand_prix_manager.hpp"
|
||||
|
||||
enum WidgetTokens
|
||||
{
|
||||
@ -49,22 +47,16 @@ GrandPrixSelect::GrandPrixSelect() : m_curr_track_img(0), m_clock(0.0f)
|
||||
widget_manager->switchOrder();
|
||||
widget_manager->addEmptyWgt(WTOK_TITLE, 60, 7);
|
||||
|
||||
// Findout which grand prixs are available and load them
|
||||
std::set<std::string> result;
|
||||
file_manager->listFiles(result, "data");
|
||||
int nId = 0;
|
||||
for(std::set<std::string>::iterator i = result.begin();
|
||||
i != result.end() ; i++)
|
||||
{
|
||||
if (StringUtils::has_suffix(*i, ".cup"))
|
||||
{
|
||||
CupData cup(*i);
|
||||
if(unlock_manager->isLocked(cup.getName())) continue;
|
||||
m_all_cups.push_back(cup);
|
||||
widget_manager->addTextButtonWgt(WTOK_FIRSTPRIX + nId, 60, 7, cup.getName() );
|
||||
nId++;
|
||||
} // if
|
||||
} // for i
|
||||
int nId=0;
|
||||
m_gp_index.clear();
|
||||
for(unsigned int i=0; i<grand_prix_manager->getNumberOfGrandPrix(); i++)
|
||||
{
|
||||
const CupData *cup = grand_prix_manager->getCup(i);
|
||||
if(unlock_manager->isLocked(cup->getName())) continue;
|
||||
widget_manager->addTextButtonWgt(WTOK_FIRSTPRIX + nId, 60, 7, cup->getName() );
|
||||
m_gp_index.push_back(i);
|
||||
nId++;
|
||||
} // for i
|
||||
|
||||
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 100, 1 );
|
||||
|
||||
@ -105,15 +97,15 @@ void GrandPrixSelect::update(float dt)
|
||||
if( widget_manager->selectionChanged() &&
|
||||
!( SELECTED_TOKEN < WTOK_FIRSTPRIX ))
|
||||
{
|
||||
const int CUP_NUM = SELECTED_TOKEN - WTOK_FIRSTPRIX;
|
||||
const int NUM_TRACKS = (int)m_all_cups[CUP_NUM].getTrackCount();
|
||||
const int CUP_NUM = m_gp_index[SELECTED_TOKEN - WTOK_FIRSTPRIX];
|
||||
const CupData *cup = grand_prix_manager->getCup(CUP_NUM);
|
||||
const int NUM_TRACKS = cup->getTrackCount();
|
||||
|
||||
const CupData &cup = m_all_cups[CUP_NUM];
|
||||
widget_manager->setWgtText(WTOK_DESCRIPTION, cup.getDescription());
|
||||
widget_manager->setWgtText(WTOK_DESCRIPTION, cup->getDescription());
|
||||
|
||||
|
||||
std::string track_list;
|
||||
m_cup_tracks = m_all_cups[CUP_NUM].getTracks();
|
||||
m_cup_tracks = cup->getTracks();
|
||||
|
||||
for( int i = 0; i < NUM_TRACKS; ++i )
|
||||
{
|
||||
@ -142,14 +134,14 @@ void GrandPrixSelect::update(float dt)
|
||||
m_track_imgs.push_back(mat->getState()->getTextureHandle());
|
||||
}
|
||||
|
||||
if( !( m_track_imgs.empty() ))
|
||||
if( !m_track_imgs.empty() )
|
||||
{
|
||||
m_clock = 0.0f;
|
||||
m_curr_track_img = 0;
|
||||
|
||||
widget_manager->showWgtTexture( WTOK_IMG );
|
||||
widget_manager->setWgtTexture( WTOK_IMG,
|
||||
m_track_imgs[ m_curr_track_img ] );
|
||||
m_track_imgs[ m_curr_track_img ] );
|
||||
widget_manager->setWgtColor( WTOK_IMG, WGT_WHITE );
|
||||
}
|
||||
else
|
||||
@ -159,7 +151,7 @@ void GrandPrixSelect::update(float dt)
|
||||
}
|
||||
}
|
||||
|
||||
if( !( m_track_imgs.empty() ))
|
||||
if( !m_track_imgs.empty() )
|
||||
{
|
||||
m_clock += dt;
|
||||
|
||||
@ -170,8 +162,8 @@ void GrandPrixSelect::update(float dt)
|
||||
++m_curr_track_img;
|
||||
if( m_curr_track_img >= m_track_imgs.size() ) m_curr_track_img = 0;
|
||||
|
||||
widget_manager->setWgtTexture( WTOK_IMG,
|
||||
m_track_imgs[ m_curr_track_img ] );
|
||||
widget_manager->setWgtTexture(WTOK_IMG,
|
||||
m_track_imgs[ m_curr_track_img ] );
|
||||
}
|
||||
}
|
||||
|
||||
@ -190,7 +182,8 @@ void GrandPrixSelect::select()
|
||||
menu_manager->popMenu();
|
||||
return;
|
||||
}
|
||||
race_manager->setGrandPrix(m_all_cups[CLICKED_TOKEN-WTOK_FIRSTPRIX]);
|
||||
const CupData *cup=grand_prix_manager->getCup(m_gp_index[CLICKED_TOKEN-WTOK_FIRSTPRIX]);
|
||||
race_manager->setGrandPrix(*cup);
|
||||
menu_manager->pushMenu(MENUID_RACE_OPTIONS);
|
||||
} // select
|
||||
|
||||
|
@ -26,12 +26,12 @@
|
||||
|
||||
class GrandPrixSelect: public BaseGUI
|
||||
{
|
||||
private:
|
||||
std::vector<CupData> m_all_cups;
|
||||
std::vector<std::string> m_cup_tracks;
|
||||
std::vector<int> m_track_imgs;
|
||||
unsigned int m_curr_track_img;
|
||||
float m_clock;
|
||||
private:
|
||||
std::vector<std::string> m_cup_tracks;
|
||||
std::vector<int> m_track_imgs;
|
||||
std::vector<unsigned int> m_gp_index;
|
||||
unsigned int m_curr_track_img;
|
||||
float m_clock;
|
||||
public:
|
||||
GrandPrixSelect();
|
||||
~GrandPrixSelect();
|
||||
|
@ -136,7 +136,7 @@ _("If you see a button with a lock like the one to the right,\n\
|
||||
you need to complete a challenge to unlock it."));
|
||||
|
||||
widget_manager->addImgWgt(WTOK_LOCK, 6, 8, 0);
|
||||
widget_manager->setWgtTexture(WTOK_LOCK, "gui_help_lock.rgb", false);
|
||||
widget_manager->setWgtLockTexture(WTOK_LOCK);
|
||||
widget_manager->breakLine();
|
||||
|
||||
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 100, 1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user