diff options
Diffstat (limited to 'src/cgame')
-rw-r--r-- | src/cgame/cg_event.c | 7 | ||||
-rw-r--r-- | src/cgame/cg_local.h | 6 | ||||
-rw-r--r-- | src/cgame/cg_trails.c | 25 | ||||
-rw-r--r-- | src/cgame/cg_weapons.c | 23 |
4 files changed, 59 insertions, 2 deletions
diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c index 1caba1f5..763d8b77 100644 --- a/src/cgame/cg_event.c +++ b/src/cgame/cg_event.c @@ -874,6 +874,13 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) CG_ShotgunFire( es ); break; + case EV_MASS_DRIVER: + DEBUGNAME( "EV_MASS_DRIVER" ); + ByteToDir( es->eventParm, dir ); + CG_MissileHitWall( es->weapon, es->generic1, 0, position, dir, IMPACTSOUND_DEFAULT ); + CG_MassDriverFire( es ); + break; + case EV_GENERAL_SOUND: DEBUGNAME( "EV_GENERAL_SOUND" ); if( cgs.gameSounds[ es->eventParm ] ) diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index 50381ff2..00ddb519 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -459,7 +459,7 @@ typedef struct baseTrailBeam_s // the time it takes for a beam to fade out (double attached only) int fadeOutTime; - + char shaderName[ MAX_QPATH ]; qhandle_t shader; @@ -488,6 +488,7 @@ typedef struct baseTrailSystem_s baseTrailBeam_t *beams[ MAX_BEAMS_PER_SYSTEM ]; int numBeams; + int lifeTime; qboolean thirdPersonOnly; qboolean registered; //whether or not the assets for this trail have been loaded } baseTrailSystem_t; @@ -499,6 +500,7 @@ typedef struct trailSystem_s attachment_t frontAttachment; attachment_t backAttachment; + int birthTime; int destroyTime; qboolean valid; } trailSystem_t; @@ -1252,6 +1254,7 @@ typedef struct qhandle_t humanBleedPS; qhandle_t teslaZapTS; + qhandle_t massDriverTS; sfxHandle_t lCannonWarningSound; @@ -1700,6 +1703,7 @@ void CG_MissileHitWall( weapon_t weapon, weaponMode_t weaponMode, int cli void CG_MissileHitPlayer( weapon_t weapon, weaponMode_t weaponMode, vec3_t origin, vec3_t dir, int entityNum ); void CG_Bullet( vec3_t origin, int sourceEntityNum, vec3_t normal, qboolean flesh, int fleshEntityNum ); void CG_ShotgunFire( entityState_t *es ); +void CG_MassDriverFire( entityState_t *es ); void CG_AddViewWeapon (playerState_t *ps); void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent ); diff --git a/src/cgame/cg_trails.c b/src/cgame/cg_trails.c index c8943ed8..ca610461 100644 --- a/src/cgame/cg_trails.c +++ b/src/cgame/cg_trails.c @@ -1009,6 +1009,15 @@ static qboolean CG_ParseTrailSystem( baseTrailSystem_t *bts, char **text_p, cons } else if( !Q_stricmp( token, "thirdPersonOnly" ) ) bts->thirdPersonOnly = qtrue; + else if( !Q_stricmp( token, "lifeTime" ) ) + { + token = COM_Parse( text_p ); + if( !Q_stricmp( token, "" ) ) + break; + + bts->lifeTime = atoi_neg( token, qfalse ); + continue; + } else if( !Q_stricmp( token, "beam" ) ) //acceptable text continue; else if( !Q_stricmp( token, "}" ) ) @@ -1291,7 +1300,8 @@ trailSystem_t *CG_SpawnNewTrailSystem( qhandle_t psHandle ) ts->valid = qtrue; ts->destroyTime = -1; - + ts->birthTime = cg.time; + for( j = 0; j < bts->numBeams; j++ ) CG_SpawnNewTrailBeam( bts->beams[ j ], ts ); @@ -1406,6 +1416,19 @@ static void CG_GarbageCollectTrailSystems( void ) CG_DestroyTrailSystem( &tempTS ); } + // lifetime expired + if( ts->destroyTime <= 0 && ts->class->lifeTime && + ts->birthTime + ts->class->lifeTime < cg.time ) + { + trailSystem_t *tempTS = ts; + + CG_DestroyTrailSystem( &tempTS ); + if( cg_debugTrails.integer >= 1 ) + CG_Printf( "TS %s expired (born %d, lives %d, now %d)\n", + ts->class->name, ts->birthTime, ts->class->lifeTime, + cg.time ); + } + if( cg_debugTrails.integer >= 1 && !ts->valid ) CG_Printf( "TS %s garbage collected\n", ts->class->name ); } diff --git a/src/cgame/cg_weapons.c b/src/cgame/cg_weapons.c index a74a15f4..d5c91aa8 100644 --- a/src/cgame/cg_weapons.c +++ b/src/cgame/cg_weapons.c @@ -644,6 +644,7 @@ void CG_InitWeapons( void ) CG_RegisterWeapon( i ); cgs.media.level2ZapTS = CG_RegisterTrailSystem( "models/weapons/lev2zap/lightning" ); + cgs.media.massDriverTS = CG_RegisterTrailSystem( "models/weapons/mdriver/fireTS" ); } @@ -1614,6 +1615,28 @@ void CG_MissileHitPlayer( weapon_t weaponNum, weaponMode_t weaponMode, CG_MissileHitWall( weaponNum, weaponMode, 0, origin, dir, IMPACTSOUND_FLESH ); } +/* +============== +CG_MassDriverFire + +Draws the mass driver trail +============== +*/ + +void CG_MassDriverFire( entityState_t *es ) +{ + trailSystem_t *ts; + + ts = CG_SpawnNewTrailSystem( cgs.media.massDriverTS ); + if( CG_IsTrailSystemValid( &ts ) ) + { + CG_SetAttachmentPoint( &ts->frontAttachment, es->origin2 ); + CG_SetAttachmentPoint( &ts->backAttachment, es->pos.trBase ); + CG_AttachToPoint( &ts->frontAttachment ); + CG_AttachToPoint( &ts->backAttachment ); + } +} + /* ============================================================================ |