mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-18 22:18:19 +00:00
Merge pull request #8035 from Robyt3/Entities-Switch-Fix
Always build switch entities layers
This commit is contained in:
commit
011299d0e3
|
@ -229,14 +229,8 @@ IGraphics::CTextureHandle CMapImages::GetEntities(EMapImageEntityLayerType Entit
|
||||||
// build game layer
|
// build game layer
|
||||||
for(int n = 0; n < MAP_IMAGE_ENTITY_LAYER_TYPE_COUNT; ++n)
|
for(int n = 0; n < MAP_IMAGE_ENTITY_LAYER_TYPE_COUNT; ++n)
|
||||||
{
|
{
|
||||||
bool BuildThisLayer = true;
|
|
||||||
if(n == MAP_IMAGE_ENTITY_LAYER_TYPE_SWITCH && Layers()->SwitchLayer() == nullptr)
|
|
||||||
BuildThisLayer = false;
|
|
||||||
|
|
||||||
dbg_assert(!m_aaEntitiesTextures[(EntitiesModType * 2) + (int)EntitiesAreMasked][n].IsValid(), "entities texture already loaded when it should not be");
|
dbg_assert(!m_aaEntitiesTextures[(EntitiesModType * 2) + (int)EntitiesAreMasked][n].IsValid(), "entities texture already loaded when it should not be");
|
||||||
|
|
||||||
if(BuildThisLayer)
|
|
||||||
{
|
|
||||||
// set everything transparent
|
// set everything transparent
|
||||||
mem_zero(pBuildImgData, BuildImageSize);
|
mem_zero(pBuildImgData, BuildImageSize);
|
||||||
|
|
||||||
|
@ -290,18 +284,6 @@ IGraphics::CTextureHandle CMapImages::GetEntities(EMapImageEntityLayerType Entit
|
||||||
|
|
||||||
m_aaEntitiesTextures[(EntitiesModType * 2) + (int)EntitiesAreMasked][n] = Graphics()->LoadTextureRaw(ImgInfo.m_Width, ImgInfo.m_Height, ImgInfo.m_Format, pBuildImgData, TextureLoadFlag, aPath);
|
m_aaEntitiesTextures[(EntitiesModType * 2) + (int)EntitiesAreMasked][n] = Graphics()->LoadTextureRaw(ImgInfo.m_Width, ImgInfo.m_Height, ImgInfo.m_Format, pBuildImgData, TextureLoadFlag, aPath);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if(!m_TransparentTexture.IsValid())
|
|
||||||
{
|
|
||||||
// set everything transparent
|
|
||||||
mem_zero(pBuildImgData, BuildImageSize);
|
|
||||||
|
|
||||||
m_TransparentTexture = Graphics()->LoadTextureRaw(ImgInfo.m_Width, ImgInfo.m_Height, ImgInfo.m_Format, pBuildImgData, TextureLoadFlag, aPath);
|
|
||||||
}
|
|
||||||
m_aaEntitiesTextures[(EntitiesModType * 2) + (int)EntitiesAreMasked][n] = m_TransparentTexture;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
free(pBuildImgData);
|
free(pBuildImgData);
|
||||||
|
|
||||||
|
@ -355,7 +337,7 @@ void CMapImages::ChangeEntitiesPath(const char *pPath)
|
||||||
{
|
{
|
||||||
for(int n = 0; n < MAP_IMAGE_ENTITY_LAYER_TYPE_COUNT; ++n)
|
for(int n = 0; n < MAP_IMAGE_ENTITY_LAYER_TYPE_COUNT; ++n)
|
||||||
{
|
{
|
||||||
if(m_aaEntitiesTextures[i][n].IsValid() && m_aaEntitiesTextures[i][n].Id() != m_TransparentTexture.Id())
|
if(m_aaEntitiesTextures[i][n].IsValid())
|
||||||
{
|
{
|
||||||
Graphics()->UnloadTexture(&(m_aaEntitiesTextures[i][n]));
|
Graphics()->UnloadTexture(&(m_aaEntitiesTextures[i][n]));
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,6 @@ private:
|
||||||
IGraphics::CTextureHandle m_OverlayBottomTexture;
|
IGraphics::CTextureHandle m_OverlayBottomTexture;
|
||||||
IGraphics::CTextureHandle m_OverlayTopTexture;
|
IGraphics::CTextureHandle m_OverlayTopTexture;
|
||||||
IGraphics::CTextureHandle m_OverlayCenterTexture;
|
IGraphics::CTextureHandle m_OverlayCenterTexture;
|
||||||
IGraphics::CTextureHandle m_TransparentTexture;
|
|
||||||
int m_TextureScale;
|
int m_TextureScale;
|
||||||
|
|
||||||
void InitOverlayTextures();
|
void InitOverlayTextures();
|
||||||
|
|
Loading…
Reference in a new issue