diff --git a/Adventures in Lestoria/AdventuresInLestoria.cpp b/Adventures in Lestoria/AdventuresInLestoria.cpp index 7a2c3dd2..63276fc6 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.cpp +++ b/Adventures in Lestoria/AdventuresInLestoria.cpp @@ -1696,12 +1696,21 @@ void AiL::RenderHud(){ RenderCastbar(CastInfo{"Exiting Level...",GetPlayer()->GetEndZoneStandTime(),"Player.End Zone Wait Time"_F}); } + Pixel healthOutlineCol=BLACK; + if(player->GetHealth()/player->GetMaxHealth()<="Player.Health Warning Pct"_F/100.f){ + float runTimeAmt=fmod(GetRuntime(),"Player.Health Warning Flicker Time"_F*2); + if(runTimeAmt<"Player.Health Warning Flicker Time"_F){ + healthOutlineCol="Player.Health Warning Outline Color"_Pixel; + } + } + + DrawDecal({2,2},GFX["heart_outline.png"].Decal(),{1.f,1.f},healthOutlineCol); DrawDecal({2,2},GFX["heart.png"].Decal()); DrawDecal({2,20},GFX["mana.png"].Decal()); std::string text=player->GetHealth()>0?std::to_string(healthCounter.GetDisplayValue()):"X"; std::string text_mana=std::to_string(manaCounter.GetDisplayValue()); - DrawShadowStringPropDecal({20,3},text,healthCounter.GetDisplayColor(),BLACK,{2,2},INFINITE); + DrawShadowStringPropDecal({20,3},text,healthCounter.GetDisplayColor(),healthOutlineCol,{2,2},INFINITE); DrawShadowStringPropDecal({24,23},text_mana,manaCounter.GetDisplayColor(),BLACK,{1.5f,1.5f},INFINITE); #pragma region Show Max Health/Max Mana @@ -1710,7 +1719,7 @@ void AiL::RenderHud(){ std::string maxHealthText="/"+std::to_string(int(player->GetMaxHealth())); float maxHealthTextHeight=GetTextSizeProp(maxHealthText).y; - DrawShadowStringPropDecal(vf2d{20,3}+healthTextSize+vf2d{1.f,-maxHealthTextHeight},maxHealthText,{200,200,200,255},BLACK,{1.f,1.f},INFINITE); + DrawShadowStringPropDecal(vf2d{20,3}+healthTextSize+vf2d{1.f,-maxHealthTextHeight},maxHealthText,{200,200,200,255},healthOutlineCol,{1.f,1.f},INFINITE); } if(GameSettings::ShowMaxMana()){ vf2d manaTextSize=GetTextSizeProp(text_mana)*vf2d{1.5f,1.5f}; diff --git a/Adventures in Lestoria/Player.cpp b/Adventures in Lestoria/Player.cpp index e8e0467e..28912630 100644 --- a/Adventures in Lestoria/Player.cpp +++ b/Adventures in Lestoria/Player.cpp @@ -293,6 +293,7 @@ void Player::Update(float fElapsedTime){ notificationDisplay.second=std::max(0.f,notificationDisplay.second-fElapsedTime); lastHitTimer=std::max(0.f,lastHitTimer-fElapsedTime); lastPathfindingCooldown=std::max(0.f,lastPathfindingCooldown-fElapsedTime); + lowHealthSoundPlayedTimer=std::max(0.f,lowHealthSoundPlayedTimer-fElapsedTime); if(hurtRumbleTime>0.f){ hurtRumbleTime=std::max(0.f,hurtRumbleTime-fElapsedTime); if(hurtRumbleTime==0.f){ @@ -755,6 +756,12 @@ bool Player::Hurt(int damage,bool onUpperLevel,float z){ } lastHitTimer=0.05f; + if(!lowHealthSoundPlayed&&lowHealthSoundPlayedTimer==0.f&&GetHealth()/GetMaxHealth()<="Player.Health Warning Pct"_F/100.f){ + SoundEffect::PlaySFX("Health Warning",SoundEffect::CENTERED); + lowHealthSoundPlayed=true; + lowHealthSoundPlayedTimer="Player.Health Warning Cooldown"_F; + } + if(game->GetPlayer()->GetHealth()GetPlayer()->GetMaxHealth()*0.5f&&!Tutorial::TaskIsComplete(TutorialTaskName::USE_RECOVERY_ITEMS)){ Tutorial::SetNextTask(TutorialTaskName::USE_RECOVERY_ITEMS); } @@ -1269,6 +1276,10 @@ void Player::PerformHPRecovery(){ if(GetHealth()"Player.Health Warning Pct"_F/100.f){ + lowHealthSoundPlayed=false; + } } const float Player::GetDamageReductionPct()const{ diff --git a/Adventures in Lestoria/Player.h b/Adventures in Lestoria/Player.h index 372b089b..c0caa663 100644 --- a/Adventures in Lestoria/Player.h +++ b/Adventures in Lestoria/Player.h @@ -313,6 +313,8 @@ private: //Typical usage is playerInvoked is true on first call, and playerInvoked is false on all subsequent chained calls. bool _SetY(float y,const bool playerInvoked=true); const bool UsingAutoAim()const; + bool lowHealthSoundPlayed=false; + float lowHealthSoundPlayedTimer=0.f; protected: const float ATTACK_COOLDOWN="Warrior.Auto Attack.Cooldown"_F; const float MAGIC_ATTACK_COOLDOWN="Wizard.Auto Attack.Cooldown"_F; diff --git a/Adventures in Lestoria/TODO.txt b/Adventures in Lestoria/TODO.txt index 3ac46e87..ada871f3 100644 --- a/Adventures in Lestoria/TODO.txt +++ b/Adventures in Lestoria/TODO.txt @@ -8,8 +8,4 @@ Materials for initial craft seems to be wrong? need to recheck do we need a minimap? (maybe with fog of war?) Maybe polling that once testing with more people. should gemstones dropp from boss stages aswell? (Maybe lower droprate?) -Toggle for displaying error messages - -Low health warning - -I think thats your easiest bet, option to display as is, full numbers (which may/will get super small), and scientific notation as a middle ground if the full one does get crazy. That should please most people looking for information on those stats \ No newline at end of file +Toggle for displaying error messages \ No newline at end of file diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index 21ac1d5e..85784e4b 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 5 #define VERSION_PATCH 1 -#define VERSION_BUILD 8142 +#define VERSION_BUILD 8145 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Adventures in Lestoria/assets/config/Player.txt b/Adventures in Lestoria/assets/config/Player.txt index 816d5ca3..2c9424c7 100644 --- a/Adventures in Lestoria/assets/config/Player.txt +++ b/Adventures in Lestoria/assets/config/Player.txt @@ -44,6 +44,17 @@ Player # How long the rumble lasts when getting hit by a monster. Hurt Rumble Time = 0.1s + # Warning sound percentage threshold + Health Warning Pct = 30% + + # Warning sound cooldown + Health Warning Cooldown = 8.0s + + # Health Warning Flicker On/Off + Health Warning Flicker Time = 0.5s + + Health Warning Outline Color = 255,0,0,255 + # Each attack will have _N,_E,_S,_W appended to them once read in-game. PLAYER_ANIMATION[0] = WARRIOR_WALK PLAYER_ANIMATION[1] = WARRIOR_IDLE diff --git a/Adventures in Lestoria/assets/config/audio/events.txt b/Adventures in Lestoria/assets/config/audio/events.txt index 4b5535c0..caca40fe 100644 --- a/Adventures in Lestoria/assets/config/audio/events.txt +++ b/Adventures in Lestoria/assets/config/audio/events.txt @@ -69,6 +69,11 @@ Events # Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%) File[0] = footsteps_wet.ogg, 100% } + Health Warning + { + # Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%) + File[0] = health_warning.ogg, 80% + } Buy Item { # Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%) diff --git a/Adventures in Lestoria/assets/config/gfx/gfx.txt b/Adventures in Lestoria/assets/config/gfx/gfx.txt index c3d9caa5..7fb0ee8e 100644 --- a/Adventures in Lestoria/assets/config/gfx/gfx.txt +++ b/Adventures in Lestoria/assets/config/gfx/gfx.txt @@ -20,6 +20,7 @@ Images GFX_FireRing3 = fire_ring3.png GFX_FireRing4 = fire_ring4.png GFX_Heart = heart.png + GFX_Heart_Outline = heart_outline.png GFX_Laser = laser.png GFX_LightningBolt = lightning_bolt.png GFX_LightningBoltParticle1 = lightning_bolt_part1.png diff --git a/Adventures in Lestoria/assets/gamepack.pak b/Adventures in Lestoria/assets/gamepack.pak index d8a61b4d..45769436 100644 Binary files a/Adventures in Lestoria/assets/gamepack.pak and b/Adventures in Lestoria/assets/gamepack.pak differ diff --git a/Adventures in Lestoria/assets/heart.png b/Adventures in Lestoria/assets/heart.png index 952156ec..3bf8d1b4 100644 Binary files a/Adventures in Lestoria/assets/heart.png and b/Adventures in Lestoria/assets/heart.png differ diff --git a/Adventures in Lestoria/assets/heart_outline.png b/Adventures in Lestoria/assets/heart_outline.png new file mode 100644 index 00000000..9e9fe3cf Binary files /dev/null and b/Adventures in Lestoria/assets/heart_outline.png differ diff --git a/Adventures in Lestoria/assets/sounds/health_warning.ogg b/Adventures in Lestoria/assets/sounds/health_warning.ogg new file mode 100644 index 00000000..41dffd54 Binary files /dev/null and b/Adventures in Lestoria/assets/sounds/health_warning.ogg differ diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index 63c3a460..5dbeeada 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ