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
// instead, we'll add the sounds as new ones and change the code to reference them
L"fire.new_ignite",
L"damage.critical" //eSoundType_DAMAGE_CRITICAL
};

View file

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

View file

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

View file

@ -859,7 +859,12 @@ bool LivingEntity::hurt(DamageSource *source, float dmg)
}
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);
@ -960,6 +965,13 @@ int LivingEntity::getHurtSound()
return eSoundType_DAMAGE_HURT;
}
int LivingEntity::getCritHurtSound()
{
return eSoundType_DAMAGE_CRITICAL;
}
int LivingEntity::getDeathSound()
{
return eSoundType_DAMAGE_HURT;

View file

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

View file

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

View file

@ -114,105 +114,106 @@ enum eSOUND_TYPE
eSoundType_STEP_CLOTH,
eSoundType_STEP_SAND,
// soundbank 2
eSoundType_MOB_ENDERDRAGON_END,
eSoundType_MOB_ENDERDRAGON_GROWL,
eSoundType_MOB_ENDERDRAGON_HIT,
eSoundType_MOB_ENDERDRAGON_MOVE,
eSoundType_MOB_IRONGOLEM_THROW,
eSoundType_MOB_IRONGOLEM_HIT,
eSoundType_MOB_IRONGOLEM_DEATH,
eSoundType_MOB_IRONGOLEM_WALK,
eSoundType_MOB_ENDERDRAGON_END,
eSoundType_MOB_ENDERDRAGON_GROWL,
eSoundType_MOB_ENDERDRAGON_HIT,
eSoundType_MOB_ENDERDRAGON_MOVE,
eSoundType_MOB_IRONGOLEM_THROW,
eSoundType_MOB_IRONGOLEM_HIT,
eSoundType_MOB_IRONGOLEM_DEATH,
eSoundType_MOB_IRONGOLEM_WALK,
// TU14
eSoundType_DAMAGE_THORNS,
eSoundType_RANDOM_ANVIL_BREAK,
eSoundType_RANDOM_ANVIL_LAND,
eSoundType_RANDOM_ANVIL_USE,
eSoundType_MOB_VILLAGER_HAGGLE,
eSoundType_MOB_VILLAGER_IDLE,
eSoundType_MOB_VILLAGER_HIT,
eSoundType_MOB_VILLAGER_DEATH,
eSoundType_MOB_VILLAGER_YES,
eSoundType_MOB_VILLAGER_NO,
eSoundType_MOB_ZOMBIE_INFECT,
eSoundType_MOB_ZOMBIE_UNFECT,
eSoundType_MOB_ZOMBIE_REMEDY,
eSoundType_STEP_SNOW,
eSoundType_STEP_LADDER,
eSoundType_DIG_CLOTH,
eSoundType_DIG_GRASS,
eSoundType_DIG_GRAVEL,
eSoundType_DIG_SAND,
eSoundType_DIG_SNOW,
eSoundType_DIG_STONE,
eSoundType_DIG_WOOD,
// TU14
eSoundType_DAMAGE_THORNS,
eSoundType_RANDOM_ANVIL_BREAK,
eSoundType_RANDOM_ANVIL_LAND,
eSoundType_RANDOM_ANVIL_USE,
eSoundType_MOB_VILLAGER_HAGGLE,
eSoundType_MOB_VILLAGER_IDLE,
eSoundType_MOB_VILLAGER_HIT,
eSoundType_MOB_VILLAGER_DEATH,
eSoundType_MOB_VILLAGER_YES,
eSoundType_MOB_VILLAGER_NO,
eSoundType_MOB_ZOMBIE_INFECT,
eSoundType_MOB_ZOMBIE_UNFECT,
eSoundType_MOB_ZOMBIE_REMEDY,
eSoundType_STEP_SNOW,
eSoundType_STEP_LADDER,
eSoundType_DIG_CLOTH,
eSoundType_DIG_GRASS,
eSoundType_DIG_GRAVEL,
eSoundType_DIG_SAND,
eSoundType_DIG_SNOW,
eSoundType_DIG_STONE,
eSoundType_DIG_WOOD,
// 1.6.4
eSoundType_FIREWORKS_LAUNCH,
eSoundType_FIREWORKS_BLAST,
eSoundType_FIREWORKS_BLAST_FAR,
eSoundType_FIREWORKS_LARGE_BLAST,
eSoundType_FIREWORKS_LARGE_BLAST_FAR,
eSoundType_FIREWORKS_TWINKLE,
eSoundType_FIREWORKS_TWINKLE_FAR,
// 1.6.4
eSoundType_FIREWORKS_LAUNCH,
eSoundType_FIREWORKS_BLAST,
eSoundType_FIREWORKS_BLAST_FAR,
eSoundType_FIREWORKS_LARGE_BLAST,
eSoundType_FIREWORKS_LARGE_BLAST_FAR,
eSoundType_FIREWORKS_TWINKLE,
eSoundType_FIREWORKS_TWINKLE_FAR,
eSoundType_MOB_BAT_IDLE,
eSoundType_MOB_BAT_HURT,
eSoundType_MOB_BAT_DEATH,
eSoundType_MOB_BAT_TAKEOFF,
eSoundType_MOB_BAT_IDLE,
eSoundType_MOB_BAT_HURT,
eSoundType_MOB_BAT_DEATH,
eSoundType_MOB_BAT_TAKEOFF,
eSoundType_MOB_WITHER_SPAWN,
eSoundType_MOB_WITHER_IDLE, //"mob.wither.idle";
eSoundType_MOB_WITHER_HURT, //"mob.wither.hurt";
eSoundType_MOB_WITHER_DEATH,//"mob.wither.death";
eSoundType_MOB_WITHER_SHOOT,//"mob.wither.shoot";
eSoundType_MOB_WITHER_SPAWN,
eSoundType_MOB_WITHER_IDLE, //"mob.wither.idle";
eSoundType_MOB_WITHER_HURT, //"mob.wither.hurt";
eSoundType_MOB_WITHER_DEATH,//"mob.wither.death";
eSoundType_MOB_WITHER_SHOOT,//"mob.wither.shoot";
eSoundType_MOB_COW_STEP,
eSoundType_MOB_CHICKEN_STEP,
eSoundType_MOB_PIG_STEP,
eSoundType_MOB_ENDERMAN_STARE,
eSoundType_MOB_ENDERMAN_SCREAM,
eSoundType_MOB_SHEEP_SHEAR,
eSoundType_MOB_SHEEP_STEP,
eSoundType_MOB_SKELETON_DEATH,
eSoundType_MOB_SKELETON_STEP,
eSoundType_MOB_SPIDER_STEP,
eSoundType_MOB_WOLF_STEP,
eSoundType_MOB_ZOMBIE_STEP,
eSoundType_LIQUID_SWIM,
eSoundType_MOB_HORSE_LAND,
eSoundType_MOB_HORSE_ARMOR,
eSoundType_MOB_HORSE_LEATHER,
eSoundType_MOB_HORSE_ZOMBIE_DEATH,
eSoundType_MOB_HORSE_SKELETON_DEATH,
eSoundType_MOB_HORSE_DONKEY_DEATH,
eSoundType_MOB_HORSE_DEATH,
eSoundType_MOB_HORSE_ZOMBIE_HIT,
eSoundType_MOB_HORSE_SKELETON_HIT,
eSoundType_MOB_HORSE_DONKEY_HIT,
eSoundType_MOB_HORSE_HIT,
eSoundType_MOB_HORSE_ZOMBIE_IDLE,
eSoundType_MOB_HORSE_SKELETON_IDLE,
eSoundType_MOB_HORSE_DONKEY_IDLE,
eSoundType_MOB_HORSE_IDLE,
eSoundType_MOB_HORSE_DONKEY_ANGRY,
eSoundType_MOB_HORSE_ANGRY,
eSoundType_MOB_HORSE_GALLOP,
eSoundType_MOB_HORSE_BREATHE,
eSoundType_MOB_HORSE_WOOD,
eSoundType_MOB_HORSE_SOFT,
eSoundType_MOB_HORSE_JUMP,
eSoundType_MOB_WITCH_IDLE,
eSoundType_MOB_WITCH_HURT,
eSoundType_MOB_WITCH_DEATH,
eSoundType_MOB_SLIME_BIG,
eSoundType_MOB_SLIME_SMALL,
eSoundType_EATING,
eSoundType_RANDOM_LEVELUP,
eSoundType_FIRE_NEWIGNITE,
eSoundType_MOB_COW_STEP,
eSoundType_MOB_CHICKEN_STEP,
eSoundType_MOB_PIG_STEP,
eSoundType_MOB_ENDERMAN_STARE,
eSoundType_MOB_ENDERMAN_SCREAM,
eSoundType_MOB_SHEEP_SHEAR,
eSoundType_MOB_SHEEP_STEP,
eSoundType_MOB_SKELETON_DEATH,
eSoundType_MOB_SKELETON_STEP,
eSoundType_MOB_SPIDER_STEP,
eSoundType_MOB_WOLF_STEP,
eSoundType_MOB_ZOMBIE_STEP,
eSoundType_LIQUID_SWIM,
eSoundType_MOB_HORSE_LAND,
eSoundType_MOB_HORSE_ARMOR,
eSoundType_MOB_HORSE_LEATHER,
eSoundType_MOB_HORSE_ZOMBIE_DEATH,
eSoundType_MOB_HORSE_SKELETON_DEATH,
eSoundType_MOB_HORSE_DONKEY_DEATH,
eSoundType_MOB_HORSE_DEATH,
eSoundType_MOB_HORSE_ZOMBIE_HIT,
eSoundType_MOB_HORSE_SKELETON_HIT,
eSoundType_MOB_HORSE_DONKEY_HIT,
eSoundType_MOB_HORSE_HIT,
eSoundType_MOB_HORSE_ZOMBIE_IDLE,
eSoundType_MOB_HORSE_SKELETON_IDLE,
eSoundType_MOB_HORSE_DONKEY_IDLE,
eSoundType_MOB_HORSE_IDLE,
eSoundType_MOB_HORSE_DONKEY_ANGRY,
eSoundType_MOB_HORSE_ANGRY,
eSoundType_MOB_HORSE_GALLOP,
eSoundType_MOB_HORSE_BREATHE,
eSoundType_MOB_HORSE_WOOD,
eSoundType_MOB_HORSE_SOFT,
eSoundType_MOB_HORSE_JUMP,
eSoundType_MOB_WITCH_IDLE,
eSoundType_MOB_WITCH_HURT,
eSoundType_MOB_WITCH_DEATH,
eSoundType_MOB_SLIME_BIG,
eSoundType_MOB_SLIME_SMALL,
eSoundType_EATING,
eSoundType_RANDOM_LEVELUP,
eSoundType_FIRE_NEWIGNITE,
//New ENUM
eSoundType_DAMAGE_CRITICAL,
eSoundType_MAX
};