]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/View.qc
kill a seriously weird array use
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / View.qc
index f0810e5e29c3efbe230837c51997feea08c8bbb8..66d7dd31c4b1ae258043002bc381a81109d9ddfc 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;
@@ -1385,7 +1395,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;
                                }
                        }
@@ -1459,6 +1469,9 @@ void CSQC_UpdateView(float w, float h)
         else if(hud == HUD_BUMBLEBEE)
             CSQC_BUMBLE_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 +1497,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