summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cgame/cg_event.c2
-rw-r--r--src/cgame/cg_local.h6
-rw-r--r--src/cgame/cg_main.c3
-rw-r--r--src/cgame/cg_players.c35
-rw-r--r--src/cgame/cg_weapons.c59
-rw-r--r--src/game/g_weapon.c4
6 files changed, 67 insertions, 42 deletions
diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c
index 2aa0a13c..aa0f37cd 100644
--- a/src/cgame/cg_event.c
+++ b/src/cgame/cg_event.c
@@ -805,7 +805,7 @@ void CG_EntityEvent( centity_t *cent, vec3_t position )
case EV_MISSILE_HIT:
DEBUGNAME( "EV_MISSILE_HIT" );
ByteToDir( es->eventParm, dir );
- CG_MissileHitPlayer( es->weapon, es->generic1, position, dir, es->otherEntityNum, es->torsoAnim );
+ CG_MissileHitEntity( es->weapon, es->generic1, position, dir, es->otherEntityNum, es->torsoAnim );
break;
case EV_MISSILE_MISS:
diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h
index 6301919f..f2807044 100644
--- a/src/cgame/cg_local.h
+++ b/src/cgame/cg_local.h
@@ -1288,6 +1288,9 @@ typedef struct
qhandle_t alienBleedPS;
qhandle_t humanBleedPS;
+ qhandle_t alienBuildableBleedPS;
+ qhandle_t humanBuildableBleedPS;
+
qhandle_t teslaZapTS;
@@ -1723,7 +1726,8 @@ void CG_RegisterWeapon( int weaponNum );
void CG_FireWeapon( centity_t *cent, weaponMode_t weaponMode );
void CG_MissileHitWall( weapon_t weapon, weaponMode_t weaponMode, int clientNum,
vec3_t origin, vec3_t dir, impactSound_t soundType, int charge );
-void CG_MissileHitPlayer( weapon_t weapon, weaponMode_t weaponMode, vec3_t origin, vec3_t dir, int entityNum, int charge );
+void CG_MissileHitEntity( weapon_t weaponNum, weaponMode_t weaponMode,
+ vec3_t origin, vec3_t dir, int entityNum, int charge );
void CG_Bullet( vec3_t origin, int sourceEntityNum, vec3_t normal, qboolean flesh, int fleshEntityNum );
void CG_ShotgunFire( entityState_t *es );
diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c
index 7925b659..8beb0245 100644
--- a/src/cgame/cg_main.c
+++ b/src/cgame/cg_main.c
@@ -787,6 +787,9 @@ static void CG_RegisterGraphics( void )
cgs.media.humanBuildableDestroyedPS = CG_RegisterParticleSystem( "humanBuildableDestroyedPS" );
cgs.media.alienBuildableDestroyedPS = CG_RegisterParticleSystem( "alienBuildableDestroyedPS" );
+ cgs.media.humanBuildableBleedPS = CG_RegisterParticleSystem( "humanBuildableBleedPS");
+ cgs.media.alienBuildableBleedPS = CG_RegisterParticleSystem( "alienBleedPS" );
+ // use the regular alien bleed ps for buildables for now
cgs.media.alienBleedPS = CG_RegisterParticleSystem( "alienBleedPS" );
cgs.media.humanBleedPS = CG_RegisterParticleSystem( "humanBleedPS" );
diff --git a/src/cgame/cg_players.c b/src/cgame/cg_players.c
index 97324fa8..6fa577f6 100644
--- a/src/cgame/cg_players.c
+++ b/src/cgame/cg_players.c
@@ -2369,38 +2369,3 @@ void CG_PlayerDisconnect( vec3_t org )
}
}
-/*
-=================
-CG_Bleed
-
-This is the spurt of blood when a character gets hit
-=================
-*/
-void CG_Bleed( vec3_t origin, vec3_t normal, int entityNum )
-{
- team_t team = cgs.clientinfo[ entityNum ].team;
- qhandle_t bleedPS;
- particleSystem_t *ps;
-
- if( !cg_blood.integer )
- return;
-
- if( team == TEAM_ALIENS )
- bleedPS = cgs.media.alienBleedPS;
- else if( team == TEAM_HUMANS )
- bleedPS = cgs.media.humanBleedPS;
- else
- return;
-
- ps = CG_SpawnNewParticleSystem( bleedPS );
-
- if( CG_IsParticleSystemValid( &ps ) )
- {
- CG_SetAttachmentPoint( &ps->attachment, origin );
- CG_SetAttachmentCent( &ps->attachment, &cg_entities[ entityNum ] );
- CG_AttachToPoint( &ps->attachment );
-
- CG_SetParticleSystemNormal( ps, normal );
- }
-}
-
diff --git a/src/cgame/cg_weapons.c b/src/cgame/cg_weapons.c
index 8a95e096..414d3a89 100644
--- a/src/cgame/cg_weapons.c
+++ b/src/cgame/cg_weapons.c
@@ -1799,10 +1799,10 @@ void CG_MissileHitWall( weapon_t weaponNum, weaponMode_t weaponMode, int clientN
/*
=================
-CG_MissileHitPlayer
+CG_MissileHitEntity
=================
*/
-void CG_MissileHitPlayer( weapon_t weaponNum, weaponMode_t weaponMode,
+void CG_MissileHitEntity( weapon_t weaponNum, weaponMode_t weaponMode,
vec3_t origin, vec3_t dir, int entityNum, int charge )
{
vec3_t normal;
@@ -2025,8 +2025,9 @@ static void CG_ShotgunPattern( vec3_t origin, vec3_t origin2, int seed, int othe
if( !( tr.surfaceFlags & SURF_NOIMPACT ) )
{
- if( cg_entities[ tr.entityNum ].currentState.eType == ET_PLAYER )
- CG_MissileHitPlayer( WP_SHOTGUN, WPM_PRIMARY, tr.endpos, tr.plane.normal, tr.entityNum, 0 );
+ if( cg_entities[ tr.entityNum ].currentState.eType == ET_PLAYER ||
+ cg_entities[ tr.entityNum ].currentState.eType == ET_BUILDABLE )
+ CG_MissileHitEntity( WP_SHOTGUN, WPM_PRIMARY, tr.endpos, tr.plane.normal, tr.entityNum, 0 );
else if( tr.surfaceFlags & SURF_METALSTEPS )
CG_MissileHitWall( WP_SHOTGUN, WPM_PRIMARY, 0, tr.endpos, tr.plane.normal, IMPACTSOUND_METAL, 0 );
else
@@ -2052,3 +2053,53 @@ void CG_ShotgunFire( entityState_t *es )
CG_ShotgunPattern( es->pos.trBase, es->origin2, es->eventParm, es->otherEntityNum );
}
+/*
+=================
+CG_Bleed
+
+This is the spurt of blood when a character gets hit
+=================
+*/
+void CG_Bleed( vec3_t origin, vec3_t normal, int entityNum )
+{
+ team_t team;
+ qhandle_t bleedPS;
+ particleSystem_t *ps;
+
+ if( !cg_blood.integer )
+ return;
+
+ if( cg_entities[ entityNum ].currentState.eType == ET_PLAYER )
+ {
+ team = cgs.clientinfo[ entityNum ].team;
+ if( team == TEAM_ALIENS )
+ bleedPS = cgs.media.alienBleedPS;
+ else if( team == TEAM_HUMANS )
+ bleedPS = cgs.media.humanBleedPS;
+ else
+ return;
+ }
+ else if( cg_entities[ entityNum ].currentState.eType == ET_BUILDABLE )
+ {
+ //ew
+ team = BG_Buildable( cg_entities[ entityNum ].currentState.modelindex )->team;
+ if( team == TEAM_ALIENS )
+ bleedPS = cgs.media.alienBuildableBleedPS;
+ else if( team == TEAM_HUMANS )
+ bleedPS = cgs.media.humanBuildableBleedPS;
+ }
+ else
+ return;
+
+ ps = CG_SpawnNewParticleSystem( bleedPS );
+
+ if( CG_IsParticleSystemValid( &ps ) )
+ {
+ CG_SetAttachmentPoint( &ps->attachment, origin );
+ CG_SetAttachmentCent( &ps->attachment, &cg_entities[ entityNum ] );
+ CG_AttachToPoint( &ps->attachment );
+
+ CG_SetParticleSystemNormal( ps, normal );
+ }
+}
+
diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c
index bf547dbb..dac17f7a 100644
--- a/src/game/g_weapon.c
+++ b/src/game/g_weapon.c
@@ -362,7 +362,9 @@ void bulletFire( gentity_t *ent, float spread, int damage, int mod )
SnapVectorTowards( tr.endpos, muzzle );
// send bullet impact
- if( traceEnt->takedamage && traceEnt->client )
+ if( traceEnt->takedamage &&
+ (traceEnt->s.eType == ET_PLAYER ||
+ traceEnt->s.eType == ET_BUILDABLE ) )
{
tent = G_TempEntity( tr.endpos, EV_BULLET_HIT_FLESH );
tent->s.eventParm = traceEnt->s.number;