From: Mario Date: Sat, 19 Nov 2016 14:54:07 +0000 (+1000) Subject: Rename a few parameters and locals named x, y, z X-Git-Tag: xonotic-v0.8.2~428 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=a394baa72a77a2db64709e44caa89a6fb4aaf5f4;hp=e7cd5c6fecdcdbefe35f35b29737b51784dff852 Rename a few parameters and locals named x, y, z --- diff --git a/qcsrc/client/hud/hud.qc b/qcsrc/client/hud/hud.qc index c89fe08bc4..ee94af7270 100644 --- a/qcsrc/client/hud/hud.qc +++ b/qcsrc/client/hud/hud.qc @@ -22,34 +22,34 @@ Misc HUD functions ================== */ -vector HUD_Get_Num_Color (float x, float maxvalue) +vector HUD_Get_Num_Color (float hp, float maxvalue) { float blinkingamt; vector color; - if(x >= maxvalue) { + if(hp >= maxvalue) { color.x = sin(2*M_PI*time); color.y = 1; color.z = sin(2*M_PI*time); } - else if(x > maxvalue * 0.75) { - color.x = 0.4 - (x-150)*0.02 * 0.4; //red value between 0.4 -> 0 - color.y = 0.9 + (x-150)*0.02 * 0.1; // green value between 0.9 -> 1 + else if(hp > maxvalue * 0.75) { + color.x = 0.4 - (hp-150)*0.02 * 0.4; //red value between 0.4 -> 0 + color.y = 0.9 + (hp-150)*0.02 * 0.1; // green value between 0.9 -> 1 color.z = 0; } - else if(x > maxvalue * 0.5) { - color.x = 1 - (x-100)*0.02 * 0.6; //red value between 1 -> 0.4 - color.y = 1 - (x-100)*0.02 * 0.1; // green value between 1 -> 0.9 - color.z = 1 - (x-100)*0.02; // blue value between 1 -> 0 + else if(hp > maxvalue * 0.5) { + color.x = 1 - (hp-100)*0.02 * 0.6; //red value between 1 -> 0.4 + color.y = 1 - (hp-100)*0.02 * 0.1; // green value between 1 -> 0.9 + color.z = 1 - (hp-100)*0.02; // blue value between 1 -> 0 } - else if(x > maxvalue * 0.25) { + else if(hp > maxvalue * 0.25) { color.x = 1; color.y = 1; - color.z = 0.2 + (x-50)*0.02 * 0.8; // blue value between 0.2 -> 1 + color.z = 0.2 + (hp-50)*0.02 * 0.8; // blue value between 0.2 -> 1 } - else if(x > maxvalue * 0.1) { + else if(hp > maxvalue * 0.1) { color.x = 1; - color.y = (x-20)*90/27/100; // green value between 0 -> 1 - color.z = (x-20)*90/27/100 * 0.2; // blue value between 0 -> 0.2 + color.y = (hp-20)*90/27/100; // green value between 0 -> 1 + color.z = (hp-20)*90/27/100 * 0.2; // blue value between 0 -> 0.2 } else { color.x = 1; @@ -57,7 +57,7 @@ vector HUD_Get_Num_Color (float x, float maxvalue) color.z = 0; } - blinkingamt = (1 - x/maxvalue/0.25); + blinkingamt = (1 - hp/maxvalue/0.25); if(blinkingamt > 0) { color.x = color.x - color.x * blinkingamt * sin(2*M_PI*time); @@ -303,7 +303,7 @@ void HUD_Panel_DrawHighlight(vector pos, vector mySize, vector color, float theA drawsubpic(pos + eX * mySize.x - eX * min(mySize.x * 0.5, mySize.y), eX * min(mySize.x * 0.5, mySize.y) + eY * mySize.y, pic, '0.75 0 0', '0.25 1 0', color, theAlpha, drawflag); } -void DrawNumIcon_expanding(vector myPos, vector mySize, float x, string icon, bool vertical, int icon_right_align, vector color, float theAlpha, float fadelerp) +void DrawNumIcon_expanding(vector myPos, vector mySize, float theTime, string icon, bool vertical, int icon_right_align, vector color, float theAlpha, float fadelerp) { TC(bool, vertical); TC(int, icon_right_align); vector newPos = '0 0 0', newSize = '0 0 0'; @@ -345,7 +345,7 @@ void DrawNumIcon_expanding(vector myPos, vector mySize, float x, string icon, bo // reduce only y to draw numbers with different number of digits with the same y size numpos.y += newSize.y * ((1 - 0.7) / 2); newSize.y *= 0.7; - drawstring_aspect(numpos, ftos(x), newSize, color, panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL); + drawstring_aspect(numpos, ftos(theTime), newSize, color, panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL); return; } @@ -379,14 +379,14 @@ void DrawNumIcon_expanding(vector myPos, vector mySize, float x, string icon, bo // NOTE: newSize_x is always equal to 3 * mySize_y so we can use // '2 1 0' * newSize_y instead of eX * (2/3) * newSize_x + eY * newSize_y - drawstring_aspect_expanding(numpos, ftos(x), '2 1 0' * newSize.y, color, panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL, fadelerp); + drawstring_aspect_expanding(numpos, ftos(theTime), '2 1 0' * newSize.y, color, panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL, fadelerp); drawpic_aspect_skin_expanding(picpos, icon, '1 1 0' * newSize.y, '1 1 1', panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL, fadelerp); } -void DrawNumIcon(vector myPos, vector mySize, float x, string icon, bool vertical, int icon_right_align, vector color, float theAlpha) +void DrawNumIcon(vector myPos, vector mySize, float theTime, string icon, bool vertical, int icon_right_align, vector color, float theAlpha) { TC(bool, vertical); TC(int, icon_right_align); - DrawNumIcon_expanding(myPos, mySize, x, icon, vertical, icon_right_align, color, theAlpha, 0); + DrawNumIcon_expanding(myPos, mySize, theTime, icon, vertical, icon_right_align, color, theAlpha, 0); } /* diff --git a/qcsrc/client/hud/hud.qh b/qcsrc/client/hud/hud.qh index 4cd0ee88e3..06a3491145 100644 --- a/qcsrc/client/hud/hud.qh +++ b/qcsrc/client/hud/hud.qh @@ -48,9 +48,9 @@ float HUD_Radar_InputEvent(float bInputType, float nPrimary, float nSecondary); void HUD_Radar_Hide_Maximized(); float HUD_GetRowCount(int item_count, vector size, float item_aspect); -vector HUD_Get_Num_Color (float x, float maxvalue); -void DrawNumIcon(vector myPos, vector mySize, float x, string icon, bool vertical, bool icon_right_align, vector color, float theAlpha); -void DrawNumIcon_expanding(vector myPos, vector mySize, float x, string icon, bool vertical, int icon_right_align, vector color, float theAlpha, float fadelerp); +vector HUD_Get_Num_Color (float hp, float maxvalue); +void DrawNumIcon(vector myPos, vector mySize, float theTime, string icon, bool vertical, bool icon_right_align, vector color, float theAlpha); +void DrawNumIcon_expanding(vector myPos, vector mySize, float theTime, string icon, bool vertical, int icon_right_align, vector color, float theAlpha, float fadelerp); void HUD_Panel_DrawHighlight(vector pos, vector mySize, vector color, float theAlpha, int drawflag); vector HUD_GetTableSize_BestItemAR(int item_count, vector psize, float item_aspect); diff --git a/qcsrc/client/hud/panel/healtharmor.qc b/qcsrc/client/hud/panel/healtharmor.qc index 7f5e4c1709..4fad2c7c43 100644 --- a/qcsrc/client/hud/panel/healtharmor.qc +++ b/qcsrc/client/hud/panel/healtharmor.qc @@ -86,8 +86,7 @@ void HUD_HealthArmor() vector v; v = healtharmor_maxdamage(health, armor, armorblockpercent, DEATH_WEAPON.m_id); - float x; - x = floor(v.x + 1); + float hp = floor(v.x + 1); float maxtotal = maxhealth + maxarmor; string biggercount; @@ -95,7 +94,7 @@ void HUD_HealthArmor() { biggercount = "health"; if(autocvar_hud_panel_healtharmor_progressbar) - HUD_Panel_DrawProgressBar(pos, mySize, autocvar_hud_panel_healtharmor_progressbar_health, x/maxtotal, 0, (baralign == 1 || baralign == 2), autocvar_hud_progressbar_health_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL); + HUD_Panel_DrawProgressBar(pos, mySize, autocvar_hud_panel_healtharmor_progressbar_health, hp/maxtotal, 0, (baralign == 1 || baralign == 2), autocvar_hud_progressbar_health_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL); if(armor) if(autocvar_hud_panel_healtharmor_text) drawpic_aspect_skin(pos + eX * mySize.x - eX * 0.5 * mySize.y, "armor", '0.5 0.5 0' * mySize.y, '1 1 1', panel_fg_alpha * armor / health, DRAWFLAG_NORMAL); @@ -104,13 +103,13 @@ void HUD_HealthArmor() { biggercount = "armor"; if(autocvar_hud_panel_healtharmor_progressbar) - HUD_Panel_DrawProgressBar(pos, mySize, autocvar_hud_panel_healtharmor_progressbar_armor, x/maxtotal, 0, (baralign == 1 || baralign == 2), autocvar_hud_progressbar_armor_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL); + HUD_Panel_DrawProgressBar(pos, mySize, autocvar_hud_panel_healtharmor_progressbar_armor, hp/maxtotal, 0, (baralign == 1 || baralign == 2), autocvar_hud_progressbar_armor_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL); if(health) if(autocvar_hud_panel_healtharmor_text) drawpic_aspect_skin(pos + eX * mySize.x - eX * 0.5 * mySize.y, "health", '0.5 0.5 0' * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); } if(autocvar_hud_panel_healtharmor_text) - DrawNumIcon(pos, mySize, x, biggercount, 0, iconalign, HUD_Get_Num_Color(x, maxtotal), 1); + DrawNumIcon(pos, mySize, hp, biggercount, 0, iconalign, HUD_Get_Num_Color(hp, maxtotal), 1); if(fuel) HUD_Panel_DrawProgressBar(pos, eX * mySize.x + eY * 0.2 * mySize.y, "progressbar", fuel/100, 0, (baralign == 1 || baralign == 3), autocvar_hud_progressbar_fuel_color, panel_fg_alpha * 0.8, DRAWFLAG_NORMAL); diff --git a/qcsrc/client/miscfunctions.qc b/qcsrc/client/miscfunctions.qc index 0e88cd5a51..a0d7b8789c 100644 --- a/qcsrc/client/miscfunctions.qc +++ b/qcsrc/client/miscfunctions.qc @@ -389,15 +389,15 @@ void PolyDrawModel(entity e) void DrawCircleClippedPic(vector centre, float radi, string pic, float f, vector rgb, float a, float drawflag) { - float x, y, q, d; + float d; vector ringsize, v, t; ringsize = radi * '1 1 0'; - x = cos(f * 2 * M_PI); - y = sin(f * 2 * M_PI); - q = fabs(x) + fabs(y); - x /= q; - y /= q; + float co = cos(f * 2 * M_PI); + float si = sin(f * 2 * M_PI); + float q = fabs(co) + fabs(si); + co /= q; + si /= q; if(f >= 1) { @@ -530,8 +530,8 @@ void DrawCircleClippedPic(vector centre, float radi, string pic, float f, vector if(d > 0) { v = centre; t = '0.5 0.5 0'; - v.x += x * 0.5 * ringsize.x; t += x * '0.5 0.5 0'; - v.y += y * 0.5 * ringsize.y; t += y * '0.5 -0.5 0'; + v.x += co * 0.5 * ringsize.x; t += co * '0.5 0.5 0'; + v.y += si * 0.5 * ringsize.y; t += si * '0.5 -0.5 0'; R_PolygonVertex(v, t, rgb, a); R_EndPolygon(); } diff --git a/qcsrc/client/teamradar.qc b/qcsrc/client/teamradar.qc index 9c4544bba0..abd700e613 100644 --- a/qcsrc/client/teamradar.qc +++ b/qcsrc/client/teamradar.qc @@ -49,12 +49,12 @@ vector teamradar_2dcoord_to_texcoord(vector in) return out; } -vector teamradar_texcoord_to_3dcoord(vector in,float z) +vector teamradar_texcoord_to_3dcoord(vector in,float oz) { vector out; out_x = in_x * (mi_picmax_x - mi_picmin_x) + mi_picmin_x; out_y = in_y * (mi_picmax_y - mi_picmin_y) + mi_picmin_y; - out_z = z; + out_z = oz; return out; } diff --git a/qcsrc/client/teamradar.qh b/qcsrc/client/teamradar.qh index 0b1884ccf3..251c1a53f1 100644 --- a/qcsrc/client/teamradar.qh +++ b/qcsrc/client/teamradar.qh @@ -32,7 +32,7 @@ vector teamradar_3dcoord_to_texcoord(vector in); vector teamradar_texcoord_to_2dcoord(vector in); -vector teamradar_texcoord_to_3dcoord(vector in,float z); +vector teamradar_texcoord_to_3dcoord(vector in,float oz); void draw_teamradar_background(float fg); diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index 12f4c6a1d0..a3bc0462e3 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -826,8 +826,8 @@ void HitSound() float a = autocvar_cl_hitsound_max_pitch; float b = autocvar_cl_hitsound_min_pitch; float c = autocvar_cl_hitsound_nom_damage; - float x = unaccounted_damage; - float pitch_shift = (b*x*(a-1) + a*c*(1-b)) / (x*(a-1) + c*(1-b)); + float d = unaccounted_damage; + float pitch_shift = (b*d*(a-1) + a*c*(1-b)) / (d*(a-1) + c*(1-b)); // if sound variation is disabled, set pitch_shift to 1 if (autocvar_cl_hitsound == 1) @@ -879,7 +879,7 @@ vector crosshair_getcolor(entity this, float health_stat) case 2: // crosshair_color_by_health { - float x = health_stat; + float hp = health_stat; //x = red //y = green @@ -887,33 +887,33 @@ vector crosshair_getcolor(entity this, float health_stat) wcross_color.z = 0; - if(x > 200) + if(hp > 200) { wcross_color.x = 0; wcross_color.y = 1; } - else if(x > 150) + else if(hp > 150) { - wcross_color.x = 0.4 - (x-150)*0.02 * 0.4; - wcross_color.y = 0.9 + (x-150)*0.02 * 0.1; + wcross_color.x = 0.4 - (hp-150)*0.02 * 0.4; + wcross_color.y = 0.9 + (hp-150)*0.02 * 0.1; } - else if(x > 100) + else if(hp > 100) { - wcross_color.x = 1 - (x-100)*0.02 * 0.6; - wcross_color.y = 1 - (x-100)*0.02 * 0.1; - wcross_color.z = 1 - (x-100)*0.02; + wcross_color.x = 1 - (hp-100)*0.02 * 0.6; + wcross_color.y = 1 - (hp-100)*0.02 * 0.1; + wcross_color.z = 1 - (hp-100)*0.02; } - else if(x > 50) + else if(hp > 50) { wcross_color.x = 1; wcross_color.y = 1; - wcross_color.z = 0.2 + (x-50)*0.02 * 0.8; + wcross_color.z = 0.2 + (hp-50)*0.02 * 0.8; } - else if(x > 20) + else if(hp > 20) { wcross_color.x = 1; - wcross_color.y = (x-20)*90/27/100; - wcross_color.z = (x-20)*90/27/100 * 0.2; + wcross_color.y = (hp-20)*90/27/100; + wcross_color.z = (hp-20)*90/27/100 * 0.2; } else { diff --git a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc index e2647289b7..32c61eb6aa 100644 --- a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc +++ b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc @@ -424,9 +424,9 @@ void buff_Medic_Heal(entity this) }); } -float buff_Inferno_CalculateTime(float x, float offset_x, float offset_y, float intersect_x, float intersect_y, float base) +float buff_Inferno_CalculateTime(float damg, float offset_x, float offset_y, float intersect_x, float intersect_y, float base) { - return offset_y + (intersect_y - offset_y) * logn(((x - offset_x) * ((base - 1) / intersect_x)) + 1, base); + return offset_y + (intersect_y - offset_y) * logn(((damg - offset_x) * ((base - 1) / intersect_x)) + 1, base); } // mutator hooks diff --git a/qcsrc/common/physics/movetypes/movetypes.qc b/qcsrc/common/physics/movetypes/movetypes.qc index 729928bf5b..f0df80cd5d 100644 --- a/qcsrc/common/physics/movetypes/movetypes.qc +++ b/qcsrc/common/physics/movetypes/movetypes.qc @@ -510,9 +510,9 @@ void makevectors_matrix(vector myangles) // AngleVectorsFLU { v_forward = v_right = v_up = '0 0 0'; - float y = myangles.y * (M_PI * 2 / 360); - float sy = sin(y); - float cy = cos(y); + float yy = myangles.y * (M_PI * 2 / 360); + float sy = sin(yy); + float cy = cos(yy); float p = myangles.x * (M_PI * 2 / 360); float sp = sin(p); float cp = cos(p); diff --git a/qcsrc/common/turrets/config.qc b/qcsrc/common/turrets/config.qc index 2b1e00c8a7..68cac08464 100644 --- a/qcsrc/common/turrets/config.qc +++ b/qcsrc/common/turrets/config.qc @@ -28,12 +28,12 @@ float T_Config_Queue_Compare(float root, float child, entity pass) void Dump_Turret_Settings() { - float x, totalsettings = 0; + int totalsettings = 0; FOREACH(Turrets, it != TUR_Null, { // step 1: clear the queue TUR_CONFIG_COUNT = 0; - for(x = 0; x <= MAX_TUR_CONFIG; ++x) - { tur_config_queue[x] = string_null; } + for(int j = 0; j <= MAX_TUR_CONFIG; ++j) + { tur_config_queue[j] = string_null; } // step 2: build new queue it.tr_config(it); @@ -43,8 +43,8 @@ void Dump_Turret_Settings() // step 4: write queue TUR_CONFIG_WRITETOFILE(sprintf("// {{{ #%d: %s\n", i, it.turret_name)) - for(x = 0; x <= TUR_CONFIG_COUNT; ++x) - { TUR_CONFIG_WRITETOFILE(tur_config_queue[x]) } + for(int j = 0; j <= TUR_CONFIG_COUNT; ++j) + { TUR_CONFIG_WRITETOFILE(tur_config_queue[j]) } TUR_CONFIG_WRITETOFILE("// }}}\n") // step 5: debug info @@ -54,8 +54,8 @@ void Dump_Turret_Settings() // clear queue now that we're finished TUR_CONFIG_COUNT = 0; - for(x = 0; x <= MAX_TUR_CONFIG; ++x) - { tur_config_queue[x] = string_null; } + for(int j = 0; j <= MAX_TUR_CONFIG; ++j) + { tur_config_queue[j] = string_null; } // extra information LOG_INFO(sprintf("Totals: %d turrets, %d settings\n", (Turrets_COUNT - 1), totalsettings)); diff --git a/qcsrc/common/util.qc b/qcsrc/common/util.qc index 87636d24e8..d83871080d 100644 --- a/qcsrc/common/util.qc +++ b/qcsrc/common/util.qc @@ -228,13 +228,13 @@ string ScoreString(int pFlags, float pValue) float lengthLogTable[128]; -float invertLengthLog(float x) +float invertLengthLog(float dist) { int l, r, m; - if(x >= lengthLogTable[127]) + if(dist >= lengthLogTable[127]) return 127; - if(x <= lengthLogTable[0]) + if(dist <= lengthLogTable[0]) return 0; l = 0; @@ -243,15 +243,15 @@ float invertLengthLog(float x) while(r - l > 1) { m = floor((l + r) / 2); - if(lengthLogTable[m] < x) + if(lengthLogTable[m] < dist) l = m; else r = m; } // now: r is >=, l is < - float lerr = (x - lengthLogTable[l]); - float rerr = (lengthLogTable[r] - x); + float lerr = (dist - lengthLogTable[l]); + float rerr = (lengthLogTable[r] - dist); if(lerr < rerr) return l; return r; @@ -263,26 +263,26 @@ vector decompressShortVector(int data) if(data == 0) return '0 0 0'; float p = (data & 0xF000) / 0x1000; - float y = (data & 0x0F80) / 0x80; + float q = (data & 0x0F80) / 0x80; int len = (data & 0x007F); - //print("\ndecompress: p ", ftos(p)); print("y ", ftos(y)); print("len ", ftos(len), "\n"); + //print("\ndecompress: p ", ftos(p)); print("q ", ftos(q)); print("len ", ftos(len), "\n"); if(p == 0) { out.x = 0; out.y = 0; - if(y == 31) + if(q == 31) out.z = -1; else out.z = +1; } else { - y = .19634954084936207740 * y; + q = .19634954084936207740 * q; p = .19634954084936207740 * p - 1.57079632679489661922; - out.x = cos(y) * cos(p); - out.y = sin(y) * cos(p); + out.x = cos(q) * cos(p); + out.y = sin(q) * cos(p); out.z = -sin(p); } @@ -1073,26 +1073,25 @@ vector get_shotvelocity(vector myvel, vector mydir, float spd, float newton_styl float compressShotOrigin(vector v) { - float x, y, z; - x = rint(v.x * 2); - y = rint(v.y * 4) + 128; - z = rint(v.z * 4) + 128; - if(x > 255 || x < 0) + float rx = rint(v.x * 2); + float ry = rint(v.y * 4) + 128; + float rz = rint(v.z * 4) + 128; + if(rx > 255 || rx < 0) { LOG_INFO("shot origin ", vtos(v), " x out of bounds\n"); - x = bound(0, x, 255); + rx = bound(0, rx, 255); } - if(y > 255 || y < 0) + if(ry > 255 || ry < 0) { LOG_INFO("shot origin ", vtos(v), " y out of bounds\n"); - y = bound(0, y, 255); + ry = bound(0, ry, 255); } - if(z > 255 || z < 0) + if(rz > 255 || rz < 0) { LOG_INFO("shot origin ", vtos(v), " z out of bounds\n"); - z = bound(0, z, 255); + rz = bound(0, rz, 255); } - return x * 0x10000 + y * 0x100 + z; + return rx * 0x10000 + ry * 0x100 + rz; } vector decompressShotOrigin(int f) { diff --git a/qcsrc/common/util.qh b/qcsrc/common/util.qh index 57f9a2217c..05e4a4ea27 100644 --- a/qcsrc/common/util.qh +++ b/qcsrc/common/util.qh @@ -103,7 +103,7 @@ float almost_equals(float a, float b); float almost_in_bounds(float a, float b, float c); float power2of(float e); -float log2of(float x); +float log2of(float e); vector rgb_to_hsl(vector rgb); vector hsl_to_rgb(vector hsl); @@ -238,7 +238,7 @@ void queue_to_execute_next_frame(string s); // f(1) = 1 // f'(0) = startspeedfactor // f'(1) = endspeedfactor -float cubic_speedfunc(float startspeedfactor, float endspeedfactor, float x); +float cubic_speedfunc(float startspeedfactor, float endspeedfactor, float spd); // checks whether f'(x) = 0 anywhere from 0 to 1 // because if this is the case, the function is not usable for platforms diff --git a/qcsrc/lib/math.qh b/qcsrc/lib/math.qh index feb7a82474..92d45bf142 100644 --- a/qcsrc/lib/math.qh +++ b/qcsrc/lib/math.qh @@ -82,12 +82,12 @@ vector bezier_quadratic_getderivative(vector a, vector b, vector c, float t) + (b - a) * 2; } -float cubic_speedfunc(float startspeedfactor, float endspeedfactor, float x) +float cubic_speedfunc(float startspeedfactor, float endspeedfactor, float spd) { return (((startspeedfactor + endspeedfactor - 2 - ) * x - 2 * startspeedfactor - endspeedfactor + 3 - ) * x + startspeedfactor - ) * x; + ) * spd - 2 * startspeedfactor - endspeedfactor + 3 + ) * spd + startspeedfactor + ) * spd; } bool cubic_speedfunc_is_sane(float startspeedfactor, float endspeedfactor) @@ -195,54 +195,54 @@ float power2of(float e) return pow(2, e); } -float log2of(float x) +float log2of(float e) { // NOTE: generated code - if (x > 2048) - if (x > 131072) - if (x > 1048576) - if (x > 4194304) return 23; + if (e > 2048) + if (e > 131072) + if (e > 1048576) + if (e > 4194304) return 23; else - if (x > 2097152) return 22; + if (e > 2097152) return 22; else return 21; else - if (x > 524288) return 20; + if (e > 524288) return 20; else - if (x > 262144) return 19; + if (e > 262144) return 19; else return 18; else - if (x > 16384) - if (x > 65536) return 17; + if (e > 16384) + if (e > 65536) return 17; else - if (x > 32768) return 16; + if (e > 32768) return 16; else return 15; else - if (x > 8192) return 14; + if (e > 8192) return 14; else - if (x > 4096) return 13; + if (e > 4096) return 13; else return 12; else - if (x > 32) - if (x > 256) - if (x > 1024) return 11; + if (e > 32) + if (e > 256) + if (e > 1024) return 11; else - if (x > 512) return 10; + if (e > 512) return 10; else return 9; else - if (x > 128) return 8; + if (e > 128) return 8; else - if (x > 64) return 7; + if (e > 64) return 7; else return 6; else - if (x > 4) - if (x > 16) return 5; + if (e > 4) + if (e > 16) return 5; else - if (x > 8) return 4; + if (e > 8) return 4; else return 3; else - if (x > 2) return 2; + if (e > 2) return 2; else - if (x > 1) return 1; + if (e > 1) return 1; else return 0; } diff --git a/qcsrc/lib/warpzone/mathlib.qc b/qcsrc/lib/warpzone/mathlib.qc index ac3b65ff1a..868724fa86 100644 --- a/qcsrc/lib/warpzone/mathlib.qc +++ b/qcsrc/lib/warpzone/mathlib.qc @@ -4,174 +4,173 @@ #elif defined(SVQC) #endif -int fpclassify(float x) +int fpclassify(float e) { - if(isnan(x)) + if(isnan(e)) return FP_NAN; - if(isinf(x)) + if(isinf(e)) return FP_INFINITE; - if(x == 0) + if(e == 0) return FP_ZERO; return FP_NORMAL; } -bool isfinite(float x) +bool isfinite(float e) { - return !(isnan(x) || isinf(x)); + return !(isnan(e) || isinf(e)); } -bool isinf(float x) +bool isinf(float e) { - return (x != 0) && (x + x == x); + return (e != 0) && (e + e == e); } -bool isnan(float x) +bool isnan(float e) { - float y; - y = x; - return (x != y); + float f = e; + return (e != f); } -bool isnormal(float x) +bool isnormal(float e) { - return isfinite(x); + return isfinite(e); } -bool signbit(float x) +bool signbit(float e) { - return (x < 0); + return (e < 0); } -float acosh(float x) +float acosh(float e) { - return log(x + sqrt(x*x - 1)); + return log(e + sqrt(e*e - 1)); } -float asinh(float x) +float asinh(float e) { - return log(x + sqrt(x*x + 1)); + return log(e + sqrt(e*e + 1)); } -float atanh(float x) +float atanh(float e) { - return 0.5 * log((1+x) / (1-x)); + return 0.5 * log((1+e) / (1-e)); } -float cosh(float x) +float cosh(float e) { - return 0.5 * (exp(x) + exp(-x)); + return 0.5 * (exp(e) + exp(-e)); } -float sinh(float x) +float sinh(float e) { - return 0.5 * (exp(x) - exp(-x)); + return 0.5 * (exp(e) - exp(-e)); } -float tanh(float x) +float tanh(float e) { - return sinh(x) / cosh(x); + return sinh(e) / cosh(e); } -float exp(float x) +float exp(float e) { - return pow(M_E, x); + return pow(M_E, e); } -float exp2(float x) +float exp2(float e) { - return pow(2, x); + return pow(2, e); } -float expm1(float x) +float expm1(float e) { - return exp(x) - 1; + return exp(e) - 1; } -vector frexp(float x) +vector frexp(float e) { vector v; v.z = 0; - v.y = ilogb(x) + 1; - v.x = x / exp2(v.y); + v.y = ilogb(e) + 1; + v.x = e / exp2(v.y); return v; } -int ilogb(float x) +int ilogb(float e) { - return floor(log2(fabs(x))); + return floor(log2(fabs(e))); } -float ldexp(float x, int e) +float ldexp(float e, int e) { - return x * pow(2, e); + return e * pow(2, e); } -float logn(float x, float base) +float logn(float e, float base) { - return log(x) / log(base); + return log(e) / log(base); } -float log10(float x) +float log10(float e) { - return log(x) * M_LOG10E; + return log(e) * M_LOG10E; } -float log1p(float x) +float log1p(float e) { - return log(x + 1); + return log(e + 1); } -float log2(float x) +float log2(float e) { - return log(x) * M_LOG2E; + return log(e) * M_LOG2E; } -float logb(float x) +float logb(float e) { - return floor(log2(fabs(x))); + return floor(log2(fabs(e))); } vector modf(float f) { return '1 0 0' * (f - trunc(f)) + '0 1 0' * trunc(f); } -float scalbn(float x, int n) +float scalbn(float e, int n) { - return x * pow(2, n); + return e * pow(2, n); } -float cbrt(float x) +float cbrt(float e) { - return copysign(pow(fabs(x), 1.0/3.0), x); + return copysign(pow(fabs(e), 1.0/3.0), e); } -float hypot(float x, float y) +float hypot(float e, float f) { - return sqrt(x*x + y*y); + return sqrt(e*e + f*f); } -float erf(float x) +float erf(float e) { // approximation taken from wikipedia - float y; - y = x*x; - return copysign(sqrt(1 - exp(-y * (1.273239544735163 + 0.14001228868667 * y) / (1 + 0.14001228868667 * y))), x); + float f; + f = e*e; + return copysign(sqrt(1 - exp(-f * (1.273239544735163 + 0.14001228868667 * f) / (1 + 0.14001228868667 * f))), e); } -float erfc(float x) +float erfc(float e) { - return 1.0 - erf(x); + return 1.0 - erf(e); } -vector lgamma(float x) +vector lgamma(float e) { // TODO improve accuracy - if(!isfinite(x)) - return fabs(x) * '1 0 0' + copysign(1, x) * '0 1 0'; - if(x < 1 && x == floor(x)) + if(!isfinite(e)) + return fabs(e) * '1 0 0' + copysign(1, e) * '0 1 0'; + if(e < 1 && e == floor(e)) return nan("gamma") * '1 1 1'; - if(x < 0.1) + if(e < 0.1) { vector v; - v = lgamma(1.0 - x); + v = lgamma(1.0 - e); // reflection formula: // gamma(1-z) * gamma(z) = pi / sin(pi*z) // lgamma(1-z) + lgamma(z) = log(pi) - log(sin(pi*z)) // sign of gamma(1-z) = sign of gamma(z) * sign of sin(pi*z) - v.z = sin(M_PI * x); + v.z = sin(M_PI * e); v.x = log(M_PI) - log(fabs(v.z)) - v.x; if(v.z < 0) v.y = -v.y; v.z = 0; return v; } - if(x < 1.1) - return lgamma(x + 1) - log(x) * '1 0 0'; - x -= 1; - return (0.5 * log(2 * M_PI * x) + x * (log(x) - 1)) * '1 0 0' + '0 1 0'; + if(e < 1.1) + return lgamma(e + 1) - log(e) * '1 0 0'; + e -= 1; + return (0.5 * log(2 * M_PI * e) + e * (log(e) - 1)) * '1 0 0' + '0 1 0'; } -float tgamma(float x) +float tgamma(float e) { vector v; - v = lgamma(x); + v = lgamma(e); return exp(v.x) * v.y; } @@ -184,109 +183,109 @@ float tgamma(float x) * 1 % -2 == -1 * -1 % -2 == -1 */ -float pymod(float x, float y) +float pymod(float e, float f) { - return x - y * floor(x / y); + return e - f * floor(e / f); } -float nearbyint(float x) +float nearbyint(float e) { - return rint(x); + return rint(e); } -float trunc(float x) +float trunc(float e) { - return (x>=0) ? floor(x) : ceil(x); + return (e>=0) ? floor(e) : ceil(e); } -float fmod(float x, float y) +float fmod(float e, float f) { - return x - y * trunc(x / y); + return e - f * trunc(e / f); } -float remainder(float x, float y) +float remainder(float e, float f) { - return x - y * rint(x / y); + return e - f * rint(e / f); } -vector remquo(float x, float y) +vector remquo(float e, float f) { vector v; v.z = 0; - v.y = rint(x / y); - v.x = x - y * v.y; + v.y = rint(e / f); + v.x = e - f * v.y; return v; } -float copysign(float x, float y) +float copysign(float e, float f) { - return fabs(x) * ((y>0) ? 1 : -1); + return fabs(e) * ((f>0) ? 1 : -1); } float nan(string tag) { return sqrt(-1); } -float nextafter(float x, float y) +float nextafter(float e, float f) { // TODO very crude - if(x == y) + if(e == f) return nan("nextafter"); - if(x > y) - return -nextafter(-x, -y); - // now we know that x < y - // so we need the next number > x + if(e > f) + return -nextafter(-e, -f); + // now we know that e < f + // so we need the next number > e float d, a, b; - d = max(fabs(x), 0.00000000000000000000001); - a = x + d; + d = max(fabs(e), 0.00000000000000000000001); + a = e + d; do { d *= 0.5; b = a; - a = x + d; + a = e + d; } - while(a != x); + while(a != e); return b; } -float nexttoward(float x, float y) +float nexttoward(float e, float f) { - return nextafter(x, y); + return nextafter(e, f); } -float fdim(float x, float y) +float fdim(float e, float f) { - return max(x-y, 0); + return max(e-f, 0); } -float fmax(float x, float y) +float fmax(float e, float f) { - return max(x, y); + return max(e, f); } -float fmin(float x, float y) +float fmin(float e, float f) { - return min(x, y); + return min(e, f); } -float fma(float x, float y, float z) +float fma(float e, float f, float g) { - return x * y + z; + return e * f + g; } -int isgreater(float x, float y) +int isgreater(float e, float f) { - return x > y; + return e > f; } -int isgreaterequal(float x, float y) +int isgreaterequal(float e, float f) { - return x >= y; + return e >= f; } -int isless(float x, float y) +int isless(float e, float f) { - return x < y; + return e < f; } -int islessequal(float x, float y) +int islessequal(float e, float f) { - return x <= y; + return e <= f; } -int islessgreater(float x, float y) +int islessgreater(float e, float f) { - return x < y || x > y; + return e < f || e > f; } -int isunordered(float x, float y) +int isunordered(float e, float f) { - return !(x < y || x == y || x > y); + return !(e < f || e == f || e > f); } diff --git a/qcsrc/lib/warpzone/mathlib.qh b/qcsrc/lib/warpzone/mathlib.qh index 2b35c92f84..f5d8f63e74 100644 --- a/qcsrc/lib/warpzone/mathlib.qh +++ b/qcsrc/lib/warpzone/mathlib.qh @@ -10,55 +10,55 @@ const int FP_INFINITE = 1; const int FP_ZERO = 2; const int FP_SUBNORMAL = 3; const int FP_NORMAL = 4; -int fpclassify(float x); -bool isfinite(float x); -bool isinf(float x); -bool isnan(float x); -bool isnormal(float x); -bool signbit(float x); - -//float acos(float x); -//float asin(float x); -//float atan(float x); -//float atan2(float y, float x); -//float cos(float x); -//float sin(float x); -//float tan(float x); - -float acosh(float x); -float asinh(float x); -float atanh(float x); -float cosh(float x); -float sinh(float x); -float tanh(float x); - -float exp(float x); -float exp2(float x); -float expm1(float x); - -vector frexp(float x); // returns mantissa as _x, exponent as _y -int ilogb(float x); -float ldexp(float x, int e); -//float log(float x); -float logn(float x, float base); -float log10(float x); -float log1p(float x); -float log2(float x); -float logb(float x); +int fpclassify(float e); +bool isfinite(float e); +bool isinf(float e); +bool isnan(float e); +bool isnormal(float e); +bool signbit(float e); + +//float acos(float e); +//float asin(float e); +//float atan(float e); +//float atan2(float f, float e); +//float cos(float e); +//float sin(float e); +//float tan(float e); + +float acosh(float e); +float asinh(float e); +float atanh(float e); +float cosh(float e); +float sinh(float e); +float tanh(float e); + +float exp(float e); +float exp2(float e); +float expm1(float e); + +vector frexp(float e); // returns mantissa as _x, exponent as _y +int ilogb(float e); +float ldexp(float e, int e); +//float log(float e); +float logn(float e, float base); +float log10(float e); +float log1p(float e); +float log2(float e); +float logb(float e); vector modf(float f); // fraction as _x, integer as _y -float scalbn(float x, int n); +float scalbn(float e, int n); -float cbrt(float x); -//float fabs(float x); -float hypot(float x, float y); -//float pow(float x, float y); -//float sqrt(float x, float y); +float cbrt(float e); +//float fabs(float e); +float hypot(float e, float f); +//float pow(float e, float f); +//float sqrt(float e, float f); -float erf(float x); -float erfc(float x); -vector lgamma(float x); // value in _x, sign in _y -float tgamma(float x); +float erf(float e); +float erfc(float e); +vector lgamma(float e); // value in _x, sign in _y +float tgamma(float e); /** * Pythonic mod: @@ -69,35 +69,35 @@ float tgamma(float x); * 1 % -2 == -1 * -1 % -2 == -1 */ -float pymod(float x, float y); +float pymod(float e, float f); -//float ceil(float x); -//float floor(float x); -float nearbyint(float x); -//float rint(float x); -//float round(float x); -float trunc(float x); +//float ceil(float e); +//float floor(float e); +float nearbyint(float e); +//float rint(float e); +//float round(float e); +float trunc(float e); -float fmod(float x, float y); -float remainder(float x, float y); -vector remquo(float x, float y); +float fmod(float e, float f); +float remainder(float e, float f); +vector remquo(float e, float f); -float copysign(float x, float y); +float copysign(float e, float f); float nan(string tag); -float nextafter(float x, float y); -float nexttoward(float x, float y); - -float fdim(float x, float y); -float fmax(float x, float y); -float fmin(float x, float y); -float fma(float x, float y, float z); - -int isgreater(float x, float y); -int isgreaterequal(float x, float y); -int isless(float x, float y); -int islessequal(float x, float y); -int islessgreater(float x, float y); -int isunordered(float x, float y); +float nextafter(float e, float f); +float nexttoward(float e, float f); + +float fdim(float e, float f); +float fmax(float e, float f); +float fmin(float e, float f); +float fma(float e, float f, float g); + +int isgreater(float e, float f); +int isgreaterequal(float e, float f); +int isless(float e, float f); +int islessequal(float e, float f); +int islessgreater(float e, float f); +int isunordered(float e, float f); const float M_E = 2.7182818284590452354; /* e */ const float M_LOG2E = 1.4426950408889634074; /* log_2 e */ diff --git a/qcsrc/menu/item/image.qc b/qcsrc/menu/item/image.qc index 06ac91f025..59405ec169 100644 --- a/qcsrc/menu/item/image.qc +++ b/qcsrc/menu/item/image.qc @@ -137,13 +137,13 @@ } return 1; } - void Image_setZoom(entity me, float z, float atMousePosition) + void Image_setZoom(entity me, float newzoom, float atMousePosition) { float prev_zoomFactor; prev_zoomFactor = me.zoomFactor; - if (z < 0) // multiply by the current zoomFactor (but can also snap to real dimensions or to box) + if (newzoom < 0) // multiply by the current zoomFactor (but can also snap to real dimensions or to box) { - me.zoomFactor *= -z; + me.zoomFactor *= -newzoom; float realSize_in_the_middle, boxSize_in_the_middle; realSize_in_the_middle = ((prev_zoomFactor - 1) * (me.zoomFactor - 1) < 0); boxSize_in_the_middle = (me.zoomBox > 0 && (prev_zoomFactor - me.zoomBox) * (me.zoomFactor - me.zoomBox) < 0); @@ -162,14 +162,14 @@ me.zoomFactor = me.zoomBox; // snap to box } } - else if (z == 0) // reset (no zoom) + else if (newzoom == 0) // reset (no zoom) { if (me.zoomBox > 0) me.zoomFactor = me.zoomBox; else me.zoomFactor = 1; } else // directly set { - me.zoomFactor = z; + me.zoomFactor = newzoom; } me.zoomFactor = bound(1 / 16, me.zoomFactor, 16); if (me.zoomMax > 0 && me.zoomFactor > me.zoomMax) me.zoomFactor = me.zoomMax; diff --git a/qcsrc/menu/item/listbox.qc b/qcsrc/menu/item/listbox.qc index d9d63ab8c5..aa10c20b3b 100644 --- a/qcsrc/menu/item/listbox.qc +++ b/qcsrc/menu/item/listbox.qc @@ -379,17 +379,16 @@ oldshift = draw_shift; oldscale = draw_scale; - float y; i = me.getItemAtPos(me, me.scrollPos); - y = me.getItemStart(me, i) - me.scrollPos; - for ( ; i < me.nItems && y < 1; ++i) + float j = me.getItemStart(me, i) - me.scrollPos; + for ( ; i < me.nItems && j < 1; ++i) { - draw_shift = boxToGlobal(eY * y, oldshift, oldscale); + draw_shift = boxToGlobal(eY * j, oldshift, oldscale); vector relSize = eX * (1 - me.controlWidth) + eY * me.getItemHeight(me, i); absSize = boxToGlobalSize(relSize, me.size); draw_scale = boxToGlobalSize(relSize, oldscale); me.drawListBoxItem(me, i, absSize, (me.selectedItem == i), (me.focusedItem == i)); - y += relSize.y; + j += relSize.y; } draw_ClearClip(); diff --git a/qcsrc/menu/xonotic/checkbox.qc b/qcsrc/menu/xonotic/checkbox.qc index b863518981..949b01c41d 100644 --- a/qcsrc/menu/xonotic/checkbox.qc +++ b/qcsrc/menu/xonotic/checkbox.qc @@ -2,28 +2,28 @@ entity makeXonoticCheckBox_T(float isInverted, string theCvar, string theText, string theTooltip) { - float y, n; + float m, n; if(isInverted > 1) { n = isInverted - 1; - y = -n; + m = -n; } else if(isInverted < -1) { n = isInverted + 1; - y = -n; + m = -n; } else if(isInverted == 1) { n = 1; - y = 0; + m = 0; } else { n = 0; - y = 1; + m = 1; } - return makeXonoticCheckBoxEx_T(y, n, theCvar, theText, theTooltip); + return makeXonoticCheckBoxEx_T(m, n, theCvar, theText, theTooltip); } entity makeXonoticCheckBox(float isInverted, string theCvar, string theText) { diff --git a/qcsrc/menu/xonotic/screenshotimage.qc b/qcsrc/menu/xonotic/screenshotimage.qc index 82ff4ba7b2..42e168b4b5 100644 --- a/qcsrc/menu/xonotic/screenshotimage.qc +++ b/qcsrc/menu/xonotic/screenshotimage.qc @@ -56,12 +56,11 @@ void XonoticScreenshotImage_draw(entity me) if (time < me.zoomTime + 2) // 1 seconds at full alpha, 1 second fading out { string zoomString; - float z; - z = me.zoomFactor * 100; - if (z - floor(z) == 0) - zoomString = sprintf("%d%%", z); + float myzoom = me.zoomFactor * 100; + if (myzoom - floor(myzoom) == 0) + zoomString = sprintf("%d%%", myzoom); else - zoomString = sprintf("%.2f%%", z); + zoomString = sprintf("%.2f%%", myzoom); theAlpha = (2 - (time - me.zoomTime)); draw_Text('0.05 0.95 0', zoomString, me.realFontSize, '1 1 1', theAlpha, false); } diff --git a/qcsrc/menu/xonotic/serverlist.qc b/qcsrc/menu/xonotic/serverlist.qc index cd3d702ab7..bbb9dcac05 100644 --- a/qcsrc/menu/xonotic/serverlist.qc +++ b/qcsrc/menu/xonotic/serverlist.qc @@ -471,9 +471,8 @@ void XonoticServerList_draw(entity me) // entire list, otherwise there is no way to know which item is first in its category. // binary search method suggested by div - float x; float begin = 0; - for(x = 1; x <= category_ent_count; ++x) { + for(int j = 1; j <= category_ent_count; ++j) { float first = begin; float last = (itemcount - 1); if (first > last) { @@ -482,42 +481,42 @@ void XonoticServerList_draw(entity me) } float catf = gethostcachenumber(SLIST_FIELD_CATEGORY, first); float catl = gethostcachenumber(SLIST_FIELD_CATEGORY, last); - if (catf > x) { - // The first one is already > x. - // Therefore, category x does not exist. + if (catf > j) { + // The first one is already > j. + // Therefore, category j does not exist. // Higher numbered categories do exist though. - } else if (catl < x) { - // The last one is < x. + } else if (catl < j) { + // The last one is < j. // Thus this category - and any following - // don't exist. break; - } else if (catf == x) { + } else if (catf == j) { // Starts at first. This breaks the loop // invariant in the binary search and thus has // to be handled separately. - if(gethostcachenumber(SLIST_FIELD_CATEGORY, first) != x) + if(gethostcachenumber(SLIST_FIELD_CATEGORY, first) != j) error("Category mismatch I"); if(first > 0) - if(gethostcachenumber(SLIST_FIELD_CATEGORY, first - 1) == x) + if(gethostcachenumber(SLIST_FIELD_CATEGORY, first - 1) == j) error("Category mismatch II"); - category_name[category_draw_count] = x; + category_name[category_draw_count] = j; category_item[category_draw_count] = first; ++category_draw_count; begin = first + 1; } else { - // At this point, catf <= x < catl, thus + // At this point, catf <= j < catl, thus // catf < catl, thus first < last. // INVARIANTS: // last - first >= 1 // catf == gethostcachenumber(SLIST_FIELD_CATEGORY(first) // catl == gethostcachenumber(SLIST_FIELD_CATEGORY(last) - // catf < x - // catl >= x + // catf < j + // catl >= j while (last - first > 1) { float middle = floor((first + last) / 2); // By loop condition, middle != first && middle != last. float cat = gethostcachenumber(SLIST_FIELD_CATEGORY, middle); - if (cat >= x) { + if (cat >= j) { last = middle; catl = cat; } else { @@ -525,13 +524,13 @@ void XonoticServerList_draw(entity me) catf = cat; } } - if (catl == x) { - if(gethostcachenumber(SLIST_FIELD_CATEGORY, last) != x) + if (catl == j) { + if(gethostcachenumber(SLIST_FIELD_CATEGORY, last) != j) error("Category mismatch III"); if(last > 0) - if(gethostcachenumber(SLIST_FIELD_CATEGORY, last - 1) == x) + if(gethostcachenumber(SLIST_FIELD_CATEGORY, last - 1) == j) error("Category mismatch IV"); - category_name[category_draw_count] = x; + category_name[category_draw_count] = j; category_item[category_draw_count] = last; ++category_draw_count; begin = last + 1; // already scanned through these, skip 'em diff --git a/qcsrc/menu/xonotic/slider_decibels.qc b/qcsrc/menu/xonotic/slider_decibels.qc index 2b78141383..dcc2c85b06 100644 --- a/qcsrc/menu/xonotic/slider_decibels.qc +++ b/qcsrc/menu/xonotic/slider_decibels.qc @@ -7,9 +7,9 @@ float toDecibelOfSquare(float f, float mi) { // linear scale part float t = 1 / A + mi; - float y = exp(1 + A * mi); - if(f <= y) - return mi + (t - mi) * (f / y); + float u = exp(1 + A * mi); + if(f <= u) + return mi + (t - mi) * (f / u); } return log(f) / A; } @@ -21,9 +21,9 @@ float fromDecibelOfSquare(float f, float mi) { // linear scale part float t = 1 / A + mi; - float y = exp(1 + A * mi); + float u = exp(1 + A * mi); if(f <= t) - return y * ((f - mi) / (t - mi)); + return u * ((f - mi) / (t - mi)); } return exp(A * f); } diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index da66ece3bb..3b48e5c1cf 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -1605,11 +1605,11 @@ void player_regen(entity this) } bool zoomstate_set; -void SetZoomState(entity this, float z) +void SetZoomState(entity this, float newzoom) { - if(z != this.zoomstate) + if(newzoom != this.zoomstate) { - this.zoomstate = z; + this.zoomstate = newzoom; ClientData_Touch(this); } zoomstate_set = true; diff --git a/qcsrc/server/command/radarmap.qc b/qcsrc/server/command/radarmap.qc index a5e4a7547a..ad86afb23c 100644 --- a/qcsrc/server/command/radarmap.qc +++ b/qcsrc/server/command/radarmap.qc @@ -49,18 +49,18 @@ float FullTraceFraction(vector a, vector mi, vector ma, vector b) return white / (black + white); } -float RadarMapAtPoint_Trace(float x, float y, float w, float h, float zmin, float zsize, float q) +float RadarMapAtPoint_Trace(float e, float f, float w, float h, float zmin, float zsize, float q) { vector a, b, mi, ma; mi = '0 0 0'; ma = '1 0 0' * w + '0 1 0' * h; - a = '1 0 0' * x + '0 1 0' * y + '0 0 1' * zmin; - b = '1 0 0' * x + '0 1 0' * y + '0 0 1' * (zsize + zmin); + a = '1 0 0' * e + '0 1 0' * f + '0 0 1' * zmin; + b = '1 0 0' * e + '0 1 0' * f + '0 0 1' * (zsize + zmin); return FullTraceFraction(a, mi, ma, b); } -float RadarMapAtPoint_LineBlock(float x, float y, float w, float h, float zmin, float zsize, float q) +float RadarMapAtPoint_LineBlock(float e, float f, float w, float h, float zmin, float zsize, float q) { vector o, mi, ma; float i, r; @@ -72,12 +72,12 @@ float RadarMapAtPoint_LineBlock(float x, float y, float w, float h, float zmin, mi = '0 0 0'; dz = (zsize / q) * '0 0 1'; ma = '1 0 0' * w + '0 1 0' * h + dz; - o = '1 0 0' * x + '0 1 0' * y + '0 0 1' * zmin; + o = '1 0 0' * e + '0 1 0' * f + '0 0 1' * zmin; - if (x < world.absmin.x - w) return 0; - if (y < world.absmin.y - h) return 0; - if (x > world.absmax.x) return 0; - if (y > world.absmax.y) return 0; + if (e < world.absmin.x - w) return 0; + if (f < world.absmin.y - h) return 0; + if (e > world.absmax.x) return 0; + if (f > world.absmax.y) return 0; r = 0; for (i = 0; i < q; ++i) @@ -95,7 +95,7 @@ float RadarMapAtPoint_LineBlock(float x, float y, float w, float h, float zmin, } return r / q; } -float RadarMapAtPoint_Block(float x, float y, float w, float h, float zmin, float zsize, float q) +float RadarMapAtPoint_Block(float e, float f, float w, float h, float zmin, float zsize, float q) { vector o, mi, ma; float i, r; @@ -107,12 +107,12 @@ float RadarMapAtPoint_Block(float x, float y, float w, float h, float zmin, floa mi = '0 0 0'; dz = (zsize / q) * '0 0 1'; ma = '1 0 0' * w + '0 1 0' * h + dz; - o = '1 0 0' * x + '0 1 0' * y + '0 0 1' * zmin; + o = '1 0 0' * e + '0 1 0' * f + '0 0 1' * zmin; - if (x < world.absmin.x - w) return 0; - if (y < world.absmin.y - h) return 0; - if (x > world.absmax.x) return 0; - if (y > world.absmax.y) return 0; + if (e < world.absmin.x - w) return 0; + if (f < world.absmin.y - h) return 0; + if (e > world.absmax.x) return 0; + if (f > world.absmax.y) return 0; r = 0; for (i = 0; i < q; ++i) @@ -122,7 +122,7 @@ float RadarMapAtPoint_Block(float x, float y, float w, float h, float zmin, floa } return r / q; } -float RadarMapAtPoint_Sample(float x, float y, float w, float h, float zmin, float zsize, float q) +float RadarMapAtPoint_Sample(float e, float f, float w, float h, float zmin, float zsize, float q) { vector a, b, mi, ma; @@ -133,7 +133,7 @@ float RadarMapAtPoint_Sample(float x, float y, float w, float h, float zmin, flo mi = '0 0 0'; ma = '1 0 0' * w + '0 1 0' * h; - a = '1 0 0' * x + '0 1 0' * y + '0 0 1' * zmin; + a = '1 0 0' * e + '0 1 0' * f + '0 0 1' * zmin; b = '1 0 0' * w + '0 1 0' * h + '0 0 1' * zsize; float c, i; @@ -151,31 +151,31 @@ float RadarMapAtPoint_Sample(float x, float y, float w, float h, float zmin, flo return c / q; } -void sharpen_set(int x, float v) +void sharpen_set(int b, float v) { - sharpen_buffer[x + 2 * RADAR_WIDTH_MAX] = v; + sharpen_buffer[b + 2 * RADAR_WIDTH_MAX] = v; } -float sharpen_getpixel(int x, int y) +float sharpen_getpixel(int b, int c) { - if (x < 0) return 0; - if (x >= RADAR_WIDTH_MAX) return 0; - if (y < 0) return 0; - if (y > 2) return 0; - return sharpen_buffer[x + y * RADAR_WIDTH_MAX]; + if (b < 0) return 0; + if (b >= RADAR_WIDTH_MAX) return 0; + if (c < 0) return 0; + if (c > 2) return 0; + return sharpen_buffer[b + c * RADAR_WIDTH_MAX]; } -float sharpen_get(float x, float a) +float sharpen_get(float b, float a) { - float sum = sharpen_getpixel(x, 1); + float sum = sharpen_getpixel(b, 1); if (a == 0) return sum; sum *= (8 + 1 / a); - sum -= sharpen_getpixel(x - 1, 0); - sum -= sharpen_getpixel(x - 1, 1); - sum -= sharpen_getpixel(x - 1, 2); - sum -= sharpen_getpixel(x + 1, 0); - sum -= sharpen_getpixel(x + 1, 1); - sum -= sharpen_getpixel(x + 1, 2); - sum -= sharpen_getpixel(x, 0); - sum -= sharpen_getpixel(x, 2); + sum -= sharpen_getpixel(b - 1, 0); + sum -= sharpen_getpixel(b - 1, 1); + sum -= sharpen_getpixel(b - 1, 2); + sum -= sharpen_getpixel(b + 1, 0); + sum -= sharpen_getpixel(b + 1, 1); + sum -= sharpen_getpixel(b + 1, 2); + sum -= sharpen_getpixel(b, 0); + sum -= sharpen_getpixel(b, 2); return bound(0, sum * a, 1); } void sharpen_shift(int w) diff --git a/qcsrc/server/command/sv_cmd.qc b/qcsrc/server/command/sv_cmd.qc index f2be14b600..1e5fedbcb6 100644 --- a/qcsrc/server/command/sv_cmd.qc +++ b/qcsrc/server/command/sv_cmd.qc @@ -1328,7 +1328,7 @@ void GameCommand_shuffleteams(float request) { if (teamplay) { - float x, t_teams, t_players, team_color; + float t_teams, t_players, team_color; // count the total amount of players and total amount of teams t_players = 0; @@ -1366,15 +1366,15 @@ void GameCommand_shuffleteams(float request) for (int i = 1; i <= t_teams; ++i) { // find out how many players to assign to this team - x = (t_players / t_teams); - x = ((i == 1) ? ceil(x) : floor(x)); + int pnum = (t_players / t_teams); + pnum = ((i == 1) ? ceil(pnum) : floor(pnum)); team_color = Team_NumberToTeam(i); // sort through the random list of players made earlier for (int z = 1; z <= maxclients; ++z) { - if (!(shuffleteams_teams[i] >= x)) + if (!(shuffleteams_teams[i] >= pnum)) { if (!(shuffleteams_players[z])) continue; // not a player, move on to next random slot diff --git a/qcsrc/server/pathlib/main.qc b/qcsrc/server/pathlib/main.qc index 044d644434..36c7c1d314 100644 --- a/qcsrc/server/pathlib/main.qc +++ b/qcsrc/server/pathlib/main.qc @@ -297,11 +297,11 @@ void pathlib_cleanup() } -float Cosine_Interpolate(float a, float b, float x) +float Cosine_Interpolate(float a, float b, float c) { float ft,f; - ft = x * 3.1415927; + ft = c * 3.1415927; f = (1 - cos(ft)) * 0.5; return a*(1-f) + b*f;