Jump to content

Home

New surface flag


Ipsum

Recommended Posts

I would like to modify the player's movement when they come into contact with a level surface that has a certain flag defined. I have defined a new surface flag in surfaceflags.h (#define SURF_MYSURFACE 0x10000000). In bg_pmove.c in PmoveSingle() I check to see if the play model makes contact with the surface and set a flag, pml.bMyFlag, using the following code (which I modified from a Quake 3 tutorial for ladders):

vec3_t flatforward,spot;

trace_t trace;

pml.bMyFlag = qfalse;

 

flatforward[0] = pml.forward[0];

flatforward[1] = pml.forward[1];

flatforward[2] = 0;

VectorNormalize (flatforward);

VectorMA (pm->ps->origin, 1, flatforward, spot);

pm->trace (&trace, pm->ps->origin, pm->mins, pm->maxs, spot,pm->ps->clientNum, MASK_PLAYERSOLID);

 

if ((trace.fraction < 1) && (trace.surfaceFlags & SURF_MYFLAG))

pml.bMyFlag = qtrue;

 

Then later in PMoveSingle, where all the checking for swimming and walking is done, I check to see if my flag is set, and then I modify the movement accordingly. This whole system compiles with no problems, but I am unsure if it is the correct approach to what I want to do. If this will work, then how would I go about setting the brush flags with this flag?

 

Thanks

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...