Add combat sounds, melee ability animations, and player vocalizations

Wire CombatSoundManager into SMSG_ATTACKERSTATEUPDATE for weapon swing,
impact, and miss sounds. Add attack grunt and wound vocalizations to
ActivitySoundManager using correct WoW MPQ PC-suffix paths. Trigger
attack animation on SMSG_SPELL_GO for warrior melee abilities. Add
client-side melee range and facing checks to prevent server rejections.
Snap charge arrival to target's current position for reliable melee range.
This commit is contained in:
Kelsi 2026-02-19 21:31:37 -08:00
parent e163813dee
commit 8a9d9f47db
4 changed files with 250 additions and 18 deletions

View file

@ -856,8 +856,26 @@ void Application::update(float deltaTime) {
renderer->getCameraController()->setExternalFollow(false);
renderer->getCameraController()->setExternalMoving(false);
// Start auto-attack on arrival
// Snap to melee range of target's CURRENT position (it may have moved)
if (chargeTargetGuid_ != 0) {
auto targetEntity = gameHandler->getEntityManager().getEntity(chargeTargetGuid_);
if (targetEntity) {
glm::vec3 targetCanonical(targetEntity->getX(), targetEntity->getY(), targetEntity->getZ());
glm::vec3 targetRender = core::coords::canonicalToRender(targetCanonical);
glm::vec3 toTarget = targetRender - renderPos;
float d = glm::length(toTarget);
if (d > 1.5f) {
// Place us 1.5 units from target (well within 8-unit melee range)
glm::vec3 snapPos = targetRender - glm::normalize(toTarget) * 1.5f;
renderer->getCharacterPosition() = snapPos;
glm::vec3 snapCanonical = core::coords::renderToCanonical(snapPos);
gameHandler->setPosition(snapCanonical.x, snapCanonical.y, snapCanonical.z);
if (renderer->getCameraController()) {
glm::vec3* ft = renderer->getCameraController()->getFollowTargetMutable();
if (ft) *ft = snapPos;
}
}
}
gameHandler->startAutoAttack(chargeTargetGuid_);
renderer->triggerMeleeSwing();
}