Implemented Death menu. Release Build 7668.
This commit is contained in:
		
							parent
							
								
									03e6d3bd80
								
							
						
					
					
						commit
						b96b5735e9
					
				| @ -574,6 +574,10 @@ | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="AdventuresInLestoria.cpp" /> | ||||
|     <ClCompile Include="DamageNumber.cpp" /> | ||||
|     <ClCompile Include="DeathMenu.cpp"> | ||||
|       <SubType> | ||||
|       </SubType> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="discord-files\achievement_manager.cpp" /> | ||||
|     <ClCompile Include="discord-files\activity_manager.cpp" /> | ||||
|     <ClCompile Include="discord-files\application_manager.cpp" /> | ||||
|  | ||||
| @ -827,6 +827,9 @@ | ||||
|     <ClCompile Include="State_Death.cpp"> | ||||
|       <Filter>Source Files\Game States</Filter> | ||||
|     </ClCompile> | ||||
|     <ClCompile Include="DeathMenu.cpp"> | ||||
|       <Filter>Source Files\Interface</Filter> | ||||
|     </ClCompile> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <None Include="cpp.hint" /> | ||||
|  | ||||
| @ -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; | ||||
|  | ||||
							
								
								
									
										86
									
								
								Adventures in Lestoria/DeathMenu.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										86
									
								
								Adventures in Lestoria/DeathMenu.cpp
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,86 @@ | ||||
| #pragma region License | ||||
| /*
 | ||||
| License (OLC-3) | ||||
| ~~~~~~~~~~~~~~~ | ||||
| 
 | ||||
| Copyright 2024 Joshua Sigona <sigonasr2@gmail.com> | ||||
| 
 | ||||
| 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<float>{{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<float>{{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",}}, | ||||
| 	}); | ||||
| } | ||||
| @ -106,6 +106,7 @@ void Menu::InitializeMenus(){ | ||||
| 	InitializeKeyboardInputWindow(); | ||||
| 	InitializeNewKeybindInputWindow(); | ||||
| 	InitializePauseWindow(); | ||||
| 	InitializeDeathWindow(); | ||||
| 
 | ||||
| 	for(MenuType type=MenuType(int(MenuType::ENUM_START)+1);type<MenuType::ENUM_END;type=MenuType(int(type+1))){ | ||||
| 		if(menus.count(type)==0){ | ||||
|  | ||||
| @ -110,6 +110,7 @@ class Menu:public IAttributable{ | ||||
|     static void InitializeKeyboardInputWindow(); | ||||
|     static void InitializeNewKeybindInputWindow(); | ||||
|     static void InitializePauseWindow(); | ||||
|     static void InitializeDeathWindow(); | ||||
| 
 | ||||
|     friend class AiL; | ||||
|     friend class ItemInfo; | ||||
|  | ||||
| @ -41,7 +41,7 @@ enum MenuType{ | ||||
|     ///////////////////////////////////////////////////////////
 | ||||
|     /*DO NOT REMOVE!!*/ENUM_START,///////////////////////////////
 | ||||
|     ///////////////////////////////////////////////////////////
 | ||||
|     // 100% Controller Compatibility. (100 total items, 4 items per menu * 25 menus)
 | ||||
|     // 100% Controller Compatibility. (104 total items, 4 items per menu * 26 menus)
 | ||||
|     INVENTORY_CONSUMABLES, //100% Controller Compatibility
 | ||||
|     CLASS_INFO, //100% Controller Compatibility
 | ||||
|     CLASS_SELECTION, //100% Controller Compatibility
 | ||||
| @ -67,6 +67,7 @@ enum MenuType{ | ||||
|     INPUT_KEY_DISPLAY, //100% Controller Compatibility
 | ||||
|     NEW_INPUT, //100% Controller Compatibility
 | ||||
|     PAUSE, //100% Controller Compatibility
 | ||||
|     DEATH, //100% Controller Compatibility
 | ||||
|     ///////////////////////////////////////////////////////////
 | ||||
|     /*DO NOT REMOVE!!*/ENUM_END////////////////////////////////
 | ||||
|     ///////////////////////////////////////////////////////////
 | ||||
|  | ||||
| @ -55,7 +55,7 @@ class AiL; | ||||
| 
 | ||||
| enum class Attribute; | ||||
| 
 | ||||
| enum MonsterAnimation{ | ||||
| enum class MonsterAnimation{ | ||||
| 	IDLE, | ||||
| 	JUMP, | ||||
| 	SHOOT, | ||||
|  | ||||
| @ -385,16 +385,16 @@ std::string MonsterData::GetDisplayName(){ | ||||
| } | ||||
| 
 | ||||
| std::string MonsterData::GetIdleAnimation(){ | ||||
| 	return animations[IDLE]; | ||||
| 	return animations[int(MonsterAnimation::IDLE)]; | ||||
| } | ||||
| std::string MonsterData::GetJumpAnimation(){ | ||||
| 	return animations[JUMP]; | ||||
| 	return animations[int(MonsterAnimation::JUMP)]; | ||||
| } | ||||
| std::string MonsterData::GetShootAnimation(){ | ||||
| 	return animations[SHOOT]; | ||||
| 	return animations[int(MonsterAnimation::SHOOT)]; | ||||
| } | ||||
| std::string MonsterData::GetDeathAnimation(){ | ||||
| 	return animations[DEATH]; | ||||
| 	return animations[int(MonsterAnimation::DEATH)]; | ||||
| } | ||||
| const std::vector<MonsterDropData>&MonsterData::GetDropData(){ | ||||
| 	return dropData; | ||||
|  | ||||
| @ -54,6 +54,14 @@ void State_Death::OnStateChange(GameState*prevState){ | ||||
| 		Menu::CloseAllMenus(); | ||||
| 	} | ||||
| 	game->GetPlayer()->SetState(State::DEATH); | ||||
| 	if(!Unlock::IsUnlocked("HUB")){ | ||||
| 		Component<MenuComponent>(DEATH,"Return to Camp Button")->SetLabel(" Return  to \nStage Select"); | ||||
| 	}else{ | ||||
| 		Component<MenuComponent>(DEATH,"Return to Camp Button")->SetLabel("Return  to Camp"); | ||||
| 	} | ||||
| 
 | ||||
| 	gameSlowdownPct=1.f; | ||||
| 	accTime=0.f; | ||||
| } | ||||
| void State_Death::OnLevelLoad(){ | ||||
| 	Component<MenuComponent>(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){ | ||||
|  | ||||
| @ -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 | ||||
|  | ||||
| @ -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 | ||||
|  | ||||
										
											Binary file not shown.
										
									
								
							
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user