]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/g_world.qc
Merge branch 'master' into TimePath/experiments/csqc_prediction
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / g_world.qc
index cfdbd0bc961407e509bdc003120e58cc6ae75099..adfb59a08cb5246823867171d493cf9aeb44c778 100644 (file)
@@ -41,7 +41,7 @@ void PingPLReport_Think()
                WriteByte(MSG_BROADCAST, 0);
                WriteByte(MSG_BROADCAST, 0);
        }
-       self.cnt = mod(self.cnt + 1, maxclients);
+       self.cnt = (self.cnt + 1) % maxclients;
 }
 void PingPLReport_Spawn()
 {
@@ -756,6 +756,7 @@ void spawnfunc_worldspawn (void)
        addstat(STAT_WEAPON_CLIPLOAD, AS_INT, clip_load);
        addstat(STAT_WEAPON_CLIPSIZE, AS_INT, clip_size);
        addstat(STAT_LAST_PICKUP, AS_FLOAT, last_pickup);
+       addstat(STAT_HIT_TIME, AS_FLOAT, hit_time);
        addstat(STAT_DAMAGE_DEALT_TOTAL, AS_INT, damage_dealt_total);
        addstat(STAT_TYPEHIT_TIME, AS_FLOAT, typehit_time);
        addstat(STAT_LAYED_MINES, AS_INT, minelayer_mines);
@@ -1033,7 +1034,7 @@ float() MaplistMethod_Iterate = // usual method
                for(i = 1; i < Map_Count; ++i)
                {
                        float mapindex;
-                       mapindex = mod(i + Map_Current, Map_Count);
+                       mapindex = (i + Map_Current) % Map_Count;
                        if(Map_Check(mapindex, pass))
                                return mapindex;
                }
@@ -1061,7 +1062,7 @@ float() MaplistMethod_Random = // random map selection
        for(i = 0; i <= imax; ++i)
        {
                float mapindex;
-               mapindex = mod(Map_Current + floor(random() * (Map_Count - 1) + 1), Map_Count); // any OTHER map
+               mapindex = (Map_Current + floor(random() * (Map_Count - 1) + 1)) % Map_Count; // any OTHER map
                if(Map_Check(mapindex, 1))
                        return mapindex;
        }
@@ -2201,21 +2202,13 @@ void EndFrame()
        float altime;
        FOR_EACH_REALCLIENT(self)
        {
-               self.damage_dealt_total = 0;
-       
-               if(IS_SPEC(self))
-               {
-                       if(self.enemy.typehitsound)
-                               self.typehit_time = time;
-                       else if(self.enemy.damage_dealt)
-                               self.damage_dealt_total = ceil(self.enemy.damage_dealt);
-               }
-               else
+               entity e = IS_SPEC(self) ? self.enemy : self;
+               if(e.typehitsound)
+                       self.typehit_time = time;
+               else if(e.damage_dealt)
                {
-                       if(self.typehitsound)
-                               self.typehit_time = time;
-                       else if(self.damage_dealt)
-                               self.damage_dealt_total = ceil(self.damage_dealt);
+                       self.hit_time = time;
+                       self.damage_dealt_total += ceil(e.damage_dealt);
                }
        }
        altime = time + frametime * (1 + autocvar_g_antilag_nudge);