diff --git a/data/fonts/AvantGarde-Demi.txf b/data/fonts/AvantGarde-Demi.txf index 52c697a2b..6e0112bb9 100644 Binary files a/data/fonts/AvantGarde-Demi.txf and b/data/fonts/AvantGarde-Demi.txf differ diff --git a/data/fonts/DomesticManners.txf b/data/fonts/DomesticManners.txf index 4340eb80f..6e0112bb9 100644 Binary files a/data/fonts/DomesticManners.txf and b/data/fonts/DomesticManners.txf differ diff --git a/src/Makefile.am b/src/Makefile.am index 46463ea96..2c64f7f85 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -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 \ diff --git a/src/challenges/city_time.cpp b/src/challenges/city_time.cpp new file mode 100644 index 000000000..daa2a17af --- /dev/null +++ b/src/challenges/city_time.cpp @@ -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 +//----------------------------------------------------------------------------- diff --git a/src/challenges/city_time.hpp b/src/challenges/city_time.hpp new file mode 100644 index 000000000..5c986bc0f --- /dev/null +++ b/src/challenges/city_time.hpp @@ -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*/ diff --git a/src/challenges/energy_shifting_sands.cpp b/src/challenges/energy_shifting_sands.cpp new file mode 100644 index 000000000..265904e1f --- /dev/null +++ b/src/challenges/energy_shifting_sands.cpp @@ -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 +//----------------------------------------------------------------------------- diff --git a/src/challenges/energy_shifting_sands.hpp b/src/challenges/energy_shifting_sands.hpp new file mode 100644 index 000000000..31c91edb3 --- /dev/null +++ b/src/challenges/energy_shifting_sands.hpp @@ -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*/ diff --git a/src/challenges/island_follow.cpp b/src/challenges/island_follow.cpp new file mode 100644 index 000000000..30d60e782 --- /dev/null +++ b/src/challenges/island_follow.cpp @@ -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 +//----------------------------------------------------------------------------- diff --git a/src/challenges/island_follow.hpp b/src/challenges/island_follow.hpp new file mode 100644 index 000000000..084902c61 --- /dev/null +++ b/src/challenges/island_follow.hpp @@ -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*/ diff --git a/src/challenges/jungle_follow.cpp b/src/challenges/jungle_follow.cpp new file mode 100644 index 000000000..b28d27892 --- /dev/null +++ b/src/challenges/jungle_follow.cpp @@ -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 +//----------------------------------------------------------------------------- diff --git a/src/challenges/jungle_follow.hpp b/src/challenges/jungle_follow.hpp new file mode 100644 index 000000000..b7e071821 --- /dev/null +++ b/src/challenges/jungle_follow.hpp @@ -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*/ diff --git a/src/challenges/moon_and_back_gp.cpp b/src/challenges/moon_and_back_gp.cpp new file mode 100644 index 000000000..7d159b6d0 --- /dev/null +++ b/src/challenges/moon_and_back_gp.cpp @@ -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 +//----------------------------------------------------------------------------- diff --git a/src/challenges/moon_and_back_gp.hpp b/src/challenges/moon_and_back_gp.hpp new file mode 100644 index 000000000..cfa37c2a9 --- /dev/null +++ b/src/challenges/moon_and_back_gp.hpp @@ -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*/ diff --git a/src/challenges/penguin_playground_gp.cpp b/src/challenges/penguin_playground_gp.cpp new file mode 100644 index 000000000..737554077 --- /dev/null +++ b/src/challenges/penguin_playground_gp.cpp @@ -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 +//----------------------------------------------------------------------------- diff --git a/src/challenges/penguin_playground_gp.hpp b/src/challenges/penguin_playground_gp.hpp new file mode 100644 index 000000000..f6e790dcd --- /dev/null +++ b/src/challenges/penguin_playground_gp.hpp @@ -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*/ diff --git a/src/challenges/race_track_time.cpp b/src/challenges/race_track_time.cpp index c1feaa57e..a1b921d52 100755 --- a/src/challenges/race_track_time.cpp +++ b/src/challenges/race_track_time.cpp @@ -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 //----------------------------------------------------------------------------- diff --git a/src/challenges/tollway_time.cpp b/src/challenges/tollway_time.cpp new file mode 100644 index 000000000..ae196e152 --- /dev/null +++ b/src/challenges/tollway_time.cpp @@ -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 +//----------------------------------------------------------------------------- diff --git a/src/challenges/tollway_time.hpp b/src/challenges/tollway_time.hpp new file mode 100644 index 000000000..bf099f09f --- /dev/null +++ b/src/challenges/tollway_time.hpp @@ -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 +#include + +#include "challenges/challenge.hpp" + +class TollwayTime : public Challenge +{ +public: + TollwayTime(); + virtual bool raceFinished(); + virtual void setRace() const; +}; // TollwayTime + + +#endif /*TOLLWAY_TIME_H*/ diff --git a/src/unlock_manager.cpp b/src/unlock_manager.cpp index a69cca1e5..cd0e8ada6 100755 --- a/src/unlock_manager.cpp +++ b/src/unlock_manager.cpp @@ -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 diff --git a/src/world.cpp b/src/world.cpp index 2cb83b9b6..a62438d0d 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -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