SOLVED: ent_decal crash

Posted By: MatAllum

SOLVED: ent_decal crash - 02/20/15 23:27

Can anyone fathom why the following code works in a test level:
Code:
result = c_trace(camera.x, temp, IGNORE_YOU|IGNORE_PASSABLE|SCAN_TEXTURE|USE_POLYGON);
you = hit.entity;
if(result > 0)
{
	PARTICLE* p = ent_decal(you, bullethole, 10, random(360));
}



... and yet, when I put the code into practice, the game hard-crashes immediately upon bullet impact?

Code:
bullet_private_var = c_trace(gl_event_source,target_pos, IGNORE_ME|IGNORE_YOU|IGNORE_PASSABLE|IGNORE_PASSENTS|ACTIVATE_SHOOT|SCAN_TEXTURE);
you = hit.entity;
ENTITY* victim = you;
if(trace_hit)
{
	PARTICLE* p = ent_decal(you, "bulhole.tga", 10, 0);
	...



If anybody has ideas, I'd love to hear them.
Incidentally, if I put a bullet hole on an object with a shader, the bullet hole is just a black square with a line down one side. How would I fix that?
Posted By: Superku

Re: ent_decal crash - 02/21/15 00:15

You are giving a STRING(*) object instead of a bitmap to the function, which is why the game probably crashes.
Posted By: MatAllum

Re: ent_decal crash - 02/21/15 00:52

Oh my goooooooddd: 1. Wow, I can't believe I missed that. 2. You're a genius, thank you.

No more crash, although now it tells me "file not found" with just a paragraph symbol, and the black square on shader problem is still present.
Posted By: Superku

Re: ent_decal crash - 02/21/15 02:40

You are welcome.
Try giving the particle/ decal a different material than the shader.
I don't know about the file not found error though.
Posted By: MatAllum

Re: ent_decal crash - 02/21/15 13:46

Okay, I'll see if that works. Sounds like a good idea though.
Posted By: MatAllum

Re: ent_decal crash - 02/21/15 16:13

WE HAVE GOT THIS!

All works perfectly.

Also, for others' reference, make sure you don't directly set the decal particle's flags variable.

You need to OR stuff onto it like this: p->flags |= TRANSLUCENT;
Rather than like this: p->flags = TRANSLUCENT;

Just spent half an hour wondering why my decals were duplicating themselves in the center of the map, and that was why.
Posted By: alibaba

Re: ent_decal crash - 02/21/15 18:08

Donīt you use the "set" macro?
Posted By: MatAllum

Re: ent_decal crash - 02/23/15 12:24

Sometimes. Other times I forget or have one reason or another not to use it.
© 2024 lite-C Forums