Move global update items to its own game loop update function. Damage numbers now update on the overworld map menu.
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
6b2f9e80e8
commit
793815e9ce
@ -361,29 +361,7 @@ bool AiL::OnUserCreate(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool AiL::OnUserUpdate(float fElapsedTime){
|
bool AiL::OnUserUpdate(float fElapsedTime){
|
||||||
levelTime+=fElapsedTime;
|
GlobalGameUpdates();
|
||||||
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();
|
|
||||||
}
|
|
||||||
LoadingScreen::Update();
|
LoadingScreen::Update();
|
||||||
InputListener::Update();
|
InputListener::Update();
|
||||||
Tutorial::Update();
|
Tutorial::Update();
|
||||||
@ -1659,20 +1637,6 @@ void AiL::RenderWorld(float fElapsedTime){
|
|||||||
|
|
||||||
for(std::vector<std::shared_ptr<DamageNumber>>::iterator it=DAMAGENUMBER_LIST.begin();it!=DAMAGENUMBER_LIST.end();++it){
|
for(std::vector<std::shared_ptr<DamageNumber>>::iterator it=DAMAGENUMBER_LIST.begin();it!=DAMAGENUMBER_LIST.end();++it){
|
||||||
DamageNumber*dn=(*it).get();
|
DamageNumber*dn=(*it).get();
|
||||||
if(dn->pauseTime>0){
|
|
||||||
dn->pauseTime-=fElapsedTime;
|
|
||||||
} else{
|
|
||||||
dn->lifeTime+=fElapsedTime;
|
|
||||||
if(dn->lifeTime<=1){
|
|
||||||
if(dn->lifeTime<DamageNumber::MOVE_UP_TIME){
|
|
||||||
if(dn->invertedDirection){
|
|
||||||
dn->pos.y+=dn->riseSpd*fElapsedTime;
|
|
||||||
}else{
|
|
||||||
dn->pos.y-=dn->riseSpd*fElapsedTime;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#define NumberScalesWithDamage true
|
#define NumberScalesWithDamage true
|
||||||
#define NormalNumber false
|
#define NormalNumber false
|
||||||
@ -3948,3 +3912,49 @@ const float AiL::GetEncounterDuration()const{
|
|||||||
void AiL::ShowDamageVignetteOverlay(){
|
void AiL::ShowDamageVignetteOverlay(){
|
||||||
vignetteDisplayTime="Interface.Vignette Appearance Time"_F+"Interface.Vignette Fadeout Time"_F;
|
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<std::shared_ptr<DamageNumber>>::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->lifeTime<DamageNumber::MOVE_UP_TIME){
|
||||||
|
if(dn->invertedDirection){
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
@ -321,6 +321,7 @@ public:
|
|||||||
void ActivateActionSetForAllControllers(InputActionSetHandle_t actionSetHandle);
|
void ActivateActionSetForAllControllers(InputActionSetHandle_t actionSetHandle);
|
||||||
const float GetEncounterDuration()const;
|
const float GetEncounterDuration()const;
|
||||||
void ShowDamageVignetteOverlay();
|
void ShowDamageVignetteOverlay();
|
||||||
|
void GlobalGameUpdates();
|
||||||
|
|
||||||
struct TileGroupData{
|
struct TileGroupData{
|
||||||
vi2d tilePos;
|
vi2d tilePos;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user