mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 06:28:19 +00:00
add console chain for ClBackgroundEntities
This commit is contained in:
parent
e63c9481e0
commit
fd5d334cd1
|
@ -903,6 +903,7 @@ void CMenus::OnInit()
|
|||
|
||||
Console()->Chain("snd_enable", ConchainUpdateMusicState, this);
|
||||
Console()->Chain("snd_enable_music", ConchainUpdateMusicState, this);
|
||||
Console()->Chain("cl_background_entities", ConchainBackgroundEntities, this);
|
||||
|
||||
Console()->Chain("cl_assets_entities", ConchainAssetsEntities, this);
|
||||
Console()->Chain("cl_asset_game", ConchainAssetGame, this);
|
||||
|
@ -938,6 +939,22 @@ void CMenus::OnConsoleInit()
|
|||
Console()->Register("remove_favorite_skin", "s[skin_name]", CFGFLAG_CLIENT, Con_RemFavoriteSkin, this, "Remove a skin from the favorites");
|
||||
}
|
||||
|
||||
void CMenus::ConchainBackgroundEntities(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
|
||||
{
|
||||
pfnCallback(pResult, pCallbackUserData);
|
||||
if(pResult->NumArguments())
|
||||
{
|
||||
CMenus *pSelf = (CMenus *)pUserData;
|
||||
pSelf->UpdateBackgroundEntities();
|
||||
}
|
||||
}
|
||||
|
||||
void CMenus::UpdateBackgroundEntities()
|
||||
{
|
||||
if(str_comp(g_Config.m_ClBackgroundEntities, m_pClient->m_Background.MapName()) != 0)
|
||||
m_pClient->m_Background.LoadBackground();
|
||||
}
|
||||
|
||||
void CMenus::ConchainUpdateMusicState(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
|
||||
{
|
||||
pfnCallback(pResult, pCallbackUserData);
|
||||
|
|
|
@ -427,6 +427,8 @@ protected:
|
|||
#endif
|
||||
void RenderMenubar(CUIRect Box, IClient::EClientState ClientState);
|
||||
void RenderNews(CUIRect MainView);
|
||||
static void ConchainBackgroundEntities(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
|
||||
void UpdateBackgroundEntities();
|
||||
static void ConchainUpdateMusicState(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
|
||||
void UpdateMusicState();
|
||||
|
||||
|
|
|
@ -3345,8 +3345,7 @@ void CMenus::RenderSettingsDDNet(CUIRect MainView)
|
|||
static CButtonContainer s_BackgroundEntitiesReloadButton;
|
||||
if(DoButton_Menu(&s_BackgroundEntitiesReloadButton, Localize("Reload"), 0, &Button))
|
||||
{
|
||||
if(str_comp(g_Config.m_ClBackgroundEntities, m_pClient->m_Background.MapName()) != 0)
|
||||
m_pClient->m_Background.LoadBackground();
|
||||
UpdateBackgroundEntities();
|
||||
}
|
||||
|
||||
Background.HSplitTop(20.0f, &Button, &Background);
|
||||
|
|
Loading…
Reference in a new issue