2010-11-20 10:37:14 +00:00
|
|
|
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
|
|
|
|
/* If you are missing that file, acquire a complete release at teeworlds.com. */
|
2010-05-29 07:25:38 +00:00
|
|
|
#ifndef GAME_CLIENT_COMPONENTS_SKINS_H
|
|
|
|
#define GAME_CLIENT_COMPONENTS_SKINS_H
|
2019-04-26 12:06:32 +00:00
|
|
|
#include <base/color.h>
|
2010-09-24 11:21:03 +00:00
|
|
|
#include <base/tl/sorted_array.h>
|
2020-09-20 00:19:32 +00:00
|
|
|
#include <base/vmath.h>
|
2020-09-20 00:19:24 +00:00
|
|
|
#include <engine/client/http.h>
|
2010-05-29 07:25:38 +00:00
|
|
|
#include <game/client/component.h>
|
|
|
|
|
|
|
|
class CSkins : public CComponent
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// do this better and nicer
|
|
|
|
struct CSkin
|
|
|
|
{
|
2018-07-25 21:36:52 +00:00
|
|
|
bool m_IsVanilla;
|
2012-08-12 10:41:50 +00:00
|
|
|
IGraphics::CTextureHandle m_OrgTexture;
|
|
|
|
IGraphics::CTextureHandle m_ColorTexture;
|
2010-09-24 11:21:03 +00:00
|
|
|
char m_aName[24];
|
2019-04-26 12:06:32 +00:00
|
|
|
ColorRGBA m_BloodColor;
|
2010-09-24 11:21:03 +00:00
|
|
|
|
2020-10-08 05:28:53 +00:00
|
|
|
bool operator<(const CSkin &Other) const { return str_comp(m_aName, Other.m_aName) < 0; }
|
2020-09-04 14:40:35 +00:00
|
|
|
|
2020-10-08 05:28:53 +00:00
|
|
|
bool operator<(const char *pOther) const { return str_comp(m_aName, pOther) < 0; }
|
|
|
|
bool operator==(const char *pOther) const { return !str_comp(m_aName, pOther); }
|
2010-09-18 18:48:49 +00:00
|
|
|
};
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2020-09-18 21:06:35 +00:00
|
|
|
struct CDownloadSkin
|
2020-09-20 00:19:24 +00:00
|
|
|
{
|
|
|
|
std::shared_ptr<CGetFile> m_pTask;
|
|
|
|
char m_aPath[MAX_PATH_LENGTH];
|
2020-09-18 21:06:35 +00:00
|
|
|
char m_aName[24];
|
|
|
|
|
2020-10-08 05:28:53 +00:00
|
|
|
bool operator<(const CDownloadSkin &Other) const { return str_comp(m_aName, Other.m_aName) < 0; }
|
|
|
|
bool operator<(const char *pOther) const { return str_comp(m_aName, pOther) < 0; }
|
|
|
|
bool operator==(const char *pOther) const { return !str_comp(m_aName, pOther); }
|
2020-09-20 00:19:24 +00:00
|
|
|
};
|
|
|
|
|
2011-02-13 12:58:59 +00:00
|
|
|
void OnInit();
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2020-10-06 14:00:18 +00:00
|
|
|
void Refresh();
|
2010-05-29 07:25:38 +00:00
|
|
|
int Num();
|
|
|
|
const CSkin *Get(int Index);
|
2020-09-04 14:40:35 +00:00
|
|
|
int Find(const char *pName);
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
private:
|
2010-09-24 11:21:03 +00:00
|
|
|
sorted_array<CSkin> m_aSkins;
|
2020-09-20 00:19:24 +00:00
|
|
|
sorted_array<CDownloadSkin> m_aDownloadSkins;
|
2020-09-20 00:19:02 +00:00
|
|
|
char m_EventSkinPrefix[24];
|
2010-05-29 07:25:38 +00:00
|
|
|
|
2020-09-20 00:19:24 +00:00
|
|
|
int LoadSkin(const char *pName, const char *pPath, int DirType);
|
2020-09-04 14:40:35 +00:00
|
|
|
int FindImpl(const char *pName);
|
2011-02-21 10:23:30 +00:00
|
|
|
static int SkinScan(const char *pName, int IsDir, int DirType, void *pUser);
|
2010-05-29 07:25:38 +00:00
|
|
|
};
|
|
|
|
#endif
|