diff --git a/Adventures in Lestoria/AdventuresInLestoria.cpp b/Adventures in Lestoria/AdventuresInLestoria.cpp index c3121301..2e6b63d9 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.cpp +++ b/Adventures in Lestoria/AdventuresInLestoria.cpp @@ -353,6 +353,8 @@ bool AiL::OnUserCreate(){ SetupDiscord(); #endif + minimap.Initialize(); + gameInitialized=true; if(!gamepack.Loaded()&&"GENERATE_GAMEPACK"_B){ @@ -2228,7 +2230,7 @@ void AiL::_PrepareLevel(MapName map,MusicChange changeMusic){ #pragma region Foreground and Upper Foreground Tile Fade Group Setup (Loading phase 3.5) LoadingScreen::AddPhase([&](){ - minimap.Initialize(); + minimap.Reset(); return true; }); #pragma endregion @@ -2533,7 +2535,7 @@ TilesheetData AiL::GetTileSheet(MapName map,int tileID){ size_t slashMarkerSourceDir = tileData[tileData.size()-1].data["source"].find_last_of('/'); std::string baseSourceDir=tileData[tileData.size()-1].data["source"].substr(slashMarkerSourceDir+1); int firstgid=stoi(tileData[tileData.size()-1].data["firstgid"]); - return {&MAP_TILESETS["assets/maps/"+baseSourceDir],firstgid,MAP_TILESETS["assets/maps/"+baseSourceDir].tilecols[tileID-firstgid]}; + return {&MAP_TILESETS["assets/maps/"+baseSourceDir],firstgid,MAP_TILESETS["assets/maps/"+baseSourceDir].tilecols[tileID-(firstgid-1)]}; } } diff --git a/Adventures in Lestoria/AdventuresInLestoria.h b/Adventures in Lestoria/AdventuresInLestoria.h index 0d1d0558..5add30c5 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.h +++ b/Adventures in Lestoria/AdventuresInLestoria.h @@ -75,6 +75,7 @@ class AiL : public olc::PixelGameEngine friend class SaveFile; friend class sig::Animation; friend class Audio; + friend class Minimap; std::unique_ptrplayer; SplashScreen splash; public: diff --git a/Adventures in Lestoria/Minimap.cpp b/Adventures in Lestoria/Minimap.cpp index 68e824d6..eb7fb147 100644 --- a/Adventures in Lestoria/Minimap.cpp +++ b/Adventures in Lestoria/Minimap.cpp @@ -44,6 +44,17 @@ All rights reserved. INCLUDE_game void Minimap::Initialize(){ + std::vectorenlargedCircle; + 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)}*"Minimap.Minimap HUD Size"_I+"Minimap.Minimap HUD Size"_I);} + enlargedCircle.push_back(vf2d{cos(angle),sin(angle)}*"Minimap.Minimap HUD Size"_I+"Minimap.Minimap HUD Size"_I); + } + mapCircleHud=ViewPort{enlargedCircle}; + +} + +void Minimap::Reset(){ loadedChunks.clear(); if(minimap.Sprite()==nullptr)minimap.Create(1,1); @@ -156,11 +167,11 @@ void Minimap::UpdateChunk(const vi2d chunkPos){ } cover.Decal()->Update(); - - LOG(std::format("Chunk {}_{} Revealed",chunkPos.x,chunkPos.y)<DrawDecal(vf2d{float(game->ScreenWidth()-cover.Sprite()->width),0},cover.Decal()); + mapCircleHud.DrawRotatedDecal(vf2d{"Minimap.Minimap HUD Size"_I/2.f,"Minimap.Minimap HUD Size"_I/2.f},cover.Decal(),0.f,game->GetPlayer()->GetPos()/24); + mapCircleHud.DrawStringDecal({0,0},"Hello World! Hello World! Hello World! Hello World! \nHello World! Hello World! Hello World! Hello World! \nHello World! Hello World! Hello World! "); + mapCircleHud.drawEdges(); } \ No newline at end of file diff --git a/Adventures in Lestoria/Minimap.h b/Adventures in Lestoria/Minimap.h index 1d2f33a6..e17e387b 100644 --- a/Adventures in Lestoria/Minimap.h +++ b/Adventures in Lestoria/Minimap.h @@ -37,14 +37,18 @@ All rights reserved. #pragma endregion #pragma once +#include "olcPGEX_ViewPort.h" + class Minimap{ public: void Initialize(); + void Reset(); void Update(); void Draw(); void UpdateChunk(const vi2d chunkPos); private: + ViewPort mapCircleHud; Renderable minimap; Renderable cover; std::unordered_setloadedChunks; diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index aacd07de..d2006157 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 8781 +#define VERSION_BUILD 8815 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Adventures in Lestoria/assets/config/minimap.txt b/Adventures in Lestoria/assets/config/minimap.txt index c492bcbf..9117fc65 100644 --- a/Adventures in Lestoria/assets/config/minimap.txt +++ b/Adventures in Lestoria/assets/config/minimap.txt @@ -1,5 +1,8 @@ Minimap { + # Minimap Hud Size + Minimap HUD Size = 48 + # Chunk size in tiles Chunk Size = 16 } \ No newline at end of file diff --git a/Adventures in Lestoria/assets/maps/End_of_Map.tmx b/Adventures in Lestoria/assets/maps/End_of_Map.tmx index a04bfac7..1d1497fc 100644 --- a/Adventures in Lestoria/assets/maps/End_of_Map.tmx +++ b/Adventures in Lestoria/assets/maps/End_of_Map.tmx @@ -1,5 +1,5 @@ - + diff --git a/Adventures in Lestoria/olcPGEX_ViewPort.h b/Adventures in Lestoria/olcPGEX_ViewPort.h index 40c4c303..c2c43205 100644 --- a/Adventures in Lestoria/olcPGEX_ViewPort.h +++ b/Adventures in Lestoria/olcPGEX_ViewPort.h @@ -17,7 +17,7 @@ namespace olc { public: ViewPort(); ViewPort(std::vector vertices, vf2d offset = {0, 0}); - geom2d::rectrect; + geom2d::rectrect{}; virtual ~ViewPort(); void addPoint(vf2d point); void clear(); @@ -533,16 +533,18 @@ void olc::ViewPort::drawClippedDecal(Decal *decal, vf2d min={std::numeric_limits::max(),std::numeric_limits::max()},max; bool pointsOutside=false; - for(vf2d&points:outputList){ - if(!geom2d::contains(rect,points)){ - pointsOutside=true; - break; + if(rect!=geom2d::rect{}){ + for(vf2d&points:outputList){ + if(!geom2d::contains(rect,points)){ + pointsOutside=true; + break; + } } - } + }else{pointsOutside=true;} if(!pointsOutside)goto render; for (auto i = 0u; i < clipVertices.size(); i++) { auto clipA = clipVertices[i]; - auto clipB = clipVertices[(i + 1) % 4]; + auto clipB = clipVertices[(i + 1) % clipVertices.size()]; auto inputList{outputList}; auto inputUvs{outputUvs}; diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index cd9c5ba9..a6018878 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ