Added low health warning visuals and sound effect. Release Build 8145.

mac-build
sigonasr2 9 months ago
parent 1d70685351
commit d21352a633
  1. 13
      Adventures in Lestoria/AdventuresInLestoria.cpp
  2. 11
      Adventures in Lestoria/Player.cpp
  3. 2
      Adventures in Lestoria/Player.h
  4. 6
      Adventures in Lestoria/TODO.txt
  5. 2
      Adventures in Lestoria/Version.h
  6. 11
      Adventures in Lestoria/assets/config/Player.txt
  7. 5
      Adventures in Lestoria/assets/config/audio/events.txt
  8. 1
      Adventures in Lestoria/assets/config/gfx/gfx.txt
  9. BIN
      Adventures in Lestoria/assets/gamepack.pak
  10. BIN
      Adventures in Lestoria/assets/heart.png
  11. BIN
      Adventures in Lestoria/assets/heart_outline.png
  12. BIN
      Adventures in Lestoria/assets/sounds/health_warning.ogg
  13. BIN
      x64/Release/Adventures in Lestoria.exe

@ -1696,12 +1696,21 @@ void AiL::RenderHud(){
RenderCastbar(CastInfo{"Exiting Level...",GetPlayer()->GetEndZoneStandTime(),"Player.End Zone Wait Time"_F}); 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,2},GFX["heart.png"].Decal());
DrawDecal({2,20},GFX["mana.png"].Decal()); DrawDecal({2,20},GFX["mana.png"].Decal());
std::string text=player->GetHealth()>0?std::to_string(healthCounter.GetDisplayValue()):"X"; std::string text=player->GetHealth()>0?std::to_string(healthCounter.GetDisplayValue()):"X";
std::string text_mana=std::to_string(manaCounter.GetDisplayValue()); 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); DrawShadowStringPropDecal({24,23},text_mana,manaCounter.GetDisplayColor(),BLACK,{1.5f,1.5f},INFINITE);
#pragma region Show Max Health/Max Mana #pragma region Show Max Health/Max Mana
@ -1710,7 +1719,7 @@ void AiL::RenderHud(){
std::string maxHealthText="/"+std::to_string(int(player->GetMaxHealth())); std::string maxHealthText="/"+std::to_string(int(player->GetMaxHealth()));
float maxHealthTextHeight=GetTextSizeProp(maxHealthText).y; 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()){ if(GameSettings::ShowMaxMana()){
vf2d manaTextSize=GetTextSizeProp(text_mana)*vf2d{1.5f,1.5f}; vf2d manaTextSize=GetTextSizeProp(text_mana)*vf2d{1.5f,1.5f};

@ -293,6 +293,7 @@ void Player::Update(float fElapsedTime){
notificationDisplay.second=std::max(0.f,notificationDisplay.second-fElapsedTime); notificationDisplay.second=std::max(0.f,notificationDisplay.second-fElapsedTime);
lastHitTimer=std::max(0.f,lastHitTimer-fElapsedTime); lastHitTimer=std::max(0.f,lastHitTimer-fElapsedTime);
lastPathfindingCooldown=std::max(0.f,lastPathfindingCooldown-fElapsedTime); lastPathfindingCooldown=std::max(0.f,lastPathfindingCooldown-fElapsedTime);
lowHealthSoundPlayedTimer=std::max(0.f,lowHealthSoundPlayedTimer-fElapsedTime);
if(hurtRumbleTime>0.f){ if(hurtRumbleTime>0.f){
hurtRumbleTime=std::max(0.f,hurtRumbleTime-fElapsedTime); hurtRumbleTime=std::max(0.f,hurtRumbleTime-fElapsedTime);
if(hurtRumbleTime==0.f){ if(hurtRumbleTime==0.f){
@ -755,6 +756,12 @@ bool Player::Hurt(int damage,bool onUpperLevel,float z){
} }
lastHitTimer=0.05f; 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()<game->GetPlayer()->GetMaxHealth()*0.5f&&!Tutorial::TaskIsComplete(TutorialTaskName::USE_RECOVERY_ITEMS)){ if(game->GetPlayer()->GetHealth()<game->GetPlayer()->GetMaxHealth()*0.5f&&!Tutorial::TaskIsComplete(TutorialTaskName::USE_RECOVERY_ITEMS)){
Tutorial::SetNextTask(TutorialTaskName::USE_RECOVERY_ITEMS); Tutorial::SetNextTask(TutorialTaskName::USE_RECOVERY_ITEMS);
} }
@ -1269,6 +1276,10 @@ void Player::PerformHPRecovery(){
if(GetHealth()<GetMaxHealth()){ if(GetHealth()<GetMaxHealth()){
Heal(hpRecoveryAmt); Heal(hpRecoveryAmt);
} }
if(GetHealth()/GetMaxHealth()>"Player.Health Warning Pct"_F/100.f){
lowHealthSoundPlayed=false;
}
} }
const float Player::GetDamageReductionPct()const{ const float Player::GetDamageReductionPct()const{

@ -313,6 +313,8 @@ private:
//Typical usage is playerInvoked is true on first call, and playerInvoked is false on all subsequent chained calls. //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); bool _SetY(float y,const bool playerInvoked=true);
const bool UsingAutoAim()const; const bool UsingAutoAim()const;
bool lowHealthSoundPlayed=false;
float lowHealthSoundPlayedTimer=0.f;
protected: protected:
const float ATTACK_COOLDOWN="Warrior.Auto Attack.Cooldown"_F; const float ATTACK_COOLDOWN="Warrior.Auto Attack.Cooldown"_F;
const float MAGIC_ATTACK_COOLDOWN="Wizard.Auto Attack.Cooldown"_F; const float MAGIC_ATTACK_COOLDOWN="Wizard.Auto Attack.Cooldown"_F;

@ -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. 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?) should gemstones dropp from boss stages aswell? (Maybe lower droprate?)
Toggle for displaying error messages 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

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 0 #define VERSION_MAJOR 0
#define VERSION_MINOR 5 #define VERSION_MINOR 5
#define VERSION_PATCH 1 #define VERSION_PATCH 1
#define VERSION_BUILD 8142 #define VERSION_BUILD 8145
#define stringify(a) stringify_(a) #define stringify(a) stringify_(a)
#define stringify_(a) #a #define stringify_(a) #a

@ -44,6 +44,17 @@ Player
# How long the rumble lasts when getting hit by a monster. # How long the rumble lasts when getting hit by a monster.
Hurt Rumble Time = 0.1s 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. # Each attack will have _N,_E,_S,_W appended to them once read in-game.
PLAYER_ANIMATION[0] = WARRIOR_WALK PLAYER_ANIMATION[0] = WARRIOR_WALK
PLAYER_ANIMATION[1] = WARRIOR_IDLE PLAYER_ANIMATION[1] = WARRIOR_IDLE

@ -69,6 +69,11 @@ Events
# Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%) # Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%)
File[0] = footsteps_wet.ogg, 100% 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 Buy Item
{ {
# Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%) # Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%)

@ -20,6 +20,7 @@ Images
GFX_FireRing3 = fire_ring3.png GFX_FireRing3 = fire_ring3.png
GFX_FireRing4 = fire_ring4.png GFX_FireRing4 = fire_ring4.png
GFX_Heart = heart.png GFX_Heart = heart.png
GFX_Heart_Outline = heart_outline.png
GFX_Laser = laser.png GFX_Laser = laser.png
GFX_LightningBolt = lightning_bolt.png GFX_LightningBolt = lightning_bolt.png
GFX_LightningBoltParticle1 = lightning_bolt_part1.png GFX_LightningBoltParticle1 = lightning_bolt_part1.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 689 B

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 654 B

Loading…
Cancel
Save