mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Fix rendering of layers with cl_show_entities and crashes
This commit is contained in:
parent
90fa601a2f
commit
9d64525e5d
|
@ -244,6 +244,10 @@ void CMapLayers::OnRender()
|
|||
Graphics()->TextureSet(m_pClient->m_pMapimages->Get(pTMap->m_Image));
|
||||
|
||||
CTile *pTiles = (CTile *)m_pLayers->Map()->GetData(pTMap->m_Data);
|
||||
unsigned int Size = m_pLayers->Map()->GetUncompressedDataSize(pTMap->m_Data);
|
||||
|
||||
if (Size >= pTMap->m_Width*pTMap->m_Height*sizeof(CTile))
|
||||
{
|
||||
Graphics()->BlendNone();
|
||||
vec4 Color = vec4(pTMap->m_Color.r/255.0f, pTMap->m_Color.g/255.0f, pTMap->m_Color.b/255.0f, pTMap->m_Color.a/255.0f);
|
||||
RenderTools()->RenderTilemap(pTiles, pTMap->m_Width, pTMap->m_Height, 32.0f, Color, TILERENDERFLAG_EXTEND|LAYERRENDERFLAG_OPAQUE,
|
||||
|
@ -252,6 +256,7 @@ void CMapLayers::OnRender()
|
|||
RenderTools()->RenderTilemap(pTiles, pTMap->m_Width, pTMap->m_Height, 32.0f, Color, TILERENDERFLAG_EXTEND|LAYERRENDERFLAG_TRANSPARENT,
|
||||
EnvelopeEval, this, pTMap->m_ColorEnv, pTMap->m_ColorEnvOffset);
|
||||
}
|
||||
}
|
||||
else if(pLayer->m_Type == LAYERTYPE_QUADS)
|
||||
{
|
||||
CMapItemLayerQuads *pQLayer = (CMapItemLayerQuads *)pLayer;
|
||||
|
@ -276,6 +281,10 @@ void CMapLayers::OnRender()
|
|||
Graphics()->TextureSet(m_pClient->m_pMapimages->GetEntities());
|
||||
|
||||
CTile *pFrontTiles = (CTile *)m_pLayers->Map()->GetData(pTMap->m_Front);
|
||||
unsigned int Size = m_pLayers->Map()->GetUncompressedDataSize(pTMap->m_Front);
|
||||
|
||||
if (Size >= pTMap->m_Width*pTMap->m_Height*sizeof(CTile))
|
||||
{
|
||||
Graphics()->BlendNone();
|
||||
vec4 Color = vec4(pTMap->m_Color.r/255.0f, pTMap->m_Color.g/255.0f, pTMap->m_Color.b/255.0f, pTMap->m_Color.a/255.0f);
|
||||
RenderTools()->RenderTilemap(pFrontTiles, pTMap->m_Width, pTMap->m_Height, 32.0f, Color, TILERENDERFLAG_EXTEND|LAYERRENDERFLAG_OPAQUE,
|
||||
|
@ -284,12 +293,17 @@ void CMapLayers::OnRender()
|
|||
RenderTools()->RenderTilemap(pFrontTiles, pTMap->m_Width, pTMap->m_Height, 32.0f, Color, TILERENDERFLAG_EXTEND|LAYERRENDERFLAG_TRANSPARENT,
|
||||
EnvelopeEval, this, pTMap->m_ColorEnv, pTMap->m_ColorEnvOffset);
|
||||
}
|
||||
}
|
||||
else if(g_Config.m_ClShowEntities && IsSwitchLayer)
|
||||
{
|
||||
CMapItemLayerTilemap *pTMap = (CMapItemLayerTilemap *)pLayer;
|
||||
Graphics()->TextureSet(m_pClient->m_pMapimages->GetEntities());
|
||||
|
||||
CSwitchTile *pSwitchTiles = (CSwitchTile *)m_pLayers->Map()->GetData(pTMap->m_Switch);
|
||||
unsigned int Size = m_pLayers->Map()->GetUncompressedDataSize(pTMap->m_Switch);
|
||||
|
||||
if (Size >= pTMap->m_Width*pTMap->m_Height*sizeof(CSwitchTile))
|
||||
{
|
||||
Graphics()->BlendNone();
|
||||
vec4 Color = vec4(pTMap->m_Color.r/255.0f, pTMap->m_Color.g/255.0f, pTMap->m_Color.b/255.0f, pTMap->m_Color.a/255.0f);
|
||||
RenderTools()->RenderSwitchmap(pSwitchTiles, pTMap->m_Width, pTMap->m_Height, 32.0f, Color, TILERENDERFLAG_EXTEND|LAYERRENDERFLAG_OPAQUE);
|
||||
|
@ -297,12 +311,17 @@ void CMapLayers::OnRender()
|
|||
RenderTools()->RenderSwitchmap(pSwitchTiles, pTMap->m_Width, pTMap->m_Height, 32.0f, Color, TILERENDERFLAG_EXTEND|LAYERRENDERFLAG_TRANSPARENT);
|
||||
RenderTools()->RenderSwitchOverlay(pSwitchTiles, pTMap->m_Width, pTMap->m_Height, 32.0f);
|
||||
}
|
||||
}
|
||||
else if(g_Config.m_ClShowEntities && IsTeleLayer)
|
||||
{
|
||||
CMapItemLayerTilemap *pTMap = (CMapItemLayerTilemap *)pLayer;
|
||||
Graphics()->TextureSet(m_pClient->m_pMapimages->GetEntities());
|
||||
|
||||
CTeleTile *pTeleTiles = (CTeleTile *)m_pLayers->Map()->GetData(pTMap->m_Tele);
|
||||
unsigned int Size = m_pLayers->Map()->GetUncompressedDataSize(pTMap->m_Tele);
|
||||
|
||||
if (Size >= pTMap->m_Width*pTMap->m_Height*sizeof(CTeleTile))
|
||||
{
|
||||
Graphics()->BlendNone();
|
||||
vec4 Color = vec4(pTMap->m_Color.r/255.0f, pTMap->m_Color.g/255.0f, pTMap->m_Color.b/255.0f, pTMap->m_Color.a/255.0f);
|
||||
RenderTools()->RenderTelemap(pTeleTiles, pTMap->m_Width, pTMap->m_Height, 32.0f, Color, TILERENDERFLAG_EXTEND|LAYERRENDERFLAG_OPAQUE);
|
||||
|
@ -310,12 +329,17 @@ void CMapLayers::OnRender()
|
|||
RenderTools()->RenderTelemap(pTeleTiles, pTMap->m_Width, pTMap->m_Height, 32.0f, Color, TILERENDERFLAG_EXTEND|LAYERRENDERFLAG_TRANSPARENT);
|
||||
RenderTools()->RenderTeleOverlay(pTeleTiles, pTMap->m_Width, pTMap->m_Height, 32.0f);
|
||||
}
|
||||
}
|
||||
else if(g_Config.m_ClShowEntities && IsSpeedupLayer)
|
||||
{
|
||||
CMapItemLayerTilemap *pTMap = (CMapItemLayerTilemap *)pLayer;
|
||||
Graphics()->TextureSet(m_pClient->m_pMapimages->GetEntities());
|
||||
|
||||
CSpeedupTile *pSpeedupTiles = (CSpeedupTile *)m_pLayers->Map()->GetData(pTMap->m_Speedup);
|
||||
unsigned int Size = m_pLayers->Map()->GetUncompressedDataSize(pTMap->m_Speedup);
|
||||
|
||||
if (Size >= pTMap->m_Width*pTMap->m_Height*sizeof(CSpeedupTile))
|
||||
{
|
||||
Graphics()->BlendNone();
|
||||
vec4 Color = vec4(pTMap->m_Color.r/255.0f, pTMap->m_Color.g/255.0f, pTMap->m_Color.b/255.0f, pTMap->m_Color.a/255.0f);
|
||||
RenderTools()->RenderSpeedupmap(pSpeedupTiles, pTMap->m_Width, pTMap->m_Height, 32.0f, Color, TILERENDERFLAG_EXTEND|LAYERRENDERFLAG_OPAQUE);
|
||||
|
@ -324,6 +348,7 @@ void CMapLayers::OnRender()
|
|||
RenderTools()->RenderSpeedupOverlay(pSpeedupTiles, pTMap->m_Width, pTMap->m_Height, 32.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!g_Config.m_GfxNoclip)
|
||||
Graphics()->ClipDisable();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue