]> git.rm.cloudns.org Git - voretournament/voretournament.git/commitdiff
Port flying spectators from Xonotic. They don't go through warpzones and teleporters...
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sun, 29 Jan 2012 11:24:03 +0000 (13:24 +0200)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sun, 29 Jan 2012 11:24:03 +0000 (13:24 +0200)
data/defaultVT.cfg
data/qcsrc/client/movetypes.qh
data/qcsrc/server/cl_client.qc
data/qcsrc/server/cl_physics.qc
data/qcsrc/server/constants.qh
data/qcsrc/server/defs.qh
data/qcsrc/server/miscfunctions.qc
docs/TODO.txt

index c431a981ce351785ecb5f240bbb54fd2048bcc5e..aebb12002cedd7ecbd896d576524b8fecfb438a6 100644 (file)
@@ -1393,6 +1393,8 @@ set sv_clones 0   "number of clones a player may make (reset by the \"kill\" comma
 \r
 set cl_handicap 1      "the higher, the more damage you will receive (client setting)"\r
 \r
+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." \r
+\r
 // must be at the bottom of this file:\r
 // alias for switching the teamselect menu\r
 alias menu_showteamselect "menu_cmd directmenu TeamSelect"\r
index 8d3e20dd8e80b6c48f4d3a5c62d39cb0573a37fb..c1d8b045f8d0511bc65e83d6ce4a1ee3754c5f81 100644 (file)
@@ -28,6 +28,7 @@ float MOVETYPE_BOUNCE                         = 10;
 float  MOVETYPE_BOUNCEMISSILE  = 11;   // Like bounce but doesn't lose speed on bouncing\r
 float MOVETYPE_FOLLOW = 12;\r
 float MOVETYPE_FAKEPUSH = 13;\r
+float MOVETYPE_FLY_WORLDONLY = 33;\r
 \r
 float   FL_ITEM                 = 256;\r
 float  FL_ONGROUND                             = 512;\r
index 039017cf5ce0403a7e8b5b4c8aad8ebfc0f1ef96..33406554dd2ac92b7a0780b3b54c26205b6719ee 100644 (file)
@@ -623,7 +623,7 @@ void PutObserverInServer (void)
        self.health = -666;\r
        self.takedamage = DAMAGE_NO;\r
        self.solid = SOLID_NOT;\r
-       self.movetype = MOVETYPE_NOCLIP;\r
+       self.movetype = MOVETYPE_FLY_WORLDONLY; // user preference is controlled by playerprethink\r
        self.flags = FL_CLIENT | FL_NOTARGET;\r
        self.armorvalue = 666;\r
        self.effects = 0;\r
@@ -652,9 +652,9 @@ void PutObserverInServer (void)
        self.fixangle = TRUE;\r
        self.crouch = FALSE;\r
 \r
-       self.view_ofs = PL_VIEW_OFS;\r
+       self.view_ofs = '0 0 0'; // so that your view doesn't go into the ceiling with MOVETYPE_FLY_WORLDONLY, previously "PL_VIEW_OFS"\r
        setorigin (self, spot.origin);\r
-       setsize (self, '0 0 0', '0 0 0');\r
+       setsize (self, PL_CROUCH_MIN, PL_CROUCH_MAX); // give the spectator some space between walls for MOVETYPE_FLY_WORLDONLY\r
        self.prevorigin = self.origin;\r
        self.items = 0;\r
        self.weapons = 0;\r
@@ -2390,17 +2390,20 @@ void SetPlayerSize()
 \r
 void ObserverThink()\r
 {\r
+       float prefered_movetype;\r
        if (self.flags & FL_JUMPRELEASED) {\r
                if (self.BUTTON_JUMP && !self.version_mismatch) {\r
-                       self.welcomemessage_time = 0;\r
                        self.flags &~= FL_JUMPRELEASED;\r
                        self.flags |= FL_SPAWNING;\r
                } else if(self.BUTTON_ATCK && !self.version_mismatch) {\r
-                       self.welcomemessage_time = 0;\r
                        self.flags &~= FL_JUMPRELEASED;\r
                        if(SpectateNext() == 1) {\r
                                self.classname = "spectator";\r
                        }\r
+               } else {\r
+                       prefered_movetype = ((!self.BUTTON_USE ? self.cvar_cl_clippedspectating : !self.cvar_cl_clippedspectating) ? MOVETYPE_FLY_WORLDONLY : MOVETYPE_NOCLIP);\r
+                       if (self.movetype != prefered_movetype)\r
+                               self.movetype = prefered_movetype;\r
                }\r
        } else {\r
                if (!(self.BUTTON_ATCK || self.BUTTON_JUMP)) {\r
@@ -2413,6 +2416,7 @@ void ObserverThink()
                        }\r
                }\r
        }\r
+\r
        PrintWelcomeMessage(self);\r
 }\r
 \r
index 492dc2a4fb828db0cbdca36c6ed5a954fe71fc1a..f887a4b2a014dcda693ab2c6c093aadafdaace4e 100644 (file)
@@ -916,7 +916,7 @@ void SV_PlayerPhysics()
        {\r
                RaceCarPhysics();\r
        }\r
-       else if (self.movetype == MOVETYPE_NOCLIP || self.movetype == MOVETYPE_FLY)\r
+       else if (self.movetype == MOVETYPE_NOCLIP || self.movetype == MOVETYPE_FLY || self.movetype == MOVETYPE_FLY_WORLDONLY)\r
        {\r
                // noclipping or flying\r
                self.flags &~= FL_ONGROUND;\r
index 8bcc5c68de24aaecfeb3936979439ba541ad0ed7..70b8221ac073146b330b91c7ab9925e6eeaa7add 100644 (file)
@@ -33,6 +33,7 @@ float MOVETYPE_FLYMISSILE                     = 9;
 float  MOVETYPE_BOUNCE                         = 10;\r
 float  MOVETYPE_BOUNCEMISSILE  = 11;   // Like bounce but doesn't lose speed on bouncing\r
 //float        MOVETYPE_FOLLOW                         = 12;   // 'Attaches' the entity to its aim_ent\r
+float MOVETYPE_FLY_WORLDONLY = 33;\r
 \r
 float  SOLID_NOT                               = 0;\r
 float  SOLID_TRIGGER                           = 1;\r
index 5c4685039b2865cba75162ca2d3f8634c888c046..55cdcae9bd9df70ff60d73a524d53176e6d18457 100644 (file)
@@ -325,6 +325,7 @@ float default_weapon_alpha;
 \r
 .float() customizeentityforclient;\r
 .float cvar_cl_handicap;\r
+.float cvar_cl_clippedspectating;\r
 .float cvar_scr_centertime;\r
 .float cvar_cl_shownames;\r
 .string cvar_g_voretournamentversion;\r
index 2e278f5dbe4d6e1d1d8d4c687b762d7dec053dda..caf444e8932a823bf3bd20e6f6d0f3eb356474cc 100644 (file)
@@ -596,6 +596,7 @@ void GetCvars(float f)
        GetCvars_handleFloat(s, f, cvar_cl_shownames, "cl_shownames");\r
        GetCvars_handleString(s, f, cvar_g_voretournamentversion, "g_voretournamentversion");\r
        GetCvars_handleFloat(s, f, cvar_cl_handicap, "cl_handicap");\r
+       GetCvars_handleFloat(s, f, cvar_cl_clippedspectating, "cl_clippedspectating");\r
        GetCvars_handleString_Fixup(s, f, cvar_cl_weaponpriority, "cl_weaponpriority", W_FixWeaponOrder_ForceComplete);\r
        GetCvars_handleString_Fixup(s, f, cvar_cl_weaponpriorities[0], "cl_weaponpriority0", W_FixWeaponOrder_AllowIncomplete);\r
        GetCvars_handleString_Fixup(s, f, cvar_cl_weaponpriorities[1], "cl_weaponpriority1", W_FixWeaponOrder_AllowIncomplete);\r
index 55dd2d91b50a8444dba3fbe8f4036593e1ca0846..eef10c55990bd98d7d59ffd4340861d778b23a49 100644 (file)
@@ -56,8 +56,6 @@
 \r
 - 0.7 | 0.8: Add some saliva to the regurgitate particle effects (both constant and one-time effects)\r
 \r
-- 0.8: Can I port the flying spectators from Xonotic?\r
-\r
 - 0.7: Enable that new engine setting, to render models in batches for higher FPS\r
 \r
 - 0.7 | 0.8: Remake helper voices\r
 - 0.7 | 0.8 BUG: Gibbed dead bodies seem to keep throwing gibs infinitely on dedicated servers.\r
 \r
 - 0.8: Chat portraits for all models.\r
+\r
+- 0.7: Fix flying spectators not going through teleporters and warpzones.\r