MCPcopy Create free account
hub / github.com/assaultcube/AC / addbullethole

Function addbullethole

source/src/renderparticles.cpp:624–641  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

622VARP(bulletbouncesoundrad, 0, 15, 1000);
623
624bool addbullethole(dynent *d, const vec &from, const vec &to, float radius, bool noisy)
625{
626 if(!bulletholettl || !bullethole) return false;
627 vec surface, ray(to);
628 ray.sub(from);
629 ray.normalize();
630 float dist = raycube(from, ray, surface), mag = to.dist(from);
631 if(surface.iszero() || (radius>0 && (dist < mag-radius || dist > mag+radius))) return false;
632 vec o(from);
633 o.add(ray.mul(dist));
634 o.add(vec(surface).normalize().mul(0.01f));
635 newparticle(o, surface, bulletholettl, 7);
636 if(noisy && bulletbouncesound && bulletbouncesoundrad && d!=player1 && o.dist(camera1->o) <= bulletbouncesoundrad)
637 {
638 audiomgr.playsound(o.z < waterlevel ? S_BULLETWATERHIT : S_BULLETHIT, &o, SP_LOW);
639 }
640 return true;
641}
642
643
644VARP(scorch, 0, 1, 1);

Callers 1

attackfxMethod · 0.85

Calls 8

raycubeFunction · 0.85
vecClass · 0.85
newparticleFunction · 0.85
distMethod · 0.80
mulMethod · 0.80
playsoundMethod · 0.80
iszeroMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected