diff --git a/Crawler/Crawler.cpp b/Crawler/Crawler.cpp index 5f3719f2..fa32619b 100644 --- a/Crawler/Crawler.cpp +++ b/Crawler/Crawler.cpp @@ -922,39 +922,67 @@ void Crawler::LoadLevel(MapName map){ #pragma region TileGroupShenanigans auto SetupTileGroups=[&](std::functionIsForeground,TileRenderData tile,std::set&foregroundTilesIncluded,std::vector&groups){ int layerID=layer.tag.GetInteger("id"); - if(IsForeground(tileSheet,tileSheetIndex)){ - if(foregroundTilesIncluded.find({x,y})==foregroundTilesIncluded.end()){ - std::queuetileGroupChecks; - TileGroup group; - foregroundTilesIncluded.insert({x,y}); - group.originatingLayer=layerID; - group.InsertTile(tile); - if(x>0)tileGroupChecks.push({x-1,y}); - if(x0)tileGroupChecks.push({x,y-1}); - if(ySprite()->width/24; - int tileSheetHeight=tileSheet.tileset.tileset->Sprite()->height/24; - int tileSheetIndex=tileID-(tileSheet.firstgid-1); - int tileSheetX=tileSheetIndex%tileSheetWidth; - int tileSheetY=tileSheetIndex/tileSheetWidth; - TileRenderData tile={tileSheet.tileset.tileset->Decal(),pos*24,vi2d{tileSheetX,tileSheetY}*24}; - if(IsForeground(tileSheet,tileSheetIndex)&&foregroundTilesIncluded.find(pos)==foregroundTilesIncluded.end()){ - foregroundTilesIncluded.insert(pos); - group.InsertTile(tile); - if(pos.x>0)tileGroupChecks.push(pos+vi2d{-1,0}); - if(pos.x0)tileGroupChecks.push(pos+vi2d{0,-1}); - if(pos.ytileGroupChecks; + TileGroup group; + foregroundTilesIncluded.insert({x,y}); + group.originatingLayer=layerID; + group.InsertTile(tile); + if(x>0)tileGroupChecks.push({x-1,y}); + if(x0)tileGroupChecks.push({x,y-1}); + if(ySprite()->width/24; + int tileSheetHeight=tileSheet.tileset.tileset->Sprite()->height/24; + int tileSheetIndex=tileID-(tileSheet.firstgid-1); + int tileSheetX=tileSheetIndex%tileSheetWidth; + int tileSheetY=tileSheetIndex/tileSheetWidth; + TileRenderData tile={tileSheet.tileset.tileset->Decal(),vi2d{x,y}*24,vi2d{tileSheetX,tileSheetY}*24}; + if(IsForeground(tileSheet,tileSheetIndex)){ + foregroundTilesIncluded.insert({x,y}); + group.InsertTile(tile); + } + } + while(!tileGroupChecks.empty()){ + vi2d&pos=tileGroupChecks.front(); + tileGroupChecks.pop(); + int tileID=layer.tiles[pos.y][pos.x]-1; + TilesheetData tileSheet=GetTileSheet(currentLevel,tileID); + int tileSheetWidth=tileSheet.tileset.tileset->Sprite()->width/24; + int tileSheetHeight=tileSheet.tileset.tileset->Sprite()->height/24; + int tileSheetIndex=tileID-(tileSheet.firstgid-1); + int tileSheetX=tileSheetIndex%tileSheetWidth; + int tileSheetY=tileSheetIndex/tileSheetWidth; + TileRenderData tile={tileSheet.tileset.tileset->Decal(),pos*24,vi2d{tileSheetX,tileSheetY}*24}; + if(IsForeground(tileSheet,tileSheetIndex)&&foregroundTilesIncluded.find(pos)==foregroundTilesIncluded.end()){ + foregroundTilesIncluded.insert(pos); + group.InsertTile(tile); + if(pos.x>0)tileGroupChecks.push(pos+vi2d{-1,0}); + if(pos.x0)tileGroupChecks.push(pos+vi2d{0,-1}); + if(pos.ySprite()->width/24; + int tileSheetHeight=tileSheet.tileset.tileset->Sprite()->height/24; + int tileSheetIndex=tileID-(tileSheet.firstgid-1); + int tileSheetX=tileSheetIndex%tileSheetWidth; + int tileSheetY=tileSheetIndex/tileSheetWidth; + TileRenderData tile={tileSheet.tileset.tileset->Decal(),pos*24,vi2d{tileSheetX,tileSheetY}*24}; + if(IsForeground(tileSheet,tileSheetIndex)){ + foregroundTilesIncluded.insert(pos); + group.InsertTile(tile); + } } } - groups.push_back(group); } + groups.push_back(group); } }; TileRenderData tile={tileSheet.tileset.tileset->Decal(),vi2d{x,y}*24,vi2d{tileSheetX,tileSheetY}*24}; diff --git a/Crawler/Version.h b/Crawler/Version.h index 1f0be048..f61c7600 100644 --- a/Crawler/Version.h +++ b/Crawler/Version.h @@ -2,7 +2,7 @@ #define VERSION_MAJOR 0 #define VERSION_MINOR 2 #define VERSION_PATCH 0 -#define VERSION_BUILD 1079 +#define VERSION_BUILD 1093 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/x64/Release/Crawler.exe b/x64/Release/Crawler.exe index 3ca5fffc..6698a85b 100644 Binary files a/x64/Release/Crawler.exe and b/x64/Release/Crawler.exe differ diff --git a/x64/Release/Crawler.exe.lastcodeanalysissucceeded b/x64/Release/Crawler.exe.lastcodeanalysissucceeded deleted file mode 100644 index e69de29b..00000000