From: TimePath Date: Thu, 25 Dec 2014 11:03:27 +0000 (+1100) Subject: Replace usages of mod() with the operator % X-Git-Tag: xonotic-v0.8.0~44^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=7415ded9c665a49be49f4100555dfee6e0bf01b2;p=xonotic%2Fxonotic-data.pk3dir.git Replace usages of mod() with the operator % --- diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index 7359468e0..28f095487 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -3118,7 +3118,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) @@ -3762,7 +3762,7 @@ void HUD_InfoMessages(void) } string blinkcolor; - if(mod(time, 1) >= 0.5) + if(time % 1 >= 0.5) blinkcolor = "^1"; else blinkcolor = "^3"; @@ -4563,7 +4563,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); diff --git a/qcsrc/client/hud.qh b/qcsrc/client/hud.qh index 55d4bd0db..d56caf133 100644 --- a/qcsrc/client/hud.qh +++ b/qcsrc/client/hud.qh @@ -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);\ }\ diff --git a/qcsrc/client/hud_config.qc b/qcsrc/client/hud_config.qc index 8ecc326b1..047e012ad 100644 --- a/qcsrc/client/hud_config.qc +++ b/qcsrc/client/hud_config.qc @@ -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; } diff --git a/qcsrc/client/mapvoting.qc b/qcsrc/client/mapvoting.qc index a354bacf2..3f30a6a72 100644 --- a/qcsrc/client/mapvoting.qc +++ b/qcsrc/client/mapvoting.qc @@ -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) + diff --git a/qcsrc/client/scoreboard.qc b/qcsrc/client/scoreboard.qc index d1c7fb9f1..fd2ab2481 100644 --- a/qcsrc/client/scoreboard.qc +++ b/qcsrc/client/scoreboard.qc @@ -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); diff --git a/qcsrc/client/tuba.qc b/qcsrc/client/tuba.qc index 38ce1090a..73d72b61e 100644 --- a/qcsrc/client/tuba.qc +++ b/qcsrc/client/tuba.qc @@ -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)); diff --git a/qcsrc/client/waypointsprites.qc b/qcsrc/client/waypointsprites.qc index c99fc5d51..2df3dd411 100644 --- a/qcsrc/client/waypointsprites.qc +++ b/qcsrc/client/waypointsprites.qc @@ -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; diff --git a/qcsrc/common/command/generic.qc b/qcsrc/common/command/generic.qc index 0710726de..743793bad 100644 --- a/qcsrc/common/command/generic.qc +++ b/qcsrc/common/command/generic.qc @@ -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")); diff --git a/qcsrc/common/counting.qh b/qcsrc/common/counting.qh index 1413a8090..0aeabc85e 100644 --- a/qcsrc/common/counting.qh +++ b/qcsrc/common/counting.qh @@ -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); diff --git a/qcsrc/common/urllib.qc b/qcsrc/common/urllib.qc index c69d2f44a..b747a27c4 100644 --- a/qcsrc/common/urllib.qc +++ b/qcsrc/common/urllib.qc @@ -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 { diff --git a/qcsrc/common/util.qc b/qcsrc/common/util.qc index 671c8d5a5..db6f04c62 100644 --- a/qcsrc/common/util.qc +++ b/qcsrc/common/util.qc @@ -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), diff --git a/qcsrc/common/util.qh b/qcsrc/common/util.qh index 49ec62ad3..65b4e67a4 100644 --- a/qcsrc/common/util.qh +++ b/qcsrc/common/util.qh @@ -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); diff --git a/qcsrc/common/weapons/w_fireball.qc b/qcsrc/common/weapons/w_fireball.qc index a5bca22cd..80c453a4d 100644 --- a/qcsrc/common/weapons/w_fireball.qc +++ b/qcsrc/common/weapons/w_fireball.qc @@ -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: diff --git a/qcsrc/common/weapons/w_seeker.qc b/qcsrc/common/weapons/w_seeker.qc index 7d933d5ca..d4c4d3394 100644 --- a/qcsrc/common/weapons/w_seeker.qc +++ b/qcsrc/common/weapons/w_seeker.qc @@ -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: diff --git a/qcsrc/common/weapons/w_tuba.qc b/qcsrc/common/weapons/w_tuba.qc index 5b1789368..e08cf676f 100644 --- a/qcsrc/common/weapons/w_tuba.qc +++ b/qcsrc/common/weapons/w_tuba.qc @@ -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); diff --git a/qcsrc/common/weapons/weapons.qc b/qcsrc/common/weapons/weapons.qc index e45a901c3..4f11fc3ef 100644 --- a/qcsrc/common/weapons/weapons.qc +++ b/qcsrc/common/weapons/weapons.qc @@ -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 diff --git a/qcsrc/server/cheats.qc b/qcsrc/server/cheats.qc index 22b793d39..c1a637514 100644 --- a/qcsrc/server/cheats.qc +++ b/qcsrc/server/cheats.qc @@ -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")); } diff --git a/qcsrc/server/cl_impulse.qc b/qcsrc/server/cl_impulse.qc index 76610f4c3..7446b7022 100644 --- a/qcsrc/server/cl_impulse.qc +++ b/qcsrc/server/cl_impulse.qc @@ -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); } diff --git a/qcsrc/server/command/getreplies.qc b/qcsrc/server/command/getreplies.qc index aadc62958..b77799033 100644 --- a/qcsrc/server/command/getreplies.qc +++ b/qcsrc/server/command/getreplies.qc @@ -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); } diff --git a/qcsrc/server/g_triggers.qc b/qcsrc/server/g_triggers.qc index f203fdf4f..c5fb08c96 100644 --- a/qcsrc/server/g_triggers.qc +++ b/qcsrc/server/g_triggers.qc @@ -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; diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index 12118a2ff..0fd5d2de3 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -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; } diff --git a/qcsrc/server/ipban.qc b/qcsrc/server/ipban.qc index a180547c0..d3d7fdca6 100644 --- a/qcsrc/server/ipban.qc +++ b/qcsrc/server/ipban.qc @@ -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; diff --git a/qcsrc/server/mutators/gamemode_keyhunt.qc b/qcsrc/server/mutators/gamemode_keyhunt.qc index 0512fe3f0..7b3ea98af 100644 --- a/qcsrc/server/mutators/gamemode_keyhunt.qc +++ b/qcsrc/server/mutators/gamemode_keyhunt.qc @@ -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 } diff --git a/qcsrc/server/mutators/gamemode_nexball.qc b/qcsrc/server/mutators/gamemode_nexball.qc index 392caa037..346ae1eee 100644 --- a/qcsrc/server/mutators/gamemode_nexball.qc +++ b/qcsrc/server/mutators/gamemode_nexball.qc @@ -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 diff --git a/qcsrc/server/race.qc b/qcsrc/server/race.qc index 8cc7d322c..1c12058d0 100644 --- a/qcsrc/server/race.qc +++ b/qcsrc/server/race.qc @@ -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; } diff --git a/qcsrc/server/t_jumppads.qc b/qcsrc/server/t_jumppads.qc index 029bd8e5b..f52b492a7 100644 --- a/qcsrc/server/t_jumppads.qc +++ b/qcsrc/server/t_jumppads.qc @@ -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; } diff --git a/qcsrc/server/vehicles/spiderbot.qc b/qcsrc/server/vehicles/spiderbot.qc index d78ae30a2..c5eb546e8 100644 --- a/qcsrc/server/vehicles/spiderbot.qc +++ b/qcsrc/server/vehicles/spiderbot.qc @@ -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; diff --git a/qcsrc/server/weapons/accuracy.qc b/qcsrc/server/weapons/accuracy.qc index 8a7f4c5b0..98929b1a1 100644 --- a/qcsrc/server/weapons/accuracy.qc +++ b/qcsrc/server/weapons/accuracy.qc @@ -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)) diff --git a/qcsrc/server/weapons/selection.qc b/qcsrc/server/weapons/selection.qc index 12ffbb9b4..f7f3cde51 100644 --- a/qcsrc/server/weapons/selection.qc +++ b/qcsrc/server/weapons/selection.qc @@ -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 != "") {