X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fclient%2FView.qc;h=a0233e5eaab36e5095eefb3f530eab631f81db41;hb=05e03a14f0959732567abc9a6dc9032b4f0a06e0;hp=8087d6f8da818ebf5e05432f7facd64eae40c8b9;hpb=5b3eab87a3606cbaccfed97870a1e8041afebbb8;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/client/View.qc b/qcsrc/client/View.qc index 8087d6f8d..a0233e5ea 100644 --- a/qcsrc/client/View.qc +++ b/qcsrc/client/View.qc @@ -104,7 +104,7 @@ vector GetCurrentFov(float fov) zoomfactor = 2.5; zoomspeed = autocvar_cl_zoomspeed; if(zoomspeed >= 0) - if(zoomspeed < 0.5 || zoomspeed > 16) + if(zoomspeed < 0.5 || zoomspeed > 16) zoomspeed = 3.5; zoomdir = button_zoom; @@ -123,13 +123,20 @@ vector GetCurrentFov(float fov) // fteqcc failed twice here already, don't optimize this } - if(zoomdir) - zoomin_effect = 0; + if(zoomdir) { zoomin_effect = 0; } - if(zoomin_effect || camera_active) + if(camera_active) { current_viewzoom = min(1, current_viewzoom + drawframetime); } + else if(autocvar_cl_spawnzoom && zoomin_effect) + { + float spawnzoomfactor = bound(1, autocvar_cl_spawnzoom_factor, 16); + + current_viewzoom += (autocvar_cl_spawnzoom_speed * (spawnzoomfactor - current_viewzoom) * drawframetime); + current_viewzoom = bound(1 / spawnzoomfactor, current_viewzoom, 1); + if(current_viewzoom == 1) { zoomin_effect = 0; } + } else { if(zoomspeed < 0) // instant zoom @@ -242,7 +249,7 @@ float EnemyHitCheck() if(teamplay) if(t == myteam) return SHOTTYPE_HITTEAM; - if(t == COLOR_SPECTATOR) + if(t == NUM_SPECTATOR) return SHOTTYPE_HITWORLD; return SHOTTYPE_HITENEMY; } @@ -368,11 +375,7 @@ vector myhealth_gentlergb; float contentavgalpha, liquidalpha_prev; vector liquidcolor_prev; -#define EVENTCHASE_UNSAVED -12345 float eventchase_current_distance; -var float eventchase_back_save = EVENTCHASE_UNSAVED; -var float eventchase_overhead_save = EVENTCHASE_UNSAVED; -var float eventchase_up_save = EVENTCHASE_UNSAVED; vector damage_blurpostprocess, content_blurpostprocess; @@ -454,21 +457,12 @@ void CSQC_UpdateView(float w, float h) if(spectatee_status >= 0 && (autocvar_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) + autocvar_sv_spectator_viewoffset); + vector current_view_origin = ((csqcplayer ? csqcplayer.origin : pmove_org) + autocvar_cl_eventchase_viewoffset); // 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 setproperty() - if(!autocvar_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) - - if(eventchase_back_save == EVENTCHASE_UNSAVED) { eventchase_back_save = cvar("chase_back"); } - if(eventchase_overhead_save == EVENTCHASE_UNSAVED) { eventchase_overhead_save = cvar("chase_overhead"); } - if(eventchase_up_save == EVENTCHASE_UNSAVED) { eventchase_up_save = cvar("chase_up"); } - cvar_set("chase_back", "0"); // don't let chase adjust the camera - cvar_set("chase_overhead", "0"); // no overhead view either - cvar_set("chase_up", "0"); // don't let chase adjust the camera - } + // -1 enables chase_active while marking it as set by this code, and not by the user (which would be 1) + if(!autocvar_chase_active) { cvar_set("chase_active", "-1"); } // make the camera smooth back if(autocvar_cl_eventchase_speed && eventchase_current_distance < autocvar_cl_eventchase_distance) @@ -479,21 +473,23 @@ void CSQC_UpdateView(float w, float h) makevectors(view_angles); vector eventchase_target_origin = (current_view_origin - (v_forward * eventchase_current_distance)); - WarpZone_TraceBox(current_view_origin, autocvar_sv_spectator_mins, autocvar_sv_spectator_maxs, eventchase_target_origin, MOVE_WORLDONLY, self); - - setproperty(VF_ORIGIN, ((trace_startsolid) ? current_view_origin : trace_endpos)); + WarpZone_TraceBox(current_view_origin, autocvar_cl_eventchase_mins, autocvar_cl_eventchase_maxs, eventchase_target_origin, MOVE_WORLDONLY, self); + + // If the boxtrace fails, revert back to line tracing. + if(trace_startsolid) + { + eventchase_target_origin = (current_view_origin - (v_forward * eventchase_current_distance)); + WarpZone_TraceLine(current_view_origin, eventchase_target_origin, MOVE_WORLDONLY, self); + setproperty(VF_ORIGIN, (trace_endpos - (v_forward * autocvar_cl_eventchase_mins_z))); + } + else { setproperty(VF_ORIGIN, trace_endpos); } + setproperty(VF_ANGLES, WarpZone_TransformVAngles(WarpZone_trace_transform, view_angles)); } else if(autocvar_chase_active < 0) // time to disable chase_active if it was set by this code { cvar_set("chase_active", "0"); - cvar_set("chase_back", ftos(eventchase_back_save)); - cvar_set("chase_overhead", ftos(eventchase_overhead_save)); - cvar_set("chase_up", ftos(eventchase_up_save)); eventchase_current_distance = 0; // start from 0 next time - eventchase_back_save = EVENTCHASE_UNSAVED; - eventchase_overhead_save = EVENTCHASE_UNSAVED; - eventchase_up_save = EVENTCHASE_UNSAVED; } } // workaround for camera stuck between player's legs when using chase_active 1 @@ -866,8 +862,8 @@ void CSQC_UpdateView(float w, float h) } } } - - if(autocvar_hud_damage) + + if(autocvar_hud_damage && !getstati(STAT_FROZEN)) { splash_size_x = max(vid_conwidth, vid_conheight); splash_size_y = max(vid_conwidth, vid_conheight); @@ -919,25 +915,22 @@ void CSQC_UpdateView(float w, float h) // pro: matches model better // contra: it's not red because blood is red, but because red is an alarming color, so red should stay // maybe different reddish pics? - if(autocvar_chase_active >= 0) // not while the event chase camera is active + if(autocvar_cl_gentle_damage || autocvar_cl_gentle) { - if(autocvar_cl_gentle_damage || autocvar_cl_gentle) + if(autocvar_cl_gentle_damage == 2) { - if(autocvar_cl_gentle_damage == 2) + if(myhealth_flash < pain_threshold) // only randomize when the flash is gone { - if(myhealth_flash < pain_threshold) // only randomize when the flash is gone - { - myhealth_gentlergb = eX * random() + eY * random() + eZ * random(); - } + myhealth_gentlergb = eX * random() + eY * random() + eZ * random(); } - else - myhealth_gentlergb = stov(autocvar_hud_damage_gentle_color); - - drawfill('0 0 0', eX * vid_conwidth + eY * vid_conheight, myhealth_gentlergb, autocvar_hud_damage_gentle_alpha_multiplier * bound(0, myhealth_flash_temp, 1) * autocvar_hud_damage, DRAWFLAG_NORMAL); } else - drawpic(splash_pos, "gfx/blood", splash_size, stov(autocvar_hud_damage_color), bound(0, myhealth_flash_temp, 1) * autocvar_hud_damage, DRAWFLAG_NORMAL); + myhealth_gentlergb = stov(autocvar_hud_damage_gentle_color); + + drawfill('0 0 0', eX * vid_conwidth + eY * vid_conheight, myhealth_gentlergb, autocvar_hud_damage_gentle_alpha_multiplier * bound(0, myhealth_flash_temp, 1) * autocvar_hud_damage, DRAWFLAG_NORMAL); } + else + drawpic(splash_pos, "gfx/blood", splash_size, stov(autocvar_hud_damage_color), bound(0, myhealth_flash_temp, 1) * autocvar_hud_damage, DRAWFLAG_NORMAL); if(autocvar_hud_postprocessing) // we still need to set this anyway even when chase_active is set, this way it doesn't get stuck on. { @@ -965,7 +958,7 @@ void CSQC_UpdateView(float w, float h) if(cvar("r_glsl_postprocess_uservec2_enable") != e2) { cvar_set("r_glsl_postprocess_uservec2_enable", ftos(e2)); } // blur postprocess handling done first (used by hud_damage and hud_contents) - if((damage_blurpostprocess_x || content_blurpostprocess_x) && autocvar_chase_active >= 0) // not while the event chase camera is active + if((damage_blurpostprocess_x || content_blurpostprocess_x)) { float blurradius = bound(0, damage_blurpostprocess_y + content_blurpostprocess_y, autocvar_hud_postprocessing_maxblurradius); float bluralpha = bound(0, damage_blurpostprocess_z + content_blurpostprocess_z, autocvar_hud_postprocessing_maxbluralpha); @@ -990,7 +983,7 @@ void CSQC_UpdateView(float w, float h) sharpen_intensity = bound(0, ((getstati(STAT_HEALTH) > 0) ? sharpen_intensity : 0), 5); // Check to see if player is alive (if not, set 0) - also bound to fade out starting at 5 seconds. - if(autocvar_hud_powerup && sharpen_intensity > 0 && autocvar_chase_active >= 0) // not while the event chase camera is active + if(autocvar_hud_powerup && sharpen_intensity > 0) { if(sharpen_intensity != old_sharpen_intensity) // reduce cvar_set spam as much as possible { @@ -1054,7 +1047,7 @@ void CSQC_UpdateView(float w, float h) if(getstatf(STAT_REVIVE_PROGRESS)) { DrawCircleClippedPic(eX * 0.5 * vid_conwidth + eY * 0.6 * vid_conheight, 0.1 * vid_conheight, "gfx/crosshair_ring.tga", getstatf(STAT_REVIVE_PROGRESS), '0.25 0.90 1', autocvar_hud_colorflash_alpha, DRAWFLAG_ADDITIVE); - drawstring_aspect(eY * 0.64 * vid_conheight, "Revival progress", eX * vid_conwidth + eY * 0.025 * vid_conheight, '1 1 1', 1, DRAWFLAG_NORMAL); + drawstring_aspect(eY * 0.64 * vid_conheight, _("Revival progress"), eX * vid_conwidth + eY * 0.025 * vid_conheight, '1 1 1', 1, DRAWFLAG_NORMAL); } } @@ -1512,25 +1505,8 @@ void CSQC_UpdateView(float w, float h) void CSQC_common_hud(void) { - // do some accuracy var caching - float i; - if(!(gametype == MAPINFO_TYPE_RACE || gametype == MAPINFO_TYPE_CTS)) - { - if(autocvar_accuracy_color_levels != acc_color_levels) - { - if(acc_color_levels) - strunzone(acc_color_levels); - acc_color_levels = strzone(autocvar_accuracy_color_levels); - acc_levels = tokenize_console(acc_color_levels); - if (acc_levels > MAX_ACCURACY_LEVELS) - acc_levels = MAX_ACCURACY_LEVELS; - - for (i = 0; i < acc_levels; ++i) - acc_lev[i] = stof(argv(i)) / 100.0; - } - // let know that acc_col[] needs to be loaded - acc_col[0] = '-1 0 0'; - } + if(!(gametype == MAPINFO_TYPE_RACE || gametype == MAPINFO_TYPE_CTS)) + Accuracy_LoadLevels(); HUD_Main(); // always run these functions for alpha checks HUD_DrawScoreboard();