A bit better formatting in world status
This commit is contained in:
parent
507d9566a0
commit
47b46558f2
@ -44,7 +44,9 @@ WorldStatus::WorldStatus()
|
|||||||
m_play_racestart_sounds = true;
|
m_play_racestart_sounds = true;
|
||||||
|
|
||||||
IrrlichtDevice *device = irr_driver->getDevice();
|
IrrlichtDevice *device = irr_driver->getDevice();
|
||||||
if (device->getTimer()->isStopped()) device->getTimer()->start();
|
|
||||||
|
if (device->getTimer()->isStopped())
|
||||||
|
device->getTimer()->start();
|
||||||
} // WorldStatus
|
} // WorldStatus
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -62,7 +64,9 @@ void WorldStatus::reset()
|
|||||||
m_track_intro_sound->stop();
|
m_track_intro_sound->stop();
|
||||||
|
|
||||||
IrrlichtDevice *device = irr_driver->getDevice();
|
IrrlichtDevice *device = irr_driver->getDevice();
|
||||||
if (device->getTimer()->isStopped()) device->getTimer()->start();
|
|
||||||
|
if (device->getTimer()->isStopped())
|
||||||
|
device->getTimer()->start();
|
||||||
} // reset
|
} // reset
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -74,7 +78,9 @@ WorldStatus::~WorldStatus()
|
|||||||
sfx_manager->deleteSFX(m_start_sound);
|
sfx_manager->deleteSFX(m_start_sound);
|
||||||
sfx_manager->deleteSFX(m_track_intro_sound);
|
sfx_manager->deleteSFX(m_track_intro_sound);
|
||||||
IrrlichtDevice *device = irr_driver->getDevice();
|
IrrlichtDevice *device = irr_driver->getDevice();
|
||||||
if (device->getTimer()->isStopped()) device->getTimer()->start();
|
|
||||||
|
if (device->getTimer()->isStopped())
|
||||||
|
device->getTimer()->start();
|
||||||
} // ~WorldStatus
|
} // ~WorldStatus
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -96,14 +102,12 @@ void WorldStatus::setClockMode(const ClockType mode, const float initial_time)
|
|||||||
void WorldStatus::enterRaceOverState()
|
void WorldStatus::enterRaceOverState()
|
||||||
{
|
{
|
||||||
// Don't enter race over if it's already race over
|
// Don't enter race over if it's already race over
|
||||||
if( m_phase == DELAY_FINISH_PHASE
|
if (m_phase == DELAY_FINISH_PHASE || m_phase == RESULT_DISPLAY_PHASE ||
|
||||||
|| m_phase == RESULT_DISPLAY_PHASE
|
m_phase == FINISH_PHASE)
|
||||||
|| m_phase == FINISH_PHASE )
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_phase = DELAY_FINISH_PHASE;
|
m_phase = DELAY_FINISH_PHASE;
|
||||||
m_auxiliary_timer = 0.0f;
|
m_auxiliary_timer = 0.0f;
|
||||||
|
|
||||||
} // enterRaceOverState
|
} // enterRaceOverState
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -148,7 +152,9 @@ void WorldStatus::update(const float dt)
|
|||||||
if (UserConfigParams::m_artist_debug_mode &&
|
if (UserConfigParams::m_artist_debug_mode &&
|
||||||
race_manager->getNumberOfKarts() == 1 &&
|
race_manager->getNumberOfKarts() == 1 &&
|
||||||
race_manager->getTrackName() != "tutorial")
|
race_manager->getTrackName() != "tutorial")
|
||||||
|
{
|
||||||
m_auxiliary_timer += dt * 6;
|
m_auxiliary_timer += dt * 6;
|
||||||
|
}
|
||||||
|
|
||||||
// Work around a bug that occurred on linux once:
|
// Work around a bug that occurred on linux once:
|
||||||
// the sfx_manager kept on reporting that it is playing,
|
// the sfx_manager kept on reporting that it is playing,
|
||||||
@ -156,57 +162,82 @@ void WorldStatus::update(const float dt)
|
|||||||
// ... phase. Since the sound effect is about 3 seconds
|
// ... phase. Since the sound effect is about 3 seconds
|
||||||
// long, we use the aux timer to force the next phase
|
// long, we use the aux timer to force the next phase
|
||||||
// after 3.5 seconds.
|
// after 3.5 seconds.
|
||||||
if(m_track_intro_sound->getStatus()==SFXManager::SFX_PLAYING
|
if (m_track_intro_sound->getStatus() == SFXManager::SFX_PLAYING &&
|
||||||
&& m_auxiliary_timer<3.5f)
|
m_auxiliary_timer < 3.5f)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Wait before ready phase if sounds are disabled
|
// Wait before ready phase if sounds are disabled
|
||||||
if (!UserConfigParams::m_sfx && m_auxiliary_timer < 3.0f)
|
if (!UserConfigParams::m_sfx && m_auxiliary_timer < 3.0f)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_auxiliary_timer = 0.0f;
|
m_auxiliary_timer = 0.0f;
|
||||||
if (m_play_racestart_sounds) m_prestart_sound->play();
|
|
||||||
|
if (m_play_racestart_sounds)
|
||||||
|
m_prestart_sound->play();
|
||||||
|
|
||||||
m_phase = READY_PHASE;
|
m_phase = READY_PHASE;
|
||||||
|
|
||||||
for (unsigned int i = 0; i < World::getWorld()->getNumKarts(); i++)
|
for (unsigned int i = 0; i < World::getWorld()->getNumKarts(); i++)
|
||||||
|
{
|
||||||
World::getWorld()->getKart(i)->startEngineSFX();
|
World::getWorld()->getKart(i)->startEngineSFX();
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case READY_PHASE:
|
case READY_PHASE:
|
||||||
if (m_auxiliary_timer > 1.0)
|
if (m_auxiliary_timer > 1.0)
|
||||||
{
|
{
|
||||||
if (m_play_racestart_sounds) m_prestart_sound->play();
|
if (m_play_racestart_sounds)
|
||||||
|
{
|
||||||
|
m_prestart_sound->play();
|
||||||
|
}
|
||||||
|
|
||||||
m_phase = SET_PHASE;
|
m_phase = SET_PHASE;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_auxiliary_timer += dt;
|
m_auxiliary_timer += dt;
|
||||||
|
|
||||||
// In artist debug mode, when without opponents, skip the ready/set/go counter faster
|
// In artist debug mode, when without opponents, skip the ready/set/go counter faster
|
||||||
if (UserConfigParams::m_artist_debug_mode &&
|
if (UserConfigParams::m_artist_debug_mode &&
|
||||||
race_manager->getNumberOfKarts() == 1 &&
|
race_manager->getNumberOfKarts() == 1 &&
|
||||||
race_manager->getTrackName() != "tutorial")
|
race_manager->getTrackName() != "tutorial")
|
||||||
|
{
|
||||||
m_auxiliary_timer += dt*6;
|
m_auxiliary_timer += dt*6;
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
case SET_PHASE:
|
case SET_PHASE:
|
||||||
if (m_auxiliary_timer > 2.0)
|
if (m_auxiliary_timer > 2.0)
|
||||||
{
|
{
|
||||||
// set phase is over, go to the next one
|
// set phase is over, go to the next one
|
||||||
m_phase = GO_PHASE;
|
m_phase = GO_PHASE;
|
||||||
if (m_play_racestart_sounds) m_start_sound->play();
|
if (m_play_racestart_sounds)
|
||||||
|
{
|
||||||
|
m_start_sound->play();
|
||||||
|
}
|
||||||
|
|
||||||
World::getWorld()->getTrack()->startMusic();
|
World::getWorld()->getTrack()->startMusic();
|
||||||
|
|
||||||
// event
|
// event
|
||||||
onGo();
|
onGo();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_auxiliary_timer += dt;
|
m_auxiliary_timer += dt;
|
||||||
|
|
||||||
// In artist debug mode, when without opponents, skip the ready/set/go counter faster
|
// In artist debug mode, when without opponents, skip the ready/set/go counter faster
|
||||||
if (UserConfigParams::m_artist_debug_mode &&
|
if (UserConfigParams::m_artist_debug_mode &&
|
||||||
race_manager->getNumberOfKarts() == 1 &&
|
race_manager->getNumberOfKarts() == 1 &&
|
||||||
race_manager->getTrackName() != "tutorial")
|
race_manager->getTrackName() != "tutorial")
|
||||||
|
{
|
||||||
m_auxiliary_timer += dt*6;
|
m_auxiliary_timer += dt*6;
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
case GO_PHASE :
|
case GO_PHASE :
|
||||||
|
|
||||||
if (m_auxiliary_timer>2.5f && music_manager->getCurrentMusic())
|
if (m_auxiliary_timer>2.5f && music_manager->getCurrentMusic())
|
||||||
|
{
|
||||||
music_manager->startMusic(music_manager->getCurrentMusic());
|
music_manager->startMusic(music_manager->getCurrentMusic());
|
||||||
|
}
|
||||||
|
|
||||||
if (m_auxiliary_timer > 3.0f) // how long to display the 'go' message
|
if (m_auxiliary_timer > 3.0f) // how long to display the 'go' message
|
||||||
{
|
{
|
||||||
@ -219,12 +250,18 @@ void WorldStatus::update(const float dt)
|
|||||||
if (UserConfigParams::m_artist_debug_mode &&
|
if (UserConfigParams::m_artist_debug_mode &&
|
||||||
race_manager->getNumberOfKarts() == 1 &&
|
race_manager->getNumberOfKarts() == 1 &&
|
||||||
race_manager->getTrackName() != "tutorial")
|
race_manager->getTrackName() != "tutorial")
|
||||||
|
{
|
||||||
m_auxiliary_timer += dt*6;
|
m_auxiliary_timer += dt*6;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case MUSIC_PHASE:
|
case MUSIC_PHASE:
|
||||||
// how long to display the 'music' message
|
// how long to display the 'music' message
|
||||||
if (m_auxiliary_timer>stk_config->m_music_credit_time)
|
if (m_auxiliary_timer>stk_config->m_music_credit_time)
|
||||||
|
{
|
||||||
m_phase = RACE_PHASE;
|
m_phase = RACE_PHASE;
|
||||||
|
}
|
||||||
|
|
||||||
m_auxiliary_timer += dt;
|
m_auxiliary_timer += dt;
|
||||||
break;
|
break;
|
||||||
case RACE_PHASE:
|
case RACE_PHASE:
|
||||||
@ -241,6 +278,7 @@ void WorldStatus::update(const float dt)
|
|||||||
m_phase = RESULT_DISPLAY_PHASE;
|
m_phase = RESULT_DISPLAY_PHASE;
|
||||||
terminateRace();
|
terminateRace();
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case RESULT_DISPLAY_PHASE:
|
case RESULT_DISPLAY_PHASE:
|
||||||
@ -298,10 +336,13 @@ void WorldStatus::setTime(const float time)
|
|||||||
void WorldStatus::pause(Phase phase)
|
void WorldStatus::pause(Phase phase)
|
||||||
{
|
{
|
||||||
assert(m_previous_phase == UNDEFINED_PHASE);
|
assert(m_previous_phase == UNDEFINED_PHASE);
|
||||||
|
|
||||||
m_previous_phase = m_phase;
|
m_previous_phase = m_phase;
|
||||||
m_phase = phase;
|
m_phase = phase;
|
||||||
IrrlichtDevice *device = irr_driver->getDevice();
|
IrrlichtDevice *device = irr_driver->getDevice();
|
||||||
if (!device->getTimer()->isStopped()) device->getTimer()->stop();
|
|
||||||
|
if (!device->getTimer()->isStopped())
|
||||||
|
device->getTimer()->stop();
|
||||||
} // pause
|
} // pause
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -314,5 +355,7 @@ void WorldStatus::unpause()
|
|||||||
// in pause to detect incorrect pause/unpause sequences.
|
// in pause to detect incorrect pause/unpause sequences.
|
||||||
m_previous_phase = UNDEFINED_PHASE;
|
m_previous_phase = UNDEFINED_PHASE;
|
||||||
IrrlichtDevice *device = irr_driver->getDevice();
|
IrrlichtDevice *device = irr_driver->getDevice();
|
||||||
if (device->getTimer()->isStopped()) device->getTimer()->start();
|
|
||||||
|
if (device->getTimer()->isStopped())
|
||||||
|
device->getTimer()->start();
|
||||||
} // unpause
|
} // unpause
|
||||||
|
Loading…
x
Reference in New Issue
Block a user