diff --git a/Adventures in Lestoria/AdventuresInLestoria.cpp b/Adventures in Lestoria/AdventuresInLestoria.cpp index d6af078e..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 @@ -1740,6 +1742,9 @@ void AiL::RenderHud(){ } } }; + + minimap.Update(); + minimap.Draw(); RenderAimingCursor(); @@ -1811,9 +1816,6 @@ void AiL::RenderHud(){ std::string displayText=player->notificationDisplay.first; DrawShadowStringPropDecal(vf2d{float(ScreenWidth()/2),float(ScreenHeight()/4)-24}-GetTextSizeProp(displayText)/2,displayText,BLUE,VERY_DARK_BLUE); } - - minimap.Update(); - minimap.Draw(); DisplayBossEncounterInfo(); #ifdef _DEBUG @@ -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/Checkbox.h b/Adventures in Lestoria/Checkbox.h index 9fe4a7e2..58207e33 100644 --- a/Adventures in Lestoria/Checkbox.h +++ b/Adventures in Lestoria/Checkbox.h @@ -42,6 +42,7 @@ All rights reserved. #include "SoundEffect.h" INCLUDE_game +INCLUDE_GFX class Checkbox:public MenuComponent{ protected: @@ -76,17 +77,10 @@ public: } inline void DrawDecal(ViewPort&window,bool focused)override{ - geom2d::linecheckmarkLine1=geom2d::line({rect.left().start.x+rect.size.x*0.125f,rect.left().start.y+rect.size.y*0.5f},{rect.top().start.x+rect.size.x*0.375f,rect.top().start.y+rect.size.y*0.875f}); - geom2d::linecheckmarkLine2=geom2d::line(checkmarkLine1.end,{rect.left().start.x+rect.size.x*0.875f,rect.top().start.y+rect.size.y*0.25f}); - MenuComponent::DrawDecal(window,focused); + if(checked){ - for(int y=-1;y<=1;y++){ - for(int x=-1;x<=1;x++){ - window.DrawLineDecal(vf2d{float(x),float(y)}/game->GetScreenPixelSize()+checkmarkLine1.start,vf2d{float(x),float(y)}/game->GetScreenPixelSize()+checkmarkLine1.end); - window.DrawLineDecal(vf2d{float(x),float(y)}/game->GetScreenPixelSize()+checkmarkLine2.start,vf2d{float(x),float(y)}/game->GetScreenPixelSize()+checkmarkLine2.end); - } - } + window.DrawDecal(rect.pos,GFX["checkmark.png"].Decal()); } } }; \ No newline at end of file diff --git a/Adventures in Lestoria/GameSettings.cpp b/Adventures in Lestoria/GameSettings.cpp index a9b4dc78..e8f9e6b2 100644 --- a/Adventures in Lestoria/GameSettings.cpp +++ b/Adventures in Lestoria/GameSettings.cpp @@ -52,6 +52,7 @@ bool GameSettings::rumble=true; bool GameSettings::terrainCollisionBoxes=true; bool GameSettings::keyboardAutoAim=false; bool GameSettings::vsync=true; +bool GameSettings::autopause=true; const bool GameSettings::OVERRIDE=true; vi2d GameSettings::windowPos{30,30}; IconType GameSettings::iconType=IconType::XB; @@ -83,6 +84,9 @@ const IconType GameSettings::GetIconType(){ const bool GameSettings::VSyncEnabled(){ return vsync; } +const bool GameSettings::AutoPauseEnabled(){ + return autopause; +} void GameSettings::SetMaxHealthDisplay(bool maxHealthDisplayed){ showMaxHealth=maxHealthDisplayed; @@ -152,6 +156,10 @@ void GameSettings::Initialize(){ Component(SETTINGS,"VSync Checkbox")->SetChecked(loadSystemFile["VSync"].GetBool()); game->SetVSync(GameSettings::VSyncEnabled()); } + if(loadSystemFile.HasProperty("Auto Pause")){ + GameSettings::SetAutoPause(loadSystemFile["Auto Pause"].GetBool()); + Component(SETTINGS,"Auto Pause Checkbox")->SetChecked(loadSystemFile["Auto Pause"].GetBool()); + } if(loadSystemFile.HasProperty("Controller Icons")){ const int maxIterations=10; int iterationCount=0; @@ -192,4 +200,8 @@ void GameSettings::Initialize(){ } } #pragma endregion +} + +void GameSettings::SetAutoPause(const bool autoPauseEnabled){ + autopause=autoPauseEnabled; } \ No newline at end of file diff --git a/Adventures in Lestoria/GameSettings.h b/Adventures in Lestoria/GameSettings.h index 4073399d..4ce9e713 100644 --- a/Adventures in Lestoria/GameSettings.h +++ b/Adventures in Lestoria/GameSettings.h @@ -48,6 +48,7 @@ class GameSettings{ static bool terrainCollisionBoxes; static bool keyboardAutoAim; static bool vsync; + static bool autopause; static vi2d windowPos; static IconType iconType; public: @@ -60,6 +61,7 @@ public: static const bool TerrainCollisionBoxesEnabled(); static const bool KeyboardAutoAimEnabled(); static const bool VSyncEnabled(); + static const bool AutoPauseEnabled(); static const vi2d GetWindowPos(); static const IconType GetIconType(); static void SetMaxHealthDisplay(bool maxHealthDisplayed); @@ -71,5 +73,6 @@ public: static void SetWindowPos(vi2d windowPos); static void SetIconType(IconType type); static void SetVSync(const bool vSyncEnabled); + static void SetAutoPause(const bool autoPauseEnabled); static void Initialize(); }; \ No newline at end of file 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/LoadGameWindow.cpp b/Adventures in Lestoria/LoadGameWindow.cpp index 8bd11efc..6f0cca17 100644 --- a/Adventures in Lestoria/LoadGameWindow.cpp +++ b/Adventures in Lestoria/LoadGameWindow.cpp @@ -101,14 +101,14 @@ void Menu::InitializeLoadGameWindow(){ if(SaveFile::GetSaveFileCount()>0||SaveFile::GetOnlineSaveFileCount()>0){ if(SaveFile::IsOnline()){ if(Component(type,"Online Game Files List")->GetComponents().size()>0){ - Menu::menus[type]->SetSelection(Component(type,"Online Game Files List")->GetComponents()[0],true); + Menu::menus[type]->SetSelection(Component(type,"Online Game Files List")->GetComponents()[0],true,true); returnData=Menu::menus[type]->GetSelection(); }else{ returnData="Go Back Button"; } }else{ if(Component(type,"Game Files List")->GetComponents().size()>0){ - Menu::menus[type]->SetSelection(Component(type,"Game Files List")->GetComponents()[0],true); + Menu::menus[type]->SetSelection(Component(type,"Game Files List")->GetComponents()[0],true,true); returnData=Menu::menus[type]->GetSelection(); }else{ returnData="Go Back Button"; diff --git a/Adventures in Lestoria/Menu.cpp b/Adventures in Lestoria/Menu.cpp index db0b1fb5..c450541a 100644 --- a/Adventures in Lestoria/Menu.cpp +++ b/Adventures in Lestoria/Menu.cpp @@ -322,7 +322,7 @@ void Menu::OpenMenu(MenuType menu,bool cover){ Data returnData; menus[menu]->onOpenFunc(menu,returnData); menus[menu]->defaultButton=returnData; - if(std::holds_alternative(returnData)&&std::get(returnData).length()>0||std::holds_alternative>(returnData))menus[menu]->SetSelection(returnData,true); + if(std::holds_alternative(returnData)&&std::get(returnData).length()>0||std::holds_alternative>(returnData))menus[menu]->SetSelection(returnData,false); } stack.push_back(menus[menu]); Audio::UpdateBGMVolume(); //If we open the pause menu, it forces the bgm volume to be halved. So we notify the engine that this is happening. @@ -761,17 +761,11 @@ void Menu::SetSelection(std::string_view button,const bool scroll,const bool res keyboardSelection=selection; } - if(!selection.lock()->parentComponent.expired()&&reset){ - auto scrollWindow=selection.lock()->parentComponent.lock(); - scrollWindow->targetScrollOffset.y=0.f; - scrollWindow->scrollOffset.y=0.f; - scrollWindow->selectionIndex=0.f; - } - if(scroll&&!UsingMouseNavigation()&&!selection.lock()->parentComponent.expired()){ auto scrollWindow=selection.lock()->parentComponent.lock(); scrollWindow->HandleOutsideDisabledButtonSelection(Menu::menus[selection.lock()->parentMenu]->components[selection.lock()->GetName()]); scrollWindow->selectionIndex=scrollWindow->GetComponentIndex(selection); + scrollWindow->SetScrollAmount(scrollWindow->GetScrollAmount()-scrollWindow->GetComponents()[scrollWindow->selectionIndex].lock()->GetPos()); } } diff --git a/Adventures in Lestoria/Minimap.cpp b/Adventures in Lestoria/Minimap.cpp index 7db80998..4ef7ae8b 100644 --- a/Adventures in Lestoria/Minimap.cpp +++ b/Adventures in Lestoria/Minimap.cpp @@ -53,17 +53,27 @@ void Minimap::Initialize(){ } mapCircleHud=ViewPort{enlargedCircle,vi2d{game->ScreenWidth()-"Minimap.Minimap HUD Size"_I-4,4}}; + enlargedCircle.clear(); + for(int i=360;i>=0;i-=4){ + float angle=util::degToRad(float(i))-PI/2; + if(i==360){enlargedCircle.push_back(vf2d{cos(angle),sin(angle)}*game->ScreenWidth()/3+game->ScreenWidth()/3);} + enlargedCircle.push_back(vf2d{cos(angle),sin(angle)}*game->ScreenWidth()/3+game->ScreenWidth()/3); + } + mapCircleLargeHud=ViewPort{enlargedCircle,vi2d{game->ScreenWidth()/2-game->ScreenWidth()/3,game->ScreenHeight()/2-game->ScreenWidth()/3}}; + } void Minimap::Reset(){ if(minimap.Sprite()==nullptr)minimap.Create(1,1); if(cover.Sprite()==nullptr)cover.Create(1,1); + if(coverOutline.Sprite()==nullptr)coverOutline.Create(1,1); Sprite baseMinimap; #pragma region Cleanup minimap and cover images minimap.Sprite()->Resize(game->GetCurrentMapData().width,game->GetCurrentMapData().height); cover.Sprite()->Resize(game->GetCurrentMapData().width,game->GetCurrentMapData().height); + coverOutline.Sprite()->Resize(game->GetCurrentMapData().width,game->GetCurrentMapData().height); baseMinimap.Resize(game->GetCurrentMapData().width,game->GetCurrentMapData().height); game->SetDrawTarget(minimap.Sprite()); game->SetPixelMode(Pixel::ALPHA); @@ -72,6 +82,8 @@ void Minimap::Reset(){ game->Clear(BLANK); game->SetDrawTarget(cover.Sprite()); game->Clear(BLANK); + game->SetDrawTarget(coverOutline.Sprite()); + game->Clear(BLANK); game->SetPixelMode(Pixel::NORMAL); //Will update the minimap decal at the end, since we are about to change it anyways. cover.Decal()->Update(); @@ -124,6 +136,19 @@ void Minimap::Reset(){ } } } + + if(game->GetZones().count("EndZone")){ + for(const ZoneData&zone:game->GetZones().at("EndZone")){ + vf2d ringPos=zone.zone.pos/game->GetCurrentMapData().TileSize; + vf2d ringSize=zone.zone.size/game->GetCurrentMapData().TileSize; + for(int y=0;y<=ringSize.y;y++){ + for(int x=0;x<=ringSize.x;x++){ + minimap.Sprite()->SetPixel(ringPos+vi2d{x,y},GREEN); + } + } + } + } + game->SetDrawTarget(nullptr); minimap.Decal()->Update(); @@ -137,7 +162,11 @@ void Minimap::Reset(){ } void Minimap::Update(){ - + 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; + } } void Minimap::UpdateChunk(const MapName map,const vi2d chunkPos){ @@ -153,11 +182,15 @@ void Minimap::UpdateChunk(const MapName map,const vi2d chunkPos){ //We start twice the distance we are supposed to outwards. for(int y=pixelPos.y;yGetPixel(x,y).a==255||minimap.Sprite()->GetPixel(x,y).a==0)continue; //Already revealed or invisible anyways. + Pixel sourceCol=minimap.Sprite()->GetPixel(x,y); + bool sourceWasBlack=sourceCol==BLACK; + + if(cover.Sprite()->GetPixel(x,y).a==255||sourceCol.a==0)continue; //Already revealed or invisible anyways. vi2d chunk=vi2d{x,y}/"Minimap.Chunk Size"_I; if(chunk==chunkPos){ - cover.Sprite()->SetPixel(x,y,minimap.Sprite()->GetPixel(x,y)); + cover.Sprite()->SetPixel(x,y,sourceCol); + if(sourceWasBlack)coverOutline.Sprite()->SetPixel(x,y,sourceCol); }else{ const vi2d chunkOffset={"Minimap.Chunk Size"_I/2,"Minimap.Chunk Size"_I/2}; @@ -166,21 +199,32 @@ void Minimap::UpdateChunk(const MapName map,const vi2d chunkPos){ if(cover.Sprite()->GetPixel(x,y).a>alpha)continue; //The distance was uncovered by another closer chunk, don't need to reveal it here. - Pixel sourceCol=minimap.Sprite()->GetPixel(x,y); sourceCol.a=alpha; cover.Sprite()->SetPixel(x,y,sourceCol); + if(sourceWasBlack)coverOutline.Sprite()->SetPixel(x,y,sourceCol); } } } cover.Decal()->Update(); + coverOutline.Decal()->Update(); } void Minimap::Draw(){ const vf2d minimapPos=vf2d{float("Minimap.Minimap HUD Size"_I),float("Minimap.Minimap HUD Size"_I)}/2; - if(!game->InBossEncounter())mapCircleHud.DrawRotatedDecal(minimapPos,cover.Decal(),0.f,game->GetPlayer()->GetPos()/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}); + if(!game->InBossEncounter()){ + switch(displayMode){ + case MinimapMode::SMALL:{ + 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->camera.GetPosition()/game->GetCurrentMapData().tilewidth,vf2d{2.f,2.f},{255,255,255,48}); + }break; + case MinimapMode::OFF:{}break; + } + } } void Minimap::EraseChunkData(){ @@ -189,4 +233,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 0f9fec52..a8fbc390 100644 --- a/Adventures in Lestoria/Minimap.h +++ b/Adventures in Lestoria/Minimap.h @@ -39,6 +39,12 @@ All rights reserved. #include "olcPGEX_ViewPort.h" +enum class MinimapMode{ + SMALL, + LARGE, + OFF, +}; + class Minimap{ public: void Initialize(); @@ -50,9 +56,15 @@ public: void EraseChunkData(); const std::unordered_map>&GetChunkData(); + + const MinimapMode&GetMinimapMode()const; + void SetMinimapMode(MinimapMode newMode); private: ViewPort mapCircleHud; + ViewPort mapCircleLargeHud; Renderable minimap; Renderable cover; + Renderable coverOutline; std::unordered_map>loadedChunks; + MinimapMode displayMode=MinimapMode::SMALL; }; \ No newline at end of file diff --git a/Adventures in Lestoria/Player.cpp b/Adventures in Lestoria/Player.cpp index 8855b5e4..4e4a876f 100644 --- a/Adventures in Lestoria/Player.cpp +++ b/Adventures in Lestoria/Player.cpp @@ -802,6 +802,10 @@ bool Player::Hurt(int damage,bool onUpperLevel,float z){ if(game->GetPlayer()->GetHealth()GetPlayer()->GetMaxHealth()*0.5f&&!Tutorial::TaskIsComplete(TutorialTaskName::USE_RECOVERY_ITEMS)){ Tutorial::SetNextTask(TutorialTaskName::USE_RECOVERY_ITEMS); } + + if(GameSettings::AutoPauseEnabled()&&!Menu::IsMenuOpen()&&GameState::STATE==GameState::states[States::GAME_RUN]&&!game->IsFocused()){ + Menu::OpenMenu(MenuType::PAUSE); + } return true; } diff --git a/Adventures in Lestoria/SaveFile.cpp b/Adventures in Lestoria/SaveFile.cpp index 638debf6..2c5a1106 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! @@ -173,6 +174,7 @@ const void SaveFile::SaveGame(){ saveSystemFile["Keyboard Auto-Aim"].SetBool(GameSettings::KeyboardAutoAimEnabled()); saveSystemFile["Controller Icons"].SetInt(int(GameSettings::GetIconType())); saveSystemFile["VSync"].SetBool(GameSettings::VSyncEnabled()); + saveSystemFile["Auto Pause"].SetBool(GameSettings::AutoPauseEnabled()); saveSystemFile["Window Pos"].SetInt(game->GetActualWindowPos().x,0); saveSystemFile["Window Pos"].SetInt(game->GetActualWindowPos().y,1); @@ -403,6 +405,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/ScrollableWindowComponent.h b/Adventures in Lestoria/ScrollableWindowComponent.h index 6cdfc5f5..60123767 100644 --- a/Adventures in Lestoria/ScrollableWindowComponent.h +++ b/Adventures in Lestoria/ScrollableWindowComponent.h @@ -90,6 +90,10 @@ public: LOG("WARNING! Attempted to remove subbuttons from button listing, but not found!"); } } + + targetScrollOffset.y=std::min(targetScrollOffset.y,bounds.bottom().end.y); + scrollOffset.y=std::min(scrollOffset.y,bounds.bottom().end.y); + selectionIndex=std::min(size_t(selectionIndex),components.size()-1); } virtual inline void RemoveButton(std::weak_ptrbutton){ auto componentSearchResults=std::find_if(components.begin(),components.end(),[&](std::weak_ptrptr){return &*ptr.lock()==&*button.lock();}); diff --git a/Adventures in Lestoria/SettingsWindow.cpp b/Adventures in Lestoria/SettingsWindow.cpp index 428a4efb..03be6b2d 100644 --- a/Adventures in Lestoria/SettingsWindow.cpp +++ b/Adventures in Lestoria/SettingsWindow.cpp @@ -141,6 +141,12 @@ void Menu::InitializeSettingsWindow(){ return true; },GameSettings::VSyncEnabled())END; auto vsyncToggleLabel=settingsList->ADD("VSync Toggle Label",MenuLabel)(geom2d::rect{{22.f,100},{windowSize.x/2-36.f,16.f}},"VSync",1.f,ComponentAttr::SHADOW|ComponentAttr::LEFT_ALIGN)END; + + auto autoPauseToggle=settingsList->ADD("Auto Pause Checkbox",Checkbox)(geom2d::rect{{4.f,120},{16.f,16.f}},[](ToggleFuncData data){ + GameSettings::SetAutoPause(data.checked); + return true; + },GameSettings::AutoPauseEnabled())END; + auto autoPauseToggleLabel=settingsList->ADD("Auto Pause Toggle Label",MenuLabel)(geom2d::rect{{22.f,120},{windowSize.x/2-36.f,16.f}},"Pause if Hit When\nWindow Unfocused",1.f,ComponentAttr::SHADOW|ComponentAttr::LEFT_ALIGN)END; settingsList->ADD("Terrain Collision Boxes Checkbox",Checkbox)(geom2d::rect{{windowSize.x/2+4.f,60},{16.f,16.f}},[](ToggleFuncData data){ GameSettings::SetTerrainCollisionBoxes(data.checked); @@ -169,7 +175,7 @@ void Menu::InitializeSettingsWindow(){ fullscreenToggleLabel->Disable(); #endif - settingsList->ADD("Button Set Toggle Box",MenuIconButton)(geom2d::rect{{windowSize.x/2.f-windowSize.x/8.f-6.f,120.f},{windowSize.x/4.f,16.f}},GFX["themes/xb.png"].Decal(),[](MenuFuncData data){ + settingsList->ADD("Button Set Toggle Box",MenuIconButton)(geom2d::rect{{windowSize.x/2.f-windowSize.x/8.f-6.f,140.f},{windowSize.x/4.f,16.f}},GFX["themes/xb.png"].Decal(),[](MenuFuncData data){ switch(GameSettings::GetIconType()){ case IconType::XB:{ GameSettings::SetIconType(IconType::PS); @@ -215,13 +221,13 @@ void Menu::InitializeSettingsWindow(){ }; #pragma endregion - settingsList->ADD("Keyboard Bindings Button",MenuComponent)(geom2d::rect{{28,140.f},vf2d{settingsList->rect.size.x-12-56,24}},"Keyboard Bindings",[&](MenuFuncData data){ + settingsList->ADD("Keyboard Bindings Button",MenuComponent)(geom2d::rect{{28,160.f},vf2d{settingsList->rect.size.x-12-56,24}},"Keyboard Bindings",[&](MenuFuncData data){ ChangeKeybindDisplayType(KEY); Component(INPUT_KEY_DISPLAY,"Keyboard Mapping Label")->SetLabel("Keyboard Mappings"); Menu::OpenMenu(INPUT_KEY_DISPLAY); return true; },vf2d{1.5f,2.f})END; - settingsList->ADD("Controller Bindings Button",MenuComponent)(geom2d::rect{{28,168.f},vf2d{settingsList->rect.size.x-12-56,24}},"Controller Bindings",[&](MenuFuncData data){ + settingsList->ADD("Controller Bindings Button",MenuComponent)(geom2d::rect{{28,188.f},vf2d{settingsList->rect.size.x-12-56,24}},"Controller Bindings",[&](MenuFuncData data){ ChangeKeybindDisplayType(CONTROLLER); Component(INPUT_KEY_DISPLAY,"Keyboard Mapping Label")->SetLabel("Controller Mappings"); STEAMINPUT( @@ -287,20 +293,19 @@ void Menu::InitializeSettingsWindow(){ .right="Keyboard Play Auto-Aim Checkbox",}}, {"VSync Checkbox",{ .up="Controller Rumble Checkbox", - .down="Button Set Toggle Box", + .down="Auto Pause Checkbox", .left="Fullscreen Toggle Checkbox", .right="Fullscreen Toggle Checkbox",}}, + {"Auto Pause Checkbox",{ + .up="VSync Checkbox", + .down="Button Set Toggle Box",}}, {"Fullscreen Toggle Checkbox",{ .up="Keyboard Play Auto-Aim Checkbox", - .down="Button Set Toggle Box", + .down="Auto Pause Checkbox", .left="VSync Checkbox", .right="VSync Checkbox",}}, {"Button Set Toggle Box",{ - #ifdef __EMSCRIPTEN__ - .up="VSync Checkbox", - #else - .up="Fullscreen Toggle Checkbox", - #endif + .up="Auto Pause Checkbox", .down="Keyboard Bindings Button",}}, {"Keyboard Bindings Button",{ .up="Button Set Toggle Box", diff --git a/Adventures in Lestoria/TODO.txt b/Adventures in Lestoria/TODO.txt index 15d219c0..550e005c 100644 --- a/Adventures in Lestoria/TODO.txt +++ b/Adventures in Lestoria/TODO.txt @@ -11,25 +11,6 @@ Upon completion of a stage in time trial mode if the player beat their previous For each class and stage combination there will be a "dev time" Settings menu doesn't scroll back up properly while the scrollbar does? -Merchant descriptions have no newlines. -Amount to sell shows total of that accessory you have instead of 1/1. -Bosses can get stuck outside the arena? Traveling merchants of different colors/looks. Steel Weapons appear in the demo for Chapter 2. -Update display counters on the overworld map. -Pressing movement keys that negate each other shouldn't cause a walking animation to occur. - ->As the player navigates around the map, the blank map canvas gets updated based on distance. ->If a chunk has not been explored yet, it gets flagged as explored (probably unlock the chunks around the player as well). - ->When a map is visited later, all visited chunks are revealed again. - -============================================ -Consider a "killed by player" / "marked by player" flag for monsters to determine if a player gets credit for a monster kill (for achievements) -Make another actions config file for the main build (The app # is different) - -Review other games and see what the screen does when the player takes damage. Vignette effect - -Look at green slime remains count for crafting. - -Textured ground tiles \ No newline at end of file +Look into removing OVERRIDE from rumble settings. It looks like it was used to purposefully disable rumble, but looks very unnecessary. \ No newline at end of file diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index b7d9db51..dfaaffa9 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 8852 +#define VERSION_BUILD 8902 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Adventures in Lestoria/assets/checkmark.png b/Adventures in Lestoria/assets/checkmark.png new file mode 100644 index 00000000..13281734 Binary files /dev/null and b/Adventures in Lestoria/assets/checkmark.png differ 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/gfx/gfx.txt b/Adventures in Lestoria/assets/config/gfx/gfx.txt index 68ed9369..935947b0 100644 --- a/Adventures in Lestoria/assets/config/gfx/gfx.txt +++ b/Adventures in Lestoria/assets/config/gfx/gfx.txt @@ -85,6 +85,7 @@ Images GFX_SwordSlash = swordslash.png GFX_CustomFont = font.png GFX_Vignette = vignette.png + GFX_Checkmark = checkmark.png # Ability Icons GFX_Warrior_BattleCry_Icon = Ability Icons/battlecry.png 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/assets/gamepack.pak b/Adventures in Lestoria/assets/gamepack.pak index d49544d4..70643b89 100644 Binary files a/Adventures in Lestoria/assets/gamepack.pak and b/Adventures in Lestoria/assets/gamepack.pak differ 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/Adventures in Lestoria/olcPixelGameEngine.h b/Adventures in Lestoria/olcPixelGameEngine.h index 1b82ed05..aa126699 100644 --- a/Adventures in Lestoria/olcPixelGameEngine.h +++ b/Adventures in Lestoria/olcPixelGameEngine.h @@ -1021,6 +1021,7 @@ namespace olc // Called when a console command is executed virtual bool OnConsoleCommand(const std::string& sCommand); virtual void OnRequestCompleted(const std::string_view receivedData)const; + virtual void OnWindowLoseFocus()const; virtual olc::rcode SendRequest(std::string_view url,std::string_view data); @@ -4619,6 +4620,7 @@ namespace olc bool PixelGameEngine::OnConsoleCommand(const std::string& sCommand) { UNUSED(sCommand); return false; } void PixelGameEngine::OnRequestCompleted(const std::string_view receivedData)const{} + void PixelGameEngine::OnWindowLoseFocus()const{} olc::rcode PixelGameEngine::SendRequest(std::string_view url,std::string_view data){platform->SendRequest(url,data);return olc::rcode::OK;}; @@ -4698,6 +4700,7 @@ namespace olc olc_UpdateKeyState(i,false); } } + if(!state)OnWindowLoseFocus(); bHasInputFocus = state; } diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index 58c0a408..9cb372cd 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ