X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fclient%2FView.qc;h=857cdab4a087f41c330d83ac7259d859db4193e0;hb=543d3ac5df6159c81c69829c2837a1dc1bf67f5f;hp=556859a466ed66828f27fb6c72229b2653dd8126;hpb=4b15b999e2716d2ddc35075f75910b330a6cbf5c;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/client/View.qc b/qcsrc/client/View.qc index 556859a46..857cdab4a 100644 --- a/qcsrc/client/View.qc +++ b/qcsrc/client/View.qc @@ -12,6 +12,8 @@ void Porto_Draw() if(activeweapon != WEP_PORTO || spectatee_status || gametype == MAPINFO_TYPE_NEXBALL) return; + if(g_balance_porto_secondary) + return; if(intermission == 1) return; if(intermission == 2) @@ -55,9 +57,11 @@ void Porto_Draw() if(!CheckWireframeBox(porto, p - 48 * v_right - 48 * v_up + 16 * v_forward, 96 * v_right, 96 * v_up, 96 * v_forward)) return; if(portal_number == 1) + { portal1_idx = idx; - if(portal_number >= 2) - break; + if(portal_number >= 2) + break; + } } while(idx >= 2) @@ -92,6 +96,7 @@ vector GetCurrentFov(float fov) { float zoomsensitivity, zoomspeed, zoomfactor, zoomdir; float velocityzoom, curspeed; + vector v; zoomsensitivity = autocvar_cl_zoomsensitivity; zoomfactor = autocvar_cl_zoomfactor; @@ -157,13 +162,17 @@ vector GetCurrentFov(float fov) makevectors(view_angles); - if(autocvar_cl_velocityzoom) + if(autocvar_cl_velocityzoom && autocvar_cl_velocityzoom_type) // _type = 0 disables velocity zoom too { + v = pmove_vel; + if(csqcplayer) + v = csqcplayer.velocity; + switch(autocvar_cl_velocityzoom_type) { - case 3: curspeed = max(0, v_forward * pmove_vel); break; - case 2: curspeed = (v_forward * pmove_vel); break; - case 1: default: curspeed = vlen(pmove_vel); break; + case 3: curspeed = max(0, v_forward * v); break; + case 2: curspeed = (v_forward * v); break; + case 1: default: curspeed = vlen(v); break; } velocityzoom = bound(0, drawframetime / max(0.000000001, autocvar_cl_velocityzoom_time), 1); // speed at which the zoom adapts to player velocity @@ -218,14 +227,18 @@ void TrueAim_Init() float EnemyHitCheck() { - float t; + float t, n; wcross_origin = project_3d_to_2d(trace_endpos); wcross_origin_z = 0; - if(trace_networkentity < 1) + if(trace_ent) + n = trace_ent.entnum; + else + n = trace_networkentity; + if(n < 1) return SHOTTYPE_HITWORLD; - if(trace_networkentity > maxclients) + if(n > maxclients) return SHOTTYPE_HITWORLD; - t = GetPlayerColor(trace_networkentity - 1); + t = GetPlayerColor(n - 1); if(teamplay) if(t == myteam) return SHOTTYPE_HITTEAM; @@ -363,6 +376,7 @@ float checkfail[16]; #define BUTTON_3 4 #define BUTTON_4 8 +float cl_notice_run(); void CSQC_UpdateView(float w, float h) { entity e; @@ -372,6 +386,10 @@ void CSQC_UpdateView(float w, float h) vector vf_size, vf_min; float a; + execute_next_frame(); + + ++framecount; + hud = getstati(STAT_HUD); if(checkextension("DP_CSQC_MINFPS_QUALITY")) @@ -426,7 +444,7 @@ void CSQC_UpdateView(float w, float h) { // 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 setproperty() if(!autocvar_chase_active) @@ -457,9 +475,16 @@ void CSQC_UpdateView(float w, float h) eventchase_current_distance = 0; // start from 0 next time } } - + // workaround for camera stuck between player's legs when using chase_active 1 + // because the engine stops updating the chase_active camera when the game ends + else if(intermission) + { + cvar_settemp("chase_active", "-1"); + eventchase_current_distance = 0; + } + // do lockview after event chase camera so that it still applies whenever necessary. - if(autocvar_cl_lockview || (autocvar__hud_configure && spectatee_status <= 0) || intermission > 1) + if(autocvar_cl_lockview || (!autocvar_hud_cursormode && (autocvar__hud_configure && spectatee_status <= 0 || intermission > 1))) { setproperty(VF_ORIGIN, freeze_org); setproperty(VF_ANGLES, freeze_ang); @@ -523,8 +548,8 @@ void CSQC_UpdateView(float w, float h) calledhooks |= HOOK_END; } } - - Announcer(); + + Announcer(); fov = autocvar_fov; if(fov <= 59.5) @@ -911,12 +936,14 @@ void CSQC_UpdateView(float w, float h) } } - if(autocvar_hud_postprocessing) // TODO: Remove this code and re-do the postprocess handling in the engine, where it properly belongs. + float e1 = (autocvar_hud_postprocessing_maxbluralpha != 0); + float e2 = (autocvar_hud_powerup != 0); + if(autocvar_hud_postprocessing && (e1 || e2)) // TODO: Remove this code and re-do the postprocess handling in the engine, where it properly belongs. { // enable or disable rendering types if they are used or not - if(cvar("r_glsl_postprocess_uservec1_enable") != (autocvar_hud_postprocessing_maxbluralpha != 0)) { cvar_set("r_glsl_postprocess_uservec1_enable", ftos(autocvar_hud_postprocessing_maxbluralpha != 0)); } - if(cvar("r_glsl_postprocess_uservec2_enable") != (autocvar_hud_powerup != 0)) { cvar_set("r_glsl_postprocess_uservec2_enable", ftos(autocvar_hud_powerup != 0)); } - + if(cvar("r_glsl_postprocess_uservec1_enable") != e1) { cvar_set("r_glsl_postprocess_uservec1_enable", ftos(e1)); } + 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 { @@ -937,7 +964,7 @@ void CSQC_UpdateView(float w, float h) } // edge detection postprocess handling done second (used by hud_powerup) - float sharpen_intensity, strength_finished = getstatf(STAT_STRENGTH_FINISHED), invincible_finished = getstatf(STAT_INVINCIBLE_FINISHED); + float sharpen_intensity = 0, strength_finished = getstatf(STAT_STRENGTH_FINISHED), invincible_finished = getstatf(STAT_INVINCIBLE_FINISHED); if (strength_finished - time > 0) { sharpen_intensity += (strength_finished - time); } if (invincible_finished - time > 0) { sharpen_intensity += (invincible_finished - time); } @@ -956,7 +983,12 @@ void CSQC_UpdateView(float w, float h) cvar_set("r_glsl_postprocess_uservec2", "0 0 0 0"); old_sharpen_intensity = 0; } + + if(cvar("r_glsl_postprocess") == 0) + cvar_set("r_glsl_postprocess", "2"); } + else if(cvar("r_glsl_postprocess") == 2) + cvar_set("r_glsl_postprocess", "0"); if(menu_visible) menu_show(); @@ -1011,7 +1043,11 @@ void CSQC_UpdateView(float w, float h) CSQC_common_hud(); // crosshair goes VERY LAST - if(!scoreboard_active && !camera_active && intermission != 2 && spectatee_status != -1 && hud == HUD_NORMAL) { + if(!scoreboard_active && !camera_active && intermission != 2 && spectatee_status != -1 && hud == HUD_NORMAL) + { + if not(autocvar_crosshair_enabled) // main toggle for crosshair rendering + return; + string wcross_style; float wcross_alpha, wcross_resolution; wcross_style = autocvar_crosshair; @@ -1050,7 +1086,7 @@ void CSQC_UpdateView(float w, float h) shottype = SHOTTYPE_HITWORLD; vector wcross_color, wcross_size; - string wcross_wep, wcross_name; + string wcross_wep = "", wcross_name; float wcross_scale, wcross_blur; if (autocvar_crosshair_per_weapon || autocvar_crosshair_color_per_weapon) { @@ -1156,7 +1192,8 @@ void CSQC_UpdateView(float w, float h) if(autocvar_crosshair_hitindication) { - vector hitindication_color = stov(autocvar_crosshair_hitindication_color); + vector hitindication_color = ((autocvar_crosshair_color_per_weapon) ? stov(autocvar_crosshair_hitindication_per_weapon_color) : stov(autocvar_crosshair_hitindication_color)); + if(hitindication_crosshair_time < hit_time) { if(time - hit_time < MAX_TIME_DIFF) // don't trigger the animation if it's too old @@ -1237,9 +1274,9 @@ void CSQC_UpdateView(float w, float h) if (autocvar_crosshair_ring || autocvar_crosshair_ring_reload) { // declarations and stats - float ring_value, ring_scale, ring_alpha, ring_inner_value, ring_inner_alpha; - string ring_image, ring_inner_image; - vector ring_rgb, ring_inner_rgb; + float ring_value = 0, ring_scale = 0, ring_alpha = 0, ring_inner_value = 0, ring_inner_alpha = 0; + string ring_image = string_null, ring_inner_image = string_null; + vector ring_rgb = '0 0 0', ring_inner_rgb = '0 0 0'; ring_scale = autocvar_crosshair_ring_size; @@ -1363,10 +1400,12 @@ void CSQC_UpdateView(float w, float h) { vector wcross_color_old; wcross_color_old = wcross_color; - if(autocvar_crosshair_dot_color != "0") + + if((autocvar_crosshair_dot_color_custom) && (autocvar_crosshair_dot_color != "0")) wcross_color = stov(autocvar_crosshair_dot_color); + CROSSHAIR_DRAW(wcross_resolution * autocvar_crosshair_dot_size, "gfx/crosshairdot.tga", f * autocvar_crosshair_dot_alpha); - // FIXME why don't we use wcross_alpha here? + // FIXME why don't we use wcross_alpha here?cl_notice_run(); wcross_color = wcross_color_old; } } @@ -1439,7 +1478,12 @@ void CSQC_UpdateView(float w, float h) CSQC_RAPTOR_HUD(); else if(hud == HUD_BUMBLEBEE) CSQC_BUMBLE_HUD(); + else if(hud == HUD_BUMBLEBEE_GUN) + CSQC_BUMBLE_GUN_HUD(); } + + cl_notice_run(); + // let's reset the view back to normal for the end setproperty(VF_MIN, '0 0 0'); setproperty(VF_SIZE, '1 0 0' * w + '0 1 0' * h); @@ -1465,7 +1509,7 @@ void CSQC_common_hud(void) acc_lev[i] = stof(argv(i)) / 100.0; } // let know that acc_col[] needs to be loaded - acc_col_x[0] = -1; + acc_col[0] = '-1 0 0'; } HUD_Main(); // always run these functions for alpha checks