diff options
Diffstat (limited to 'src/cgame')
-rw-r--r-- | src/cgame/cg_draw.c | 5 | ||||
-rw-r--r-- | src/cgame/cg_ents.c | 94 | ||||
-rw-r--r-- | src/cgame/cg_local.h | 9 | ||||
-rw-r--r-- | src/cgame/cg_main.c | 18 |
4 files changed, 72 insertions, 54 deletions
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c index e92e8652..cc087856 100644 --- a/src/cgame/cg_draw.c +++ b/src/cgame/cg_draw.c @@ -354,8 +354,9 @@ static void CG_DrawLighting( void ) switch( cg.snap->ps.stats[ STAT_PCLASS ] ) { - case PCL_D_BASE: - case PCL_D_BUILDER: + case PCL_D_B_BASE: + case PCL_D_O_BASE: + case PCL_D_D_BASE: if( lum < 10 ) CG_DrawPic( -4, -4, 648, 488, cgs.media.droidNav9 ); else if( lum >= 10 && lum < 16 ) diff --git a/src/cgame/cg_ents.c b/src/cgame/cg_ents.c index d78f3d64..9b8c10e5 100644 --- a/src/cgame/cg_ents.c +++ b/src/cgame/cg_ents.c @@ -709,59 +709,42 @@ CG_TorchLight */ static void CG_TorchLight( centity_t *cent ) { - float r, g, b; - int i, j, k; - byte lum; + int i, j, lum, numFragments; polyVert_t verts[ 4 ]; - vec3_t square[ 4 ]; - vec2_t tex[ 4 ]; - float size; + float size, texCoordScale, veclength; trace_t tr; + vec2_t tex[ 4 ]; vec3_t temp, origin, normal, projection, angles; + vec3_t to, from, forward, length; + vec3_t markPoints[ MAX_MARK_POINTS ]; + vec3_t square[ 4 ]; vec4_t axis[ 3 ], color; markFragment_t markFragments[ MAX_MARK_FRAGMENTS ], *mf; - vec3_t markPoints[ MAX_MARK_POINTS ]; - int numFragments; - float texCoordScale; - - if( cent->currentState.frame == cg.predictedPlayerState.clientNum ) + if( cent->currentState.clientNum == cg.predictedPlayerState.clientNum ) { - vec3_t to, from, forward, length; - float veclength; - VectorCopy( cg.predictedPlayerState.origin, from ); VectorCopy( cg.predictedPlayerState.viewangles, angles ); - - from[2] += cg.predictedPlayerState.viewheight; - - AngleVectors( angles, forward, NULL, NULL ); - VectorMA( from, 4096, forward, to ); - - CG_Trace( &tr, from, NULL, NULL, to, cg.predictedPlayerState.clientNum, MASK_SOLID ); - - VectorSubtract( tr.endpos, from, length ); - veclength = VectorLength( length ); - - VectorMA( tr.endpos, -(veclength / 5), forward, origin ); - - //VectorCopy( cent->lerpOrigin, origin ); - size = veclength / 2.0f; - if( size > 255 ) size = 255; - if( size < 0 ) size = 0; } else { - VectorCopy( cent->lerpOrigin, origin ); + VectorCopy( cent->lerpOrigin, from ); VectorCopy( cent->lerpAngles, angles ); - - size = ( cent->currentState.constantLight >> 24 ) & 0xFF; //CREEP_BASESIZE / 2; } - AngleVectors( angles, temp, NULL, NULL ); - VectorMA( origin, 4096, temp, temp ); + from[2] += cg.predictedPlayerState.viewheight; + + AngleVectors( angles, forward, NULL, NULL ); + VectorMA( from, 4096, forward, to ); - CG_Trace( &tr, origin, NULL, NULL, temp, cent->currentState.number, MASK_SOLID ); + CG_Trace( &tr, from, NULL, NULL, to, -1, MASK_SOLID ); + + VectorSubtract( tr.endpos, from, length ); + veclength = VectorLength( length ); + + size = veclength / 2.0f; + if( size > 255 ) size = 255; + if( size < 0 ) size = 0; VectorCopy( tr.endpos, origin ); VectorCopy( tr.plane.normal, normal ); @@ -789,16 +772,21 @@ static void CG_TorchLight( centity_t *cent ) Vector2Set( tex[ 2 ], 1, 1 ); Vector2Set( tex[ 3 ], 1, 0 ); - VectorScale( normal, -20, projection ); + VectorScale( normal, -32, projection ); numFragments = trap_CM_MarkFragments( 4, (void *)square, projection, MAX_MARK_POINTS, markPoints[0], MAX_MARK_FRAGMENTS, markFragments ); color[ 0 ] = color[ 1 ] = color[ 2 ] = color[ 3 ] = 255; - r = g = b = 1; + VectorCopy( origin, temp ); + VectorMA( temp, 48, normal, temp ); + lum = CG_AmbientLight( temp ); + + lum += (int)( ( size / 255.0f ) * 24 ); - lum = CG_AmbientLight( origin ); + if( lum > 255 ) + lum = 255; for ( i = 0, mf = markFragments ; i < numFragments ; i++, mf++ ) { @@ -823,13 +811,27 @@ static void CG_TorchLight( centity_t *cent ) v->st[1] = 0.5 + DotProduct( delta, axis[2] ) * texCoordScale; *(int *)v->modulate = *(int *)color; } - - trap_R_AddPolyToScene( cgs.media.humanTorch, mf->numPoints, verts ); - + + if( lum < 64 ) + { + if( lum < 10 ) + trap_R_AddPolyToScene( cgs.media.humanTorch8, mf->numPoints, verts ); + else if( lum >= 10 && lum < 16 ) + trap_R_AddPolyToScene( cgs.media.humanTorch7, mf->numPoints, verts ); + else if( lum >= 16 && lum < 22 ) + trap_R_AddPolyToScene( cgs.media.humanTorch6, mf->numPoints, verts ); + else if( lum >= 22 && lum < 28 ) + trap_R_AddPolyToScene( cgs.media.humanTorch5, mf->numPoints, verts ); + else if( lum >= 28 && lum < 34 ) + trap_R_AddPolyToScene( cgs.media.humanTorch4, mf->numPoints, verts ); + else if( lum >= 34 && lum < 40 ) + trap_R_AddPolyToScene( cgs.media.humanTorch3, mf->numPoints, verts ); + else if( lum >= 40 && lum < 46 ) + trap_R_AddPolyToScene( cgs.media.humanTorch2, mf->numPoints, verts ); + else if( lum >= 46 ) + trap_R_AddPolyToScene( cgs.media.humanTorch1, mf->numPoints, verts ); + } } - - - trap_R_AddLightToScene( origin, (int)size, r, g, b ); } /* diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index 3417ddfc..d1703528 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -737,7 +737,14 @@ typedef struct { qhandle_t explosionTrailShader; qhandle_t humanNV; - qhandle_t humanTorch; + qhandle_t humanTorch8; + qhandle_t humanTorch7; + qhandle_t humanTorch6; + qhandle_t humanTorch5; + qhandle_t humanTorch4; + qhandle_t humanTorch3; + qhandle_t humanTorch2; + qhandle_t humanTorch1; qhandle_t droidNav9; qhandle_t droidNav8; qhandle_t droidNav7; diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c index f1a2af5d..01ae9552 100644 --- a/src/cgame/cg_main.c +++ b/src/cgame/cg_main.c @@ -795,7 +795,14 @@ static void CG_RegisterGraphics( void ) { //TA: screenfades cgs.media.humanNV = trap_R_RegisterShader( "humanNV" ); - cgs.media.humanTorch = trap_R_RegisterShader( "humanTorch" ); + cgs.media.humanTorch8 = trap_R_RegisterShader( "humanTorch8" ); + cgs.media.humanTorch7 = trap_R_RegisterShader( "humanTorch7" ); + cgs.media.humanTorch6 = trap_R_RegisterShader( "humanTorch6" ); + cgs.media.humanTorch5 = trap_R_RegisterShader( "humanTorch5" ); + cgs.media.humanTorch4 = trap_R_RegisterShader( "humanTorch4" ); + cgs.media.humanTorch3 = trap_R_RegisterShader( "humanTorch3" ); + cgs.media.humanTorch2 = trap_R_RegisterShader( "humanTorch2" ); + cgs.media.humanTorch1 = trap_R_RegisterShader( "humanTorch1" ); cgs.media.droidNav9 = trap_R_RegisterShader( "droidNav9" ); cgs.media.droidNav8 = trap_R_RegisterShader( "droidNav8" ); cgs.media.droidNav7 = trap_R_RegisterShader( "droidNav7" ); @@ -927,8 +934,8 @@ CG_RegisterClients static void CG_RegisterClients( void ) { int i; - CG_LoadingClient(cg.clientNum); - CG_NewClientInfo(cg.clientNum); + //CG_LoadingClient(cg.clientNum); + //CG_NewClientInfo(cg.clientNum); for (i=0 ; i<MAX_CLIENTS+MAX_PRECACHES; i++) { const char *clientInfo; @@ -941,14 +948,15 @@ static void CG_RegisterClients( void ) { if ( !clientInfo[0] ) { continue; } - CG_LoadingClient( i ); if( i < MAX_CLIENTS ) { - CG_NewClientInfo( i ); + //CG_LoadingClient( i ); + //CG_NewClientInfo( i ); } else { + CG_LoadingClient( i ); CG_PrecacheClientInfo( i ); } } |