remove decals from entity ?

Posted By: Reconnoiter

remove decals from entity ? - 08/16/16 18:39

Hello,

Is it possible to remove decals from an entity? It would be nice to have it cause I currently do a check so the decal count doesnt get to high. Being able to remove all current decals would allow me to keep creating new ones when e.g. firing on fairly big targets like walls or floors.
Posted By: Anonymous

Re: remove decals from entity ? - 08/17/16 04:29

http://www.conitec.net/beta/ent_getdecal.htm

http://www.conitec.net/beta/ent_decal.htm

The thing that comes to mind is using an array.
If Particle* p = ent_decal

Then maybe
Code:
particle* p[2000];

Int part_count =-1;
Int part_max =1999;

Function
{
Part_count +=1;
P[part_count] =ent_decal.....;

/// remove all
For (i=part_count;i>-1; i--)
{
P[i].lifespan =0;
P[i] = NULL;
}


You could use p=ent_getdecal
Then use the *p pointer to set the lifespan to 0
P.lifespan =0;
Something like
Code:
For(i=1;i<50;i++)
{Particle* p=ent_getdecal(Ent,0,i);

P.lifespan=0;
If(p==null)
Break;}



Unless there a system type link for particles like ent_next
Posted By: Reconnoiter

Re: remove decals from entity ? - 08/17/16 09:25

Its not perfect since I check max decals per entity but it would be great for a few big models, tnx!
Posted By: Anonymous

Re: remove decals from entity ? - 08/17/16 09:36

Well maybe ask jcl how ent_getdecal links the Ent and particles. The you could just check -- is decal linked to This ENT then kill it.
Also i guess you could cycle a link list of all particles then test If the decal.xyz is inside the ent bbox.. Then kill it.
Superku posted about a particles linked-list in ask the devs
Posted By: Anonymous

Re: remove decals from entity ? - 08/17/16 10:03

The decal particles would need to hold the ent pointer.The manual says not to change the particles skill_x-z I'd bet one is the Ent pointer. You did say you wanted to kill all the dexals. So it should just be a matter of running a clink looking for the ent pointer. But i see no reason this is better then using the ent pointer in ent_getdecal to kill all of them.

Or why not just limit the lifespan upon creation.
Posted By: Reconnoiter

Re: remove decals from entity ? - 08/17/16 10:14

Originally Posted By: Malice
Or why not just limit the lifespan upon creation.
, already do that laugh , but I have some fast-firing weaponry/guns in my game, so the decals can increase alot very fast. But good idea about ent pointer connection and jcl.
© 2024 lite-C Forums