diff --git a/Adventures in Lestoria/Adventures in Lestoria.vcxproj b/Adventures in Lestoria/Adventures in Lestoria.vcxproj index ec73e369..35b643c2 100644 --- a/Adventures in Lestoria/Adventures in Lestoria.vcxproj +++ b/Adventures in Lestoria/Adventures in Lestoria.vcxproj @@ -574,6 +574,10 @@ + + + + diff --git a/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters b/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters index 3d552ce5..fc42a45f 100644 --- a/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters +++ b/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters @@ -827,6 +827,9 @@ Source Files\Game States + + Source Files\Interface + diff --git a/Adventures in Lestoria/AdventuresInLestoria.cpp b/Adventures in Lestoria/AdventuresInLestoria.cpp index 14099497..e49fdcd8 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.cpp +++ b/Adventures in Lestoria/AdventuresInLestoria.cpp @@ -2014,6 +2014,9 @@ void AiL::_PrepareLevel(MapName map,MusicChange changeMusic){ ZONE_LIST.clear(); ItemDrop::drops.clear(); GameEvent::events.clear(); + Audio::SetBGMPitch(1.f); + game->view.SetZoom(1.f,game->view.WorldToScreen(game->camera.GetViewPosition())); + SetMosaicEffect(1U); worldColor=WHITE; worldColorFunc=[&](vi2d pos){return game->worldColor;}; levelTime=0; diff --git a/Adventures in Lestoria/DeathMenu.cpp b/Adventures in Lestoria/DeathMenu.cpp new file mode 100644 index 00000000..8f292e0e --- /dev/null +++ b/Adventures in Lestoria/DeathMenu.cpp @@ -0,0 +1,86 @@ +#pragma region License +/* +License (OLC-3) +~~~~~~~~~~~~~~~ + +Copyright 2024 Joshua Sigona + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions or derivations of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + +2. Redistributions or derivative works in binary form must reproduce the above +copyright notice. This list of conditions and the following disclaimer must be +reproduced in the documentation and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors may +be used to endorse or promote products derived from this software without specific +prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT +SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + +Portions of this software are copyright © 2024 The FreeType +Project (www.freetype.org). Please see LICENSE_FT.txt for more information. +All rights reserved. +*/ +#pragma endregion + +#include "Menu.h" +#include "MenuComponent.h" +#include "GameState.h" +#include "AdventuresInLestoria.h" +#include "Unlock.h" + +INCLUDE_game +INCLUDE_GFX + +void Menu::InitializeDeathWindow(){ + Menu*deathWindow=CreateMenu(MenuType::DEATH,CENTERED,vi2d{96,52}); + + deathWindow->ADD("Retry Button",MenuComponent)(geom2d::rect{{6.f,0.f},{84.f,24.f}},"Retry",[](MenuFuncData data){ + Menu::CloseAllMenus(); + GameState::ChangeState(States::GAME_RUN); + return true; + },ButtonAttr::FIT_TO_LABEL)END; + deathWindow->ADD("Return to Camp Button",MenuComponent)(geom2d::rect{{6.f,28.f},{84.f,24.f}},"Return to Camp",[](MenuFuncData data){ + if(!Unlock::IsUnlocked("HUB")){ + GameState::ChangeState(States::OVERWORLD_MAP); + }else{ + GameState::ChangeState(States::GAME_HUB); + } + return true; + },ButtonAttr::FIT_TO_LABEL)END; + + deathWindow->SetupKeyboardNavigation( + [](MenuType type,Data&returnData){ //On Open + returnData="Retry Button"; + }, + { //Button Key + {game->KEY_SCROLL,{"Navigate",[](MenuType type){}}}, + {game->KEY_MENU,{"Resume",[](MenuType type){ + if(!Menu::menus[type]->GetSelection().expired()){ + Menu::menus[type]->GetSelection().lock()->Click(); + } + }}}, + {game->KEY_CONFIRM,{"Select",[](MenuType type){}}}, + } + ,{ //Button Navigation Rules + {"Retry Button",{ + .up="Return to Camp Button", + .down="Return to Camp Button",}}, + {"Return to Camp Button",{ + .up="Retry Button", + .down="Retry Button",}}, + }); +} \ No newline at end of file diff --git a/Adventures in Lestoria/Menu.cpp b/Adventures in Lestoria/Menu.cpp index 004f091e..301c1625 100644 --- a/Adventures in Lestoria/Menu.cpp +++ b/Adventures in Lestoria/Menu.cpp @@ -106,6 +106,7 @@ void Menu::InitializeMenus(){ InitializeKeyboardInputWindow(); InitializeNewKeybindInputWindow(); InitializePauseWindow(); + InitializeDeathWindow(); for(MenuType type=MenuType(int(MenuType::ENUM_START)+1);type&MonsterData::GetDropData(){ return dropData; diff --git a/Adventures in Lestoria/State_Death.cpp b/Adventures in Lestoria/State_Death.cpp index 19d2774d..5e874ae6 100644 --- a/Adventures in Lestoria/State_Death.cpp +++ b/Adventures in Lestoria/State_Death.cpp @@ -54,6 +54,14 @@ void State_Death::OnStateChange(GameState*prevState){ Menu::CloseAllMenus(); } game->GetPlayer()->SetState(State::DEATH); + if(!Unlock::IsUnlocked("HUB")){ + Component(DEATH,"Return to Camp Button")->SetLabel(" Return to \nStage Select"); + }else{ + Component(DEATH,"Return to Camp Button")->SetLabel("Return to Camp"); + } + + gameSlowdownPct=1.f; + accTime=0.f; } void State_Death::OnLevelLoad(){ Component(MenuType::PAUSE,"Return to Camp Button")->SetGrayedOut( @@ -71,9 +79,12 @@ void State_Death::OnUserUpdate(AiL*game){ game->SetWorldColor({uint8_t(util::lerp(255,0,(gameSlowdownPct-1)/10.f)),uint8_t(util::lerp(255,0,(gameSlowdownPct-1)/10.f)),uint8_t(util::lerp(255,0,(gameSlowdownPct-1)/10.f)),255}); Audio::SetBGMPitch(util::lerp(1.f,0,(gameSlowdownPct-1)/10.f)); if(gameSlowdownPct<5.f){ - game->SetMosaicEffect(uint8_t(util::lerp(1.f,4.f,(gameSlowdownPct-1)/5.f))); + game->SetMosaicEffect(uint8_t(util::lerp(1.f,9.f,(gameSlowdownPct-1)/7.f))); }else{ - game->SetMosaicEffect(uint8_t(util::lerp(4.f,1.f,(gameSlowdownPct-5)/5.f))); + if(!Menu::IsMenuOpen()){ + Menu::OpenMenu(MenuType::DEATH); + } + game->SetMosaicEffect(uint8_t(util::lerp(9.f,1.f,(gameSlowdownPct-7)/3.f))); } if(gameSlowdownPct<10.f){ diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index 630e45ed..ac368a96 100644 --- a/Adventures in Lestoria/Version.h +++ b/Adventures in Lestoria/Version.h @@ -39,7 +39,7 @@ All rights reserved. #define VERSION_MAJOR 0 #define VERSION_MINOR 3 #define VERSION_PATCH 0 -#define VERSION_BUILD 7662 +#define VERSION_BUILD 7668 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Adventures in Lestoria/assets/config/items/ItemDatabase.txt b/Adventures in Lestoria/assets/config/items/ItemDatabase.txt index 743e82bc..6a2fdfb4 100644 --- a/Adventures in Lestoria/assets/config/items/ItemDatabase.txt +++ b/Adventures in Lestoria/assets/config/items/ItemDatabase.txt @@ -103,7 +103,7 @@ ItemDatabase { ItemScript = RestoreDuringCast Description = Restores 30% health points over 6 seconds. The effect can be interrupted. - HP % Restore = 5%,1,6 + HP % Restore = 5%,0.9,6 Cast Time = 6.0 Cooldown Time = 5.0 ItemCategory = Consumables diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index c927dc99..679bbf52 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ