mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Fix entities textures not being built for non-DDNet/DDRace types
The combined entities texture for all layers except the switch layer was only built when the gametype has a front, speedup, tele or tune layer, which is only the case for servers declaring DDNet or DDRace type in their gameinfo. Now this entities layer is always built, as the game layer is always present.
This commit is contained in:
parent
ab3445967d
commit
fdf427db15
|
@ -158,31 +158,6 @@ void CMapImages::LoadBackground(class CLayers *pLayers, class IMap *pMap)
|
|||
OnMapLoadImpl(pLayers, pMap);
|
||||
}
|
||||
|
||||
bool CMapImages::HasFrontLayer(EMapImageModType ModType)
|
||||
{
|
||||
return ModType == MAP_IMAGE_MOD_TYPE_DDNET || ModType == MAP_IMAGE_MOD_TYPE_DDRACE;
|
||||
}
|
||||
|
||||
bool CMapImages::HasSpeedupLayer(EMapImageModType ModType)
|
||||
{
|
||||
return ModType == MAP_IMAGE_MOD_TYPE_DDNET || ModType == MAP_IMAGE_MOD_TYPE_DDRACE;
|
||||
}
|
||||
|
||||
bool CMapImages::HasSwitchLayer(EMapImageModType ModType)
|
||||
{
|
||||
return ModType == MAP_IMAGE_MOD_TYPE_DDNET || ModType == MAP_IMAGE_MOD_TYPE_DDRACE;
|
||||
}
|
||||
|
||||
bool CMapImages::HasTeleLayer(EMapImageModType ModType)
|
||||
{
|
||||
return ModType == MAP_IMAGE_MOD_TYPE_DDNET || ModType == MAP_IMAGE_MOD_TYPE_DDRACE;
|
||||
}
|
||||
|
||||
bool CMapImages::HasTuneLayer(EMapImageModType ModType)
|
||||
{
|
||||
return ModType == MAP_IMAGE_MOD_TYPE_DDNET || ModType == MAP_IMAGE_MOD_TYPE_DDRACE;
|
||||
}
|
||||
|
||||
IGraphics::CTextureHandle CMapImages::GetEntities(EMapImageEntityLayerType EntityLayerType)
|
||||
{
|
||||
EMapImageModType EntitiesModType = MAP_IMAGE_MOD_TYPE_DDNET;
|
||||
|
@ -207,18 +182,9 @@ IGraphics::CTextureHandle CMapImages::GetEntities(EMapImageEntityLayerType Entit
|
|||
{
|
||||
m_aEntitiesIsLoaded[(EntitiesModType * 2) + (int)EntitiesAreMasked] = true;
|
||||
|
||||
// any mod that does not mask, will get all layers unmasked
|
||||
bool WasUnknown = !EntitiesAreMasked;
|
||||
|
||||
char aPath[64];
|
||||
str_format(aPath, sizeof(aPath), "%s/%s.png", m_aEntitiesPath, gs_apModEntitiesNames[EntitiesModType]);
|
||||
|
||||
bool GameTypeHasFrontLayer = HasFrontLayer(EntitiesModType) || WasUnknown;
|
||||
bool GameTypeHasSpeedupLayer = HasSpeedupLayer(EntitiesModType) || WasUnknown;
|
||||
bool GameTypeHasSwitchLayer = HasSwitchLayer(EntitiesModType) || WasUnknown;
|
||||
bool GameTypeHasTeleLayer = HasTeleLayer(EntitiesModType) || WasUnknown;
|
||||
bool GameTypeHasTuneLayer = HasTuneLayer(EntitiesModType) || WasUnknown;
|
||||
|
||||
int TextureLoadFlag = 0;
|
||||
if(Graphics()->HasTextureArraysSupport())
|
||||
TextureLoadFlag = (Graphics()->Uses2DTextureArrays() ? IGraphics::TEXLOAD_TO_2D_ARRAY_TEXTURE : IGraphics::TEXLOAD_TO_3D_TEXTURE) | IGraphics::TEXLOAD_NO_2D_TEXTURE;
|
||||
|
@ -264,10 +230,7 @@ IGraphics::CTextureHandle CMapImages::GetEntities(EMapImageEntityLayerType Entit
|
|||
for(int n = 0; n < MAP_IMAGE_ENTITY_LAYER_TYPE_COUNT; ++n)
|
||||
{
|
||||
bool BuildThisLayer = true;
|
||||
if(n == MAP_IMAGE_ENTITY_LAYER_TYPE_ALL_EXCEPT_SWITCH && !GameTypeHasFrontLayer &&
|
||||
!GameTypeHasSpeedupLayer && !GameTypeHasTeleLayer && !GameTypeHasTuneLayer)
|
||||
BuildThisLayer = false;
|
||||
else if(n == MAP_IMAGE_ENTITY_LAYER_TYPE_SWITCH && !GameTypeHasSwitchLayer)
|
||||
if(n == MAP_IMAGE_ENTITY_LAYER_TYPE_SWITCH && EntitiesModType != MAP_IMAGE_MOD_TYPE_DDNET && EntitiesModType != MAP_IMAGE_MOD_TYPE_DDRACE)
|
||||
BuildThisLayer = false;
|
||||
|
||||
dbg_assert(!m_aaEntitiesTextures[(EntitiesModType * 2) + (int)EntitiesAreMasked][n].IsValid(), "entities texture already loaded when it should not be");
|
||||
|
|
|
@ -42,12 +42,6 @@ class CMapImages : public CComponent
|
|||
|
||||
char m_aEntitiesPath[IO_MAX_PATH_LENGTH];
|
||||
|
||||
bool HasFrontLayer(EMapImageModType ModType);
|
||||
bool HasSpeedupLayer(EMapImageModType ModType);
|
||||
bool HasSwitchLayer(EMapImageModType ModType);
|
||||
bool HasTeleLayer(EMapImageModType ModType);
|
||||
bool HasTuneLayer(EMapImageModType ModType);
|
||||
|
||||
public:
|
||||
CMapImages();
|
||||
CMapImages(int TextureSize);
|
||||
|
|
Loading…
Reference in a new issue