Creating a new surface flag


(DiaZ) #1

Hey,
I am trying to create a rain splash effect that would splat sprites with a raindrop impact texture at random positions… the way I’m trying to make it is to create a new surface type, so I can place brushes around the map on surfaces that would be affected, and then a line is traced from the ceiling to the ground. XY coordinates of the vector points would be player position + a random value. If the line hits a surface with the new flag (I have named it SURF_SPLASH on my experiments) then a polygon is drawn on the point where that event happens. The question is, how is this accomplished? First, how do I tell the game where did the line collide with the surface? And secondly… How can I make that new surface flag? I’ve tried defining a new flag SURF_SPLASH on surfaceflags.h and then using surfaceparms splash on a new shader script, but it ain’t working. What am I doing wrong? help would be appreciated :smile:

Just in case, here’s the code that is supposed to trace the lines and all:

void CG_DrawRainMarks (void)
{
vec3_t start, end;
trace_t tr;

start[0] = cg.refdef.vieworg[0] + random() * 1000;
start[1] = cg.refdef.vieworg[1] + random() * 1000;
start[2] = cg.refdef.vieworg[2] + 18000;

end[0] = start[0];
end[1] = start[1];
end[2] = start[2] - 32000;


  	CG_Trace( &tr, start, NULL, NULL, end, ENTITYNUM_NONE, MASK_SOLID|MASK_WATER ); // Trace a line trying to impact a surface with the splash flag

  	if( tr.surfaceFlags & SURF_SPLASH )  
  	{
			CG_Printf ("DEBUG: Draw rain splash code should now be executed."); // I still have to learn how to draw a polygon starting from this point, I would also appreaciate some help on this :smile:
	}

}


(fretn) #2

http://www.q3f.com/atmospheric.html

:smile:

fretn


(DiaZ) #3

I’ve already got that code and have tried to isolate the rain splash part (I already have another system for the drops so I just need those), but with no luck. I guess I’ll mess some more with it to see if I can eventually do it… Thanks anyways.


(fretn) #4

http://www.2de-hands.be/design/tutorials/

some months ago I wrote a small tutorial on making new surfaces & setting up radiant to compile them.

fretn


(DiaZ) #5

Thanks, I’ve set the surface parameters now (and I guess it’s working right) but however, i’m not getting the debug print. I suppose I’m doing something wrong with the vectors - Can someone see what’s wrong on that code?


(RR2DO2) #6

There are a few mistakes in fretn’s tutorial. First of all the shader is wrong. If your custinfoparms.txt lists ‘mysurface’, then adding a ‘surfaceparm mysurface’ to any shader is enough to add your surfaceparm to that shader.

The other thing is the commandline. You only ever should execute the bsp stage once, and -custinfoparms is a parameter for the bsp stage only (so you don’t need it with -vis and -light).

  • Arnout ‘RR2DO2’

(fretn) #7

1st mistake: hmm, prolly forgot to add this
2nd: didn’t knew this, mapping is not my domain :wink:

thanks

EDIT:

can you also do this:

! C:PROGRA~1RETURN~1RADIANTq3map # -game wolf -custinfoparms $

instead of

! C:PROGRA~1RETURN~1RADIANTq3map # -game wolf $ && ! C:PROGRA~1RETURN~1RADIANTq3map # -game wolf -custinfoparms $

??

fretn

<font size=-1>[ This Message was edited by: fretn on 2002-10-23 12:33 ]</font>


(RR2DO2) #8

On 2002-10-23 12:32, fretn wrote:
can you also do this:

! C:PROGRA~1RETURN~1RADIANTq3map # -game wolf -custinfoparms $

instead of

! C:PROGRA~1RETURN~1RADIANTq3map # -game wolf $ && ! C:PROGRA~1RETURN~1RADIANTq3map # -game wolf -custinfoparms $

Yes. If you look closely you’ll see it are just commandlines.

  • Arnout ‘RR2DO2’

(fretn) #9

thanks,

btw: the mds-tag system is working (for the locational damage) only one problem can’t do fopen (I’m using fseek to read the offsets/ tag/frame) for a file that’s in a pk3 :s, thanks for the hint :wink:

fretn

<font size=-1>[ This Message was edited by: fretn on 2002-10-24 18:22 ]</font>

<font size=-1>[ This Message was edited by: fretn on 2002-10-24 19:19 ]</font>