Merge branch 'master' of https://github.com/supertuxkart/stk-code
This commit is contained in:
commit
2e6eeb15ea
@ -317,7 +317,14 @@ void Flyable::getLinearKartItemIntersection (const Vec3 &origin,
|
||||
* (dx * cosf(target_kart_heading) -
|
||||
dz * sinf(target_kart_heading) );
|
||||
|
||||
float fire_th = (dx*dist - dz * sqrtf(dx*dx + dz*dz - dist*dist))
|
||||
float f = dx*dx + dz*dz - dist*dist;
|
||||
// Avoid negative square root
|
||||
if(f>0)
|
||||
f = sqrtf(f);
|
||||
else
|
||||
f = 0.0f;
|
||||
|
||||
float fire_th = (dx*dist - dz * f)
|
||||
/ (dx*dx + dz*dz);
|
||||
if(fire_th>1)
|
||||
fire_th = 1.0f;
|
||||
|
@ -58,7 +58,8 @@ CutsceneWorld::CutsceneWorld() : World()
|
||||
m_aborted = false;
|
||||
WorldStatus::setClockMode(CLOCK_NONE);
|
||||
m_use_highscores = false;
|
||||
m_play_racestart_sounds = false;
|
||||
m_play_track_intro_sound = false;
|
||||
m_play_ready_set_go_sounds = false;
|
||||
m_fade_duration = 1.0f;
|
||||
} // CutsceneWorld
|
||||
|
||||
|
@ -30,6 +30,21 @@
|
||||
|
||||
#include <irrlicht.h>
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Starts the kart engines.
|
||||
*/
|
||||
void WorldStatus::startEngines()
|
||||
{
|
||||
if (m_engines_started)
|
||||
return;
|
||||
|
||||
m_engines_started = true;
|
||||
for (unsigned int i = 0; i < World::getWorld()->getNumKarts(); i++)
|
||||
{
|
||||
World::getWorld()->getKart(i)->startEngineSFX();
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
WorldStatus::WorldStatus()
|
||||
{
|
||||
@ -39,7 +54,8 @@ WorldStatus::WorldStatus()
|
||||
m_start_sound = SFXManager::get()->createSoundSource("start_race");
|
||||
m_track_intro_sound = SFXManager::get()->createSoundSource("track_intro");
|
||||
|
||||
m_play_racestart_sounds = true;
|
||||
m_play_track_intro_sound = UserConfigParams::m_music;
|
||||
m_play_ready_set_go_sounds = true;
|
||||
|
||||
IrrlichtDevice *device = irr_driver->getDevice();
|
||||
|
||||
@ -54,6 +70,9 @@ void WorldStatus::reset()
|
||||
{
|
||||
m_time = 0.0f;
|
||||
m_auxiliary_timer = 0.0f;
|
||||
|
||||
m_engines_started = false;
|
||||
|
||||
// Using SETUP_PHASE will play the track into sfx first, and has no
|
||||
// other side effects.
|
||||
m_phase = UserConfigParams::m_race_now ? MUSIC_PHASE : SETUP_PHASE;
|
||||
@ -149,7 +168,7 @@ void WorldStatus::update(const float dt)
|
||||
m_auxiliary_timer = 0.0f;
|
||||
m_phase = TRACK_INTRO_PHASE;
|
||||
|
||||
if (m_play_racestart_sounds)
|
||||
if (m_play_track_intro_sound)
|
||||
{
|
||||
m_track_intro_sound->play();
|
||||
}
|
||||
@ -184,23 +203,27 @@ void WorldStatus::update(const float dt)
|
||||
if (!UserConfigParams::m_sfx && m_auxiliary_timer < 3.0f)
|
||||
return;
|
||||
|
||||
if (!m_play_track_intro_sound)
|
||||
{
|
||||
startEngines();
|
||||
if (m_auxiliary_timer < 3.0f)
|
||||
return;
|
||||
}
|
||||
|
||||
m_auxiliary_timer = 0.0f;
|
||||
|
||||
if (m_play_racestart_sounds)
|
||||
if (m_play_ready_set_go_sounds)
|
||||
m_prestart_sound->play();
|
||||
|
||||
m_phase = READY_PHASE;
|
||||
|
||||
for (unsigned int i = 0; i < World::getWorld()->getNumKarts(); i++)
|
||||
{
|
||||
World::getWorld()->getKart(i)->startEngineSFX();
|
||||
}
|
||||
startEngines();
|
||||
|
||||
break;
|
||||
case READY_PHASE:
|
||||
if (m_auxiliary_timer > 1.0)
|
||||
{
|
||||
if (m_play_racestart_sounds)
|
||||
if (m_play_ready_set_go_sounds)
|
||||
{
|
||||
m_prestart_sound->play();
|
||||
}
|
||||
@ -224,7 +247,7 @@ void WorldStatus::update(const float dt)
|
||||
{
|
||||
// set phase is over, go to the next one
|
||||
m_phase = GO_PHASE;
|
||||
if (m_play_racestart_sounds)
|
||||
if (m_play_ready_set_go_sounds)
|
||||
{
|
||||
m_start_sound->play();
|
||||
}
|
||||
|
@ -97,7 +97,8 @@ protected:
|
||||
double m_time;
|
||||
ClockType m_clock_mode;
|
||||
|
||||
bool m_play_racestart_sounds;
|
||||
bool m_play_track_intro_sound;
|
||||
bool m_play_ready_set_go_sounds;
|
||||
|
||||
private:
|
||||
Phase m_phase;
|
||||
@ -113,6 +114,8 @@ private:
|
||||
*/
|
||||
float m_auxiliary_timer;
|
||||
|
||||
bool m_engines_started;
|
||||
void startEngines();
|
||||
public:
|
||||
WorldStatus();
|
||||
virtual ~WorldStatus();
|
||||
|
Loading…
Reference in New Issue
Block a user