diff options
author | Paweł Redman <pawel.redman@gmail.com> | 2015-06-27 19:59:02 +0200 |
---|---|---|
committer | Paweł Redman <pawel.redman@gmail.com> | 2015-06-27 19:59:02 +0200 |
commit | 1d91c18466031a320b70828d84541b8094a2b486 (patch) | |
tree | e5ed8092fd65756cbb3cc81745877808aa69970a | |
parent | 9f6a3c3c4c0d8c50f7e380feeb93e860af17638f (diff) |
Implement cg_brighten.
-rw-r--r-- | assets/gfx/level1/warpOverlay.jpg | bin | 287 -> 0 bytes | |||
-rw-r--r-- | assets/scripts/aw_level1.shader | 10 | ||||
-rw-r--r-- | assets/scripts/system_effects.shader | 9 | ||||
-rw-r--r-- | src/cgame/cg_draw.c | 23 | ||||
-rw-r--r-- | src/cgame/cg_local.h | 4 | ||||
-rw-r--r-- | src/cgame/cg_main.c | 8 |
6 files changed, 44 insertions, 10 deletions
diff --git a/assets/gfx/level1/warpOverlay.jpg b/assets/gfx/level1/warpOverlay.jpg Binary files differdeleted file mode 100644 index 33e83e2..0000000 --- a/assets/gfx/level1/warpOverlay.jpg +++ /dev/null diff --git a/assets/scripts/aw_level1.shader b/assets/scripts/aw_level1.shader index 33ce967..5a7d570 100644 --- a/assets/scripts/aw_level1.shader +++ b/assets/scripts/aw_level1.shader @@ -1,15 +1,7 @@ gfx/level1/warpOverlay { { - map gfx/level1/warpOverlay.jpg - blendFunc GL_DST_COLOR GL_ONE - } - { - map gfx/level1/warpOverlay.jpg - blendFunc GL_DST_COLOR GL_ONE - } - { - map gfx/level1/warpOverlay.jpg + map *white blendFunc GL_ONE_MINUS_DST_COLOR GL_ONE_MINUS_SRC_COLOR } } diff --git a/assets/scripts/system_effects.shader b/assets/scripts/system_effects.shader index fce90a2..b5366a9 100644 --- a/assets/scripts/system_effects.shader +++ b/assets/scripts/system_effects.shader @@ -687,3 +687,12 @@ gfx/misc/nopower rgbGen identity } } + + +gfx/brighten +{ + { + map *white + blendFunc GL_DST_COLOR GL_ONE + } +} 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 @@ -4138,6 +4138,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 ); |