Added new challenges that lock most of the new tracks/features.
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1759 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
f5eeae2bfd
commit
39c2690102
Binary file not shown.
Binary file not shown.
@ -95,8 +95,14 @@ supertuxkart_SOURCES = main.cpp \
|
||||
challenges/challenge.hpp challenges/challenge.cpp \
|
||||
challenges/all_tracks.cpp challenges/all_tracks.hpp \
|
||||
challenges/energy_math_class.cpp challenges/energy_math_class.hpp\
|
||||
challenges/win_gotm_cup.cpp challenges/win_gotm_cup.hpp \
|
||||
challenges/penguin_playground_gp.cpp challenges/penguin_playground_gp.hpp \
|
||||
challenges/race_track_time.cpp challenges/race_track_time.hpp\
|
||||
challenges/tollway_time.cpp challenges/tollway_time.hpp \
|
||||
challenges/jungle_follow.cpp challenges/jungle_follow.hpp \
|
||||
challenges/energy_shifting_sands.cpp challenges/energy_shifting_sands.hpp \
|
||||
challenges/moon_and_back_gp.cpp challenges/moon_and_back_gp.hpp \
|
||||
challenges/city_time.cpp challenges/city_time.hpp \
|
||||
challenges/island_follow.cpp challenges/island_follow.hpp \
|
||||
lisp/lisp.cpp lisp/lisp.hpp \
|
||||
lisp/lexer.cpp lisp/lexer.hpp \
|
||||
lisp/parser.cpp lisp/parser.hpp \
|
||||
|
53
src/challenges/city_time.cpp
Normal file
53
src/challenges/city_time.cpp
Normal file
@ -0,0 +1,53 @@
|
||||
// $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 2
|
||||
// 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 "challenges/city_time.hpp"
|
||||
#include "world.hpp"
|
||||
#include "race_manager.hpp"
|
||||
|
||||
CityTime::CityTime() : Challenge("citytime", "Finish the City track in 5:00")
|
||||
{
|
||||
setChallengeDescription("Finish 3 laps on the City track\nwith 3 AI karts\nin under 5:00 minutes.");
|
||||
setFeatureDescription("New track: SnowTux Peak\nnow available");
|
||||
setFeature("snowtuxpeak");
|
||||
addDependency("junglefollow");
|
||||
} // CityTime
|
||||
//-----------------------------------------------------------------------------
|
||||
void CityTime::setRace() const {
|
||||
race_manager->setRaceMode(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()>300) 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
|
||||
//-----------------------------------------------------------------------------
|
37
src/challenges/city_time.hpp
Normal file
37
src/challenges/city_time.hpp
Normal file
@ -0,0 +1,37 @@
|
||||
// $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 2
|
||||
// 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*/
|
56
src/challenges/energy_shifting_sands.cpp
Normal file
56
src/challenges/energy_shifting_sands.cpp
Normal file
@ -0,0 +1,56 @@
|
||||
// $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 2
|
||||
// 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 "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:10 minutes.");
|
||||
setFeatureDescription("New Grand Prix: To the Moon and Back\nnow available");
|
||||
setFeature("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->setRaceMode(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);
|
||||
} // 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
|
||||
//-----------------------------------------------------------------------------
|
36
src/challenges/energy_shifting_sands.hpp
Normal file
36
src/challenges/energy_shifting_sands.hpp
Normal file
@ -0,0 +1,36 @@
|
||||
// $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 2
|
||||
// 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*/
|
60
src/challenges/island_follow.cpp
Normal file
60
src/challenges/island_follow.cpp
Normal file
@ -0,0 +1,60 @@
|
||||
// $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 2
|
||||
// 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 "challenges/island_follow.hpp"
|
||||
#include "world.hpp"
|
||||
#include "race_manager.hpp"
|
||||
|
||||
IslandFollow::IslandFollow() : Challenge("islandfollow", "Win Follow the Leader on a Desert Island")
|
||||
{
|
||||
setChallengeDescription("Win a Follow the Leader race\nwith 3 AI karts\non a Desert Island.");
|
||||
setFeatureDescription("New Grand Prix: At World's End\nnow available");
|
||||
setFeature("At world's end");
|
||||
addDependency("moonandbackgp");
|
||||
addDependancy("tollwaytime");
|
||||
addDependancy("citytime");
|
||||
} // IslandFollow
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void IslandFollow::setRace() const {
|
||||
race_manager->setRaceMode(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
|
||||
//-----------------------------------------------------------------------------
|
34
src/challenges/island_follow.hpp
Normal file
34
src/challenges/island_follow.hpp
Normal file
@ -0,0 +1,34 @@
|
||||
// $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 2
|
||||
// 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*/
|
59
src/challenges/jungle_follow.cpp
Normal file
59
src/challenges/jungle_follow.cpp
Normal file
@ -0,0 +1,59 @@
|
||||
// $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 2
|
||||
// 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 "challenges/jungle_follow.hpp"
|
||||
#include "world.hpp"
|
||||
#include "race_manager.hpp"
|
||||
|
||||
JungleFollow::JungleFollow() : Challenge("junglefollow", "Win Follow the Leader in the Jungle")
|
||||
{
|
||||
setChallengeDescription("Win a Follow the Leader race\nwith 3 AI karts\nin the Amazonian Jungle.");
|
||||
setFeatureDescription("New track: City\nnow available");
|
||||
setFeature("city");
|
||||
addDependency("penguinplaygroundgp");
|
||||
addDependency("racetracktime");
|
||||
} // JungleFollow
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void JungleFollow::setRace() const {
|
||||
race_manager->setRaceMode(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
|
||||
//-----------------------------------------------------------------------------
|
33
src/challenges/jungle_follow.hpp
Normal file
33
src/challenges/jungle_follow.hpp
Normal file
@ -0,0 +1,33 @@
|
||||
// $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 2
|
||||
// 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*/
|
63
src/challenges/moon_and_back_gp.cpp
Normal file
63
src/challenges/moon_and_back_gp.cpp
Normal file
@ -0,0 +1,63 @@
|
||||
// $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 2
|
||||
// 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 "challenges/moon_and_back_gp.hpp"
|
||||
#include "race_manager.hpp"
|
||||
#include "world.hpp"
|
||||
|
||||
MoonAndBackGP::MoonAndBackGP() : Challenge("moonandbackgp","Finish To the Moon and Back Grand Prix")
|
||||
{
|
||||
setChallengeDescription("Finish the To the Moon and Back\nGrand Prix with 3 'Driver' Level AI karts\nin the top 3.");
|
||||
setFeatureDescription("New Grand Prix: To the Moon and Back\nnow available");
|
||||
setFeature("Snag Drive"); //gp3
|
||||
// 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->setRaceMode(RaceManager::RM_GRAND_PRIX);
|
||||
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()
|
||||
{
|
||||
//const CupData CUP = race_manager->getGrandPrix();
|
||||
if (race_manager->getRaceMode() != RaceManager::RM_GRAND_PRIX ||
|
||||
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()<4;
|
||||
}
|
||||
return false;
|
||||
|
||||
} // grandPrixFinished
|
||||
//-----------------------------------------------------------------------------
|
36
src/challenges/moon_and_back_gp.hpp
Normal file
36
src/challenges/moon_and_back_gp.hpp
Normal file
@ -0,0 +1,36 @@
|
||||
// $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 2
|
||||
// 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*/
|
60
src/challenges/penguin_playground_gp.cpp
Normal file
60
src/challenges/penguin_playground_gp.cpp
Normal file
@ -0,0 +1,60 @@
|
||||
// $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 2
|
||||
// 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 "challenges/penguin_playground_gp.hpp"
|
||||
#include "race_manager.hpp"
|
||||
#include "world.hpp"
|
||||
|
||||
PenguinPlaygroundGP::PenguinPlaygroundGP() : Challenge("penguinplaygroundgp","Finish Penguin Playground Grand Prix")
|
||||
{
|
||||
setChallengeDescription("Finish the Penguin Playground Grand\nPrix with 3 'Driver' Level AI karts\nin the top 3.");
|
||||
setFeatureDescription("New game mode\n'Follow Leader'\nnow available");
|
||||
setFeature("followleader");
|
||||
// The energymathclass challenge must be done, otherwise GP can't be selected
|
||||
addDependency("energymathclass");
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void PenguinPlaygroundGP::setRace() const {
|
||||
race_manager->setRaceMode(RaceManager::RM_GRAND_PRIX);
|
||||
CupData cup("gp1.cup");
|
||||
race_manager->setGrandPrix(cup);
|
||||
race_manager->setDifficulty(RaceManager::RD_HARD);
|
||||
race_manager->setNumKarts(4);
|
||||
race_manager->setNumPlayers(1);
|
||||
} // setRace
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool PenguinPlaygroundGP::grandPrixFinished()
|
||||
{
|
||||
if (race_manager->getRaceMode() != RaceManager::RM_GRAND_PRIX ||
|
||||
race_manager->getGrandPrix()->getName() != "Penguin Playground" ||
|
||||
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()<4;
|
||||
}
|
||||
return false;
|
||||
|
||||
} // grandPrixFinished
|
||||
//-----------------------------------------------------------------------------
|
34
src/challenges/penguin_playground_gp.hpp
Normal file
34
src/challenges/penguin_playground_gp.hpp
Normal file
@ -0,0 +1,34 @@
|
||||
// $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 2
|
||||
// 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 PENGUIN_PLAYGROUND_GP_H
|
||||
#define PENGUIN_PLAYGROUND_GP_H
|
||||
|
||||
#include "challenges/challenge.hpp"
|
||||
|
||||
class PenguinPlaygroundGP : public Challenge
|
||||
{
|
||||
public:
|
||||
PenguinPlaygroundGP();
|
||||
virtual bool grandPrixFinished();
|
||||
virtual void setRace() const;
|
||||
|
||||
};
|
||||
|
||||
#endif /*PENGUIN_PLAYGROUND_GP_H*/
|
@ -25,8 +25,8 @@
|
||||
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.");
|
||||
setFeatureDescription("New game mode\n'Follow Leader'\nnow available");
|
||||
setFeature("followleader");
|
||||
setFeatureDescription("New track: Amazonian Jungle\nnow available");
|
||||
setFeature("jungle");
|
||||
} // RaceTrackTime
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
53
src/challenges/tollway_time.cpp
Normal file
53
src/challenges/tollway_time.cpp
Normal file
@ -0,0 +1,53 @@
|
||||
// $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 2
|
||||
// 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 "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 track\nwith 3 AI karts\nin under 3:00 minutes.");
|
||||
setFeatureDescription("New track: Canyon\nnow available");
|
||||
setFeature("canyon");
|
||||
} // TollwayTime
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void TollwayTime::setRace() const {
|
||||
race_manager->setRaceMode(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
|
||||
//-----------------------------------------------------------------------------
|
36
src/challenges/tollway_time.hpp
Normal file
36
src/challenges/tollway_time.hpp
Normal file
@ -0,0 +1,36 @@
|
||||
// $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 2
|
||||
// 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*/
|
@ -19,10 +19,16 @@
|
||||
|
||||
#include "unlock_manager.hpp"
|
||||
|
||||
#include "challenges/all_tracks.hpp"
|
||||
//#include "challenges/all_tracks.hpp"
|
||||
#include "challenges/energy_math_class.hpp"
|
||||
#include "challenges/win_gotm_cup.hpp"
|
||||
#include "challenges/penguin_playground_gp.hpp"
|
||||
#include "challenges/race_track_time.hpp"
|
||||
#include "challenges/tollway_time.hpp"
|
||||
#include "challenges/jungle_follow.hpp"
|
||||
#include "challenges/energy_shifting_sands.hpp"
|
||||
#include "challenges/moon_and_back_gp.hpp"
|
||||
#include "challenges/city_time.hpp"#
|
||||
#include "challenges/island_follow.hpp"
|
||||
#include "user_config.hpp"
|
||||
|
||||
UnlockManager* unlock_manager=0;
|
||||
@ -37,10 +43,16 @@ UnlockManager::UnlockManager()
|
||||
|
||||
// Add all challenges:
|
||||
Challenge *c;
|
||||
c=new AllTracks(); m_all_challenges[c->getId()]=c;
|
||||
//c=new AllTracks(); m_all_challenges[c->getId()]=c;
|
||||
c=new EnergyMathClass(); m_all_challenges[c->getId()]=c;
|
||||
c=new WinGOTMCup(); m_all_challenges[c->getId()]=c;
|
||||
c=new PenguinPlaygroundGP(); m_all_challenges[c->getId()]=c;
|
||||
c=new RaceTrackTime(); m_all_challenges[c->getId()]=c;
|
||||
c=new TollwayTime(); m_all_challenges[c->getId()]=c;
|
||||
c=new JungleFollow(); m_all_challenges[c->getId()]=c;
|
||||
c=new EnergyShiftingSands(); m_all_challenges[c->getId()]=c;
|
||||
c=new MoonAndBackGP(); m_all_challenges[c->getId()]=c;
|
||||
c=new CityTime(); m_all_challenges[c->getId()]=c;
|
||||
c=new IslandFollow(); m_all_challenges[c->getId()]=c;
|
||||
|
||||
computeActive();
|
||||
} // UnlockManager
|
||||
|
@ -255,6 +255,7 @@ void World::update(float dt)
|
||||
if(race_manager->getRaceMode()==RaceManager::RM_FOLLOW_LEADER)
|
||||
{
|
||||
menu_manager->pushMenu(MENUID_LEADERRESULT);
|
||||
unlock_manager->raceFinished();
|
||||
return;
|
||||
}
|
||||
// Add times to highscore list. First compute the order of karts,
|
||||
@ -594,6 +595,7 @@ void World::updateRaceStatus(float dt)
|
||||
} // if !raceIsFinished
|
||||
} // for i
|
||||
}
|
||||
|
||||
if(m_phase==FINISH_PHASE) unlock_manager->raceFinished();
|
||||
} // updateRaceStatus
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user