diff --git a/Adventures in Lestoria/AdventuresInLestoria.cpp b/Adventures in Lestoria/AdventuresInLestoria.cpp index 394d9b02..69a4de52 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.cpp +++ b/Adventures in Lestoria/AdventuresInLestoria.cpp @@ -361,29 +361,7 @@ bool AiL::OnUserCreate(){ } bool AiL::OnUserUpdate(float fElapsedTime){ - levelTime+=fElapsedTime; - SteamAPI_RunCallbacks(); - STEAMINPUT( - ActivateActionSetForAllControllers(Input::ingameControlsHandle); - Input::UpdateSteamInput(); - ) - - if(GetMousePos()!=lastMousePos){ - lastMouseMovement=0.f; - lastMousePos=GetMousePos(); - }else lastMouseMovement+=fElapsedTime; - - vignetteDisplayTime=std::max(0.f,vignetteDisplayTime-fElapsedTime); - - if(Audio::Engine().IsPlaying(GetPlayer()->cooldownSoundInstance)){ - Audio::Engine().SetVolume(GetPlayer()->cooldownSoundInstance,Audio::GetCalculatedSFXVolume("Audio.Casting Sound Volume"_F/100.f)); - } - - if(!GamePaused()){ - GameState::STATE->OnUserUpdate(this); - }else{ - ClearTimedOutGarbage(); - } + GlobalGameUpdates(); LoadingScreen::Update(); InputListener::Update(); Tutorial::Update(); @@ -1659,20 +1637,6 @@ void AiL::RenderWorld(float fElapsedTime){ for(std::vector>::iterator it=DAMAGENUMBER_LIST.begin();it!=DAMAGENUMBER_LIST.end();++it){ DamageNumber*dn=(*it).get(); - if(dn->pauseTime>0){ - dn->pauseTime-=fElapsedTime; - } else{ - dn->lifeTime+=fElapsedTime; - if(dn->lifeTime<=1){ - if(dn->lifeTimeinvertedDirection){ - dn->pos.y+=dn->riseSpd*fElapsedTime; - }else{ - dn->pos.y-=dn->riseSpd*fElapsedTime; - } - } - } - } #define NumberScalesWithDamage true #define NormalNumber false @@ -3947,4 +3911,50 @@ const float AiL::GetEncounterDuration()const{ void AiL::ShowDamageVignetteOverlay(){ vignetteDisplayTime="Interface.Vignette Appearance Time"_F+"Interface.Vignette Fadeout Time"_F; +} + +void AiL::GlobalGameUpdates(){ + levelTime+=fElapsedTime; + SteamAPI_RunCallbacks(); + STEAMINPUT( + ActivateActionSetForAllControllers(Input::ingameControlsHandle); + Input::UpdateSteamInput(); + ) + + #pragma region Damage Numbers update + for(std::vector>::iterator it=DAMAGENUMBER_LIST.begin();it!=DAMAGENUMBER_LIST.end();++it){ + DamageNumber*dn=(*it).get(); + if(dn->pauseTime>0){ + dn->pauseTime-=fElapsedTime; + } else{ + dn->lifeTime+=fElapsedTime; + if(dn->lifeTime<=1){ + if(dn->lifeTimeinvertedDirection){ + dn->pos.y+=dn->riseSpd*fElapsedTime; + }else{ + dn->pos.y-=dn->riseSpd*fElapsedTime; + } + } + } + } + } + #pragma endregion + + if(GetMousePos()!=lastMousePos){ + lastMouseMovement=0.f; + lastMousePos=GetMousePos(); + }else lastMouseMovement+=fElapsedTime; + + vignetteDisplayTime=std::max(0.f,vignetteDisplayTime-fElapsedTime); + + if(Audio::Engine().IsPlaying(GetPlayer()->cooldownSoundInstance)){ + Audio::Engine().SetVolume(GetPlayer()->cooldownSoundInstance,Audio::GetCalculatedSFXVolume("Audio.Casting Sound Volume"_F/100.f)); + } + + if(!GamePaused()){ + GameState::STATE->OnUserUpdate(this); + }else{ + ClearTimedOutGarbage(); + } } \ No newline at end of file diff --git a/Adventures in Lestoria/AdventuresInLestoria.h b/Adventures in Lestoria/AdventuresInLestoria.h index 4602cc14..64cb81f8 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.h +++ b/Adventures in Lestoria/AdventuresInLestoria.h @@ -321,6 +321,7 @@ public: void ActivateActionSetForAllControllers(InputActionSetHandle_t actionSetHandle); const float GetEncounterDuration()const; void ShowDamageVignetteOverlay(); + void GlobalGameUpdates(); struct TileGroupData{ vi2d tilePos;