diff --git a/Adventures in Lestoria/AdventuresInLestoria.cpp b/Adventures in Lestoria/AdventuresInLestoria.cpp index d6af078e..3031493f 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.cpp +++ b/Adventures in Lestoria/AdventuresInLestoria.cpp @@ -1740,6 +1740,9 @@ void AiL::RenderHud(){ } } }; + + minimap.Update(); + minimap.Draw(); RenderAimingCursor(); @@ -1811,9 +1814,6 @@ void AiL::RenderHud(){ std::string displayText=player->notificationDisplay.first; DrawShadowStringPropDecal(vf2d{float(ScreenWidth()/2),float(ScreenHeight()/4)-24}-GetTextSizeProp(displayText)/2,displayText,BLUE,VERY_DARK_BLUE); } - - minimap.Update(); - minimap.Draw(); DisplayBossEncounterInfo(); #ifdef _DEBUG diff --git a/Adventures in Lestoria/Minimap.cpp b/Adventures in Lestoria/Minimap.cpp index 7db80998..bd47731b 100644 --- a/Adventures in Lestoria/Minimap.cpp +++ b/Adventures in Lestoria/Minimap.cpp @@ -53,17 +53,27 @@ void Minimap::Initialize(){ } mapCircleHud=ViewPort{enlargedCircle,vi2d{game->ScreenWidth()-"Minimap.Minimap HUD Size"_I-4,4}}; + enlargedCircle.clear(); + for(int i=360;i>=0;i-=4){ + float angle=util::degToRad(float(i))-PI/2; + if(i==360){enlargedCircle.push_back(vf2d{cos(angle),sin(angle)}*game->ScreenWidth()/3+game->ScreenWidth()/3);} + enlargedCircle.push_back(vf2d{cos(angle),sin(angle)}*game->ScreenWidth()/3+game->ScreenWidth()/3); + } + mapCircleLargeHud=ViewPort{enlargedCircle,vi2d{game->ScreenWidth()/2-game->ScreenWidth()/3,game->ScreenHeight()/2-game->ScreenWidth()/3}}; + } void Minimap::Reset(){ if(minimap.Sprite()==nullptr)minimap.Create(1,1); if(cover.Sprite()==nullptr)cover.Create(1,1); + if(coverOutline.Sprite()==nullptr)coverOutline.Create(1,1); Sprite baseMinimap; #pragma region Cleanup minimap and cover images minimap.Sprite()->Resize(game->GetCurrentMapData().width,game->GetCurrentMapData().height); cover.Sprite()->Resize(game->GetCurrentMapData().width,game->GetCurrentMapData().height); + coverOutline.Sprite()->Resize(game->GetCurrentMapData().width,game->GetCurrentMapData().height); baseMinimap.Resize(game->GetCurrentMapData().width,game->GetCurrentMapData().height); game->SetDrawTarget(minimap.Sprite()); game->SetPixelMode(Pixel::ALPHA); @@ -72,6 +82,8 @@ void Minimap::Reset(){ game->Clear(BLANK); game->SetDrawTarget(cover.Sprite()); game->Clear(BLANK); + game->SetDrawTarget(coverOutline.Sprite()); + game->Clear(BLANK); game->SetPixelMode(Pixel::NORMAL); //Will update the minimap decal at the end, since we are about to change it anyways. cover.Decal()->Update(); @@ -137,7 +149,11 @@ void Minimap::Reset(){ } void Minimap::Update(){ - + if(game->GetKey(TAB).bPressed){ + if(displayMode==MinimapMode::SMALL)displayMode=MinimapMode::LARGE; + else if(displayMode==MinimapMode::LARGE)displayMode=MinimapMode::OFF; + else if(displayMode==MinimapMode::OFF)displayMode=MinimapMode::SMALL; + } } void Minimap::UpdateChunk(const MapName map,const vi2d chunkPos){ @@ -153,11 +169,15 @@ void Minimap::UpdateChunk(const MapName map,const vi2d chunkPos){ //We start twice the distance we are supposed to outwards. for(int y=pixelPos.y;yGetPixel(x,y).a==255||minimap.Sprite()->GetPixel(x,y).a==0)continue; //Already revealed or invisible anyways. + 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){ - cover.Sprite()->SetPixel(x,y,minimap.Sprite()->GetPixel(x,y)); + cover.Sprite()->SetPixel(x,y,sourceCol); + if(sourceWasBlack)coverOutline.Sprite()->SetPixel(x,y,sourceCol); }else{ const vi2d chunkOffset={"Minimap.Chunk Size"_I/2,"Minimap.Chunk Size"_I/2}; @@ -166,21 +186,32 @@ 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. - Pixel sourceCol=minimap.Sprite()->GetPixel(x,y); sourceCol.a=alpha; cover.Sprite()->SetPixel(x,y,sourceCol); + if(sourceWasBlack)coverOutline.Sprite()->SetPixel(x,y,sourceCol); } } } cover.Decal()->Update(); + coverOutline.Decal()->Update(); } void Minimap::Draw(){ const vf2d minimapPos=vf2d{float("Minimap.Minimap HUD Size"_I),float("Minimap.Minimap HUD Size"_I)}/2; - if(!game->InBossEncounter())mapCircleHud.DrawRotatedDecal(minimapPos,cover.Decal(),0.f,game->GetPlayer()->GetPos()/game->GetCurrentMapData().tilewidth,vf2d{0.5f,0.5f}); - game->DrawRotatedDecal(mapCircleHud.GetOffset()+minimapPos,GFX["skill_overlay_icon.png"].Decal(),0.f,GFX["skill_overlay_icon.png"].Sprite()->Size()/2,vf2d{float("Minimap.Minimap HUD Size"_I),float("Minimap.Minimap HUD Size"_I)}/24.f*1.05f); - game->DrawRotatedDecal(mapCircleHud.GetOffset()+minimapPos,game->GetPlayer()->GetMinimapImage().Decal(),0.f,vi2d{"Player.Minimap Image Size"_i[0],"Player.Minimap Image Size"_i[1]}/2,{0.5f,0.5f}); + if(!game->InBossEncounter()){ + switch(displayMode){ + case MinimapMode::SMALL:{ + mapCircleHud.DrawRotatedDecal(minimapPos,cover.Decal(),0.f,game->GetPlayer()->GetPos()/game->GetCurrentMapData().tilewidth,vf2d{0.5f,0.5f}); + game->DrawRotatedDecal(mapCircleHud.GetOffset()+minimapPos,GFX["skill_overlay_icon.png"].Decal(),0.f,GFX["skill_overlay_icon.png"].Sprite()->Size()/2,vf2d{float("Minimap.Minimap HUD Size"_I),float("Minimap.Minimap HUD Size"_I)}/24.f*1.05f); + game->DrawRotatedDecal(mapCircleHud.GetOffset()+minimapPos,game->GetPlayer()->GetMinimapImage().Decal(),0.f,vi2d{"Player.Minimap Image Size"_i[0],"Player.Minimap Image Size"_i[1]}/2,{0.5f,0.5f}); + }break; + case MinimapMode::LARGE:{ + mapCircleLargeHud.DrawRotatedDecal(vf2d{game->ScreenWidth()/3.f,game->ScreenWidth()/3.f},coverOutline.Decal(),0.f,game->GetPlayer()->GetPos()/game->GetCurrentMapData().tilewidth,vf2d{2.f,2.f},{255,255,255,48}); + }break; + case MinimapMode::OFF:{}break; + } + } } void Minimap::EraseChunkData(){ diff --git a/Adventures in Lestoria/Minimap.h b/Adventures in Lestoria/Minimap.h index 0f9fec52..42800062 100644 --- a/Adventures in Lestoria/Minimap.h +++ b/Adventures in Lestoria/Minimap.h @@ -39,6 +39,12 @@ All rights reserved. #include "olcPGEX_ViewPort.h" +enum class MinimapMode{ + SMALL, + LARGE, + OFF, +}; + class Minimap{ public: void Initialize(); @@ -52,7 +58,10 @@ public: const std::unordered_map>&GetChunkData(); private: ViewPort mapCircleHud; + ViewPort mapCircleLargeHud; Renderable minimap; Renderable cover; + Renderable coverOutline; std::unordered_map>loadedChunks; + MinimapMode displayMode=MinimapMode::SMALL; }; \ No newline at end of file diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index cf9e0f83..4ee46cfb 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 8851 +#define VERSION_BUILD 8868 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index dc94a93b..1a8a8162 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ