MCPcopy Create free account
hub / github.com/ddnet/ddnet / LoadEmoticonsSkin

Method LoadEmoticonsSkin

src/game/client/gameclient.cpp:4205–4247  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4203}
4204
4205void CGameClient::LoadEmoticonsSkin(const char *pPath, bool AsDir)
4206{
4207 if(m_EmoticonsSkinLoaded)
4208 {
4209 for(auto &SpriteEmoticon : m_EmoticonsSkin.m_aSpriteEmoticons)
4210 Graphics()->UnloadTexture(&SpriteEmoticon);
4211
4212 m_EmoticonsSkinLoaded = false;
4213 }
4214
4215 char aPath[IO_MAX_PATH_LENGTH];
4216 bool IsDefault = false;
4217 if(str_comp(pPath, "default") == 0)
4218 {
4219 str_copy(aPath, g_pData->m_aImages[IMAGE_EMOTICONS].m_pFilename);
4220 IsDefault = true;
4221 }
4222 else
4223 {
4224 if(AsDir)
4225 str_format(aPath, sizeof(aPath), "assets/emoticons/%s/%s", pPath, g_pData->m_aImages[IMAGE_EMOTICONS].m_pFilename);
4226 else
4227 str_format(aPath, sizeof(aPath), "assets/emoticons/%s.png", pPath);
4228 }
4229
4230 CImageInfo ImgInfo;
4231 bool PngLoaded = Graphics()->LoadPng(ImgInfo, aPath, IStorage::TYPE_ALL);
4232 if(!PngLoaded && !IsDefault)
4233 {
4234 if(AsDir)
4235 LoadEmoticonsSkin("default");
4236 else
4237 LoadEmoticonsSkin(pPath, true);
4238 }
4239 else if(PngLoaded && Graphics()->CheckImageDivisibility(aPath, ImgInfo, g_pData->m_aSprites[SPRITE_OOP].m_pSet->m_Gridx, g_pData->m_aSprites[SPRITE_OOP].m_pSet->m_Gridy, true) && Graphics()->IsImageFormatRgba(aPath, ImgInfo))
4240 {
4241 for(int i = 0; i < 16; ++i)
4242 m_EmoticonsSkin.m_aSpriteEmoticons[i] = Graphics()->LoadSpriteTexture(ImgInfo, &g_pData->m_aSprites[SPRITE_OOP + i]);
4243
4244 m_EmoticonsSkinLoaded = true;
4245 }
4246 ImgInfo.Free();
4247}
4248
4249void CGameClient::LoadParticlesSkin(const char *pPath, bool AsDir)
4250{

Callers 3

ClearCustomItemsMethod · 0.80
RenderSettingsCustomMethod · 0.80

Calls 10

GraphicsFunction · 0.85
str_compFunction · 0.85
str_formatFunction · 0.85
UnloadTextureMethod · 0.80
IsImageFormatRgbaMethod · 0.80
LoadSpriteTextureMethod · 0.80
str_copyFunction · 0.50
LoadPngMethod · 0.45
FreeMethod · 0.45

Tested by

no test coverage detected