]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Enforce use of the pow macro, allow switching between FTEQCC and GMQCC pow implementa...
authorMario <mario.mario@y7mail.com>
Sat, 2 Jul 2022 13:54:02 +0000 (23:54 +1000)
committerMario <mario.mario@y7mail.com>
Sat, 2 Jul 2022 13:54:02 +0000 (23:54 +1000)
39 files changed:
qcsrc/Makefile
qcsrc/client/announcer.qc
qcsrc/client/hud/panel/physics.qc
qcsrc/client/hud/panel/score.qc
qcsrc/client/mapvoting.qc
qcsrc/client/view.qc
qcsrc/common/command/rpn.qc
qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qc
qcsrc/common/gamemodes/gamemode/keyhunt/sv_keyhunt.qc
qcsrc/common/mapobjects/func/pointparticles.qc
qcsrc/common/mapobjects/trigger/impulse.qc
qcsrc/common/mapobjects/trigger/jumppads.qc
qcsrc/common/mutators/mutator/bugrigs/bugrigs.qc
qcsrc/common/mutators/mutator/dodging/sv_dodging.qc
qcsrc/common/mutators/mutator/dynamic_handicap/sv_dynamic_handicap.qc
qcsrc/common/mutators/mutator/nades/nades.qc
qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc
qcsrc/common/physics/player.qc
qcsrc/common/turrets/cl_turrets.qc
qcsrc/common/util.qc
qcsrc/common/vehicles/cl_vehicles.qc
qcsrc/common/weapons/weapon/crylink.qc
qcsrc/common/weapons/weapon/hook.qc
qcsrc/common/weapons/weapon/tuba.qc
qcsrc/lib/_all.inc
qcsrc/lib/compiler.qh
qcsrc/lib/math.qh
qcsrc/lib/noise.qh
qcsrc/lib/vector.qh
qcsrc/menu/xonotic/serverlist.qc
qcsrc/menu/xonotic/slider_picmip.qc
qcsrc/server/bot/default/aim.qc
qcsrc/server/bot/default/bot.qc
qcsrc/server/bot/default/havocbot/havocbot.qc
qcsrc/server/bot/default/havocbot/roles.qc
qcsrc/server/bot/default/scripting.qc
qcsrc/server/intermission.qc
qcsrc/server/spawnpoints.qc
qcsrc/tools/qcc.sh

index ee9e7e64ab9c6e6016fd362b3e2faca5a801b369..c4650c26f5f7d8cdb5a79129fad67f998d777827 100644 (file)
@@ -1,5 +1,6 @@
 CPP := cc -xc -E
 QCC ?= ../../../../gmqcc/gmqcc
+QCCIDENT ?= -DGMQCC
 
 PROGS_OUT ?= ..
 WORKDIR ?= ../.tmp
@@ -128,6 +129,7 @@ export CPP
 export QCC
 export QCCDEFS
 export QCCFLAGS
+export QCCIDENT
 
 $(PROGS_OUT)/csprogs.dat: client/progs.inc $(QCCVERSIONFILE) | $(WORKDIR)
        @ echo make[1]: Entering directory \`$(CURDIR)/client\'
index d46595e8718bde0a2007fb276a6e54ab6b49d7ca..2199f9b4549663a4d7554a6d6334fc92fb59b1de 100644 (file)
@@ -32,8 +32,8 @@ void Announcer_Duel()
 
        entity pl1 = players.sort_next;
        entity pl2 = pl1.sort_next;
-       string pl1_name = (pl1 && pl1.team != NUM_SPECTATOR ? entcs_GetName(pl1.sv_entnum) : "???");
-       string pl2_name = (pl2 && pl2.team != NUM_SPECTATOR ? entcs_GetName(pl2.sv_entnum) : "???");
+       string pl1_name = ((pl1 && pl1.team != NUM_SPECTATOR) ? entcs_GetName(pl1.sv_entnum) : "???");
+       string pl2_name = ((pl2 && pl2.team != NUM_SPECTATOR) ? entcs_GetName(pl2.sv_entnum) : "???");
 
        if(pl1_name == prev_pl1_name && pl2_name == prev_pl2_name)
                return; // Players haven't changed, stop here
index 53d778a4ba2ffac65fd43658cd5d861199e50d9c..34afc29071f0ecdf22ca9f78869c791cbc335b6c 100644 (file)
@@ -105,7 +105,7 @@ void HUD_Physics()
        {
                discrete_acceleration = acceleration;
                // workaround for ftos_decimals returning a negative 0
-               if(discrete_acceleration > -1 / (10 ** acc_decimals) && discrete_acceleration < 0)
+               if(discrete_acceleration > -1 / pow(10, acc_decimals) && discrete_acceleration < 0)
                        discrete_acceleration = 0;
                discrete_speed = speed;
                physics_update_time += autocvar_hud_panel_physics_update_interval;
index c33fce08b16a1ae80a9d3a256e99551ea7424167..a8cd5cf0860ececc8576054369382b0a7d0c06ec 100644 (file)
@@ -186,7 +186,7 @@ void HUD_Score()
                        // distribution display
                        distribution = me.(scores(ps_primary)) - pl.(scores(ps_primary));
 
-                       distrtimer = ftos_decimals(fabs(distribution/(10 ** TIME_DECIMALS)), TIME_DECIMALS);
+                       distrtimer = ftos_decimals(fabs(distribution/pow(10, TIME_DECIMALS)), TIME_DECIMALS);
 
                        if (distribution <= 0) {
                                distribution_color = '0 1 0';
index 29640128c0abf575c8a8b43fa03cb81c5d044e9e..f69c069e8229c5581f9bee1361ac6f679ce9c6c9 100644 (file)
@@ -473,7 +473,7 @@ void MapVote_Draw()
        mv_selection = MapVote_Selection(pos, dist, rows, mv_columns);
 
        if (mv_top2_time)
-               mv_top2_alpha = max(0.2, 1 - (time - mv_top2_time) ** 2);
+               mv_top2_alpha = max(0.2, pow(1 - (time - mv_top2_time), 2));
 
        void (vector, float, float, string, string, float, float) DrawItem;
 
index 530324656373d1346762879984b5473795df5af5..b731d088198de591905a88844bb591356aa80591 100644 (file)
@@ -500,7 +500,7 @@ vector GetCurrentFov(float fov)
                current_zoomfraction = (current_viewzoom - 1) / (1/zoomfactor - 1);
 
        if(zoomsensitivity < 1)
-               setsensitivityscale(current_viewzoom ** (1 - zoomsensitivity));
+               setsensitivityscale(pow(current_viewzoom, (1 - zoomsensitivity)));
        else
                setsensitivityscale(1);
 
@@ -1331,7 +1331,7 @@ void View_BlurTest()
        {
                float t = (time - blurtest_time0) / (blurtest_time1 - blurtest_time0);
                float r = t * blurtest_radius;
-               float f = 1 / (t ** blurtest_power) - 1;
+               float f = 1 / pow(t, blurtest_power) - 1;
 
                cvar_set("r_glsl_postprocess", "1");
                cvar_set("r_glsl_postprocess_uservec1", strcat(ftos(r), " ", ftos(f), " 0 0"));
index 99f96ff7606c90c68d6976e73fb014317ea07bd2..2bc4949628702ec1994f3fb32c06d5f763b1b01c 100644 (file)
@@ -171,7 +171,7 @@ void GenericCommand_rpn(int request, int argc, string command)
                                                rpn_setf(f2 - f * floor(f2 / f));
                                        } else if(rpncmd == "pow" || rpncmd == "**") {
                                                f = rpn_popf();
-                                               rpn_setf(rpn_getf() ** f);
+                                               rpn_setf(pow(rpn_getf(), f));
                                        } else if(rpncmd == "bitand" || rpncmd == "&") {
                                                f = rpn_popf();
                                                rpn_setf(rpn_getf() & f);
index 4c50abb464e3737b0284849e98c69671580e5aa2..c1f6a081bba2b4124d298b5828b65ca9ce9ff2ae 100644 (file)
@@ -223,7 +223,7 @@ void havocbot_goalrating_ft_freeplayers(entity this, float ratingscale, vector o
                        // If teamate is not frozen still seek them out as fight better
                        // in a group.
                        best_dist2 = vlen2(it.origin - org);
-                       if (best_dist2 < 700 ** 2)
+                       if (best_dist2 < pow(700, 2))
                        {
                                best_pl = NULL;
                                best_dist2 = 0; // already close to a teammate
index 5f90c390f617ad394c61a454e5a273d07aa0811d..31cd84172435882cef8002e55829b74b3d0e298b 100644 (file)
@@ -128,7 +128,7 @@ void kh_update_state()
                        f = key.team;
                else
                        f = 30;
-               s |= (32 ** key.count) * f;
+               s |= pow(32, key.count) * f;
        }
 
        FOREACH_CLIENT(true, { STAT(OBJECTIVE_STATUS, it) = s; });
@@ -136,7 +136,7 @@ void kh_update_state()
        FOR_EACH_KH_KEY(key)
        {
                if(key.owner)
-                       STAT(OBJECTIVE_STATUS, key.owner) |= (32 ** key.count) * 31;
+                       STAT(OBJECTIVE_STATUS, key.owner) |= pow(32, key.count) * 31;
        }
        //print(ftos((nextent(NULL)).kh_state), "\n");
 }
index 7aa34ce474e8d16b71e0afe72a4a740414452069..51e4bd0b3fa5745694fd990cf64550b3e0184d6f 100644 (file)
@@ -324,7 +324,7 @@ NET_HANDLE(ENT_CLIENT_POINTPARTICLES, bool isnew)
                if(!this.absolute)
                {
                        v = this.maxs - this.mins;
-                       this.impulse *= -v.x * v.y * v.z / (64**3); // relative: particles per 64^3 cube
+                       this.impulse *= -v.x * v.y * v.z / pow(64, 3); // relative: particles per 64^3 cube
                }
        }
 
index 4306e2ff7b169db75f947e6e522ab534d00eba9f..296c6436ed0d823ff4f1197131a4a5d555a6e019 100644 (file)
@@ -80,7 +80,7 @@ void trigger_impulse_touch_accel(entity this, entity toucher)
        }
 
        // div0: ticrate independent, 1 = identity (not 20)
-       toucher.velocity = toucher.velocity * (this.strength ** pushdeltatime);
+       toucher.velocity = toucher.velocity * pow(this.strength, pushdeltatime);
 
 #ifdef SVQC
        UpdateCSQCProjectile(toucher);
@@ -203,7 +203,7 @@ spawnfunc(trigger_impulse)
                        {
                                this.strength = IMPULSE_DEFAULT_ACCEL_STRENGTH;
                        }
-                       this.strength = (this.strength ** autocvar_g_triggerimpulse_accel_power) * autocvar_g_triggerimpulse_accel_multiplier;
+                       this.strength = pow(this.strength, autocvar_g_triggerimpulse_accel_power) * autocvar_g_triggerimpulse_accel_multiplier;
                        settouch(this, trigger_impulse_touch_accel);
                }
        }
index 59fd0c55318fff522c0401b8a37d35104ee78a9a..a4cc2a97108e541af457b407c49d74ff22d4f942 100644 (file)
@@ -371,7 +371,7 @@ float trigger_push_get_push_time(entity this, vector endpos)
                        vector v = this.movedir;
 
                        float t = v.z / grav;
-                       float jump_height = 1/2 * grav * (t ** 2);
+                       float jump_height = 1/2 * grav * pow(t, 2);
                        float remaining_height = org.z + jump_height - endpos.z;
                        float v2_z = sqrt(2 * grav * remaining_height);
 
index 1ee60e1d43692c95e35b9d21717c94be87aa4232..a9c9c76a0563173c097a2427c2594efea212a512 100644 (file)
@@ -135,7 +135,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 + pow((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;
@@ -192,7 +192,7 @@ void RaceCarPhysics(entity this, float dt)
                float myspeed = vlen(this.velocity);
 
                // responsiveness factor for steering and acceleration
-               float f = 1 / (1 + (max(0, myspeed / PHYS_BUGRIGS_SPEED_REF(this)) ** PHYS_BUGRIGS_SPEED_POW(this)));
+               float f = 1 / (1 + pow(max(0, myspeed / PHYS_BUGRIGS_SPEED_REF(this)), PHYS_BUGRIGS_SPEED_POW(this)));
                float steerfactor = -myspeed * f;
                this.angles_y += steer * dt * steerfactor; // apply steering
 
index 8af5092226109f9664f78165d376355f5034934b..e01a89561c3326e6a27e51405e96cd6a09d82199 100644 (file)
@@ -206,7 +206,7 @@ bool PM_dodging_checkpressedkeys(entity this)
        this.dodging_direction.y = tap_direction_y;
 
        // normalize the dodging_direction vector.. (unlike UT99) XD
-       float length = sqrt(this.dodging_direction.x ** 2 + this.dodging_direction.y ** 2);
+       float length = sqrt(pow(this.dodging_direction.x, 2) + pow(this.dodging_direction.y, 2));
 
        this.dodging_direction.x = this.dodging_direction.x / length;
        this.dodging_direction.y = this.dodging_direction.y / length;
index 237d14a6e72a38a328663562645aebfbde9b8493..e34ab2f1c9fb10efe0ef2d278b38223ac8a37ac1 100644 (file)
@@ -44,7 +44,7 @@ void DynamicHandicap_UpdateHandicap()
                float score = PlayerScore_Get(it, SP_SCORE);
                float handicap = fabs((score - mean_score) *
                        autocvar_g_dynamic_handicap_scale);
-               handicap = handicap ** autocvar_g_dynamic_handicap_exponent;
+               handicap = pow(handicap, autocvar_g_dynamic_handicap_exponent);
                if (score < mean_score)
                {
                        handicap = -handicap;
index f64e5d329f7fd13da0b38d56bd1ee262395bfe77..3b423e0daa7a89b8764b91e956b32e6e255efc29 100644 (file)
@@ -594,7 +594,7 @@ void nade_entrap_touch(entity this, entity toucher)
                if(!pushdeltatime) return;
 
                // div0: ticrate independent, 1 = identity (not 20)
-               toucher.velocity = toucher.velocity * (autocvar_g_nades_entrap_strength ** pushdeltatime);
+               toucher.velocity = toucher.velocity * pow(autocvar_g_nades_entrap_strength, pushdeltatime);
 
        #ifdef SVQC
                UpdateCSQCProjectile(toucher);
index 88c508229e85edd4a66a11ed724bab2d077035b6..5062c9f20e3b3609467e20a341fde8002fb400ba 100644 (file)
@@ -470,7 +470,7 @@ vector fixrgbexcess(vector rgb)
 void Draw_WaypointSprite(entity this)
 {
     if (this.lifetime > 0)
-        this.alpha = (bound(0, (this.fadetime - time) / this.lifetime, 1) ** waypointsprite_timealphaexponent);
+        this.alpha = pow(bound(0, (this.fadetime - time) / this.lifetime, 1), waypointsprite_timealphaexponent);
     else
         this.alpha = 1;
 
@@ -535,7 +535,7 @@ void Draw_WaypointSprite(entity this)
     {
         // restrict maximum normal distance to the waypoint's maximum distance to prevent exploiting cvars
         float maxnormdistance = bound(0, waypointsprite_normdistance, this.maxdistance - 1);
-        a *= (bound(0, (this.maxdistance - dist) / (this.maxdistance - maxnormdistance), 1) ** waypointsprite_distancealphaexponent);
+        a *= pow(bound(0, (this.maxdistance - dist) / (this.maxdistance - maxnormdistance), 1), waypointsprite_distancealphaexponent);
     }
 
     vector rgb = spritelookupcolor(this, spriteimage, this.teamradar_color);
@@ -626,7 +626,7 @@ void Draw_WaypointSprite(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( pow((o.x - vid_conwidth/2), 2) + pow((o.y - vid_conheight/2), 2) );
 
     t = waypointsprite_scale;
     a *= waypointsprite_alpha;
index 75ebfd2ce630f533492ed31bc770b236a9739d74..e6d90b091bf3b73ebf4f18e963cfd27389061442 100644 (file)
@@ -116,7 +116,7 @@ float GeomLerp(float a, float _lerp, float b)
 {
        return a == 0 ? (_lerp < 1 ? 0 : b)
                : b == 0 ? (_lerp > 0 ? 0 : a)
-               : a * (fabs(b / a) ** _lerp);
+               : a * pow(fabs(b / a), _lerp);
 }
 
 void PM_ClientMovement_UpdateStatus(entity this)
@@ -200,7 +200,7 @@ void CPM_PM_Aircontrol(entity this, float dt, vector wishdir, float wishspeed)
 
        if (dot > 0) // we can't change direction while slowing down
        {
-               k *= (dot ** PHYS_AIRCONTROL_POWER(this)) * dt;
+               k *= pow(dot, PHYS_AIRCONTROL_POWER(this)) * dt;
                xyspeed = max(0, xyspeed - PHYS_AIRCONTROL_PENALTY(this) * sqrt(max(0, 1 - dot*dot)) * k/32);
                k *= PHYS_AIRCONTROL(this);
                this.velocity = normalize(this.velocity * xyspeed + wishdir * k);
index aff0f764c7759c2955a527f55960725dca8526e6..8201ddb8a8d38c7a281d0c7196eb20ede51c7200 100644 (file)
@@ -106,9 +106,9 @@ void turret_draw2d(entity this)
 
 
        if(this.maxdistance > waypointsprite_normdistance)
-               a *= (bound(0, (this.maxdistance - dist) / (this.maxdistance - waypointsprite_normdistance), 1) ** waypointsprite_distancealphaexponent);
+               a *= pow(bound(0, (this.maxdistance - dist) / (this.maxdistance - waypointsprite_normdistance), 1), waypointsprite_distancealphaexponent);
        else if(this.maxdistance > 0)
-               a *= (bound(0, (waypointsprite_fadedistance - dist) / (waypointsprite_fadedistance - waypointsprite_normdistance), 1) ** waypointsprite_distancealphaexponent) * (1 - waypointsprite_minalpha) + waypointsprite_minalpha;
+               a *= pow(bound(0, (waypointsprite_fadedistance - dist) / (waypointsprite_fadedistance - waypointsprite_normdistance), 1), waypointsprite_distancealphaexponent) * (1 - waypointsprite_minalpha) + waypointsprite_minalpha;
 
        if(rgb == '0 0 0')
        {
@@ -158,7 +158,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( pow((o.x - vid_conwidth/2), 2) + pow((o.y - vid_conheight/2), 2) );
 
        t = waypointsprite_scale;
        a *= waypointsprite_alpha;
index 8ef6b2019f07c4a08d5467897214d5717ce03c56..3db18ebc027dadb07eeba88d76c41d78cf9b688b 100644 (file)
@@ -502,7 +502,7 @@ float compressShortVector(vector vec)
 STATIC_INIT(compressShortVector)
 {
        float l = 1;
-       float f = (2 ** (1/8));
+       float f = pow(2, (1/8));
        int i;
        for(i = 0; i < 128; ++i)
        {
@@ -1891,7 +1891,7 @@ void attach_sameorigin(entity e, entity to, string tag)
     float tagscale;
 
     org = e.origin - gettaginfo(to, gettagindex(to, tag));
-    tagscale = (vlen(v_forward) ** -2); // undo a scale on the tag
+    tagscale = pow(vlen(v_forward), -2); // undo a scale on the tag
     t_forward = v_forward * tagscale;
     t_left = v_right * -tagscale;
     t_up = v_up * tagscale;
index a9f44a2c2473b090967b8daa3e7fa15625704133..d9cac4768ea1d3bed2c4eef186f7f371117e2cf0 100644 (file)
@@ -167,7 +167,7 @@ void Vehicles_drawHUD(
                float tmpblinkValue = 0.55 + sin(time * 3) * 0.45;
                tmpPos.x = vehicleHud_Pos.x + vehicleHud_Size.x * (96/256) - tmpSize.x;
                tmpPos.y = vehicleHud_Pos.y;
-               tmpSize = '1 1 1' * hud_fontsize;
+               tmpSize = hud_fontsize;
                drawstring(tmpPos, sprintf(_("Press %s"), getcommandkey(_("drop weapon"), "dropweapon")), tmpSize, '1 0 0' + '0 1 1' * tmpblinkValue, hudAlpha, DRAWFLAG_NORMAL);
        }
 
index 5458a2496b92e9ab241660b0079fdcad09324092..70483c3b90d95e5efe06c3f6b30f8000f6a52573 100644 (file)
@@ -115,9 +115,9 @@ vector W_Crylink_LinkJoin(entity e, float jspeed)
                return avg_origin; // nothing to do
 
        // yes, mathematically we can do this in ONE step, but beware of 32bit floats...
-       avg_dist = (vlen(e.origin - avg_origin) ** 2);
+       avg_dist = pow(vlen(e.origin - avg_origin), 2);
        for(p = e; (p = p.queuenext) != e; )
-               avg_dist += (vlen(WarpZone_RefSys_TransformOrigin(p, e, p.origin) - avg_origin) ** 2);
+               avg_dist += pow(vlen(WarpZone_RefSys_TransformOrigin(p, e, p.origin) - avg_origin), 2);
        avg_dist *= (1.0 / n);
        avg_dist = sqrt(avg_dist);
 
index d9e11dc012fb9d2736a0f04a56853d4ab9c9e14d..f6dffa04772abe70fa6cc3a0cd6942aed93ea7cc 100644 (file)
@@ -7,7 +7,7 @@ void W_Hook_ExplodeThink(entity this)
        float dt, dmg_remaining_next, f;
 
        dt = time - this.teleport_time;
-       dmg_remaining_next = (bound(0, 1 - dt / this.dmg_duration, 1) ** this.dmg_power);
+       dmg_remaining_next = pow(bound(0, 1 - dt / this.dmg_duration, 1), this.dmg_power);
 
        f = this.dmg_last - dmg_remaining_next;
        this.dmg_last = dmg_remaining_next;
index bb1c015dd36621fa9d18b09451ba94756b66fd17..0e0858d62f4e10dd4b93b004be4be604ab77e8ee 100644 (file)
@@ -454,23 +454,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 = pow(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 = pow(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 = pow(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 = pow(2.0, ((m - Tuba_PitchStep) / 12.0));
                        }
                } else if (restart) {
                        snd1 = TUBA_STARTNOTE(e.tuba_instrument, e.note);
index 0bef0b6e0e944feebfe54c14fea8728a9bc6d295..7e9fd3cc8074942c6cef6d7fede70912252b648e 100644 (file)
@@ -64,7 +64,7 @@
 #ifndef QCC_SUPPORT_POW
     #define pow(a, b) pow(a, b)
 #else
-    #define pow(a, b) ((a) ** (b))
+    #define pow(a, b) POW(a, b)
 #endif
 
 #include "self.qh"
index 5ca0ed56525ee33886c46a0a7c27ecfd7763068b..b633782dce4b32627b9e28bc23523b22fb169973 100644 (file)
@@ -1,37 +1,45 @@
 #pragma once
 
 #ifndef QCC_SUPPORT_ACCUMULATE
-       #ifdef GMQCC
+       #if defined(GMQCC) || defined(FTEQCC)
                #define QCC_SUPPORT_ACCUMULATE
        #endif
 #endif
 
 #ifndef QCC_SUPPORT_NIL
-       #ifdef GMQCC
+       #if defined(GMQCC) || defined(FTEQCC)
                #define QCC_SUPPORT_NIL
        #endif
 #endif
 
 #ifndef QCC_SUPPORT_ERASEABLE
-       #ifdef GMQCC
+       #if defined(GMQCC) || defined(FTEQCC)
                #define QCC_SUPPORT_ERASEABLE
        #endif
 #endif
 
 #ifndef QCC_SUPPORT_ALIAS
-       #ifdef GMQCC
+       #if defined(GMQCC) || defined(FTEQCC)
                #define QCC_SUPPORT_ALIAS
        #endif
 #endif
 
 #ifndef QCC_SUPPORT_POW
-    #ifdef GMQCC
+    #if defined(GMQCC) || defined(FTEQCC)
         #define QCC_SUPPORT_POW
     #endif
 #endif
 
-#ifdef GMQCC
+#if defined(GMQCC) || defined(FTEQCC)
     #define LABEL(id) :id
 #else
     #define LABEL(id) id:
 #endif
+
+#ifdef QCC_SUPPORT_POW
+    #ifdef FTEQCC
+        #define POW(a, b) ((a) *^ (b))
+    #else
+        #define POW(a, b) ((a) ** (b))
+    #endif
+#endif
index ac23325000995f50ef2e1fdde945686ff741401f..46b5554e3ae3f8cbe4c22591f4d995ce6fe08e87 100644 (file)
@@ -6,8 +6,8 @@ ERASEABLE
 void mean_accumulate(entity e, .float a, .float c, float mean, float value, float weight)
 {
        if (weight == 0) return;
-       if (mean == 0) e.(a) *= (value ** weight);
-       else e.(a) += (value ** mean) * weight;
+       if (mean == 0) e.(a) *= pow(value, weight);
+       else e.(a) += pow(value, mean) * weight;
        e.(c) += weight;
 }
 
@@ -15,8 +15,8 @@ ERASEABLE
 float mean_evaluate(entity e, .float a, .float c, float mean)
 {
        if (e.(c) == 0) return 0;
-       if (mean == 0) return (e.(a) ** (1.0 / e.(c)));
-       else return ((e.(a) / e.(c)) ** (1.0 / mean));
+       if (mean == 0) return pow(e.(a), (1.0 / e.(c)));
+       else return pow((e.(a) / e.(c)), (1.0 / mean));
 }
 
 #define MEAN_ACCUMULATE(s, prefix, v, w) mean_accumulate(s, prefix##_accumulator, prefix##_count, prefix##_mean, v, w)
@@ -243,12 +243,12 @@ float almost_in_bounds(float a, float b, float c)
 ERASEABLE
 float ExponentialFalloff(float mindist, float maxdist, float halflifedist, float d)
 {
-       if (halflifedist > 0) return (0.5 ** ((bound(mindist, d, maxdist) - mindist) / halflifedist));
-       else if (halflifedist < 0) return (0.5 ** ((bound(mindist, d, maxdist) - maxdist) / halflifedist));
+       if (halflifedist > 0) return pow(0.5, ((bound(mindist, d, maxdist) - mindist) / halflifedist));
+       else if (halflifedist < 0) return pow(0.5, ((bound(mindist, d, maxdist) - maxdist) / halflifedist));
        else return 1;
 }
 
-#define power2of(e) (2 ** e)
+#define power2of(e) pow(2, e)
 
 ERASEABLE
 float log2of(float e)
index 5ef9cf8b6b17708b6bed1bb664b593d049496e53..8e5308baaa36fd23c403f9124de816f6f1667d1b 100644 (file)
@@ -20,9 +20,9 @@ float Noise_Pink(entity e, float dt)
        float f;
        f = dt * 60;
        // http://home.earthlink.net/~ltrammell/tech/pinkalg.htm
-       if (random() > (0.3190 ** f)) e.noise_paccum = 0.34848 * (2 * random() - 1);
-       if (random() > (0.7756 ** f)) e.noise_paccum2 = 0.28768 * (2 * random() - 1);
-       if (random() > (0.9613 ** f)) e.noise_paccum3 = 0.43488 * (2 * random() - 1);
+       if (random() > pow(0.3190, f)) e.noise_paccum = 0.34848 * (2 * random() - 1);
+       if (random() > pow(0.7756, f)) e.noise_paccum2 = 0.28768 * (2 * random() - 1);
+       if (random() > pow(0.9613, f)) e.noise_paccum3 = 0.43488 * (2 * random() - 1);
        return e.noise_paccum + e.noise_paccum2 + e.noise_paccum3;
 }
 ERASEABLE
@@ -34,6 +34,6 @@ float Noise_White(entity e, float dt)
 ERASEABLE
 float Noise_Burst(entity e, float dt, float p)
 {
-       if (random() > (p ** dt)) e.noise_bstate = !e.noise_bstate;
+       if (random() > pow(p, dt)) e.noise_bstate = !e.noise_bstate;
        return 2 * e.noise_bstate - 1;
 }
index 23bfdf05593ff178f4f31c35d4319d4985d6626a..e048fad8132ff09f8b2bd8b28c30bbde537de2de 100644 (file)
@@ -5,7 +5,7 @@ noref vector _vlen2;
 
 #if 1
 /** Vector distance comparison, avoids sqrt() */
-#define vdist(v, cmp, f) (vlen2(v) cmp ((f) ** 2))
+#define vdist(v, cmp, f) (vlen2(v) cmp pow((f), 2))
 #else
 #define vdist(v, cmp, f) (vlen(v) cmp (f))
 #endif
index e07081e542fc7f11b980c18cf25b0bc0f54c1a41..1455cc9c8e75f5efebd09256a922f0fc09a2c0ba 100644 (file)
@@ -239,7 +239,7 @@ METHOD(XonoticServerList, toggleFavorite, void(XonoticServerList this, string sr
                adding = false;
                string before = (i > 0) ? substring(s, 0, argv_end_index(i - 1)) : "";
                string after = (i < n - 1) ? substring(s, argv_start_index(i + 1), -1) : "";
-               s = strcat(before, (before != "" && after != "" ? " " : ""), after);
+               s = strcat(before, ((before != "" && after != "") ? " " : ""), after);
                ret = s;
                // keep searching
                // TODO: why not break here?
index c0b03af57df5afea037fda43c2953ad794ed596b..ba4bf0782cb7c8a4c861bf91a4267bb7f5f951bf 100644 (file)
@@ -18,8 +18,8 @@ float texmemsize(float s3tc)
 {
        return
        (
-                 2500 * (0.25 ** max(0, cvar("gl_picmip") + cvar("gl_picmip_other")))
-               + 1500 * (0.25 ** max(0, cvar("gl_picmip") + cvar("gl_picmip_world")))
+                 2500 * pow(0.25, max(0, cvar("gl_picmip") + cvar("gl_picmip_other")))
+               + 1500 * pow(0.25, max(0, cvar("gl_picmip") + cvar("gl_picmip_world")))
        ) * ((s3tc && (cvar("r_texture_dds_load") || cvar("gl_texturecompression"))) ? 0.2 : 1.0); // TC: normalmaps 50%, other 25%, few incompressible, guessing 40% as conservative average
 }
 void XonoticPicmipSlider_autofix(entity me)
index 6b1488bac494ec2e2b68987aa13f47122a6dc105..9b4d5ee20b90612a8a67c187ea9e48e5125fe2d4 100644 (file)
@@ -254,7 +254,7 @@ void bot_aimdir(entity this, vector v, float maxfiredeviation)
        this.bot_5th_order_aimfilter= this.bot_5th_order_aimfilter
                + (this.bot_4th_order_aimfilter - this.bot_5th_order_aimfilter) * bound(0, autocvar_bot_ai_aimskill_order_filter_5th,1);
 
-       //blend = (bound(0,skill,10)*0.1)*((1-bound(0,skill,10)*0.05) ** 2.5)*5.656854249; //Plot formule before changing !
+       //blend = (bound(0,skill,10)*0.1)*pow((1-bound(0,skill,10)*0.05), 2.5)*5.656854249; //Plot formule before changing !
        blend = bound(0,skill+this.bot_aimskill,10)*0.1;
        desiredang = desiredang + blend *
        (
@@ -307,7 +307,7 @@ void bot_aimdir(entity this, vector v, float maxfiredeviation)
        blendrate = autocvar_bot_ai_aimskill_blendrate;
        r = max(fixedrate, blendrate);
        //this.v_angle = this.v_angle + diffang * bound(frametime, r * frametime * (2+skill*skill*0.05-random()*0.05*(10-skill)), 1);
-       r = bound(delta_t, r * delta_t * (2 + ((skill + this.bot_mouseskill) ** 3) * 0.005 - random()), 1);
+       r = bound(delta_t, r * delta_t * (2 + pow((skill + this.bot_mouseskill), 3) * 0.005 - random()), 1);
        this.v_angle += diffang * (r + (1 - r) * bound(0, 1 - autocvar_bot_ai_aimskill_mouse, 1));
 
        this.v_angle_z = 0;
index 79b3a96924754bf066ef762b7d602c03faa9ca8b..bdd148082d43fa70acb71808b46f4631ae6c8e78 100644 (file)
@@ -64,7 +64,7 @@ void bot_think(entity this)
        if(autocvar_bot_god)
                this.flags |= FL_GODMODE;
 
-       this.bot_nextthink = max(time, this.bot_nextthink) + max(0.01, autocvar_bot_ai_thinkinterval * (0.5 ** this.bot_aiskill) * min(14 / (skill + 14), 1));
+       this.bot_nextthink = max(time, this.bot_nextthink) + max(0.01, autocvar_bot_ai_thinkinterval * pow(0.5, this.bot_aiskill) * min(14 / (skill + 14), 1));
 
        if (!IS_PLAYER(this) || (autocvar_g_campaign && !campaign_bots_may_start))
        {
@@ -587,7 +587,7 @@ void autoskill(float factor)
 void bot_calculate_stepheightvec()
 {
        stepheightvec = autocvar_sv_stepheight * '0 0 1';
-       jumpheight_vec = (autocvar_sv_jumpvelocity ** 2) / (2 * autocvar_sv_gravity) * '0 0 1';
+       jumpheight_vec = pow(autocvar_sv_jumpvelocity, 2) / (2 * autocvar_sv_gravity) * '0 0 1';
        jumpstepheightvec = stepheightvec + jumpheight_vec * 0.85; // reduce it a bit to make the jumps easy
        jumpheight_time = autocvar_sv_jumpvelocity / autocvar_sv_gravity;
 }
index 689f0c179ffcfc3ea65155ec04153bddb6ce1716..788e6e5c894a6dd105f0b4940e02c9e55b51e324 100644 (file)
@@ -376,7 +376,7 @@ entity havocbot_select_an_item_of_group(entity this, int gr)
        IL_EACH(g_items, it.item_group == gr && it.solid,
        {
                float dist2 = vlen2(this.origin - it.origin);
-               if (dist2 < 600 ** 2 && dist2 > selected_dist2)
+               if (dist2 < pow(600, 2) && dist2 > selected_dist2)
                {
                        selected = it;
                        selected_dist2 = vlen2(this.origin - selected.origin);
@@ -447,7 +447,7 @@ void havocbot_movetogoal(entity this)
                        if(d < db || d < 500)
                        {
                                // Brake
-                               if (vel2 > (maxspeed * 0.3) ** 2)
+                               if (vel2 > pow((maxspeed * 0.3), 2))
                                {
                                        CS(this).movement_x = dir * v_forward * -maxspeed;
                                        return;
@@ -1333,7 +1333,7 @@ void havocbot_chooseenemy(entity this)
        this.havocbot_chooseenemy_finished = time + autocvar_bot_ai_enemydetectioninterval;
        vector eye = this.origin + this.view_ofs;
        entity best = NULL;
-       float bestrating = autocvar_bot_ai_enemydetectionradius ** 2;
+       float bestrating = pow(autocvar_bot_ai_enemydetectionradius, 2);
 
        // Backup hit flags
        int hf = this.dphitcontentsmask;
@@ -1379,7 +1379,7 @@ LABEL(scan_targets)
                {
                        scan_secondary_targets = true;
                        // restart the loop
-                       bestrating = autocvar_bot_ai_enemydetectionradius ** 2;
+                       bestrating = pow(autocvar_bot_ai_enemydetectionradius, 2);
                        goto scan_targets;
                }
 
@@ -1479,7 +1479,7 @@ void havocbot_chooseweapon(entity this, .entity weaponentity)
                this.lastcombotime = time;
        }
 
-       distance *= (2 ** this.bot_rangepreference);
+       distance *= pow(2, this.bot_rangepreference);
 
        // Custom weapon list based on distance to the enemy
        if(bot_custom_weapon){
index 52aff186aef70e133f390c1851f93dc5c613e6f6..e7d752523d6931db5226fca82dd35ec75c16f12c 100644 (file)
@@ -97,8 +97,8 @@ bool havocbot_goalrating_item_pickable_check_players(entity this, vector org, en
        // Rate the item only if no one needs it, or if an enemy is closer to it
        dist2 = vlen2(item_org - org);
        if ((enemy_dist2 < friend_dist2 && dist2 < enemy_dist2)
-               || (friend_dist2 > autocvar_bot_ai_friends_aware_pickup_radius ** 2)
-               || (dist2 < friend_dist2 && dist2 < 200 ** 2))
+               || (friend_dist2 > pow(autocvar_bot_ai_friends_aware_pickup_radius, 2))
+               || (dist2 < friend_dist2 && dist2 < pow(200, 2)))
                return true;
        return false;
 };
index 5a13330652f576268b6ce42a2939716d4517a66f..e072a8372c3aa2d6eb1bbc0b6373b2c663cc114b 100644 (file)
@@ -892,7 +892,7 @@ float bot_cmd_keypress_handler(entity this, string key, float enabled)
        {
                case "all":
                        if(enabled)
-                               this.bot_cmd_keys = (2 ** 20) - 1; // >:)
+                               this.bot_cmd_keys = pow(2, 20) - 1; // >:)
                        else
                                this.bot_cmd_keys = BOT_CMD_KEY_NONE;
                case "forward":
index 98d2ef25b08febaa7805ba1f42e5f7327cb9c0af..0e2f7d55f564ac60b2a0bf630549b6e01790662a 100644 (file)
@@ -225,7 +225,7 @@ float MaplistMethod_Shuffle(float exponent) // more clever shuffling
                string newlist;
 
                // now reinsert this at another position
-               insertpos = (random() ** (1 / exponent));       // ]0, 1]
+               insertpos = pow(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));
index dbe15ee19e88ec96f9fd322fc3df395423b745a6..8fc73e844ce2b660c36ef0256d1e10a8f1097d6c 100644 (file)
@@ -312,7 +312,7 @@ entity Spawn_WeightedPoint(entity firstspot, float lower, float upper, float exp
 
        RandomSelection_Init();
        for(spot = firstspot; spot; spot = spot.chain)
-               RandomSelection_AddEnt(spot, (bound(lower, spot.spawnpoint_score.y, upper) ** exponent) * spot.cnt, (spot.spawnpoint_score.y >= lower) * 0.5 + spot.spawnpoint_score.x);
+               RandomSelection_AddEnt(spot, pow(bound(lower, spot.spawnpoint_score.y, upper), exponent) * spot.cnt, (spot.spawnpoint_score.y >= lower) * 0.5 + spot.spawnpoint_score.x);
 
        return RandomSelection_chosen_ent;
 }
index dfc375bb5a984fab52d12b4720c62b2e7e70c225..bf6c26eec1dc3dda8aa0ca02d31a1336d539fc6f 100755 (executable)
@@ -5,7 +5,7 @@ IFS=$' \n\t'
 WORKDIR=${WORKDIR}
 CPP=${CPP}
 QCC=${QCC}
-QCCIDENT="-DGMQCC"
+QCCIDENT=${QCCIDENT}
 QCCDEFS=${QCCDEFS}
 QCCFLAGS=${QCCFLAGS}