Add workaround for tickets #1084 and #1085.

Currently there is no non-linear track where eggs could be hidden. Start track as linear solves problem with position after rescue.
Also add win animation when all eggs are collected.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14398 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
deveee 2013-11-08 21:42:49 +00:00
parent 86118b92ae
commit 41bc19fa99
5 changed files with 27 additions and 11 deletions

View File

@ -184,7 +184,8 @@ void EndController::update(float dt)
// In case of battle mode: don't do anything
if(race_manager->getMinorMode()==RaceManager::MINOR_MODE_3_STRIKES ||
race_manager->getMinorMode()==RaceManager::MINOR_MODE_SOCCER)
race_manager->getMinorMode()==RaceManager::MINOR_MODE_SOCCER ||
race_manager->getMinorMode()==RaceManager::MINOR_MODE_EASTER_EGG)
{
m_controls->m_accel = 0.0f;
// Brake while we are still driving forwards (if we keep

View File

@ -849,6 +849,12 @@ void Kart::finishedRace(float time)
setController(new EndController(this, m_controller->getPlayer(),
m_controller));
}
else if (race_manager->getMinorMode() == RaceManager::MINOR_MODE_EASTER_EGG)
{
m_kart_model->setAnimation(KartModel::AF_WIN_START);
setController(new EndController(this, m_controller->getPlayer(),
m_controller));
}
} // finishedRace

View File

@ -24,7 +24,7 @@
//-----------------------------------------------------------------------------
/** Constructor. Sets up the clock mode etc.
*/
EasterEggHunt::EasterEggHunt() : WorldWithRank()
EasterEggHunt::EasterEggHunt() : LinearWorld()
{
WorldStatus::setClockMode(CLOCK_CHRONO);
m_use_highscores = true;
@ -36,7 +36,7 @@ EasterEggHunt::EasterEggHunt() : WorldWithRank()
*/
void EasterEggHunt::init()
{
WorldWithRank::init();
LinearWorld::init();
m_display_rank = false;
// check for possible problems if AI karts were incorrectly added
@ -160,8 +160,8 @@ void EasterEggHunt::collectedEasterEgg(const AbstractKart *kart)
*/
void EasterEggHunt::update(float dt)
{
WorldWithRank::update(dt);
WorldWithRank::updateTrack(dt);
LinearWorld::update(dt);
LinearWorld::updateTrack(dt);
} // update
//-----------------------------------------------------------------------------
@ -181,7 +181,7 @@ bool EasterEggHunt::isRaceOver()
*/
void EasterEggHunt::reset()
{
WorldWithRank::reset();
LinearWorld::reset();
for(unsigned int i=0; i<m_eggs_collected.size(); i++)
m_eggs_collected[i] = 0;
@ -205,4 +205,13 @@ void EasterEggHunt::getKartsDisplayInfo(
rank_info.m_color = video::SColor(255, 255, 255, 255);
}
} // getKartDisplayInfo
//-----------------------------------------------------------------------------
/** Override the base class method to change behavior. We don't want wrong
* direction messages in the easter egg mode since there is no direction there.
* \param i Kart id.
*/
void EasterEggHunt::checkForWrongDirection(unsigned int i)
{
} // checkForWrongDirection

View File

@ -19,7 +19,7 @@
#ifndef EASTER_EGG_HUNT_HPP
#define EASTER_EGG_HUNT_HPP
#include "modes/world_with_rank.hpp"
#include "modes/linear_world.hpp"
#include "states_screens/race_gui_base.hpp"
#include <string>
@ -31,7 +31,7 @@ class AbstractKart;
* \brief An implementation of World to provide an easter egg hunt like mode
* \ingroup modes
*/
class EasterEggHunt: public WorldWithRank
class EasterEggHunt: public LinearWorld
{
private:
/** Keeps track of how many eggs each kart has found. */
@ -64,6 +64,8 @@ public:
void updateKartRanks();
void collectedEasterEgg(const AbstractKart *kart);
void readData(const std::string &filename);
virtual void checkForWrongDirection(unsigned int i) OVERRIDE;
}; // EasterEggHunt

View File

@ -1527,9 +1527,7 @@ void Track::loadTrackModel(bool reverse_track, unsigned int mode_id)
}
else if(name=="checks")
{
// Easter egg hunts don't have laps.
if(race_manager->getMinorMode()!=RaceManager::MINOR_MODE_EASTER_EGG)
CheckManager::get()->load(*node);
CheckManager::get()->load(*node);
}
else if (name=="particle-emitter")
{