]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'TimePath/refactor/mod_operator' into 'master'
authorMario <zacjardine@y7mail.com>
Sat, 27 Dec 2014 00:10:16 +0000 (00:10 +0000)
committerMario <zacjardine@y7mail.com>
Sat, 27 Dec 2014 00:10:16 +0000 (00:10 +0000)
Use modulus operator

Convert usages of `mod(A, B)` to `((A) % (B))`

See merge request !68

29 files changed:
qcsrc/client/hud.qc
qcsrc/client/hud.qh
qcsrc/client/hud_config.qc
qcsrc/client/mapvoting.qc
qcsrc/client/scoreboard.qc
qcsrc/client/tuba.qc
qcsrc/client/waypointsprites.qc
qcsrc/common/command/generic.qc
qcsrc/common/counting.qh
qcsrc/common/urllib.qc
qcsrc/common/util.qc
qcsrc/common/util.qh
qcsrc/common/weapons/w_fireball.qc
qcsrc/common/weapons/w_seeker.qc
qcsrc/common/weapons/w_tuba.qc
qcsrc/common/weapons/weapons.qc
qcsrc/server/cheats.qc
qcsrc/server/cl_impulse.qc
qcsrc/server/command/getreplies.qc
qcsrc/server/g_triggers.qc
qcsrc/server/g_world.qc
qcsrc/server/ipban.qc
qcsrc/server/mutators/gamemode_keyhunt.qc
qcsrc/server/mutators/gamemode_nexball.qc
qcsrc/server/race.qc
qcsrc/server/t_jumppads.qc
qcsrc/server/vehicles/spiderbot.qc
qcsrc/server/weapons/accuracy.qc
qcsrc/server/weapons/selection.qc

index 51c5c6489cbdef0a887097a4c9cf87a439443965..8a9aab304c4b7fecf0f09ecc3857660aa97a33b1 100644 (file)
@@ -3114,7 +3114,7 @@ void HUD_Mod_NexBall(vector pos, vector mySize)
        //Manage the progress bar if any
        if (nb_pb_starttime > 0)
        {
-               dt = mod(time - nb_pb_starttime, nb_pb_period);
+               dt = (time - nb_pb_starttime) % nb_pb_period;
                // one period of positive triangle
                p = 2 * dt / nb_pb_period;
                if (p > 1)
@@ -3754,7 +3754,7 @@ void HUD_InfoMessages(void)
                }
 
                string blinkcolor;
-               if(mod(time, 1) >= 0.5)
+               if(time % 1 >= 0.5)
                        blinkcolor = "^1";
                else
                        blinkcolor = "^3";
@@ -4551,7 +4551,7 @@ void HUD_Main (void)
                        }
                        else if(hud_dock_color == "pants") {
                                f = stof(getplayerkeyvalue(current_player - 1, "colors"));
-                               color = colormapPaletteColor(mod(f, 16), 1);
+                               color = colormapPaletteColor(f % 16, 1);
                        }
                        else
                                color = stov(hud_dock_color);
index 55d4bd0db8c9fdd71265993fea3dd372549c83c9..d56caf1331e88fa48e9624f20b2cf7982c581f70 100644 (file)
@@ -189,7 +189,7 @@ if((teamplay) && panel_bg_color_team) {\
                if(panel_bg_color_str == "shirt") {\
                        panel_bg_color = colormapPaletteColor(floor(stof(getplayerkeyvalue(current_player - 1, "colors")) / 16), 0);\
                } else if(panel_bg_color_str == "pants") {\
-                       panel_bg_color = colormapPaletteColor(mod(stof(getplayerkeyvalue(current_player - 1, "colors")), 16), 1);\
+                       panel_bg_color = colormapPaletteColor(stof(getplayerkeyvalue(current_player - 1, "colors")) % 16, 1);\
                } else {\
                        panel_bg_color = stov(panel_bg_color_str);\
                }\
index 8ecc326b1e788441547b2fd7ec2081ffbd7bbd60..047e012ad65d8670b5502679f1bff01f72cce9c7 100644 (file)
@@ -810,13 +810,13 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
                        }
                        if (!tab_backward)
                        {
-                               level = mod(level + level_height, vid_conheight);
+                               level = (level + level_height) % vid_conheight;
                                start_pos_x = 0;
                                candidate_pos_x = vid_conwidth;
                        }
                        else
                        {
-                               level = mod(level - level_height, vid_conheight);
+                               level = (level - level_height) % vid_conheight;
                                start_pos_x = vid_conwidth;
                                candidate_pos_x = 0;
                        }
index a354bacf28d9ecbec0b259bb5055f2989c889a98..3f30a6a722f7d3e805e6423facaca0b7ad81ab00 100644 (file)
@@ -234,7 +234,7 @@ void MapVote_DrawAbstain(vector pos, float isize, float tsize, float count, floa
 vector MapVote_GridVec(vector gridspec, float i, float m)
 {
        float r;
-       r = mod(i, m);
+       r = i % m;
        return
                '1 0 0' * (gridspec_x * r)
                +
index b6efc3b3a7c1c22a97e301fa7846af504d2b946c..f5b3206ba3bbbb6bc259df0d920675a01a96d7a3 100644 (file)
@@ -555,7 +555,7 @@ string HUD_GetField(entity pl, float field)
                                        hud_field_icon1 = "gfx/scoreboard/playercolor_shirt";
                                        hud_field_icon1_rgb = colormapPaletteColor(floor(f / 16), 0);
                                        hud_field_icon2 = "gfx/scoreboard/playercolor_pants";
-                                       hud_field_icon2_rgb = colormapPaletteColor(mod(f, 16), 1);
+                                       hud_field_icon2_rgb = colormapPaletteColor(f % 16, 1);
                                }
                        }
                        return GetPlayerName(pl.sv_entnum);
@@ -695,7 +695,7 @@ void HUD_PrintScoreboardItem(vector pos, vector item_size, entity pl, float is_s
        // alternated rows highlighting
        if(is_self)
                drawfill(h_pos, h_size, rgb, scoreboard_highlight_alpha_self, DRAWFLAG_NORMAL);
-       else if((scoreboard_highlight) && (!mod(pl_number,2)))
+       else if((scoreboard_highlight) && (!(pl_number % 2)))
                drawfill(h_pos, h_size, rgb, scoreboard_highlight_alpha, DRAWFLAG_NORMAL);
 
        tmp_x = item_size_x;
@@ -874,7 +874,7 @@ vector HUD_Scoreboard_MakeTable(vector pos, entity tm, vector rgb, vector bg_siz
                column_dim_x = hud_size[i] + hud_fontsize_x;
                if (scoreboard_highlight)
                {
-                       if (mod(i,2))
+                       if (i % 2)
                                drawfill(pos - '0 1 0' - hud_fontsize_x / 2 * '1 0 0', column_dim, '0 0 0', scoreboard_alpha_bg * 0.2, DRAWFLAG_NORMAL);
                }
                drawstring(pos, hud_title[i], hud_fontsize, rgb * 1.5, scoreboard_alpha_fg, DRAWFLAG_NORMAL);
@@ -893,7 +893,7 @@ vector HUD_Scoreboard_MakeTable(vector pos, entity tm, vector rgb, vector bg_siz
 
                        if (scoreboard_highlight)
                        {
-                               if (!mod(i,2))
+                               if (!(i % 2))
                                {
                                        if (i == hud_num_fields-1)
                                                column_dim_x = hud_size[i] + hud_fontsize_x / 2 + 1;
@@ -994,7 +994,7 @@ vector HUD_DrawScoreboardAccuracyStats(vector pos, vector rgb, vector bg_size)
        // column highlighting
        for(i = 0; i < weapon_cnt/rows; ++i)
        {
-               if(!mod(i, 2))
+               if(!(i % 2))
                        drawfill(pos + '1 0 0' * weapon_width * rows * i, '0 1 0' * height * rows + '1 0 0' * weapon_width * rows, '0 0 0', scoreboard_alpha_bg * 0.2, DRAWFLAG_NORMAL);
        }
 
@@ -1185,7 +1185,7 @@ vector HUD_DrawScoreboardRankings(vector pos, entity pl,  vector rgb, vector bg_
                p = count_ordinal(i+1);
                if(grecordholder[i] == GetPlayerName(player_localnum))
                        drawfill(pos, '1 0 0' * sbwidth + '0 1.25 0' * hud_fontsize_y, hl_rgb, scoreboard_highlight_alpha_self, DRAWFLAG_NORMAL);
-               else if(!mod(i, 2) && scoreboard_highlight)
+               else if(!(i % 2) && scoreboard_highlight)
                        drawfill(pos, '1 0 0' * sbwidth + '0 1.25 0' * hud_fontsize_y, hl_rgb, scoreboard_highlight_alpha, DRAWFLAG_NORMAL);
                drawstring(pos, p, '1 1 0' * hud_fontsize_y, '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL);
                drawstring(pos + '3 0 0' * hud_fontsize_y, TIME_ENCODED_TOSTRING(t), '1 1 0' * hud_fontsize_y, '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL);
index 38ce1090a12aea33334f64478bb69dd33bc27172..73d72b61e716c5ad200630d46b05365f217f74eb 100644 (file)
@@ -30,7 +30,7 @@ void tubasound(entity e, float restart)
                f2 = 0;
                p2 = 1;
 
-               m = mod(e.note, Tuba_PitchStep);
+               m = e.note % Tuba_PitchStep;
                if(m)
                {
                        if(e.note - m < TUBA_MIN)
@@ -190,7 +190,7 @@ void Tuba_Precache()
        }
        for(n = TUBA_MIN; n <= TUBA_MAX; ++n)
        {
-               if(!Tuba_PitchStep || (mod(n, Tuba_PitchStep) == 0))
+               if(!Tuba_PitchStep || ((n % Tuba_PitchStep) == 0))
                {
                        for(i = 0; i < TUBA_INSTRUMENTS; ++i)
                                precache_sound(TUBA_STARTNOTE(i, n));
index c99fc5d51c0a593a2668f6ea22dd8f461b0ac17e..2df3dd411bc6d9f4da76ef4124a81fa51658c8fc 100644 (file)
@@ -701,7 +701,7 @@ void Ent_WaypointSprite()
                if(f & 0x80)
                {
                        self.(teamradar_times[self.teamradar_time_index]) = time;
-                       self.teamradar_time_index = mod(self.teamradar_time_index + 1, MAX_TEAMRADAR_TIMES);
+                       self.teamradar_time_index = (self.teamradar_time_index + 1) % MAX_TEAMRADAR_TIMES;
                }
                self.teamradar_color_x = ReadByte() / 255.0;
                self.teamradar_color_y = ReadByte() / 255.0;
index 0710726de1cf62c8e017b66fc662fbc8c83ecd07..743793bad02db23bbfc88e5bbf211fdedc9a7b50 100644 (file)
@@ -153,7 +153,7 @@ void GenericCommand_qc_curl(float request, float argc)
                        {
                                curl_uri_get_exec[curl_uri_get_pos] = do_exec;
                                curl_uri_get_cvar[curl_uri_get_pos] = do_cvar;
-                               curl_uri_get_pos = mod(curl_uri_get_pos + 1, URI_GET_CURL_END - URI_GET_CURL + 1);
+                               curl_uri_get_pos = (curl_uri_get_pos + 1) % (URI_GET_CURL_END - URI_GET_CURL + 1);
                        }
                        else
                                print(_("error creating curl handle\n"));
index 1413a80902d1fb338abed1881ea942c2929bf608..0aeabc85e7b092e9800199fd2672c9b475a0a088 100644 (file)
@@ -60,10 +60,10 @@ string count_ordinal(float interval)
        // Basically, it just allows you to represent a number or count in different ways
        // depending on the number... like, with count_ordinal you can provide integers
        // and retrieve 1st, 2nd, 3rd, nth ordinal numbers in a clean and simple way.
-       if(floor((mod(interval, 100))/10) * 10 != 10) // examples: 12th, 111th, 213th will not execute this block
+       if(floor((interval % 100)/10) * 10 != 10) // examples: 12th, 111th, 213th will not execute this block
        {
                // otherwise, check normally for 1st,2nd,3rd insertions
-               switch(mod(interval, 10))
+               switch(interval % 10)
                {
                        case 1: return sprintf(_("%dst"), interval);
                        case 2: return sprintf(_("%dnd"), interval);
index c69d2f44aab4139b44e1da806baa8e6edbb58a7a..b747a27c468b2da7db99b678a15c66da1a9a0bf9 100644 (file)
@@ -159,7 +159,7 @@ void url_single_fopen(string url, float mode, url_ready_func rdy, entity pass)
                                url_fromid[i] = e;
 
                                // make sure this slot won't be reused quickly even on map change
-                               cvar_set("_urllib_nextslot", ftos(mod(i + 1, NUM_URL_ID)));
+                               cvar_set("_urllib_nextslot", ftos((i + 1) % NUM_URL_ID));
                                break;
                }
        }
@@ -262,7 +262,7 @@ void url_fclose(entity e)
                        url_fromid[i] = e;
 
                        // make sure this slot won't be reused quickly even on map change
-                       cvar_set("_urllib_nextslot", ftos(mod(i + 1, NUM_URL_ID)));
+                       cvar_set("_urllib_nextslot", ftos((i + 1) % NUM_URL_ID));
                }
                else
                {
index 671c8d5a593e23f9c552a700172cc57b9cf7139c..db6f04c62e2eaacc803b2998572c3c2161359f90 100644 (file)
@@ -346,14 +346,14 @@ void db_close(float db)
 string db_get(float db, string pKey)
 {
        float h;
-       h = mod(crc16(FALSE, pKey), DB_BUCKETS);
+       h = crc16(FALSE, pKey) % DB_BUCKETS;
        return uri_unescape(infoget(bufstr_get(db, h), pKey));
 }
 
 void db_put(float db, string pKey, string pValue)
 {
        float h;
-       h = mod(crc16(FALSE, pKey), DB_BUCKETS);
+       h = crc16(FALSE, pKey) % DB_BUCKETS;
        bufstr_set(db, h, infoadd(bufstr_get(db, h), pKey, uri_escape(pValue)));
 }
 
@@ -2261,10 +2261,10 @@ const string XENCODE_22 = "0123456789abcdefABCDEF";
 string xencode(float f)
 {
        float a, b, c, d;
-       d = mod(f, 22); f = floor(f / 22);
-       c = mod(f, 22); f = floor(f / 22);
-       b = mod(f, 22); f = floor(f / 22);
-       a = mod(f,  2); // f = floor(f /  2);
+       d = f % 22; f = floor(f / 22);
+       c = f % 22; f = floor(f / 22);
+       b = f % 22; f = floor(f / 22);
+       a = f %  2; // f = floor(f /  2);
        return strcat(
                "^",
                substring(XENCODE_2,  a, 1),
index 49ec62ad3d7e875545b12f2e8a0f24bf29141990..65b4e67a427b5eca7ba99208d874cec288d466be 100644 (file)
@@ -98,11 +98,6 @@ void db_put(float db, string key, string value);
 float buf_load(string filename);
 void buf_save(float buf, string filename);
 
-// modulo function
-#ifndef MENUQC
-float mod(float a, float b) { return a - (floor(a / b) * b); }
-#endif
-
 #define TIME_TO_NTHS(t,n) floor((t) * (n) + 0.4)
 string format_time(float seconds);
 string mmsss(float t);
index a5bca22cd16ac1e3cadd9bfa734383f4c19a9cb6..80c453a4d735a79a0efdea85065f3d40f6342d95 100644 (file)
@@ -298,7 +298,7 @@ void W_Fireball_Attack2(void)
        vector f_diff;
        float c;
 
-       c = mod(self.bulletcounter, 4);
+       c = self.bulletcounter % 4;
        switch(c)
        {
                case 0:
index 7d933d5ca6bb7888f95a36ab841af5a2ad26044f..d4c4d33941efc18591d9a168c918beda8f6d5422 100644 (file)
@@ -323,7 +323,7 @@ void W_Seeker_Fire_Flac(void)
 
        W_DecreaseAmmo(WEP_CVAR(seeker, flac_ammo));
 
-       c = mod(self.bulletcounter, 4);
+       c = self.bulletcounter % 4;
        switch(c)
        {
                case 0:
@@ -430,7 +430,7 @@ void W_Seeker_Vollycontroller_Think(void) // TODO: Merge this with W_Seeker_Atta
        oldenemy = self.enemy;
        self.enemy = oldself.enemy;
 
-       c = mod(self.cnt, 4);
+       c = self.cnt % 4;
        switch(c)
        {
                case 0:
index 5b17893682904aa317533b2c8dccb6177fa71ddc..e08cf676fb76eb92508241aec738317d3d824b0d 100644 (file)
@@ -71,7 +71,7 @@ float W_Tuba_HasPlayed(entity pl, string melody, float instrument, float ignorep
        nolength = FALSE;
        for(i = 0; i < n; ++i)
        {
-               vector v = pl.(tuba_lastnotes[mod(pl.tuba_lastnotes_last - i + MAX_TUBANOTES, MAX_TUBANOTES)]);
+               vector v = pl.(tuba_lastnotes[(pl.tuba_lastnotes_last - i + MAX_TUBANOTES) % MAX_TUBANOTES]);
                float ai = stof(argv(n - i - 1));
                float np = floor(ai);
                if(ai == np)
@@ -108,13 +108,13 @@ float W_Tuba_HasPlayed(entity pl, string melody, float instrument, float ignorep
 
                for(i = 0; i < n; ++i)
                {
-                       vector vi = pl.(tuba_lastnotes[mod(pl.tuba_lastnotes_last - i + MAX_TUBANOTES, MAX_TUBANOTES)]);
+                       vector vi = pl.(tuba_lastnotes[(pl.tuba_lastnotes_last - i + MAX_TUBANOTES) % MAX_TUBANOTES]);
                        float ai = stof(argv(n - i - 1));
                        ti -= 1 / (ai - floor(ai));
                        float tj = ti;
                        for(j = i+1; j < n; ++j)
                        {
-                               vector vj = pl.(tuba_lastnotes[mod(pl.tuba_lastnotes_last - j + MAX_TUBANOTES, MAX_TUBANOTES)]);
+                               vector vj = pl.(tuba_lastnotes[(pl.tuba_lastnotes_last - j + MAX_TUBANOTES) % MAX_TUBANOTES]);
                                float aj = stof(argv(n - j - 1));
                                tj -= (aj - floor(aj));
 
@@ -154,7 +154,7 @@ void W_Tuba_NoteOff(void)
        //   note: self.cnt
        if(self.owner.tuba_note == self)
        {
-               self.owner.tuba_lastnotes_last = mod(self.owner.tuba_lastnotes_last + 1, MAX_TUBANOTES);
+               self.owner.tuba_lastnotes_last = (self.owner.tuba_lastnotes_last + 1) % MAX_TUBANOTES;
                self.owner.(tuba_lastnotes[self.owner.tuba_lastnotes_last]) = eX * self.spawnshieldtime + eY * time + eZ * self.cnt;
                self.owner.tuba_note = world;
                self.owner.tuba_lastnotes_cnt = bound(0, self.owner.tuba_lastnotes_cnt + 1, MAX_TUBANOTES);
index e45a901c3c62a2e13e3344a669d908c0bd8e507d..4f11fc3ef272ed53c5763b8f420c36553e6e7b68 100644 (file)
@@ -222,7 +222,7 @@ float W_FixWeaponOrder_BuildImpulseList_cmp(float i, float j, entity pass)
        float d;
        e1 = get_weaponinfo(W_FixWeaponOrder_BuildImpulseList_buf[i]);
        e2 = get_weaponinfo(W_FixWeaponOrder_BuildImpulseList_buf[j]);
-       d = mod(e1.impulse + 9, 10) - mod(e2.impulse + 9, 10);
+       d = (e1.impulse + 9) % 10 - (e2.impulse + 9) % 10;
        if(d != 0)
                return -d; // high impulse first!
        return
index 22b793d3966a35cd631f2c1a0c2e73213984e42f..c1a637514275849c26b573a565e8fb499d9db86b 100644 (file)
@@ -1075,7 +1075,7 @@ void DragBox_Think()
        }
        else
        {
-               setmodel(self.killindicator, strcat("models/sprites/", ftos(mod(self.cnt, 10)), ".spr32"));
+               setmodel(self.killindicator, strcat("models/sprites/", ftos(self.cnt % 10), ".spr32"));
                setmodel(self.killindicator.killindicator, strcat("models/sprites/", ftos(floor(self.cnt / 10)), ".spr32"));
        }
 
index 76610f4c3e57da54d79fc73dcbb1ebcb9aabe0a9..7446b7022a229c2c46589d7cfc9c1d92423a05c2 100644 (file)
@@ -124,7 +124,7 @@ void ImpulseCommands (void)
                if(self.deadflag == DEAD_NO)
                {
                        // custom order weapon cycling
-                       i = mod(imp, 10);
+                       i = imp % 10;
                        m = (imp - (210 + i)); // <0 for prev, =0 for best, >0 for next
                        W_CycleWeapon(self.(cvar_cl_weaponpriorities[i]), m);
                }
index aadc629587da0d2cda4e821b9dfae011570cfeab..b777990338cca615706b0f1bd7b5390f55909d37 100644 (file)
@@ -293,7 +293,7 @@ string getmaplist()
        {
                if(MapInfo_CheckMap(argv(i)))
                {
-                       if(mod(i, 2)) { col = "^2"; }
+                       if(i % 2) { col = "^2"; }
                        else { col = "^3"; }
                        maplist = sprintf("%s%s%s ", maplist, col, argv(i));
                }
@@ -321,12 +321,12 @@ string getlsmaps()
                        )
                        {
                                newmaps = TRUE;
-                               if(mod(i, 2)) { col = "^4*"; }
+                               if(i % 2) { col = "^4*"; }
                                else { col = "^5*"; }
                        }
                        else
                        {
-                               if(mod(i, 2)) { col = "^2"; }
+                               if(i % 2) { col = "^2"; }
                                else { col = "^3"; }
                        }
 
@@ -345,7 +345,7 @@ string getmonsterlist()
 
        for(i = MON_FIRST; i <= MON_LAST; ++i)
        {
-               if(mod(i, 2)) { col = "^2"; }
+               if(i % 2) { col = "^2"; }
                else { col = "^3"; }
                monsterlist = sprintf("%s%s%s ", monsterlist, col, (get_monsterinfo(i)).netname);
        }
index f203fdf4fa1ce3693f747f109e309fa0d200a70e..c5fb08c965c2afa88d6f6f3aecf1d58974c333bd 100644 (file)
@@ -1771,7 +1771,7 @@ void target_voicescript_next(entity pl)
                        if(pl.voicescript_index < vs.cnt)
                                i = pl.voicescript_index * 2;
                        else if(n > vs.cnt * 2)
-                               i = mod(pl.voicescript_index - vs.cnt, (n - vs.cnt * 2 - 1) / 2) * 2 + vs.cnt * 2 + 1;
+                               i = ((pl.voicescript_index - vs.cnt) % ((n - vs.cnt * 2 - 1) / 2)) * 2 + vs.cnt * 2 + 1;
                        else
                                i = -1;
 
index 12118a2ff9b974733b47d74c2a603f5ae64132c4..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;
        }
index a180547c0f97c09cb3632fdeb694e9bece0762a5..d3d7fdca6e93aa87ad5db6b41f5261891672ff0a 100644 (file)
@@ -138,7 +138,7 @@ void OnlineBanList_URI_Get_Callback(float id, float status, string data)
        else
                n = tokenizebyseparator(data, "\n");
 
-       if(mod(n, 4) != 0)
+       if((n % 4) != 0)
        {
                print("error: received invalid item count: ", ftos(n), "\n");
                return;
index 0512fe3f0d7cbc7dff24dcddfadc2ea45b04eb57..7b3ea98af6dc0dc558224870e604164259e969d3 100644 (file)
@@ -668,7 +668,7 @@ void kh_Key_Think()  // runs all the time
        if(self.owner)
        {
 #ifndef KH_PLAYER_USE_ATTACHMENT
-               makevectors('0 1 0' * (self.cnt + mod(time, 360) * KH_KEY_XYSPEED));
+               makevectors('0 1 0' * (self.cnt + (time % 360) * KH_KEY_XYSPEED));
                setorigin(self, v_forward * KH_KEY_XYDIST + '0 0 1' * self.origin_z);
 #endif
        }
index 392caa037d82b048dd1402109da7b0185697abb3..346ae1eee4493eed30b0649d18a2747d8d824e23 100644 (file)
@@ -741,7 +741,7 @@ void W_Nexball_Attack(float t)
                mi = autocvar_g_nexball_basketball_meter_minpower;
                ma = max(mi, autocvar_g_nexball_basketball_meter_maxpower); // avoid confusion
                //One triangle wave period with 1 as max
-               mul = 2 * mod(t, g_nexball_meter_period) / g_nexball_meter_period;
+               mul = 2 * (t % g_nexball_meter_period) / g_nexball_meter_period;
                if(mul > 1)
                        mul = 2 - mul;
                mul = mi + (ma - mi) * mul; // range from the minimal power to the maximal power
index 8cc7d322c4e3a3fedb09346a9f9fe559fb67d137..1c12058d0d9019ee4bb0ae36366a4db58c588c96 100644 (file)
@@ -1178,7 +1178,7 @@ float race_GetFractionalLapCount(entity e)
        // race_timed_checkpoint == 0: then nextcp==0 means 0.9999x
        float c, nc;
        nc = race_highest_checkpoint + 1;
-       c = (mod(nextcpindex - race_timed_checkpoint + nc + nc - 1, nc) + 1) - bestfraction;
+       c = ((nextcpindex - race_timed_checkpoint + nc + nc - 1) % nc) + 1 - bestfraction;
 
        return l + c / nc;
 }
index 029bd8e5b6ed75b293cff51cf67367415b8cdfab..f52b492a7042d520c03c80764ef8b2f75d1258ca 100644 (file)
@@ -188,7 +188,7 @@ void trigger_push_touch()
                                        found = TRUE;
                        if(!found)
                        {
-                               other.(jumppadsused[mod(other.jumppadcount, NUM_JUMPPADSUSED)]) = self;
+                               other.(jumppadsused[other.jumppadcount % NUM_JUMPPADSUSED]) = self;
                                other.jumppadcount = other.jumppadcount + 1;
                        }
 
index d78ae30a29abc7159c1b245d8ed4d81b8b7c9247..c5eb546e8b9695a505522263c0e35644d231aa71 100644 (file)
@@ -494,7 +494,7 @@ float spiderbot_frame()
 
             self = player;
 
-            mod(spider.misc_bulletcounter, 2) ? gun = spider.gun1 : gun = spider.gun2;
+            (spider.misc_bulletcounter % 2) ? gun = spider.gun1 : gun = spider.gun2;
             v = gettaginfo(gun, gettagindex(gun, "barrels"));
             v_forward = normalize(v_forward);
             v += v_forward * 50;
index 8a7f4c5b061d76d93d29984777bc9f4881df60f3..98929b1a1cc2eef95755e6b5b796a56fbfe060d3 100644 (file)
@@ -94,7 +94,7 @@ void accuracy_add(entity e, float w, float fired, float hit)
 
        if(b == accuracy_byte(a.(accuracy_hit[w]), a.(accuracy_fired[w])))
                return;
-       w = pow(2, mod(w, 24));
+       w = pow(2, w % 24);
        a.SendFlags |= w;
        FOR_EACH_CLIENT(a)
                if(IS_SPEC(a))
index 12ffbb9b49bd17d2f5f664bd824dc99f97352767..f7f3cde51230e2af87ee885741e67be068b7473d 100644 (file)
@@ -182,7 +182,7 @@ float W_GetCycleWeapon(entity pl, string weaponorder, float dir, float imp, floa
        if(complain)
        {
                self.weaponcomplainindex += 1;
-               c = mod(self.weaponcomplainindex, c) + 1;
+               c = (self.weaponcomplainindex % c) + 1;
                rest = weaponorder;
                while(rest != "")
                {