|
|
|
@ -1385,7 +1385,48 @@ void Crawler::InitializeLevel(std::string mapFile,MapName map){ |
|
|
|
|
MAP_TILESETS["assets/maps/"+baseSourceDir].animationData=tileset.GetData().AnimationData; |
|
|
|
|
MAP_TILESETS["assets/maps/"+baseSourceDir].reflectiveData=tileset.GetData().ReflectiveData; |
|
|
|
|
std::cout<<"assets/maps/"+baseSourceDir<<" Animation Data Size: "<<MAP_TILESETS["assets/maps/"+baseSourceDir].animationData.size()<<std::endl; |
|
|
|
|
r->Load("assets/maps/"+tileset.GetData().ImageData.data["source"]); |
|
|
|
|
std::string mapPath="assets/maps/"+tileset.GetData().ImageData.data["source"]; |
|
|
|
|
if(std::filesystem::exists(mapPath)){ |
|
|
|
|
r->Load(mapPath); |
|
|
|
|
}else{ |
|
|
|
|
std::cout<<"WARNING! "<<mapPath<<" does not exist, auto-generating mock-up texture"<<std::endl; |
|
|
|
|
r->Create(tileset.GetData().imagewidth,tileset.GetData().imageheight); |
|
|
|
|
SetDrawTarget(r->Sprite()); |
|
|
|
|
int tileXCount=tileset.GetData().imagewidth/tileset.GetData().tilewidth; |
|
|
|
|
int tileYCount=tileset.GetData().imageheight/tileset.GetData().tileheight; |
|
|
|
|
vi2d tileSize={tileset.GetData().tilewidth,tileset.GetData().tileheight}; |
|
|
|
|
|
|
|
|
|
const int colorCombinations=255*6; |
|
|
|
|
|
|
|
|
|
for(int y=0;y<tileYCount;y++){ |
|
|
|
|
for(int x=0;x<tileXCount;x++){ |
|
|
|
|
int colorCycleIndex=(y*255+x)%colorCombinations; |
|
|
|
|
Pixel tileCol=WHITE; |
|
|
|
|
if(colorCycleIndex<255){ |
|
|
|
|
tileCol={uint8_t(colorCycleIndex%255),0,0}; |
|
|
|
|
}else |
|
|
|
|
if(colorCycleIndex<255*2){ |
|
|
|
|
tileCol={0,uint8_t(colorCycleIndex%255),0}; |
|
|
|
|
}else |
|
|
|
|
if(colorCycleIndex<255*3){ |
|
|
|
|
tileCol={0,0,uint8_t(colorCycleIndex%255)}; |
|
|
|
|
}else |
|
|
|
|
if(colorCycleIndex<255*4){ |
|
|
|
|
tileCol={uint8_t(colorCycleIndex%255),uint8_t(colorCycleIndex%255),0}; |
|
|
|
|
}else |
|
|
|
|
if(colorCycleIndex<255*5){ |
|
|
|
|
tileCol={0,uint8_t(colorCycleIndex%255),uint8_t(colorCycleIndex%255)}; |
|
|
|
|
}else{ |
|
|
|
|
tileCol={uint8_t(colorCycleIndex%255),0,uint8_t(colorCycleIndex%255)}; |
|
|
|
|
} |
|
|
|
|
FillRect(vi2d{x,y}*tileSize,tileSize,tileCol); |
|
|
|
|
DrawRect(vi2d{x,y}*tileSize,tileSize,GREY); |
|
|
|
|
DrawString(vi2d{x,y}*tileSize+vi2d{1,1},std::to_string(y*255+x),DARK_GREY); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
SetDrawTarget(nullptr); |
|
|
|
|
r->Decal()->Update(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|