]> de.git.xonotic.org Git - voretournament/voretournament.git/commitdiff
Blur postprocessing effect when damaged. Ported from Xonotic code
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Fri, 25 Feb 2011 21:21:04 +0000 (23:21 +0200)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Fri, 25 Feb 2011 21:21:04 +0000 (23:21 +0200)
data/defaultVoretournament.cfg
data/qcsrc/client/View.qc

index f1202cc420f78be21dc9ca8d7ec1cc5e12c2f616..b13d32c1b82cc2a5ba9da655cc55ec757bdfe668 100644 (file)
@@ -578,6 +578,7 @@ set g_bloodloss 0   "amount of health below which blood loss occurs"
 set g_footsteps 1      "serverside footstep sounds"\r
 \r
 // effects\r
+r_glsl_postprocess 1\r
 r_picmipsprites 0 // Voretournament uses sprites that should never be picmipped (team mate, typing, waypoints)\r
 r_mipsprites 1\r
 r_mipskins 1\r
@@ -1060,6 +1061,8 @@ con_notifysize 10
 con_notifyalign 0\r
 \r
 seta hud_damage 0.55 "an improved version of gl_polyblend for damage, draw an image instead when hurt"\r
+seta hud_damage_blur 10 "Use postprocessing to blur the screen when you have taken damage. This can be paired with current hud damage or just used alone. Higher values = more blur"\r
+seta hud_damage_blur_alpha 0.5 "Amount of alpha to use when merging the blurred layers back into the render. Turning this up higher will remove bloom, so it's best to find a balance"\r
 seta hud_damage_gentle_alpha_multiplier 0.10 "how much to multiply alpha of flash when using the cl_gentle version, it's much more opaque than the non-gentle version"\r
 seta hud_damage_gentle_color "1 0.7 1" "color of flash for cl_gentle version"\r
 seta hud_damage_color "1 0 0" "color of flash"\r
@@ -1072,6 +1075,10 @@ seta hud_damage_pain_threshold_lower_health 50 "at which health we start lowerin
 seta hud_damage_pain_threshold_pulsating_min 0.6 "minimum value when calculating the pulse: max(pulsating_min, fabs(sin(PI * time / period))"\r
 seta hud_damage_pain_threshold_pulsating_period 0.8 "one pulse every X seconds"\r
 \r
+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"\r
+seta hud_postprocessing_maxbluralpha 0.5 "maximum alpha which the blur postprocess can be"\r
+seta hud_postprocessing_maxblurradius 10 "maximum radius which the blur postprocess can be"\r
+\r
 seta hud_contents 1 "an improved version of gl_polyblend for liquids such as water/lava/slime, draw a filler when inside the liquid"\r
 seta hud_contents_factor 1 "factor at which to multiply the current faded value."\r
 seta hud_contents_fadeintime 0.02 "factor of time it takes for the alpha level to reach normal value when entering the liquid"\r
index 07321ed6228c6922a20e1309ce94d50228a84b69..42fdf05c0c41e68480d4b528dc9b2459dbafb7f5 100644 (file)
@@ -257,6 +257,7 @@ float myhealth, myhealth_prev, myhealth_flash;
 float contentavgalpha, liquidalpha_prev;\r
 vector myhealth_gentlergb;\r
 vector liquidcolor_prev;\r
+vector damage_blurpostprocess, content_blurpostprocess;\r
 string artwork_image;\r
 string intermission_song;\r
 string NextFrameCommand;\r
@@ -562,6 +563,38 @@ void CSQC_UpdateView(float w, float h)
                }\r
                else\r
                        drawpic('0 0 0', "gfx/blood", '1 0 0' * vid_conwidth + '0 1 0' * vid_conheight, stov(cvar_string("hud_damage_color")), bound(0, myhealth_flash_temp, 1) * cvar("hud_damage"), DRAWFLAG_NORMAL);\r
+\r
+               if(cvar("hud_postprocessing"))\r
+               {\r
+                       if(cvar("hud_damage_blur"))\r
+                       {\r
+                               damage_blurpostprocess_x = 1;\r
+                               damage_blurpostprocess_y = bound(0, myhealth_flash_temp, 1) * cvar("hud_damage_blur");\r
+                               damage_blurpostprocess_z = bound(0, myhealth_flash_temp, 1) * cvar("hud_damage_blur_alpha");\r
+                       }\r
+                       else\r
+                       {\r
+                               damage_blurpostprocess_x = 0;\r
+                               damage_blurpostprocess_y = 0;\r
+                               damage_blurpostprocess_z = 0;\r
+                       }\r
+               }\r
+       }\r
+\r
+       if(cvar("hud_postprocessing"))\r
+       { // lets apply the postprocess effects from the previous two functions if needed\r
+               if(damage_blurpostprocess_x || content_blurpostprocess_x)\r
+               {\r
+                       float blurradius = bound(0, damage_blurpostprocess_y + content_blurpostprocess_y, cvar("hud_postprocessing_maxblurradius"));\r
+                       float bluralpha = bound(0, damage_blurpostprocess_z + content_blurpostprocess_z, cvar("hud_postprocessing_maxbluralpha"));\r
+                       cvar_set("r_glsl_postprocess_uservec1", strcat(ftos(blurradius), " ", ftos(bluralpha), " 0 0"));\r
+                       cvar_set("r_glsl_postprocess_uservec1_enable", "1");\r
+               }\r
+               else\r
+               {\r
+                       cvar_set("r_glsl_postprocess_uservec1", "0 0 0 0");\r
+                       cvar_set("r_glsl_postprocess_uservec1_enable", "0");\r
+               }\r
        }\r
 \r
        // Draw the mouse cursor\r