Added visited connection point alerts to stage plates. Removed save on window close (Deciding that saving the game at smart locations when the game is in a known good state is a better idea). Player XP config fixed.

pull/35/head
sigonasr2 1 year ago
parent 6907b35e16
commit 8a1689cb07
  1. 4
      Adventures in Lestoria/AdventuresInLestoria.cpp
  2. 8
      Adventures in Lestoria/ConnectionPoint.cpp
  3. 5
      Adventures in Lestoria/ConnectionPoint.h
  4. 14
      Adventures in Lestoria/SaveFile.cpp
  5. 19
      Adventures in Lestoria/State_OverworldMap.cpp
  6. 2
      Adventures in Lestoria/State_OverworldMap.h
  7. 2
      Adventures in Lestoria/TODO.txt
  8. 2
      Adventures in Lestoria/Version.h
  9. 2
      Adventures in Lestoria/assets/config/Player.txt

@ -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("");
}

@ -46,3 +46,11 @@ bool ConnectionPoint::IsNeighbor(ConnectionPoint&testPoint){
}
return false;
}
void ConnectionPoint::SetVisited(){
visited=true;
}
const bool ConnectionPoint::Visited()const{
return visited;
}

@ -52,6 +52,7 @@ struct ConnectionPoint{
std::string name;
std::string map;
std::string unlockCondition;
bool visited=false;
std::array<int,8>neighbors; //Indices into the connectionPoint array.
std::vector<std::string>spawns;
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;
};

@ -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<ConnectionPoint&>(State_OverworldMap::GetCurrentConnectionPoint()));

@ -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);
@ -265,3 +272,15 @@ void State_OverworldMap::UpdateCurrentConnectionPoint(const ConnectionPoint&conn
Component<MenuComponent>(OVERWORLD_LEVEL_SELECT,"Enter Button")->Enable(currentConnectionPoint->levelDataExists);
Component<MenuComponent>(OVERWORLD_LEVEL_SELECT,"Change Loadout Button")->Enable(currentConnectionPoint->levelDataExists&&!(currentConnectionPoint->type=="STORY"||currentConnectionPoint->type=="SHOP"));
}
std::optional<ConnectionPoint*>State_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;
}
}

@ -54,6 +54,8 @@ public:
static ConnectionPoint&GetCurrentConnectionPoint();
static void SetStageMarker(std::string connectionName);
static ConnectionPoint&ConnectionPointFromIndex(int ind);
static std::optional<ConnectionPoint*>ConnectionPointFromString(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;

@ -15,7 +15,7 @@ Settings Menu
- Stage Loot Config
- Initial Crafting of Gear.
- Experience point changes
- XP Bar
January 31st
============

@ -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

@ -54,7 +54,7 @@ Player
}
Player XP
PlayerXP
{
LEVEL[1] = 224xp
LEVEL[2] = 605xp

Loading…
Cancel
Save