I could never get the ent_decal command to work correctly. Whenever I tried to make a decal, I always got an error.
Here is the code:
function spawn_sprite()
{
proc_kill(4); // stops the function from running more than 1 time
// spawn a sprite at mouse click position, 200 quants behind the screen
while (key_space) {wait (1);}
vec_set(temp.x,camera.x);
vec_set(temp2,vector(20000,0,0));
vec_rotate(temp2,camera.pan);
vec_add(temp2,camera.x);
trace(temp,temp2);
ent_create("bullethole.pcx",target,NULL);
//ent_decal(you,"bullethole.tga",you.x, you.y);
}
function makedecals()
{
// calculate the target vector
VECTOR trace_target;
vec_set(trace_target,vector(5000,0,0)); // the weapon has a firing range of 5000 quants
vec_rotate(trace_target, camera.pan);
vec_add(trace_target, camera.x);
// display a red spot at the target position
if (c_trace(camera.x,trace_target, IGNORE_PASSABLE | USE_POLYGON| SCAN_TEXTURE) > 0) // hit something?
{
draw_point3d(hit.x,vector(50,50,255),100,3);
}//ent_create("hairs.bmp", hit.x, NULL);
// fire and then place a decal at the hit position
if (key_space) // fire
{
if (HIT_TARGET) // target hit?
{
//spawn_sprite();
//p = ent_decal(you,"bullethole.tga",7+random(3),random(360)); // place a random sized decal at the hit entity
//p.lifespan = 1600; // remove decal after 100 seconds
}
//PARTICLE* p = ent_decal(you,bmMark,you, 5); // place a random sized decal at the hit entity
// p->lifespan = 80;
//hit.x);
//ent_create("bullethole.tga",vector(hit.x,hit.y,hit.z),NULL);
//ent_decal(you,bmMark,you, 5);
}
wait(1);
}
Any advice?
Here is another link to the code as well:
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Main=35040&Number=286107#Post286107