diff --git a/Adventures in Lestoria/AdventuresInLestoria.cpp b/Adventures in Lestoria/AdventuresInLestoria.cpp index f5acc998..2063b612 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.cpp +++ b/Adventures in Lestoria/AdventuresInLestoria.cpp @@ -150,6 +150,7 @@ float AiL::SIZE_CHANGE_SPEED=1; AiL::AiL() { utils::datafile::Read(DATA,"assets/config/configuration.txt"); + std::filesystem::create_directories("save_file_path"_S); _DEBUG_MAP_LOAD_INFO=bool("debug_map_load_info"_I); @@ -3552,7 +3553,6 @@ void AiL::GetAnyKeyRelease(Key key){ #pragma region New keyboard input binding listener using A=Attribute; if(Menu::IsMenuOpen()&&Menu::stack.back()==Menu::menus[NEW_INPUT]){ - if(Menu::menus[NEW_INPUT]->B(A::IS_KEYBOARD)){//We are requesting a brand new input. using A=Attribute; if(InputGroup::menuNamesToInputGroups.count(Menu::menus[NEW_INPUT]->S(A::KEYBIND))){ @@ -3607,9 +3607,6 @@ void AiL::GetAnyMouseRelease(int32_t mouseButton){ if(InputGroup::menuNamesToInputGroups.count(Menu::menus[NEW_INPUT]->S(A::KEYBIND))){ InputGroup::menuNamesToInputGroups[Menu::menus[NEW_INPUT]->S(A::KEYBIND)]->AddKeybind(Input{MOUSE,mouseButton}); Menu::alreadyClicked=true; - for(auto&[menuType,menu]:Menu::menus){ - menu->helpDisplay.Initialize(menu->inputGroups); - } Menu::CloseMenu(); } }else{ diff --git a/Adventures in Lestoria/GameSettings.cpp b/Adventures in Lestoria/GameSettings.cpp index d134d20e..327f3faa 100644 --- a/Adventures in Lestoria/GameSettings.cpp +++ b/Adventures in Lestoria/GameSettings.cpp @@ -96,7 +96,10 @@ void GameSettings::Initialize(){ std::string loadSystemFilename="save_file_path"_S+"system.conf"; - if(std::filesystem::exists(loadSystemFilename))utils::datafile::Read(loadSystemFile,loadSystemFilename); + if(std::filesystem::exists(loadSystemFilename)){ + std::cout<<"Reading system data file..."<(INPUT_KEY_DISPLAY,std::format("Input_{}_{} Input Displayer",row,col))->GetInput(); - group.SetNewPrimaryKeybind({KEY,loadSystemFile[keyName].GetInt()}); + if(loadSystemFile.HasProperty("Menu Keyboard Input_"+"Inputs.Menu Input Names"_s[inputID])){ + std::string keyName="Menu Keyboard Input_"+"Inputs.Menu Input Names"_s[inputID]; + if(loadSystemFile.HasProperty(keyName)){ + InputGroup&group=Component(INPUT_KEY_DISPLAY,std::format("Input_{}_{} Input Displayer",row,col))->GetInput(); + group.SetNewPrimaryKeybind({KEY,loadSystemFile[keyName].GetInt()}); + } } - keyName="Menu Controller Input_"+"Inputs.Menu Input Names"_s[inputID]; - if(loadSystemFile.HasProperty(keyName)){ - InputGroup&group=Component(INPUT_KEY_DISPLAY,std::format("Input_{}_{} Input Displayer",row,col))->GetInput(); - group.SetNewPrimaryKeybind({CONTROLLER,loadSystemFile[keyName].GetInt()}); + if(loadSystemFile.HasProperty("Menu Controller Input_"+"Inputs.Menu Input Names"_s[inputID])){ + std::string keyName="Menu Controller Input_"+"Inputs.Menu Input Names"_s[inputID]; + if(loadSystemFile.HasProperty(keyName)){ + InputGroup&group=Component(INPUT_KEY_DISPLAY,std::format("Input_{}_{} Input Displayer",row,col))->GetInput(); + group.SetNewPrimaryKeybind({CONTROLLER,loadSystemFile[keyName].GetInt()}); + } } } } diff --git a/Adventures in Lestoria/Key.cpp b/Adventures in Lestoria/Key.cpp index e35f3014..1fc786fa 100644 --- a/Adventures in Lestoria/Key.cpp +++ b/Adventures in Lestoria/Key.cpp @@ -197,6 +197,9 @@ InputGroup::InputGroup(){} void InputGroup::AddKeybind(Input bind){ keys.insert(bind); keyOrder.push_back(bind); + for(auto&[menuType,menu]:Menu::menus){ + menu->ReInitializeInputGroup(); + } } void InputGroup::ClearAllKeybinds(){ diff --git a/Adventures in Lestoria/SaveFile.cpp b/Adventures in Lestoria/SaveFile.cpp index e34ec230..8111480e 100644 --- a/Adventures in Lestoria/SaveFile.cpp +++ b/Adventures in Lestoria/SaveFile.cpp @@ -261,7 +261,7 @@ const void SaveFile::SaveGame(){ emscripten_idb_async_store("/assets",("save_file_path"_S+"system.conf").c_str(),systemContents.data(),systemContents.length(),0,[](void*arg){ std::cout<<"Successfully saved system file!"<