Merge branch 'master' into fruitiex/ctsfix
authorRudolf Polzer <divverent@alientrap.org>
Thu, 9 Dec 2010 21:22:11 +0000 (22:22 +0100)
committerRudolf Polzer <divverent@alientrap.org>
Thu, 9 Dec 2010 21:22:11 +0000 (22:22 +0100)
qcsrc/server/autocvars.qh
qcsrc/server/cl_client.qc
qcsrc/server/cl_physics.qc
qcsrc/server/defs.qh
qcsrc/server/miscfunctions.qc
qcsrc/server/race.qc
qcsrc/server/t_quake3.qc

index eb344da..cd688f8 100644 (file)
@@ -1083,6 +1083,7 @@ float autocvar_sv_dodging_sound;
 float autocvar_sv_dodging_up_speed;
 float autocvar_sv_dodging_wall_distance_threshold;
 float autocvar_sv_dodging_wall_dodging;
+float autocvar_sv_doublejump;
 float autocvar_sv_eventlog;
 float autocvar_sv_eventlog_console;
 float autocvar_sv_eventlog_files;
index 5ff519b..c9cea7d 100644 (file)
@@ -1263,6 +1263,11 @@ void KillIndicator_Think()
                ClientKill_Now(); // no oldself needed
                return;
        }
+    else if(g_cts)
+    {
+        self.nextthink = time + 1;
+        self.cnt -= 1;
+    }
        else
        {
                if(self.cnt <= 10)
@@ -1297,7 +1302,13 @@ void ClientKill_TeamChange (float targetteam) // 0 = don't change, -1 = auto
 
        self.killindicator_teamchange = targetteam;
 
-       if(!self.killindicator)
+    if(g_cts) // allow an instant kill in CTS
+    {
+        ClientKill_Now();
+        return;
+    }
+
+    else if(!self.killindicator)
        {
                if(killtime <= 0 || !self.modelindex || self.deadflag != DEAD_NO)
                {
@@ -1355,20 +1366,14 @@ void ClientKill (void)
                ClientKill_TeamChange(0);
 }
 
-void CTS_ClientKill_Think (void)
+void CTS_ClientKill (entity e) // silent version of ClientKill
 {
-       self = self.owner; // set self to the player to be killed
-       sprint(self, "^1You were killed in order to prevent cheating!");
-       ClientKill_Now();
-}
-
-void CTS_ClientKill (float t) // silent version of ClientKill
-{
-       entity e;
-       e = spawn();
-       e.owner = self;
-       e.think = CTS_ClientKill_Think;
-       e.nextthink = t;
+    e.killindicator = spawn();
+    e.killindicator.owner = e;
+    e.killindicator.think = KillIndicator_Think;
+    e.killindicator.nextthink = time + (e.lip) * 0.05;
+    e.killindicator.cnt = ceil(autocvar_g_cts_finish_kill_delay);
+    e.lip = 0;
 }
 
 void DoTeamChange(float destteam)
index ed459ae..e2feca9 100644 (file)
@@ -30,7 +30,7 @@ void PlayerJump (void)
        float doublejump;
 
        doublejump = FALSE;
-       if (sv_doublejump)
+       if (autocvar_sv_doublejump)
        {
                tracebox(self.origin + '0 0 0.01', self.mins, self.maxs, self.origin - '0 0 0.01', MOVE_NORMAL, self);
                if (trace_fraction < 1 && trace_plane_normal_z > 0.7)
index c9a7e61..76ce748 100644 (file)
@@ -427,7 +427,6 @@ float sv_maxidle;
 float sv_maxidle_spectatorsareidle;
 
 float sv_pogostick;
-float sv_doublejump;
 float tracebox_hits_trigger_hurt(vector start, vector mi, vector ma, vector end);
 
 float next_pingtime;
index 8e052e8..7eb10de 100644 (file)
@@ -880,8 +880,10 @@ float want_weapon(string cvarprefix, entity weaponinfo, float allguns)
                        t = (weaponinfo.spawnflags & WEP_FLAG_NORMAL);
                else if(t < -1)
                        t = 0;
-               else if (g_race || g_cts)
-                       t = (i == WEP_LASER);
+               else if (g_race)
+                       t = (i == WEP_LASER || i == WEP_SHOTGUN);
+               else if (g_cts)
+                       t = (i == WEP_SHOTGUN);
                else if (g_nexball)
                        t = 0; // weapon is set a few lines later
                else
@@ -1295,6 +1297,9 @@ void readlevelcvars(void)
        if (!g_weapon_stay && (cvar("deathmatch") == 2))
                g_weapon_stay = 1;
 
+       if (!g_weapon_stay && g_cts)
+               g_weapon_stay = 1;
+
        g_ghost_items = cvar("g_ghost_items");
 
        if(g_ghost_items >= 1)
@@ -1810,7 +1815,13 @@ void InitializeEntitiesRun()
             self = e_old;
         }
         //dprint("Delayed initialization: ", self.classname, "\n");
-        func();
+        if(func != func_null)
+            func();
+        else
+        {
+            eprint(self);
+            backtrace(strcat("Null function in: ", self.classname, "\n"));
+        }
         self = e;
     }
 }
index 80a379a..9817b3b 100644 (file)
@@ -308,7 +308,7 @@ void race_SendTime(entity e, float cp, float t, float tvalid)
                                        race_setTime(GetMapname(), t, e.crypto_idfp, e.netname, e);
                                        if(g_cts && autocvar_g_cts_finish_kill_delay)
                                        {
-                                               CTS_ClientKill(autocvar_g_cts_finish_kill_delay);
+                                               CTS_ClientKill(e);
                                        }
                                }
                                if(t < recordtime || recordtime == 0)
@@ -742,11 +742,21 @@ void trigger_race_checkpoint_verify()
                for(trigger = world; (trigger = find(trigger, classname, "trigger_multiple")); )
                        for(targ = world; (targ = find(targ, targetname, trigger.target)); )
                                if (targ.classname == "target_checkpoint" || targ.classname == "target_startTimer" || targ.classname == "target_stopTimer") {
-                                       targ.wait = -2;
+                                       trigger.wait = 0;
+                                       trigger.delay = 0;
+                                       targ.wait = 0;
                                        targ.delay = 0;
 
-                                       setsize(targ, trigger.mins, trigger.maxs);
-                                       setorigin(targ, trigger.origin);
+                    // These just make the game crash on some maps with oddly shaped triggers. 
+                    // (on the other hand they used to fix the case when two players ran through a checkpoint at once, 
+                    // and often one of them just passed through without being registered. Hope it's fixed  in a better way now.
+                    // (happened on item triggers too)
+                    //
+                                       //targ.wait = -2;
+                                       //targ.delay = 0;
+
+                                       //setsize(targ, trigger.mins, trigger.maxs);
+                                       //setorigin(targ, trigger.origin);
                                        //remove(trigger);
                                }
        }
index 241b8f7..c63b4de 100644 (file)
@@ -47,11 +47,13 @@ void target_init_verify()
                for(targ = world; (targ = find(targ, targetname, trigger.target)); )
                        if (targ.classname == "target_init" || targ.classname == "target_give" || targ.classname == "target_items")
                        {
-                               targ.wait = -2;
+                               trigger.wait = 0;
+                               trigger.delay = 0;
+                               targ.wait = 0;
                                targ.delay = 0;
 
-                               setsize(targ, trigger.mins, trigger.maxs);
-                               setorigin(targ, trigger.origin);
+                               //setsize(targ, trigger.mins, trigger.maxs);
+                               //setorigin(targ, trigger.origin);
                                //remove(trigger);
                        }
 }
@@ -59,7 +61,7 @@ void target_init_verify()
 void spawnfunc_target_init()
 {
        self.spawnflags = 0; // remove all weapons except the ones listed below
-       self.netname = "laser uzi"; // keep these weapons through the remove trigger
+       self.netname = "shotgun"; // keep these weapons through the remove trigger
        spawnfunc_target_items();
        InitializeEntity(self, target_init_verify, INITPRIO_FINDTARGET);
 }