diff --git a/Adventures in Lestoria/FireBolt.cpp b/Adventures in Lestoria/FireBolt.cpp index e6c23e0a..685e0c3f 100644 --- a/Adventures in Lestoria/FireBolt.cpp +++ b/Adventures in Lestoria/FireBolt.cpp @@ -40,6 +40,7 @@ All rights reserved. #include "AdventuresInLestoria.h" #include "DEFINES.h" #include "util.h" +#include "SoundEffect.h" INCLUDE_game INCLUDE_MONSTER_LIST @@ -61,6 +62,8 @@ bool FireBolt::PlayerHit(Player*player) deactivated=true; fadeOutTime="Wizard.Ability 1.BulletHitFadeoutTime"_F; game->AddEffect(std::make_unique(player->GetPos(),0,"splash_effect.png",upperLevel,5,0.25,vf2d{},Pixel{240,120,60})); + + SoundEffect::PlaySFX("Wizard Fire Bolt Hit",pos); return false; } @@ -74,5 +77,7 @@ bool FireBolt::MonsterHit(Monster& monster) game->SetupWorldShake("Wizard.Ability 1.WorldShakeTime"_F); game->HurtEnemies(monster.GetPos(),"Wizard.Ability 1.BulletHitExplosionRange"_F/100*12,int("Wizard.Ability 1.BulletHitExplosionDamageMult"_F*game->GetPlayer()->GetAttack()),OnUpperLevel(),0); game->AddEffect(std::make_unique(monster.GetPos(),0,"splash_effect.png",upperLevel,"Wizard.Ability 1.BulletHitExplosionRange"_F/100*2,"Wizard.Ability 1.BulletHitExplosionFadeoutTime"_F,vf2d{},"Wizard.Ability 1.BulletHitExplosionColor"_Pixel)); + + SoundEffect::PlaySFX("Wizard Fire Bolt Hit",pos); return false; } diff --git a/Adventures in Lestoria/LightningBolt.cpp b/Adventures in Lestoria/LightningBolt.cpp index 20c601ab..68c23caf 100644 --- a/Adventures in Lestoria/LightningBolt.cpp +++ b/Adventures in Lestoria/LightningBolt.cpp @@ -41,6 +41,7 @@ All rights reserved. #include "DEFINES.h" #include "Emitter.h" #include "util.h" +#include "SoundEffect.h" INCLUDE_game INCLUDE_MONSTER_LIST @@ -78,6 +79,8 @@ bool LightningBolt::PlayerHit(Player*player) deactivated=true; fadeOutTime="Wizard.Ability 2.BulletFadeoutTime"_F; game->AddEffect(std::make_unique(player->GetPos(),"Wizard.Ability 2.SplashLifetime"_F,"lightning_splash_effect.png",upperLevel,player->GetSizeMult(),"Wizard.Ability 2.SplashFadeoutTime"_F,vf2d{},WHITE,"Wizard.Ability 2.SplashRotationRange"_FRange)); + + SoundEffect::PlaySFX("Wizard Lightning Bolt Hit",pos); return false; } @@ -100,5 +103,7 @@ bool LightningBolt::MonsterHit(Monster& monster) } if(targetsHit>=2)break; } + + SoundEffect::PlaySFX("Wizard Lightning Bolt Hit",pos); return false; } \ No newline at end of file diff --git a/Adventures in Lestoria/Meteor.cpp b/Adventures in Lestoria/Meteor.cpp index 2cb1da16..d55a66a4 100644 --- a/Adventures in Lestoria/Meteor.cpp +++ b/Adventures in Lestoria/Meteor.cpp @@ -40,6 +40,7 @@ All rights reserved. #include "AdventuresInLestoria.h" #include "util.h" #include "safemap.h" +#include "SoundEffect.h" INCLUDE_game INCLUDE_MONSTER_LIST @@ -64,6 +65,7 @@ bool Meteor::Update(float fElapsedTime){ } game->HurtEnemies(pos,"Wizard.Ability 3.MeteorRadius"_F/100*24,int(game->GetPlayer()->GetAttack()*"Wizard.Ability 3.MeteorDamageMult"_F),OnUpperLevel(),0); game->AddEffect(std::make_unique(pos,"Wizard.Ability 3.FireRingLifetime"_F,"fire_ring1.png",OnUpperLevel(),vf2d{"Wizard.Ability 3.MeteorRadius"_F/100*2,"Wizard.Ability 3.MeteorRadius"_F/100*2},"Wizard.Ability 3.FireRingFadeoutTime"_F),true); + SoundEffect::PlaySFX("Wizard Meteor",pos); } return Effect::Update(fElapsedTime); } diff --git a/Adventures in Lestoria/Player.cpp b/Adventures in Lestoria/Player.cpp index 3f186c30..8a154316 100644 --- a/Adventures in Lestoria/Player.cpp +++ b/Adventures in Lestoria/Player.cpp @@ -50,6 +50,7 @@ All rights reserved. #include "MenuComponent.h" #include "config.h" #include +#include "SoundEffect.h" INCLUDE_MONSTER_DATA INCLUDE_MONSTER_LIST @@ -276,6 +277,7 @@ void Player::Update(float fElapsedTime){ if(state==State::CASTING){ if(!Audio::Engine().IsPlaying(cooldownSoundInstance)){ + Audio::Engine().SetVolume(cooldownSoundInstance,"Audio.Casting Sound Volume"_F/100.f); Audio::Engine().Play(cooldownSoundInstance,true); } }else{ @@ -329,6 +331,7 @@ void Player::Update(float fElapsedTime){ float numb=4; game->HurtEnemies(pos,"Warrior.Ability 2.Range"_F/100*12,int(GetAttack()*"Warrior.Ability 2.DamageMult"_F),OnUpperLevel(),0); game->AddEffect(std::make_unique(GetPos(),"Warrior.Ability 2.EffectLifetime"_F,"ground-slam-attack-front.png",upperLevel,"Warrior.Ability 2.Range"_F/300*1.33f,"Warrior.Ability 2.EffectFadetime"_F),std::make_unique(GetPos(),"Warrior.Ability 2.EffectLifetime"_F,"ground-slam-attack-back.png",upperLevel,"Warrior.Ability 2.Range"_F/300*1.33f,"Warrior.Ability 2.EffectFadetime"_F)); + SoundEffect::PlaySFX("Warrior Ground Slam",SoundEffect::CENTERED); } if(lastAnimationFlip>0){ lastAnimationFlip=std::max(0.f,lastAnimationFlip-fElapsedTime); @@ -627,6 +630,7 @@ bool Player::Hurt(int damage,bool onUpperLevel,float z){ float mod_dmg=float(damage); if(GetState()==State::BLOCK){ mod_dmg=0; + SoundEffect::PlaySFX("Warrior Block Hit",SoundEffect::CENTERED); }else{ float otherDmgTaken=1-GetDamageReductionFromBuffs(); float armorDmgTaken=1-GetDamageReductionFromArmor(); @@ -649,6 +653,8 @@ bool Player::Hurt(int damage,bool onUpperLevel,float z){ mod_dmg*=1-dmgRoll; mod_dmg=std::ceil(mod_dmg); + + SoundEffect::PlaySFX("Player Hit",SoundEffect::CENTERED); } hp=std::max(0,hp-int(mod_dmg)); if(lastHitTimer>0){ diff --git a/Adventures in Lestoria/PulsatingFire.cpp b/Adventures in Lestoria/PulsatingFire.cpp index 948598ef..03408f79 100644 --- a/Adventures in Lestoria/PulsatingFire.cpp +++ b/Adventures in Lestoria/PulsatingFire.cpp @@ -40,6 +40,7 @@ All rights reserved. #include "AdventuresInLestoria.h" #include "util.h" #include "safemap.h" +#include "SoundEffect.h" INCLUDE_game INCLUDE_ANIMATION_DATA @@ -69,6 +70,7 @@ bool PulsatingFire::Update(float fElapsedTime){ if(lastDamageTimer<=0){ lastDamageTimer="Wizard.Ability 3.FireRingDamageFreq"_F-0.01f; game->HurtEnemies(pos,"Wizard.Ability 3.MeteorRadius"_F/100*24,int(game->GetPlayer()->GetAttack()*"Wizard.Ability 3.FireRingDamageMult"_F),OnUpperLevel(),0); + SoundEffect::PlaySFX("Wizard Meteor Flames",pos); } return Effect::Update(fElapsedTime); } diff --git a/Adventures in Lestoria/SoundEffect.cpp b/Adventures in Lestoria/SoundEffect.cpp index 484442c0..a4f739dc 100644 --- a/Adventures in Lestoria/SoundEffect.cpp +++ b/Adventures in Lestoria/SoundEffect.cpp @@ -69,6 +69,7 @@ void SoundEffect::PlaySFX(const std::string_view eventName,const vf2d&pos){ if(eventName.length()==0)return; auto itr=SOUND_EFFECTS.equal_range(std::string(eventName)); size_t soundCount=std::distance(itr.first,itr.second); + if(soundCount==0)ERR("WARNING! Sound Effect "<Hurt(int(GetAttack()*"Warrior.Auto Attack.DamageMult"_F),OnUpperLevel(),GetZ())){ - attack_cooldown_timer=ATTACK_COOLDOWN-GetAttackRecoveryRateReduction(); - swordSwingTimer="Warrior.Auto Attack.SwordSwingTime"_F; - SetState(State::SWING_SWORD); - switch(facingDirection){ - case DOWN:{ - UpdateAnimation("WARRIOR_SWINGSWORD_S",WARRIOR|THIEF); - }break; - case RIGHT:{ - UpdateAnimation("WARRIOR_SWINGSWORD_E",WARRIOR|THIEF); - }break; - case LEFT:{ - UpdateAnimation("WARRIOR_SWINGSWORD_W",WARRIOR|THIEF); - }break; - case UP:{ - UpdateAnimation("WARRIOR_SWINGSWORD_N",WARRIOR|THIEF); - }break; - } + if(closest!=nullptr){ + closest->Hurt(int(GetAttack()*"Warrior.Auto Attack.DamageMult"_F),OnUpperLevel(),GetZ()); + } + attack_cooldown_timer=ATTACK_COOLDOWN-GetAttackRecoveryRateReduction(); + swordSwingTimer="Warrior.Auto Attack.SwordSwingTime"_F; + SetState(State::SWING_SWORD); + switch(facingDirection){ + case DOWN:{ + UpdateAnimation("WARRIOR_SWINGSWORD_S",WARRIOR|THIEF); + }break; + case RIGHT:{ + UpdateAnimation("WARRIOR_SWINGSWORD_E",WARRIOR|THIEF); + }break; + case LEFT:{ + UpdateAnimation("WARRIOR_SWINGSWORD_W",WARRIOR|THIEF); + }break; + case UP:{ + UpdateAnimation("WARRIOR_SWINGSWORD_N",WARRIOR|THIEF); + }break; } + SoundEffect::PlaySFX("Warrior Auto Attack",SoundEffect::CENTERED); } return true; } @@ -125,6 +128,7 @@ void Warrior::InitializeClassAbilities(){ m.AddBuff(BuffType::SLOWDOWN,"Warrior.Ability 1.SlowdownDuration"_F,"Warrior.Ability 1.SlowdownAmt"_F); } } + SoundEffect::PlaySFX("Warrior Battlecry",SoundEffect::CENTERED); return true; }; #pragma endregion @@ -166,6 +170,7 @@ void Warrior::InitializeClassAbilities(){ } BULLET_LIST.push_back(std::make_unique(p->GetPos(),bulletVel,"Warrior.Ability 3.Radius"_F,p->GetAttack()*"Warrior.Ability 3.DamageMult"_F,"sonicslash.png",p->upperLevel,true,"Warrior.Ability 3.Lifetime"_F,true,true,WHITE,vf2d{"Warrior.Ability 3.Radius"_F/30,"Warrior.Ability 3.Radius"_F/30})); game->SetupWorldShake("Warrior.Ability 3.ShakeTime"_F); + SoundEffect::PlaySFX("Warrior Sonic Slash",SoundEffect::CENTERED); return true; }; #pragma endregion diff --git a/Adventures in Lestoria/Wizard.cpp b/Adventures in Lestoria/Wizard.cpp index 1ef5b8d5..6bded088 100644 --- a/Adventures in Lestoria/Wizard.cpp +++ b/Adventures in Lestoria/Wizard.cpp @@ -44,6 +44,7 @@ All rights reserved. #include "BulletTypes.h" #include "config.h" #include "util.h" +#include "SoundEffect.h" INCLUDE_MONSTER_LIST INCLUDE_BULLET_LIST @@ -105,6 +106,7 @@ bool Wizard::AutoAttack(){ attack_cooldown_timer=MAGIC_ATTACK_COOLDOWN-GetAttackRecoveryRateReduction(); float angleToCursor=atan2(game->GetWorldMousePos().y-GetPos().y,game->GetWorldMousePos().x-GetPos().x); BULLET_LIST.push_back(std::make_unique(EnergyBolt(GetPos(),{cos(angleToCursor)*"Wizard.Auto Attack.Speed"_F,sin(angleToCursor)*"Wizard.Auto Attack.Speed"_F},"Wizard.Auto Attack.Radius"_F/100*12,int(GetAttack()*"Wizard.Auto Attack.DamageMult"_F),upperLevel,true,WHITE))); + SoundEffect::PlaySFX("Wizard Auto Attack",SoundEffect::CENTERED); return true; } void Wizard::InitializeClassAbilities(){ @@ -129,6 +131,7 @@ void Wizard::InitializeClassAbilities(){ for(int i=0;i<"Wizard.Right Click Ability.ParticleCount"_I;i++){ game->AddEffect(std::make_unique(p->GetPos()+vf2d{(util::random("Wizard.Right Click Ability.ParticleRange"_F/100*2)-"Wizard.Right Click Ability.ParticleRange"_F/100)*12,(util::random("Wizard.Right Click Ability.ParticleRange"_F/100*2)-"Wizard.Right Click Ability.ParticleRange"_F/100)*12},util::random("Wizard.Right Click Ability.ParticleLifetimeMax"_F)+"Wizard.Right Click Ability.ParticleLifetimeMin"_F,"circle.png",p->upperLevel,"Wizard.Right Click Ability.ParticleSize"_F,"Wizard.Right Click Ability.ParticleFadetime"_F,vf2d{util::random("Wizard.Right Click Ability.ParticleSpeedMax"_F*2)+"Wizard.Right Click Ability.ParticleSpeedMin"_F,util::random("Wizard.Right Click Ability.ParticleSpeedMax"_F*2)+"Wizard.Right Click Ability.ParticleSpeedMin"_F},"Wizard.Right Click Ability.ParticleColor"_Pixel)); } + SoundEffect::PlaySFX("Wizard Teleport",SoundEffect::CENTERED); return true; } else { p->notificationDisplay={"Cannot Teleport to that location!",0.5}; @@ -141,6 +144,7 @@ void Wizard::InitializeClassAbilities(){ [](Player*p,vf2d pos={}){ float angleToCursor=atan2(game->GetWorldMousePos().y-p->GetPos().y,game->GetWorldMousePos().x-p->GetPos().x); BULLET_LIST.push_back(std::make_unique(FireBolt(p->GetPos(),{cos(angleToCursor)*"Wizard.Ability 1.BulletSpeed"_F,sin(angleToCursor)*"Wizard.Ability 1.BulletSpeed"_F},"Wizard.Ability 1.Radius"_F/100*12,int(p->GetAttack()*"Wizard.Ability 1.InitialDamageMult"_F),p->upperLevel,true,"Wizard.Ability 1.BulletColor"_Pixel))); + SoundEffect::PlaySFX("Wizard Fire Bolt Shoot",SoundEffect::CENTERED); return true; }; #pragma endregion @@ -149,6 +153,7 @@ void Wizard::InitializeClassAbilities(){ [](Player*p,vf2d pos={}){ float angleToCursor=atan2(game->GetWorldMousePos().y-p->GetPos().y,game->GetWorldMousePos().x-p->GetPos().x); BULLET_LIST.push_back(std::make_unique(LightningBolt(p->GetPos(),{cos(angleToCursor)*"Wizard.Ability 2.BulletSpeed"_F,sin(angleToCursor)*"Wizard.Ability 2.BulletSpeed"_F},"Wizard.Ability 2.Radius"_F/100*12,int(p->GetAttack()*"Wizard.Ability 2.DamageMult"_F),p->upperLevel,true,"Wizard.Ability 2.BulletColor"_Pixel))); + SoundEffect::PlaySFX("Wizard Lightning Bolt Shoot",SoundEffect::CENTERED); return true; }; #pragma endregion diff --git a/Adventures in Lestoria/assets/Campaigns/1_2.tmx b/Adventures in Lestoria/assets/Campaigns/1_2.tmx index 998198f2..62232b0f 100644 --- a/Adventures in Lestoria/assets/Campaigns/1_2.tmx +++ b/Adventures in Lestoria/assets/Campaigns/1_2.tmx @@ -1023,35 +1023,35 @@ - + - + - + - + - + diff --git a/Adventures in Lestoria/assets/config/audio/audio.txt b/Adventures in Lestoria/assets/config/audio/audio.txt index 316d4ff4..5eb05e6c 100644 --- a/Adventures in Lestoria/assets/config/audio/audio.txt +++ b/Adventures in Lestoria/assets/config/audio/audio.txt @@ -1,4 +1,6 @@ Audio { Environmental Audio Activation Range = 400 + + Casting Sound Volume = 70% } \ No newline at end of file diff --git a/Adventures in Lestoria/assets/config/audio/events.txt b/Adventures in Lestoria/assets/config/audio/events.txt index 08750a27..2b2e7419 100644 --- a/Adventures in Lestoria/assets/config/audio/events.txt +++ b/Adventures in Lestoria/assets/config/audio/events.txt @@ -68,6 +68,12 @@ Events # Specify file names, followed by volume % File[0] = monster_hurt.ogg, 40% } + Player Hit + { + # Specify file names, followed by volume % + File[0] = player_hit1.ogg, 40% + File[1] = player_hit2.ogg, 100% + } Ranger Auto Attack { # Specify file names, followed by volume % @@ -131,7 +137,7 @@ Events Warrior Auto Attack { # Specify file names, followed by volume % - File[0] = warrior_auto1.ogg, 100% + File[0] = warrior_auto1.ogg, 60% } Warrior Battlecry { @@ -152,15 +158,15 @@ Events Warrior Sonic Slash { # Specify file names, followed by volume % - File[0] = warrior_sonicslash.ogg, 100% + File[0] = warrior_sonicslash.ogg, 70% } Wizard Auto Attack { # Specify file names, followed by volume % - File[0] = wizard_auto1.ogg, 100% - File[1] = wizard_auto2.ogg, 100% + File[0] = wizard_auto1.ogg, 60% + File[1] = wizard_auto2.ogg, 60% } - Wizard Fire Bolt + Wizard Fire Bolt Shoot { # Specify file names, followed by volume % File[0] = wizard_firebolt.ogg, 100% @@ -170,10 +176,10 @@ Events # Specify file names, followed by volume % File[0] = wizard_firebolt_hit.ogg, 100% } - Wizard Lightning Bolt + Wizard Lightning Bolt Shoot { # Specify file names, followed by volume % - File[0] = wizard_lightningbolt.ogg, 100% + File[0] = wizard_lightningbolt.ogg, 60% } Wizard Lightning Bolt Hit { diff --git a/Adventures in Lestoria/assets/sounds/player_hit1.ogg b/Adventures in Lestoria/assets/sounds/player_hit1.ogg new file mode 100644 index 00000000..83cc232f Binary files /dev/null and b/Adventures in Lestoria/assets/sounds/player_hit1.ogg differ diff --git a/Adventures in Lestoria/assets/sounds/player_hit2.ogg b/Adventures in Lestoria/assets/sounds/player_hit2.ogg new file mode 100644 index 00000000..36a0c01c Binary files /dev/null and b/Adventures in Lestoria/assets/sounds/player_hit2.ogg differ diff --git a/Adventures in Lestoria/assets/sounds/warrior_auto1.ogg b/Adventures in Lestoria/assets/sounds/warrior_auto1.ogg index 3b3a47f6..7fd053c7 100644 Binary files a/Adventures in Lestoria/assets/sounds/warrior_auto1.ogg and b/Adventures in Lestoria/assets/sounds/warrior_auto1.ogg differ diff --git a/Adventures in Lestoria/assets/sounds/warrior_blockhit1.ogg b/Adventures in Lestoria/assets/sounds/warrior_blockhit1.ogg index 2f93af8f..6235df90 100644 Binary files a/Adventures in Lestoria/assets/sounds/warrior_blockhit1.ogg and b/Adventures in Lestoria/assets/sounds/warrior_blockhit1.ogg differ diff --git a/Adventures in Lestoria/assets/sounds/wizard_lightningbolt.ogg b/Adventures in Lestoria/assets/sounds/wizard_lightningbolt.ogg index a8cbb4da..8609b401 100644 Binary files a/Adventures in Lestoria/assets/sounds/wizard_lightningbolt.ogg and b/Adventures in Lestoria/assets/sounds/wizard_lightningbolt.ogg differ