mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
added entities clear for other gametypes
This commit is contained in:
parent
e0e7f20196
commit
4a22e762ff
Binary file not shown.
Before Width: | Height: | Size: 242 KiB |
BIN
data/editor/entities_clear/ddnet.png
Normal file
BIN
data/editor/entities_clear/ddnet.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 294 KiB |
BIN
data/editor/entities_clear/ddrace.png
Normal file
BIN
data/editor/entities_clear/ddrace.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 237 KiB |
BIN
data/editor/entities_clear/fng.png
Normal file
BIN
data/editor/entities_clear/fng.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 72 KiB |
BIN
data/editor/entities_clear/race.png
Normal file
BIN
data/editor/entities_clear/race.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 97 KiB |
BIN
data/editor/entities_clear/vanilla.png
Normal file
BIN
data/editor/entities_clear/vanilla.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 63 KiB |
|
@ -51,9 +51,14 @@ public:
|
|||
CClient m_aClients[MAX_CLIENTS];
|
||||
};
|
||||
|
||||
bool IsVanilla(const CServerInfo *pInfo);
|
||||
bool IsCatch(const CServerInfo *pInfo);
|
||||
bool IsInsta(const CServerInfo *pInfo);
|
||||
bool IsFNG(const CServerInfo *pInfo);
|
||||
bool IsRace(const CServerInfo *pInfo);
|
||||
bool IsDDRace(const CServerInfo *pInfo);
|
||||
bool IsDDNet(const CServerInfo *pInfo);
|
||||
|
||||
bool Is64Player(const CServerInfo *pInfo);
|
||||
bool IsPlus(const CServerInfo *pInfo);
|
||||
|
||||
|
|
|
@ -1,6 +1,32 @@
|
|||
#include <engine/serverbrowser.h>
|
||||
#include <base/system.h>
|
||||
|
||||
// gametypes
|
||||
|
||||
bool IsVanilla(const CServerInfo *pInfo)
|
||||
{
|
||||
return !str_comp(pInfo->m_aGameType, "DM")
|
||||
|| !str_comp(pInfo->m_aGameType, "TDM")
|
||||
|| !str_comp(pInfo->m_aGameType, "CTF");
|
||||
}
|
||||
|
||||
bool IsCatch(const CServerInfo *pInfo)
|
||||
{
|
||||
return str_find_nocase(pInfo->m_aGameType, "catch");
|
||||
}
|
||||
|
||||
bool IsInsta(const CServerInfo *pInfo)
|
||||
{
|
||||
return str_find_nocase(pInfo->m_aGameType, "idm")
|
||||
|| str_find_nocase(pInfo->m_aGameType, "itdm")
|
||||
|| str_find_nocase(pInfo->m_aGameType, "ictf");
|
||||
}
|
||||
|
||||
bool IsFNG(const CServerInfo *pInfo)
|
||||
{
|
||||
return str_find_nocase(pInfo->m_aGameType, "fng");
|
||||
}
|
||||
|
||||
bool IsRace(const CServerInfo *pInfo)
|
||||
{
|
||||
return str_find_nocase(pInfo->m_aGameType, "race")
|
||||
|
@ -19,6 +45,8 @@ bool IsDDNet(const CServerInfo *pInfo)
|
|||
|| str_find_nocase(pInfo->m_aGameType, "ddnet");
|
||||
}
|
||||
|
||||
// other
|
||||
|
||||
bool Is64Player(const CServerInfo *pInfo)
|
||||
{
|
||||
return str_find(pInfo->m_aGameType, "64")
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include <engine/graphics.h>
|
||||
#include <engine/map.h>
|
||||
#include <engine/storage.h>
|
||||
#include <engine/serverbrowser.h>
|
||||
#include <game/client/component.h>
|
||||
#include <game/mapitems.h>
|
||||
|
||||
|
@ -88,11 +89,26 @@ void CMapImages::LoadBackground(class IMap *pMap)
|
|||
|
||||
int CMapImages::GetEntities()
|
||||
{
|
||||
if(m_EntitiesTextures == -1)
|
||||
CServerInfo Info;
|
||||
Client()->GetServerInfo(&Info);
|
||||
|
||||
if(m_EntitiesTextures == -1 || str_comp(m_aEntitiesGameType, Info.m_aGameType))
|
||||
{
|
||||
m_EntitiesTextures = Graphics()->LoadTexture("editor/entities_clear.png", IStorage::TYPE_ALL, CImageInfo::FORMAT_AUTO, 0);
|
||||
if(m_EntitiesTextures == -1)
|
||||
m_EntitiesTextures = Graphics()->LoadTexture("editor/entities.png", IStorage::TYPE_ALL, CImageInfo::FORMAT_AUTO, 0);
|
||||
char file[64] = "vanilla";
|
||||
if(IsDDNet(&Info))
|
||||
str_copy(file, "ddnet", sizeof(file));
|
||||
else if(IsDDRace(&Info))
|
||||
str_copy(file, "ddrace", sizeof(file));
|
||||
else if(IsRace(&Info))
|
||||
str_copy(file, "race", sizeof(file));
|
||||
else if(IsFNG(&Info))
|
||||
str_copy(file, "fng", sizeof(file));
|
||||
|
||||
char path[64];
|
||||
str_format(path, sizeof(path), "editor/entities_clear/%s.png", file);
|
||||
m_EntitiesTextures = Graphics()->LoadTexture(path, IStorage::TYPE_ALL, CImageInfo::FORMAT_AUTO, 0);
|
||||
|
||||
str_copy(m_aEntitiesGameType, Info.m_aGameType, sizeof(m_aEntitiesGameType));
|
||||
}
|
||||
return m_EntitiesTextures;
|
||||
}
|
||||
|
|
|
@ -10,6 +10,8 @@ class CMapImages : public CComponent
|
|||
|
||||
int m_aTextures[64];
|
||||
int m_Count;
|
||||
|
||||
char m_aEntitiesGameType[16];
|
||||
public:
|
||||
CMapImages();
|
||||
|
||||
|
|
|
@ -432,24 +432,20 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
|
|||
{
|
||||
vec3 hsl = vec3(1.0f, 1.0f, 1.0f);
|
||||
|
||||
if (!str_comp(pItem->m_aGameType, "DM")
|
||||
|| !str_comp(pItem->m_aGameType, "TDM")
|
||||
|| !str_comp(pItem->m_aGameType, "CTF"))
|
||||
hsl = vec3(0.33f, 1.0f, 0.75f); // Vanilla
|
||||
else if (str_find_nocase(pItem->m_aGameType, "catch"))
|
||||
hsl = vec3(0.17f, 1.0f, 0.75f); // Catch
|
||||
else if (str_find_nocase(pItem->m_aGameType, "idm")
|
||||
|| str_find_nocase(pItem->m_aGameType, "itdm")
|
||||
|| str_find_nocase(pItem->m_aGameType, "ictf"))
|
||||
hsl = vec3(0.00f, 1.0f, 0.75f); // Instagib
|
||||
else if (str_find_nocase(pItem->m_aGameType, "fng"))
|
||||
hsl = vec3(0.83f, 1.0f, 0.75f); // FNG
|
||||
if (IsVanilla(pItem))
|
||||
hsl = vec3(0.33f, 1.0f, 0.75f);
|
||||
else if (IsCatch(pItem))
|
||||
hsl = vec3(0.17f, 1.0f, 0.75f);
|
||||
else if (IsInsta(pItem))
|
||||
hsl = vec3(0.00f, 1.0f, 0.75f);
|
||||
else if (IsFNG(pItem))
|
||||
hsl = vec3(0.83f, 1.0f, 0.75f);
|
||||
else if (IsDDNet(pItem))
|
||||
hsl = vec3(0.58f, 1.0f, 0.75f); // DDNet
|
||||
hsl = vec3(0.58f, 1.0f, 0.75f);
|
||||
else if (IsDDRace(pItem))
|
||||
hsl = vec3(0.75f, 1.0f, 0.75f); // DDRace
|
||||
hsl = vec3(0.75f, 1.0f, 0.75f);
|
||||
else if (IsRace(pItem))
|
||||
hsl = vec3(0.46f, 1.0f, 0.75f); // Race
|
||||
hsl = vec3(0.46f, 1.0f, 0.75f);
|
||||
|
||||
vec3 rgb = HslToRgb(hsl);
|
||||
TextRender()->TextColor(rgb.r, rgb.g, rgb.b, 1.0f);
|
||||
|
|
Loading…
Reference in a new issue