ddnet/src/game/client/components/mapimages.h

98 lines
3 KiB
C
Raw Normal View History

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
{
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
IGraphics::CTextureHandle m_aTextures[64];
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;
2020-09-26 07:37:35 +00:00
char m_aEntitiesPath[MAX_PATH_LENGTH];
bool HasFrontLayer(EMapImageModType ModType);
bool HasSpeedupLayer(EMapImageModType ModType);
bool HasSwitchLayer(EMapImageModType ModType);
bool HasTeleLayer(EMapImageModType ModType);
bool HasTuneLayer(EMapImageModType ModType);
2010-05-29 07:25:38 +00:00
public:
CMapImages();
CMapImages(int ImageSize);
IGraphics::CTextureHandle Get(int Index) const { return m_aTextures[Index]; }
2010-05-29 07:25:38 +00:00
int Num() const { return m_Count; }
void OnMapLoadImpl(class CLayers *pLayers, class IMap *pMap);
2010-05-29 07:25:38 +00:00
virtual void OnMapLoad();
virtual void OnInit();
void LoadBackground(class CLayers *pLayers, class IMap *pMap);
2011-03-16 12:48:16 +00:00
// DDRace
2020-09-08 13:11:32 +00:00
IGraphics::CTextureHandle GetEntities(EMapImageEntityLayerType EntityLayerType);
IGraphics::CTextureHandle GetSpeedupArrow();
IGraphics::CTextureHandle GetOverlayBottom();
IGraphics::CTextureHandle GetOverlayTop();
IGraphics::CTextureHandle GetOverlayCenter();
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];
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];
IGraphics::CTextureHandle m_SpeedupArrowTexture;
IGraphics::CTextureHandle m_OverlayBottomTexture;
IGraphics::CTextureHandle m_OverlayTopTexture;
IGraphics::CTextureHandle m_OverlayCenterTexture;
2020-09-08 13:11:32 +00:00
IGraphics::CTextureHandle m_TransparentTexture;
int m_TextureScale;
void InitOverlayTextures();
IGraphics::CTextureHandle UploadEntityLayerText(int TextureSize, int MaxWidth, int YOffset);
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