diff --git a/Minecraft.Client/Common/Audio/SoundNames.cpp b/Minecraft.Client/Common/Audio/SoundNames.cpp index ebb7e9ee1..dd16efca7 100644 --- a/Minecraft.Client/Common/Audio/SoundNames.cpp +++ b/Minecraft.Client/Common/Audio/SoundNames.cpp @@ -223,6 +223,8 @@ 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, }; diff --git a/Minecraft.Client/Common/BuildVer.h b/Minecraft.Client/Common/BuildVer.h index eaa77d26a..a5a9494ac 100644 --- a/Minecraft.Client/Common/BuildVer.h +++ b/Minecraft.Client/Common/BuildVer.h @@ -1,7 +1,7 @@ #pragma once #define VER_PRODUCTBUILD 560 -#define VER_PRODUCTVERSION_STR_W L"DEV (unknown version)" +#define VER_PRODUCTVERSION_STR_W L"" #define VER_FILEVERSION_STR_W VER_PRODUCTVERSION_STR_W -#define VER_BRANCHVERSION_STR_W L"UNKNOWN BRANCH" +#define VER_BRANCHVERSION_STR_W L"UNKNOWN/" #define VER_NETWORK VER_PRODUCTBUILD diff --git a/Minecraft.Client/Windows64Media/Sound/Minecraft/damage/critical.mp3 b/Minecraft.Client/Windows64Media/Sound/Minecraft/damage/critical.mp3 new file mode 100644 index 000000000..b3687e43e Binary files /dev/null and b/Minecraft.Client/Windows64Media/Sound/Minecraft/damage/critical.mp3 differ diff --git a/Minecraft.World/DamageSource.cpp b/Minecraft.World/DamageSource.cpp index bc3adc804..f567385d0 100644 --- a/Minecraft.World/DamageSource.cpp +++ b/Minecraft.World/DamageSource.cpp @@ -124,6 +124,7 @@ DamageSource::DamageSource(ChatPacket::EChatPacketMessage msgId, ChatPacket::ECh _isProjectile = false; _isMagic = false; _isExplosion = false; + _isCritical = false; //this->msgId = msgId; m_msgId = msgId; @@ -153,7 +154,15 @@ DamageSource *DamageSource::bypassInvul() _bypassInvul = true; return this; } - +bool DamageSource::isCritical() +{ + return _isCritical; +} +DamageSource *DamageSource::setIsCritical() +{ + _isCritical = true; + return this; +} DamageSource *DamageSource::setIsFire() { isFireSource = true; diff --git a/Minecraft.World/DamageSource.h b/Minecraft.World/DamageSource.h index 1173db4db..6d0d5326e 100644 --- a/Minecraft.World/DamageSource.h +++ b/Minecraft.World/DamageSource.h @@ -47,8 +47,11 @@ class DamageSource bool _scalesWithDifficulty; bool _isMagic; bool _isExplosion; + bool _isCritical; public: + bool isCritical(); + DamageSource *setIsCritical(); bool isProjectile(); DamageSource *setProjectile(); bool isExplosion(); diff --git a/Minecraft.World/EntityEvent.h b/Minecraft.World/EntityEvent.h index 4d2064aba..ae80cd1bd 100644 --- a/Minecraft.World/EntityEvent.h +++ b/Minecraft.World/EntityEvent.h @@ -5,6 +5,8 @@ class EntityEvent public: static const BYTE JUMP = 1; static const BYTE HURT = 2; + //New + static const BYTE HURT_CRITICAL = 19; static const BYTE DEATH = 3; static const BYTE START_ATTACKING = 4; static const BYTE STOP_ATTACKING = 5; diff --git a/Minecraft.World/LivingEntity.cpp b/Minecraft.World/LivingEntity.cpp index 3ace88068..20967b7f5 100644 --- a/Minecraft.World/LivingEntity.cpp +++ b/Minecraft.World/LivingEntity.cpp @@ -831,7 +831,12 @@ bool LivingEntity::hurt(DamageSource *source, float dmg) if (sound) { - level->broadcastEntityEvent(shared_from_this(), EntityEvent::HURT); + if (source->isCritical()) { + level->broadcastEntityEvent(shared_from_this(), EntityEvent::HURT_CRITICAL); + } + else { + level->broadcastEntityEvent(shared_from_this(), EntityEvent::HURT); + } if (source != DamageSource::drown) markHurt(); if (sourceEntity != nullptr) { @@ -859,7 +864,10 @@ bool LivingEntity::hurt(DamageSource *source, float dmg) } else { - if (sound) playSound(getHurtSound(), getSoundVolume(), getVoicePitch()); + if (sound) { + if (source->isCritical()) playSound(getCriticalSound(), getSoundVolume(), getVoicePitch()); + playSound(getHurtSound(), getSoundVolume(), getVoicePitch()); + } } MemSect(0); @@ -959,7 +967,10 @@ int LivingEntity::getHurtSound() { return eSoundType_DAMAGE_HURT; } - +int LivingEntity::getCriticalSound() +{ + return eSoundType_DAMAGE_CRITICAL; +} int LivingEntity::getDeathSound() { return eSoundType_DAMAGE_HURT; @@ -1181,7 +1192,8 @@ void LivingEntity::swing() void LivingEntity::handleEntityEvent(byte id) { - if (id == EntityEvent::HURT) + //These gotta be in parentheses + if ((id == EntityEvent::HURT) || (id == EntityEvent::HURT_CRITICAL)) { walkAnimSpeed = 1.5f; @@ -1191,11 +1203,16 @@ void LivingEntity::handleEntityEvent(byte id) MemSect(31); // 4J-PB -added because villagers have no sounds - int iHurtSound=getHurtSound(); + int iHurtSound = getHurtSound(); + int iCritSound = getCriticalSound(); if(iHurtSound!=-1) { playSound(iHurtSound, getSoundVolume(), (random->nextFloat() - random->nextFloat()) * 0.2f + 1.0f); } + if(iCritSound!=-1 && id == EntityEvent::HURT_CRITICAL) + { + playSound(iCritSound, getSoundVolume(), (random->nextFloat() - random->nextFloat()) * 0.2f + 1.0f); + } MemSect(0); hurt(DamageSource::genericSource, 0); } diff --git a/Minecraft.World/LivingEntity.h b/Minecraft.World/LivingEntity.h index ecc819df9..086935efc 100644 --- a/Minecraft.World/LivingEntity.h +++ b/Minecraft.World/LivingEntity.h @@ -185,6 +185,7 @@ class LivingEntity : public Entity virtual void knockback(shared_ptr source, float dmg, double xd, double zd); protected: + virtual int getCriticalSound(); virtual int getHurtSound(); virtual int getDeathSound(); diff --git a/Minecraft.World/Player.cpp b/Minecraft.World/Player.cpp index 00c7148e4..c3677862b 100644 --- a/Minecraft.World/Player.cpp +++ b/Minecraft.World/Player.cpp @@ -1631,6 +1631,10 @@ void Player::attack(shared_ptr entity) } DamageSource *damageSource = DamageSource::playerAttack(dynamic_pointer_cast(shared_from_this())); + + if (bCrit) { + damageSource->setIsCritical(); + } bool wasHurt = entity->hurt(damageSource, dmg); delete damageSource; if (wasHurt) diff --git a/Minecraft.World/SoundTypes.h b/Minecraft.World/SoundTypes.h index 81e81d796..cae541df3 100644 --- a/Minecraft.World/SoundTypes.h +++ b/Minecraft.World/SoundTypes.h @@ -213,6 +213,8 @@ enum eSOUND_TYPE eSoundType_FIRE_NEWIGNITE, + eSoundType_DAMAGE_CRITICAL, + eSoundType_MAX };