From: MirceaKitsune Date: Sat, 26 Feb 2011 01:04:42 +0000 (+0200) Subject: Implement sharpen effect when having the shield or strength powerup. Not fully finished. X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=1910ea7703937de96d8c51e3d02b22a7a40c8ef3;p=voretournament%2Fvoretournament.git Implement sharpen effect when having the shield or strength powerup. Not fully finished. --- diff --git a/data/defaultVoretournament.cfg b/data/defaultVoretournament.cfg index ff241d33..984d53b4 100644 --- a/data/defaultVoretournament.cfg +++ b/data/defaultVoretournament.cfg @@ -1091,6 +1091,7 @@ seta hud_stomach_fade_out 0.03 "how quickly the stomach splash disappears when y seta hud_postprocessing 1 "enables the ability for effects such as hud_damage_blur and hud_contents to apply a postprocessing method upon the screen - enabling this disables manual editing of the postprocess cvars" seta hud_postprocessing_maxbluralpha 0.5 "maximum alpha which the blur postprocess can be" seta hud_postprocessing_maxblurradius 10 "maximum radius which the blur postprocess can be" +seta hud_postprocessing_maxsharpenalpha 0.75 "maximum alpha which the sharpen postprocess can be" seta hud_contents 1 "an improved version of gl_polyblend for liquids such as water/lava/slime, draw a filler when inside the liquid" seta hud_contents_factor 1 "factor at which to multiply the current faded value." diff --git a/data/qcsrc/client/View.qc b/data/qcsrc/client/View.qc index 42a68526..aabe319c 100644 --- a/data/qcsrc/client/View.qc +++ b/data/qcsrc/client/View.qc @@ -634,6 +634,27 @@ void CSQC_UpdateView(float w, float h) cvar_set("r_glsl_postprocess_uservec1", "0 0 0 0"); cvar_set("r_glsl_postprocess_uservec1_enable", "0"); } + + if(cvar("hud_postprocessing_maxsharpenalpha")) + { + float sharpen_intensity; + if (getstatf(STAT_STRENGTH_FINISHED) - time > 0) + sharpen_intensity += (getstatf(STAT_STRENGTH_FINISHED) - time); + if (getstatf(STAT_INVINCIBLE_FINISHED) - time > 0) + sharpen_intensity += (getstatf(STAT_INVINCIBLE_FINISHED) - time); + sharpen_intensity = bound(0, sharpen_intensity, 5); // powerup warning time is 5 seconds, so match it + + if(sharpen_intensity > 0) + { + cvar_set("r_glsl_postprocess_uservec2", strcat("1 ", ftos(-sharpen_intensity * cvar("hud_postprocessing_maxsharpenalpha")), " 0 0")); + cvar_set("r_glsl_postprocess_uservec2_enable", "1"); + } + else + { + cvar_set("r_glsl_postprocess_uservec2", "0 0 0 0"); + cvar_set("r_glsl_postprocess_uservec2_enable", "0"); + } + } } if not(cvar("hud_damage") && cvar("hud_postprocessing")) @@ -642,6 +663,12 @@ void CSQC_UpdateView(float w, float h) cvar_set("r_glsl_postprocess_uservec1", "0 0 0 0"); cvar_set("r_glsl_postprocess_uservec1_enable", "0"); } + if not(cvar("hud_postprocessing_maxsharpenalpha") && cvar("hud_postprocessing")) + { + // don't allow sharpen to get stuck on if we disable the cvar while powered up + cvar_set("r_glsl_postprocess_uservec2", "0 0 0 0"); + cvar_set("r_glsl_postprocess_uservec2_enable", "0"); + } // Draw the mouse cursor // NOTE: drawpic must happen after R_RenderScene for some reason