mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Add console chain for assets, reload current asset on reload button click
This commit is contained in:
parent
a503251998
commit
0012e72d34
|
@ -1424,6 +1424,11 @@ void CMenus::OnInit()
|
||||||
Console()->Chain("add_friend", ConchainFriendlistUpdate, this);
|
Console()->Chain("add_friend", ConchainFriendlistUpdate, this);
|
||||||
Console()->Chain("remove_friend", ConchainFriendlistUpdate, this);
|
Console()->Chain("remove_friend", ConchainFriendlistUpdate, this);
|
||||||
|
|
||||||
|
Console()->Chain("cl_assets_entities", ConchainAssetsEntities, this);
|
||||||
|
Console()->Chain("cl_asset_game", ConchainAssetGame, this);
|
||||||
|
Console()->Chain("cl_asset_emoticons", ConchainAssetEmoticons, this);
|
||||||
|
Console()->Chain("cl_asset_particles", ConchainAssetParticles, this);
|
||||||
|
|
||||||
m_TextureBlob = Graphics()->LoadTexture("blob.png", IStorage::TYPE_ALL, CImageInfo::FORMAT_AUTO, 0);
|
m_TextureBlob = Graphics()->LoadTexture("blob.png", IStorage::TYPE_ALL, CImageInfo::FORMAT_AUTO, 0);
|
||||||
|
|
||||||
// setup load amount
|
// setup load amount
|
||||||
|
|
|
@ -270,6 +270,11 @@ protected:
|
||||||
static int EmoticonsScan(const char *pName, int IsDir, int DirType, void *pUser);
|
static int EmoticonsScan(const char *pName, int IsDir, int DirType, void *pUser);
|
||||||
static int ParticlesScan(const char *pName, int IsDir, int DirType, void *pUser);
|
static int ParticlesScan(const char *pName, int IsDir, int DirType, void *pUser);
|
||||||
|
|
||||||
|
static void ConchainAssetsEntities(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
|
||||||
|
static void ConchainAssetGame(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
|
||||||
|
static void ConchainAssetParticles(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
|
||||||
|
static void ConchainAssetEmoticons(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
|
||||||
|
|
||||||
void ClearCustomItems(int CurTab);
|
void ClearCustomItems(int CurTab);
|
||||||
|
|
||||||
int m_MenuPage;
|
int m_MenuPage;
|
||||||
|
|
|
@ -249,18 +249,30 @@ void CMenus::ClearCustomItems(int CurTab)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_EntitiesList.clear();
|
m_EntitiesList.clear();
|
||||||
|
|
||||||
|
// reload current entities
|
||||||
|
m_pClient->m_pMapimages->ChangeEntitiesPath(g_Config.m_ClAssetsEntites);
|
||||||
}
|
}
|
||||||
else if(CurTab == 1)
|
else if(CurTab == 1)
|
||||||
{
|
{
|
||||||
ClearAssetList(m_GameList, Graphics());
|
ClearAssetList(m_GameList, Graphics());
|
||||||
|
|
||||||
|
// reload current game skin
|
||||||
|
GameClient()->LoadGameSkin(g_Config.m_ClAssetGame);
|
||||||
}
|
}
|
||||||
else if(CurTab == 2)
|
else if(CurTab == 2)
|
||||||
{
|
{
|
||||||
ClearAssetList(m_EmoticonList, Graphics());
|
ClearAssetList(m_EmoticonList, Graphics());
|
||||||
|
|
||||||
|
// reload current emoticons skin
|
||||||
|
GameClient()->LoadEmoticonsSkin(g_Config.m_ClAssetEmoticons);
|
||||||
}
|
}
|
||||||
else if(CurTab == 3)
|
else if(CurTab == 3)
|
||||||
{
|
{
|
||||||
ClearAssetList(m_ParticlesList, Graphics());
|
ClearAssetList(m_ParticlesList, Graphics());
|
||||||
|
|
||||||
|
// reload current particles skin
|
||||||
|
GameClient()->LoadParticlesSkin(g_Config.m_ClAssetParticles);
|
||||||
}
|
}
|
||||||
s_InitCustomList[CurTab] = true;
|
s_InitCustomList[CurTab] = true;
|
||||||
}
|
}
|
||||||
|
@ -548,3 +560,63 @@ void CMenus::RenderSettingsCustom(CUIRect MainView)
|
||||||
TextRender()->SetRenderFlags(0);
|
TextRender()->SetRenderFlags(0);
|
||||||
TextRender()->SetCurFont(NULL);
|
TextRender()->SetCurFont(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CMenus::ConchainAssetsEntities(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
|
||||||
|
{
|
||||||
|
CMenus *pThis = (CMenus *)pUserData;
|
||||||
|
if(pResult->NumArguments() == 1)
|
||||||
|
{
|
||||||
|
const char *pArg = pResult->GetString(0);
|
||||||
|
if(str_comp(pArg, g_Config.m_ClAssetsEntites) != 0)
|
||||||
|
{
|
||||||
|
pThis->m_pClient->m_pMapimages->ChangeEntitiesPath(pArg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pfnCallback(pResult, pCallbackUserData);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMenus::ConchainAssetGame(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
|
||||||
|
{
|
||||||
|
CMenus *pThis = (CMenus *)pUserData;
|
||||||
|
if(pResult->NumArguments() == 1)
|
||||||
|
{
|
||||||
|
const char *pArg = pResult->GetString(0);
|
||||||
|
if(str_comp(pArg, g_Config.m_ClAssetGame) != 0)
|
||||||
|
{
|
||||||
|
pThis->GameClient()->LoadGameSkin(pArg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pfnCallback(pResult, pCallbackUserData);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMenus::ConchainAssetParticles(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
|
||||||
|
{
|
||||||
|
CMenus *pThis = (CMenus *)pUserData;
|
||||||
|
if(pResult->NumArguments() == 1)
|
||||||
|
{
|
||||||
|
const char *pArg = pResult->GetString(0);
|
||||||
|
if(str_comp(pArg, g_Config.m_ClAssetParticles) != 0)
|
||||||
|
{
|
||||||
|
pThis->GameClient()->LoadParticlesSkin(pArg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pfnCallback(pResult, pCallbackUserData);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMenus::ConchainAssetEmoticons(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
|
||||||
|
{
|
||||||
|
CMenus *pThis = (CMenus *)pUserData;
|
||||||
|
if(pResult->NumArguments() == 1)
|
||||||
|
{
|
||||||
|
const char *pArg = pResult->GetString(0);
|
||||||
|
if(str_comp(pArg, g_Config.m_ClAssetEmoticons) != 0)
|
||||||
|
{
|
||||||
|
pThis->GameClient()->LoadEmoticonsSkin(pArg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pfnCallback(pResult, pCallbackUserData);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue