X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=data%2Fqcsrc%2Fclient%2FView.qc;h=33a38f082ab1ae4af581f2da597405c785bb1a3e;hb=fab7536add6809d5a70fe1f49f975a4407749f56;hp=2635eaca378644a36b2da90365a59bf8630ff890;hpb=8c00456babd258e44afe9f1e0512b8ae6260fb7e;p=voretournament%2Fvoretournament.git diff --git a/data/qcsrc/client/View.qc b/data/qcsrc/client/View.qc index 2635eaca..33a38f08 100644 --- a/data/qcsrc/client/View.qc +++ b/data/qcsrc/client/View.qc @@ -244,7 +244,6 @@ void PostInit(void); void CSQC_Demo_Camera(); float Sbar_WouldDrawScoreboard (); float last_health, last_spectatee; -float view_set; float camera_mode; float reticle_type; float chase_active_old; @@ -253,12 +252,11 @@ float pickup_crosshair_time, pickup_crosshair_size, pickup_flash_time, vore_flas float spawnfov_current; float myhealth, myhealth_prev, myhealth_flash; float contentavgalpha, liquidalpha_prev; -float old_blurradius, old_bluralpha, old_sharpen_intensity; +float old_blurradius, old_bluralpha, old_cartoon_intensity; float stomachsplash_alpha; -float volume_modify_1, volume_modify_2, volume_modify_default_1, volume_modify_default_2; -float volume_modify_changed_1, volume_modify_changed_2; float eventchase_current_distance; float helper_pause, helper_health, helper_armor, helper_ammo, helper_speed, helper_stomachload; +vector freeze_org, freeze_ang; vector myhealth_gentlergb; vector liquidcolor_prev; vector damage_blurpostprocess, content_blurpostprocess; @@ -383,10 +381,13 @@ void CSQC_UpdateView(float w, float h) // event chase camera if(cvar("chase_active") <= 0) // greater than 0 means it's enabled manually, and this code is skipped { - if(!getstati(STAT_VORE_EATEN) && spectatee_status >= 0 && (cvar("cl_eventchase_death") && getstati(STAT_HEALTH) <= 0 && !intermission)) + if(spectatee_status >= 0 && (cvar("cl_eventchase_death") && getstati(STAT_HEALTH) <= 0 && !intermission) || intermission) { + // make special vector since we can't use view_origin (It is one frame old as of this code, it gets set later with the results this code makes.) + vector current_view_origin = getpropertyvec(VF_ORIGIN); + // We must enable chase_active to get a third person view (weapon viewmodel hidden and own player model showing). - // Ideally, there should be another way to enable third person cameras, such as through R_SetView() + // Ideally, there should be another way to enable third person cameras, such as through setproperty() if(!cvar("chase_active")) cvar_set("chase_active", "-1"); // -1 enables chase_active while marking it as set by this code, and not by the user (which would be 1) @@ -399,15 +400,15 @@ void CSQC_UpdateView(float w, float h) vector eventchase_target_origin; makevectors(view_angles); // pass 1, used to check where the camera would go and obtain the trace_fraction - eventchase_target_origin = pmove_org - v_forward * eventchase_current_distance; - - traceline(pmove_org, eventchase_target_origin, MOVE_WORLDONLY, self); + eventchase_target_origin = current_view_origin - v_forward * eventchase_current_distance; + WarpZone_TraceLine(current_view_origin, eventchase_target_origin, MOVE_WORLDONLY, self); // pass 2, also multiplying view_forward with trace_fraction, to prevent the camera from going through walls // The 0.1 subtraction is to not limit the camera precisely at the wall surface, as that allows the view to poke through - eventchase_target_origin = pmove_org - v_forward * eventchase_current_distance * (trace_fraction - 0.1); + eventchase_target_origin = current_view_origin - v_forward * eventchase_current_distance * (trace_fraction - 0.1); + WarpZone_TraceLine(current_view_origin, eventchase_target_origin, MOVE_WORLDONLY, self); - R_SetView(VF_ORIGIN, eventchase_target_origin); - R_SetView(VF_ANGLES, view_angles); + setproperty(VF_ORIGIN, trace_endpos); + setproperty(VF_ANGLES, WarpZone_TransformVAngles(WarpZone_trace_transform, view_angles)); } else if(cvar("chase_active") < 0) // time to disable chase_active if it was set by this code { @@ -446,18 +447,26 @@ void CSQC_UpdateView(float w, float h) cvar_set("v_idlescale", ftos(apply_idlescale)); } - // Render the Scene - if(!intermission || !view_set) + // do lockview after event chase camera so that it still applies whenever necessary. + if(intermission > 1) + { + setproperty(VF_ORIGIN, freeze_org); + setproperty(VF_ANGLES, freeze_ang); + } + else { - view_origin = pmove_org + vo; - view_angles = input_angles; - makevectors(view_angles); - view_forward = v_forward; - view_right = v_right; - view_up = v_up; - view_set = 1; + freeze_org = getpropertyvec(VF_ORIGIN); + freeze_ang = getpropertyvec(VF_ANGLES); } + // Render the Scene + view_origin = getpropertyvec(VF_ORIGIN); + view_angles = getpropertyvec(VF_ANGLES); + makevectors(view_angles); + view_forward = v_forward; + view_right = v_right; + view_up = v_up; + vid_width = w; vid_height = h; @@ -546,6 +555,12 @@ void CSQC_UpdateView(float w, float h) // ALWAYS Clear Current Scene First R_ClearScene(); + if(checkextension("DP_CSQC_ROTATEMOVES")) + { + setproperty(VF_ORIGIN, view_origin); + setproperty(VF_ANGLES, view_angles); + } + // Assign Standard Viewflags // Draw the World (and sky) R_SetView(VF_DRAWWORLD, 1); @@ -882,8 +897,8 @@ void CSQC_UpdateView(float w, float h) // enable or disable rendering types if they are used or not if(cvar("r_glsl_postprocess_uservec1_enable") != (cvar("hud_postprocessing_maxbluralpha") != 0)) cvar_set("r_glsl_postprocess_uservec1_enable", ftos(cvar("hud_postprocessing_maxbluralpha") != 0)); - if(cvar("r_glsl_postprocess_uservec2_enable") != (cvar("hud_powerup") != 0)) - cvar_set("r_glsl_postprocess_uservec2_enable", ftos(cvar("hud_powerup") != 0)); + if(cvar("r_glsl_postprocess_uservec2_enable") != (cvar("hud_cartoon") != 0)) + cvar_set("r_glsl_postprocess_uservec2_enable", ftos(cvar("hud_cartoon") != 0)); // lets apply the postprocess effects from the previous two functions if needed if((damage_blurpostprocess_x || content_blurpostprocess_x) && cvar("chase_active") >= 0) // not while the event chase camera is active @@ -904,26 +919,27 @@ void CSQC_UpdateView(float w, float h) old_bluralpha = 0; } - 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); - - if(cvar("hud_powerup") && sharpen_intensity > 0 && cvar("chase_active") >= 0) // not while the event chase camera is active + if(cvar("hud_cartoon")) { - sharpen_intensity = bound(0, sharpen_intensity, 5); // powerup warning time is 5 seconds, so fade the effect from there - - if(sharpen_intensity != old_sharpen_intensity) // reduce cvar_set spam as much as possible + // When having the strength or invincible powerups, cartoon lines will be white instead of black. + // As powerup time goes under 5 seconds (warning time), lines will fade from white to nothing then from nothing back to black. + float cartoon_intensity, cartoon_powerup; + cartoon_intensity = -cvar("hud_cartoon"); + cartoon_powerup = bound(0, getstatf(STAT_STRENGTH_FINISHED) - time, 5) + bound(0, getstatf(STAT_INVINCIBLE_FINISHED) - time, 5); + cartoon_powerup = bound(0, cartoon_powerup, 5); + if (cartoon_powerup && cvar("chase_active") >= 0) // not while the event chase camera is active + cartoon_intensity *= 1 - cartoon_powerup / 2.5; // cycle between -1 and 1 + + if(cartoon_intensity != old_cartoon_intensity) // reduce cvar_set spam as much as possible { - cvar_set("r_glsl_postprocess_uservec2", strcat("0 ", ftos(-sharpen_intensity * cvar("hud_powerup")), " 0 0")); - old_sharpen_intensity = sharpen_intensity; + cvar_set("r_glsl_postprocess_uservec2", strcat("0 ", ftos(cartoon_intensity), " ", cvar_string("hud_cartoon_tolerance"), " 0")); + old_cartoon_intensity = cartoon_intensity; } } else if(cvar_string("r_glsl_postprocess_uservec2") != "0 0 0 0") // reduce cvar_set spam as much as possible { cvar_set("r_glsl_postprocess_uservec2", "0 0 0 0"); - old_sharpen_intensity = 0; + old_cartoon_intensity = 0; } } @@ -934,7 +950,7 @@ 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") && !cvar("hud_powerup")) + if(cvar("hud_postprocessing") && !cvar("hud_cartoon")) if(cvar("r_glsl_postprocess_uservec2_enable")) { // don't allow sharpen to get stuck on if we disable the cvar while powered up @@ -960,63 +976,32 @@ void CSQC_UpdateView(float w, float h) cvar_set("r_glsl_saturation", "1"); } - // volume cutting - if(cvar("cl_vore_cutvolume_sound") < 1 || cvar("cl_vore_cutvolume_music") < 1) + float target_volume; + if(cvar("cl_vore_cutvolume_sound") && frametime) { - 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 - } - } + // sound volume cutting + target_volume = 0; + if(getstatf(STAT_VORE_PROGRESS_PREY)) + target_volume = getstatf(STAT_VORE_PROGRESS_PREY); + else if(getstati(STAT_VORE_EATEN)) + target_volume = 1; + target_volume = cvar("menu_volume") * (1 - target_volume * cvar("cl_vore_cutvolume_sound")); + + if(cvar("volume") != target_volume) // reduce cvar_set spam as much as possible + cvar_set("volume", ftos(target_volume)); + } + if(cvar("cl_vore_cutvolume_music") && frametime) + { + // music volume cutting + target_volume = 0; + if(getstatf(STAT_VORE_PROGRESS_PREY)) + target_volume = getstatf(STAT_VORE_PROGRESS_PREY); + else if(getstati(STAT_VORE_EATEN)) + target_volume = 1; + target_volume = cvar("menu_bgmvolume") * (1 - target_volume * cvar("cl_vore_cutvolume_music")); + + if(cvar("bgmvolume") != target_volume) // reduce cvar_set spam as much as possible + cvar_set("bgmvolume", ftos(target_volume)); } // Draw the mouse cursor