summaryrefslogtreecommitdiff
path: root/src/cgame/cg_ents.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cgame/cg_ents.c')
-rw-r--r--src/cgame/cg_ents.c426
1 files changed, 199 insertions, 227 deletions
diff --git a/src/cgame/cg_ents.c b/src/cgame/cg_ents.c
index f0e10574..c4b287aa 100644
--- a/src/cgame/cg_ents.c
+++ b/src/cgame/cg_ents.c
@@ -27,22 +27,22 @@ tag location
======================
*/
void CG_PositionEntityOnTag( refEntity_t *entity, const refEntity_t *parent,
- qhandle_t parentModel, char *tagName ) {
- int i;
+ qhandle_t parentModel, char *tagName )
+{
+ int i;
orientation_t lerped;
// lerp the tag
trap_R_LerpTag( &lerped, parentModel, parent->oldframe, parent->frame,
- 1.0 - parent->backlerp, tagName );
+ 1.0 - parent->backlerp, tagName );
// FIXME: allow origin offsets along tag?
VectorCopy( parent->origin, entity->origin );
- for ( i = 0 ; i < 3 ; i++ ) {
- VectorMA( entity->origin, lerped.origin[i], parent->axis[i], entity->origin );
- }
+ for( i = 0; i < 3; i++ )
+ VectorMA( entity->origin, lerped.origin[ i ], parent->axis[ i ], entity->origin );
// had to cast away the const to avoid compiler problems...
- MatrixMultiply( lerped.axis, ((refEntity_t *)parent)->axis, entity->axis );
+ MatrixMultiply( lerped.axis, ( (refEntity_t *)parent )->axis, entity->axis );
entity->backlerp = parent->backlerp;
}
@@ -56,25 +56,25 @@ tag location
======================
*/
void CG_PositionRotatedEntityOnTag( refEntity_t *entity, const refEntity_t *parent,
- qhandle_t parentModel, char *tagName ) {
- int i;
+ qhandle_t parentModel, char *tagName )
+{
+ int i;
orientation_t lerped;
- vec3_t tempAxis[3];
+ vec3_t tempAxis[ 3 ];
//AxisClear( entity->axis );
// lerp the tag
trap_R_LerpTag( &lerped, parentModel, parent->oldframe, parent->frame,
- 1.0 - parent->backlerp, tagName );
+ 1.0 - parent->backlerp, tagName );
// FIXME: allow origin offsets along tag?
VectorCopy( parent->origin, entity->origin );
- for ( i = 0 ; i < 3 ; i++ ) {
- VectorMA( entity->origin, lerped.origin[i], parent->axis[i], entity->origin );
- }
+ for( i = 0; i < 3; i++ )
+ VectorMA( entity->origin, lerped.origin[ i ], parent->axis[ i ], entity->origin );
// had to cast away the const to avoid compiler problems...
MatrixMultiply( entity->axis, lerped.axis, tempAxis );
- MatrixMultiply( tempAxis, ((refEntity_t *)parent)->axis, entity->axis );
+ MatrixMultiply( tempAxis, ( (refEntity_t *)parent )->axis, entity->axis );
}
@@ -94,17 +94,19 @@ CG_SetEntitySoundPosition
Also called by event processing code
======================
*/
-void CG_SetEntitySoundPosition( centity_t *cent ) {
- if ( cent->currentState.solid == SOLID_BMODEL ) {
+void CG_SetEntitySoundPosition( centity_t *cent )
+{
+ if( cent->currentState.solid == SOLID_BMODEL )
+ {
vec3_t origin;
- float *v;
+ float *v;
v = cgs.inlineModelMidpoints[ cent->currentState.modelindex ];
VectorAdd( cent->lerpOrigin, v, origin );
trap_S_UpdateEntityPosition( cent->currentState.number, origin );
- } else {
- trap_S_UpdateEntityPosition( cent->currentState.number, cent->lerpOrigin );
}
+ else
+ trap_S_UpdateEntityPosition( cent->currentState.number, cent->lerpOrigin );
}
/*
@@ -114,19 +116,23 @@ CG_EntityEffects
Add continuous entity effects, like local entity emission and lighting
==================
*/
-static void CG_EntityEffects( centity_t *cent ) {
-
+static void CG_EntityEffects( centity_t *cent )
+{
// update sound origins
CG_SetEntitySoundPosition( cent );
// add loop sound
- if ( cent->currentState.loopSound ) {
- if (cent->currentState.eType != ET_SPEAKER) {
+ if( cent->currentState.loopSound )
+ {
+ if( cent->currentState.eType != ET_SPEAKER )
+ {
trap_S_AddLoopingSound( cent->currentState.number, cent->lerpOrigin, vec3_origin,
- cgs.gameSounds[ cent->currentState.loopSound ] );
- } else {
+ cgs.gameSounds[ cent->currentState.loopSound ] );
+ }
+ else
+ {
trap_S_AddRealLoopingSound( cent->currentState.number, cent->lerpOrigin, vec3_origin,
- cgs.gameSounds[ cent->currentState.loopSound ] );
+ cgs.gameSounds[ cent->currentState.loopSound ] );
}
}
@@ -153,18 +159,18 @@ static void CG_EntityEffects( centity_t *cent ) {
CG_General
==================
*/
-static void CG_General( centity_t *cent ) {
+static void CG_General( centity_t *cent )
+{
refEntity_t ent;
entityState_t *s1;
s1 = &cent->currentState;
// if set to invisible, skip
- if (!s1->modelindex) {
+ if( !s1->modelindex )
return;
- }
- memset (&ent, 0, sizeof(ent));
+ memset( &ent, 0, sizeof( ent ) );
// set frame
@@ -175,18 +181,17 @@ static void CG_General( centity_t *cent ) {
VectorCopy( cent->lerpOrigin, ent.origin);
VectorCopy( cent->lerpOrigin, ent.oldorigin);
- ent.hModel = cgs.gameModels[s1->modelindex];
+ ent.hModel = cgs.gameModels[ s1->modelindex ];
// player model
- if (s1->number == cg.snap->ps.clientNum) {
+ if( s1->number == cg.snap->ps.clientNum )
ent.renderfx |= RF_THIRD_PERSON; // only draw from mirrors
- }
// convert angles to axis
AnglesToAxis( cent->lerpAngles, ent.axis );
// add to refresh list
- trap_R_AddRefEntityToScene (&ent);
+ trap_R_AddRefEntityToScene( &ent );
}
/*
@@ -196,20 +201,21 @@ CG_Speaker
Speaker entities can automatically play sounds
==================
*/
-static void CG_Speaker( centity_t *cent ) {
- if ( ! cent->currentState.clientNum ) { // FIXME: use something other than clientNum...
+static void CG_Speaker( centity_t *cent )
+{
+ if( ! cent->currentState.clientNum )
+ { // FIXME: use something other than clientNum...
return; // not auto triggering
}
- if ( cg.time < cent->miscTime ) {
+ if( cg.time < cent->miscTime )
return;
- }
- trap_S_StartSound (NULL, cent->currentState.number, CHAN_ITEM, cgs.gameSounds[cent->currentState.eventParm] );
+ trap_S_StartSound( NULL, cent->currentState.number, CHAN_ITEM, cgs.gameSounds[ cent->currentState.eventParm ] );
// ent->s.frame = ent->wait * 10;
// ent->s.clientNum = ent->random * 10;
- cent->miscTime = cg.time + cent->currentState.frame * 100 + cent->currentState.clientNum * 100 * crandom();
+ cent->miscTime = cg.time + cent->currentState.frame * 100 + cent->currentState.clientNum * 100 * crandom( );
}
@@ -230,55 +236,42 @@ static void CG_Missile( centity_t *cent )
int index;
s1 = &cent->currentState;
- if ( s1->weapon > WP_NUM_WEAPONS ) {
+ if( s1->weapon > WP_NUM_WEAPONS )
s1->weapon = 0;
- }
- weapon = &cg_weapons[s1->weapon];
+
+ weapon = &cg_weapons[ s1->weapon ];
// calculate the axis
- VectorCopy( s1->angles, cent->lerpAngles);
+ VectorCopy( s1->angles, cent->lerpAngles );
// add trails
- if ( weapon->missileTrailFunc )
- {
+ if( weapon->missileTrailFunc )
weapon->missileTrailFunc( cent, weapon );
- }
// add dynamic light
- if ( weapon->missileDlight ) {
- trap_R_AddLightToScene(cent->lerpOrigin, weapon->missileDlight,
- weapon->missileDlightColor[0], weapon->missileDlightColor[1], weapon->missileDlightColor[2] );
+ if( weapon->missileDlight )
+ {
+ trap_R_AddLightToScene( cent->lerpOrigin, weapon->missileDlight,
+ weapon->missileDlightColor[ 0 ], weapon->missileDlightColor[ 1 ], weapon->missileDlightColor[ 2 ] );
}
// add missile sound
- if ( weapon->missileSound ) {
+ if( weapon->missileSound )
+ {
vec3_t velocity;
BG_EvaluateTrajectoryDelta( &cent->currentState.pos, cg.time, velocity );
- //TA: FIXME: hack until i figure out why trap_S_ALS has a problem with velocity`
- if( s1->weapon == WP_PLASMAGUN )
- VectorClear( velocity );
-
trap_S_AddLoopingSound( cent->currentState.number, cent->lerpOrigin, velocity, weapon->missileSound );
}
// create the render entity
- memset (&ent, 0, sizeof(ent));
- VectorCopy( cent->lerpOrigin, ent.origin);
- VectorCopy( cent->lerpOrigin, ent.oldorigin);
+ memset( &ent, 0, sizeof( ent ) );
+ VectorCopy( cent->lerpOrigin, ent.origin );
+ VectorCopy( cent->lerpOrigin, ent.oldorigin );
switch( cent->currentState.weapon )
{
- case WP_PLASMAGUN:
- ent.reType = RT_SPRITE;
- ent.radius = 16;
- ent.rotation = 0;
- ent.customShader = cgs.media.plasmaBallShader;
- trap_R_AddRefEntityToScene( &ent );
- return;
- break;
-
case WP_PULSE_RIFLE:
ent.reType = RT_SPRITE;
ent.radius = 4;
@@ -335,66 +328,18 @@ static void CG_Missile( centity_t *cent )
/*
===============
-CG_Grapple
-
-This is called when the grapple is sitting up against the wall
-===============
-*/
-static void CG_Grapple( centity_t *cent ) {
- refEntity_t ent;
- entityState_t *s1;
- const weaponInfo_t *weapon;
-
- s1 = &cent->currentState;
- if ( s1->weapon > WP_NUM_WEAPONS ) {
- s1->weapon = 0;
- }
- weapon = &cg_weapons[s1->weapon];
-
- // calculate the axis
- VectorCopy( s1->angles, cent->lerpAngles);
-
-#if 0 // FIXME add grapple pull sound here..?
- // add missile sound
- if ( weapon->missileSound ) {
- trap_S_AddLoopingSound( cent->currentState.number, cent->lerpOrigin, vec3_origin, weapon->missileSound );
- }
-#endif
-
- // Will draw cable if needed
- CG_GrappleTrail ( cent, weapon );
-
- // create the render entity
- memset (&ent, 0, sizeof(ent));
- VectorCopy( cent->lerpOrigin, ent.origin);
- VectorCopy( cent->lerpOrigin, ent.oldorigin);
-
- // flicker between two skins
- ent.skinNum = cg.clientFrame & 1;
- ent.hModel = weapon->missileModel;
- ent.renderfx = weapon->missileRenderfx | RF_NOSHADOW;
-
- // convert direction of travel into axis
- if ( VectorNormalize2( s1->pos.trDelta, ent.axis[0] ) == 0 ) {
- ent.axis[0][2] = 1;
- }
-
- trap_R_AddRefEntityToScene( &ent );
-}
-
-/*
-===============
CG_Mover
===============
*/
-static void CG_Mover( centity_t *cent ) {
+static void CG_Mover( centity_t *cent )
+{
refEntity_t ent;
entityState_t *s1;
s1 = &cent->currentState;
// create the render entity
- memset (&ent, 0, sizeof(ent));
+ memset( &ent, 0, sizeof( ent ) );
VectorCopy( cent->lerpOrigin, ent.origin);
VectorCopy( cent->lerpOrigin, ent.oldorigin);
AnglesToAxis( cent->lerpAngles, ent.axis );
@@ -405,20 +350,20 @@ static void CG_Mover( centity_t *cent ) {
ent.skinNum = ( cg.time >> 6 ) & 1;
// get the model, either as a bmodel or a modelindex
- if ( s1->solid == SOLID_BMODEL ) {
- ent.hModel = cgs.inlineDrawModel[s1->modelindex];
- } else {
- ent.hModel = cgs.gameModels[s1->modelindex];
- }
+ if( s1->solid == SOLID_BMODEL )
+ ent.hModel = cgs.inlineDrawModel[ s1->modelindex ];
+ else
+ ent.hModel = cgs.gameModels[ s1->modelindex ];
// add to refresh list
- trap_R_AddRefEntityToScene(&ent);
+ trap_R_AddRefEntityToScene( &ent );
// add the secondary model
- if ( s1->modelindex2 ) {
+ if( s1->modelindex2 )
+ {
ent.skinNum = 0;
- ent.hModel = cgs.gameModels[s1->modelindex2];
- trap_R_AddRefEntityToScene(&ent);
+ ent.hModel = cgs.gameModels[ s1->modelindex2 ];
+ trap_R_AddRefEntityToScene( &ent );
}
}
@@ -430,14 +375,15 @@ CG_Beam
Also called as an event
===============
*/
-void CG_Beam( centity_t *cent ) {
+void CG_Beam( centity_t *cent )
+{
refEntity_t ent;
entityState_t *s1;
s1 = &cent->currentState;
// create the render entity
- memset (&ent, 0, sizeof(ent));
+ memset( &ent, 0, sizeof( ent ) );
VectorCopy( s1->pos.trBase, ent.origin );
VectorCopy( s1->origin2, ent.oldorigin );
AxisClear( ent.axis );
@@ -446,7 +392,7 @@ void CG_Beam( centity_t *cent ) {
ent.renderfx = RF_NOSHADOW;
// add to refresh list
- trap_R_AddRefEntityToScene(&ent);
+ trap_R_AddRefEntityToScene( &ent );
}
@@ -455,31 +401,32 @@ void CG_Beam( centity_t *cent ) {
CG_Portal
===============
*/
-static void CG_Portal( centity_t *cent ) {
+static void CG_Portal( centity_t *cent )
+{
refEntity_t ent;
entityState_t *s1;
s1 = &cent->currentState;
// create the render entity
- memset (&ent, 0, sizeof(ent));
+ memset( &ent, 0, sizeof( ent ) );
VectorCopy( cent->lerpOrigin, ent.origin );
VectorCopy( s1->origin2, ent.oldorigin );
- ByteToDir( s1->eventParm, ent.axis[0] );
- PerpendicularVector( ent.axis[1], ent.axis[0] );
+ ByteToDir( s1->eventParm, ent.axis[ 0 ] );
+ PerpendicularVector( ent.axis[ 1 ], ent.axis[ 0 ] );
// negating this tends to get the directions like they want
// we really should have a camera roll value
- VectorSubtract( vec3_origin, ent.axis[1], ent.axis[1] );
+ VectorSubtract( vec3_origin, ent.axis[ 1 ], ent.axis[ 1 ] );
- CrossProduct( ent.axis[0], ent.axis[1], ent.axis[2] );
+ CrossProduct( ent.axis[ 0 ], ent.axis[ 1 ], ent.axis[ 2 ] );
ent.reType = RT_PORTALSURFACE;
ent.oldframe = s1->powerups;
ent.frame = s1->frame; // rotation speed
- ent.skinNum = s1->clientNum/256.0 * 360; // roll offset
+ ent.skinNum = s1->clientNum / 256.0 * 360; // roll offset
// add to refresh list
- trap_R_AddRefEntityToScene(&ent);
+ trap_R_AddRefEntityToScene( &ent );
}
//============================================================================
@@ -548,18 +495,22 @@ CG_AdjustPositionForMover
Also called by client movement prediction code
=========================
*/
-void CG_AdjustPositionForMover( const vec3_t in, int moverNum, int fromTime, int toTime, vec3_t out ) {
+void CG_AdjustPositionForMover( const vec3_t in, int moverNum, int fromTime, int toTime, vec3_t out )
+{
centity_t *cent;
- vec3_t oldOrigin, origin, deltaOrigin;
- vec3_t oldAngles, angles, deltaAngles;
+ vec3_t oldOrigin, origin, deltaOrigin;
+ vec3_t oldAngles, angles, deltaAngles;
- if ( moverNum <= 0 || moverNum >= ENTITYNUM_MAX_NORMAL ) {
+ if( moverNum <= 0 || moverNum >= ENTITYNUM_MAX_NORMAL )
+ {
VectorCopy( in, out );
return;
}
cent = &cg_entities[ moverNum ];
- if ( cent->currentState.eType != ET_MOVER ) {
+
+ if( cent->currentState.eType != ET_MOVER )
+ {
VectorCopy( in, out );
return;
}
@@ -584,15 +535,15 @@ void CG_AdjustPositionForMover( const vec3_t in, int moverNum, int fromTime, int
CG_InterpolateEntityPosition
=============================
*/
-static void CG_InterpolateEntityPosition( centity_t *cent ) {
+static void CG_InterpolateEntityPosition( centity_t *cent )
+{
vec3_t current, next;
- float f;
+ float f;
// it would be an internal error to find an entity that interpolates without
// a snapshot ahead of the current one
- if ( cg.nextSnap == NULL ) {
+ if( cg.nextSnap == NULL )
CG_Error( "CG_InterpoateEntityPosition: cg.nextSnap == NULL" );
- }
f = cg.frameInterpolation;
@@ -601,16 +552,16 @@ static void CG_InterpolateEntityPosition( centity_t *cent ) {
BG_EvaluateTrajectory( &cent->currentState.pos, cg.snap->serverTime, current );
BG_EvaluateTrajectory( &cent->nextState.pos, cg.nextSnap->serverTime, next );
- cent->lerpOrigin[0] = current[0] + f * ( next[0] - current[0] );
- cent->lerpOrigin[1] = current[1] + f * ( next[1] - current[1] );
- cent->lerpOrigin[2] = current[2] + f * ( next[2] - current[2] );
+ cent->lerpOrigin[ 0 ] = current[ 0 ] + f * ( next[ 0 ] - current[ 0 ] );
+ cent->lerpOrigin[ 1 ] = current[ 1 ] + f * ( next[ 1 ] - current[ 1 ] );
+ cent->lerpOrigin[ 2 ] = current[ 2 ] + f * ( next[ 2 ] - current[ 2 ] );
BG_EvaluateTrajectory( &cent->currentState.apos, cg.snap->serverTime, current );
BG_EvaluateTrajectory( &cent->nextState.apos, cg.nextSnap->serverTime, next );
- cent->lerpAngles[0] = LerpAngle( current[0], next[0], f );
- cent->lerpAngles[1] = LerpAngle( current[1], next[1], f );
- cent->lerpAngles[2] = LerpAngle( current[2], next[2], f );
+ cent->lerpAngles[ 0 ] = LerpAngle( current[ 0 ], next[ 0 ], f );
+ cent->lerpAngles[ 1 ] = LerpAngle( current[ 1 ], next[ 1 ], f );
+ cent->lerpAngles[ 2 ] = LerpAngle( current[ 2 ], next[ 2 ], f );
}
@@ -620,25 +571,30 @@ CG_CalcEntityLerpPositions
===============
*/
-static void CG_CalcEntityLerpPositions( centity_t *cent ) {
+static void CG_CalcEntityLerpPositions( centity_t *cent )
+{
// if this player does not want to see extrapolated players
- if ( !cg_smoothClients.integer ) {
+ if( !cg_smoothClients.integer )
+ {
// make sure the clients use TR_INTERPOLATE
- if ( cent->currentState.number < MAX_CLIENTS ) {
+ if( cent->currentState.number < MAX_CLIENTS )
+ {
cent->currentState.pos.trType = TR_INTERPOLATE;
cent->nextState.pos.trType = TR_INTERPOLATE;
}
}
- if ( cent->interpolate && cent->currentState.pos.trType == TR_INTERPOLATE ) {
+ if( cent->interpolate && cent->currentState.pos.trType == TR_INTERPOLATE )
+ {
CG_InterpolateEntityPosition( cent );
return;
}
// first see if we can interpolate between two snaps for
// linear extrapolated clients
- if ( cent->interpolate && cent->currentState.pos.trType == TR_LINEAR_STOP &&
- cent->currentState.number < MAX_CLIENTS) {
+ if( cent->interpolate && cent->currentState.pos.trType == TR_LINEAR_STOP &&
+ cent->currentState.number < MAX_CLIENTS )
+ {
CG_InterpolateEntityPosition( cent );
return;
}
@@ -649,9 +605,10 @@ static void CG_CalcEntityLerpPositions( centity_t *cent ) {
// adjust for riding a mover if it wasn't rolled into the predicted
// player state
- if ( cent != &cg.predictedPlayerEntity ) {
+ if( cent != &cg.predictedPlayerEntity )
+ {
CG_AdjustPositionForMover( cent->lerpOrigin, cent->currentState.groundEntityNum,
- cg.snap->serverTime, cg.time, cent->lerpOrigin );
+ cg.snap->serverTime, cg.time, cent->lerpOrigin );
}
}
@@ -663,11 +620,11 @@ CG_AddCEntity
===============
*/
-static void CG_AddCEntity( centity_t *cent ) {
+static void CG_AddCEntity( centity_t *cent )
+{
// event-only entities will have been dealt with already
- if ( cent->currentState.eType >= ET_EVENTS ) {
+ if( cent->currentState.eType >= ET_EVENTS )
return;
- }
// calculate the current origin
CG_CalcEntityLerpPositions( cent );
@@ -675,53 +632,64 @@ static void CG_AddCEntity( centity_t *cent ) {
// add automatic effects
CG_EntityEffects( cent );
- switch ( cent->currentState.eType ) {
- default:
- CG_Error( "Bad entity type: %i\n", cent->currentState.eType );
- break;
- case ET_INVISIBLE:
- case ET_PUSH_TRIGGER:
- case ET_TELEPORT_TRIGGER:
- break;
- case ET_GENERAL:
- CG_General( cent );
- break;
- case ET_CORPSE:
- CG_Corpse( cent );
- break;
- case ET_PLAYER:
- CG_Player( cent );
- break;
- case ET_BUILDABLE:
- CG_Buildable( cent );
- break;
- case ET_MISSILE:
- CG_Missile( cent );
- break;
- case ET_MOVER:
- CG_Mover( cent );
- break;
- case ET_BEAM:
- CG_Beam( cent );
- break;
- case ET_PORTAL:
- CG_Portal( cent );
- break;
- case ET_SPEAKER:
- CG_Speaker( cent );
- break;
- case ET_GRAPPLE:
- CG_Grapple( cent );
- break;
- case ET_SPRITER:
- CG_Spriter( cent );
- break;
- case ET_ANIMMAPOBJ:
- CG_animMapObj( cent );
- break;
- case ET_LIGHTFLARE:
- CG_LightFlare( cent );
- break;
+ switch( cent->currentState.eType )
+ {
+ default:
+ CG_Error( "Bad entity type: %i\n", cent->currentState.eType );
+ break;
+
+ case ET_INVISIBLE:
+ case ET_PUSH_TRIGGER:
+ case ET_TELEPORT_TRIGGER:
+ break;
+
+ case ET_GENERAL:
+ CG_General( cent );
+ break;
+
+ case ET_CORPSE:
+ CG_Corpse( cent );
+ break;
+
+ case ET_PLAYER:
+ CG_Player( cent );
+ break;
+
+ case ET_BUILDABLE:
+ CG_Buildable( cent );
+ break;
+
+ case ET_MISSILE:
+ CG_Missile( cent );
+ break;
+
+ case ET_MOVER:
+ CG_Mover( cent );
+ break;
+
+ case ET_BEAM:
+ CG_Beam( cent );
+ break;
+
+ case ET_PORTAL:
+ CG_Portal( cent );
+ break;
+
+ case ET_SPEAKER:
+ CG_Speaker( cent );
+ break;
+
+ case ET_SPRITER:
+ CG_Spriter( cent );
+ break;
+
+ case ET_ANIMMAPOBJ:
+ CG_animMapObj( cent );
+ break;
+
+ case ET_LIGHTFLARE:
+ CG_LightFlare( cent );
+ break;
}
}
@@ -731,34 +699,38 @@ CG_AddPacketEntities
===============
*/
-void CG_AddPacketEntities( void ) {
- int num;
- centity_t *cent;
+void CG_AddPacketEntities( void )
+{
+ int num;
+ centity_t *cent;
playerState_t *ps;
// set cg.frameInterpolation
- if ( cg.nextSnap ) {
+ if( cg.nextSnap )
+ {
int delta;
- delta = (cg.nextSnap->serverTime - cg.snap->serverTime);
- if ( delta == 0 ) {
+ delta = ( cg.nextSnap->serverTime - cg.snap->serverTime );
+
+ if( delta == 0 )
cg.frameInterpolation = 0;
- } else {
+ else
cg.frameInterpolation = (float)( cg.time - cg.snap->serverTime ) / delta;
- }
- } else {
+ }
+ else
+ {
cg.frameInterpolation = 0; // actually, it should never be used, because
// no entities should be marked as interpolating
}
// the auto-rotating items will all have the same axis
- cg.autoAngles[0] = 0;
- cg.autoAngles[1] = ( cg.time & 2047 ) * 360 / 2048.0;
- cg.autoAngles[2] = 0;
+ cg.autoAngles[ 0 ] = 0;
+ cg.autoAngles[ 1 ] = ( cg.time & 2047 ) * 360 / 2048.0;
+ cg.autoAngles[ 2 ] = 0;
- cg.autoAnglesFast[0] = 0;
- cg.autoAnglesFast[1] = ( cg.time & 1023 ) * 360 / 1024.0f;
- cg.autoAnglesFast[2] = 0;
+ cg.autoAnglesFast[ 0 ] = 0;
+ cg.autoAnglesFast[ 1 ] = ( cg.time & 1023 ) * 360 / 1024.0f;
+ cg.autoAnglesFast[ 2 ] = 0;
AnglesToAxis( cg.autoAngles, cg.autoAxis );
AnglesToAxis( cg.autoAnglesFast, cg.autoAxisFast );