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,13 +244,18 @@ void CMapLayers::OnRender()
|
||||||
Graphics()->TextureSet(m_pClient->m_pMapimages->Get(pTMap->m_Image));
|
Graphics()->TextureSet(m_pClient->m_pMapimages->Get(pTMap->m_Image));
|
||||||
|
|
||||||
CTile *pTiles = (CTile *)m_pLayers->Map()->GetData(pTMap->m_Data);
|
CTile *pTiles = (CTile *)m_pLayers->Map()->GetData(pTMap->m_Data);
|
||||||
Graphics()->BlendNone();
|
unsigned int Size = m_pLayers->Map()->GetUncompressedDataSize(pTMap->m_Data);
|
||||||
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,
|
if (Size >= pTMap->m_Width*pTMap->m_Height*sizeof(CTile))
|
||||||
EnvelopeEval, this, pTMap->m_ColorEnv, pTMap->m_ColorEnvOffset);
|
{
|
||||||
Graphics()->BlendNormal();
|
Graphics()->BlendNone();
|
||||||
RenderTools()->RenderTilemap(pTiles, pTMap->m_Width, pTMap->m_Height, 32.0f, Color, TILERENDERFLAG_EXTEND|LAYERRENDERFLAG_TRANSPARENT,
|
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);
|
||||||
EnvelopeEval, this, pTMap->m_ColorEnv, pTMap->m_ColorEnvOffset);
|
RenderTools()->RenderTilemap(pTiles, pTMap->m_Width, pTMap->m_Height, 32.0f, Color, TILERENDERFLAG_EXTEND|LAYERRENDERFLAG_OPAQUE,
|
||||||
|
EnvelopeEval, this, pTMap->m_ColorEnv, pTMap->m_ColorEnvOffset);
|
||||||
|
Graphics()->BlendNormal();
|
||||||
|
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)
|
else if(pLayer->m_Type == LAYERTYPE_QUADS)
|
||||||
{
|
{
|
||||||
|
@ -276,13 +281,18 @@ void CMapLayers::OnRender()
|
||||||
Graphics()->TextureSet(m_pClient->m_pMapimages->GetEntities());
|
Graphics()->TextureSet(m_pClient->m_pMapimages->GetEntities());
|
||||||
|
|
||||||
CTile *pFrontTiles = (CTile *)m_pLayers->Map()->GetData(pTMap->m_Front);
|
CTile *pFrontTiles = (CTile *)m_pLayers->Map()->GetData(pTMap->m_Front);
|
||||||
Graphics()->BlendNone();
|
unsigned int Size = m_pLayers->Map()->GetUncompressedDataSize(pTMap->m_Front);
|
||||||
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,
|
if (Size >= pTMap->m_Width*pTMap->m_Height*sizeof(CTile))
|
||||||
EnvelopeEval, this, pTMap->m_ColorEnv, pTMap->m_ColorEnvOffset);
|
{
|
||||||
Graphics()->BlendNormal();
|
Graphics()->BlendNone();
|
||||||
RenderTools()->RenderTilemap(pFrontTiles, pTMap->m_Width, pTMap->m_Height, 32.0f, Color, TILERENDERFLAG_EXTEND|LAYERRENDERFLAG_TRANSPARENT,
|
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);
|
||||||
EnvelopeEval, this, pTMap->m_ColorEnv, pTMap->m_ColorEnvOffset);
|
RenderTools()->RenderTilemap(pFrontTiles, pTMap->m_Width, pTMap->m_Height, 32.0f, Color, TILERENDERFLAG_EXTEND|LAYERRENDERFLAG_OPAQUE,
|
||||||
|
EnvelopeEval, this, pTMap->m_ColorEnv, pTMap->m_ColorEnvOffset);
|
||||||
|
Graphics()->BlendNormal();
|
||||||
|
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)
|
else if(g_Config.m_ClShowEntities && IsSwitchLayer)
|
||||||
{
|
{
|
||||||
|
@ -290,12 +300,17 @@ void CMapLayers::OnRender()
|
||||||
Graphics()->TextureSet(m_pClient->m_pMapimages->GetEntities());
|
Graphics()->TextureSet(m_pClient->m_pMapimages->GetEntities());
|
||||||
|
|
||||||
CSwitchTile *pSwitchTiles = (CSwitchTile *)m_pLayers->Map()->GetData(pTMap->m_Switch);
|
CSwitchTile *pSwitchTiles = (CSwitchTile *)m_pLayers->Map()->GetData(pTMap->m_Switch);
|
||||||
Graphics()->BlendNone();
|
unsigned int Size = m_pLayers->Map()->GetUncompressedDataSize(pTMap->m_Switch);
|
||||||
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);
|
if (Size >= pTMap->m_Width*pTMap->m_Height*sizeof(CSwitchTile))
|
||||||
Graphics()->BlendNormal();
|
{
|
||||||
RenderTools()->RenderSwitchmap(pSwitchTiles, pTMap->m_Width, pTMap->m_Height, 32.0f, Color, TILERENDERFLAG_EXTEND|LAYERRENDERFLAG_TRANSPARENT);
|
Graphics()->BlendNone();
|
||||||
RenderTools()->RenderSwitchOverlay(pSwitchTiles, pTMap->m_Width, pTMap->m_Height, 32.0f);
|
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);
|
||||||
|
Graphics()->BlendNormal();
|
||||||
|
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)
|
else if(g_Config.m_ClShowEntities && IsTeleLayer)
|
||||||
{
|
{
|
||||||
|
@ -303,12 +318,17 @@ void CMapLayers::OnRender()
|
||||||
Graphics()->TextureSet(m_pClient->m_pMapimages->GetEntities());
|
Graphics()->TextureSet(m_pClient->m_pMapimages->GetEntities());
|
||||||
|
|
||||||
CTeleTile *pTeleTiles = (CTeleTile *)m_pLayers->Map()->GetData(pTMap->m_Tele);
|
CTeleTile *pTeleTiles = (CTeleTile *)m_pLayers->Map()->GetData(pTMap->m_Tele);
|
||||||
Graphics()->BlendNone();
|
unsigned int Size = m_pLayers->Map()->GetUncompressedDataSize(pTMap->m_Tele);
|
||||||
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);
|
if (Size >= pTMap->m_Width*pTMap->m_Height*sizeof(CTeleTile))
|
||||||
Graphics()->BlendNormal();
|
{
|
||||||
RenderTools()->RenderTelemap(pTeleTiles, pTMap->m_Width, pTMap->m_Height, 32.0f, Color, TILERENDERFLAG_EXTEND|LAYERRENDERFLAG_TRANSPARENT);
|
Graphics()->BlendNone();
|
||||||
RenderTools()->RenderTeleOverlay(pTeleTiles, pTMap->m_Width, pTMap->m_Height, 32.0f);
|
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);
|
||||||
|
Graphics()->BlendNormal();
|
||||||
|
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)
|
else if(g_Config.m_ClShowEntities && IsSpeedupLayer)
|
||||||
{
|
{
|
||||||
|
@ -316,12 +336,17 @@ void CMapLayers::OnRender()
|
||||||
Graphics()->TextureSet(m_pClient->m_pMapimages->GetEntities());
|
Graphics()->TextureSet(m_pClient->m_pMapimages->GetEntities());
|
||||||
|
|
||||||
CSpeedupTile *pSpeedupTiles = (CSpeedupTile *)m_pLayers->Map()->GetData(pTMap->m_Speedup);
|
CSpeedupTile *pSpeedupTiles = (CSpeedupTile *)m_pLayers->Map()->GetData(pTMap->m_Speedup);
|
||||||
Graphics()->BlendNone();
|
unsigned int Size = m_pLayers->Map()->GetUncompressedDataSize(pTMap->m_Speedup);
|
||||||
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);
|
if (Size >= pTMap->m_Width*pTMap->m_Height*sizeof(CSpeedupTile))
|
||||||
Graphics()->BlendNormal();
|
{
|
||||||
RenderTools()->RenderSpeedupmap(pSpeedupTiles, pTMap->m_Width, pTMap->m_Height, 32.0f, Color, TILERENDERFLAG_EXTEND|LAYERRENDERFLAG_TRANSPARENT);
|
Graphics()->BlendNone();
|
||||||
RenderTools()->RenderSpeedupOverlay(pSpeedupTiles, pTMap->m_Width, pTMap->m_Height, 32.0f);
|
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);
|
||||||
|
Graphics()->BlendNormal();
|
||||||
|
RenderTools()->RenderSpeedupmap(pSpeedupTiles, pTMap->m_Width, pTMap->m_Height, 32.0f, Color, TILERENDERFLAG_EXTEND|LAYERRENDERFLAG_TRANSPARENT);
|
||||||
|
RenderTools()->RenderSpeedupOverlay(pSpeedupTiles, pTMap->m_Width, pTMap->m_Height, 32.0f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!g_Config.m_GfxNoclip)
|
if(!g_Config.m_GfxNoclip)
|
||||||
|
|
Loading…
Reference in a new issue