All basic sound effects implemented.

pull/29/head
sigonasr2 1 year ago
parent 8a1d8868c9
commit 3f4c714c42
  1. 5
      Adventures in Lestoria/FireBolt.cpp
  2. 5
      Adventures in Lestoria/LightningBolt.cpp
  3. 2
      Adventures in Lestoria/Meteor.cpp
  4. 6
      Adventures in Lestoria/Player.cpp
  5. 2
      Adventures in Lestoria/PulsatingFire.cpp
  6. 1
      Adventures in Lestoria/SoundEffect.cpp
  7. 2
      Adventures in Lestoria/Version.h
  8. 41
      Adventures in Lestoria/Warrior.cpp
  9. 5
      Adventures in Lestoria/Wizard.cpp
  10. 10
      Adventures in Lestoria/assets/Campaigns/1_2.tmx
  11. 2
      Adventures in Lestoria/assets/config/audio/audio.txt
  12. 20
      Adventures in Lestoria/assets/config/audio/events.txt
  13. BIN
      Adventures in Lestoria/assets/sounds/player_hit1.ogg
  14. BIN
      Adventures in Lestoria/assets/sounds/player_hit2.ogg
  15. BIN
      Adventures in Lestoria/assets/sounds/warrior_auto1.ogg
  16. BIN
      Adventures in Lestoria/assets/sounds/warrior_blockhit1.ogg
  17. BIN
      Adventures in Lestoria/assets/sounds/wizard_lightningbolt.ogg

@ -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<Effect>(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<Effect>(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;
}

@ -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<Effect>(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;
}

@ -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<PulsatingFire>(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);
}

@ -50,6 +50,7 @@ All rights reserved.
#include "MenuComponent.h"
#include "config.h"
#include <string_view>
#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<Effect>(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<Effect>(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){

@ -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);
}

@ -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 "<<std::quoted(eventName)<<" does not have any sound effects loaded/doesn't exist!")
size_t soundEffectChoice=util::random()%soundCount;
int counter=0;
auto it=itr.first;

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 0
#define VERSION_MINOR 2
#define VERSION_PATCH 1
#define VERSION_BUILD 5528
#define VERSION_BUILD 5533
#define stringify(a) stringify_(a)
#define stringify_(a) #a

@ -42,6 +42,7 @@ All rights reserved.
#include "Effect.h"
#include "AdventuresInLestoria.h"
#include "config.h"
#include "SoundEffect.h"
INCLUDE_MONSTER_LIST
INCLUDE_BULLET_LIST
@ -78,25 +79,27 @@ bool Warrior::AutoAttack(){
closest=&m;
}
}
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;
}
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<Bullet>(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

@ -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>(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<Effect>(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>(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>(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

@ -1023,35 +1023,35 @@
<object id="79" name="Blue Slime" type="Monster" x="2522.67" y="2186.67">
<properties>
<property name="Type" propertytype="MonsterName" value="Blue Slime"/>
<property name="spawner" type="object" value="78"/>
<property name="spawner" type="object" value="35"/>
</properties>
<point/>
</object>
<object id="81" name="Blue Slime" type="Monster" x="2517.33" y="1888">
<properties>
<property name="Type" propertytype="MonsterName" value="Blue Slime"/>
<property name="spawner" type="object" value="78"/>
<property name="spawner" type="object" value="35"/>
</properties>
<point/>
</object>
<object id="82" name="Blue Slime" type="Monster" x="2686.67" y="1996">
<properties>
<property name="Type" propertytype="MonsterName" value="Blue Slime"/>
<property name="spawner" type="object" value="78"/>
<property name="spawner" type="object" value="35"/>
</properties>
<point/>
</object>
<object id="83" name="Blue Slime" type="Monster" x="2778.67" y="1882.67">
<properties>
<property name="Type" propertytype="MonsterName" value="Blue Slime"/>
<property name="spawner" type="object" value="78"/>
<property name="spawner" type="object" value="35"/>
</properties>
<point/>
</object>
<object id="84" name="Blue Slime" type="Monster" x="2829.33" y="2113.33">
<properties>
<property name="Type" propertytype="MonsterName" value="Blue Slime"/>
<property name="spawner" type="object" value="78"/>
<property name="spawner" type="object" value="35"/>
</properties>
<point/>
</object>

@ -1,4 +1,6 @@
Audio
{
Environmental Audio Activation Range = 400
Casting Sound Volume = 70%
}

@ -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
{

Loading…
Cancel
Save