summaryrefslogtreecommitdiff
path: root/src/cgame
diff options
context:
space:
mode:
Diffstat (limited to 'src/cgame')
-rw-r--r--src/cgame/cg_buildable.c40
-rw-r--r--src/cgame/cg_event.c9
-rw-r--r--src/cgame/cg_local.h1
-rw-r--r--src/cgame/cg_main.c1
4 files changed, 34 insertions, 17 deletions
diff --git a/src/cgame/cg_buildable.c b/src/cgame/cg_buildable.c
index a75169da..d1732f38 100644
--- a/src/cgame/cg_buildable.c
+++ b/src/cgame/cg_buildable.c
@@ -597,8 +597,8 @@ static void CG_BuildableParticleEffects( centity_t *cent )
{
entityState_t *es = &cent->currentState;
buildableTeam_t team = BG_FindTeamForBuildable( es->modelindex );
- int health = es->generic1 & ~( B_POWERED_TOGGLEBIT | B_DCCED_TOGGLEBIT );
- float healthFrac = (float)health / 63.0f;
+ int health = es->generic1 & ~( B_POWERED_TOGGLEBIT | B_DCCED_TOGGLEBIT | B_SPAWNED_TOGGLEBIT );
+ float healthFrac = (float)health / B_HEALTH_SCALE;
int smokeTime, sparkTime, i, bleedBlobs;
vec3_t origin;
vec3_t acc = { 0.0f, 0.0f, 50.0f };
@@ -704,8 +704,8 @@ static void CG_BuildableHealthBar( centity_t *cent )
es = &cent->currentState;
- health = es->generic1 & ~( B_POWERED_TOGGLEBIT | B_DCCED_TOGGLEBIT );
- progress = (float)health / 63.0f;
+ health = es->generic1 & ~( B_POWERED_TOGGLEBIT | B_DCCED_TOGGLEBIT | B_SPAWNED_TOGGLEBIT );
+ progress = (float)health / B_HEALTH_SCALE;
if( progress < 0.0f )
progress = 0.0f;
@@ -773,19 +773,14 @@ CG_Buildable
void CG_Buildable( centity_t *cent )
{
refEntity_t ent;
- entityState_t *es;
+ entityState_t *es = &cent->currentState;
vec3_t angles;
vec3_t forward, surfNormal, xNormal, end, start, mins, maxs;
vec3_t refNormal = { 0.0f, 0.0f, 1.0f };
float rotAngle;
trace_t tr;
-
- es = &cent->currentState;
+ buildableTeam_t team = BG_FindTeamForBuildable( es->modelindex );
- //add creep
- if( es->modelindex2 == BIT_ALIENS )
- CG_Creep( cent );
-
// if set to invisible, skip
if ( !es->modelindex || ( es->eFlags & EF_NODRAW ) )
return;
@@ -835,11 +830,24 @@ void CG_Buildable( centity_t *cent )
ent.nonNormalizedAxes = qfalse;
- //run animations
- CG_BuildableAnimation( cent, &ent.oldframe, &ent.frame, &ent.backlerp );
+ //add creep
+ if( team == BIT_ALIENS )
+ {
+ CG_Creep( cent );
+ //run animations
+ CG_BuildableAnimation( cent, &ent.oldframe, &ent.frame, &ent.backlerp );
+ }
+ else if( team == BIT_HUMANS )
+ {
+ if( !( es->generic1 & B_SPAWNED_TOGGLEBIT ) )
+ ent.customShader = cgs.media.humanSpawningShader;
+ else
+ CG_BuildableAnimation( cent, &ent.oldframe, &ent.frame, &ent.backlerp );
+ }
+
// add to refresh list
- trap_R_AddRefEntityToScene(&ent);
+ trap_R_AddRefEntityToScene( &ent );
//turret barrel bit
if( cg_buildables[ es->modelindex ].models[ 1 ] )
@@ -863,6 +871,8 @@ void CG_Buildable( centity_t *cent )
turretBarrel.frame = ent.frame;
turretBarrel.backlerp = ent.backlerp;
+ turretBarrel.customShader = ent.customShader;
+
trap_R_AddRefEntityToScene( &turretBarrel );
}
@@ -892,6 +902,8 @@ void CG_Buildable( centity_t *cent )
turretTop.frame = ent.frame;
turretTop.backlerp = ent.backlerp;
+ turretTop.customShader = ent.customShader;
+
trap_R_AddRefEntityToScene( &turretTop );
}
diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c
index 93dcca1d..cdfd8718 100644
--- a/src/cgame/cg_event.c
+++ b/src/cgame/cg_event.c
@@ -780,9 +780,12 @@ void CG_EntityEvent( centity_t *cent, vec3_t position )
case EV_BUILD_DELAY:
DEBUGNAME( "EV_BUILD_DELAY" );
- //FIXME: change to "negative" sound
- trap_S_StartLocalSound( cgs.media.hitSound, CHAN_LOCAL_SOUND );
- cg.lastBuildAttempt = cg.time;
+ if( clientNum == cg.predictedPlayerState.clientNum )
+ {
+ //FIXME: change to "negative" sound
+ trap_S_StartLocalSound( cgs.media.hitSound, CHAN_LOCAL_SOUND );
+ cg.lastBuildAttempt = cg.time;
+ }
break;
case EV_POISONCLOUD:
diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h
index c5fbfbeb..b5e7238c 100644
--- a/src/cgame/cg_local.h
+++ b/src/cgame/cg_local.h
@@ -854,6 +854,7 @@ typedef struct
qhandle_t greenBuildShader;
qhandle_t redBuildShader;
qhandle_t noPowerShader;
+ qhandle_t humanSpawningShader;
// weapon effect models
qhandle_t bulletFlashModel;
diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c
index f68c7da1..d52c77ec 100644
--- a/src/cgame/cg_main.c
+++ b/src/cgame/cg_main.c
@@ -727,6 +727,7 @@ static void CG_RegisterGraphics( void )
cgs.media.greenBuildShader = trap_R_RegisterShader("gfx/2d/greenbuild" );
cgs.media.redBuildShader = trap_R_RegisterShader("gfx/2d/redbuild" );
cgs.media.noPowerShader = trap_R_RegisterShader("gfx/2d/nopower" );
+ cgs.media.humanSpawningShader = trap_R_RegisterShader("models/buildables/replicator/rep_cyl" );
cgs.media.machinegunBrassModel = trap_R_RegisterModel( "models/weapons2/shells/m_shell.md3" );
cgs.media.shotgunBrassModel = trap_R_RegisterModel( "models/weapons2/shells/s_shell.md3" );