Skip to content

Commit

Permalink
Improve Wraith warp vision.
Browse files Browse the repository at this point in the history
  • Loading branch information
enneract committed Jun 27, 2015
1 parent be6717d commit 9f6a3c3
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 9 deletions.
Binary file modified assets/gfx/level1/warpOverlay.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/gfx/level1/warpOverlay2.jpg
Binary file not shown.
10 changes: 7 additions & 3 deletions assets/scripts/aw_level1.shader
Expand Up @@ -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
}
}

Expand Down
43 changes: 37 additions & 6 deletions src/cgame/cg_draw.c
Expand Up @@ -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;
}

//==================================================================================
Expand Down
1 change: 1 addition & 0 deletions src/cgame/cg_local.h
Expand Up @@ -1364,6 +1364,7 @@ typedef struct
qhandle_t warpOverlayBlocked;
qhandle_t warpingShader;
qhandle_t warpingEnvironmentShader;
qhandle_t warpParticle;
} cgMedia_t;

typedef struct
Expand Down
1 change: 1 addition & 0 deletions src/cgame/cg_main.c
Expand Up @@ -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 );
Expand Down

0 comments on commit 9f6a3c3

Please sign in to comment.