From b474447d20876f5ce9e83902c78deb4e56b7aaa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Gia=20Phong?= Date: Fri, 2 Jul 2021 11:30:47 +0700 Subject: Fix array out of bound in tackling Also Debian updated OpenAL (-; --- src/GameTick.cpp | 80 +++++++++++++++++++++++++------------------------------- 1 file changed, 35 insertions(+), 45 deletions(-) (limited to 'src/GameTick.cpp') diff --git a/src/GameTick.cpp b/src/GameTick.cpp index 5cd11b8..dd23dc9 100644 --- a/src/GameTick.cpp +++ b/src/GameTick.cpp @@ -2184,53 +2184,43 @@ void Game::Tick(){ } //Tackle - - if(person[0].currentanimation==diveanim&&visions==0){ - - for(int i=1;i 0 + || findDistancefast(person[i].playercoords, + person[0].playercoords + + flatfacing) > 22) + continue; + + float gLoc[3] { + (camera.position.x + + person[0].playercoords.x + + flatfacing.x) / soundscalefactor / 2, + (camera.position.y + + person[0].playercoords.y + + flatfacing.y) / soundscalefactor / 2, + (camera.position.z + + person[0].playercoords.z + + flatfacing.z) / soundscalefactor / 2, + }; + + alSourcefv(gSourceID[headwhacksound], + AL_POSITION, gLoc); + alSourcePlay(gSourceID[headwhacksound]); + person[i].skeleton.free = 1; + person[i].longdead = 1; + + for (auto& joint : person[i].skeleton.joints) { + joint.position = DoRotation(joint.position, 0, person[i].playerrotation, 0); + joint.position += person[i].playercoords; + joint.realoldposition = joint.position; + joint.velocity = person[0].velocity; + joint.velocity.y = -10; + joint.velocity.x += abs(Random() % 10) - 5; + joint.velocity.y += abs(Random() % 10) - 5; + joint.velocity.z += abs(Random() % 10) - 5; } - } - } //Fire/wing -- cgit v1.2.3