diff --git a/Adventures in Lestoria/AdventuresInLestoria.cpp b/Adventures in Lestoria/AdventuresInLestoria.cpp index 3031493f..6d927949 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.cpp +++ b/Adventures in Lestoria/AdventuresInLestoria.cpp @@ -146,6 +146,8 @@ InputGroup AiL::KEY_SHOULDER2; InputGroup AiL::KEY_CHANGE_LOADOUT; InputGroup AiL::KEY_MOUSE_RIGHT; +InputGroup AiL::KEY_TOGGLE_MAP; + #ifndef __EMSCRIPTEN__ ::discord::Core*Discord{}; #endif @@ -2770,14 +2772,24 @@ bool Steam_Init(){ int main() { - #ifndef __EMSCRIPTEN__ - if(SteamAPI_RestartAppIfNecessary(2895980U))return false; //Immediately quit if steam is detected and can be started through it. - if(Steam_Init()){ - LOG("Steam API Initialized successfully!"); - }else{ - LOG("Steam API failed to initialize!"); + if(!std::filesystem::exists("assets/config/configuration.txt")){ + ERR("WARNING! Could not find initial config file! Aborting."); + return false; + } + { + utils::datafile configFile; + utils::datafile::Read(configFile,"assets/config/configuration.txt"); + if(configFile["steam_api"].GetBool()){ + #ifndef __EMSCRIPTEN__ + if(SteamAPI_RestartAppIfNecessary(2895980U))return false; //Immediately quit if steam is detected and can be started through it. + if(Steam_Init()){ + LOG("Steam API Initialized successfully!"); + }else{ + LOG("Steam API failed to initialize!"); + } + #endif } - #endif + } { AiL demo; @@ -3169,6 +3181,10 @@ void AiL::InitializeDefaultKeybinds(){ KEY_UNEQUIP.AddKeybind({CONTROLLER,static_cast(GPButtons::FACE_U)}); KEY_FACEDOWN.AddKeybind({STEAM,Steam::FUNCTION_1}); + KEY_TOGGLE_MAP.AddKeybind({KEY,TAB}); + KEY_TOGGLE_MAP.AddKeybind({CONTROLLER,static_cast(GPButtons::R3)}); + KEY_TOGGLE_MAP.AddKeybind({STEAM,Steam::TOGGLE_MAP}); + KEY_MOUSE_RIGHT.AddKeybind({MOUSE,Mouse::RIGHT}); #define TieMenuNameToMenuInputGroup(KEY_NAME) \ @@ -3196,6 +3212,7 @@ void AiL::InitializeDefaultKeybinds(){ TieMenuNameToGameplayInputGroup(Player::KEY_ITEM1); TieMenuNameToGameplayInputGroup(Player::KEY_ITEM2); TieMenuNameToGameplayInputGroup(Player::KEY_ITEM3); + TieMenuNameToGameplayInputGroup(KEY_TOGGLE_MAP); InputGroup::menuNamesToInputGroups.SetInitialized(); } @@ -3740,7 +3757,7 @@ void AiL::UpdateDiscordStatus(std::string levelName,std::string className){ } SteamFriends()->SetRichPresence("steam_display","#Status"); }else{ - if(Steam_Init()){ + if("steam_api"_B&&Steam_Init()){ retry=true; LOG("Steam API Initialized successfully!"); } @@ -3786,6 +3803,7 @@ void AiL::ResetGame(bool changeToMainMenu){ SetChapter(1); SaveFile::SetSaveFileName(""); Tutorial::Initialize(); + minimap.SetMinimapMode(MinimapMode::SMALL); minimap.EraseChunkData(); } diff --git a/Adventures in Lestoria/AdventuresInLestoria.h b/Adventures in Lestoria/AdventuresInLestoria.h index 5add30c5..3f0aae6f 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.h +++ b/Adventures in Lestoria/AdventuresInLestoria.h @@ -123,6 +123,8 @@ public: static InputGroup KEY_MOUSE_RIGHT; + static InputGroup KEY_TOGGLE_MAP; + static float SIZE_CHANGE_SPEED; double levelTime=0.; Camera2D camera; diff --git a/Adventures in Lestoria/InputKeyboardWindow.cpp b/Adventures in Lestoria/InputKeyboardWindow.cpp index 0912c3a8..34e6a6f4 100644 --- a/Adventures in Lestoria/InputKeyboardWindow.cpp +++ b/Adventures in Lestoria/InputKeyboardWindow.cpp @@ -239,15 +239,21 @@ void Menu::InitializeKeyboardInputWindow(){ }}, {"Input_3_1 Gameplay Input Displayer",{ .up="Input_2_1 Gameplay Input Displayer", - .down="Confirm Button", + .down="Input_4_1 Gameplay Input Displayer", .left="Input_3_0 Gameplay Input Displayer", .right="Input_3_0 Gameplay Input Displayer", }}, {"Input_4_0 Gameplay Input Displayer",{ .up="Input_3_0 Gameplay Input Displayer", .down="Confirm Button", - .left="Input_3_1 Gameplay Input Displayer", - .right="Input_3_1 Gameplay Input Displayer", + .left="Input_4_1 Gameplay Input Displayer", + .right="Input_4_1 Gameplay Input Displayer", + }}, + {"Input_4_1 Gameplay Input Displayer",{ + .up="Input_3_1 Gameplay Input Displayer", + .down="Confirm Button", + .left="Input_4_0 Gameplay Input Displayer", + .right="Input_4_0 Gameplay Input Displayer", }}, {"Confirm Button",{ .up="Input_4_0 Gameplay Input Displayer", diff --git a/Adventures in Lestoria/Key.cpp b/Adventures in Lestoria/Key.cpp index 0e5addb8..9be91d25 100644 --- a/Adventures in Lestoria/Key.cpp +++ b/Adventures in Lestoria/Key.cpp @@ -171,6 +171,7 @@ void Input::Initialize(){ enumToActionName[i][Steam::LOCK_UNLOCK_ACC]={"Lock/Unlock_Accessory",{}}; enumToActionName[i][Steam::FAST_SCROLL_UP]={"Fast_Scroll_Up",{}}; enumToActionName[i][Steam::FAST_SCROLL_DOWN]={"Fast_Scroll_Down",{}}; + enumToActionName[i][Steam::TOGGLE_MAP]={"Toggle_Map",{}}; } } diff --git a/Adventures in Lestoria/Key.h b/Adventures in Lestoria/Key.h index db59e1c8..978f15b3 100644 --- a/Adventures in Lestoria/Key.h +++ b/Adventures in Lestoria/Key.h @@ -92,6 +92,7 @@ namespace Steam{ LOCK_UNLOCK_ACC, FAST_SCROLL_UP, FAST_SCROLL_DOWN, + TOGGLE_MAP, }; }; diff --git a/Adventures in Lestoria/Minimap.cpp b/Adventures in Lestoria/Minimap.cpp index bd47731b..b743ae96 100644 --- a/Adventures in Lestoria/Minimap.cpp +++ b/Adventures in Lestoria/Minimap.cpp @@ -149,7 +149,7 @@ void Minimap::Reset(){ } void Minimap::Update(){ - if(game->GetKey(TAB).bPressed){ + if(game->KEY_TOGGLE_MAP.Pressed()){ if(displayMode==MinimapMode::SMALL)displayMode=MinimapMode::LARGE; else if(displayMode==MinimapMode::LARGE)displayMode=MinimapMode::OFF; else if(displayMode==MinimapMode::OFF)displayMode=MinimapMode::SMALL; @@ -202,12 +202,12 @@ void Minimap::Draw(){ if(!game->InBossEncounter()){ switch(displayMode){ case MinimapMode::SMALL:{ - mapCircleHud.DrawRotatedDecal(minimapPos,cover.Decal(),0.f,game->GetPlayer()->GetPos()/game->GetCurrentMapData().tilewidth,vf2d{0.5f,0.5f}); + mapCircleHud.DrawRotatedDecal(minimapPos,cover.Decal(),0.f,game->camera.GetPosition()/game->GetCurrentMapData().tilewidth,vf2d{0.5f,0.5f}); game->DrawRotatedDecal(mapCircleHud.GetOffset()+minimapPos,GFX["skill_overlay_icon.png"].Decal(),0.f,GFX["skill_overlay_icon.png"].Sprite()->Size()/2,vf2d{float("Minimap.Minimap HUD Size"_I),float("Minimap.Minimap HUD Size"_I)}/24.f*1.05f); game->DrawRotatedDecal(mapCircleHud.GetOffset()+minimapPos,game->GetPlayer()->GetMinimapImage().Decal(),0.f,vi2d{"Player.Minimap Image Size"_i[0],"Player.Minimap Image Size"_i[1]}/2,{0.5f,0.5f}); }break; case MinimapMode::LARGE:{ - mapCircleLargeHud.DrawRotatedDecal(vf2d{game->ScreenWidth()/3.f,game->ScreenWidth()/3.f},coverOutline.Decal(),0.f,game->GetPlayer()->GetPos()/game->GetCurrentMapData().tilewidth,vf2d{2.f,2.f},{255,255,255,48}); + mapCircleLargeHud.DrawRotatedDecal(vf2d{game->ScreenWidth()/3.f,game->ScreenWidth()/3.f},coverOutline.Decal(),0.f,game->camera.GetPosition()/game->GetCurrentMapData().tilewidth,vf2d{2.f,2.f},{255,255,255,48}); }break; case MinimapMode::OFF:{}break; } @@ -220,4 +220,12 @@ void Minimap::EraseChunkData(){ const std::unordered_map>&Minimap::GetChunkData(){ return loadedChunks; +} + +const MinimapMode&Minimap::GetMinimapMode()const{ + return displayMode; +} + +void Minimap::SetMinimapMode(MinimapMode newMode){ + displayMode=newMode; } \ No newline at end of file diff --git a/Adventures in Lestoria/Minimap.h b/Adventures in Lestoria/Minimap.h index 42800062..a8fbc390 100644 --- a/Adventures in Lestoria/Minimap.h +++ b/Adventures in Lestoria/Minimap.h @@ -56,6 +56,9 @@ public: void EraseChunkData(); const std::unordered_map>&GetChunkData(); + + const MinimapMode&GetMinimapMode()const; + void SetMinimapMode(MinimapMode newMode); private: ViewPort mapCircleHud; ViewPort mapCircleLargeHud; diff --git a/Adventures in Lestoria/SaveFile.cpp b/Adventures in Lestoria/SaveFile.cpp index 638debf6..efeee2df 100644 --- a/Adventures in Lestoria/SaveFile.cpp +++ b/Adventures in Lestoria/SaveFile.cpp @@ -136,6 +136,7 @@ const void SaveFile::SaveGame(){ saveFile["Save Name"].SetString(std::string(GetSaveFileName())); saveFile["Game Time"].SetReal(game->GetRuntime()); saveFile["TravelingMerchant"].SetString(std::string(Merchant::GetCurrentTravelingMerchant().GetKeyName())); + saveFile["Minimap Display Mode"].SetInt(int(game->minimap.GetMinimapMode())); #pragma region Save Keyboard/Controller mappings //NOTE: We are shadowing code from InputKeyboardWindow! If at some point the retrival method for getting input displays changes, we likely will be changing the code here as well! @@ -403,6 +404,10 @@ void SaveFile::LoadFile(){ } } + if(loadFile.HasProperty("Minimap Display Mode")){ + game->minimap.SetMinimapMode(MinimapMode(loadFile["Minimap Display Mode"].GetInt())); + } + #pragma region Load Keyboard/Controller mappings //NOTE: We are shadowing code from InputKeyboardWindow! If at some point the retrival method for getting input displays changes, we likely will be changing the code here as well! const int ingameControlsRowCount=DATA.GetProperty("Inputs.Gameplay Input Names").GetValueCount()%2==0?DATA.GetProperty("Inputs.Gameplay Input Names").GetValueCount()/2:DATA.GetProperty("Inputs.Gameplay Input Names").GetValueCount()/2+1; diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index 4ee46cfb..a714dae4 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 8868 +#define VERSION_BUILD 8875 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Adventures in Lestoria/assets/config/configuration.txt b/Adventures in Lestoria/assets/config/configuration.txt index 5e469df5..a58c05a8 100644 --- a/Adventures in Lestoria/assets/config/configuration.txt +++ b/Adventures in Lestoria/assets/config/configuration.txt @@ -16,6 +16,9 @@ gfx_config = gfx/gfx.txt # Save File Server Name save_server = https://projectdivar.com:4505/AiL +# Steam API. Set to False to disable using Steam. +steam_api = True + # Map Files Loading Config map_config = levels.txt diff --git a/Adventures in Lestoria/assets/config/settings/input.txt b/Adventures in Lestoria/assets/config/settings/input.txt index d69b1461..ab3587b1 100644 --- a/Adventures in Lestoria/assets/config/settings/input.txt +++ b/Adventures in Lestoria/assets/config/settings/input.txt @@ -2,7 +2,7 @@ Inputs { Menu Input Names = Confirm, Back, Function 1, Function 2, Menu, Up, Right, Down, Left - Gameplay Input Names = Basic Attack, Defensive, Ability 1, Ability 2, Ability 3, Ability 4, Item 1, Item 2, Item 3 + Gameplay Input Names = Basic Attack, Defensive, Ability 1, Ability 2, Ability 3, Ability 4, Item 1, Item 2, Item 3, Toggle Minimap KEY_CONFIRM = Confirm @@ -24,4 +24,5 @@ Inputs Player::KEY_ITEM1=Item 1 Player::KEY_ITEM2=Item 2 Player::KEY_ITEM3=Item 3 + KEY_TOGGLE_MAP=Toggle Minimap } \ No newline at end of file diff --git a/Adventures in Lestoria/controller_config/controller_generic.vdf b/Adventures in Lestoria/controller_config/controller_generic.vdf index f4788879..58c8e505 100644 --- a/Adventures in Lestoria/controller_config/controller_generic.vdf +++ b/Adventures in Lestoria/controller_config/controller_generic.vdf @@ -1,18 +1,18 @@ "controller_mappings" { "version" "3" - "revision" "87" + "revision" "88" "title" "Generic Gamepad" "description" "Default Generic Gamepad controls" "creator" "76561198025675819" - "progenitor" "" - "url" "autosave://C:\\Program Files (x86)\\Steam\\steamapps\\common\\Steam Controller Configs\\65410091\\config\\2895980\\controller_generic.vdf" + "progenitor" "game://controller_generic.vdf" + "url" "game://controller_generic.vdf" "export_type" "personal_local" "controller_type" "controller_generic" "controller_caps" "1573375" "major_revision" "0" "minor_revision" "0" - "Timestamp" "1711752971" + "Timestamp" "1713016743" "actions" { "InGameControls" @@ -61,6 +61,7 @@ } "Fast_Scroll_Up" "#ScrollUp" "Fast_Scroll_Down" "#ScrollDown" + "Toggle_Map" "#ToggleMap" } } } @@ -97,6 +98,7 @@ "Scroll" "Scroll Menu/Manual Aim" "ScrollUp" "Fast Scroll Menu Up" "ScrollDown" "Fast Scroll Menu Down" + "ToggleMap" "Toggle Minimap" } } "group" @@ -531,6 +533,22 @@ "description" "" "inputs" { + "click" + { + "activators" + { + "Full_Press" + { + "bindings" + { + "binding" "game_action InGameControls Toggle_Map, #ToggleMap, , " + } + } + } + "disabled_activators" + { + } + } } "settings" { diff --git a/Adventures in Lestoria/controller_config/controller_switch_pro.vdf b/Adventures in Lestoria/controller_config/controller_switch_pro.vdf index 1f9fa0c5..3230591a 100644 --- a/Adventures in Lestoria/controller_config/controller_switch_pro.vdf +++ b/Adventures in Lestoria/controller_config/controller_switch_pro.vdf @@ -1,18 +1,18 @@ "controller_mappings" { "version" "3" - "revision" "85" + "revision" "86" "title" "Switch Pro" "description" "Default Switch Pro configuration." "creator" "76561198025675819" - "progenitor" "" - "url" "autosave://C:\\Program Files (x86)\\Steam\\steamapps\\common\\Steam Controller Configs\\65410091\\config\\2895980\\controller_switch_pro.vdf" + "progenitor" "game://controller_switch_pro.vdf" + "url" "game://controller_switch_pro.vdf" "export_type" "personal_local" "controller_type" "controller_switch_pro" "controller_caps" "613772287" "major_revision" "0" "minor_revision" "0" - "Timestamp" "1711752483" + "Timestamp" "1713016698" "actions" { "InGameControls" @@ -61,6 +61,7 @@ } "Fast_Scroll_Up" "#ScrollUp" "Fast_Scroll_Down" "#ScrollDown" + "Toggle_Map" "#ToggleMap" } } } @@ -97,6 +98,7 @@ "Scroll" "Scroll Menu/Manual Aim" "ScrollUp" "Fast Scroll Menu Up" "ScrollDown" "Fast Scroll Menu Down" + "ToggleMap" "Toggle Minimap" } } "group" @@ -531,6 +533,22 @@ "description" "" "inputs" { + "click" + { + "activators" + { + "Full_Press" + { + "bindings" + { + "binding" "game_action InGameControls Toggle_Map, #ToggleMap, , " + } + } + } + "disabled_activators" + { + } + } } "settings" { diff --git a/Adventures in Lestoria/controller_config/controller_xboxone.vdf b/Adventures in Lestoria/controller_config/controller_xboxone.vdf index c8d3217d..55e0d327 100644 --- a/Adventures in Lestoria/controller_config/controller_xboxone.vdf +++ b/Adventures in Lestoria/controller_config/controller_xboxone.vdf @@ -1,18 +1,18 @@ "controller_mappings" { "version" "3" - "revision" "78" + "revision" "79" "title" "Xbox/Playstation" "description" "Default Xbox/Playstation controls" - "creator" "76561198025675819" - "progenitor" "" - "url" "autosave://C:\\Program Files (x86)\\Steam\\steamapps\\common\\Steam Controller Configs\\65410091\\config\\2895980\\controller_xbox360.vdf" + "creator" "-1" + "progenitor" "game://controller_xboxone.vdf" + "url" "game://controller_xboxone.vdf" "export_type" "personal_local" "controller_type" "controller_xbox360" "controller_caps" "1590271" "major_revision" "0" "minor_revision" "0" - "Timestamp" "1711752757" + "Timestamp" "1713016732" "actions" { "InGameControls" @@ -61,6 +61,7 @@ } "Fast_Scroll_Up" "#ScrollUp" "Fast_Scroll_Down" "#ScrollDown" + "Toggle_Map" "#ToggleMap" } } } @@ -97,6 +98,7 @@ "Scroll" "Scroll Menu/Manual Aim" "ScrollUp" "Fast Scroll Menu Up" "ScrollDown" "Fast Scroll Menu Down" + "ToggleMap" "Toggle Minimap" } } "group" @@ -531,6 +533,22 @@ "description" "" "inputs" { + "click" + { + "activators" + { + "Full_Press" + { + "bindings" + { + "binding" "game_action InGameControls Toggle_Map, #ToggleMap, , " + } + } + } + "disabled_activators" + { + } + } } "settings" { diff --git a/Adventures in Lestoria/controller_config/game_actions_2895980.vdf b/Adventures in Lestoria/controller_config/game_actions_2895980.vdf index 50f1a57d..e40f302b 100644 --- a/Adventures in Lestoria/controller_config/game_actions_2895980.vdf +++ b/Adventures in Lestoria/controller_config/game_actions_2895980.vdf @@ -44,6 +44,7 @@ "Lock/Unlock_Accessory" "#Select" "Fast_Scroll_Up" "#ScrollUp" "Fast_Scroll_Down" "#ScrollDown" + "Toggle_Map" "#ToggleMap" } } } @@ -77,6 +78,7 @@ "Scroll" "Scroll Menu/Manual Aim" "ScrollUp" "Fast Scroll Menu Up" "ScrollDown" "Fast Scroll Menu Down" + "ToggleMap" "Toggle Minimap" } } "configurations" diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index 1a8a8162..d3f5d392 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ