diff --git a/Adventures in Lestoria/Bear.cpp b/Adventures in Lestoria/Bear.cpp index 86ad1e00..e1b39da8 100644 --- a/Adventures in Lestoria/Bear.cpp +++ b/Adventures in Lestoria/Bear.cpp @@ -88,14 +88,14 @@ void Monster::STRATEGY::BEAR(Monster&m,float fElapsedTime,std::string strategy){ if(geom2d::overlaps(attackCircle,game->GetPlayer()->Hitbox())){ if(game->GetPlayer()->Hurt(m.GetAttack(),m.OnUpperLevel(),0.f)){ game->GetPlayer()->Knockup(ConfigFloat("Attack Knockup Duration")); - vf2d playerDirVecNorm=geom2d::line(m.V(A::LOCKON_POS),game->GetPlayer()->GetPos()).vector().norm(); + vf2d playerDirVecNorm=geom2d::line(m.GetPos(),game->GetPlayer()->GetPos()).vector().norm(); game->GetPlayer()->Knockback(playerDirVecNorm*ConfigFloat("Attack Knockback Amount")); } } for(Monster&otherM:MONSTER_LIST){ if(!otherM.AttackAvoided(m.GetZ())&&&m!=&otherM&&geom2d::overlaps(attackCircle,otherM.Hitbox())){ otherM.Knockup(ConfigFloat("Attack Knockup Duration")); - vf2d monsterDirVecNorm=geom2d::line(m.V(A::LOCKON_POS),otherM.GetPos()).vector().norm(); + vf2d monsterDirVecNorm=geom2d::line(m.GetPos(),otherM.GetPos()).vector().norm(); game->GetPlayer()->Knockback(monsterDirVecNorm*ConfigFloat("Attack Knockback Amount")); } } diff --git a/Adventures in Lestoria/SaveFile.cpp b/Adventures in Lestoria/SaveFile.cpp index 645cb771..78a5196d 100644 --- a/Adventures in Lestoria/SaveFile.cpp +++ b/Adventures in Lestoria/SaveFile.cpp @@ -124,35 +124,37 @@ const void SaveFile::SaveGame(){ utils::datafile::INITIAL_SETUP_COMPLETE=true; #ifdef __EMSCRIPTEN__ - std::stringstream fileContents; - std::ifstream file("save_file_path"_S+std::format("save.{:04}",saveFileID)); - while(file.good()){ - int val=file.get(); - if(val!=-1){ - fileContents<RetryResponse; - RetryResponse=[&](std::string_view response){ - if(response!="ERR"){ - Server_SaveFile([](std::string_view response){ - if(response=="ERR"){ - std::cout<<"WARNING! Could not save data to server!"<RetryResponse; + RetryResponse=[&](std::string_view response){ + if(response!="ERR"){ + Server_SaveFile([](std::string_view response){ + if(response=="ERR"){ + std::cout<<"WARNING! Could not save data to server!"<(LOAD_GAME,"Game Files List"); + gameFilesList->RemoveAllComponents(); + if(SaveFile::IsOnline()){ + const size_t saveFileCount=GetSaveFileCount(); + utils::datafile metadata; + if(!std::filesystem::exists("save_file_path"_S+"metadata.dat")){ + utils::datafile::Write(metadata,"save_file_path"_S+"metadata.dat"); + } + utils::datafile::Read(metadata,"save_file_path"_S+"metadata.dat"); + float offsetY=0; + for(size_t i=0;iADD(std::format("Load File Button - Save {}",i),LoadFileButton)(geom2d::rect{{0,offsetY},{gameFilesList->GetSize().x-13,48}},metadata[std::format("save{}",i)],i,[](MenuFuncData data){ + std::weak_ptrcomp=DYNAMIC_POINTER_CAST(data.component.lock()); + saveFileID=comp.lock()->getSaveFileID(); + SaveFile::LoadGame(); + return true; + },ButtonAttr::NONE)END; + offsetY+=49; + } + } + } + }; LoadMetadataFile(); @@ -337,7 +363,7 @@ const void SaveFile::Server_GetFile(std::functionrespCal } const void SaveFile::Server_SaveFile(std::functionrespCallbackFunc){ std::stringstream fileContents; - std::ifstream file("save_file_path"_S+std::format("save.{:04}",saveFileID)); + std::ifstream file("save_file_path"_S+std::format("save.{:04}",saveFileID)+"_online"); while(file.good()){ int val=file.get(); if(val!=-1){ @@ -349,21 +375,19 @@ const void SaveFile::Server_SaveFile(std::functionrespCa } const void SaveFile::Server_SaveMetadataFile(std::functionrespCallbackFunc){ std::stringstream fileContents; - std::ifstream file("save_file_path"_S+"metadata.dat"); + std::ifstream file("save_file_path"_S+"metadata.dat"+"_online"); while(file.good()){ int val=file.get(); if(val!=-1){ fileContents<SendRequest("save_server"_S,CreateServerRequest(SaveFileOperation::SAVE_METADATA_FILE,fileContents.str())); game->responseCallback=respCallbackFunc; } @@ -375,6 +399,10 @@ const void SaveFile::SetUserID(std::string_view userID){ SaveFile::username=userID; } -bool SaveFile::IsOnline(){ +const bool SaveFile::IsOnline(){ return onlineMode; +} + +void SaveFile::SetOnlineMode(bool online){ + onlineMode=online; } \ No newline at end of file diff --git a/Adventures in Lestoria/SaveFile.h b/Adventures in Lestoria/SaveFile.h index 78fc7968..a907d8f1 100644 --- a/Adventures in Lestoria/SaveFile.h +++ b/Adventures in Lestoria/SaveFile.h @@ -57,7 +57,8 @@ public: static const std::string_view GetSaveFileName(); static const void SetSaveFileName(std::string_view saveFileName); static const size_t GetSaveFileCount(); - static bool IsOnline(); + static const bool IsOnline(); + static void SetOnlineMode(bool online); static const std::string_view GetUserID(); static const void SetUserID(std::string_view userID); static const void SaveGame(); diff --git a/Adventures in Lestoria/assets/config/MonsterStrategies.txt b/Adventures in Lestoria/assets/config/MonsterStrategies.txt index 399fb69e..0292aceb 100644 --- a/Adventures in Lestoria/assets/config/MonsterStrategies.txt +++ b/Adventures in Lestoria/assets/config/MonsterStrategies.txt @@ -334,6 +334,15 @@ MonsterStrategy # Maximum amount of time the boss takes to run towards the center before giving up and continuing through Phase 2. Run to Center Time = 10.0s + + # Number of stomps to perform before doing a run towards the player. + Stomp Count = 3 + + # Amount of time to run towards the player. + Run Time = 2.0s + + # Provide a speed boost amount during the run. + Run Speed Boost = 0% } Phase 2 { @@ -419,6 +428,15 @@ MonsterStrategy # Amount of knockback to cause to the player when hit by the charging attack. Charge Attack Knockback Strength = 3.5 + + # Number of stomps to perform before doing a run towards the player. + Stomp Count = 3 + + # Amount of time to run towards the player. + Run Time = 2.0s + + # Provide a speed boost amount during the run. + Run Speed Boost = 0% } Phase 4 { diff --git a/Adventures in Lestoria/assets/monsters/Ursule Mother of Bears2.png b/Adventures in Lestoria/assets/monsters/Ursule Mother of Bears2.png index 0e8d67cb..3878ad20 100644 Binary files a/Adventures in Lestoria/assets/monsters/Ursule Mother of Bears2.png and b/Adventures in Lestoria/assets/monsters/Ursule Mother of Bears2.png differ diff --git a/Adventures in Lestoria/assets/monsters/Ursule, Mother of Bears.png b/Adventures in Lestoria/assets/monsters/Ursule, Mother of Bears.png index 833bbe4b..6eff7c77 100644 Binary files a/Adventures in Lestoria/assets/monsters/Ursule, Mother of Bears.png and b/Adventures in Lestoria/assets/monsters/Ursule, Mother of Bears.png differ