]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/movetypes.qc
Remove for-loop workaround
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / movetypes.qc
index a1e9a65f7a6008717266c715e72173bbcae4aedb..2f62ae6dcf77741849bde451f5a5cc8189a9f415 100644 (file)
@@ -1,3 +1,16 @@
+#if defined(CSQC)
+       #include "../dpdefs/csprogsdefs.qh"
+       #include "defs.qh"
+       #include "../common/stats.qh"
+       #include "../common/util.qh"
+       #include "movetypes.qh"
+       #include "../csqcmodellib/common.qh"
+       #include "../server/t_items.qh"
+#elif defined(MENUQC)
+#elif defined(SVQC)
+#endif
+
+
 const int MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE = 4;
 #define GRAVITY_UNAFFECTED_BY_TICRATE (getstati(STAT_MOVEFLAGS) & MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE)
 
@@ -11,14 +24,10 @@ void _Movetype_CheckVelocity() // SV_CheckVelocity
 
 float _Movetype_CheckWater(entity ent) // SV_CheckWater
 {
-       int supercontents;
-       float nativecontents;
-       vector point;
+       vector point = ent.move_origin;
+       point.z += (ent.mins.z + 1);
 
-       point = ent.move_origin;
-       point_z += (ent.mins.z + 1);
-
-       nativecontents = pointcontents(point);
+       int nativecontents = pointcontents(point);
 
        if(ent.move_watertype)
        if(ent.move_watertype != nativecontents)
@@ -31,16 +40,16 @@ float _Movetype_CheckWater(entity ent) // SV_CheckWater
        ent.move_waterlevel = 0;
        ent.move_watertype = CONTENT_EMPTY;
 
-       supercontents = Mod_Q1BSP_SuperContentsFromNativeContents(nativecontents);
+       int supercontents = Mod_Q1BSP_SuperContentsFromNativeContents(nativecontents);
        if(supercontents & DPCONTENTS_LIQUIDSMASK)
        {
                ent.move_watertype = nativecontents;
                ent.move_waterlevel = 1;
-               point_y = (ent.origin.y + ((ent.mins.z + ent.maxs.y) * 0.5));
+               point.y = (ent.origin.y + ((ent.mins.z + ent.maxs.y) * 0.5));
                if(Mod_Q1BSP_SuperContentsFromNativeContents(pointcontents(point)) & DPCONTENTS_LIQUIDSMASK)
                {
                        ent.move_waterlevel = 2;
-                       point_y = ent.origin.y + ent.view_ofs.y;
+                       point.y = ent.origin.y + ent.view_ofs.y;
                        if(Mod_Q1BSP_SuperContentsFromNativeContents(pointcontents(point)) & DPCONTENTS_LIQUIDSMASK)
                                ent.move_waterlevel = 3;
                }
@@ -52,7 +61,7 @@ float _Movetype_CheckWater(entity ent) // SV_CheckWater
 void _Movetype_CheckWaterTransition(entity ent) // SV_CheckWaterTransition
 {
        float contents = pointcontents(ent.move_origin);
-       
+
        if(!ent.move_watertype)
        {
                // just spawned here
@@ -234,9 +243,9 @@ vector _Movetype_ClipVelocity(vector vel, vector norm, float f) // SV_ClipVeloci
 {
        vel = vel - ((vel * norm) * norm) * f;
 
-       if(vel.x > -0.1 && vel.x < 0.1) vel_x = 0;
-       if(vel.y > -0.1 && vel.y < 0.1) vel_y = 0;
-       if(vel.z > -0.1 && vel.z < 0.1) vel_z = 0;
+       if(vel.x > -0.1 && vel.x < 0.1) vel.x = 0;
+       if(vel.y > -0.1 && vel.y < 0.1) vel.y = 0;
+       if(vel.z > -0.1 && vel.z < 0.1) vel.z = 0;
 
        return vel;
 }