From 1d91c18466031a320b70828d84541b8094a2b486 Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Sat, 27 Jun 2015 19:59:02 +0200 Subject: Implement cg_brighten. --- src/cgame/cg_draw.c | 23 +++++++++++++++++++++++ src/cgame/cg_local.h | 4 ++++ src/cgame/cg_main.c | 8 +++++++- 3 files changed, 34 insertions(+), 1 deletion(-) (limited to 'src/cgame') diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c index 8597482..a439b51 100644 --- a/src/cgame/cg_draw.c +++ b/src/cgame/cg_draw.c @@ -4136,6 +4136,21 @@ static void CG_DrawHealthBars( void ) } } +/* +================= +CG_Brighten +================= +*/ +static void CG_Brighten( int iterations ) +{ + int i; + + for( i = 0; i < iterations; i++ ) + { + CG_DrawPic( 0, 0, 640, 480, cgs.media.brightenShader ); + } +} + /* ================= CG_DrawWarpOverlay @@ -4176,6 +4191,12 @@ static void CG_DrawWarpOverlay( void ) if( cg.warping ) { trap_R_SetColor( NULL ); + + if( cg_brighten.integer < 2 ) + { + CG_Brighten( MIN( 2 - cg_brighten.integer, 2 ) ); + } + CG_DrawPic( 0, 0, 640, 480, cgs.media.warpOverlay ); if( cg.warpExitBlocked ) @@ -4211,6 +4232,8 @@ static void CG_Draw2D( void ) // (only 2D that can't be disabled) CG_DrawLighting( ); + CG_Brighten( cg_brighten.integer ); + CG_DrawWarpOverlay( ); if( cg_draw2D.integer == 0 ) diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index d1ae009..8f0586e 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -1365,6 +1365,8 @@ typedef struct qhandle_t warpingShader; qhandle_t warpingEnvironmentShader; qhandle_t warpParticle; + + qhandle_t brightenShader; } cgMedia_t; typedef struct @@ -1631,6 +1633,8 @@ extern vmCvar_t cg_healthBarAlpha; extern vmCvar_t cg_hitSounds; extern vmCvar_t cg_hitStats; +extern vmCvar_t cg_brighten; + // // cg_main.c // diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c index 672b8bb..91187fe 100644 --- a/src/cgame/cg_main.c +++ b/src/cgame/cg_main.c @@ -241,6 +241,8 @@ vmCvar_t cg_healthBarAlpha; vmCvar_t cg_hitSounds; vmCvar_t cg_hitStats; +vmCvar_t cg_brighten; + typedef struct { vmCvar_t *vmCvar; @@ -397,7 +399,9 @@ static cvarTable_t cvarTable[ ] = { &cg_healthBarAlpha, "cg_healthBarAlpha", "0.5", CVAR_ARCHIVE }, { &cg_hitSounds, "cg_hitSounds", "1", CVAR_ARCHIVE }, - { &cg_hitStats, "cg_hitStats", "0", CVAR_ARCHIVE } + { &cg_hitStats, "cg_hitStats", "0", CVAR_ARCHIVE }, + + { &cg_brighten, "cg_brighten", "0", CVAR_ARCHIVE } }; static int cvarTableSize = sizeof( cvarTable ) / sizeof( cvarTable[0] ); @@ -942,6 +946,8 @@ static void CG_RegisterGraphics( void ) cgs.media.warpingEnvironmentShader = trap_R_RegisterShader( "gfx/level1/warpingEnvironment" ); cgs.media.warpParticle = trap_R_RegisterShader( "gfx/level1/warpParticle1" ); + cgs.media.brightenShader = trap_R_RegisterShader( "gfx/brighten" ); + CG_BuildableStatusParse( "ui/assets/human/buildstat.cfg", &cgs.humanBuildStat ); CG_BuildableStatusParse( "ui/assets/alien/buildstat.cfg", &cgs.alienBuildStat ); -- cgit