]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Tighten the maths around the new pow replacements
authorMario <mario@smbclan.net>
Mon, 6 Mar 2017 20:28:06 +0000 (06:28 +1000)
committerMario <mario@smbclan.net>
Mon, 6 Mar 2017 20:28:06 +0000 (06:28 +1000)
qcsrc/common/mutators/mutator/bugrigs/bugrigs.qc
qcsrc/common/turrets/cl_turrets.qc
qcsrc/common/weapons/weapon/tuba.qc
qcsrc/lib/warpzone/mathlib.qc
qcsrc/server/g_world.qc

index 729fbbad06b9ef459784e1d2f0f2d0ef5dfde471..318cc10f4a95657a2d237a5e904ebd44283aa002 100644 (file)
@@ -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;
index c2cc03e73806986ade725c89731bbd3bfdcb17ac..809b69a96a8d8299e5b446d792084f9b4e4ed43a 100644 (file)
@@ -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;
index 1536eb337bc75482edb37f9cfaa165301ecbc17b..2949a8a24446e049342de97b2d5730d81e03fe83 100644 (file)
@@ -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);
index 816a7ec6e761aa91f774a5ea8406e45b1a5775ae..acbc1c61d4dda0f69cb0d256467f16bc2808cb07 100644 (file)
@@ -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)
 {
index 6a6cdc214e7504da31dafb31d3ddf9406f73c987..7502bdb9dd6783b584807e5bcf731c2e7bf408fc 100644 (file)
@@ -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));