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_MAPIMAGES_H
|
|
|
|
#define GAME_CLIENT_COMPONENTS_MAPIMAGES_H
|
|
|
|
#include <game/client/component.h>
|
|
|
|
|
2020-09-08 13:11:32 +00:00
|
|
|
enum EMapImageEntityLayerType
|
|
|
|
{
|
|
|
|
MAP_IMAGE_ENTITY_LAYER_TYPE_GAME = 0,
|
|
|
|
MAP_IMAGE_ENTITY_LAYER_TYPE_FRONT,
|
|
|
|
MAP_IMAGE_ENTITY_LAYER_TYPE_SPEEDUP,
|
|
|
|
MAP_IMAGE_ENTITY_LAYER_TYPE_SWITCH,
|
|
|
|
MAP_IMAGE_ENTITY_LAYER_TYPE_TELE,
|
|
|
|
MAP_IMAGE_ENTITY_LAYER_TYPE_TUNE,
|
|
|
|
|
|
|
|
MAP_IMAGE_ENTITY_LAYER_TYPE_COUNT,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum EMapImageModType
|
|
|
|
{
|
2020-09-19 12:43:47 +00:00
|
|
|
MAP_IMAGE_MOD_TYPE_DDNET = 0,
|
2020-09-08 13:11:32 +00:00
|
|
|
MAP_IMAGE_MOD_TYPE_DDRACE,
|
|
|
|
MAP_IMAGE_MOD_TYPE_RACE,
|
|
|
|
MAP_IMAGE_MOD_TYPE_BLOCKWORLDS,
|
|
|
|
MAP_IMAGE_MOD_TYPE_FNG,
|
|
|
|
MAP_IMAGE_MOD_TYPE_VANILLA,
|
|
|
|
|
|
|
|
MAP_IMAGE_MOD_TYPE_COUNT,
|
|
|
|
};
|
|
|
|
|
2020-09-26 07:37:35 +00:00
|
|
|
static const char *const gs_aModEntitiesNames[] = {
|
|
|
|
"ddnet",
|
|
|
|
"ddrace",
|
|
|
|
"race",
|
|
|
|
"blockworlds",
|
|
|
|
"fng",
|
|
|
|
"vanilla"};
|
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
class CMapImages : public CComponent
|
2011-04-13 18:37:12 +00:00
|
|
|
{
|
2015-08-25 00:11:04 +00:00
|
|
|
friend class CBackground;
|
2020-09-18 16:45:42 +00:00
|
|
|
friend class CMenuBackground;
|
2017-02-21 16:10:08 +00:00
|
|
|
|
2012-08-12 10:41:50 +00:00
|
|
|
IGraphics::CTextureHandle m_aTextures[64];
|
2020-08-29 10:10:38 +00:00
|
|
|
int m_aTextureUsedByTileOrQuadLayerFlag[64]; // 0: nothing, 1(as flag): tile layer, 2(as flag): quad layer
|
2010-05-29 07:25:38 +00:00
|
|
|
int m_Count;
|
2016-04-29 16:17:06 +00:00
|
|
|
|
2020-09-26 07:37:35 +00:00
|
|
|
char m_aEntitiesPath[MAX_PATH_LENGTH];
|
|
|
|
|
2020-09-22 00:01:22 +00:00
|
|
|
bool HasFrontLayer(EMapImageModType ModType);
|
|
|
|
bool HasSpeedupLayer(EMapImageModType ModType);
|
|
|
|
bool HasSwitchLayer(EMapImageModType ModType);
|
|
|
|
bool HasTeleLayer(EMapImageModType ModType);
|
|
|
|
bool HasTuneLayer(EMapImageModType ModType);
|
2020-09-10 22:42:42 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
public:
|
|
|
|
CMapImages();
|
2019-05-06 12:19:10 +00:00
|
|
|
CMapImages(int ImageSize);
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2012-08-12 10:41:50 +00:00
|
|
|
IGraphics::CTextureHandle Get(int Index) const { return m_aTextures[Index]; }
|
2010-05-29 07:25:38 +00:00
|
|
|
int Num() const { return m_Count; }
|
|
|
|
|
2020-08-29 10:10:38 +00:00
|
|
|
void OnMapLoadImpl(class CLayers *pLayers, class IMap *pMap);
|
2010-05-29 07:25:38 +00:00
|
|
|
virtual void OnMapLoad();
|
2017-09-12 18:15:37 +00:00
|
|
|
virtual void OnInit();
|
2020-08-29 10:10:38 +00:00
|
|
|
void LoadBackground(class CLayers *pLayers, class IMap *pMap);
|
2011-03-16 12:48:16 +00:00
|
|
|
|
2011-04-09 06:41:31 +00:00
|
|
|
// DDRace
|
2020-09-08 13:11:32 +00:00
|
|
|
IGraphics::CTextureHandle GetEntities(EMapImageEntityLayerType EntityLayerType);
|
2020-08-29 10:10:38 +00:00
|
|
|
IGraphics::CTextureHandle GetSpeedupArrow();
|
2020-09-10 22:42:42 +00:00
|
|
|
|
2012-08-12 10:41:50 +00:00
|
|
|
IGraphics::CTextureHandle GetOverlayBottom();
|
|
|
|
IGraphics::CTextureHandle GetOverlayTop();
|
|
|
|
IGraphics::CTextureHandle GetOverlayCenter();
|
2011-04-09 06:41:31 +00:00
|
|
|
|
2019-05-06 12:19:10 +00:00
|
|
|
void SetTextureScale(int Size);
|
|
|
|
int GetTextureScale();
|
|
|
|
|
2020-09-26 07:37:35 +00:00
|
|
|
void ChangeEntitiesPath(const char *pPath);
|
|
|
|
|
2011-03-16 12:48:16 +00:00
|
|
|
private:
|
2020-09-19 12:43:47 +00:00
|
|
|
bool m_EntitiesIsLoaded[MAP_IMAGE_MOD_TYPE_COUNT * 2];
|
2020-08-29 10:10:38 +00:00
|
|
|
bool m_SpeedupArrowIsLoaded;
|
2020-09-19 12:43:47 +00:00
|
|
|
IGraphics::CTextureHandle m_EntitiesTextures[MAP_IMAGE_MOD_TYPE_COUNT * 2][MAP_IMAGE_ENTITY_LAYER_TYPE_COUNT];
|
2020-08-29 10:10:38 +00:00
|
|
|
IGraphics::CTextureHandle m_SpeedupArrowTexture;
|
2012-08-12 10:41:50 +00:00
|
|
|
IGraphics::CTextureHandle m_OverlayBottomTexture;
|
|
|
|
IGraphics::CTextureHandle m_OverlayTopTexture;
|
|
|
|
IGraphics::CTextureHandle m_OverlayCenterTexture;
|
2020-09-08 13:11:32 +00:00
|
|
|
IGraphics::CTextureHandle m_TransparentTexture;
|
2019-05-06 12:19:10 +00:00
|
|
|
int m_TextureScale;
|
2020-09-10 22:42:42 +00:00
|
|
|
|
2019-05-06 12:19:10 +00:00
|
|
|
void InitOverlayTextures();
|
2020-08-29 10:10:38 +00:00
|
|
|
IGraphics::CTextureHandle UploadEntityLayerText(int TextureSize, int MaxWidth, int YOffset);
|
2020-09-26 19:41:58 +00:00
|
|
|
void UpdateEntityLayerText(void *pTexBuffer, int ImageColorChannelCount, int TexWidth, int TexHeight, int TextureSize, int MaxWidth, int YOffset, int NumbersPower, int MaxNumber = -1);
|
2010-05-29 07:25:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|