Add in breadcrumb re-exploration for minimaps. Release Build 8921.
This commit is contained in:
parent
97030dd38f
commit
7aa455a890
@ -172,7 +172,7 @@ void Minimap::Reset(){
|
|||||||
#pragma region Load all minimap chunks already explored
|
#pragma region Load all minimap chunks already explored
|
||||||
for(auto&chunk:loadedChunks[game->GetCurrentMapName()]){
|
for(auto&chunk:loadedChunks[game->GetCurrentMapName()]){
|
||||||
vi2d chunkPos={stoi(chunk.substr(0,chunk.find('_'))),stoi(chunk.substr(chunk.find('_')+1))};
|
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
|
#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));
|
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.
|
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 y=pixelPos.y;y<chunkEndPixelPos.y;y++){
|
||||||
for(int x=pixelPos.x;x<chunkEndPixelPos.x;x++){
|
for(int x=pixelPos.x;x<chunkEndPixelPos.x;x++){
|
||||||
Pixel sourceCol=minimap.Sprite()->GetPixel(x,y);
|
Pixel sourceCol=minimap.Sprite()->GetPixel(x,y);
|
||||||
|
|
||||||
bool sourceWasBlack=sourceCol==BLACK;
|
bool sourceWasBlack=sourceCol==BLACK;
|
||||||
|
|
||||||
if(cover.Sprite()->GetPixel(x,y).a==255||sourceCol.a==0)continue; //Already revealed or invisible anyways.
|
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;
|
vi2d chunk=vi2d{x,y}/"Minimap.Chunk Size"_I;
|
||||||
if(chunk==chunkPos){
|
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);
|
cover.Sprite()->SetPixel(x,y,sourceCol);
|
||||||
if(sourceWasBlack)coverOutline.Sprite()->SetPixel(x,y,sourceCol);
|
if(sourceWasBlack)coverOutline.Sprite()->SetPixel(x,y,sourceCol);
|
||||||
}else{
|
}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.
|
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;
|
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);
|
cover.Sprite()->SetPixel(x,y,sourceCol);
|
||||||
if(sourceWasBlack)coverOutline.Sprite()->SetPixel(x,y,sourceCol);
|
if(sourceWasBlack)coverOutline.Sprite()->SetPixel(x,y,sourceCol);
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,11 @@ All rights reserved.
|
|||||||
|
|
||||||
#include "olcPGEX_ViewPort.h"
|
#include "olcPGEX_ViewPort.h"
|
||||||
|
|
||||||
|
enum class InitialLoad{
|
||||||
|
NO=0,
|
||||||
|
YES=1,
|
||||||
|
};
|
||||||
|
|
||||||
enum class MinimapMode{
|
enum class MinimapMode{
|
||||||
SMALL,
|
SMALL,
|
||||||
LARGE,
|
LARGE,
|
||||||
@ -52,7 +57,7 @@ public:
|
|||||||
void Update();
|
void Update();
|
||||||
void Draw();
|
void Draw();
|
||||||
|
|
||||||
void UpdateChunk(const MapName map,const vi2d chunkPos);
|
void UpdateChunk(const MapName map,const vi2d chunkPos,const InitialLoad initialLoad);
|
||||||
void EraseChunkData();
|
void EraseChunkData();
|
||||||
|
|
||||||
const std::unordered_map<MapName,std::unordered_set<std::string>>&GetChunkData();
|
const std::unordered_map<MapName,std::unordered_set<std::string>>&GetChunkData();
|
||||||
|
@ -897,7 +897,7 @@ void Player::Moved(){
|
|||||||
ForceSetPos({pos.x,float(game->GetCurrentMapData().playerSpawnLocation.y)});
|
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){
|
void Player::Spin(float duration,float spinSpd){
|
||||||
|
@ -400,7 +400,7 @@ void SaveFile::LoadFile(){
|
|||||||
for(auto&[key,size]:loadFile["Minimap"].GetKeys()){
|
for(auto&[key,size]:loadFile["Minimap"].GetKeys()){
|
||||||
for(const std::string&chunk:loadFile["Minimap"][key].GetValues()){
|
for(const std::string&chunk:loadFile["Minimap"][key].GetValues()){
|
||||||
vi2d chunkPos={stoi(chunk.substr(0,chunk.find('_'))),stoi(chunk.substr(chunk.find('_')+1))};
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ All rights reserved.
|
|||||||
#define VERSION_MAJOR 1
|
#define VERSION_MAJOR 1
|
||||||
#define VERSION_MINOR 1
|
#define VERSION_MINOR 1
|
||||||
#define VERSION_PATCH 0
|
#define VERSION_PATCH 0
|
||||||
#define VERSION_BUILD 8917
|
#define VERSION_BUILD 8921
|
||||||
|
|
||||||
#define stringify(a) stringify_(a)
|
#define stringify(a) stringify_(a)
|
||||||
#define stringify_(a) #a
|
#define stringify_(a) #a
|
||||||
|
@ -6,10 +6,10 @@ Player
|
|||||||
# Game Map Starting Location
|
# Game Map Starting Location
|
||||||
Starting Location = Story I
|
Starting Location = Story I
|
||||||
|
|
||||||
# Class Minimap Image offset
|
# Player Class Minimap Image offset
|
||||||
Minimap Image Offset = 12,11
|
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
|
Minimap Image Size = 12,12
|
||||||
|
|
||||||
# Starting base crit rate.
|
# Starting base crit rate.
|
||||||
|
@ -5,4 +5,7 @@ Minimap
|
|||||||
|
|
||||||
# Chunk size in tiles
|
# Chunk size in tiles
|
||||||
Chunk Size = 16
|
Chunk Size = 16
|
||||||
|
|
||||||
|
# Transparency for already explored maps when re-entering a level.
|
||||||
|
Map Explore Transparency = 80
|
||||||
}
|
}
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user