]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/cheats.qc
Remove some leftovers from merge
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / cheats.qc
index f3c64a6967dd84a90b79718493946c4ac2a88b09..0c6fc7f39d483e7b0b931e18f25360fbc4730392 100644 (file)
@@ -1,3 +1,31 @@
+#include "cheats.qh"
+#include "_all.qh"
+
+#include "g_damage.qh"
+#include "race.qh"
+#include "../common/triggers/teleporters.qh"
+
+#include "mutators/mutators_include.qh"
+
+#include "weapons/tracing.qh"
+
+#include "../common/constants.qh"
+#include "../common/deathtypes.qh"
+#include "../common/util.qh"
+
+#include "../common/monsters/all.qh"
+
+#include "../common/weapons/all.qh"
+
+#include "../common/triggers/subs.qh"
+
+#include "../common/triggers/func/breakable.qh"
+
+#include "../csqcmodellib/sv_model.qh"
+
+#include "../warpzonelib/anglestransform.qh"
+#include "../warpzonelib/util_server.qh"
+
 void CopyBody(float keepvelocity);
 
 #ifdef NOCHEATS
@@ -16,15 +44,7 @@ void Drag_MoveDrag(entity from, entity to) { }
 .float maycheat;
 float gamestart_sv_cheats;
 
-const float CHIMPULSE_SPEEDRUN_INIT = 30;
-const float CHIMPULSE_GIVE_ALL = 99;
-const float CHIMPULSE_CLONE_MOVING = 140;
-const float CHIMPULSE_SPEEDRUN = 141;
-const float CHIMPULSE_CLONE_STANDING = 142;
-const float CHIMPULSE_TELEPORT = 143;
-const float CHIMPULSE_R00T = 148;
 
-const float CHRAME_DRAG = 8;
 
 void CheatInit()
 {
@@ -103,7 +123,7 @@ void info_autoscreenshot_findtarget()
                return;
        }
        vector a = vectoangles(e.origin - self.origin);
-       a_x = -a.x; // don't ask
+       a.x = -a.x; // don't ask
        self.angles_x = a.x;
        self.angles_y = a.y;
        // we leave Rick Roll alone
@@ -178,7 +198,7 @@ float CheatImpulse(float i)
                        IS_CHEAT(i, 0, 0);
                        if(self.personal)
                        {
-                               self.speedrunning = TRUE;
+                               self.speedrunning = true;
                                tracebox(self.personal.origin, self.mins, self.maxs, self.personal.origin, MOVE_WORLDONLY, self);
                                if(trace_startsolid)
                                {
@@ -190,7 +210,7 @@ float CheatImpulse(float i)
                                        setorigin(self, self.personal.origin);
                                        self.oldvelocity = self.velocity = self.personal.velocity;
                                        self.angles = self.personal.v_angle;
-                                       self.fixangle = TRUE;
+                                       self.fixangle = true;
 
                                        MUTATOR_CALLHOOK(AbortSpeedrun);
                                }
@@ -232,7 +252,7 @@ float CheatImpulse(float i)
                                        self.angles = e.angles;
                                        remove(e);
                                        // should we? self.angles_x = -self.angles_x;
-                                       self.fixangle = TRUE;
+                                       self.fixangle = true;
                                        self.velocity = '0 0 0';
                                        DID_CHEAT();
                                        break;
@@ -242,7 +262,7 @@ float CheatImpulse(float i)
                        {
                                sprint(self, "Emergency teleport used random location\n");
                                self.angles_x = -self.angles.x;
-                               self.fixangle = TRUE;
+                               self.fixangle = true;
                                self.velocity = '0 0 0';
                                DID_CHEAT();
                                break;
@@ -319,7 +339,7 @@ float CheatCommand(float argc)
                                // arguments:
                                //   effectname
                                effectnum = particleeffectnum(argv(1));
-                               W_SetupShot(self, FALSE, FALSE, "", CH_WEAPON_A, 0);
+                               W_SetupShot(self, false, false, "", CH_WEAPON_A, 0);
                                traceline(w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, MOVE_NORMAL, self);
                                trailparticles(self, effectnum, w_shotorg, trace_endpos);
                                DID_CHEAT();
@@ -334,7 +354,7 @@ float CheatCommand(float argc)
                                // arguments:
                                //   modelname mode
                                f = stof(argv(2));
-                               W_SetupShot(self, FALSE, FALSE, "", CH_WEAPON_A, 0);
+                               W_SetupShot(self, false, false, "", CH_WEAPON_A, 0);
                                traceline(w_shotorg, w_shotorg + w_shotdir * 2048, MOVE_NORMAL, self);
                                if((trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT) || trace_fraction == 1)
                                {
@@ -420,9 +440,9 @@ float CheatCommand(float argc)
                        e.enemy.skin = 1;
                        setsize(e.enemy, '0 0 0', '0 0 0');
                        end = normalize(self.origin + self.view_ofs - e.aiment.origin);
-                       end_x = (end.x > 0) * 2 - 1;
-                       end_y = (end.y > 0) * 2 - 1;
-                       end_z = (end.z > 0) * 2 - 1;
+                       end.x = (end.x > 0) * 2 - 1;
+                       end.y = (end.y > 0) * 2 - 1;
+                       end.z = (end.z > 0) * 2 - 1;
                        if(argc == 4)
                                setorigin(e.enemy, stov(argv(3)));
                        else
@@ -750,11 +770,11 @@ float CheatFrame()
                        {
                                // use cheat dragging if cheats are enabled
                                crosshair_trace_plusvisibletriggers(self);
-                               Drag(TRUE, TRUE);
+                               Drag(true, true);
                        }
                        else
                        {
-                               Drag(FALSE, FALSE); // execute dragging
+                               Drag(false, false); // execute dragging
                        }
                        break;
        }
@@ -768,13 +788,23 @@ float CheatFrame()
 
 // ENTITY DRAGGING
 
+// on dragger:
+.float draggravity;
+.float dragspeed; // speed of mouse wheel action
+.float dragdistance; // distance of dragentity's draglocalvector from view_ofs
+.vector draglocalvector; // local attachment vector of the dragentity
+.float draglocalangle;
+// on draggee:
+.entity draggedby;
+.float dragmovetype;
+
 float Drag(float force_allow_pick, float ischeat)
 {
        BEGIN_CHEAT_FUNCTION();
 
-       // returns TRUE when an entity has been picked up
-       // If pick is TRUE, the object can also be picked up if it's not being held already
-       // If pick is FALSE, only keep dragging the object if it's already being held
+       // returns true when an entity has been picked up
+       // If pick is true, the object can also be picked up if it's not being held already
+       // If pick is false, only keep dragging the object if it's already being held
 
        switch(0)
        {
@@ -820,7 +850,7 @@ float Drag(float force_allow_pick, float ischeat)
                                                float pick = force_allow_pick;
                                                if (e && !pick)
                                                {
-                                                       // pick is TRUE if the object can be picked up. While an object is being carried, the Drag() function
+                                                       // pick is true if the object can be picked up. While an object is being carried, the Drag() function
                                                        // must execute for it either way, otherwise it would cause bugs if it went out of the player's trace.
                                                        // This also makes sure that an object can only pe picked up if in range, but does not get dropped if
                                                        // it goes out of range while slinging it around.
@@ -833,14 +863,14 @@ float Drag(float force_allow_pick, float ischeat)
                                                                                break;
                                                                        case 1: // owner can grab
                                                                                if(e.owner == self || e.realowner == self)
-                                                                                       pick = TRUE;
+                                                                                       pick = true;
                                                                                break;
                                                                        case 2: // owner and team mates can grab
                                                                                if(SAME_TEAM(e.owner, self) || SAME_TEAM(e.realowner, self) || e.team == self.team)
-                                                                                       pick = TRUE;
+                                                                                       pick = true;
                                                                                break;
                                                                        case 3: // anyone can grab
-                                                                               pick = TRUE;
+                                                                               pick = true;
                                                                                break;
                                                                        default:
                                                                                break;
@@ -860,24 +890,15 @@ float Drag(float force_allow_pick, float ischeat)
                                                                Drag_Begin(self, e, trace_endpos);
                                                                if(ischeat)
                                                                        DID_CHEAT();
-                                                               return TRUE;
+                                                               return true;
                                                        }
                                        }
                        }
                        break;
        }
-       return FALSE;
+       return false;
 }
 
-// on dragger:
-.float draggravity;
-.float dragspeed; // speed of mouse wheel action
-.float dragdistance; // distance of dragentity's draglocalvector from view_ofs
-.vector draglocalvector; // local attachment vector of the dragentity
-.float draglocalangle;
-// on draggee:
-.entity draggedby;
-.float dragmovetype;
 void Drag_Begin(entity dragger, entity draggee, vector touchpoint)
 {
        float tagscale;
@@ -938,35 +959,35 @@ float Drag_IsDraggable(entity draggee)
 {
        // TODO add more checks for bad stuff here
        if(draggee == world)
-               return FALSE;
+               return false;
        if(draggee.classname == "func_bobbing")
-               return FALSE;
+               return false;
        if(draggee.classname == "door") // FIXME find out why these must be excluded, or work around the problem (trying to drag these causes like 4 fps)
-               return FALSE;
+               return false;
        if(draggee.classname == "plat")
-               return FALSE;
+               return false;
        if(draggee.classname == "func_button")
-               return FALSE;
+               return false;
 //     if(draggee.model == "")
-//             return FALSE;
+//             return false;
        if(IS_SPEC(draggee))
-               return FALSE;
+               return false;
        if(IS_OBSERVER(draggee))
-               return FALSE;
+               return false;
        if(draggee.classname == "exteriorweaponentity")
-               return FALSE;
+               return false;
        if(draggee.classname == "weaponentity")
-               return FALSE;
+               return false;
 
-       return TRUE;
+       return true;
 }
 
 float Drag_MayChangeAngles(entity draggee)
 {
        // TODO add more checks for bad stuff here
        if(substring(draggee.model, 0, 1) == "*")
-               return FALSE;
-       return TRUE;
+               return false;
+       return true;
 }
 
 void Drag_MoveForward(entity dragger)
@@ -1023,18 +1044,18 @@ float Drag_CanDrag(entity dragger)
 float Drag_IsDragging(entity dragger)
 {
        if(!dragger.dragentity)
-               return FALSE;
+               return false;
        if(wasfreed(dragger.dragentity) || dragger.dragentity.draggedby != dragger)
        {
                dragger.dragentity = world;
-               return FALSE;
+               return false;
        }
        if(!Drag_CanDrag(dragger) || !Drag_IsDraggable(dragger.dragentity))
        {
                Drag_Finish(dragger);
-               return FALSE;
+               return false;
        }
-       return TRUE;
+       return true;
 }
 
 void Drag_MoveDrag(entity from, entity to)