mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Fix loading of old maps
This commit is contained in:
parent
15d0a40825
commit
e8229f537f
|
@ -39,6 +39,15 @@ void CLayers::Init(class IKernel *pKernel)
|
|||
if(pLayer->m_Type == LAYERTYPE_TILES)
|
||||
{
|
||||
CMapItemLayerTilemap *pTilemap = reinterpret_cast<CMapItemLayerTilemap *>(pLayer);
|
||||
|
||||
if(pTilemap->m_Version <= 2)
|
||||
{
|
||||
pTilemap->m_Switch = *((int*)(pTilemap) + 18);
|
||||
pTilemap->m_Front = *((int*)(pTilemap) + 17);
|
||||
pTilemap->m_Speedup = *((int*)(pTilemap) + 16);
|
||||
pTilemap->m_Tele = *((int*)(pTilemap) + 15);
|
||||
}
|
||||
|
||||
if(pTilemap->m_Flags&TILESLAYERFLAG_GAME)
|
||||
{
|
||||
m_pGameLayer = pTilemap;
|
||||
|
@ -62,29 +71,13 @@ void CLayers::Init(class IKernel *pKernel)
|
|||
//break;
|
||||
}
|
||||
if(pTilemap->m_Flags&TILESLAYERFLAG_TELE)
|
||||
{
|
||||
if(pTilemap->m_Version <= 2)
|
||||
pTilemap->m_Tele = *((int*)(pTilemap) + 15);
|
||||
m_pTeleLayer = pTilemap;
|
||||
}
|
||||
if(pTilemap->m_Flags&TILESLAYERFLAG_SPEEDUP)
|
||||
{
|
||||
if(pTilemap->m_Version <= 2)
|
||||
pTilemap->m_Speedup = *((int*)(pTilemap) + 16);
|
||||
m_pSpeedupLayer = pTilemap;
|
||||
}
|
||||
if(pTilemap->m_Flags&TILESLAYERFLAG_FRONT)
|
||||
{
|
||||
if(pTilemap->m_Version <= 2)
|
||||
pTilemap->m_Front = *((int*)(pTilemap) + 17);
|
||||
m_pFrontLayer = pTilemap;
|
||||
}
|
||||
if(pTilemap->m_Flags&TILESLAYERFLAG_SWITCH)
|
||||
{
|
||||
if(pTilemap->m_Version <= 2)
|
||||
pTilemap->m_Switch = *((int*)(pTilemap) + 18);
|
||||
m_pSwitchLayer = pTilemap;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1728,9 +1728,9 @@ void CGameContext::OnInit(/*class IKernel *pKernel*/)
|
|||
CTile *pFront = 0;
|
||||
CSwitchTile *pSwitch = 0;
|
||||
if(m_Layers.FrontLayer())
|
||||
pFront = (CTile *)Kernel()->RequestInterface<IMap>()->GetData(pTileMap->m_Front);
|
||||
pFront = (CTile *)Kernel()->RequestInterface<IMap>()->GetData(m_Layers.FrontLayer()->m_Front);
|
||||
if(m_Layers.SwitchLayer())
|
||||
pSwitch = (CSwitchTile *)Kernel()->RequestInterface<IMap>()->GetData(pTileMap->m_Switch);
|
||||
pSwitch = (CSwitchTile *)Kernel()->RequestInterface<IMap>()->GetData(m_Layers.SwitchLayer()->m_Switch);
|
||||
|
||||
for(int y = 0; y < pTileMap->m_Height; y++)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue