Skip to content

Commit

Permalink
Filter vanilla only skins at loading already
Browse files Browse the repository at this point in the history
  • Loading branch information
Jupeyy committed Aug 20, 2022
1 parent d1b8d53 commit 6e5c5cb
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
4 changes: 0 additions & 4 deletions src/game/client/components/menus_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -668,10 +668,6 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
if((pSkinToBeSelected->m_aName[0] == 'x' && pSkinToBeSelected->m_aName[1] == '_'))
continue;

// vanilla skins only
if(g_Config.m_ClVanillaSkinsOnly && !pSkinToBeSelected->m_IsVanilla)
continue;

if(pSkinToBeSelected == 0)
continue;

Expand Down
5 changes: 3 additions & 2 deletions src/game/client/components/skins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ int CSkins::SkinScan(const char *pName, int IsDir, int DirType, void *pUser)
str_copy(aNameWithoutPng, pName);
aNameWithoutPng[str_length(aNameWithoutPng) - 4] = 0;

if(g_Config.m_ClVanillaSkinsOnly && !IsVanillaSkin(aNameWithoutPng))
return 0;

// Don't add duplicate skins (one from user's config directory, other from
// client itself)
for(int i = 0; i < pSelf->Num(); i++)
Expand Down Expand Up @@ -154,7 +157,6 @@ int CSkins::LoadSkin(const char *pName, CImageInfo &Info)
}

CSkin Skin;
Skin.m_IsVanilla = IsVanillaSkin(pName);
Skin.m_OriginalSkin.m_Body = Graphics()->LoadSpriteTexture(Info, &g_pData->m_aSprites[SPRITE_TEE_BODY]);
Skin.m_OriginalSkin.m_BodyOutline = Graphics()->LoadSpriteTexture(Info, &g_pData->m_aSprites[SPRITE_TEE_BODY_OUTLINE]);
Skin.m_OriginalSkin.m_Feet = Graphics()->LoadSpriteTexture(Info, &g_pData->m_aSprites[SPRITE_TEE_FOOT]);
Expand Down Expand Up @@ -355,7 +357,6 @@ void CSkins::Refresh(TSkinLoadedCBFunc &&SkinLoadedFunc)
{
Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "gameclient", "failed to load skins. folder='skins/'");
CSkin DummySkin;
DummySkin.m_IsVanilla = true;
str_copy(DummySkin.m_aName, "dummy");
DummySkin.m_BloodColor = ColorRGBA(1.0f, 1.0f, 1.0f);
m_vSkins.push_back(DummySkin);
Expand Down
2 changes: 0 additions & 2 deletions src/game/client/skin.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
// do this better and nicer
struct CSkin
{
bool m_IsVanilla;

struct SSkinTextures
{
IGraphics::CTextureHandle m_Body;
Expand Down

0 comments on commit 6e5c5cb

Please sign in to comment.