]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
clean up handling of active and switch weapon
authorRudolf Polzer <divverent@xonotic.org>
Sun, 4 Sep 2011 16:48:59 +0000 (18:48 +0200)
committerRudolf Polzer <divverent@xonotic.org>
Sun, 4 Sep 2011 16:52:11 +0000 (18:52 +0200)
qcsrc/client/View.qc
qcsrc/client/hud.qc
qcsrc/client/main.qh
qcsrc/client/scoreboard.qc

index b4c222a7728cc44bed196550f4137f9aebcfec05..443c6c7fa6f4be07459ce5b83144579a8ef85a1d 100644 (file)
@@ -127,7 +127,7 @@ vector GetCurrentFov(float fov)
 
        zoomdir = button_zoom;
        if(hud == HUD_NORMAL)
-       if((getstati(STAT_ACTIVEWEAPON) == WEP_NEX && nex_scope) || (getstati(STAT_ACTIVEWEAPON) == WEP_RIFLE && rifle_scope)) // do NOT use switchweapon here
+       if((activeweapon == WEP_NEX && nex_scope) || (activeweapon == WEP_RIFLE && rifle_scope)) // do NOT use switchweapon here
                zoomdir += button_attack2;
        if(spectatee_status > 0 || isdemo())
        {
@@ -544,8 +544,8 @@ void CSQC_UpdateView(float w, float h)
        }
 
        ColorTranslateMode = autocvar_cl_stripcolorcodes;
-       activeswitchweapon = getstati(STAT_SWITCHWEAPON);
-       activeweapon = getstati(STAT_WEAPON);
+       switchweapon = getstati(STAT_SWITCHWEAPON);
+       activeweapon = getstati(STAT_ACTIVEWEAPON);
        f = (serverflags & SERVERFLAG_TEAMPLAY);
        if(f != teamplay)
        {
@@ -1160,7 +1160,7 @@ void CSQC_UpdateView(float w, float h)
 
                        f = autocvar_crosshair_effect_speed;
                        if(f < 0)
-                               f *= -2 * g_weaponswitchdelay;
+                               f *= -1 * g_weaponswitchdelay; // anim starts when weapon has been lowered and new weapon comes up
                        if(wcross_scale != wcross_scale_goal_prev || wcross_alpha != wcross_alpha_goal_prev || wcross_color != wcross_color_goal_prev)
                        {
                                wcross_changedonetime = time + f;
index 88451ecce08e0506da463fc4af1fe845f5932ae8..92bbc5223175722374ff81ddf32c37466898fa9e 100644 (file)
@@ -641,7 +641,7 @@ void HUD_Weapons(void)
                weapid = self.impulse;
 
                // draw background behind currently selected weapon
-               if(self.weapon == activeswitchweapon)
+               if(self.weapon == switchweapon)
                        drawpic_aspect_skin(wpnpos, "weapon_current_bg", wpnsize, '1 1 1', wpnalpha, DRAWFLAG_NORMAL);
 
                // draw the weapon accuracy
index 91a5087d04c8b50fa3224f8691b4d855d2eddcf7..c9f23b93bfdee87f9c35575078d2e46c6e132b6d 100644 (file)
@@ -117,7 +117,7 @@ float spectatorbutton_zoom;
 float button_attack2;
 
 float activeweapon;
-float activeswitchweapon;
+float switchweapon;
 float current_viewzoom;
 float zoomin_effect;
 float warmup_stage;
index 93f851876da157a0a229127cfdf8cac4111272b9..2562ba00544f9c5c651fa4ae8b0420f632870aa4 100644 (file)
@@ -978,7 +978,7 @@ vector HUD_DrawScoreboardAccuracyStats(vector pos, vector rgb, vector bg_size)
        if(rows == 2)
                pos_x += weapon_width / 2;
 
-       if(getstati(STAT_SWITCHWEAPON) == WEP_MINSTANEX)
+       if(switchweapon == WEP_MINSTANEX)
                g_minstagib = 1; // TODO: real detection for minstagib?
 
        float weapon_stats;