From: Mario Date: Mon, 6 Mar 2017 20:28:06 +0000 (+1000) Subject: Tighten the maths around the new pow replacements X-Git-Tag: xonotic-v0.8.2~122 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=885c44f8ae383e2a22fbe43530d55d0a0f4de206;p=xonotic%2Fxonotic-data.pk3dir.git Tighten the maths around the new pow replacements --- diff --git a/qcsrc/common/mutators/mutator/bugrigs/bugrigs.qc b/qcsrc/common/mutators/mutator/bugrigs/bugrigs.qc index 729fbbad0..318cc10f4 100644 --- a/qcsrc/common/mutators/mutator/bugrigs/bugrigs.qc +++ b/qcsrc/common/mutators/mutator/bugrigs/bugrigs.qc @@ -97,7 +97,7 @@ void RaceCarPhysics(entity this, float dt) float upspeed = this.velocity * v_up; // responsiveness factor for steering and acceleration - float f = 1 / (1 + (max(-myspeed, myspeed) / PHYS_BUGRIGS_SPEED_REF(this) ** PHYS_BUGRIGS_SPEED_POW(this))); + float f = 1 / (1 + ((max(-myspeed, myspeed) / PHYS_BUGRIGS_SPEED_REF(this)) ** PHYS_BUGRIGS_SPEED_POW(this))); //MAXIMA: f(v) := 1 / (1 + (v / PHYS_BUGRIGS_SPEED_REF(this)) ^ PHYS_BUGRIGS_SPEED_POW(this)); float steerfactor; diff --git a/qcsrc/common/turrets/cl_turrets.qc b/qcsrc/common/turrets/cl_turrets.qc index c2cc03e73..809b69a96 100644 --- a/qcsrc/common/turrets/cl_turrets.qc +++ b/qcsrc/common/turrets/cl_turrets.qc @@ -161,7 +161,7 @@ void turret_draw2d(entity this) (vid_conwidth - (vid_conwidth * waypointsprite_edgeoffset_right)) - o_x, (vid_conheight - (vid_conheight * waypointsprite_edgeoffset_bottom)) - o_y); - float crosshairdistance = sqrt( (o.x - vid_conwidth/2 ** 2) + (o.y - vid_conheight/2 ** 2) ); + float crosshairdistance = sqrt( ((o.x - vid_conwidth/2) ** 2) + ((o.y - vid_conheight/2) ** 2) ); t = waypointsprite_scale; a *= waypointsprite_alpha; diff --git a/qcsrc/common/weapons/weapon/tuba.qc b/qcsrc/common/weapons/weapon/tuba.qc index 1536eb337..2949a8a24 100644 --- a/qcsrc/common/weapons/weapon/tuba.qc +++ b/qcsrc/common/weapons/weapon/tuba.qc @@ -493,23 +493,23 @@ void tubasound(entity e, bool restart) if (restart) { snd1 = TUBA_STARTNOTE(e.tuba_instrument, e.note - m + Tuba_PitchStep); } - speed1 = (2.0 ** (m - Tuba_PitchStep) / 12.0); + speed1 = (2.0 ** ((m - Tuba_PitchStep) / 12.0)); } else if (e.note - m + Tuba_PitchStep > TUBA_MAX) { if (restart) { snd1 = TUBA_STARTNOTE(e.tuba_instrument, e.note - m); } - speed1 = (2.0 ** m / 12.0); + speed1 = (2.0 ** (m / 12.0)); } else { if (restart) { snd1 = TUBA_STARTNOTE(e.tuba_instrument, e.note - m); } vol1 = cos(M_PI_2 * m / Tuba_PitchStep); - speed1 = (2.0 ** m / 12.0); + speed1 = (2.0 ** (m / 12.0)); if (restart) { snd2 = TUBA_STARTNOTE(e.tuba_instrument, e.note - m + Tuba_PitchStep); } vol2 = sin(M_PI_2 * m / Tuba_PitchStep); - speed2 = (2.0 ** (m - Tuba_PitchStep) / 12.0); + speed2 = (2.0 ** ((m - Tuba_PitchStep) / 12.0)); } } else if (restart) { snd1 = TUBA_STARTNOTE(e.tuba_instrument, e.note); diff --git a/qcsrc/lib/warpzone/mathlib.qc b/qcsrc/lib/warpzone/mathlib.qc index 816a7ec6e..acbc1c61d 100644 --- a/qcsrc/lib/warpzone/mathlib.qc +++ b/qcsrc/lib/warpzone/mathlib.qc @@ -122,7 +122,7 @@ float scalbn(float e, int n) float cbrt(float e) { - return copysign((fabs(e) ** 1.0/3.0), e); + return copysign((fabs(e) ** (1.0/3.0)), e); } float hypot(float e, float f) { diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index 6a6cdc214..7502bdb9d 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -1141,7 +1141,7 @@ float(float exponent) MaplistMethod_Shuffle = // more clever shuffling string newlist; // now reinsert this at another position - insertpos = (random() ** 1 / exponent); // ]0, 1] + insertpos = (random() ** (1 / exponent)); // ]0, 1] insertpos = insertpos * (Map_Count - 1); // ]0, Map_Count - 1] insertpos = ceil(insertpos) + 1; // {2, 3, 4, ..., Map_Count} LOG_TRACE("SHUFFLE: insert pos = ", ftos(insertpos));