//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)
}
string blinkcolor;
- if(mod(time, 1) >= 0.5)
+ if(time % 1 >= 0.5)
blinkcolor = "^1";
else
blinkcolor = "^3";
}
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);
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);\
}\
}
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;
}
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)
+
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);
// 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;
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);
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;
// 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);
}
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);
f2 = 0;
p2 = 1;
- m = mod(e.note, Tuba_PitchStep);
+ m = e.note % Tuba_PitchStep;
if(m)
{
if(e.note - m < TUBA_MIN)
}
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));
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;
{
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"));
// 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);
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;
}
}
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
{
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)));
}
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),
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);
vector f_diff;
float c;
- c = mod(self.bulletcounter, 4);
+ c = self.bulletcounter % 4;
switch(c)
{
case 0:
W_DecreaseAmmo(WEP_CVAR(seeker, flac_ammo));
- c = mod(self.bulletcounter, 4);
+ c = self.bulletcounter % 4;
switch(c)
{
case 0:
oldenemy = self.enemy;
self.enemy = oldself.enemy;
- c = mod(self.cnt, 4);
+ c = self.cnt % 4;
switch(c)
{
case 0:
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)
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));
// 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);
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
}
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"));
}
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);
}
{
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));
}
)
{
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"; }
}
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);
}
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;
WriteByte(MSG_BROADCAST, 0);
WriteByte(MSG_BROADCAST, 0);
}
- self.cnt = mod(self.cnt + 1, maxclients);
+ self.cnt = (self.cnt + 1) % maxclients;
}
void PingPLReport_Spawn()
{
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;
}
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;
}
else
n = tokenizebyseparator(data, "\n");
- if(mod(n, 4) != 0)
+ if((n % 4) != 0)
{
print("error: received invalid item count: ", ftos(n), "\n");
return;
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
}
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
// 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;
}
found = TRUE;
if(!found)
{
- other.(jumppadsused[mod(other.jumppadcount, NUM_JUMPPADSUSED)]) = self;
+ other.(jumppadsused[other.jumppadcount % NUM_JUMPPADSUSED]) = self;
other.jumppadcount = other.jumppadcount + 1;
}
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;
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))
if(complain)
{
self.weaponcomplainindex += 1;
- c = mod(self.weaponcomplainindex, c) + 1;
+ c = (self.weaponcomplainindex % c) + 1;
rest = weaponorder;
while(rest != "")
{