get rid of all cheat stuff from other files;
authordiv0 <div0@f962a42d-fe04-0410-a3ab-8c8b0445ebaa>
Mon, 25 Jan 2010 17:05:43 +0000 (17:05 +0000)
committerdiv0 <div0@f962a42d-fe04-0410-a3ab-8c8b0445ebaa>
Mon, 25 Jan 2010 17:05:43 +0000 (17:05 +0000)
make sv_cheats global not used outside
when compiling with -DNOCHEATS, cheat code is not even compiled in

git-svn-id: svn://svn.icculus.org/nexuiz/trunk@8555 f962a42d-fe04-0410-a3ab-8c8b0445ebaa

data/qcsrc/server/campaign.qc
data/qcsrc/server/cheats.qc
data/qcsrc/server/cheats.qh
data/qcsrc/server/cl_client.qc
data/qcsrc/server/clientcommands.qc
data/qcsrc/server/defs.qh
data/qcsrc/server/ent_cs.qc
data/qcsrc/server/gamecommand.qc
data/qcsrc/server/miscfunctions.qc

index f14d6cf..8a01a23 100644 (file)
@@ -186,7 +186,7 @@ void CampaignPreIntermission()
                head = head.chain;
        }
 
-       if(won == 1 && lost == 0 && checkrules_equality == 0)
+       if(won == 1 && lost == 0 && checkrules_equality == 0 && cheatcount_total == 0)
        {
                campaign_won = 1;
                bprint("The current level has been WON.\n");
@@ -241,8 +241,6 @@ void CampaignPostIntermission()
 
 void CampaignLevelWarp(float n)
 {
-       if(!sv_cheats)
-               return;
        CampaignFile_Unload();
        CampaignFile_Load(n, 1);
        if(campaign_entries)
index 19bfc5a..3012732 100644 (file)
@@ -1,5 +1,18 @@
 void CopyBody(float keepvelocity);
 
+#ifdef NOCHEATS
+
+float CheatImpulse(float i) { return 0; }
+float CheatCommand(float argc) { return 0; }
+float CheatFrame() { return 0; }
+void CheatInit() { cheatcount_total = world.cheatcount; }
+void CheatShutdown() { }
+void CheatInitClient() { }
+void CheatShutdownClient() { }
+void Drag_MoveDrag(entity from, entity to) { }
+
+#else
+
 .float maycheat;
 float sv_cheats;
 float autocvar_sv_cheats;
@@ -14,11 +27,28 @@ float autocvar_sv_cheats;
 
 #define CHRAME_DRAG 1
 
+void CheatInit()
+{
+       sv_cheats = cvar("sv_cheats");
+}
+
+void CheatShutdown()
+{
+}
+
+void CheatInitClient()
+{
+}
+
+void CheatShutdownClient()
+{
+}
+
 float CheatsAllowed(float i, float argc, float fr) // the cheat gets passed as argument for possible future ACL checking
 {
        if(i == CHIMPULSE_CLONE_MOVING || i == CHIMPULSE_CLONE_STANDING)
                if(self.lip < sv_clones)
-                       goto allow;
+                       return 1;
        if(self.maycheat)
                return 1;
        if(sv_cheats && autocvar_sv_cheats)
@@ -213,6 +243,8 @@ float CheatImpulse(float i)
        return 1;
 }
 
+void DragBox_Think();
+float drag_lastcnt;
 float CheatCommand(float argc)
 {
        if not(CheatsAllowed(0, argc, 0))
@@ -530,6 +562,13 @@ float CheatCommand(float argc)
                        for(e = world; (e = find(e, classname, "drag_digit")); )
                                remove(e);
                        goto cheated;
+               case "warp":
+                       if(argc == 2) if(cvar("g_campaign"))
+                       {
+                               CampaignLevelWarp(stof(argv(1)));
+                               goto cheated;
+                       }
+                       break;
                case "god":
                        BITXOR_ASSIGN(self.flags, FL_GODMODE);
                        if(self.flags & FL_GODMODE)
@@ -842,3 +881,44 @@ void Drag_MoveDrag(entity from, entity to)
        }
 }
 
+
+
+
+
+
+void DragBox_Think()
+{
+       if(self.aiment && self.enemy)
+       {
+               self.origin_x = (self.aiment.origin_x + self.enemy.origin_x) * 0.5;
+               self.origin_y = (self.aiment.origin_y + self.enemy.origin_y) * 0.5;
+               self.origin_z = (self.aiment.origin_z + self.enemy.origin_z) * 0.5;
+               self.maxs_x = fabs(self.aiment.origin_x - self.enemy.origin_x) * 0.5;
+               self.maxs_y = fabs(self.aiment.origin_y - self.enemy.origin_y) * 0.5;
+               self.maxs_z = fabs(self.aiment.origin_z - self.enemy.origin_z) * 0.5;
+               self.mins = -1 * self.maxs;
+               setorigin(self, self.origin); setsize(self, self.mins, self.maxs); // link edict
+       }
+
+       if(self.cnt == -1) // actually race_place -1
+       {
+               // show "10 10" for qualifying spawns
+               setmodel(self.killindicator, "models/sprites/10.spr32");
+               setmodel(self.killindicator.killindicator, "models/sprites/10.spr32");
+       }
+       else if(self.cnt == -2) // actually race_place 0
+       {
+               // show "10 0" for loser spawns
+               setmodel(self.killindicator, "models/sprites/10.spr32");
+               setmodel(self.killindicator.killindicator, "models/sprites/0.spr32");
+       }
+       else
+       {
+               setmodel(self.killindicator, strcat("models/sprites/", ftos(mod(self.cnt, 10)), ".spr32"));
+               setmodel(self.killindicator.killindicator, strcat("models/sprites/", ftos(floor(self.cnt / 10)), ".spr32"));
+       }
+
+       self.nextthink = time;
+}
+
+#endif
index 1288c61..cb365a3 100644 (file)
@@ -1,5 +1,11 @@
 float cheatcount_total;
 .float cheatcount;
+void CheatInit();
+void CheatShutdown();
+void CheatInitClient();
+void CheatShutdownClient();
 float CheatImpulse(float i);
 float CheatCommand(float argc);
 float CheatFrame();
+
+void Drag_MoveDrag(entity from, entity to); // call this from CopyBody
index d566911..73fb1d6 100644 (file)
@@ -1447,7 +1447,7 @@ void ClientConnect (void)
                ctf_clientconnect();
        }*/
 
-       if(teams_matter || sv_cheats)
+       if(teams_matter || radar_showennemies)
                attach_entcs();
 
        bot_relinkplayerlist();
index 93630c4..883e83f 100644 (file)
@@ -94,42 +94,6 @@ entity GetPlayer(string name)
        return world;
 }
 
-float drag_lastcnt;
-void DragBox_Think()
-{
-       if(self.aiment && self.enemy)
-       {
-               self.origin_x = (self.aiment.origin_x + self.enemy.origin_x) * 0.5;
-               self.origin_y = (self.aiment.origin_y + self.enemy.origin_y) * 0.5;
-               self.origin_z = (self.aiment.origin_z + self.enemy.origin_z) * 0.5;
-               self.maxs_x = fabs(self.aiment.origin_x - self.enemy.origin_x) * 0.5;
-               self.maxs_y = fabs(self.aiment.origin_y - self.enemy.origin_y) * 0.5;
-               self.maxs_z = fabs(self.aiment.origin_z - self.enemy.origin_z) * 0.5;
-               self.mins = -1 * self.maxs;
-               setorigin(self, self.origin); setsize(self, self.mins, self.maxs); // link edict
-       }
-
-       if(self.cnt == -1) // actually race_place -1
-       {
-               // show "10 10" for qualifying spawns
-               setmodel(self.killindicator, "models/sprites/10.spr32");
-               setmodel(self.killindicator.killindicator, "models/sprites/10.spr32");
-       }
-       else if(self.cnt == -2) // actually race_place 0
-       {
-               // show "10 0" for loser spawns
-               setmodel(self.killindicator, "models/sprites/10.spr32");
-               setmodel(self.killindicator.killindicator, "models/sprites/0.spr32");
-       }
-       else
-       {
-               setmodel(self.killindicator, strcat("models/sprites/", ftos(mod(self.cnt, 10)), ".spr32"));
-               setmodel(self.killindicator.killindicator, strcat("models/sprites/", ftos(floor(self.cnt / 10)), ".spr32"));
-       }
-
-       self.nextthink = time;
-}
-
 //float ctf_clientcommand();
 float readyrestart_happened;
 .float lms_spectate_warning;
index b8f9e65..f18fcb9 100644 (file)
@@ -42,7 +42,6 @@ float g_pickup_respawntimejitter_powerup;
 float g_jetpack;
 
 float sv_clones;
-float sv_cheats;
 float sv_gentle;
 float sv_foginterval;
 
@@ -575,8 +574,6 @@ vector debug_shotorg; // if non-zero, overrides the shot origin of all weapons
 
 float servertime, serverprevtime, serverframetime;
 
-void Drag_MoveDrag(entity from, entity to);
-
 .entity soundentity;
 
 .float ammo_fuel;
@@ -608,7 +605,6 @@ string matchid;
 FTEQCC_YOU_SUCK_THIS_IS_NOT_UNREFERENCED(stats_hit);
 FTEQCC_YOU_SUCK_THIS_IS_NOT_UNREFERENCED(stats_fired);
 
-.float maycheat;
 .float stat_leadlimit;
 
 float radar_showennemies;
index 3e7f490..bee79d6 100644 (file)
@@ -32,7 +32,7 @@ float entcs_customize()
                return FALSE;
        if(other.classname == "player")
                if(o.team != other.team)
-                       if not (sv_cheats || radar_showennemies)
+                       if not (radar_showennemies)
                                return FALSE;
        return TRUE;
 }
index 316f5b8..cf2ae40 100644 (file)
@@ -683,12 +683,6 @@ void GameCommand(string command)
                return;
        }
 
-       if(argv(0) == "warp") if(argc == 2) if(cvar("g_campaign"))
-       {
-               CampaignLevelWarp(stof(argv(1)));
-               return;
-       }
-
        if(argv(0) == "gotomap") if(argc == 2)
        {
                print(GotoMap(argv(1)), "\n");
index 65155f2..3a8cf78 100644 (file)
@@ -1230,7 +1230,6 @@ void readlevelcvars(void)
                sv_loddistance2 = 1073741824; // enough to turn off LOD 2 reliably
 
        sv_clones = cvar("sv_clones");
-       sv_cheats = cvar("sv_cheats");
        sv_gentle = cvar("sv_gentle");
        sv_foginterval = cvar("sv_foginterval");
        g_cloaked = cvar("g_cloaked");