From 06afe36db4cb375d9596a1937a6e1159781b7295 Mon Sep 17 00:00:00 2001 From: GreYFoX Date: Sat, 13 Aug 2011 02:12:40 +0200 Subject: [PATCH] Removed old hook through prediction as 0.5.2 servers are no longer compatible made it possible to load old maps Enumerated layers --- src/game/collision.cpp | 22 ++------- src/game/editor/editor.cpp | 54 ++++++++++++++++----- src/game/editor/io.cpp | 41 ++++++++-------- src/game/editor/layer_tiles.cpp | 62 ++++++++++++++---------- src/game/editor/popups.cpp | 85 +++++++++++++++++---------------- src/game/layers.cpp | 24 ++++++++-- src/game/mapitems.h | 16 ++++--- 7 files changed, 178 insertions(+), 126 deletions(-) diff --git a/src/game/collision.cpp b/src/game/collision.cpp index f4f4062e5..9d3aa45e8 100644 --- a/src/game/collision.cpp +++ b/src/game/collision.cpp @@ -353,24 +353,10 @@ int CCollision::IsThrough(int x, int y) int Findex = 0; if (m_pFront) Findex = m_pFront[Ny*m_Width+Nx].m_Index; - if(!g_Config.m_ClPredictOldHookthrough) - { - if (Index == TILE_THROUGH) - return Index; - if (Findex == TILE_THROUGH) - return Findex; - } - else - { - if (Index == OLD_THROUGH1) - return Index; - if (Findex == OLD_THROUGH1) - return Findex; - if (Index == OLD_THROUGH2) - return Index; - if (Findex == OLD_THROUGH2) - return Findex; - } + if (Index == TILE_THROUGH) + return Index; + if (Findex == TILE_THROUGH) + return Findex; return 0; } diff --git a/src/game/editor/editor.cpp b/src/game/editor/editor.cpp index adf330381..01f3fb45b 100644 --- a/src/game/editor/editor.cpp +++ b/src/game/editor/editor.cpp @@ -1,8 +1,6 @@ /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ /* If you are missing that file, acquire a complete release at teeworlds.com. */ -#include - #include #include @@ -737,12 +735,12 @@ void CEditor::CallbackSaveMap(const char *pFileName, int StorageType, void *pUse //TODO:DDRace:anyone find out why do we need to save twice for things to work! if(pEditor->Save(pFileName)) - if(pEditor->Save(pFileName)) - { - str_copy(pEditor->m_aFileName, pFileName, sizeof(pEditor->m_aFileName)); - pEditor->m_ValidSaveFilename = StorageType == IStorage::TYPE_SAVE && pEditor->m_pFileDialogPath == pEditor->m_aFileDialogCurrentFolder; - pEditor->m_Map.m_Modified = false; - } + if(pEditor->Save(pFileName)) + { + str_copy(pEditor->m_aFileName, pFileName, sizeof(pEditor->m_aFileName)); + pEditor->m_ValidSaveFilename = StorageType == IStorage::TYPE_SAVE && pEditor->m_pFileDialogPath == pEditor->m_aFileDialogCurrentFolder; + pEditor->m_Map.m_Modified = false; + } pEditor->m_Dialog = DIALOG_NONE; } @@ -971,7 +969,6 @@ void CEditor::DoToolbar(CUIRect ToolBar) { if(pT) DoMapBorder(); -<<<<<<< HEAD } // do tele button TB_Bottom.VSplitLeft(5.0f, &Button, &TB_Bottom); @@ -1001,8 +998,6 @@ void CEditor::DoToolbar(CUIRect ToolBar) { static int s_SwitchPopupID = 0; UiInvokePopupMenu(&s_SwitchPopupID, 0, UI()->MouseX(), UI()->MouseY(), 120, 36, PopupSwitch); -======= ->>>>>>> c56cfa12d511559b096579d4e7a80b7cb6bbb6fe } } @@ -1521,6 +1516,43 @@ void CEditor::DoMapEditor(CUIRect View, CUIRect ToolBar) if(m_ShowTileInfo) m_TilesetPicker.ShowInfo(); } + CLayerTele *pTelet = (CLayerTele *)GetSelectedLayerType(0, LAYERTYPE_TELE); + if(pTelet) + { + m_TilesetPicker.m_Image = pTelet->m_Image; + m_TilesetPicker.m_TexID = pTelet->m_TexID; + m_TilesetPicker.Render(); + if(m_ShowTileInfo) + m_TilesetPicker.ShowInfo(); + } + CLayerSpeedup *pSpeedupt = (CLayerSpeedup *)GetSelectedLayerType(0, LAYERTYPE_SPEEDUP); + if(pSpeedupt) + { + m_TilesetPicker.m_Image = pSpeedupt->m_Image; + m_TilesetPicker.m_TexID = pSpeedupt->m_TexID; + m_TilesetPicker.Render(); + if(m_ShowTileInfo) + m_TilesetPicker.ShowInfo(); + } + CLayerFront *pFrontt = (CLayerFront *)GetSelectedLayerType(0, LAYERTYPE_FRONT); + if(pFrontt) + { + m_TilesetPicker.m_Image = pFrontt->m_Image; + m_TilesetPicker.m_TexID = pFrontt->m_TexID; + m_TilesetPicker.Render(); + if(m_ShowTileInfo) + m_TilesetPicker.ShowInfo(); + } + CLayerSwitch *pSwitcht = (CLayerSwitch *)GetSelectedLayerType(0, LAYERTYPE_SWITCH); + if(pSwitcht) + { + m_TilesetPicker.m_Image = pSwitcht->m_Image; + m_TilesetPicker.m_TexID = pSwitcht->m_TexID; + m_TilesetPicker.Render(); + if(m_ShowTileInfo) + m_TilesetPicker.ShowInfo(); + } + } static int s_Operation = OP_NONE; diff --git a/src/game/editor/io.cpp b/src/game/editor/io.cpp index 06b85a7b5..14af9ff1a 100644 --- a/src/game/editor/io.cpp +++ b/src/game/editor/io.cpp @@ -1,8 +1,5 @@ /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ /* If you are missing that file, acquire a complete release at teeworlds.com. */ - -#include - #include #include #include @@ -295,19 +292,18 @@ int CEditorMap::Save(class IStorage *pStorage, const char *pFileName) Item.m_Width = pLayer->m_Width; Item.m_Height = pLayer->m_Height; -<<<<<<< HEAD - //Item.m_Flags = pLayer->m_Game; + // Item.m_Flags = pLayer->m_Game ? TILESLAYERFLAG_GAME : 0; if(pLayer->m_Tele) - Item.m_Flags = 2; + Item.m_Flags = TILESLAYERFLAG_TELE; else if(pLayer->m_Speedup) - Item.m_Flags = 4; + Item.m_Flags = TILESLAYERFLAG_SPEEDUP; else if(pLayer->m_Front) - Item.m_Flags = 8; + Item.m_Flags = TILESLAYERFLAG_FRONT; else if(pLayer->m_Switch) - Item.m_Flags = 16; + Item.m_Flags = TILESLAYERFLAG_SWITCH; else - Item.m_Flags = pLayer->m_Game; + Item.m_Flags = pLayer->m_Game ? TILESLAYERFLAG_GAME : 0; Item.m_Image = pLayer->m_Image; if(pLayer->m_Tele) @@ -343,16 +339,11 @@ int CEditorMap::Save(class IStorage *pStorage, const char *pFileName) delete[] Tiles; } else - Item.m_Data = df.AddData(pLayer->m_Width*pLayer->m_Height*sizeof(CTile), pLayer->m_pTiles); -======= - Item.m_Flags = pLayer->m_Game ? TILESLAYERFLAG_GAME : 0; - Item.m_Image = pLayer->m_Image; Item.m_Data = df.AddData(pLayer->m_Width*pLayer->m_Height*sizeof(CTile), pLayer->m_pTiles); // save layer name StrToInts(Item.m_aName, sizeof(Item.m_aName)/sizeof(int), pLayer->m_aName); ->>>>>>> c56cfa12d511559b096579d4e7a80b7cb6bbb6fe df.AddItem(MAPITEMTYPE_LAYER, LayerCount, sizeof(Item), &Item); GItem.m_NumLayers++; @@ -573,23 +564,35 @@ int CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Storag MakeGameLayer(pTiles); MakeGameGroup(pGroup); } - else if(pTilemapItem->m_Flags&2) + else if(pTilemapItem->m_Flags&TILESLAYERFLAG_TELE) { + if(pTilemapItem->m_Version <= 2) + pTilemapItem->m_Tele = *((int*)(pTilemapItem) + 15); + pTiles = new CLayerTele(pTilemapItem->m_Width, pTilemapItem->m_Height); MakeTeleLayer(pTiles); } - else if(pTilemapItem->m_Flags&4) + else if(pTilemapItem->m_Flags&TILESLAYERFLAG_SPEEDUP) { + if(pTilemapItem->m_Version <= 2) + pTilemapItem->m_Speedup = *((int*)(pTilemapItem) + 16); + pTiles = new CLayerSpeedup(pTilemapItem->m_Width, pTilemapItem->m_Height); MakeSpeedupLayer(pTiles); } - else if(pTilemapItem->m_Flags&8) + else if(pTilemapItem->m_Flags&TILESLAYERFLAG_FRONT) { + if(pTilemapItem->m_Version <= 2) + pTilemapItem->m_Front = *((int*)(pTilemapItem) + 17); + pTiles = new CLayerFront(pTilemapItem->m_Width, pTilemapItem->m_Height); MakeFrontLayer(pTiles); } - else if(pTilemapItem->m_Flags&16) + else if(pTilemapItem->m_Flags&TILESLAYERFLAG_SWITCH) { + if(pTilemapItem->m_Version <= 2) + pTilemapItem->m_Switch = *((int*)(pTilemapItem) + 18); + pTiles = new CLayerSwitch(pTilemapItem->m_Width, pTilemapItem->m_Height); MakeSwitchLayer(pTiles); } diff --git a/src/game/editor/layer_tiles.cpp b/src/game/editor/layer_tiles.cpp index 9e831a1b9..2d861eb8c 100644 --- a/src/game/editor/layer_tiles.cpp +++ b/src/game/editor/layer_tiles.cpp @@ -72,8 +72,8 @@ void CLayerTiles::Render() m_TexID = m_pEditor->m_Map.m_lImages[m_Image]->m_TexID; Graphics()->TextureSet(m_TexID); vec4 Color = vec4(m_Color.r/255.0f, m_Color.g/255.0f, m_Color.b/255.0f, m_Color.a/255.0f); -<<<<<<< HEAD - m_pEditor->RenderTools()->RenderTilemap(m_pTiles, m_Width, m_Height, 32.0f, Color, LAYERRENDERFLAG_OPAQUE|LAYERRENDERFLAG_TRANSPARENT); + m_pEditor->RenderTools()->RenderTilemap(m_pTiles, m_Width, m_Height, 32.0f, Color, LAYERRENDERFLAG_OPAQUE|LAYERRENDERFLAG_TRANSPARENT, + m_pEditor->EnvelopeEval, m_pEditor, m_ColorEnv, m_ColorEnvOffset); // Render DDRace Layers if(m_Tele) @@ -82,10 +82,6 @@ void CLayerTiles::Render() m_pEditor->RenderTools()->RenderSpeedupOverlay(((CLayerSpeedup*)this)->m_pSpeedupTile, m_Width, m_Height, 32.0f); if(m_Switch) m_pEditor->RenderTools()->RenderSwitchOverlay(((CLayerSwitch*)this)->m_pSwitchTile, m_Width, m_Height, 32.0f); -======= - m_pEditor->RenderTools()->RenderTilemap(m_pTiles, m_Width, m_Height, 32.0f, Color, LAYERRENDERFLAG_OPAQUE|LAYERRENDERFLAG_TRANSPARENT, - m_pEditor->EnvelopeEval, m_pEditor, m_ColorEnv, m_ColorEnvOffset); ->>>>>>> c56cfa12d511559b096579d4e7a80b7cb6bbb6fe } int CLayerTiles::ConvertX(float x) const { return (int)(x/32.0f); } @@ -250,20 +246,34 @@ int CLayerTiles::BrushGrab(CLayerGroup *pBrush, CUIRect Rect) pGrabbed->m_SwitchDelay = m_pEditor->m_SwitchDelay; str_copy(pGrabbed->m_aFileName, m_pEditor->m_aFileName, sizeof(pGrabbed->m_aFileName)); } + else if(m_pEditor->GetSelectedLayer(0) == m_pEditor->m_Map.m_pFrontLayer) + { + CLayerFront *pGrabbed = new CLayerFront(r.w, r.h); + pGrabbed->m_pEditor = m_pEditor; + pGrabbed->m_TexID = m_TexID; + pGrabbed->m_Image = m_Image; + pGrabbed->m_Game = m_Game; + pBrush->AddLayer(pGrabbed); + + // copy the tiles + for(int y = 0; y < r.h; y++) + for(int x = 0; x < r.w; x++) + pGrabbed->m_pTiles[y*pGrabbed->m_Width+x] = m_pTiles[(r.y+y)*m_Width+(r.x+x)]; + str_copy(pGrabbed->m_aFileName, m_pEditor->m_aFileName, sizeof(pGrabbed->m_aFileName)); + } else { - CLayerTiles *pGrabbed = new CLayerTiles(r.w, r.h); - pGrabbed->m_pEditor = m_pEditor; - pGrabbed->m_TexID = m_TexID; - pGrabbed->m_Image = m_Image; - pGrabbed->m_Game = m_Game; + CLayerTiles *pGrabbed = new CLayerTiles(r.w, r.h); + pGrabbed->m_pEditor = m_pEditor; + pGrabbed->m_TexID = m_TexID; + pGrabbed->m_Image = m_Image; + pGrabbed->m_Game = m_Game; + pBrush->AddLayer(pGrabbed); - pBrush->AddLayer(pGrabbed); - - // copy the tiles - for(int y = 0; y < r.h; y++) - for(int x = 0; x < r.w; x++) - pGrabbed->m_pTiles[y*pGrabbed->m_Width+x] = m_pTiles[(r.y+y)*m_Width+(r.x+x)]; + // copy the tiles + for(int y = 0; y < r.h; y++) + for(int x = 0; x < r.w; x++) + pGrabbed->m_pTiles[y*pGrabbed->m_Width+x] = m_pTiles[(r.y+y)*m_Width+(r.x+x)]; str_copy(pGrabbed->m_aFileName, m_pEditor->m_aFileName, sizeof(pGrabbed->m_aFileName)); } @@ -501,9 +511,6 @@ int CLayerTiles::RenderProperties(CUIRect *pToolBox) CUIRect Button; bool InGameGroup = !find_linear(m_pEditor->m_Map.m_pGameGroup->m_lLayers.all(), this).empty(); -<<<<<<< HEAD - if(m_pEditor->m_Map.m_pGameLayer == this || m_pEditor->m_Map.m_pTeleLayer == this || m_pEditor->m_Map.m_pSpeedupLayer == this || m_pEditor->m_Map.m_pFrontLayer == this || m_pEditor->m_Map.m_pSwitchLayer == this) -======= if(m_pEditor->m_Map.m_pGameLayer != this) { if(m_Image >= 0 && m_Image < m_pEditor->m_Map.m_lImages.size() && m_pEditor->m_Map.m_lImages[m_Image]->m_AutoMapper.IsLoaded()) @@ -521,8 +528,7 @@ int CLayerTiles::RenderProperties(CUIRect *pToolBox) } } } - else ->>>>>>> c56cfa12d511559b096579d4e7a80b7cb6bbb6fe + else if(m_pEditor->m_Map.m_pGameLayer == this || m_pEditor->m_Map.m_pTeleLayer == this || m_pEditor->m_Map.m_pSpeedupLayer == this || m_pEditor->m_Map.m_pFrontLayer == this || m_pEditor->m_Map.m_pSwitchLayer == this) InGameGroup = false; if(InGameGroup) @@ -662,7 +668,8 @@ void CLayerTiles::ModifyEnvelopeIndex(INDEX_MODIFY_FUNC Func) CLayerTele::CLayerTele(int w, int h) : CLayerTiles(w, h) { - m_pTypeName = "Tele"; + m_Type = LAYERTYPE_TELE; + str_copy(m_aName, "Tele", sizeof(m_aName)); m_Tele = 1; m_pTeleTile = new CTeleTile[w*h]; @@ -890,7 +897,8 @@ void CLayerTele::FillSelection(bool Empty, CLayer *pBrush, CUIRect Rect) CLayerSpeedup::CLayerSpeedup(int w, int h) : CLayerTiles(w, h) { - m_pTypeName = "Speedup"; + m_Type = LAYERTYPE_SPEEDUP; + str_copy(m_aName, "Speedup", sizeof(m_aName)); m_Speedup = 1; m_pSpeedupTile = new CSpeedupTile[w*h]; @@ -1141,7 +1149,8 @@ void CLayerSpeedup::FillSelection(bool Empty, CLayer *pBrush, CUIRect Rect) CLayerFront::CLayerFront(int w, int h) : CLayerTiles(w, h) { - m_pTypeName = "Front"; + m_Type = LAYERTYPE_FRONT; + str_copy(m_aName, "Front", sizeof(m_aName)); m_Front = 1; } @@ -1219,7 +1228,8 @@ void CLayerFront::BrushDraw(CLayer *pBrush, float wx, float wy) CLayerSwitch::CLayerSwitch(int w, int h) : CLayerTiles(w, h) { - m_pTypeName = "Switch"; + m_Type = LAYERTYPE_SWITCH; + str_copy(m_aName, "Switch", sizeof(m_aName)); m_Switch = 1; m_pSwitchTile = new CSwitchTile[w*h]; diff --git a/src/game/editor/popups.cpp b/src/game/editor/popups.cpp index cd3ec5e15..d90f762bd 100644 --- a/src/game/editor/popups.cpp +++ b/src/game/editor/popups.cpp @@ -334,7 +334,8 @@ int CEditor::PopupLayer(CEditor *pEditor, CUIRect View) } // layer name - if(pEditor->m_Map.m_pGameLayer != pEditor->GetSelectedLayer(0)) + // if(pEditor->m_Map.m_pGameLayer != pEditor->GetSelectedLayer(0)) + if(pEditor->m_Map.m_pGameLayer != pEditor->GetSelectedLayer(0) && pEditor->m_Map.m_pTeleLayer != pEditor->GetSelectedLayer(0) && pEditor->m_Map.m_pSpeedupLayer != pEditor->GetSelectedLayer(0) && pEditor->m_Map.m_pFrontLayer != pEditor->GetSelectedLayer(0) && pEditor->m_Map.m_pSwitchLayer != pEditor->GetSelectedLayer(0)) { View.HSplitBottom(5.0f, &View, &Button); View.HSplitBottom(12.0f, &View, &Button); @@ -365,7 +366,7 @@ int CEditor::PopupLayer(CEditor *pEditor, CUIRect View) {0}, }; - + // if(pEditor->m_Map.m_pGameLayer == pEditor->GetSelectedLayer(0)) // dont use Group and Detail from the selection if this is the game layer if(pEditor->m_Map.m_pGameLayer == pEditor->GetSelectedLayer(0) || pEditor->m_Map.m_pTeleLayer == pEditor->GetSelectedLayer(0) || pEditor->m_Map.m_pSpeedupLayer == pEditor->GetSelectedLayer(0) || pEditor->m_Map.m_pFrontLayer == pEditor->GetSelectedLayer(0) || pEditor->m_Map.m_pSwitchLayer == pEditor->GetSelectedLayer(0)) // dont use Group and Detail from the selection if this is the game layer { aProps[0].m_Type = PROPTYPE_NULL; @@ -880,7 +881,46 @@ int CEditor::PopupSelectGameTileOpResult() return Result; } -<<<<<<< HEAD +static int s_AutoMapConfigSelected = -1; + +int CEditor::PopupSelectConfigAutoMap(CEditor *pEditor, CUIRect View) +{ + CLayerTiles *pLayer = static_cast(pEditor->GetSelectedLayer(0)); + CUIRect Button; + static int s_AutoMapperConfigButtons[256]; + CAutoMapper *pAutoMapper = &pEditor->m_Map.m_lImages[pLayer->m_Image]->m_AutoMapper; + + for(int i = 0; i < pAutoMapper->ConfigNamesNum(); ++i) + { + View.HSplitTop(2.0f, 0, &View); + View.HSplitTop(12.0f, &Button, &View); + if(pEditor->DoButton_Editor(&s_AutoMapperConfigButtons[i], pAutoMapper->GetConfigName(i), 0, &Button, 0, 0)) + s_AutoMapConfigSelected = i; + } + + return 0; +} + +void CEditor::PopupSelectConfigAutoMapInvoke(float x, float y) +{ + static int s_AutoMapConfigSelectID = 0; + s_AutoMapConfigSelected = -1; + CLayerTiles *pLayer = static_cast(GetSelectedLayer(0)); + if(pLayer && pLayer->m_Image >= 0 && pLayer->m_Image < m_Map.m_lImages.size() && + m_Map.m_lImages[pLayer->m_Image]->m_AutoMapper.ConfigNamesNum()) + UiInvokePopupMenu(&s_AutoMapConfigSelectID, 0, x, y, 120.0f, 12.0f+14.0f*m_Map.m_lImages[pLayer->m_Image]->m_AutoMapper.ConfigNamesNum(), PopupSelectConfigAutoMap); +} + +int CEditor::PopupSelectConfigAutoMapResult() +{ + if(s_AutoMapConfigSelected < 0) + return -1; + + int Result = s_AutoMapConfigSelected; + s_AutoMapConfigSelected = -1; + return Result; +} + // DDRace int CEditor::PopupTele(CEditor *pEditor, CUIRect View) @@ -905,29 +945,10 @@ int CEditor::PopupTele(CEditor *pEditor, CUIRect View) if(Prop == PROP_TELE) pEditor->m_TeleNumber = clamp(NewVal, 0, 255); -======= -static int s_AutoMapConfigSelected = -1; - -int CEditor::PopupSelectConfigAutoMap(CEditor *pEditor, CUIRect View) -{ - CLayerTiles *pLayer = static_cast(pEditor->GetSelectedLayer(0)); - CUIRect Button; - static int s_AutoMapperConfigButtons[256]; - CAutoMapper *pAutoMapper = &pEditor->m_Map.m_lImages[pLayer->m_Image]->m_AutoMapper; - - for(int i = 0; i < pAutoMapper->ConfigNamesNum(); ++i) - { - View.HSplitTop(2.0f, 0, &View); - View.HSplitTop(12.0f, &Button, &View); - if(pEditor->DoButton_Editor(&s_AutoMapperConfigButtons[i], pAutoMapper->GetConfigName(i), 0, &Button, 0, 0)) - s_AutoMapConfigSelected = i; - } ->>>>>>> c56cfa12d511559b096579d4e7a80b7cb6bbb6fe return 0; } -<<<<<<< HEAD int CEditor::PopupSpeedup(CEditor *pEditor, CUIRect View) { CUIRect Button; @@ -990,24 +1011,4 @@ int CEditor::PopupSwitch(CEditor *pEditor, CUIRect View) pEditor->m_SwitchDelay = clamp(NewVal, 0, 255); return 0; -======= -void CEditor::PopupSelectConfigAutoMapInvoke(float x, float y) -{ - static int s_AutoMapConfigSelectID = 0; - s_AutoMapConfigSelected = -1; - CLayerTiles *pLayer = static_cast(GetSelectedLayer(0)); - if(pLayer && pLayer->m_Image >= 0 && pLayer->m_Image < m_Map.m_lImages.size() && - m_Map.m_lImages[pLayer->m_Image]->m_AutoMapper.ConfigNamesNum()) - UiInvokePopupMenu(&s_AutoMapConfigSelectID, 0, x, y, 120.0f, 12.0f+14.0f*m_Map.m_lImages[pLayer->m_Image]->m_AutoMapper.ConfigNamesNum(), PopupSelectConfigAutoMap); -} - -int CEditor::PopupSelectConfigAutoMapResult() -{ - if(s_AutoMapConfigSelected < 0) - return -1; - - int Result = s_AutoMapConfigSelected; - s_AutoMapConfigSelected = -1; - return Result; ->>>>>>> c56cfa12d511559b096579d4e7a80b7cb6bbb6fe } diff --git a/src/game/layers.cpp b/src/game/layers.cpp index c89746940..c8ad3e53b 100644 --- a/src/game/layers.cpp +++ b/src/game/layers.cpp @@ -61,14 +61,30 @@ void CLayers::Init(class IKernel *pKernel) //break; } - if(pTilemap->m_Flags&2) + if(pTilemap->m_Flags&TILESLAYERFLAG_TELE) + { + if(pTilemap->m_Version <= 2) + pTilemap->m_Tele = *((int*)(pTilemap) + 15); m_pTeleLayer = pTilemap; - if(pTilemap->m_Flags&4) + } + if(pTilemap->m_Flags&TILESLAYERFLAG_SPEEDUP) + { + if(pTilemap->m_Version <= 2) + pTilemap->m_Speedup = *((int*)(pTilemap) + 16); m_pSpeedupLayer = pTilemap; - if(pTilemap->m_Flags&8) + } + if(pTilemap->m_Flags&TILESLAYERFLAG_FRONT) + { + if(pTilemap->m_Version <= 2) + pTilemap->m_Front = *((int*)(pTilemap) + 17); m_pFrontLayer = pTilemap; - if(pTilemap->m_Flags&16) + } + if(pTilemap->m_Flags&TILESLAYERFLAG_SWITCH) + { + if(pTilemap->m_Version <= 2) + pTilemap->m_Switch = *((int*)(pTilemap) + 18); m_pSwitchLayer = pTilemap; + } } } } diff --git a/src/game/mapitems.h b/src/game/mapitems.h index c8835242c..b8dcc5f13 100644 --- a/src/game/mapitems.h +++ b/src/game/mapitems.h @@ -12,6 +12,10 @@ enum LAYERTYPE_GAME, // not used LAYERTYPE_TILES, LAYERTYPE_QUADS, + LAYERTYPE_FRONT, + LAYERTYPE_TELE, + LAYERTYPE_SPEEDUP, + LAYERTYPE_SWITCH, MAPITEMTYPE_VERSION=0, MAPITEMTYPE_INFO, @@ -141,10 +145,12 @@ enum LAYERFLAG_DETAIL=1, TILESLAYERFLAG_GAME=1, + TILESLAYERFLAG_TELE=2, + TILESLAYERFLAG_SPEEDUP=4, + TILESLAYERFLAG_FRONT=8, + TILESLAYERFLAG_SWITCH=16, ENTITY_OFFSET=255-16*4, - OLD_THROUGH1=25, - OLD_THROUGH2=26 }; struct CPoint @@ -238,16 +244,14 @@ struct CMapItemLayerTilemap int m_Image; int m_Data; -<<<<<<< HEAD + int m_aName[3]; + // DDRace int m_Tele; int m_Speedup; int m_Front; int m_Switch; -======= - int m_aName[3]; ->>>>>>> c56cfa12d511559b096579d4e7a80b7cb6bbb6fe } ; struct CMapItemLayerQuads