mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Added variable for tile background. Improved a lil bit maplayers.
This commit is contained in:
parent
70a2cfa4ea
commit
8b8ba7b860
|
@ -300,6 +300,7 @@ MACRO_CONFIG_INT(ClBackgroundEntitiesHue, cl_background_entities_hue, 0, 0, 255,
|
|||
MACRO_CONFIG_INT(ClBackgroundEntitiesSat, cl_background_entities_sat, 0, 0, 255, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Background (entities) color saturation")
|
||||
MACRO_CONFIG_INT(ClBackgroundEntitiesLht, cl_background_entities_lht, 128, 0, 255, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Background (entities) color lightness")
|
||||
MACRO_CONFIG_STR(ClBackgroundEntities, cl_background_entities, 100, "", CFGFLAG_CLIENT|CFGFLAG_SAVE, "Background (entities)")
|
||||
MACRO_CONFIG_INT(ClBackgroundShowTilesLayers, cl_background_show_tiles_layers, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Whether draw tiles layers when using custom background (entities)")
|
||||
MACRO_CONFIG_INT(SvShowOthers, sv_show_others, 1, 0, 1, CFGFLAG_SERVER, "Whether players can user the command showothers or not")
|
||||
MACRO_CONFIG_INT(SvShowOthersDefault, sv_show_others_default, 0, 0, 1, CFGFLAG_SERVER, "Whether players see others by default")
|
||||
MACRO_CONFIG_INT(SvShowAllDefault, sv_show_all_default, 0, 0, 1, CFGFLAG_SERVER, "Whether players see all tees by default")
|
||||
|
|
|
@ -82,8 +82,10 @@ void CBackground::OnRender()
|
|||
Graphics()->GetScreen(&Screen.x, &Screen.y, &Screen.w, &Screen.h);
|
||||
|
||||
vec2 Center = m_pClient->m_pCamera->m_Center;
|
||||
|
||||
bool PassedGameLayer = false;
|
||||
|
||||
for(int g = 0; g < m_pLayers->m_pLayers->NumGroups(); g++)
|
||||
for(int g = 0; g < m_pLayers->m_pLayers->NumGroups() && !PassedGameLayer; g++)
|
||||
{
|
||||
CMapItemGroup *pGroup = m_pLayers->m_pLayers->GetGroup(g);
|
||||
|
||||
|
@ -94,15 +96,6 @@ void CBackground::OnRender()
|
|||
dbg_msg("MapLayers", "we need mapname and crc and the map that caused this if possible, and anymore info you think is relevant");
|
||||
continue;
|
||||
}
|
||||
|
||||
// load group name
|
||||
if(pGroup->m_Version >= 3)
|
||||
{
|
||||
char Buf[32];
|
||||
IntsToStr(pGroup->m_aName, sizeof(Buf)/sizeof(int), Buf);
|
||||
if(str_comp(Buf, "Game") == 0)
|
||||
return;
|
||||
}
|
||||
|
||||
if(!g_Config.m_GfxNoclip && pGroup->m_Version >= 2 && pGroup->m_UseClipping)
|
||||
{
|
||||
|
@ -124,24 +117,49 @@ void CBackground::OnRender()
|
|||
else
|
||||
m_pLayers->MapScreenToGroup(Center.x, Center.y, pGroup, m_pClient->m_pCamera->m_Zoom);
|
||||
|
||||
if(g_Config.m_ClOverlayEntities == 100 && g_Config.m_ClBackgroundEntities)
|
||||
for(int l = 0; l < pGroup->m_NumLayers; l++)
|
||||
{
|
||||
for(int l = 0; l < pGroup->m_NumLayers; l++)
|
||||
CMapItemLayer *pLayer = m_pLayers->m_pLayers->GetLayer(pGroup->m_StartLayer+l);
|
||||
// skip rendering if detail layers if not wanted
|
||||
if(pLayer->m_Flags&LAYERFLAG_DETAIL && !g_Config.m_GfxHighDetail)
|
||||
continue;
|
||||
|
||||
if(pLayer == (CMapItemLayer*)m_pLayers->m_pLayers->GameLayer())
|
||||
{
|
||||
CMapItemLayer *pLayer = m_pLayers->m_pLayers->GetLayer(pGroup->m_StartLayer+l);
|
||||
// skip rendering if detail layers if not wanted
|
||||
if(pLayer->m_Flags&LAYERFLAG_DETAIL && !g_Config.m_GfxHighDetail)
|
||||
continue;
|
||||
|
||||
if(pLayer->m_Type == LAYERTYPE_TILES)
|
||||
continue;
|
||||
PassedGameLayer = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if(pLayer->m_Type == LAYERTYPE_TILES && g_Config.m_ClBackgroundShowTilesLayers)
|
||||
{
|
||||
CMapItemLayerTilemap *pTMap = (CMapItemLayerTilemap *)pLayer;
|
||||
if(pTMap->m_Image == -1)
|
||||
Graphics()->TextureSet(-1);
|
||||
else
|
||||
Graphics()->TextureSet(m_pImages->Get(pTMap->m_Image));
|
||||
|
||||
CTile *pTiles = (CTile *)m_pMap->GetData(pTMap->m_Data);
|
||||
unsigned int Size = m_pMap->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,
|
||||
m_pLayers->EnvelopeEval, m_pLayers, pTMap->m_ColorEnv, pTMap->m_ColorEnvOffset);
|
||||
Graphics()->BlendNormal();
|
||||
RenderTools()->RenderTilemap(pTiles, pTMap->m_Width, pTMap->m_Height, 32.0f, Color, TILERENDERFLAG_EXTEND|LAYERRENDERFLAG_TRANSPARENT,
|
||||
m_pLayers->EnvelopeEval, m_pLayers, pTMap->m_ColorEnv, pTMap->m_ColorEnvOffset);
|
||||
}
|
||||
}
|
||||
else if(pLayer->m_Type == LAYERTYPE_QUADS && g_Config.m_ClShowQuads)
|
||||
{
|
||||
CMapItemLayerQuads *pQLayer = (CMapItemLayerQuads *)pLayer;
|
||||
if(pQLayer->m_Image == -1)
|
||||
Graphics()->TextureSet(-1);
|
||||
else
|
||||
Graphics()->TextureSet(m_pImages->Get(pQLayer->m_Image));
|
||||
|
||||
|
||||
CQuad *pQuads = (CQuad *)m_pMap->GetDataSwapped(pQLayer->m_Data);
|
||||
|
||||
Graphics()->BlendNone();
|
||||
|
|
|
@ -297,9 +297,7 @@ void CMapLayers::OnRender()
|
|||
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);
|
||||
if(g_Config.m_ClOverlayEntities)
|
||||
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*g_Config.m_ClOverlayEntities/100.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*g_Config.m_ClOverlayEntities/100.0f);
|
||||
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();
|
||||
|
@ -318,9 +316,7 @@ void CMapLayers::OnRender()
|
|||
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);
|
||||
if(g_Config.m_ClOverlayEntities)
|
||||
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*g_Config.m_ClOverlayEntities/100.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*g_Config.m_ClOverlayEntities/100.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);
|
||||
|
@ -338,9 +334,7 @@ void CMapLayers::OnRender()
|
|||
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);
|
||||
if(g_Config.m_ClOverlayEntities)
|
||||
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*g_Config.m_ClOverlayEntities/100.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*g_Config.m_ClOverlayEntities/100.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);
|
||||
|
@ -358,9 +352,7 @@ void CMapLayers::OnRender()
|
|||
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);
|
||||
if(g_Config.m_ClOverlayEntities)
|
||||
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*g_Config.m_ClOverlayEntities/100.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*g_Config.m_ClOverlayEntities/100.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);
|
||||
|
@ -378,9 +370,7 @@ void CMapLayers::OnRender()
|
|||
if (Size >= pTMap->m_Width*pTMap->m_Height*sizeof(CTuneTile))
|
||||
{
|
||||
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);
|
||||
if(g_Config.m_ClOverlayEntities)
|
||||
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*g_Config.m_ClOverlayEntities/100.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*g_Config.m_ClOverlayEntities/100.0f);
|
||||
RenderTools()->RenderTunemap(pTuneTiles, pTMap->m_Width, pTMap->m_Height, 32.0f, Color, TILERENDERFLAG_EXTEND|LAYERRENDERFLAG_OPAQUE);
|
||||
Graphics()->BlendNormal();
|
||||
RenderTools()->RenderTunemap(pTuneTiles, pTMap->m_Width, pTMap->m_Height, 32.0f, Color, TILERENDERFLAG_EXTEND|LAYERRENDERFLAG_TRANSPARENT);
|
||||
|
|
Loading…
Reference in a new issue