diff --git a/Adventures in Lestoria/Minimap.cpp b/Adventures in Lestoria/Minimap.cpp index c52fb1ea..07202003 100644 --- a/Adventures in Lestoria/Minimap.cpp +++ b/Adventures in Lestoria/Minimap.cpp @@ -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;yGetPixel(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); } diff --git a/Adventures in Lestoria/Minimap.h b/Adventures in Lestoria/Minimap.h index 840ade9a..5ec1e8ad 100644 --- a/Adventures in Lestoria/Minimap.h +++ b/Adventures in Lestoria/Minimap.h @@ -39,6 +39,11 @@ All rights reserved. #include "olcPGEX_ViewPort.h" +enum class InitialLoad{ + NO=0, + YES=1, +}; + enum class MinimapMode{ SMALL, LARGE, @@ -52,7 +57,7 @@ public: void Update(); void Draw(); - void UpdateChunk(const MapName map,const vi2d chunkPos); + void UpdateChunk(const MapName map,const vi2d chunkPos,const InitialLoad initialLoad); void EraseChunkData(); const std::unordered_map>&GetChunkData(); diff --git a/Adventures in Lestoria/Player.cpp b/Adventures in Lestoria/Player.cpp index 4e4a876f..8cec0694 100644 --- a/Adventures in Lestoria/Player.cpp +++ b/Adventures in Lestoria/Player.cpp @@ -897,7 +897,7 @@ void Player::Moved(){ ForceSetPos({pos.x,float(game->GetCurrentMapData().playerSpawnLocation.y)}); } - game->minimap.UpdateChunk(game->GetCurrentMapName(),GetPos()/game->GetCurrentMapData().tilewidth/"Minimap.Chunk Size"_I); + game->minimap.UpdateChunk(game->GetCurrentMapName(),GetPos()/game->GetCurrentMapData().tilewidth/"Minimap.Chunk Size"_I,InitialLoad::NO); } void Player::Spin(float duration,float spinSpd){ diff --git a/Adventures in Lestoria/SaveFile.cpp b/Adventures in Lestoria/SaveFile.cpp index 2c5a1106..f1f74e57 100644 --- a/Adventures in Lestoria/SaveFile.cpp +++ b/Adventures in Lestoria/SaveFile.cpp @@ -400,7 +400,7 @@ void SaveFile::LoadFile(){ for(auto&[key,size]:loadFile["Minimap"].GetKeys()){ for(const std::string&chunk:loadFile["Minimap"][key].GetValues()){ vi2d chunkPos={stoi(chunk.substr(0,chunk.find('_'))),stoi(chunk.substr(chunk.find('_')+1))}; - game->minimap.UpdateChunk(key,chunkPos); + game->minimap.UpdateChunk(key,chunkPos,InitialLoad::NO); } } } diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index 7c20e76e..313532a0 100644 --- a/Adventures in Lestoria/Version.h +++ b/Adventures in Lestoria/Version.h @@ -39,7 +39,7 @@ All rights reserved. #define VERSION_MAJOR 1 #define VERSION_MINOR 1 #define VERSION_PATCH 0 -#define VERSION_BUILD 8917 +#define VERSION_BUILD 8921 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Adventures in Lestoria/assets/config/Player.txt b/Adventures in Lestoria/assets/config/Player.txt index db14f99b..70391c8e 100644 --- a/Adventures in Lestoria/assets/config/Player.txt +++ b/Adventures in Lestoria/assets/config/Player.txt @@ -6,10 +6,10 @@ Player # Game Map Starting Location Starting Location = Story I - # Class Minimap Image offset + # Player Class Minimap Image offset Minimap Image Offset = 12,11 - # Class Minimap Image Size (Total Width and Height, starting from the center going out) Ex: 12 means 6 in both directions. + # Player Class Minimap Image Size (Total Width and Height, starting from the center going out) Ex: 12 means 6 in both directions. Minimap Image Size = 12,12 # Starting base crit rate. diff --git a/Adventures in Lestoria/assets/config/minimap.txt b/Adventures in Lestoria/assets/config/minimap.txt index 9117fc65..052b8583 100644 --- a/Adventures in Lestoria/assets/config/minimap.txt +++ b/Adventures in Lestoria/assets/config/minimap.txt @@ -5,4 +5,7 @@ Minimap # Chunk size in tiles Chunk Size = 16 + + # Transparency for already explored maps when re-entering a level. + Map Explore Transparency = 80 } \ No newline at end of file diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index b96dd3b7..09c8729f 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ