Add in breadcrumb re-exploration for minimaps. Release Build 8921.

This commit is contained in:
2024-04-14 14:48:37 -05:00
parent e0aea34a43
commit bdf126820a
8 changed files with 19 additions and 8 deletions
+5 -2
View File
@@ -172,7 +172,7 @@ void Minimap::Reset(){
#pragma region Load all minimap chunks already explored
for(auto&chunk:loadedChunks[game->GetCurrentMapName()]){
vi2d chunkPos={stoi(chunk.substr(0,chunk.find('_'))),stoi(chunk.substr(chunk.find('_')+1))};
UpdateChunk(game->GetCurrentMapName(),chunkPos);
UpdateChunk(game->GetCurrentMapName(),chunkPos,InitialLoad::YES);
}
#pragma endregion
}
@@ -185,7 +185,7 @@ void Minimap::Update(){
}
}
void Minimap::UpdateChunk(const MapName map,const vi2d chunkPos){
void Minimap::UpdateChunk(const MapName map,const vi2d chunkPos,const InitialLoad initialLoad){
loadedChunks[map].insert(std::format("{}_{}",chunkPos.x,chunkPos.y));
if(game->GetCurrentMapName()!=map)return; //Don't update the minimap when the map name doesn't match the current map.
@@ -199,12 +199,14 @@ void Minimap::UpdateChunk(const MapName map,const vi2d chunkPos){
for(int y=pixelPos.y;y<chunkEndPixelPos.y;y++){
for(int x=pixelPos.x;x<chunkEndPixelPos.x;x++){
Pixel sourceCol=minimap.Sprite()->GetPixel(x,y);
bool sourceWasBlack=sourceCol==BLACK;
if(cover.Sprite()->GetPixel(x,y).a==255||sourceCol.a==0)continue; //Already revealed or invisible anyways.
vi2d chunk=vi2d{x,y}/"Minimap.Chunk Size"_I;
if(chunk==chunkPos){
if(initialLoad==InitialLoad::YES)sourceCol.a=std::min(sourceCol.a,uint8_t("Minimap.Map Explore Transparency"_I));
cover.Sprite()->SetPixel(x,y,sourceCol);
if(sourceWasBlack)coverOutline.Sprite()->SetPixel(x,y,sourceCol);
}else{
@@ -216,6 +218,7 @@ void Minimap::UpdateChunk(const MapName map,const vi2d chunkPos){
if(cover.Sprite()->GetPixel(x,y).a>alpha)continue; //The distance was uncovered by another closer chunk, don't need to reveal it here.
sourceCol.a=alpha;
if(initialLoad==InitialLoad::YES)sourceCol.a=std::min(sourceCol.a,uint8_t("Minimap.Map Explore Transparency"_I));
cover.Sprite()->SetPixel(x,y,sourceCol);
if(sourceWasBlack)coverOutline.Sprite()->SetPixel(x,y,sourceCol);
}