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

Function addgib

source/src/weapon.cpp:733–767  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

731VARP(gibspeed, 1, 30, 100);
732
733void addgib(playerent *d)
734{
735 if(!d || !gib || !gibttl) return;
736 audiomgr.playsound(S_GIB, d);
737 d->nocorpse = true; // don't render regular corpse: it was gibbed
738
739 loopi(gibnum)
740 {
741 bounceent *p = bounceents.add(new bounceent);
742 p->owner = d;
743 p->millis = lastmillis;
744 p->timetolive = gibttl+rnd(10)*100;
745 p->bouncetype = BT_GIB;
746
747 p->o = d->o;
748 p->o.z -= d->aboveeye;
749 p->inwater = waterlevel > p->o.z;
750
751 p->yaw = (float)rnd(360);
752 p->pitch = (float)rnd(360);
753
754 p->maxspeed = 30.0f;
755 p->rotspeed = 3.0f;
756
757 const float angle = (float)rnd(360);
758 const float speed = (float)gibspeed;
759
760 p->vel.x = sinf(RAD*angle)*rnd(1000)/1000.0f;
761 p->vel.y = cosf(RAD*angle)*rnd(1000)/1000.0f;
762 p->vel.z = rnd(1000)/1000.0f;
763 p->vel.mul(speed/100.0f);
764
765 p->resetinterp();
766 }
767}
768
769void shorten(const vec &from, vec &target, float distsquared)
770{

Callers 1

dokillFunction · 0.85

Calls 1

playsoundMethod · 0.80

Tested by

no test coverage detected