better fog laser support

This commit is contained in:
Bryce Hutchings 2002-07-22 07:27:21 +00:00
parent 862df910c1
commit 334fe1a32e
3 changed files with 24 additions and 16 deletions

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.39 2002/07/22 07:27:21 niceass
// better fog laser support
//
// Revision 1.38 2002/06/23 04:36:27 niceass
// change to foglaser
//
@ -1180,45 +1183,37 @@ static void CG_VisibleLaser( vec3_t start, vec3_t finish ) {
void CG_DrawVisibleLaser( vec3_t origin, int clientNum, vec3_t dir) {
int num, sourceContentType, destContentType;
centity_t *cent;
int sourceContentType, destContentType;
vec3_t start, end;
trace_t trace;
if ( !cg_enableLaserFog.integer )
return;
for (num = 0; num < cg.snap->numEntities; num++) {
cent = &cg_entities[cg.snap->entities[num].number];
if (cent->currentState.eType == ET_LASER &&
cent->currentState.clientNum == clientNum ) {
break;
}
}
// Failed to find a laser dot that the player owns.
if (num == cg.snap->numEntities)
// NiceAss: This user does not have a lasersight
if (!( cg_entities[clientNum].currentState.powerups & (1 << PW_LASERSIGHT) ))
return;
VectorCopy(origin, start);
VectorMA(origin, 8192 * 16, dir, end);
trap_CM_BoxTrace(&trace, start, end, NULL, NULL, 0, MASK_SHOT);
//trap_CM_BoxTrace(&trace, start, end, NULL, NULL, clientNum, MASK_ALL); //MASK_SHOT);
CG_Trace(&trace, start, NULL, NULL, end, clientNum, MASK_ALL);
VectorCopy(trace.endpos, end);
sourceContentType = trap_CM_PointContents(start, 0);
destContentType = trap_CM_PointContents(end, 0);
// do a complete bubble trail if necessary
// do a complete laser if necessary
if ((sourceContentType == destContentType) && (sourceContentType & CONTENTS_FOG)) {
CG_VisibleLaser(start, end);
}
// bubble trail from water into air
// laser from fog into air
else if ((sourceContentType & CONTENTS_FOG)) {
trap_CM_BoxTrace(&trace, end, start, NULL, NULL, 0, CONTENTS_FOG);
CG_VisibleLaser(start, trace.endpos);
}
// bubble trail from air into water
// laser from air into fog
else if ((destContentType & CONTENTS_FOG)) {
trap_CM_BoxTrace(&trace, start, end, NULL, NULL, 0, CONTENTS_FOG);
CG_VisibleLaser(trace.endpos, end);

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.90 2002/07/22 07:26:43 niceass
// better fog laser support
//
// Revision 1.89 2002/07/22 06:33:34 niceass
// cleaned up the powerup code
//
@ -786,6 +789,8 @@ typedef enum {
typedef enum {
PW_NONE,
PW_LASERSIGHT,
PW_REDFLAG,
PW_BLUEFLAG,
PW_NEUTRALFLAG,

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.77 2002/07/22 07:27:02 niceass
// better fog laser support
//
// Revision 1.76 2002/07/22 06:32:15 niceass
// cleaned up the powerup code
//
@ -2006,15 +2009,19 @@ void Laser_Gen(gentity_t * ent, qboolean enabled)
G_FreeEntity(ent->client->lasersight);
ent->client->lasersight = NULL;
}
ent->client->ps.powerups[PW_LASERSIGHT] = 0;
return;
}
//Get rid of you?
if (ent->client->lasersight || enabled == qfalse) {
G_FreeEntity(ent->client->lasersight);
ent->client->lasersight = NULL;
ent->client->ps.powerups[PW_LASERSIGHT] = 0;
return;
}
ent->client->ps.powerups[PW_LASERSIGHT] = INT_MAX;
las = G_Spawn();
las->nextthink = level.time + 10;
@ -2056,6 +2063,7 @@ void Laser_Think(gentity_t * self)
self->parent->client->ps.weapon != WP_MP5 && self->parent->client->ps.weapon != WP_M4)) {
//Make sure you kill the reference before freeing the entity
self->parent->client->lasersight = NULL;
self->parent->client->ps.powerups[PW_LASERSIGHT] = 0;
G_FreeEntity(self);
return;
}