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:
Alayan 2024-05-11 20:39:36 +02:00
parent 1c58f0154f
commit 3ec2b9a54d
No known key found for this signature in database
2 changed files with 23 additions and 8 deletions

View File

@ -949,19 +949,27 @@ void World::moveKartTo(AbstractKart* kart, const btTransform &transform)
// ----------------------------------------------------------------------------
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();
// In linear mode, the internal time still counts up even when displayed down.
if (RaceManager::get()->isLinearRaceMode())
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 &&
!World::getWorld()->isRaceOver() && time_left > 0)
{
SFXManager::get()->quickSound("pre_start_race");
}
if (time_left <= (RaceManager::get()->isFollowMode() ? 3 : 5) &&
getTimeTicks() % stk_config->time2Ticks(1.0f) == 0 &&
!World::getWorld()->isRaceOver() && time_left > 0)
{
SFXManager::get()->quickSound("pre_start_race");
}
} // updateTimeTargetSound

View File

@ -438,6 +438,7 @@ void RaceGUI::drawGlobalTimer()
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())
{
// This assumes only challenges have a time target
@ -455,6 +456,13 @@ void RaceGUI::drawGlobalTimer()
else if (elapsed_time <= 15)
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,
irr_driver->getActualScreenSize().Height*2/100,
@ -1385,4 +1393,3 @@ void RaceGUI::drawLap(const AbstractKart* kart,
font->setScale(1.0f);
#endif
} // drawLap