typo + added an optional argument to save_replay + changed max replay length and fixed cl_notification_time values

This commit is contained in:
Corantin H 2019-06-02 15:34:01 +02:00
parent 761e73a131
commit 2e27a22927
5 changed files with 24 additions and 11 deletions

View file

@ -783,8 +783,8 @@ if(CLIENT)
backend_sdl.h
client.cpp
client.h
demoedit.cpp
demoedit.h
demoedit.cpp
demoedit.h
friends.cpp
friends.h
graphics_threaded.cpp

View file

@ -3312,14 +3312,27 @@ void CClient::Con_DemoSliceEnd(IConsole::IResult *pResult, void *pUserData)
void CClient::Con_SaveReplay(IConsole::IResult *pResult, void *pUserData)
{
CClient *pSelf = (CClient *)pUserData;
pSelf->SaveReplay();
if(pResult->NumArguments())
{
int Length = pResult->GetInteger(0);
if(Length <= 0)
{
pSelf->m_pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, "replay", "Error: length must be greater than 0 second.");
}
else
{
pSelf->SaveReplay(Length);
}
}
else
pSelf->SaveReplay(g_Config.m_ClReplayLength);
}
void CClient::SaveReplay()
void CClient::SaveReplay(const int Length)
{
if(!g_Config.m_ClRaceReplays)
{
m_pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, "replay", "Feature is disabled. Please enabled it via configuration");
m_pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, "replay", "Feature is disabled. Please enable it via configuration.");
Notify(Localize("Replay"), Localize("Replay feature is disabled!"));
}
else
@ -3342,7 +3355,7 @@ void CClient::SaveReplay()
// Slice the demo to get only the last cl_replay_length seconds
const int EndTick = GameTick();
const int StartTick = EndTick - g_Config.m_ClReplayLength * GameTickSpeed();
const int StartTick = EndTick - Length * GameTickSpeed();
// Create a job to do this slicing in background because it can be a bit long depending on the file size
std::shared_ptr<CDemoEdit> pDemoEditTask = std::make_shared<CDemoEdit>(GameClient()->NetVersion(), &m_SnapshotDelta, m_pStorage, pSrc, aFilename, StartTick, EndTick);
@ -3724,7 +3737,7 @@ void CClient::RegisterCommands()
m_pConsole->Register("demo_play", "", CFGFLAG_CLIENT, Con_DemoPlay, this, "Play demo");
m_pConsole->Register("demo_speed", "i[speed]", CFGFLAG_CLIENT, Con_DemoSpeed, this, "Set demo speed");
m_pConsole->Register("save_replay", "", CFGFLAG_CLIENT, Con_SaveReplay, this, "Save a replay of the last defined amount of seconds");
m_pConsole->Register("save_replay", "?i[length]", CFGFLAG_CLIENT, Con_SaveReplay, this, "Save a replay of the last defined amount of seconds");
m_pConsole->Chain("cl_timeout_seed", ConchainTimeoutSeed, this);

View file

@ -415,7 +415,7 @@ public:
virtual void DemoSliceBegin();
virtual void DemoSliceEnd();
virtual void DemoSlice(const char *pDstPath, CLIENTFUNC_FILTER pfnFilter, void *pUser);
virtual void SaveReplay();
virtual void SaveReplay(const int Length);
virtual void Notify(const char * pTitle, const char * pMessage);

View file

@ -265,8 +265,8 @@ MACRO_CONFIG_INT(ClShowIDs, cl_show_ids, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "
MACRO_CONFIG_INT(ClScoreboardOnDeath, cl_scoreboard_on_death, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Whether to show scoreboard after death or not")
MACRO_CONFIG_INT(ClAutoRaceRecord, cl_auto_race_record, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Save the best demo of each race")
MACRO_CONFIG_INT(ClRaceReplays, cl_race_replays, 0, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Enable replays")
MACRO_CONFIG_INT(ClReplayLength, cl_replay_length, 10, 5, 30, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Set the length of the replays")
MACRO_CONFIG_INT(ClNotificationTime, cl_notification_time, 1, 3, 10, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Set the duration of the notifications (how many seconds they should stay on the screen)")
MACRO_CONFIG_INT(ClReplayLength, cl_replay_length, 10, 5, 60, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Set the length of the replays")
MACRO_CONFIG_INT(ClNotificationTime, cl_notification_time, 3, 1, 10, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Set the duration of the notifications (how many seconds they should stay on the screen)")
MACRO_CONFIG_INT(ClRaceRecordServerControl, cl_race_record_server_control, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Let the server start the race recorder")
MACRO_CONFIG_INT(ClDemoName, cl_demo_name, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Save the player name within the demo")
MACRO_CONFIG_INT(ClDemoAssumeRace, cl_demo_assume_race, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Assume that demos are race demos")

View file

@ -2010,7 +2010,7 @@ void CMenus::RenderSettingsDDNet(CUIRect MainView)
int FakeLength = g_Config.m_ClReplayLength - 5; // minimum length is 5 not 0
FakeLength = (int)(DoScrollbarH(&FakeLength, &Button, FakeLength / 25.0f)*25.0f);
FakeLength = (int)(DoScrollbarH(&FakeLength, &Button, FakeLength / 55.0f)*55.0f);
g_Config.m_ClReplayLength = FakeLength + 5;