X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=data%2Fqcsrc%2Fclient%2FView.qc;h=dec78f340977807bb2b6b4bff61e974d3e9a1a89;hb=62afadfb6e4a7553a48932fde2e5eb7f327c4b1c;hp=f221da7f3a246f657735ce48951248efb806223d;hpb=d211bc46739c34ed3ca4a83828fd387d55439d2a;p=voretournament%2Fvoretournament.git diff --git a/data/qcsrc/client/View.qc b/data/qcsrc/client/View.qc index f221da7f..dec78f34 100644 --- a/data/qcsrc/client/View.qc +++ b/data/qcsrc/client/View.qc @@ -255,7 +255,9 @@ float artwork_fade; float pickup_crosshair_time, pickup_crosshair_size; float myhealth, myhealth_prev, myhealth_flash; float contentavgalpha, liquidalpha_prev; -float stomachsplash_alpha; +float stomachsplash_alpha, stomachsplash_remove_at_respawn; +float volume_modify_1, volume_modify_2, volume_modify_default_1, volume_modify_default_2; +float volume_modify_changed_1, volume_modify_changed_2; vector myhealth_gentlergb; vector liquidcolor_prev; vector damage_blurpostprocess, content_blurpostprocess; @@ -268,6 +270,7 @@ void CSQC_UpdateView(float w, float h) float fov; float f, i, j; vector v, vo; + float a; vector artwork_pos, artwork_size; @@ -457,6 +460,7 @@ void CSQC_UpdateView(float w, float h) // next R_RenderScene call drawstring('0 0 0', "", '1 1 0', '1 1 1', 0, 0); + // screen effects if(cvar("hud_contents")) { float contentalpha_temp, incontent, liquidalpha, contentfadetime; @@ -512,6 +516,31 @@ void CSQC_UpdateView(float w, float h) if(contentavgalpha) drawfill('0 0 0', '1 0 0' * vid_conwidth + '0 1 0' * vid_conheight, liquidcolor_prev, contentavgalpha * liquidalpha_prev, DRAWFLAG_NORMAL); + + if(cvar("hud_postprocessing")) + { + if(cvar("hud_contents_liquid_blur")) + { + // when inside the stomach, we use different blur settings than when we're inside other fluids + content_blurpostprocess_x = 1; + if(getstati(STAT_VORE_EATEN)) + { + content_blurpostprocess_y = contentavgalpha * cvar("hud_contents_stomach_blur"); + content_blurpostprocess_z = contentavgalpha * cvar("hud_contents_stomach_blur_alpha"); + } + else + { + content_blurpostprocess_y = contentavgalpha * cvar("hud_contents_liquid_blur"); + content_blurpostprocess_z = contentavgalpha * cvar("hud_contents_liquid_blur_alpha"); + } + } + else + { + content_blurpostprocess_x = 0; + content_blurpostprocess_y = 0; + content_blurpostprocess_z = 0; + } + } } if(cvar("hud_damage")) @@ -600,19 +629,28 @@ void CSQC_UpdateView(float w, float h) else stomachsplash_alpha = cvar("hud_stomach"); } - else + else if(getstati(STAT_HEALTH) > 0) { if(stomachsplash_alpha > 0) stomachsplash_alpha -= cvar("hud_stomach_fade_out") * frametime; else stomachsplash_alpha = 0; } + if(getstati(STAT_HEALTH) <= 0) + stomachsplash_remove_at_respawn = 1; // schedule the effect to be removed next respawn + + if(getstati(STAT_HEALTH) > 0 && stomachsplash_remove_at_respawn) + stomachsplash_alpha = stomachsplash_remove_at_respawn = 0; // we respawned, remove the effect + if(spectatee_status == -1) + stomachsplash_alpha = 0; + stomachsplash_alpha = bound(0, stomachsplash_alpha, 1); drawpic('0 0 0', "gfx/food", '1 0 0' * vid_conwidth + '0 1 0' * vid_conheight, stov(cvar_string("hud_stomach_color")), stomachsplash_alpha, DRAWFLAG_NORMAL); } if(cvar("hud_postprocessing")) - { // lets apply the postprocess effects from the previous two functions if needed + { + // lets apply the postprocess effects from the previous two functions if needed if(damage_blurpostprocess_x || content_blurpostprocess_x) { float blurradius = bound(0, damage_blurpostprocess_y + content_blurpostprocess_y, cvar("hud_postprocessing_maxblurradius")); @@ -625,6 +663,99 @@ 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_powerup")) + { + 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 fade the effect from there + + if(sharpen_intensity > 0) + { + cvar_set("r_glsl_postprocess_uservec2", strcat("0 ", ftos(-sharpen_intensity * cvar("hud_powerup")), " 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")) + { + // don't allow blur to get stuck on if we disable the cvar while damaged + cvar_set("r_glsl_postprocess_uservec1", "0 0 0 0"); + cvar_set("r_glsl_postprocess_uservec1_enable", "0"); + } + if not(cvar("hud_powerup") && 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"); + } + + // volume cutting + if(cvar("cl_vore_cutvolume_sound") < 1 || cvar("cl_vore_cutvolume_music") < 1) + { + float volume_modify_1_target, volume_modify_2_target, volume_modify_fade; + + if(volume_modify_changed_1 != cvar("menu_volume") || volume_modify_changed_2 != cvar("menu_bgmvolume")) + { + // An ugly hack to allow the cutvolume feature to work with the menu audio sliders. + // Without it, adjusting the music or master sound sliders while fading that volume would have bad results. + // This needs to be done in a better way! Currently, changing the volume sliders will just reset the fading. + + volume_modify_default_1 = cvar("menu_volume"); + volume_modify_default_2 = cvar("menu_bgmvolume"); + + volume_modify_changed_1 = cvar("menu_volume"); + volume_modify_changed_2 = cvar("menu_bgmvolume"); + } + else + { + if(spectatee_status == -1 || intermission) + { + volume_modify_1_target = volume_modify_default_1; + volume_modify_2_target = volume_modify_default_2; + } + else if(getstati(STAT_VORE_EATEN)) + { + volume_modify_1_target = volume_modify_default_1 * cvar("cl_vore_cutvolume_sound"); + volume_modify_2_target = volume_modify_default_2 * cvar("cl_vore_cutvolume_music"); + } + else + { + volume_modify_1_target = volume_modify_default_1; + volume_modify_2_target = volume_modify_default_2; + } + volume_modify_fade = cvar("cl_vore_cutvolume_fade") * frametime; + + if(volume_modify_1 != volume_modify_1_target || volume_modify_2 != volume_modify_2_target) + { + if (volume_modify_1 > volume_modify_1_target + volume_modify_fade) + volume_modify_1 -= volume_modify_fade; + else if (volume_modify_1 < volume_modify_1_target - volume_modify_fade) + volume_modify_1 += volume_modify_fade; + else + volume_modify_1 = volume_modify_1_target; + + if (volume_modify_2 > volume_modify_2_target + volume_modify_fade) + volume_modify_2 -= volume_modify_fade; + else if (volume_modify_2 < volume_modify_2_target - volume_modify_fade) + volume_modify_2 += volume_modify_fade; + else + volume_modify_2 = volume_modify_2_target; + + cvar_set("volume", ftos(volume_modify_1)); + cvar_set("bgmvolume", ftos(volume_modify_2)); + // TODO: Setting the "volume" cvar is a bad way to go, and modifies the menu slider! We need a better way + } + } } // Draw the mouse cursor @@ -796,6 +927,8 @@ void CSQC_UpdateView(float w, float h) else shottype = SHOTTYPE_HITWORLD; + float weapon_clipload, weapon_clipsize, ring_scale; + string wcross_style; wcross_style = cvar_string("crosshair"); @@ -927,6 +1060,17 @@ void CSQC_UpdateView(float w, float h) wcross_size = drawgetimagesize(wcross_name) * wcross_scale; CROSSHAIR_DRAW(wcross_resolution, wcross_name, wcross_alpha * f); wcross_name_alpha_goal_prev = f; + + // ring around crosshair representing bullets left in weapon clip + weapon_clipload = getstati(STAT_WEAPON_CLIPLOAD); + a = cvar("crosshair_ring_alpha"); + if (weapon_clipload && a) + { + weapon_clipsize = getstati(STAT_WEAPON_CLIPSIZE); + ring_scale = cvar("crosshair_ring_size"); + f = bound(0, weapon_clipload / weapon_clipsize, 1); + DrawCircleClippedPic(wcross_origin, wcross_size_x * ring_scale, "gfx/crosshair_ring.tga", f, wcross_color, wcross_alpha * a, DRAWFLAG_ADDITIVE); + } } } else