Allow auto recreation of ghost replay file lists after recording.
This commit is contained in:
parent
151cc72e22
commit
dff5f8d459
@ -280,7 +280,7 @@ void World::reset()
|
|||||||
race_manager->reset();
|
race_manager->reset();
|
||||||
// Make sure to overwrite the data from the previous race.
|
// Make sure to overwrite the data from the previous race.
|
||||||
if(!history->replayHistory()) history->initRecording();
|
if(!history->replayHistory()) history->initRecording();
|
||||||
if(race_manager->willRecordRace())
|
if(race_manager->isRecordingRace())
|
||||||
{
|
{
|
||||||
Log::info("World", "Start Recording race.");
|
Log::info("World", "Start Recording race.");
|
||||||
ReplayRecorder::get()->init();
|
ReplayRecorder::get()->init();
|
||||||
@ -436,16 +436,18 @@ World::~World()
|
|||||||
delete m_karts[i];
|
delete m_karts[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
if(race_manager->hasGhostKarts())
|
if(race_manager->hasGhostKarts() || race_manager->isRecordingRace())
|
||||||
{
|
{
|
||||||
// Destroy the old replay object, which also stored the ghost
|
// Destroy the old replay object, which also stored the ghost
|
||||||
// karts, and create a new one (which means that in further
|
// karts, and create a new one (which means that in further
|
||||||
// races the usage of ghosts will still be enabled).
|
// races the usage of ghosts will still be enabled).
|
||||||
|
// It can allow auto recreation of ghost replay file lists
|
||||||
|
// when next time visit the ghost replay selection screen.
|
||||||
ReplayPlay::destroy();
|
ReplayPlay::destroy();
|
||||||
ReplayPlay::create();
|
ReplayPlay::create();
|
||||||
}
|
}
|
||||||
m_karts.clear();
|
m_karts.clear();
|
||||||
if(race_manager->willRecordRace())
|
if(race_manager->isRecordingRace())
|
||||||
ReplayRecorder::get()->reset();
|
ReplayRecorder::get()->reset();
|
||||||
race_manager->setRaceGhostKarts(false);
|
race_manager->setRaceGhostKarts(false);
|
||||||
race_manager->setRecordRace(false);
|
race_manager->setRecordRace(false);
|
||||||
@ -982,7 +984,7 @@ void World::update(float dt)
|
|||||||
|
|
||||||
PROFILER_PUSH_CPU_MARKER("World::update (sub-updates)", 0x20, 0x7F, 0x00);
|
PROFILER_PUSH_CPU_MARKER("World::update (sub-updates)", 0x20, 0x7F, 0x00);
|
||||||
history->update(dt);
|
history->update(dt);
|
||||||
if(race_manager->willRecordRace()) ReplayRecorder::get()->update(dt);
|
if(race_manager->isRecordingRace()) ReplayRecorder::get()->update(dt);
|
||||||
if(history->replayHistory()) dt=history->getNextDelta();
|
if(history->replayHistory()) dt=history->getNextDelta();
|
||||||
WorldStatus::update(dt);
|
WorldStatus::update(dt);
|
||||||
if (m_script_engine) m_script_engine->update(dt);
|
if (m_script_engine) m_script_engine->update(dt);
|
||||||
|
@ -948,7 +948,7 @@ void RaceManager::setupPlayerKartInfo()
|
|||||||
void RaceManager::startWatchingReplay(const std::string &track_ident,
|
void RaceManager::startWatchingReplay(const std::string &track_ident,
|
||||||
const int num_laps)
|
const int num_laps)
|
||||||
{
|
{
|
||||||
assert(m_watching_replay && m_has_ghost_karts && !m_will_record_race);
|
assert(m_watching_replay && m_has_ghost_karts && !m_is_recording_race);
|
||||||
StateManager::get()->enterGameState();
|
StateManager::get()->enterGameState();
|
||||||
setTrack(track_ident);
|
setTrack(track_ident);
|
||||||
setNumLaps(num_laps);
|
setNumLaps(num_laps);
|
||||||
|
@ -351,7 +351,7 @@ private:
|
|||||||
/** Determines if saved GP should be continued or not*/
|
/** Determines if saved GP should be continued or not*/
|
||||||
bool m_continue_saved_gp;
|
bool m_continue_saved_gp;
|
||||||
|
|
||||||
bool m_will_record_race;
|
bool m_is_recording_race;
|
||||||
|
|
||||||
bool m_has_ghost_karts;
|
bool m_has_ghost_karts;
|
||||||
|
|
||||||
@ -722,7 +722,7 @@ public:
|
|||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
void setRecordRace(bool record)
|
void setRecordRace(bool record)
|
||||||
{
|
{
|
||||||
m_will_record_race = record;
|
m_is_recording_race = record;
|
||||||
} // setRecordRace
|
} // setRecordRace
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
void setRaceGhostKarts(bool ghost)
|
void setRaceGhostKarts(bool ghost)
|
||||||
@ -735,10 +735,10 @@ public:
|
|||||||
m_watching_replay = watch;
|
m_watching_replay = watch;
|
||||||
} // setWatchingReplay
|
} // setWatchingReplay
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
bool willRecordRace() const
|
bool isRecordingRace() const
|
||||||
{
|
{
|
||||||
return m_will_record_race;
|
return m_is_recording_race;
|
||||||
} // willRecordRace
|
} // isRecordingRace
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
bool hasGhostKarts() const
|
bool hasGhostKarts() const
|
||||||
{
|
{
|
||||||
|
@ -231,9 +231,9 @@ void TrackInfoScreen::init()
|
|||||||
const bool record_available = race_manager->getMinorMode() == RaceManager::MINOR_MODE_TIME_TRIAL;
|
const bool record_available = race_manager->getMinorMode() == RaceManager::MINOR_MODE_TIME_TRIAL;
|
||||||
m_record_race->setVisible(record_available);
|
m_record_race->setVisible(record_available);
|
||||||
getWidget<LabelWidget>("record-race-text")->setVisible(record_available);
|
getWidget<LabelWidget>("record-race-text")->setVisible(record_available);
|
||||||
if (race_manager->willRecordRace())
|
if (race_manager->isRecordingRace())
|
||||||
{
|
{
|
||||||
// willRecordRace() is true when it's pre-set by ghost replay selection
|
// isRecordingRace() is true when it's pre-set by ghost replay selection
|
||||||
// which force record this race
|
// which force record this race
|
||||||
m_record_this_race = true;
|
m_record_this_race = true;
|
||||||
m_record_race->setState(true);
|
m_record_race->setState(true);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user