+ drawpic(splash_pos, "gfx/blood", splash_size, 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") && myhealth_flash_temp)\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_stomach"))\r
+ {\r
+ if(getstati(STAT_VORE_EATEN))\r
+ {\r
+ if(stomachsplash_alpha < cvar("hud_stomach"))\r
+ stomachsplash_alpha += cvar("hud_stomach_fade_in") * frametime;\r
+ else\r
+ stomachsplash_alpha = cvar("hud_stomach");\r
+ }\r
+ else if(getstati(STAT_HEALTH) > 0)\r
+ {\r
+ if(stomachsplash_alpha > 0)\r
+ stomachsplash_alpha -= cvar("hud_stomach_fade_out") * frametime;\r
+ else\r
+ stomachsplash_alpha = 0;\r
+ }\r
+\r
+ if(respawned)\r
+ stomachsplash_alpha = 0; // we respawned, remove the effect\r
+ if(spectatee_status == -1)\r
+ stomachsplash_alpha = 0;\r
+\r
+ stomachsplash_alpha = bound(0, stomachsplash_alpha, 1);\r
+ drawpic(splash_pos, "gfx/food", splash_size, stov(cvar_string("hud_stomach_color")), stomachsplash_alpha, DRAWFLAG_NORMAL);\r
+ }\r
+\r
+ if(cvar("hud_postprocessing"))\r
+ {\r
+ // all of this should be done in the engine eventually\r
+\r
+ // disable damage blur when dead, but keep content blur\r
+ if(getstati(STAT_HEALTH) <= 0)\r
+ damage_blurpostprocess = '0 0 0';\r
+\r
+ // enable or disable rendering types if they are used or not\r
+ if(cvar("r_glsl_postprocess_uservec1_enable") != (cvar("hud_postprocessing_maxbluralpha") != 0))\r
+ cvar_set("r_glsl_postprocess_uservec1_enable", ftos(cvar("hud_postprocessing_maxbluralpha") != 0));\r
+ if(cvar("r_glsl_postprocess_uservec2_enable") != (cvar("hud_powerup") != 0))\r
+ cvar_set("r_glsl_postprocess_uservec2_enable", ftos(cvar("hud_powerup") != 0));\r
+\r
+ // lets apply the postprocess effects from the previous two functions if needed\r
+ if((damage_blurpostprocess_x || content_blurpostprocess_x) && cvar("chase_active") >= 0) // not while the event chase camera is active\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
+ if(blurradius != old_blurradius || bluralpha != old_bluralpha) // reduce cvar_set spam as much as possible\r
+ {\r
+ cvar_set("r_glsl_postprocess_uservec1", strcat(ftos(blurradius), " ", ftos(bluralpha), " 0 0"));\r
+ old_blurradius = blurradius;\r
+ old_bluralpha = bluralpha;\r
+ }\r
+ }\r
+ else if(cvar_string("r_glsl_postprocess_uservec1") != "0 0 0 0") // reduce cvar_set spam as much as possible\r
+ {\r
+ cvar_set("r_glsl_postprocess_uservec1", "0 0 0 0");\r
+ old_blurradius = 0;\r
+ old_bluralpha = 0;\r
+ }\r
+\r
+ float sharpen_intensity;\r
+ if (getstatf(STAT_STRENGTH_FINISHED) - time > 0)\r
+ sharpen_intensity += (getstatf(STAT_STRENGTH_FINISHED) - time);\r
+ if (getstatf(STAT_INVINCIBLE_FINISHED) - time > 0)\r
+ sharpen_intensity += (getstatf(STAT_INVINCIBLE_FINISHED) - time);\r
+\r
+ if(cvar("hud_powerup") && sharpen_intensity > 0 && cvar("chase_active") >= 0) // not while the event chase camera is active\r
+ {\r
+ sharpen_intensity = bound(0, sharpen_intensity, 5); // powerup warning time is 5 seconds, so fade the effect from there\r
+\r
+ if(sharpen_intensity != old_sharpen_intensity) // reduce cvar_set spam as much as possible\r
+ {\r
+ cvar_set("r_glsl_postprocess_uservec2", strcat("0 ", ftos(-sharpen_intensity * cvar("hud_powerup")), " 0 0"));\r
+ old_sharpen_intensity = sharpen_intensity;\r
+ }\r
+ }\r
+ else if(cvar_string("r_glsl_postprocess_uservec2") != "0 0 0 0") // reduce cvar_set spam as much as possible\r
+ {\r
+ cvar_set("r_glsl_postprocess_uservec2", "0 0 0 0");\r
+ old_sharpen_intensity = 0;\r
+ }\r
+ }\r
+\r
+ if(cvar("hud_postprocessing") && !cvar("hud_postprocessing_maxbluralpha"))\r
+ if(cvar("r_glsl_postprocess_uservec1_enable"))\r
+ {\r
+ // don't allow blur to get stuck on if we disable the cvar while damaged\r
+ cvar_set("r_glsl_postprocess_uservec1", "0 0 0 0");\r
+ cvar_set("r_glsl_postprocess_uservec1_enable", "0");\r
+ }\r
+ if(cvar("hud_postprocessing") && !cvar("hud_powerup"))\r
+ if(cvar("r_glsl_postprocess_uservec2_enable"))\r
+ {\r
+ // don't allow sharpen to get stuck on if we disable the cvar while powered up\r
+ cvar_set("r_glsl_postprocess_uservec2", "0 0 0 0");\r
+ cvar_set("r_glsl_postprocess_uservec2_enable", "0");\r
+ }\r
+\r
+ if(cvar("hud_postprocessing"))\r
+ {\r
+ // change saturation based on the amount of armor we have\r
+ // ranges between 0.5 and 1 saturation, over 0 armor and half the armor limit\r
+\r
+ if(cvar("hud_saturation") && armor_max && spectatee_status != -1 && getstati(STAT_HEALTH) > 0)\r
+ {\r
+ float saturation;\r
+ saturation = 0.5 + (getstati(STAT_ARMOR) / armor_max);\r
+ saturation = bound(0, saturation, 1);\r
+\r
+ if(cvar("r_glsl_saturation") != saturation)\r
+ cvar_set("r_glsl_saturation", ftos(saturation));\r
+ }\r
+ else if(cvar("r_glsl_saturation") != 1)\r
+ cvar_set("r_glsl_saturation", "1");\r
+ }\r
+\r
+ // volume cutting\r
+ if(cvar("cl_vore_cutvolume_sound") < 1 || cvar("cl_vore_cutvolume_music") < 1)\r
+ {\r
+ float volume_modify_1_target, volume_modify_2_target, volume_modify_fade;\r
+\r
+ if(volume_modify_changed_1 != cvar("menu_volume") || volume_modify_changed_2 != cvar("menu_bgmvolume"))\r
+ {\r
+ // An ugly hack to allow the cutvolume feature to work with the menu audio sliders.\r
+ // Without it, adjusting the music or master sound sliders while fading that volume would have bad results.\r
+ // This needs to be done in a better way! Currently, changing the volume sliders will just reset the fading.\r
+\r
+ volume_modify_default_1 = cvar("menu_volume");\r
+ volume_modify_default_2 = cvar("menu_bgmvolume");\r
+\r
+ volume_modify_changed_1 = cvar("menu_volume");\r
+ volume_modify_changed_2 = cvar("menu_bgmvolume");\r
+ }\r
+ else\r
+ {\r
+ if(spectatee_status == -1 || intermission)\r
+ {\r
+ volume_modify_1_target = volume_modify_default_1;\r
+ volume_modify_2_target = volume_modify_default_2;\r
+ }\r
+ else if(getstati(STAT_VORE_EATEN))\r
+ {\r
+ volume_modify_1_target = volume_modify_default_1 * cvar("cl_vore_cutvolume_sound");\r
+ volume_modify_2_target = volume_modify_default_2 * cvar("cl_vore_cutvolume_music");\r
+ }\r
+ else\r
+ {\r
+ volume_modify_1_target = volume_modify_default_1;\r
+ volume_modify_2_target = volume_modify_default_2;\r
+ }\r
+ volume_modify_fade = cvar("cl_vore_cutvolume_fade") * frametime;\r
+\r
+ if(volume_modify_1 != volume_modify_1_target || volume_modify_2 != volume_modify_2_target)\r
+ {\r
+ if (volume_modify_1 > volume_modify_1_target + volume_modify_fade)\r
+ volume_modify_1 -= volume_modify_fade;\r
+ else if (volume_modify_1 < volume_modify_1_target - volume_modify_fade)\r
+ volume_modify_1 += volume_modify_fade;\r
+ else\r
+ volume_modify_1 = volume_modify_1_target;\r
+\r
+ if (volume_modify_2 > volume_modify_2_target + volume_modify_fade)\r
+ volume_modify_2 -= volume_modify_fade;\r
+ else if (volume_modify_2 < volume_modify_2_target - volume_modify_fade)\r
+ volume_modify_2 += volume_modify_fade;\r
+ else\r
+ volume_modify_2 = volume_modify_2_target;\r
+\r
+ cvar_set("volume", ftos(volume_modify_1));\r
+ cvar_set("bgmvolume", ftos(volume_modify_2));\r
+ // TODO: Setting the "volume" cvar is a bad way to go, and modifies the menu slider! We need a better way\r
+ }\r
+ }\r