removed no longer needed game icon parts. kept backwards compatibility loading. closes #1903

This commit is contained in:
oy 2019-01-10 21:36:18 +01:00
parent 78bbf28000
commit d1657320a9
8 changed files with 10 additions and 24 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View file

@ -235,9 +235,8 @@ private:
public:
enum
{
GAMEICON_FULL=0,
GAMEICON_ON,
GAMEICON_OFF,
GAMEICON_SIZE=64,
GAMEICON_OLDHEIGHT=192,
};
CGameIcon() {};
CGameIcon(const char *pName) : m_Name(pName) {}
@ -247,7 +246,7 @@ private:
};
array<CGameIcon> m_lGameIcons;
IGraphics::CTextureHandle m_GameIconDefault;
void DoGameIcon(const char *pName, const CUIRect *pRect, int Type);
void DoGameIcon(const char *pName, const CUIRect *pRect);
static int GameIconScan(const char *pName, int IsDir, int DirType, void *pUser);
int64 m_LastInput;

View file

@ -575,7 +575,7 @@ int CMenus::DoBrowserEntry(const void *pID, CUIRect View, const CServerInfo *pEn
CUIRect Icon;
Button.VSplitLeft(Button.h, &Icon, &Button);
Icon.y -= 0.5f;
DoGameIcon(pEntry->m_aGameType, &Icon, CGameIcon::GAMEICON_FULL);
DoGameIcon(pEntry->m_aGameType, &Icon);
// gametype text
CTextCursor Cursor;
@ -1872,7 +1872,7 @@ void CMenus::RenderDetailInfo(CUIRect View, const CServerInfo *pInfo)
CUIRect Icon;
Row.VSplitLeft(Row.h, &Icon, &Row);
Icon.y -= 2.0f;
DoGameIcon(pInfo->m_aGameType, &Icon, CGameIcon::GAMEICON_FULL);
DoGameIcon(pInfo->m_aGameType, &Icon);
UI()->DoLabelScaled(&Row, pInfo->m_aGameType, FontSize, CUI::ALIGN_LEFT, Row.w, false);
// version
@ -2129,7 +2129,7 @@ void CMenus::RenderServerbrowserBottomBox(CUIRect MainView)
m_EnterPressed = false;
}
}
void CMenus::DoGameIcon(const char *pName, const CUIRect *pRect, int Type)
void CMenus::DoGameIcon(const char *pName, const CUIRect *pRect)
{
char aNameBuf[128];
str_copy(aNameBuf, pName, sizeof(aNameBuf));
@ -2145,23 +2145,10 @@ void CMenus::DoGameIcon(const char *pName, const CUIRect *pRect, int Type)
break;
}
}
Graphics()->TextureSet(Tex);
Graphics()->QuadsBegin();
// select sprite
switch(Type)
{
case CGameIcon::GAMEICON_FULL:
Graphics()->QuadsSetSubset(0.0f, 0.0f, 1.0f, 1.0f/3.0f);
break;
case CGameIcon::GAMEICON_ON:
Graphics()->QuadsSetSubset(0.0f, 1.0f/3.0f, 1.0f, 2.0f/3.0f);
break;
default: // GAMEICON_OFF
Graphics()->QuadsSetSubset(0.0f, 2.0f/3.0f, 1.0f, 1.0f);
}
// draw icon
Graphics()->TextureSet(Tex);
Graphics()->QuadsBegin();
IGraphics::CQuadItem QuadItem(pRect->x, pRect->y, pRect->w, pRect->h);
Graphics()->QuadsDrawTL(&QuadItem, 1);
Graphics()->QuadsEnd();
@ -2182,7 +2169,7 @@ int CMenus::GameIconScan(const char *pName, int IsDir, int DirType, void *pUser)
char aBuf[512];
str_format(aBuf, sizeof(aBuf), "ui/gametypes/%s", pName);
CImageInfo Info;
if(!pSelf->Graphics()->LoadPNG(&Info, aBuf, DirType))
if(!pSelf->Graphics()->LoadPNG(&Info, aBuf, DirType) || Info.m_Width != CGameIcon::GAMEICON_SIZE || (Info.m_Height != CGameIcon::GAMEICON_SIZE && Info.m_Height != CGameIcon::GAMEICON_OLDHEIGHT))
{
str_format(aBuf, sizeof(aBuf), "failed to load gametype icon '%s'", aGameIconName);
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "game", aBuf);
@ -2192,7 +2179,7 @@ int CMenus::GameIconScan(const char *pName, int IsDir, int DirType, void *pUser)
str_format(aBuf, sizeof(aBuf), "loaded gametype icon '%s'", aGameIconName);
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "game", aBuf);
GameIcon.m_IconTexture = pSelf->Graphics()->LoadTextureRaw(Info.m_Width, Info.m_Height, Info.m_Format, Info.m_pData, Info.m_Format, IGraphics::TEXLOAD_LINEARMIPMAPS);
GameIcon.m_IconTexture = pSelf->Graphics()->LoadTextureRaw(CGameIcon::GAMEICON_SIZE, CGameIcon::GAMEICON_SIZE, Info.m_Format, Info.m_pData, Info.m_Format, IGraphics::TEXLOAD_LINEARMIPMAPS);
pSelf->m_lGameIcons.add(GameIcon);
if(!str_comp_nocase(aGameIconName, "mod"))
pSelf->m_GameIconDefault = GameIcon.m_IconTexture;