summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2004-01-22 03:44:29 +0000
committerTim Angus <tim@ngus.net>2004-01-22 03:44:29 +0000
commit7dcfcac2a6de7e2976990b8620f660ad7af959a9 (patch)
tree6f198359eb207bf6a25ab6bf3c53ad76fe071673
parent8a7b1a7098224a0b3c36a3c2173f47ee22d4f583 (diff)
* Particle system should complain less if it can't find a specific system
* Reduced size of misc_particle_system entity in entities.def * Added prebuild sounds for the buildables
-rw-r--r--entities.def2
-rw-r--r--src/cgame/cg_buildable.c7
-rw-r--r--src/cgame/cg_ents.c1
-rw-r--r--src/cgame/cg_event.c3
-rw-r--r--src/cgame/cg_local.h7
-rw-r--r--src/cgame/cg_main.c12
-rw-r--r--src/cgame/cg_particles.c19
-rw-r--r--src/game/g_weapon.c6
8 files changed, 39 insertions, 18 deletions
diff --git a/entities.def b/entities.def
index 1376db92..19282d7c 100644
--- a/entities.def
+++ b/entities.def
@@ -905,7 +905,7 @@ Triggering this entity toggles it.
//=============================================================================
-/*QUAKED misc_particle_system (1 .5 .25) (-16 -16 -16) (16 16 16) SPAWN_DISABLED
+/*QUAKED misc_particle_system (1 .5 .25) (-8 -8 -8) (8 8 8) SPAWN_DISABLED
A particle system entity.
-------- KEYS --------
diff --git a/src/cgame/cg_buildable.c b/src/cgame/cg_buildable.c
index 2414b3d5..29b89ec4 100644
--- a/src/cgame/cg_buildable.c
+++ b/src/cgame/cg_buildable.c
@@ -979,12 +979,17 @@ void CG_Buildable( centity_t *cent )
if( !( es->generic1 & B_SPAWNED_TOGGLEBIT ) )
{
+ sfxHandle_t prebuildSound;
+
if( team == BIT_HUMANS )
{
ent.customShader = cgs.media.humanSpawningShader;
+ prebuildSound = cgs.media.humanBuildablePrebuild;
}
+ else if( team == BIT_ALIENS )
+ prebuildSound = cgs.media.alienBuildablePrebuild;
- /*trap_S_AddLoopingSound*/
+ trap_S_AddLoopingSound( es->number, cent->lerpOrigin, vec3_origin, prebuildSound );
}
CG_BuildableAnimation( cent, &ent.oldframe, &ent.frame, &ent.backlerp );
diff --git a/src/cgame/cg_ents.c b/src/cgame/cg_ents.c
index 1d6d5733..278309b8 100644
--- a/src/cgame/cg_ents.c
+++ b/src/cgame/cg_ents.c
@@ -882,6 +882,7 @@ static void CG_CEntityPVSEnter( centity_t *cent )
cent->jetPackState = JPS_OFF;
cent->buildablePS = NULL;
cent->entityPS = NULL;
+ cent->entityPSMissing = qfalse;
//make sure that the buildable animations are in a consistent state
//when a buildable enters the PVS
diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c
index 3157b660..6edcf942 100644
--- a/src/cgame/cg_event.c
+++ b/src/cgame/cg_event.c
@@ -710,7 +710,8 @@ void CG_EntityEvent( centity_t *cent, vec3_t position )
case EV_HUMAN_BUILDABLE_DAMAGE:
DEBUGNAME( "EV_HUMAN_BUILDABLE_DAMAGE" );
- trap_S_StartSound( NULL, es->number, CHAN_BODY, cgs.media.humanBuildableDamage );
+ i = rand( ) % 4;
+ trap_S_StartSound( NULL, es->number, CHAN_BODY, cgs.media.humanBuildableDamage[ i ] );
break;
case EV_ALIEN_BUILDABLE_DAMAGE:
diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h
index 3120ee18..4c5f36a3 100644
--- a/src/cgame/cg_local.h
+++ b/src/cgame/cg_local.h
@@ -465,6 +465,7 @@ typedef struct centity_s
jetPackState_t jetPackState;
particleSystem_t *entityPS;
+ qboolean entityPSMissing;
qboolean valid;
qboolean oldValid;
@@ -1178,9 +1179,11 @@ typedef struct
sfxHandle_t alienOvermindSpawns;
sfxHandle_t alienBuildableExplosion;
- sfxHandle_t humanBuildableExplosion;
sfxHandle_t alienBuildableDamage;
- sfxHandle_t humanBuildableDamage;
+ sfxHandle_t alienBuildablePrebuild;
+ sfxHandle_t humanBuildableExplosion;
+ sfxHandle_t humanBuildablePrebuild;
+ sfxHandle_t humanBuildableDamage[ 4 ];
qhandle_t cursor;
qhandle_t selectCursor;
diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c
index ee007318..baa1146a 100644
--- a/src/cgame/cg_main.c
+++ b/src/cgame/cg_main.c
@@ -586,7 +586,6 @@ static void CG_RegisterSounds( void )
cgs.media.gibBounce1Sound = trap_S_RegisterSound( "sound/player/gibimp1.wav", qfalse );
cgs.media.gibBounce2Sound = trap_S_RegisterSound( "sound/player/gibimp2.wav", qfalse );
cgs.media.gibBounce3Sound = trap_S_RegisterSound( "sound/player/gibimp3.wav", qfalse );
- cgs.media.metalGibBounceSound = trap_S_RegisterSound( "sound/weapons/rocket/rocklx1a.wav", qfalse );
cgs.media.teleInSound = trap_S_RegisterSound( "sound/world/telein.wav", qfalse );
cgs.media.teleOutSound = trap_S_RegisterSound( "sound/world/teleout.wav", qfalse );
@@ -648,9 +647,16 @@ static void CG_RegisterSounds( void )
cgs.media.alienEvolveSound = trap_S_RegisterSound( "sound/player/alienevolve.wav", qfalse );
cgs.media.alienBuildableExplosion = trap_S_RegisterSound( "sound/buildables/alien/explosion.wav", qfalse );
- cgs.media.humanBuildableExplosion = trap_S_RegisterSound( "sound/buildables/human/explosion.wav", qfalse );
cgs.media.alienBuildableDamage = trap_S_RegisterSound( "sound/buildables/alien/damage.wav", qfalse );
- cgs.media.humanBuildableDamage = trap_S_RegisterSound( "sound/buildables/human/damage.wav", qfalse );
+ cgs.media.alienBuildablePrebuild = trap_S_RegisterSound( "sound/buildables/alien/prebuild.wav", qfalse );
+
+ cgs.media.humanBuildableExplosion = trap_S_RegisterSound( "sound/buildables/human/explosion.wav", qfalse );
+ cgs.media.humanBuildablePrebuild = trap_S_RegisterSound( "sound/buildables/human/prebuild.wav", qfalse );
+ cgs.media.metalGibBounceSound = trap_S_RegisterSound( "sound/buildables/human/fragmentbounce.wav", qfalse );
+
+ for( i = 0; i < 4; i++ )
+ cgs.media.humanBuildableDamage[ i ] = trap_S_RegisterSound(
+ va( "sound/buildables/human/damage%d.wav", i ), qfalse );
cgs.media.hgrenb1aSound = trap_S_RegisterSound( "sound/weapons/grenade/hgrenb1a.wav", qfalse );
cgs.media.hgrenb2aSound = trap_S_RegisterSound( "sound/weapons/grenade/hgrenb2a.wav", qfalse );
diff --git a/src/cgame/cg_particles.c b/src/cgame/cg_particles.c
index ce0020d5..b3139bbf 100644
--- a/src/cgame/cg_particles.c
+++ b/src/cgame/cg_particles.c
@@ -357,8 +357,7 @@ particleSystem_t *CG_SpawnNewParticleSystem( qhandle_t psHandle )
if( !bps->registered )
{
- CG_Printf( S_COLOR_RED "ERROR: particle system %s has not been registered yet\n",
- bps->name );
+ CG_Printf( S_COLOR_RED "ERROR: a particle system has not been registered yet\n" );
return NULL;
}
@@ -426,7 +425,7 @@ qhandle_t CG_RegisterParticleSystem( char *name )
}
}
- CG_Printf( S_COLOR_YELLOW "WARNING: failed to load particle system %s\n", name );
+ CG_Printf( S_COLOR_RED "ERROR: failed to load particle system %s\n", name );
return 0;
}
@@ -2004,11 +2003,17 @@ void CG_ParticleSystemEntity( centity_t *cent )
return;
}
- if( !CG_IsParticleSystemValid( &cent->entityPS ) )
+ if( !CG_IsParticleSystemValid( &cent->entityPS ) && !cent->entityPSMissing )
{
cent->entityPS = CG_SpawnNewParticleSystem( cgs.gameParticleSystems[ es->modelindex ] );
- CG_SetParticleSystemOrigin( cent->entityPS, cent->lerpOrigin );
- CG_SetParticleSystemCent( cent->entityPS, cent );
- CG_AttachParticleSystemToOrigin( cent->entityPS );
+
+ if( CG_IsParticleSystemValid( &cent->entityPS ) )
+ {
+ CG_SetParticleSystemOrigin( cent->entityPS, cent->lerpOrigin );
+ CG_SetParticleSystemCent( cent->entityPS, cent );
+ CG_AttachParticleSystemToOrigin( cent->entityPS );
+ }
+ else
+ cent->entityPSMissing = qtrue;
}
}
diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c
index d036c0f5..dc2c6b38 100644
--- a/src/game/g_weapon.c
+++ b/src/game/g_weapon.c
@@ -84,13 +84,13 @@ void meleeAttack( gentity_t *ent, float range, int damage, meansOfDeath_t mod )
VectorMA( muzzle, range, forward, end );
trap_Trace( &tr, muzzle, NULL, NULL, end, ent->s.number, MASK_SHOT );
- if ( tr.surfaceFlags & SURF_NOIMPACT )
+ if( tr.surfaceFlags & SURF_NOIMPACT )
return;
traceEnt = &g_entities[ tr.entityNum ];
// send blood impact
- if ( traceEnt->takedamage && traceEnt->client )
+ if( traceEnt->takedamage && traceEnt->client )
{
tent = G_TempEntity( tr.endpos, EV_MISSILE_HIT );
tent->s.otherEntityNum = traceEnt->s.number;
@@ -99,7 +99,7 @@ void meleeAttack( gentity_t *ent, float range, int damage, meansOfDeath_t mod )
tent->s.generic1 = ent->s.generic1; //weaponMode
}
- if ( traceEnt->takedamage )
+ if( traceEnt->takedamage )
G_Damage( traceEnt, ent, ent, forward, tr.endpos, damage, DAMAGE_NO_KNOCKBACK, mod );
}