diff --git a/Adventures in Lestoria/AdventuresInLestoria.cpp b/Adventures in Lestoria/AdventuresInLestoria.cpp index 8ae99045..286dac42 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.cpp +++ b/Adventures in Lestoria/AdventuresInLestoria.cpp @@ -2281,9 +2281,6 @@ bool AiL::IsReflectiveTile(TilesheetData tileSheet,int tileID){ } bool AiL::OnUserDestroy(){ - if(GameState::STATE!=GameState::states[States::MAIN_MENU]){ //If we're on the main menu, we don't have a save file loaded. So we would skip saving the game. - SaveFile::SaveGame(); - } GFX.Reset(); for(auto&[key,value]:MAP_DATA){ if(MAP_DATA[key].optimizedTile!=nullptr){ @@ -2904,6 +2901,7 @@ void AiL::ResetGame(){ Unlock::Initialize(); State_OverworldMap::SetStageMarker("Stage I-I"); State_OverworldMap::UpdateCurrentConnectionPoint(*State_OverworldMap::currentConnectionPoint); + State_OverworldMap::ResetConnectionPoints(); SetChapter(1); SaveFile::SetSaveFileName(""); } diff --git a/Adventures in Lestoria/ConnectionPoint.cpp b/Adventures in Lestoria/ConnectionPoint.cpp index bf81353e..c85cb83a 100644 --- a/Adventures in Lestoria/ConnectionPoint.cpp +++ b/Adventures in Lestoria/ConnectionPoint.cpp @@ -45,4 +45,12 @@ bool ConnectionPoint::IsNeighbor(ConnectionPoint&testPoint){ } } return false; +} + +void ConnectionPoint::SetVisited(){ + visited=true; +} + +const bool ConnectionPoint::Visited()const{ + return visited; } \ No newline at end of file diff --git a/Adventures in Lestoria/ConnectionPoint.h b/Adventures in Lestoria/ConnectionPoint.h index e58eafa1..e1e49c01 100644 --- a/Adventures in Lestoria/ConnectionPoint.h +++ b/Adventures in Lestoria/ConnectionPoint.h @@ -52,6 +52,7 @@ struct ConnectionPoint{ std::string name; std::string map; std::string unlockCondition; + bool visited=false; std::arrayneighbors; //Indices into the connectionPoint array. std::vectorspawns; bool levelDataExists=false; @@ -60,4 +61,8 @@ struct ConnectionPoint{ neighbors.fill(-1); } bool IsNeighbor(ConnectionPoint&testPoint); + //Sets the visited flag to true. + void SetVisited(); + //Whether or not this connection point has been visited yet. + const bool Visited()const; }; diff --git a/Adventures in Lestoria/SaveFile.cpp b/Adventures in Lestoria/SaveFile.cpp index bb0be149..cf13b2bc 100644 --- a/Adventures in Lestoria/SaveFile.cpp +++ b/Adventures in Lestoria/SaveFile.cpp @@ -94,6 +94,15 @@ const void SaveFile::SaveGame(){ } for(const std::string&unlockName:Unlock::unlocks){ saveFile["Unlocks"][unlockName].SetString("True"); + if(unlockName=="WORLD_MAP")continue; //This is a special exception, because the world map is not an actual stage. + + auto opt_cp=State_OverworldMap::ConnectionPointFromString(unlockName); + if(!opt_cp.has_value())ERR(std::format("WARNING! Could not find connection point {}! THIS SHOULD NOT BE HAPPENING! Potential invalid unlock name.",unlockName)); + if(opt_cp.value()->Visited()){ + saveFile["Unlocks"][unlockName].SetString("True",1U); + }else{ + saveFile["Unlocks"][unlockName].SetString("False",1U); + } } saveFile["Overworld Map Location"].SetString(State_OverworldMap::GetCurrentConnectionPoint().name); saveFile["Chapter"].SetInt(game->GetCurrentChapter()); @@ -167,6 +176,11 @@ const void SaveFile::LoadGame(){ } for(const auto&[key,data]:loadFile["Unlocks"].GetOrderedKeys()){ Unlock::UnlockArea(key); + if(data.GetValueCount()>1&&data.GetBool(1U)){ + auto opt_cp=State_OverworldMap::ConnectionPointFromString(key); + if(!opt_cp.has_value())ERR(std::format("WARNING! Could not find connection point {}! THIS SHOULD NOT BE HAPPENING! Potential invalid unlock name.",key)); + opt_cp.value()->SetVisited(); + } } State_OverworldMap::SetStageMarker(loadFile["Overworld Map Location"].GetString()); State_OverworldMap::UpdateCurrentConnectionPoint(const_cast(State_OverworldMap::GetCurrentConnectionPoint())); diff --git a/Adventures in Lestoria/State_OverworldMap.cpp b/Adventures in Lestoria/State_OverworldMap.cpp index ca9ead7f..7e637ffb 100644 --- a/Adventures in Lestoria/State_OverworldMap.cpp +++ b/Adventures in Lestoria/State_OverworldMap.cpp @@ -180,6 +180,12 @@ void State_OverworldMap::Draw(AiL*game){ for(ConnectionPoint&cp:connections){ if(!Unlock::IsUnlocked(cp)){ game->view.FillRectDecal(cp.rect.pos,cp.rect.size,{0,0,0,128}); + }else{ + float exclamationScale=fmod(game->GetRuntime(),1.0f)<0.2f?1.f:1.2f; + if(!cp.Visited()){ + game->view.DrawDecal(cp.rect.pos+vf2d{-1.f,0.f},GFX["exclamation.png"].Decal(),{exclamationScale,exclamationScale},BLACK); + game->view.DrawDecal(cp.rect.pos+vf2d{-1.f,-1.f},GFX["exclamation.png"].Decal(),{exclamationScale,exclamationScale}); + } } } for(ConnectionPoint&cp:connections){ @@ -248,6 +254,7 @@ ConnectionPoint&State_OverworldMap::GetCurrentConnectionPoint(){ void State_OverworldMap::StartLevel(){ game->UpdateDiscordStatus(State_OverworldMap::GetCurrentConnectionPoint().name,game->GetPlayer()->GetClassName()); + State_OverworldMap::GetCurrentConnectionPoint().SetVisited(); SaveFile::SaveGame(); if(State_OverworldMap::GetCurrentConnectionPoint().map.starts_with("STORY")){ VisualNovel::LoadVisualNovel(State_OverworldMap::GetCurrentConnectionPoint().map); @@ -264,4 +271,16 @@ void State_OverworldMap::UpdateCurrentConnectionPoint(const ConnectionPoint&conn Component(OVERWORLD_LEVEL_SELECT,"Spawns List")->UpdateSpawns(currentConnectionPoint->spawns); Component(OVERWORLD_LEVEL_SELECT,"Enter Button")->Enable(currentConnectionPoint->levelDataExists); Component(OVERWORLD_LEVEL_SELECT,"Change Loadout Button")->Enable(currentConnectionPoint->levelDataExists&&!(currentConnectionPoint->type=="STORY"||currentConnectionPoint->type=="SHOP")); +} + +std::optionalState_OverworldMap::ConnectionPointFromString(std::string_view mapName){ + auto foundItem=std::find_if(connections.begin(),connections.end(),[&](ConnectionPoint&cp){return cp.map==mapName;}); + if(foundItem!=connections.end())return &*foundItem; + return {}; +} + +void State_OverworldMap::ResetConnectionPoints(){ + for(ConnectionPoint&cp:connections){ + cp.visited=false; + } } \ No newline at end of file diff --git a/Adventures in Lestoria/State_OverworldMap.h b/Adventures in Lestoria/State_OverworldMap.h index c05a4401..9f28d4d4 100644 --- a/Adventures in Lestoria/State_OverworldMap.h +++ b/Adventures in Lestoria/State_OverworldMap.h @@ -54,6 +54,8 @@ public: static ConnectionPoint&GetCurrentConnectionPoint(); static void SetStageMarker(std::string connectionName); static ConnectionPoint&ConnectionPointFromIndex(int ind); + static std::optionalConnectionPointFromString(std::string_view mapName); + static void ResetConnectionPoints(); virtual void OnStateChange(GameState*prevState)override final; virtual void OnUserUpdate(AiL*game)override final; virtual void Draw(AiL*game)override final; diff --git a/Adventures in Lestoria/TODO.txt b/Adventures in Lestoria/TODO.txt index 71ccfe83..44ab0176 100644 --- a/Adventures in Lestoria/TODO.txt +++ b/Adventures in Lestoria/TODO.txt @@ -15,7 +15,7 @@ Settings Menu - Stage Loot Config - Initial Crafting of Gear. -- Experience point changes +- XP Bar January 31st ============ diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index f149c15a..206a81de 100644 --- a/Adventures in Lestoria/Version.h +++ b/Adventures in Lestoria/Version.h @@ -39,7 +39,7 @@ All rights reserved. #define VERSION_MAJOR 0 #define VERSION_MINOR 3 #define VERSION_PATCH 0 -#define VERSION_BUILD 6225 +#define VERSION_BUILD 6234 #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 82c5f091..61c6f026 100644 --- a/Adventures in Lestoria/assets/config/Player.txt +++ b/Adventures in Lestoria/assets/config/Player.txt @@ -54,7 +54,7 @@ Player } -Player XP +PlayerXP { LEVEL[1] = 224xp LEVEL[2] = 605xp