]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into Mario/nade_fixes
authorMario <zacjardine@y7mail.com>
Fri, 27 Mar 2015 07:58:43 +0000 (18:58 +1100)
committerMario <zacjardine@y7mail.com>
Fri, 27 Mar 2015 07:58:43 +0000 (18:58 +1100)
defaultXonotic.cfg
qcsrc/common/util.qc
qcsrc/common/util.qh
qcsrc/common/weapons/w_shockwave.qc
qcsrc/menu/xonotic/slider_resolution.qc
qcsrc/server/command/cmd.qc
qcsrc/server/mutators/gamemode_ctf.qc
qcsrc/warpzonelib/mathlib.qc
qcsrc/warpzonelib/mathlib.qh
qcsrc/warpzonelib/server.qc
qcsrc/warpzonelib/util_server.qc

index f66dc0128bdb87059cb2a4433fb81f8f7365c75a..4f02d145e0276f7d66ae0a9036c3b9d9d6191cd2 100644 (file)
@@ -545,6 +545,7 @@ gl_picmip_other 1 // so, picmip -1 is best possible quality
 r_mipsprites 1
 r_mipskins 1
 r_shadow_realtime_world_lightmaps 1
+r_shadow_realtime_world_importlightentitiesfrommap 0 // Whether build process uses keepLights is nontransparent and may change, so better make keepLights not matter.
 cl_decals_fadetime 5
 cl_decals_time 1
 seta cl_gunalign 3 "Gun alignment; 1 = center (if allowed by g_shootfromclient) or right, 2 = center (if allowed by g_shootfromclient) or left, 3 = right only, 4 = left only"
index 99fecda0bbfc2855600c02a3ec2629845511f730..49d707f077be45adc59a7867322022ed9be41d96 100644 (file)
@@ -500,19 +500,6 @@ string ScoreString(int pFlags, float pValue)
        return valstr;
 }
 
-float dotproduct(vector a, vector b)
-{
-       return a.x * b.x + a.y * b.y + a.z * b.z;
-}
-
-vector cross(vector a, vector b)
-{
-       return
-               '1 0 0' * (a.y * b.z - a.z * b.y)
-       +       '0 1 0' * (a.z * b.x - a.x * b.z)
-       +       '0 0 1' * (a.x * b.y - a.y * b.x);
-}
-
 // compressed vector format:
 // like MD3, just even shorter
 //   4 bit pitch (16 angles), 0 is -90, 8 is 0, 16 would be 90
index 4de610f26fcc2113587a64019db6b55fb71ae647..b2cdf8dcaf2232be15fb675e2140d4018d686b64 100644 (file)
@@ -109,9 +109,6 @@ const float TIME_FACTOR = 100;
 
 string ScoreString(float vflags, float value);
 
-float dotproduct(vector a, vector b);
-vector cross(vector a, vector b);
-
 void compressShortVector_init();
 vector decompressShortVector(float data);
 float compressShortVector(vector vec);
index 24b8634b91dd1a6b6eb04defa40d2f8f8cecd466..3f40c5397fcfb8d34b96f4db4e0132c8b07bc5d1 100644 (file)
@@ -553,13 +553,11 @@ void W_Shockwave_Attack(void)
                        center = CENTER_OR_VIEWOFS(head);
 
                        // find the closest point on the enemy to the center of the attack
-                       float ang; // angle between shotdir and h
                        float h; // hypotenuse, which is the distance between attacker to head
                        float a; // adjacent side, which is the distance between attacker and the point on w_shotdir that is closest to head.origin
 
                        h = vlen(center - self.origin);
-                       ang = acos(dotproduct(normalize(center - self.origin), w_shotdir));
-                       a = h * cos(ang);
+                       a = h * (normalize(center - self.origin) * w_shotdir);
                        // WEAPONTODO: replace with simpler method
 
                        vector nearest_on_line = (w_shotorg + a * w_shotdir);
index 476c441ed1a96a40afc2e3fcb2d7ff9b70a17d75..c1443628106e7b4b2947d8a86c669d6c2a2a5e88 100644 (file)
@@ -7,6 +7,8 @@ CLASS(XonoticResolutionSlider) EXTENDS(XonoticTextSlider)
        METHOD(XonoticResolutionSlider, saveCvars, void(entity))
        METHOD(XonoticResolutionSlider, draw, void(entity))
        ATTRIB(XonoticResolutionSlider, vid_fullscreen, float, -1)
+       ATTRIB(XonoticResolutionSlider, maxAllowedWidth, float, 0)
+       ATTRIB(XonoticResolutionSlider, maxAllowedHeight, float, 0)
 ENDCLASS(XonoticResolutionSlider)
 entity makeXonoticResolutionSlider();
 float updateConwidths(float width, float height, float pixelheight);
@@ -87,6 +89,10 @@ entity makeXonoticResolutionSlider()
 }
 void XonoticResolutionSlider_addResolution(entity me, float w, float h, float pixelheight)
 {
+       if (me.maxAllowedWidth && w > me.maxAllowedWidth)
+               return;
+       if (me.maxAllowedHeight && h > me.maxAllowedHeight)
+               return;
        float i;
        for (i = 0; i < me.nValues; ++i)
        {
@@ -138,6 +144,8 @@ void XonoticResolutionSlider_loadResolutions(entity me, float fullscreen)
        }
        // NOW we can safely clear.
        me.clearValues(me);
+       me.maxAllowedWidth = 0;
+       me.maxAllowedHeight = 0;
 
        if (fullscreen)
        {
@@ -161,6 +169,21 @@ void XonoticResolutionSlider_loadResolutions(entity me, float fullscreen)
 
        if(me.nValues == 0)
        {
+               // Get workarea.
+               r = getresolution(-2);
+               // If workarea is not supported, get desktop size.
+               if(r.x == 0 && r.y == 0)
+                       r = getresolution(-1);
+
+               // Add it, and limit all other resolutions to the workarea/desktop size.
+               if(r.x != 0 || r.y != 0)
+               {
+                       me.maxAllowedWidth = r.x;
+                       me.maxAllowedHeight = r.y;
+                       me.addResolution(me, r.x, r.y, r.z);
+               }
+
+               // Add nice hardcoded defaults.
                me.addResolution(me, 640, 480, 1); // pc res
 #if 0
                me.addResolution(me, 720, 480, 1.125); // DVD NTSC 4:3
index 4a8b59eba651d8b8b1c3099858854ce7cbfca127..14e0f201c0f7bb029d4f4363a8ba50e7b7ea39c3 100644 (file)
@@ -825,6 +825,15 @@ void ClientCommand_macro_write_aliases(float fh)
 
 void SV_ParseClientCommand(string command)
 {
+       // If invalid UTF-8, don't even parse it
+       string command2 = "";
+       float len = strlen(command);
+       float i;
+       for (i = 0; i < len; ++i)
+               command2 = strcat(command2, chr2str(str2chr(command, i)));
+       if (command != command2)
+               return;
+
        // if we're banned, don't even parse the command
        if(Ban_MaybeEnforceBanOnce(self))
                return;
index 2e6eb4ff732533e927fc4359459ea5fec9f940f6..5ea2924cc4a40184fc80f9197ac49cebdb0dfab0 100644 (file)
@@ -89,13 +89,11 @@ float ctf_CheckPassDirection(vector head_center, vector passer_center, vector pa
                makevectors(passer_angle);
 
                // find the closest point on the enemy to the center of the attack
-               float ang; // angle between shotdir and h
                float h; // hypotenuse, which is the distance between attacker to head
                float a; // adjacent side, which is the distance between attacker and the point on w_shotdir that is closest to head.origin
 
                h = vlen(head_center - passer_center);
-               ang = acos(dotproduct(normalize(head_center - passer_center), v_forward));
-               a = h * cos(ang);
+               a = h * (normalize(head_center - passer_center) * v_forward);
 
                vector nearest_on_line = (passer_center + a * v_forward);
                float distance_from_line = vlen(nearest_to_passer - nearest_on_line);
index d86af8a00ec786760c15a9440b525a7160d4a0ab..c9cde9072c34210fb2f387f137569dfa35f71d9e 100644 (file)
@@ -290,3 +290,11 @@ int isunordered(float x, float y)
 {
        return !(x < y || x == y || x > y);
 }
+
+vector cross(vector a, vector b)
+{
+       return
+               '1 0 0' * (a.y * b.z - a.z * b.y)
+       +       '0 1 0' * (a.z * b.x - a.x * b.z)
+       +       '0 0 1' * (a.x * b.y - a.y * b.x);
+}
index a37ba63de6c63b87ed3dad63d12ea1ad4637fe52..ddd494de5b8422e5560cb68301d5fada7b43d73d 100644 (file)
@@ -112,4 +112,8 @@ const float M_2_PI     = 0.63661977236758134308;  /* 2/pi */
 const float M_2_SQRTPI = 1.12837916709551257390;  /* 2/sqrt(pi) */
 const float M_SQRT2    = 1.41421356237309504880;  /* sqrt(2) */
 const float M_SQRT1_2  = 0.70710678118654752440;  /* 1/sqrt(2) */
+
+// Non-<math.h> stuff follows here.
+vector cross(vector a, vector b);
+
 #endif
index 5d529c12e215ab78c66f85c48d7c79a8f3800147..c4dc7287f1c182e79ac96e009a8000902678043c 100644 (file)
@@ -537,7 +537,7 @@ void WarpZone_InitStep_UpdateTransform()
 {
        vector org, ang, norm, point;
        float area;
-       vector tri, a, b, c, p, q, n;
+       vector tri, a, b, c, n;
        float i_s, i_t, n_t;
        string tex;
 
@@ -561,11 +561,7 @@ void WarpZone_InitStep_UpdateTransform()
                        a = getsurfacepoint(self, i_s, tri.x);
                        b = getsurfacepoint(self, i_s, tri.y);
                        c = getsurfacepoint(self, i_s, tri.z);
-                       p = b - a;
-                       q = c - a;
-                       n =     '1 0 0' * (q.y * p.z - q.z * p.y)
-                       +       '0 1 0' * (q.z * p.x - q.x * p.z)
-                       +       '0 0 1' * (q.x * p.y - q.y * p.x);
+                       n = cross(c - a, b - a);
                        area = area + vlen(n);
                        norm = norm + n;
                        point = point + vlen(n) * (a + b + c);
index 79cff0174a3a98f3c046a68777de6c07e3bb7eee..b94eafbdafd4e422af7dd6eb5c31933156dbb988 100644 (file)
@@ -77,8 +77,12 @@ void WarpZoneLib_ExactTrigger_Init()
                makevectors (self.angles);
                self.movedir = v_forward;
        }
-       self.warpzone_isboxy = 1;
-       if(self.model != "")
+       if(self.model == "")
+       {
+               // It's a box! No need to match with exacttriggers.
+               self.warpzone_isboxy = 1;
+       }
+       else
        {
                mi = self.mins;
                ma = self.maxs;
@@ -87,11 +91,11 @@ void WarpZoneLib_ExactTrigger_Init()
                // let mapper-set mins/maxs override the model's bounds if set
                if(mi != '0 0 0' || ma != '0 0 0')
                {
+                       // It's a box! No need to match with exacttriggers.
                        self.mins = mi;
                        self.maxs = ma;
+                       self.warpzone_isboxy = 1;
                }
-               else
-                       self.warpzone_isboxy = 0; // enable exacttrigger matching
        }
        setorigin(self, self.origin);
        if(self.scale)