]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' of ssh://gitlab.com/xonotic/xonotic-data.pk3dir
authorMartin Taibr <taibr.martin@gmail.com>
Sun, 12 Apr 2020 17:56:44 +0000 (19:56 +0200)
committerMartin Taibr <taibr.martin@gmail.com>
Sun, 12 Apr 2020 17:56:44 +0000 (19:56 +0200)
qcsrc/common/stats.qh
qcsrc/common/t_items.qc

index c5e45e866a9a00df69697a5efe3f58ee86b80151..c77ca16be2a432043f0d8808fa1506b25b0d3a7d 100644 (file)
@@ -16,18 +16,16 @@ const int MAX_CL_STATS = 256;
 // const int STAT_NAILS = 7;
 // const int STAT_ROCKETS = 8;
 // const int STAT_CELLS = 9;
-// const int STAT_ACTIVEWEAPON = 10;
 // const int STAT_ITEMS = 15; // .items | .items2 << 23 | serverflags << 28
 // const int STAT_VIEWHEIGHT = 16;
 
 #if defined(CSQC)
     #define g_stat_HEALTH getstati(STAT_HEALTH)
-    #define g_stat_ARMOR getstat_int(STAT_ARMOR)
-    #define g_stat_SHELLS getstat_int(STAT_SHELLS)
-    #define g_stat_NAILS getstat_int(STAT_NAILS)
-    #define g_stat_ROCKETS getstat_int(STAT_ROCKETS)
-    #define g_stat_CELLS getstat_int(STAT_CELLS)
-    #define g_stat_ACTIVEWEAPON getstat_int(STAT_ACTIVEWEAPON)
+    #define g_stat_ARMOR getstati(STAT_ARMOR)
+    #define g_stat_SHELLS getstati(STAT_SHELLS)
+    #define g_stat_NAILS getstati(STAT_NAILS)
+    #define g_stat_ROCKETS getstati(STAT_ROCKETS)
+    #define g_stat_CELLS getstati(STAT_CELLS)
     #define g_stat_ITEMS getstat_int(STAT_ITEMS)
     #define g_stat_VIEWHEIGHT getstati(STAT_VIEWHEIGHT)
 #elif defined(SVQC)
@@ -37,7 +35,6 @@ const int MAX_CL_STATS = 256;
     #define stat_NAILS ammo_nails
     #define stat_ROCKETS ammo_rockets
     #define stat_CELLS ammo_cells
-    #define stat_ACTIVEWEAPON weapon
     #define stat_ITEMS items
     #define stat_VIEWHEIGHT view_ofs_z
 #endif
index bd7885d41f5273121d7956b968d2b221b2ee7211..a05f90f9e60b1aa757dac29975714102344a4b9b 100644 (file)
@@ -1667,17 +1667,19 @@ void GiveRot(entity e, float v0, float v1, .float rotfield, float rottime, .floa
 bool GiveResourceValue(entity e, int res_type, int op, int val)
 {
        int v0 = GetResource(e, res_type);
+       float new_val = 0;
        switch (op)
        {
                // min 100 cells = at least 100 cells
-               case OP_SET: SetResource(e, res_type, val); break;
-               case OP_MIN: SetResource(e, res_type, max(v0, val)); break;
-               case OP_MAX: SetResource(e, res_type, min(v0, val)); break;
-               case OP_PLUS: SetResource(e, res_type, v0 + val); break;
-               case OP_MINUS: SetResource(e, res_type, v0 - val); break;
-       }
-       int v1 = GetResource(e, res_type);
-       return v0 != v1;
+               case OP_SET: new_val = val; break;
+               case OP_MIN: new_val = max(v0, val); break;
+               case OP_MAX: new_val = min(v0, val); break;
+               case OP_PLUS: new_val = v0 + val; break;
+               case OP_MINUS: new_val = v0 - val; break;
+               default: return false;
+       }
+
+       return SetResourceExplicit(e, res_type, new_val);
 }
 
 float GiveItems(entity e, float beginarg, float endarg)