mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-08-10 09:12:30 +00:00
Crit Sound Now Plays On Death
This commit is contained in:
parent
3896c7d8a0
commit
18003c98a6
|
|
@ -7,6 +7,7 @@ public:
|
||||||
static const BYTE HURT = 2;
|
static const BYTE HURT = 2;
|
||||||
//New
|
//New
|
||||||
static const BYTE HURT_CRITICAL = 19;
|
static const BYTE HURT_CRITICAL = 19;
|
||||||
|
static const BYTE DEATH_CRITICAL = 20;
|
||||||
static const BYTE DEATH = 3;
|
static const BYTE DEATH = 3;
|
||||||
static const BYTE START_ATTACKING = 4;
|
static const BYTE START_ATTACKING = 4;
|
||||||
static const BYTE STOP_ATTACKING = 5;
|
static const BYTE STOP_ATTACKING = 5;
|
||||||
|
|
|
||||||
|
|
@ -859,7 +859,11 @@ bool LivingEntity::hurt(DamageSource *source, float dmg)
|
||||||
MemSect(31);
|
MemSect(31);
|
||||||
if (getHealth() <= 0)
|
if (getHealth() <= 0)
|
||||||
{
|
{
|
||||||
if (sound) playSound(getDeathSound(), getSoundVolume(), getVoicePitch());
|
if (sound) {
|
||||||
|
//New: both death AND hurt sounds should play critical sound as well.
|
||||||
|
if (source->isCritical()) playSound(getCriticalSound(), getSoundVolume(), getVoicePitch());
|
||||||
|
playSound(getDeathSound(), getSoundVolume(), getVoicePitch());
|
||||||
|
};
|
||||||
die(source);
|
die(source);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -934,7 +938,11 @@ void LivingEntity::die(DamageSource *source)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
level->broadcastEntityEvent(shared_from_this(), EntityEvent::DEATH);
|
if (source->isCritical()) {
|
||||||
|
level->broadcastEntityEvent(shared_from_this(), EntityEvent::DEATH_CRITICAL);
|
||||||
|
} else {
|
||||||
|
level->broadcastEntityEvent(shared_from_this(), EntityEvent::DEATH);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LivingEntity::dropEquipment(bool byPlayer, int playerBonusLevel)
|
void LivingEntity::dropEquipment(bool byPlayer, int playerBonusLevel)
|
||||||
|
|
@ -1209,18 +1217,24 @@ void LivingEntity::handleEntityEvent(byte id)
|
||||||
{
|
{
|
||||||
playSound(iHurtSound, getSoundVolume(), (random->nextFloat() - random->nextFloat()) * 0.2f + 1.0f);
|
playSound(iHurtSound, getSoundVolume(), (random->nextFloat() - random->nextFloat()) * 0.2f + 1.0f);
|
||||||
}
|
}
|
||||||
if(iCritSound!=-1 && id == EntityEvent::HURT_CRITICAL)
|
if(iCritSound!=-1 && (id == EntityEvent::HURT_CRITICAL))
|
||||||
{
|
{
|
||||||
playSound(iCritSound, getSoundVolume(), (random->nextFloat() - random->nextFloat()) * 0.2f + 1.0f);
|
playSound(iCritSound, getSoundVolume(), (random->nextFloat() - random->nextFloat()) * 0.2f + 1.0f);
|
||||||
}
|
}
|
||||||
MemSect(0);
|
MemSect(0);
|
||||||
hurt(DamageSource::genericSource, 0);
|
hurt(DamageSource::genericSource, 0);
|
||||||
}
|
}
|
||||||
else if (id == EntityEvent::DEATH)
|
else if ((id == EntityEvent::DEATH) || (id == EntityEvent::DEATH_CRITICAL))
|
||||||
{
|
{
|
||||||
MemSect(31);
|
MemSect(31);
|
||||||
// 4J-PB -added because villagers have no sounds
|
// 4J-PB -added because villagers have no sounds
|
||||||
int iDeathSound=getDeathSound();
|
int iDeathSound=getDeathSound();
|
||||||
|
int iCritSound = getCriticalSound();
|
||||||
|
|
||||||
|
if (iCritSound != -1 && (id == EntityEvent::DEATH_CRITICAL))
|
||||||
|
{
|
||||||
|
playSound(iCritSound, getSoundVolume(), (random->nextFloat() - random->nextFloat()) * 0.2f + 1.0f);
|
||||||
|
}
|
||||||
if(iDeathSound!=-1)
|
if(iDeathSound!=-1)
|
||||||
{
|
{
|
||||||
playSound(iDeathSound, getSoundVolume(), (random->nextFloat() - random->nextFloat()) * 0.2f + 1.0f);
|
playSound(iDeathSound, getSoundVolume(), (random->nextFloat() - random->nextFloat()) * 0.2f + 1.0f);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue