Make the FTL countdown addition work for all type of explosion affecting the leader
This commit is contained in:
parent
089f6d108e
commit
a4142c13c1
@ -23,8 +23,10 @@
|
|||||||
#include "items/attachment.hpp"
|
#include "items/attachment.hpp"
|
||||||
#include "karts/abstract_kart.hpp"
|
#include "karts/abstract_kart.hpp"
|
||||||
#include "karts/kart_properties.hpp"
|
#include "karts/kart_properties.hpp"
|
||||||
|
#include "modes/follow_the_leader.hpp"
|
||||||
#include "modes/world.hpp"
|
#include "modes/world.hpp"
|
||||||
#include "network/network_config.hpp"
|
#include "network/network_config.hpp"
|
||||||
|
#include "race/race_manager.hpp"
|
||||||
#include "tracks/track.hpp"
|
#include "tracks/track.hpp"
|
||||||
|
|
||||||
/** A static create function that does only create an explosion if
|
/** A static create function that does only create an explosion if
|
||||||
@ -51,6 +53,14 @@ ExplosionAnimation *ExplosionAnimation::create(AbstractKart *kart,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (race_manager->isFollowMode())
|
||||||
|
{
|
||||||
|
FollowTheLeaderRace *ftl_world =
|
||||||
|
dynamic_cast<FollowTheLeaderRace*>(World::getWorld());
|
||||||
|
if(ftl_world->isLeader(kart->getWorldKartId()))
|
||||||
|
ftl_world->leaderHit();
|
||||||
|
}
|
||||||
|
|
||||||
return new ExplosionAnimation(kart, pos, direct_hit);
|
return new ExplosionAnimation(kart, pos, direct_hit);
|
||||||
} // create
|
} // create
|
||||||
|
|
||||||
|
@ -223,17 +223,12 @@ bool FollowTheLeaderRace::isRaceOver()
|
|||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
/** If the leader kart is hit, increase the delay to the next elimination */
|
/** If the leader kart is hit, increase the delay to the next elimination */
|
||||||
bool FollowTheLeaderRace::kartHit(int kart_id, int hitter)
|
void FollowTheLeaderRace::leaderHit()
|
||||||
{
|
{
|
||||||
if (kart_id == 0)
|
int countdown = getTimeTicks();
|
||||||
{
|
countdown += stk_config->time2Ticks(5.0f);
|
||||||
int countdown = getTimeTicks();
|
setTicks(countdown);
|
||||||
countdown += stk_config->time2Ticks(5.0f);
|
} // leaderHit
|
||||||
setTicks(countdown);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
/** Called at the end of a race. Updates highscores, pauses the game, and
|
/** Called at the end of a race. Updates highscores, pauses the game, and
|
||||||
|
@ -54,13 +54,15 @@ public:
|
|||||||
virtual void init() OVERRIDE;
|
virtual void init() OVERRIDE;
|
||||||
virtual void terminateRace() OVERRIDE;
|
virtual void terminateRace() OVERRIDE;
|
||||||
virtual bool isRaceOver() OVERRIDE;
|
virtual bool isRaceOver() OVERRIDE;
|
||||||
virtual bool kartHit(int kart_id, int hitter = -1) OVERRIDE;
|
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
/** Returns if this type of race has laps. */
|
/** Returns if this type of race has laps. */
|
||||||
virtual bool raceHasLaps() OVERRIDE { return false; }
|
virtual bool raceHasLaps() OVERRIDE { return false; }
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
/** Returns if faster music should be used at the end. */
|
/** Returns if faster music should be used at the end. */
|
||||||
virtual bool useFastMusicNearEnd() const OVERRIDE { return false; }
|
virtual bool useFastMusicNearEnd() const OVERRIDE { return false; }
|
||||||
|
|
||||||
|
bool isLeader(int kart_id) { return (kart_id == 0); }
|
||||||
|
void leaderHit();
|
||||||
}; // FollowTheLeader
|
}; // FollowTheLeader
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user