Implemented controller compatibility for the pause menu. Release Build 7447.

This commit is contained in:
2024-02-20 05:49:51 -06:00
parent 397d8abc0a
commit e2cc0aa90c
17 changed files with 125 additions and 23 deletions
+11
View File
@@ -715,6 +715,7 @@ bool Player::Hurt(int damage,bool onUpperLevel,float z){
SoundEffect::PlaySFX("Player Hit",SoundEffect::CENTERED);
}
if(Menu::IsMenuOpen()&&mod_dmg>0)Menu::CloseAllMenus();
hp=std::max(0,hp-int(mod_dmg));
hurtRumbleTime="Player.Hurt Rumble Time"_F;
@@ -978,6 +979,7 @@ void Player::CheckEndZoneCollision(){
if(zone.isUpper==upperLevel&&geom2d::overlaps(GetPos(),zone.zone)){
endZoneStandTime+=game->GetElapsedTime();
if(endZoneStandTime>="Player.End Zone Wait Time"_F){
Component<MenuLabel>(LEVEL_COMPLETE,"Stage Complete Label")->SetLabel("Stage Completed");
GameState::ChangeState(States::LEVEL_COMPLETE);
}
return;
@@ -1035,6 +1037,7 @@ void EntityStats::RecalculateEquipStats(){
equipStats.A(key)+=setStats.A_Read(key);
}
}
game->GetPlayer()->UpdateHealthAndMana();
for(std::weak_ptr<MenuComponent>component:Menu::equipStatListeners){
component.lock()->OnEquipStatsUpdate();
}
@@ -1338,4 +1341,12 @@ const vf2d Player::GetAimingLocation(){
}
const bool Player::UsingAutoAim()const{
return (GameSettings::KeyboardAutoAimEnabled()&&game->LastMouseMovement()>=2.f)||Input::UsingGamepad();
}
void Player::UpdateHealthAndMana(){
//Perform a check to make sure stats are initialized before they can be used.
if(game->GameInitialized()){
hp=std::min(hp,int(GetStat("Health")));
mana=std::min(mana,GetMaxMana());
}
}