]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into terencehill/ca_fixes
authorterencehill <piuntn@gmail.com>
Thu, 30 Jan 2014 00:58:16 +0000 (01:58 +0100)
committerterencehill <piuntn@gmail.com>
Thu, 30 Jan 2014 00:58:16 +0000 (01:58 +0100)
defaultXonotic.cfg
qcsrc/client/movetypes.qc
qcsrc/client/movetypes.qh
qcsrc/common/mapinfo.qc
qcsrc/common/util.qc
qcsrc/common/util.qh
qcsrc/server/command/cmd.qc

index 624a581a36f18e773b24c0f862bd43f0d363354b..c6fa7642be5bb988be1c26272d43a86af5fb67e4 100644 (file)
@@ -1079,6 +1079,8 @@ sv_gameplayfix_delayprojectiles 0
 sv_gameplayfix_q2airaccelerate 1
 sv_gameplayfix_stepmultipletimes 1
 
+cl_gameplayfix_fixedcheckwatertransition 1
+
 // delay for "kill" to prevent abuse
 set g_balance_kill_delay 2
 set g_balance_kill_antispam 5
index 402e44cac83210d5a10485cfbf47845f9bbde998..a4122d261f175961a4b52ae55a1c21418b3141f6 100644 (file)
@@ -10,13 +10,77 @@ void _Movetype_CheckVelocity() // SV_CheckVelocity
 {
 }
 
-float _Movetype_CheckWater() // SV_CheckWater
+float _Movetype_CheckWater(entity ent) // SV_CheckWater
 {
-       return FALSE;
+       float supercontents;
+       float nativecontents;
+       vector point;
+
+       point = ent.move_origin;
+       point_z += (ent.mins_z + 1);
+
+       nativecontents = pointcontents(point);
+
+       if(ent.move_watertype)
+       if(ent.move_watertype != nativecontents)
+       {
+               //print(sprintf("_Movetype_CheckWater(): Original: '%d', New: '%d'\n", ent.move_watertype, nativecontents));
+               if(ent.contentstransition)
+                       ent.contentstransition(ent.move_watertype, nativecontents);
+       }
+
+       ent.move_waterlevel = 0;
+       ent.move_watertype = CONTENT_EMPTY;
+
+       supercontents = Mod_Q1BSP_SuperContentsFromNativeContents(nativecontents);
+       if(supercontents & DPCONTENTS_LIQUIDSMASK)
+       {
+               ent.move_watertype = nativecontents;
+               ent.move_waterlevel = 1;
+               point_y = (ent.origin_y + ((ent.mins_z + ent.maxs_y) * 0.5));
+               if(Mod_Q1BSP_SuperContentsFromNativeContents(pointcontents(point)) & DPCONTENTS_LIQUIDSMASK)
+               {
+                       ent.move_waterlevel = 2;
+                       point_y = ent.origin_y + ent.view_ofs_y;
+                       if(Mod_Q1BSP_SuperContentsFromNativeContents(pointcontents(point)) & DPCONTENTS_LIQUIDSMASK)
+                               ent.move_waterlevel = 3;
+               }
+       }
+
+       return (ent.move_waterlevel > 1);
 }
 
-void _Movetype_CheckWaterTransition() // SV_CheckWaterTransition
+void _Movetype_CheckWaterTransition(entity ent) // SV_CheckWaterTransition
 {
+       float contents = pointcontents(ent.move_origin);
+       
+       if(!ent.move_watertype)
+       {
+               // just spawned here
+               if(!autocvar_cl_gameplayfix_fixedcheckwatertransition)
+               {
+                       ent.move_watertype = contents;
+                       ent.move_waterlevel = 1;
+                       return;
+               }
+       }
+       else if(ent.move_watertype != contents)
+       {
+               //print(sprintf("_Movetype_CheckWaterTransition(): Origin: %s, Direct: '%d', Original: '%d', New: '%d'\n", vtos(ent.move_origin), pointcontents(ent.move_origin), ent.move_watertype, contents));
+               if(ent.contentstransition)
+                       ent.contentstransition(ent.move_watertype, contents);
+       }
+
+       if(contents <= CONTENT_WATER)
+       {
+               ent.move_watertype = contents;
+               ent.move_waterlevel = 1;
+       }
+       else
+       {
+               ent.move_watertype = CONTENT_EMPTY;
+               ent.move_waterlevel = (autocvar_cl_gameplayfix_fixedcheckwatertransition ? 0 : contents);
+       }
 }
 
 void _Movetype_Impact(entity oth) // SV_Impact
@@ -342,7 +406,7 @@ void _Movetype_Physics_Toss(float dt) // SV_Physics_Toss
                        self.move_velocity_z -= 0.5 * dt * getstatf(STAT_MOVEVARS_GRAVITY);
        }
 
-       _Movetype_CheckWaterTransition();
+       _Movetype_CheckWaterTransition(self);
 }
 
 void _Movetype_Physics_Frame(float movedt)
@@ -360,7 +424,7 @@ void _Movetype_Physics_Frame(float movedt)
                        error("SV_Physics_Follow not implemented");
                        break;
                case MOVETYPE_NOCLIP:
-                       _Movetype_CheckWater();
+                       _Movetype_CheckWater(self);
                        self.move_origin = self.move_origin + ticrate * self.move_velocity;
                        self.move_angles = self.move_angles + ticrate * self.move_avelocity;
                        _Movetype_LinkEdict(FALSE);
index 9f39ffc7bc846f94eecd0ba3e85e3f27e9293a4c..287226e53b7f918cbf4e788f99bcbf2e7252edb0 100644 (file)
@@ -5,11 +5,17 @@
 .vector move_velocity;
 .vector move_avelocity;
 .float move_flags;
+.float move_watertype;
+.float move_waterlevel;
 .void(void) move_touch;
+.void(float, float) contentstransition;
 .float move_bounce_factor;
 .float move_bounce_stopspeed;
 .float move_nomonsters; // -1 for MOVE_NORMAL, otherwise a MOVE_ constant
 
+// should match sv_gameplayfix_fixedcheckwatertransition
+var float autocvar_cl_gameplayfix_fixedcheckwatertransition = 1;
+
 void Movetype_Physics_MatchTicrate(float tr, float sloppy);
 void Movetype_Physics_MatchServer(float sloppy);
 void Movetype_Physics_NoMatchServer();
index 8493887cae715ca1413e51cdd94cc087ec694d2f..feb0e036420e49d47ce211390463ed8ccd951b9f 100644 (file)
@@ -602,14 +602,11 @@ void _MapInfo_Map_ApplyGametypeEx(string s, float pWantedType, float pThisType)
                p = strstrofs(sa, "=", 0);
                if(p < 0)
                {
-                       k = "timelimit";
-                       v = s;
-               }
-               else
-               {
-                       k = substring(sa, 0, p);
-                       v = substring(sa, p+1, -1);
+                       print("Invalid gametype setting in mapinfo for gametype ", MapInfo_Type_ToString(pWantedType), ": ", sa, "\n");
+                       continue;
                }
+               k = substring(sa, 0, p);
+               v = substring(sa, p+1, -1);
 
                if(k == "timelimit")
                {
@@ -645,7 +642,7 @@ void _MapInfo_Map_ApplyGametypeEx(string s, float pWantedType, float pThisType)
                }
                else
                {
-                       print("Invalid gametype key in mapinfo: ", k, "\n");
+                       print("Invalid gametype setting in mapinfo for gametype ", MapInfo_Type_ToString(pWantedType), ": ", sa, "\n");
                }
        }
 
index 1904e91c1afa1d440c4bcdcfb7bdd4d39e0c811c..bdf80e5d1cb92f698d3944743f7d4a5375258570 100644 (file)
@@ -2752,3 +2752,40 @@ float Announcer_PickNumber(float type, float num)
        return NOTIF_ABORT; // abort sending if none of these numbers were right
 }
 #endif
+
+#ifndef MENUQC
+float Mod_Q1BSP_SuperContentsFromNativeContents(float nativecontents)
+{
+       switch(nativecontents)
+       {
+               case CONTENT_EMPTY:
+                       return 0;
+               case CONTENT_SOLID:
+                       return DPCONTENTS_SOLID | DPCONTENTS_OPAQUE;
+               case CONTENT_WATER:
+                       return DPCONTENTS_WATER;
+               case CONTENT_SLIME:
+                       return DPCONTENTS_SLIME;
+               case CONTENT_LAVA:
+                       return DPCONTENTS_LAVA | DPCONTENTS_NODROP;
+               case CONTENT_SKY:
+                       return DPCONTENTS_SKY | DPCONTENTS_NODROP | DPCONTENTS_OPAQUE; // to match behaviour of Q3 maps, let sky count as opaque
+       }
+       return 0;
+}
+
+float Mod_Q1BSP_NativeContentsFromSuperContents(float supercontents)
+{
+       if(supercontents & (DPCONTENTS_SOLID | DPCONTENTS_BODY))
+               return CONTENT_SOLID;
+       if(supercontents & DPCONTENTS_SKY)
+               return CONTENT_SKY;
+       if(supercontents & DPCONTENTS_LAVA)
+               return CONTENT_LAVA;
+       if(supercontents & DPCONTENTS_SLIME)
+               return CONTENT_SLIME;
+       if(supercontents & DPCONTENTS_WATER)
+               return CONTENT_WATER;
+       return CONTENT_EMPTY;
+}
+#endif
index 978aec94bd3fdbf635389ccc3bfa67a2b3f46637..820f4f5db3fe626400502f4dd78656c402a4aa42 100644 (file)
@@ -436,3 +436,8 @@ void dedicated_print(string input);
 #define CNT_ROUNDSTART 6
 float Announcer_PickNumber(float type, float num);
 #endif
+
+#ifndef MENUQC
+float Mod_Q1BSP_SuperContentsFromNativeContents(float nativecontents);
+float Mod_Q1BSP_NativeContentsFromSuperContents(float supercontents);
+#endif
index 5de404e311d0df9b3ef2177926ca0b18d8b67eef..40f7ed406c7b72299f45b96318b118d02305fc6b 100644 (file)
@@ -455,7 +455,18 @@ void ClientCommand_selectteam(float request, float argc)
                                                                        else if(self.wasplayer && autocvar_g_changeteam_banned)
                                                                                sprint(self, "^1You cannot change team, forbidden by the server.\n");
                                                                        else
+                                                                       {
+                                                                               if(autocvar_g_balance_teams && autocvar_g_balance_teams_prevent_imbalance)
+                                                                               {
+                                                                                       GetTeamCounts(self);
+                                                                                       if(!TeamSmallerEqThanTeam(selection, self.team, self))
+                                                                                       {
+                                                                                               sprint(self, "Cannot change to a larger/better/shinier team\n");
+                                                                                               return;
+                                                                                       }
+                                                                               }
                                                                                ClientKill_TeamChange(selection);
+                                                                       }
                                                                }
                                                        }
                                                        else