Added critical hit sound

Added the critical hit sound and it's functionality within the game
This commit is contained in:
arsenicviscera 2026-03-10 08:19:56 -07:00
parent 3c01ad7a48
commit ad006efa53
8 changed files with 129 additions and 94 deletions

View file

@ -223,6 +223,7 @@ const WCHAR *ConsoleSoundEngine::wchSoundNames[eSoundType_MAX]=
// 4J-PB - Some sounds were updated, but we can't do that for the 360 or we have to do a new sound bank // 4J-PB - Some sounds were updated, but we can't do that for the 360 or we have to do a new sound bank
// instead, we'll add the sounds as new ones and change the code to reference them // instead, we'll add the sounds as new ones and change the code to reference them
L"fire.new_ignite", L"fire.new_ignite",
L"damage.critical" //eSoundType_DAMAGE_CRITICAL
}; };

View file

@ -78,6 +78,16 @@ bool DamageSource::isProjectile()
{ {
return _isProjectile; return _isProjectile;
} }
//whoa new stuff!
bool DamageSource::isCritical()
{
return _isCritical;
}
DamageSource *DamageSource::setCritical()
{
_isCritical = true;
return this;
}
DamageSource *DamageSource::setProjectile() DamageSource *DamageSource::setProjectile()
{ {

View file

@ -47,8 +47,11 @@ private:
bool _scalesWithDifficulty; bool _scalesWithDifficulty;
bool _isMagic; bool _isMagic;
bool _isExplosion; bool _isExplosion;
bool _isCritical;
public: public:
bool isCritical();
DamageSource* setCritical();
bool isProjectile(); bool isProjectile();
DamageSource *setProjectile(); DamageSource *setProjectile();
bool isExplosion(); bool isExplosion();

View file

@ -859,7 +859,12 @@ bool LivingEntity::hurt(DamageSource *source, float dmg)
} }
else else
{ {
if (sound) playSound(getHurtSound(), getSoundVolume(), getVoicePitch()); if (sound) {
//New Critical Sound plays and works for the most part
if (source->isCritical()) playSound(getCritHurtSound(), getSoundVolume(), getVoicePitch());
playSound(getHurtSound(), getSoundVolume(), getVoicePitch());
}
} }
MemSect(0); MemSect(0);
@ -960,6 +965,13 @@ int LivingEntity::getHurtSound()
return eSoundType_DAMAGE_HURT; return eSoundType_DAMAGE_HURT;
} }
int LivingEntity::getCritHurtSound()
{
return eSoundType_DAMAGE_CRITICAL;
}
int LivingEntity::getDeathSound() int LivingEntity::getDeathSound()
{ {
return eSoundType_DAMAGE_HURT; return eSoundType_DAMAGE_HURT;

View file

@ -187,6 +187,7 @@ public:
protected: protected:
virtual int getHurtSound(); virtual int getHurtSound();
virtual int getDeathSound(); virtual int getDeathSound();
virtual int getCritHurtSound();
protected: protected:
virtual void dropRareDeathLoot(int rareLootLevel); virtual void dropRareDeathLoot(int rareLootLevel);

View file

@ -1630,7 +1630,14 @@ void Player::attack(shared_ptr<Entity> entity)
entity->setOnFire(1); entity->setOnFire(1);
} }
DamageSource *damageSource = DamageSource::playerAttack(dynamic_pointer_cast<Player>(shared_from_this())); DamageSource *damageSource = DamageSource::playerAttack(dynamic_pointer_cast<Player>(shared_from_this()));
if (bCrit)
{
damageSource->setCritical();
}
bool wasHurt = entity->hurt(damageSource, dmg); bool wasHurt = entity->hurt(damageSource, dmg);
delete damageSource; delete damageSource;
if (wasHurt) if (wasHurt)

View file

@ -212,7 +212,8 @@ enum eSOUND_TYPE
eSoundType_RANDOM_LEVELUP, eSoundType_RANDOM_LEVELUP,
eSoundType_FIRE_NEWIGNITE, eSoundType_FIRE_NEWIGNITE,
//New ENUM
eSoundType_DAMAGE_CRITICAL,
eSoundType_MAX eSoundType_MAX
}; };