]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/g_world.qc
Merge branch 'master' of ssh://gitlab.com/xonotic/xonotic-data.pk3dir into kickban...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / g_world.qc
index 4b14ef3a1609e7280a1e6ee1b052494f430406d7..0fd5d2de3c2eee8f0e2a8076f22ee753b6965992 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()
 {
@@ -1036,7 +1036,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;
                }
@@ -1064,7 +1064,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;
        }
@@ -2204,27 +2204,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.hit_time = time;
-                               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.hit_time = time;
-                               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);