X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fclient%2Fview.qc;h=ff9b47cbcdaa97fb2c7d735bc96167d09b02298b;hp=42a8820e761be63bcfed9abec1676438434f4a72;hb=8e5d376c49510049572c7c182ba8778c8a8f80dd;hpb=52cdd440f6cfdc9544099ac68455e5361ace00d2 diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index 42a8820e7..ff9b47cbc 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -9,7 +9,7 @@ #include "hud/panel/scoreboard.qh" #include "hud/panel/quickmenu.qh" -#include "mutators/events.qh" +#include #include #include @@ -17,12 +17,13 @@ #include #include #include +#include #include #include #include #include #include -#include +#include #include #include @@ -30,8 +31,10 @@ #include #include +#include +#include #include -#include +#include #include #include @@ -45,6 +48,7 @@ #define EFMASK_CHEAP (EF_ADDITIVE | EF_DOUBLESIDED | EF_FULLBRIGHT | EF_NODEPTHTEST | EF_NODRAW | EF_NOSHADOW | EF_SELECTABLE | EF_TELEPORT_BIT) float autocvar_cl_viewmodel_scale; +float autocvar_cl_viewmodel_alpha; bool autocvar_cl_bobmodel; float autocvar_cl_bobmodel_speed; @@ -294,12 +298,9 @@ void viewmodel_draw(entity this) if(!this.activeweapon || !autocvar_r_drawviewmodel) return; int mask = (intermission || (STAT(HEALTH) <= 0) || autocvar_chase_active) ? 0 : MASK_NORMAL; - float a = this.alpha; - static bool wasinvehicle; + float a = ((autocvar_cl_viewmodel_alpha) ? bound(-1, autocvar_cl_viewmodel_alpha, this.m_alpha) : this.m_alpha); bool invehicle = player_localentnum > maxclients; if (invehicle) a = -1; - else if (wasinvehicle) a = 1; - wasinvehicle = invehicle; Weapon wep = this.activeweapon; int c = entcs_GetClientColors(current_player); vector g = weaponentity_glowmod(wep, NULL, c, this); @@ -399,7 +400,6 @@ STATIC_INIT(fpscounter_init) showfps_prevfps_time = currentTime; // we must initialize it to avoid an instant low frame sending } -void Porto_Draw(entity this); STATIC_INIT(Porto) { entity e = new_pure(porto); @@ -425,6 +425,10 @@ void Porto_Draw(entity this) vector pos = view_origin; vector dir = view_forward; + makevectors(((autocvar_chase_active) ? warpzone_save_view_angles : view_angles)); + pos += v_right * -wepent.movedir.y + + v_up * wepent.movedir.z; + if (wepent.angles_held_status) { makevectors(wepent.angles_held); @@ -489,9 +493,8 @@ vector GetCurrentFov(float fov) if(zoomfactor < 1 || zoomfactor > 30) zoomfactor = 2.5; zoomspeed = autocvar_cl_zoomspeed; - if(zoomspeed >= 0) - if(zoomspeed < 0.5 || zoomspeed > 16) - zoomspeed = 3.5; + if (zoomspeed >= 0 && (zoomspeed < 0.5 || zoomspeed > 16)) + zoomspeed = 3.5; zoomdir = button_zoom; @@ -524,7 +527,11 @@ vector GetCurrentFov(float fov) if(zoomdir) { zoomin_effect = 0; } - if(camera_active) + if (spectatee_status > 0 && STAT(CAMERA_SPECTATOR) == 2) + { + current_viewzoom = 1; + } + else if (camera_active) { current_viewzoom = min(1, current_viewzoom + drawframetime); } @@ -568,10 +575,10 @@ vector GetCurrentFov(float fov) if(autocvar_cl_velocityzoom_enabled && autocvar_cl_velocityzoom_type) // _type = 0 disables velocity zoom too { - if(intermission) { curspeed = 0; } + if (intermission || (spectatee_status > 0 && STAT(CAMERA_SPECTATOR) == 2)) + curspeed = 0; else { - makevectors(view_angles); v = pmove_vel; if(csqcplayer) @@ -698,6 +705,7 @@ float TrueAimCheck(entity wepent) case WEP_MORTAR: // toss curve return SHOTTYPE_HITWORLD; case WEP_VORTEX: + case WEP_OVERKILL_NEX: case WEP_VAPORIZER: mv = MOVE_NORMAL; break; @@ -766,8 +774,6 @@ float TrueAimCheck(entity wepent) return SHOTTYPE_HITWORLD; } -void PostInit(); -void CSQC_Demo_Camera(); float camera_mode; const float CAMERA_FREE = 1; const float CAMERA_CHASE = 2; @@ -1228,6 +1234,8 @@ void HUD_Crosshair(entity this) float arc_heat = wepent.arc_heat_percent; float vcharge = wepent.vortex_charge; float vchargepool = wepent.vortex_chargepool_ammo; + float oknex_charge_ = wepent.oknex_charge; + float oknex_chargepool_ = wepent.oknex_chargepool_ammo; if(vortex_charge_movingavg == 0) // this should only happen if we have just loaded up the game vortex_charge_movingavg = vcharge; @@ -1253,6 +1261,26 @@ void HUD_Crosshair(entity this) ring_rgb = wcross_color; ring_image = "gfx/crosshair_ring_nexgun.tga"; } + else if (autocvar_crosshair_ring && (wepent.activeweapon == WEP_OVERKILL_NEX) && oknex_charge_ && autocvar_crosshair_ring_vortex) + { + if (oknex_chargepool_ || use_vortex_chargepool) { + use_vortex_chargepool = 1; + ring_inner_value = oknex_chargepool_; + } else { + vortex_charge_movingavg = (1 - autocvar_crosshair_ring_vortex_currentcharge_movingavg_rate) * vortex_charge_movingavg + autocvar_crosshair_ring_vortex_currentcharge_movingavg_rate * oknex_charge_; + ring_inner_value = bound(0, autocvar_crosshair_ring_vortex_currentcharge_scale * (oknex_charge_ - vortex_charge_movingavg), 1); + } + + ring_inner_alpha = autocvar_crosshair_ring_vortex_inner_alpha; + ring_inner_rgb = eX * autocvar_crosshair_ring_vortex_inner_color_red + eY * autocvar_crosshair_ring_vortex_inner_color_green + eZ * autocvar_crosshair_ring_vortex_inner_color_blue; + ring_inner_image = "gfx/crosshair_ring_inner.tga"; + + // draw the outer ring to show the current charge of the weapon + ring_value = oknex_charge_; + ring_alpha = autocvar_crosshair_ring_vortex_alpha; + ring_rgb = wcross_color; + ring_image = "gfx/crosshair_ring_nexgun.tga"; + } else if (autocvar_crosshair_ring && wepent.activeweapon == WEP_MINE_LAYER && WEP_CVAR(minelayer, limit) && autocvar_crosshair_ring_minelayer) { ring_value = bound(0, wepent.minelayer_mines / WEP_CVAR(minelayer, limit), 1); // if you later need to use the count of bullets in another place, then add a float for it. For now, no need to. @@ -1537,15 +1565,12 @@ float oldr_novis; float oldr_useportalculling; float oldr_useinfinitefarclip; -void cl_notice_run(); - float prev_myteam; int lasthud; float vh_notice_time; -void WaypointSprite_Load(); void CSQC_UpdateView(entity this, float w, float h) { - TC(int, w); TC(int, h); + TC(int, w); TC(int, h); entity e; float fov; float f; @@ -2037,7 +2062,7 @@ void CSQC_UpdateView(entity this, float w, float h) IL_EACH(g_drawables, it.draw, it.draw(it)); - addentities(MASK_NORMAL | MASK_ENGINE | MASK_ENGINEVIEWMODELS); + addentities(MASK_NORMAL | MASK_ENGINE | MASK_ENGINEVIEWMODELS); // TODO: .health is used in cl_deathfade (a feature we have turned off currently) renderscene(); // now switch to 2D drawing mode by calling a 2D drawing function