From 9f6a3c3c4c0d8c50f7e380feeb93e860af17638f Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Sat, 27 Jun 2015 15:54:39 +0200 Subject: Improve Wraith warp vision. --- src/cgame/cg_draw.c | 43 +++++++++++++++++++++++++++++++++++++------ src/cgame/cg_local.h | 1 + src/cgame/cg_main.c | 1 + 3 files changed, 39 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c index 15a5cc4..8597482 100644 --- a/src/cgame/cg_draw.c +++ b/src/cgame/cg_draw.c @@ -4143,19 +4143,50 @@ CG_DrawWarpOverlay */ static void CG_DrawWarpOverlay( void ) { - if( !cg.warping || - cg.renderingThirdPerson ) + static qboolean last_valid = qfalse, last_warping; + static int timestamp = 0; + + if( cg.renderingThirdPerson || + cg.predictedPlayerState.weapon != WP_ALEVEL1 ) { + last_valid = qfalse; return; } - trap_R_SetColor( NULL ); - CG_DrawPic( 0, 0, 640, 480, cgs.media.warpOverlay ); + if( last_valid ) + { + if( last_warping != cg.warping ) + { + timestamp = cg.time; + } + + if( timestamp && cg.time < timestamp + 200 ) + { + float frac; + + frac = ( 1.0f - ( cg.time - timestamp ) / 200.0f ); + frac = pow( frac, 4 ) * 6; - if( cg.warpExitBlocked ) + CG_DrawPic( 320 - 320 * frac, 240 - 240 * frac, + 640 * frac, 480 * frac, + cgs.media.warpParticle ); + } + } + + if( cg.warping ) { - CG_DrawPic( 0, 0, 640, 480, cgs.media.warpOverlayBlocked ); + trap_R_SetColor( NULL ); + CG_DrawPic( 0, 0, 640, 480, cgs.media.warpOverlay ); + + if( cg.warpExitBlocked ) + { + CG_DrawPic( 0, 0, 640, 480, cgs.media.warpOverlayBlocked ); + } } + +out: + last_valid = qtrue; + last_warping = cg.warping; } //================================================================================== diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index 555063f..d1ae009 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -1364,6 +1364,7 @@ typedef struct qhandle_t warpOverlayBlocked; qhandle_t warpingShader; qhandle_t warpingEnvironmentShader; + qhandle_t warpParticle; } cgMedia_t; typedef struct diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c index 2e7fb66..672b8bb 100644 --- a/src/cgame/cg_main.c +++ b/src/cgame/cg_main.c @@ -940,6 +940,7 @@ static void CG_RegisterGraphics( void ) cgs.media.warpOverlayBlocked = trap_R_RegisterShader( "gfx/level1/warpOverlayBlocked" ); cgs.media.warpingShader = trap_R_RegisterShader( "gfx/level1/warping" ); cgs.media.warpingEnvironmentShader = trap_R_RegisterShader( "gfx/level1/warpingEnvironment" ); + cgs.media.warpParticle = trap_R_RegisterShader( "gfx/level1/warpParticle1" ); CG_BuildableStatusParse( "ui/assets/human/buildstat.cfg", &cgs.humanBuildStat ); CG_BuildableStatusParse( "ui/assets/alien/buildstat.cfg", &cgs.alienBuildStat ); -- cgit