summaryrefslogtreecommitdiff
path: root/src/cgame
diff options
context:
space:
mode:
Diffstat (limited to 'src/cgame')
-rw-r--r--src/cgame/cg_event.c11
-rw-r--r--src/cgame/cg_local.h1
-rw-r--r--src/cgame/cg_weapons.c44
3 files changed, 55 insertions, 1 deletions
diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c
index 72e8ab21..7ea62220 100644
--- a/src/cgame/cg_event.c
+++ b/src/cgame/cg_event.c
@@ -978,6 +978,17 @@ void CG_EntityEvent( centity_t *cent, vec3_t position )
CG_Bullet( es->pos.trBase, es->otherEntityNum, dir, qtrue, es->eventParm );
break;
+ case EV_LAS_HIT_WALL:
+ DEBUGNAME("EV_LAS_HIT_WALL");
+ ByteToDir( es->eventParm, dir );
+ CG_LasGunHit( es->pos.trBase, es->otherEntityNum, dir, qfalse, ENTITYNUM_WORLD );
+ break;
+
+ case EV_LAS_HIT_FLESH:
+ DEBUGNAME("EV_LAS_HIT_FLESH");
+ CG_LasGunHit( es->pos.trBase, es->otherEntityNum, dir, qtrue, es->eventParm );
+ break;
+
#define MASS_EJECTION_VEL 300
case EV_MASS_DRIVER_HIT:
DEBUGNAME("EV_MASS_DRIVER_HIT");
diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h
index ff6e4aa2..dc9af0e9 100644
--- a/src/cgame/cg_local.h
+++ b/src/cgame/cg_local.h
@@ -1453,6 +1453,7 @@ void CG_Explosion( int clientNum, vec3_t origin, vec3_t dir );
void CG_MissileHitPlayer( int weapon, vec3_t origin, vec3_t dir, int entityNum, int damage );
void CG_ShotgunFire( entityState_t *es );
void CG_Bullet( vec3_t origin, int sourceEntityNum, vec3_t normal, qboolean flesh, int fleshEntityNum );
+void CG_LasGunHit( vec3_t origin, int sourceEntityNum, vec3_t normal, qboolean flesh, int fleshEntityNum );
void CG_RailTrail( vec3_t start, vec3_t end );
void CG_TeslaTrail( vec3_t start, vec3_t end );
diff --git a/src/cgame/cg_weapons.c b/src/cgame/cg_weapons.c
index 4d66f626..7245a870 100644
--- a/src/cgame/cg_weapons.c
+++ b/src/cgame/cg_weapons.c
@@ -727,6 +727,12 @@ void CG_RegisterWeapon( int weaponNum )
cgs.media.railRingsShader = trap_R_RegisterShader( "railDisc" );
break;
+ case WP_LAS_GUN:
+ MAKERGB( weaponInfo->flashDlightColor, 1, 1, 0 );
+ weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/plasma/hyprbf1a.wav", qfalse );
+ cgs.media.bulletExplosionShader = trap_R_RegisterShader( "bulletExplosion" );
+ break;
+
case WP_LUCIFER_CANON:
weaponInfo->readySound = trap_S_RegisterSound( "sound/weapons/bfg/bfg_hum.wav", qfalse );
MAKERGB( weaponInfo->flashDlightColor, 1, 0.7f, 1 );
@@ -741,6 +747,11 @@ void CG_RegisterWeapon( int weaponNum )
weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/melee/fstatck.wav", qfalse );
break;
+ case WP_PAIN_SAW:
+ MAKERGB( weaponInfo->flashDlightColor, 0, 0, 0 );
+ weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/melee/fstatck.wav", qfalse );
+ break;
+
case WP_GRAB_CLAW:
MAKERGB( weaponInfo->flashDlightColor, 0, 0, 0 );
weaponInfo->flashSound[0] = trap_S_RegisterSound( "sound/weapons/melee/fstatck.wav", qfalse );
@@ -1911,6 +1922,7 @@ void CG_MissileHitWall( int weapon, int clientNum, vec3_t origin, vec3_t dir, im
break;
case WP_MACHINEGUN:
case WP_CHAINGUN:
+ case WP_LAS_GUN:
mod = cgs.media.bulletFlashModel;
shader = cgs.media.bulletExplosionShader;
mark = cgs.media.bulletMarkShader;
@@ -2270,6 +2282,37 @@ static qboolean CG_CalcMuzzlePoint( int entityNum, vec3_t muzzle ) {
/*
======================
+CG_LasGunHit
+
+Renders las gun effects.
+======================
+*/
+void CG_LasGunHit( vec3_t end, int sourceEntityNum, vec3_t normal, qboolean flesh, int fleshEntityNum )
+{
+ trace_t trace;
+ vec3_t start;
+
+ // if the shooter is currently valid, calc a source point and possibly
+ // do trail effects
+ if( sourceEntityNum >= 0 && cg_tracerChance.value > 0 )
+ {
+ if( CG_CalcMuzzlePoint( sourceEntityNum, start ) )
+ {
+ // draw a tracer
+ if( random() < cg_tracerChance.value )
+ CG_Tracer( start, end );
+ }
+ }
+
+ // impact splash and mark
+ if( flesh )
+ CG_Bleed( end, fleshEntityNum );
+ else
+ CG_MissileHitWall( WP_LAS_GUN, 0, end, normal, IMPACTSOUND_DEFAULT, 0 );
+}
+
+/*
+======================
CG_Bullet
Renders bullet effects.
@@ -2315,5 +2358,4 @@ void CG_Bullet( vec3_t end, int sourceEntityNum, vec3_t normal, qboolean flesh,
} else {
CG_MissileHitWall( WP_MACHINEGUN, 0, end, normal, IMPACTSOUND_DEFAULT, 0 );
}
-
}