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. --- assets/gfx/level1/warpOverlay.jpg | Bin 308 -> 287 bytes assets/gfx/level1/warpOverlay2.jpg | Bin 9251 -> 0 bytes assets/scripts/aw_level1.shader | 10 ++++++--- src/cgame/cg_draw.c | 43 +++++++++++++++++++++++++++++++------ src/cgame/cg_local.h | 1 + src/cgame/cg_main.c | 1 + 6 files changed, 46 insertions(+), 9 deletions(-) delete mode 100644 assets/gfx/level1/warpOverlay2.jpg diff --git a/assets/gfx/level1/warpOverlay.jpg b/assets/gfx/level1/warpOverlay.jpg index 02b1b6b..33e83e2 100644 Binary files a/assets/gfx/level1/warpOverlay.jpg and b/assets/gfx/level1/warpOverlay.jpg differ diff --git a/assets/gfx/level1/warpOverlay2.jpg b/assets/gfx/level1/warpOverlay2.jpg deleted file mode 100644 index 702489c..0000000 Binary files a/assets/gfx/level1/warpOverlay2.jpg and /dev/null differ diff --git a/assets/scripts/aw_level1.shader b/assets/scripts/aw_level1.shader index 8d209db..33ce967 100644 --- a/assets/scripts/aw_level1.shader +++ b/assets/scripts/aw_level1.shader @@ -2,11 +2,15 @@ gfx/level1/warpOverlay { { map gfx/level1/warpOverlay.jpg - blendFunc GL_ONE_MINUS_DST_COLOR GL_ONE_MINUS_SRC_COLOR + blendFunc GL_DST_COLOR GL_ONE } { - map gfx/level1/warpOverlay2.jpg - blendFunc filter + map gfx/level1/warpOverlay.jpg + blendFunc GL_DST_COLOR GL_ONE + } + { + map gfx/level1/warpOverlay.jpg + blendFunc GL_ONE_MINUS_DST_COLOR GL_ONE_MINUS_SRC_COLOR } } 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