]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/View.qc
Merge remote-tracking branch 'origin/terencehill/cmd_fixes'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / View.qc
index f0810e5e29c3efbe230837c51997feea08c8bbb8..9ffe5a738c67634732ac4716a6fc8e7ccace8106 100644 (file)
@@ -94,6 +94,7 @@ vector GetCurrentFov(float fov)
 {
        float zoomsensitivity, zoomspeed, zoomfactor, zoomdir;
        float velocityzoom, curspeed;
+       vector v;
 
        zoomsensitivity = autocvar_cl_zoomsensitivity;
        zoomfactor = autocvar_cl_zoomfactor;
@@ -161,11 +162,15 @@ vector GetCurrentFov(float fov)
 
        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
@@ -220,14 +225,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;
@@ -365,6 +374,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;
@@ -432,7 +442,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)
@@ -463,9 +473,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);
@@ -529,8 +546,8 @@ void CSQC_UpdateView(float w, float h)
                        calledhooks |= HOOK_END;
                }
        }
-       
-  Announcer();
+
+       Announcer();
 
        fov = autocvar_fov;
        if(fov <= 59.5)
@@ -1173,7 +1190,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
@@ -1385,7 +1403,7 @@ void CSQC_UpdateView(float w, float h)
                                                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;
                                }
                        }
@@ -1458,7 +1476,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);
@@ -1484,7 +1507,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