MCPcopy Create free account
hub / github.com/ddnet/ddnet / InitTilemapSkip

Method InitTilemapSkip

src/game/layers.cpp:139–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

137}
138
139void CLayers::InitTilemapSkip()
140{
141 for(int GroupIndex = 0; GroupIndex < NumGroups(); GroupIndex++)
142 {
143 const CMapItemGroup *pGroup = GetGroup(GroupIndex);
144 for(int LayerIndex = 0; LayerIndex < pGroup->m_NumLayers; LayerIndex++)
145 {
146 const CMapItemLayer *pLayer = GetLayer(pGroup->m_StartLayer + LayerIndex);
147 if(pLayer->m_Type != LAYERTYPE_TILES)
148 continue;
149
150 const CMapItemLayerTilemap *pTilemap = reinterpret_cast<const CMapItemLayerTilemap *>(pLayer);
151 CTile *pTiles = static_cast<CTile *>(m_pMap->GetData(pTilemap->m_Data));
152 for(int y = 0; y < pTilemap->m_Height; y++)
153 {
154 for(int x = 1; x < pTilemap->m_Width;)
155 {
156 int SkippedX;
157 for(SkippedX = 1; x + SkippedX < pTilemap->m_Width && SkippedX < 255; SkippedX++)
158 {
159 if(pTiles[y * pTilemap->m_Width + x + SkippedX].m_Index)
160 break;
161 }
162
163 pTiles[y * pTilemap->m_Width + x].m_Skip = SkippedX - 1;
164 x += SkippedX;
165 }
166 }
167 }
168 }
169}
170
171CMapItemGroup *CLayers::GetGroup(int Index) const
172{

Callers

nothing calls this directly

Calls 1

GetDataMethod · 0.45

Tested by

no test coverage detected