Fix #4166
Based on the alerts for timed challenges: - Change the timer color when an elimination is coming shortly - Play a sound when an elimination is coming shortly
This commit is contained in:
parent
1c58f0154f
commit
3ec2b9a54d
@ -949,19 +949,27 @@ void World::moveKartTo(AbstractKart* kart, const btTransform &transform)
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
void World::updateTimeTargetSound()
|
void World::updateTimeTargetSound()
|
||||||
{
|
{
|
||||||
if (RaceManager::get()->hasTimeTarget() && !RewindManager::get()->isRewinding())
|
if (RewindManager::get()->isRewinding())
|
||||||
|
return;
|
||||||
|
|
||||||
|
float time_left = getTime();;
|
||||||
|
if (RaceManager::get()->hasTimeTarget())
|
||||||
{
|
{
|
||||||
float time_left = getTime();
|
|
||||||
float time_target = RaceManager::get()->getTimeTarget();
|
float time_target = RaceManager::get()->getTimeTarget();
|
||||||
// In linear mode, the internal time still counts up even when displayed down.
|
// In linear mode, the internal time still counts up even when displayed down.
|
||||||
if (RaceManager::get()->isLinearRaceMode())
|
if (RaceManager::get()->isLinearRaceMode())
|
||||||
time_left = time_target - time_left;
|
time_left = time_target - time_left;
|
||||||
|
}
|
||||||
|
else if (!RaceManager::get()->isFollowMode())
|
||||||
|
{
|
||||||
|
return; // No Time Target and no FTL
|
||||||
|
}
|
||||||
|
|
||||||
if (time_left <= 5 && getTimeTicks() % stk_config->time2Ticks(1.0f) == 0 &&
|
if (time_left <= (RaceManager::get()->isFollowMode() ? 3 : 5) &&
|
||||||
!World::getWorld()->isRaceOver() && time_left > 0)
|
getTimeTicks() % stk_config->time2Ticks(1.0f) == 0 &&
|
||||||
{
|
!World::getWorld()->isRaceOver() && time_left > 0)
|
||||||
SFXManager::get()->quickSound("pre_start_race");
|
{
|
||||||
}
|
SFXManager::get()->quickSound("pre_start_race");
|
||||||
}
|
}
|
||||||
} // updateTimeTargetSound
|
} // updateTimeTargetSound
|
||||||
|
|
||||||
|
@ -438,6 +438,7 @@ void RaceGUI::drawGlobalTimer()
|
|||||||
|
|
||||||
sw = core::stringw (StringUtils::timeToString(elapsed_time).c_str() );
|
sw = core::stringw (StringUtils::timeToString(elapsed_time).c_str() );
|
||||||
|
|
||||||
|
// Use colors to draw player attention to countdowns in challenges and FTL
|
||||||
if (RaceManager::get()->hasTimeTarget())
|
if (RaceManager::get()->hasTimeTarget())
|
||||||
{
|
{
|
||||||
// This assumes only challenges have a time target
|
// This assumes only challenges have a time target
|
||||||
@ -455,6 +456,13 @@ void RaceGUI::drawGlobalTimer()
|
|||||||
else if (elapsed_time <= 15)
|
else if (elapsed_time <= 15)
|
||||||
time_color = video::SColor(255,255,255,0);
|
time_color = video::SColor(255,255,255,0);
|
||||||
}
|
}
|
||||||
|
else if(RaceManager::get()->isFollowMode())
|
||||||
|
{
|
||||||
|
if (elapsed_time <= 3)
|
||||||
|
time_color = video::SColor(255,255,160,0);
|
||||||
|
else if (elapsed_time <= 8)
|
||||||
|
time_color = video::SColor(255,255,255,0);
|
||||||
|
}
|
||||||
|
|
||||||
core::rect<s32> pos(irr_driver->getActualScreenSize().Width - dist_from_right,
|
core::rect<s32> pos(irr_driver->getActualScreenSize().Width - dist_from_right,
|
||||||
irr_driver->getActualScreenSize().Height*2/100,
|
irr_driver->getActualScreenSize().Height*2/100,
|
||||||
@ -1385,4 +1393,3 @@ void RaceGUI::drawLap(const AbstractKart* kart,
|
|||||||
font->setScale(1.0f);
|
font->setScale(1.0f);
|
||||||
#endif
|
#endif
|
||||||
} // drawLap
|
} // drawLap
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user