About Particle pointer

Posted By: 20BN

About Particle pointer - 12/01/18 13:26

Hi, all.
How to set point PARTICLE* p in other function?
Posted By: Superku

Re: About Particle pointer - 12/01/18 13:58

For what purpose?
Posted By: 20BN

Re: About Particle pointer - 12/02/18 09:05

Originally Posted By: Superku
For what purpose?


Hi, @Superku .
I want change p.bmap in other function.
Posted By: Superku

Re: About Particle pointer - 12/02/18 09:10

You *can* set a global particle pointer to some particle in its (event) function and use that when you manually set the pointer to NULL before particle removal (for example when lifespan gets low), but that's dangerous and can and probably will lead to crashes at some point.

I suggest you either use sprites/ models/ entities or if there's a bunch of those particles, then just use a global variable which the particle checks for:

Code:
var particleVariableBitmapType = 0;

void p_event(PARTICLE *p)
{
	if(particleVariableBitmapType == 1) p.bmap = smoke_bmp;
	else p.bmap = fire_bmp;
}

void p_fnc(PARTICLE *p)
{
	...
	p.event = p_event;
}

effect(p_fnc,...);

Posted By: 20BN

Re: About Particle pointer - 12/02/18 09:20

@Superku
Thank you so much.
This is the best solution for me!
© 2024 lite-C Forums