Add cl_race_ghost_alpha, add title for ghost settings.

This commit is contained in:
furo 2023-10-27 00:28:29 +02:00
parent b90995da06
commit dadb142f4e
3 changed files with 18 additions and 5 deletions

View file

@ -324,6 +324,7 @@ MACRO_CONFIG_INT(ClRaceShowGhost, cl_race_show_ghost, 1, 0, 1, CFGFLAG_CLIENT |
MACRO_CONFIG_INT(ClRaceSaveGhost, cl_race_save_ghost, 1, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Save ghost")
MACRO_CONFIG_INT(ClRaceGhostStrictMap, cl_race_ghost_strict_map, 0, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Strict map checking when loading ghosts")
MACRO_CONFIG_INT(ClRaceGhostSaveBest, cl_race_ghost_save_best, 1, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Save only ghosts that are better than the previous record.")
MACRO_CONFIG_INT(ClRaceGhostAlpha, cl_race_ghost_alpha, 40, 0, 100, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Visbility of ghosts (alpha value, 0 invisible, 100 fully visible)")
MACRO_CONFIG_INT(ClDDRaceScoreBoard, cl_ddrace_scoreboard, 1, 0, 1, CFGFLAG_SAVE | CFGFLAG_CLIENT, "Enable DDRace Scoreboard")
MACRO_CONFIG_INT(SvResetPickups, sv_reset_pickups, 0, 0, 1, CFGFLAG_SERVER | CFGFLAG_GAME, "Whether the weapons are reset on passing the start tile or not")

View file

@ -3002,6 +3002,9 @@ void CMenus::RenderSettingsDDNet(CUIRect MainView)
MainView.HSplitTop(110.0f, &Demo, &MainView);
Demo.HSplitTop(30.0f, &Label, &Demo);
UI()->DoLabel(&Label, Localize("Demo"), 20.0f, TEXTALIGN_ML);
Label.VSplitMid(nullptr, &Label, 20.0f);
UI()->DoLabel(&Label, Localize("Ghost"), 20.0f, TEXTALIGN_ML);
Demo.HSplitTop(5.0f, nullptr, &Demo);
Demo.VSplitMid(&Left, &Right, 20.0f);
@ -3041,10 +3044,12 @@ void CMenus::RenderSettingsDDNet(CUIRect MainView)
if(g_Config.m_ClRaceGhost)
{
Right.HSplitTop(20.0f, &Button, &Right);
if(DoButton_CheckBox(&g_Config.m_ClRaceShowGhost, Localize("Show ghost"), g_Config.m_ClRaceShowGhost, &Button))
Button.VSplitMid(&LeftLeft, &Button);
if(DoButton_CheckBox(&g_Config.m_ClRaceShowGhost, Localize("Show ghost"), g_Config.m_ClRaceShowGhost, &LeftLeft))
{
g_Config.m_ClRaceShowGhost ^= 1;
}
UI()->DoScrollbarOption(&g_Config.m_ClRaceGhostAlpha, &g_Config.m_ClRaceGhostAlpha, &Button, Localize("Opacity"), 0, 100, &CUI::ms_LinearScrollbarScale, 0u, "%");
Right.HSplitTop(20.0f, &Button, &Right);
if(DoButton_CheckBox(&g_Config.m_ClRaceSaveGhost, Localize("Save ghost"), g_Config.m_ClRaceSaveGhost, &Button))
@ -3052,10 +3057,13 @@ void CMenus::RenderSettingsDDNet(CUIRect MainView)
g_Config.m_ClRaceSaveGhost ^= 1;
}
Right.HSplitTop(20.0f, &Button, &Right);
if(DoButton_CheckBox(&g_Config.m_ClRaceGhostSaveBest, Localize("Only save improvements"), g_Config.m_ClRaceGhostSaveBest, &Button))
if(g_Config.m_ClRaceSaveGhost)
{
g_Config.m_ClRaceGhostSaveBest ^= 1;
Right.HSplitTop(20.0f, &Button, &Right);
if(DoButton_CheckBox(&g_Config.m_ClRaceGhostSaveBest, Localize("Only save improvements"), g_Config.m_ClRaceGhostSaveBest, &Button))
{
g_Config.m_ClRaceGhostSaveBest ^= 1;
}
}
}
@ -3085,7 +3093,7 @@ void CMenus::RenderSettingsDDNet(CUIRect MainView)
if(DoButton_CheckBox(&g_Config.m_ClShowOthers, Localize("Show others"), g_Config.m_ClShowOthers == SHOW_OTHERS_ON, &LeftLeft))
g_Config.m_ClShowOthers = g_Config.m_ClShowOthers != SHOW_OTHERS_ON ? SHOW_OTHERS_ON : SHOW_OTHERS_OFF;
UI()->DoScrollbarOption(&g_Config.m_ClShowOthersAlpha, &g_Config.m_ClShowOthersAlpha, &Button, Localize("Opacity"), 0, 100);
UI()->DoScrollbarOption(&g_Config.m_ClShowOthersAlpha, &g_Config.m_ClShowOthersAlpha, &Button, Localize("Opacity"), 0, 100, &CUI::ms_LinearScrollbarScale, 0u, "%");
GameClient()->m_Tooltips.DoToolTip(&g_Config.m_ClShowOthersAlpha, &Button, Localize("Adjust the opacity of entities belonging to other teams, such as tees and nameplates"));

View file

@ -283,6 +283,8 @@ void CPlayers::RenderHook(
bool OtherTeam = m_pClient->IsOtherTeam(ClientID);
float Alpha = (OtherTeam || ClientID < 0) ? g_Config.m_ClShowOthersAlpha / 100.0f : 1.0f;
if(ClientID == -2) // ghost
Alpha = g_Config.m_ClRaceGhostAlpha / 100.0f;
RenderInfo.m_Size = 64.0f;
@ -356,6 +358,8 @@ void CPlayers::RenderPlayer(
bool Local = m_pClient->m_Snap.m_LocalClientID == ClientID;
bool OtherTeam = m_pClient->IsOtherTeam(ClientID);
float Alpha = (OtherTeam || ClientID < 0) ? g_Config.m_ClShowOthersAlpha / 100.0f : 1.0f;
if(ClientID == -2) // ghost
Alpha = g_Config.m_ClRaceGhostAlpha / 100.0f;
// set size
RenderInfo.m_Size = 64.0f;