]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/t_items.qc
fix invalid use of autocvar (shouldn't change behaviour)
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / t_items.qc
index c5ffb163684bf8a3cd5e0599c42738df93debe96..18b2e3c9efe4d14445101fcffab7dd9c2d889e74 100644 (file)
 
 #ifdef CSQC
 
-float  autocvar_cl_ghost_items;
-vector autocvar_cl_ghost_items_color;
-float  autocvar_cl_simple_items;
+var float  autocvar_cl_ghost_items = 1;
+var vector autocvar_cl_ghost_items_color = '-1 -1 -1';
 float  autocvar_cl_fullbright_items;
 vector autocvar_cl_staywep_color;
 float  autocvar_cl_staywep_alpha;
+float  autocvar_cl_simple_items;
+float  cl_simple_items;
+float  cl_ghost_items_alpha;
 
 .float  spawntime;
 .float  gravity;
@@ -52,14 +54,11 @@ void ItemDrawSimple()
 float csqcitems_started; // remove this after a release or two
 void csqcitems_start()
 {
-    autocvar_cl_ghost_items =  bound(0, autocvar_cl_ghost_items, 1);
     if(autocvar_cl_ghost_items == 1)
-        autocvar_cl_ghost_items = 0.55;
+        cl_ghost_items_alpha = 0.55;
+    else
+        cl_ghost_items_alpha = bound(0, autocvar_cl_ghost_items, 1);
     
-    string _tmp = cvar_string("cl_ghost_items_color");
-    if(_tmp == "")
-        autocvar_cl_ghost_items_color = '-1 -1 -1';
-
     csqcitems_started = TRUE;
 }
 
@@ -90,7 +89,7 @@ void ItemRead(float _IsNew)
         }
         else
         {
-            if (autocvar_cl_ghost_items)
+            if (cl_ghost_items_alpha)
             {
                 self.alpha = autocvar_cl_ghost_items;
                 self.colormod = self.glowmod = autocvar_cl_ghost_items_color;
@@ -130,7 +129,7 @@ void ItemRead(float _IsNew)
         self.mdl = "";
         string _fn = ReadString();
         
-        if(autocvar_cl_simple_items && (self.ItemStatus & ITS_ALLOWSI))
+        if(cl_simple_items && (self.ItemStatus & ITS_ALLOWSI))
         {
             string _fn2 = substring(_fn, 0 , strlen(_fn) -4);
                         
@@ -166,7 +165,6 @@ void ItemRead(float _IsNew)
     
     if(sf & ISF_DROP)
     {
-        self.effects |= EF_FLAME;
         self.gravity = 1;
         self.move_movetype = MOVETYPE_TOSS;
         self.move_velocity_x = ReadCoord();
@@ -421,7 +419,7 @@ void Item_RespawnCountdown (void)
                if(self.count == 1)
                {
                        string name;
-                       vector rgb;
+                       vector rgb = '1 0 1';
                        name = string_null;
                        if(g_minstagib)
                        {
@@ -887,7 +885,8 @@ float weapon_pickupevalfunc(entity player, entity item)
 
 float commodity_pickupevalfunc(entity player, entity item)
 {
-       float c, i, need_shells, need_nails, need_rockets, need_cells, need_fuel;
+       float c, i;
+       float need_shells = FALSE, need_nails = FALSE, need_rockets = FALSE, need_cells = FALSE, need_fuel = FALSE;
        entity wi;
        c = 0;
 
@@ -1663,19 +1662,21 @@ void spawnfunc_target_items (void)
                        else if(argv(i) == "jetpack")                self.items |= IT_JETPACK;
                        else if(argv(i) == "fuel_regen")             self.items |= IT_FUEL_REGEN;
                        else
-                       for(j = WEP_FIRST; j <= WEP_LAST; ++j)
                        {
-                               e = get_weaponinfo(j);
-                               if(argv(i) == e.netname)
+                               for(j = WEP_FIRST; j <= WEP_LAST; ++j)
                                {
-                                       WEPSET_OR_EW(self, j);
-                                       if(self.spawnflags == 0 || self.spawnflags == 2)
-                                               weapon_action(e.weapon, WR_PRECACHE);
-                                       break;
+                                       e = get_weaponinfo(j);
+                                       if(argv(i) == e.netname)
+                                       {
+                                               WEPSET_OR_EW(self, j);
+                                               if(self.spawnflags == 0 || self.spawnflags == 2)
+                                                       weapon_action(e.weapon, WR_PRECACHE);
+                                               break;
+                                       }
                                }
+                               if(j > WEP_LAST)
+                                       print("target_items: invalid item ", argv(i), "\n");
                        }
-                       if(j > WEP_LAST)
-                               print("target_items: invalid item ", argv(i), "\n");
                }
 
                string itemprefix, valueprefix;