]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge remote branch 'origin/master' into samual/flyingspectators
authorSamual <samual@xonotic.org>
Sun, 14 Aug 2011 22:28:31 +0000 (18:28 -0400)
committerSamual <samual@xonotic.org>
Sun, 14 Aug 2011 22:28:31 +0000 (18:28 -0400)
Conflicts:
qcsrc/server/t_teleporters.qc
qcsrc/warpzonelib/server.qc

defaultXonotic.cfg
qcsrc/client/movetypes.qh
qcsrc/server/cl_client.qc
qcsrc/server/cl_physics.qc
qcsrc/server/constants.qh
qcsrc/server/defs.qh
qcsrc/server/miscfunctions.qc
qcsrc/server/t_teleporters.qc
qcsrc/warpzonelib/server.qc

index abd694165555a965831f4fb7a5882b525f036ce4..5d275d3b32e9fe8422c701d6e1822296ef367f8e 100644 (file)
@@ -1733,7 +1733,9 @@ alias gl_flashblend_update "_gl_flashblend_update_$r_shadow_realtime_dlight$r_sh
 
 set sv_clones 0        "number of clones a player may make (reset by the \"kill\" command)"
 
-set cl_handicap 1      "the higher, the more damage you will receive (client setting)"
+set cl_handicap 1      "the higher, the more damage you will receive (client setting) NOTE: reconnect or use sendcvar command to update the choice."
+
+seta cl_clippedspectating 1 "movement collision for spectators so that you can't pass through walls and such. (client setting) NOTE: reconnect or use sendcvar command to update the choice." 
 
 // must be at the bottom of this file:
 // alias for switching the teamselect menu
index 3ec9a8f1d35f50148833f68cc82fc234d48ef9da..2a917718f9225f397f039b31d079dbfb876e77c1 100644 (file)
@@ -28,6 +28,7 @@ float MOVETYPE_BOUNCE                         = 10;
 float  MOVETYPE_BOUNCEMISSILE  = 11;   // Like bounce but doesn't lose speed on bouncing
 float MOVETYPE_FOLLOW = 12;
 float MOVETYPE_FAKEPUSH = 13;
+float MOVETYPE_SPECTATOR = 14;
 
 float   FL_ITEM                 = 256;
 float  FL_ONGROUND                             = 512;
index a497f8c34e336a4508296ebafb80e769ab401c52..cc4920ff797e4697a77514d163ee1f31621dbc61 100644 (file)
@@ -656,13 +656,13 @@ void PutObserverInServer (void)
        accuracy_resend(self);
 
        self.spectatortime = time;
-
+       
        self.classname = "observer";
        self.iscreature = FALSE;
        self.health = -666;
        self.takedamage = DAMAGE_NO;
        self.solid = SOLID_NOT;
-       self.movetype = MOVETYPE_NOCLIP;
+       self.movetype = MOVETYPE_SPECTATOR; //(self.cvar_cl_clippedspectating ? MOVETYPE_NOCLIP : MOVETYPE_FLY); // it's too early for this anyway, lets just set it in playerprethink
        self.flags = FL_CLIENT | FL_NOTARGET;
        self.armorvalue = 666;
        self.effects = 0;
@@ -691,9 +691,9 @@ void PutObserverInServer (void)
        self.fixangle = TRUE;
        self.crouch = FALSE;
 
-       self.view_ofs = PL_VIEW_OFS;
+       self.view_ofs = '0 0 0'; // so that you can't go inside walls with MOVETYPE_FLY, previously "PL_VIEW_OFS" - for some reason this is diff from normal players
        setorigin (self, spot.origin);
-       setsize (self, '0 0 0', '0 0 0');
+       setsize (self, '-16 -16 -24', '16 16 24'); // so that you can't go inside walls with MOVETYPE_FLY
        self.prevorigin = self.origin;
        self.items = 0;
        self.weapons = 0;
@@ -2527,6 +2527,7 @@ void checkSpectatorBlock() {
 
 void ObserverThink()
 {
+       float prefered_movetype;
        if (self.flags & FL_JUMPRELEASED) {
                if (self.BUTTON_JUMP && !self.version_mismatch) {
                        self.welcomemessage_time = 0;
@@ -2538,6 +2539,10 @@ void ObserverThink()
                        if(SpectateNext() == 1) {
                                self.classname = "spectator";
                        }
+               } else {
+                       prefered_movetype = (self.cvar_cl_clippedspectating ? MOVETYPE_SPECTATOR : MOVETYPE_NOCLIP);
+                       if (self.movetype != prefered_movetype)
+                               self.movetype = prefered_movetype;
                }
        } else {
                if (!(self.BUTTON_ATCK || self.BUTTON_JUMP)) {
index 83c438b47600f7b07bd8fbf3fe54e99f2c992d15..4af6dac1c6d1839189750d0f666f92bd15844c90 100644 (file)
@@ -904,6 +904,7 @@ void SV_PlayerPhysics()
        }
 
        if(self.flags & FL_ONGROUND)
+       if(self.classname == "player") // no fall sounds for observers thank you very much
        if(self.wasFlying)
        {
                self.wasFlying = 0;
index dca76fe003ca685ebee8e32bfdee56c0228e63fe..038dae4664257c9f65a8d34d68a12dce9e89fef4 100644 (file)
@@ -33,6 +33,7 @@ float MOVETYPE_FLYMISSILE                     = 9;
 float  MOVETYPE_BOUNCE                         = 10;
 float  MOVETYPE_BOUNCEMISSILE  = 11;   // Like bounce but doesn't lose speed on bouncing
 //float        MOVETYPE_FOLLOW                         = 12;   // 'Attaches' the entity to its aim_ent
+float  MOVETYPE_SPECTATOR                      = 14;
 
 float  SOLID_NOT                               = 0;
 float  SOLID_TRIGGER                           = 1;
index 2e8ba3d698064524db892edbc3145e981e3fc889..4809fcde07c9400d273286e0345e6f0e40c901dd 100644 (file)
@@ -313,6 +313,9 @@ float default_weapon_alpha;
 .float cvar_cl_handicap;
 .float cvar_cl_playerdetailreduction;
 .float cvar_scr_centertime;
+.float cvar_cl_shownames;
+.float cvar_cl_clippedspectating;
+
 .string cvar_g_xonoticversion;
 .string cvar_cl_weaponpriority;
 .string cvar_cl_weaponpriorities[10];
index b669b041f51f765b10c8875b3e2d5c89d8fe6308..9a952ab54d2ef484a374e42e9693fe6f4321e230 100644 (file)
@@ -582,6 +582,7 @@ void GetCvars(float f)
        GetCvars_handleFloat(s, f, cvar_scr_centertime, "scr_centertime");
        GetCvars_handleString(s, f, cvar_g_xonoticversion, "g_xonoticversion");
        GetCvars_handleFloat(s, f, cvar_cl_handicap, "cl_handicap");
+       GetCvars_handleFloat(s, f, cvar_cl_clippedspectating, "cl_clippedspectating");
        GetCvars_handleString_Fixup(s, f, cvar_cl_weaponpriority, "cl_weaponpriority", W_FixWeaponOrder_ForceComplete_AndBuildImpulseList);
        GetCvars_handleString_Fixup(s, f, cvar_cl_weaponpriorities[0], "cl_weaponpriority0", W_FixWeaponOrder_AllowIncomplete);
        GetCvars_handleString_Fixup(s, f, cvar_cl_weaponpriorities[1], "cl_weaponpriority1", W_FixWeaponOrder_AllowIncomplete);
index 0adbd5196af1731fecf51774167e77816d161c1b..e069aec9f3d7e18c1d2f9af5cfecc21aa745cd80 100644 (file)
@@ -87,16 +87,19 @@ void TeleportPlayer(entity teleporter, entity player, vector to, vector to_angle
 
        makevectors (to_angles);
 
-       if(self.pushltime < time) // only show one teleport effect per teleporter per 0.2 seconds, for better fps
+       if(player.classname == "player") // don't play sounds or show particles for anything that isn't a player, maybe change later to block only observers
        {
-               if(tflags & TELEPORT_FLAG_SOUND)
-                       sound (player, CH_TRIGGER, "misc/teleport.wav", VOL_BASE, ATTN_NORM);
-               if(tflags & TELEPORT_FLAG_PARTICLES)
+               if(self.pushltime < time) // only show one teleport effect per teleporter per 0.2 seconds, for better fps
                {
-                       pointparticles(particleeffectnum("teleport"), player.origin, '0 0 0', 1);
-                       pointparticles(particleeffectnum("teleport"), to + v_forward * 32, '0 0 0', 1);
+                       if(tflags & TELEPORT_FLAG_SOUND)
+                               sound (player, CH_TRIGGER, "misc/teleport.wav", VOL_BASE, ATTN_NORM);
+                       if(tflags & TELEPORT_FLAG_PARTICLES)
+                       {
+                               pointparticles(particleeffectnum("teleport"), player.origin, '0 0 0', 1);
+                               pointparticles(particleeffectnum("teleport"), to + v_forward * 32, '0 0 0', 1);
+                       }
+                       self.pushltime = time + 0.2;
                }
-               self.pushltime = time + 0.2;
        }
 
        // Relocate the player
@@ -138,17 +141,56 @@ void TeleportPlayer(entity teleporter, entity player, vector to, vector to_angle
        }
 }
 
-void Teleport_Touch (void)
+void Simple_TeleportPlayer(entity teleporter, entity player)
 {
-       entity oldself, e;
-       vector o;
+       vector locout;
+       entity e;
        float p;
+       
+       // Find the output teleporter
+       if(!teleporter.enemy)
+       { 
+               RandomSelection_Init();
+               for(e = world; (e = find(e, targetname, teleporter.target)); )
+               {
+                       p = 1;
+                       if(autocvar_g_telefrags_avoid)
+                       {
+                               locout = e.origin + '0 0 1' * (1 - player.mins_z - 24);
+                               if(check_tdeath(player, locout, '0 0 0', '0 0 0'))
+                                       p = 0;
+                       }
+                       RandomSelection_Add(e, 0, string_null, (e.cnt ? e.cnt : 1), p);
+               }
+               teleporter.enemy = RandomSelection_chosen_ent;
+       }
+
+       if(!teleporter.enemy) { sprint(player, "Teleport destination vanished. Sorry... please complain to the mapper.\n"); }
+       
+       makevectors(teleporter.enemy.mangle);
+
+       if(teleporter.enemy.speed)
+               if(vlen(player.velocity) > teleporter.enemy.speed)
+                       player.velocity = normalize(player.velocity) * max(0, teleporter.enemy.speed);
+                       
+       if(autocvar_g_teleport_maxspeed)
+               if(vlen(player.velocity) > autocvar_g_teleport_maxspeed)
+                       player.velocity = normalize(player.velocity) * max(0, autocvar_g_teleport_maxspeed);
+
+       locout = teleporter.enemy.origin + '0 0 1' * (1 - player.mins_z - 24);
+       TeleportPlayer(teleporter, player, locout, teleporter.enemy.mangle, v_forward * vlen(player.velocity), '0 0 0', '0 0 0', TELEPORT_FLAGS_TELEPORTER);
+}
+
+void Teleport_Touch (void)
+{
+       entity oldself;
        string s;
 
        if (self.active != ACTIVE_ACTIVE)
                return;
        
        if not(other.iscreature)
+       if (other.deadflag != DEAD_NO)
                return;
 
        // for gameplay: vehicles can't teleport
@@ -164,49 +206,10 @@ void Teleport_Touch (void)
 
        EXACTTRIGGER_TOUCH;
 
-       makevectors(self.enemy.mangle);
-
        if(other.classname == "player")
                RemoveGrapplingHook(other);
-       
-       if(self.enemy)
-       {
-               e = self.enemy;
-       }
-       else
-       {
-               RandomSelection_Init();
-               for(e = world; (e = find(e, targetname, self.target)); )
-               {
-                       p = 1;
-                       if(autocvar_g_telefrags_avoid)
-                       {
-                               o = e.origin + '0 0 1' * (1 - other.mins_z - 24);
-                               if(check_tdeath(other, o, '0 0 0', '0 0 0'))
-                                       p = 0;
-                       }
-                       if(e.cnt)
-                               RandomSelection_Add(e, 0, string_null, e.cnt, p);
-                       else
-                               RandomSelection_Add(e, 0, string_null, 1, p);
-               }
-               e = RandomSelection_chosen_ent;
-       }
-
-       if(!e)
-       {
-               sprint(other, "Teleport destination vanished. Sorry... please complain to the mapper.\n");
-       }
-
-       if(e.speed)
-               if(vlen(other.velocity) > e.speed)
-                       other.velocity = normalize(other.velocity) * max(0, e.speed);
-       if(autocvar_g_teleport_maxspeed)
-               if(vlen(other.velocity) > autocvar_g_teleport_maxspeed)
-                       other.velocity = normalize(other.velocity) * max(0, autocvar_g_teleport_maxspeed);
-
-       o = e.origin + '0 0 1' * (1 - other.mins_z - 24);
-       TeleportPlayer(self, other, o, e.mangle, v_forward * vlen(other.velocity), '0 0 0', '0 0 0', TELEPORT_FLAGS_TELEPORTER);
+               
+       Simple_TeleportPlayer(self, other);
 
        activator = other;
        s = self.target; self.target = string_null;
@@ -214,7 +217,7 @@ void Teleport_Touch (void)
        if not(self.target) self.target = s;
 
        oldself = self;
-       self = e;
+       self = self.enemy;
        SUB_UseTargets();
        self = oldself;
 }
@@ -282,6 +285,17 @@ void teleport_findtarget (void)
        self.touch = Teleport_Touch;
 }
 
+entity Teleport_Find(vector mi, vector ma)
+{
+       entity e;
+       for(e = world; (e = find(e, classname, "trigger_teleport")); )
+               if(WarpZoneLib_BoxTouchesBrush(mi, ma, e, world))
+                       return e;
+       return world;
+}
+
+entity teleport_first; 
+.entity teleport_next;
 void spawnfunc_trigger_teleport (void)
 {
        self.angles = '0 0 0';
@@ -300,6 +314,9 @@ void spawnfunc_trigger_teleport (void)
                objerror ("Teleporter with no target");
                return;
        }
+       
+       self.teleport_next = teleport_first;
+       teleport_first = self;
 }
 
 void WarpZone_PostTeleportPlayer_Callback(entity pl)
index 4d44fe84e73327d4ff9a7762dcf35daa56ae72ad..fd23bb854efaecbd7fe20481db03b90f45e1d222 100644 (file)
@@ -773,41 +773,47 @@ void WarpZone_StartFrame()
                WarpZone_PostInitialize_Callback();
        }
 
-       if(warpzone_warpzones_exist)
+       entity oldself, oldother;
+       oldself = self;
+       oldother = other;
+       for(e = world; (e = nextent(e)); )
        {
-               entity oldself, oldother;
-               oldself = self;
-               oldother = other;
-               for(e = world; (e = nextent(e)); )
+               if(warpzone_warpzones_exist) { WarpZone_StoreProjectileData(e); }
+               
+               float f = clienttype(e);
+               if(f == CLIENTTYPE_REAL)
                {
-                       WarpZone_StoreProjectileData(e);
-                       float f;
-                       f = clienttype(e);
-                       if(f == CLIENTTYPE_REAL)
+                       if(e.solid == SOLID_NOT) // not spectating?
+                       if(e.movetype == MOVETYPE_NOCLIP || e.movetype == MOVETYPE_FLY) // not spectating? (this is to catch observers)
                        {
-                               if(e.solid != SOLID_NOT) // not spectating?
-                                       continue;
-                               if(e.movetype != MOVETYPE_NOCLIP && e.movetype != MOVETYPE_FLY) // not spectating? (this is to catch observers)
-                                       continue;
-                               self = WarpZone_Find(e.origin + e.mins, e.origin + e.maxs);
-                               if(!self)
-                                       continue;
-                               other = e;
-                               if(WarpZoneLib_ExactTrigger_Touch())
-                                       continue;
-                               if(WarpZone_PlaneDist(self, e.origin + e.view_ofs) <= 0)
-                                       WarpZone_Teleport(self, e, -1, 0); // NOT triggering targets by this!
+                               other = e; // player
+                       
+                               // warpzones
+                               if(warpzone_warpzones_exist) { 
+                               self = WarpZone_Find(e.origin + e.mins, e.origin + e.maxs); 
+                               if(self)
+                               if(!WarpZoneLib_ExactTrigger_Touch())
+                                       if(WarpZone_PlaneDist(self, e.origin + e.view_ofs) <= 0)
+                                               WarpZone_Teleport(self, e, -1, 0); } // NOT triggering targets by this!
+                       
+                               // teleporters
+                               self = Teleport_Find(e.origin + e.mins, e.origin + e.maxs);
+                               if(self)
+                               if(!WarpZoneLib_ExactTrigger_Touch())
+                                       Simple_TeleportPlayer(self, other); // NOT triggering targets by this!
                        }
-                       if(f == CLIENTTYPE_NOTACLIENT)
-                       {
+               }
+               
+               if(f == CLIENTTYPE_NOTACLIENT)
+               {
+                       if(warpzone_warpzones_exist)
                                for(; (e = nextent(e)); )
                                        WarpZone_StoreProjectileData(e);
-                               break;
-                       }
+                       break;
                }
-               self = oldself;
-               other = oldother;
        }
+       self = oldself;
+       other = oldother;
 }
 
 .float warpzone_reconnecting;