]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into terencehill/mutators_dialog_cleanup
authorterencehill <piuntn@gmail.com>
Thu, 10 May 2012 16:11:09 +0000 (18:11 +0200)
committerterencehill <piuntn@gmail.com>
Thu, 10 May 2012 16:11:09 +0000 (18:11 +0200)
34 files changed:
balance25.cfg
balanceFruitieX.cfg
balanceXPM.cfg
balanceXonotic.cfg
effects-ultra.cfg
qcsrc/Makefile
qcsrc/common/campaign_file.qc
qcsrc/common/command/markup.qc
qcsrc/common/mapinfo.qc
qcsrc/common/util.qc
qcsrc/common/util.qh
qcsrc/csqcmodellib/sv_model.qc
qcsrc/fteqcc-bugs.qc
qcsrc/menu/anim/animhost.c
qcsrc/menu/anim/keyframe.c
qcsrc/menu/item/container.c
qcsrc/menu/item/inputbox.c
qcsrc/menu/item/inputcontainer.c
qcsrc/menu/item/listbox.c
qcsrc/menu/xonotic/dialog_multiplayer_create_advanced.c
qcsrc/menu/xonotic/dialog_settings_audio.c
qcsrc/menu/xonotic/util.qc
qcsrc/server/cl_client.qc
qcsrc/server/cl_weaponsystem.qc
qcsrc/server/command/cmd.qc
qcsrc/server/csqcprojectile.qc
qcsrc/server/g_damage.qc
qcsrc/server/miscfunctions.qc
qcsrc/server/mutators/gamemode_freezetag.qc
qcsrc/server/mutators/gamemode_keepaway.qc
qcsrc/server/mutators/gamemode_keyhunt.qc
qcsrc/server/mutators/gamemode_nexball.qc
qcsrc/server/runematch.qc
qcsrc/server/w_porto.qc

index 9783f5e8b348e55260ea256c9b589e9d4ac75ea3..bea9ad263a3243ef5904d70fe8de2eca52047a3b 100644 (file)
@@ -167,8 +167,6 @@ set g_projectiles_newton_style 2
 // 0: absolute velocity projectiles (like Quake)
 // 1: relative velocity projectiles, "Newtonian" (like Tribes 2)
 // 2: relative velocity projectiles, but aim is precorrected so projectiles hit the crosshair (note: strafe rockets then are SLOWER than ones shot while standing, happens in 1 too when aiming correctly which is hard)
-// 3: absolute velocity + player velocity component in shot direction (note: does NOT yield the right relative velocity, but may be good enough, but it is somewhat prone to sniper rockets)
-// 4: just add the player velocity length to the absolute velocity (tZork's sniper rockets)
 set g_projectiles_newton_style_2_minfactor 0.7
 set g_projectiles_newton_style_2_maxfactor 5
 set g_projectiles_spread_style 0
index 54e232dc4dc44277909ef7831592d7aa9d83446b..16286fe0f8b85eb63c3529617bef7dc2cb259a74 100644 (file)
@@ -167,8 +167,6 @@ set g_projectiles_newton_style 2
 // 0: absolute velocity projectiles (like Quake)
 // 1: relative velocity projectiles, "Newtonian" (like Tribes 2)
 // 2: relative velocity projectiles, but aim is precorrected so projectiles hit the crosshair (note: strafe rockets then are SLOWER than ones shot while standing, happens in 1 too when aiming correctly which is hard)
-// 3: absolute velocity + player velocity component in shot direction (note: does NOT yield the right relative velocity, but may be good enough, but it is somewhat prone to sniper rockets)
-// 4: just add the player velocity length to the absolute velocity (tZork's sniper rockets)
 set g_projectiles_newton_style_2_minfactor 0.7
 set g_projectiles_newton_style_2_maxfactor 5
 set g_projectiles_spread_style 7
index ea933d2725c56b78ac7459e2f1705c09719d822e..d3478a969f292339c212b96bc934eb284e9adc2e 100644 (file)
@@ -167,8 +167,6 @@ set g_projectiles_newton_style 0
 // 0: absolute velocity projectiles (like Quake)
 // 1: relative velocity projectiles, "Newtonian" (like Tribes 2)
 // 2: relative velocity projectiles, but aim is precorrected so projectiles hit the crosshair (note: strafe rockets then are SLOWER than ones shot while standing, happens in 1 too when aiming correctly which is hard)
-// 3: absolute velocity + player velocity component in shot direction (note: does NOT yield the right relative velocity, but may be good enough, but it is somewhat prone to sniper rockets)
-// 4: just add the player velocity length to the absolute velocity (tZork's sniper rockets)
 set g_projectiles_newton_style_2_minfactor 0.8
 set g_projectiles_newton_style_2_maxfactor 1.5
 set g_projectiles_spread_style 7
index 2f1d16d82e3a9a11b62fc8cb19ffbc36921c0756..b7dbd3db8ceb72ecd803766d758db460b7b4c1bd 100644 (file)
@@ -167,8 +167,6 @@ set g_projectiles_newton_style 2
 // 0: absolute velocity projectiles (like Quake)
 // 1: relative velocity projectiles, "Newtonian" (like Tribes 2)
 // 2: relative velocity projectiles, but aim is precorrected so projectiles hit the crosshair (note: strafe rockets then are SLOWER than ones shot while standing, happens in 1 too when aiming correctly which is hard)
-// 3: absolute velocity + player velocity component in shot direction (note: does NOT yield the right relative velocity, but may be good enough, but it is somewhat prone to sniper rockets)
-// 4: just add the player velocity length to the absolute velocity (tZork's sniper rockets)
 set g_projectiles_newton_style_2_minfactor 0.8
 set g_projectiles_newton_style_2_maxfactor 1.5
 set g_projectiles_spread_style 7
index 4c4c09baff0321867c5d99be8f2d7eb933121c51..f92230f16f04f10ecf7df6656e7aedad21a08536 100644 (file)
@@ -1,5 +1,5 @@
 cl_decals 1
-cl_decals_models 1
+cl_decals_models 0
 cl_decals_time 10
 cl_particles_quality 1
 cl_damageeffect 1
index 66fc027200d52dfada5286412551cc01611b8a37..27f6fc993aa0c12c1e372a7b36c25922fcce7995 100644 (file)
@@ -3,7 +3,7 @@ FTEQCC ?= fteqcc
 PERL ?= perl
 
 FTEQCCFLAGS_WATERMARK ?= -DWATERMARK='"$(shell git describe)"' -DCVAR_POPCON
-FTEQCCFLAGS ?= -Werror -Wno-Q302 -O3 -Ono-return_only -Ono-assignments -fno-fastarrays $(FTEQCCFLAGS_EXTRA) $(FTEQCCFLAGS_WATERMARK)
+FTEQCCFLAGS ?= -Werror -Wno-Q302 -O3 -Ono-return_only -fno-fastarrays $(FTEQCCFLAGS_EXTRA) $(FTEQCCFLAGS_WATERMARK)
 FTEQCCFLAGS_PROGS ?=
 FTEQCCFLAGS_MENU ?=
 
index 067cd8054de6f311d562bf427190fd806ef1de79..5ab3da67cff47e58a34f3731b1d330d256bb3526 100644 (file)
@@ -38,13 +38,12 @@ float CampaignFile_Load(float offset, float n)
                        {
                                entlen = tokenize(l); // using insane tokenizer for CSV
 
-#define CAMPAIGN_GETARG0                  if(i >= entlen)
-#define CAMPAIGN_GETARG1 CAMPAIGN_GETARG0     error("syntax error in campaign file: line has not enough fields");
-#define CAMPAIGN_GETARG2 CAMPAIGN_GETARG1 a = argv(++i);
-#define CAMPAIGN_GETARG3 CAMPAIGN_GETARG2 if(a == ",")
-#define CAMPAIGN_GETARG4 CAMPAIGN_GETARG3     a = "";
-#define CAMPAIGN_GETARG5 CAMPAIGN_GETARG4 else
-#define CAMPAIGN_GETARG  CAMPAIGN_GETARG5     ++i
+#define CAMPAIGN_GETARG \
+       a = argv(++i); \
+       if(a == ",") \
+               a = ""; \
+       else \
+               ++i
 // What you're seeing here is what people will do when your compiler supports
 // C-style macros but no line continuations.
 
@@ -58,6 +57,10 @@ float CampaignFile_Load(float offset, float n)
                                CAMPAIGN_GETARG; campaign_mutators[campaign_entries] = strzone(a);
                                CAMPAIGN_GETARG; campaign_shortdesc[campaign_entries] = strzone(a);
                                CAMPAIGN_GETARG; campaign_longdesc[campaign_entries] = strzone(strreplace("\\n", "\n", a));
+
+                               if(i > entlen)
+                                       error("syntax error in campaign file: line has not enough fields");
+
                                campaign_entries = campaign_entries + 1;
 
                                if(campaign_entries >= n)                               
index cb1a8cc37144eb23c069b6b1294ccb5510073520..d1562aaac4222c1ebf8eedbbfdf60f7d22ffc001 100644 (file)
@@ -51,6 +51,7 @@ void GenericCommand_markup_init()
        markup_from[i] = "&.."; markup_to[i] = "\x9e"; ++i;
        markup_from[i] = "&.)"; markup_to[i] = "\x9f"; ++i;
        markup_from[i] = "&<|"; markup_to[i] = "\xff"; ++i;
+       unused_float = i;
 }
 
 string GenericCommand_markup(string s2)
index 9de5098cb349febadfccd332700803fb69abd337..05c93865dbcceed7c2606d9cb567b727e3fe8ad7 100644 (file)
@@ -945,7 +945,7 @@ float MapInfo_Get_ByName_NoFallbacks(string pFilename, float pAllowGenerate, flo
                        MapInfo_Map_author = s;
                else if(t == "has")
                {
-                       t = car(s); s = cdr(s);
+                       t = car(s); // s = cdr(s);
                        if     (t == "weapons") MapInfo_Map_supportedFeatures |= MAPINFO_FEATURE_WEAPONS;
                        else if(t == "turrets") MapInfo_Map_supportedFeatures |= MAPINFO_FEATURE_TURRETS;
                        else if(t == "vehicles") MapInfo_Map_supportedFeatures |= MAPINFO_FEATURE_VEHICLES;
index a1e0595891b5bf723ee8a7c41d1ce6c4e8ee1acc..b973850cc9f23393062a1b60a781e6ead3052d3f 100644 (file)
@@ -1580,6 +1580,109 @@ vector solve_quadratic(float a, float b, float c) // ax^2 + bx + c = 0
        return v;
 }
 
+vector solve_shotdirection(vector myorg, vector myvel, vector eorg, vector evel, float spd, float newton_style)
+{
+       vector ret;
+
+       // make origin and speed relative
+       eorg -= myorg;
+       if(newton_style)
+               evel -= myvel;
+
+       // now solve for ret, ret normalized:
+       //   eorg + t * evel == t * ret * spd
+       // or, rather, solve for t:
+       //   |eorg + t * evel| == t * spd
+       //   eorg^2 + t^2 * evel^2 + 2 * t * (eorg * evel) == t^2 * spd^2
+       //   t^2 * (evel^2 - spd^2) + t * (2 * (eorg * evel)) + eorg^2 == 0
+       vector solution = solve_quadratic(evel * evel - spd * spd, 2 * (eorg * evel), eorg * eorg);
+       // p = 2 * (eorg * evel) / (evel * evel - spd * spd)
+       // q = (eorg * eorg) / (evel * evel - spd * spd)
+       if(!solution_z) // no real solution
+       {
+               // happens if D < 0
+               // (eorg * evel)^2 < (evel^2 - spd^2) * eorg^2
+               // (eorg * evel)^2 / eorg^2 < evel^2 - spd^2
+               // spd^2 < ((evel^2 * eorg^2) - (eorg * evel)^2) / eorg^2
+               // spd^2 < evel^2 * (1 - cos^2 angle(evel, eorg))
+               // spd^2 < evel^2 * sin^2 angle(evel, eorg)
+               // spd < |evel| * sin angle(evel, eorg)
+               return '0 0 0';
+       }
+       else if(solution_x > 0)
+       {
+               // both solutions > 0: take the smaller one
+               // happens if p < 0 and q > 0
+               ret = normalize(eorg + solution_x * evel);
+       }
+       else if(solution_y > 0)
+       {
+               // one solution > 0: take the larger one
+               // happens if q < 0 or q == 0 and p < 0
+               ret = normalize(eorg + solution_y * evel);
+       }
+       else
+       {
+               // no solution > 0: reject
+               // happens if p > 0 and q >= 0
+               // 2 * (eorg * evel) / (evel * evel - spd * spd) > 0
+               // (eorg * eorg) / (evel * evel - spd * spd) >= 0
+               //
+               // |evel| >= spd
+               // eorg * evel > 0
+               //
+               // "Enemy is moving away from me at more than spd"
+               return '0 0 0';
+       }
+
+       // NOTE: we always got a solution if spd > |evel|
+
+       if(newton_style == 2)
+               ret = normalize(ret * spd + myvel);
+
+       return ret;
+}
+
+vector get_shotvelocity(vector myvel, vector mydir, float spd, float newton_style, float mi, float ma)
+{
+       if(!newton_style)
+               return spd * mydir;
+
+       if(newton_style == 2)
+       {
+               // true Newtonian projectiles with automatic aim adjustment
+               //
+               // solve: |outspeed * mydir - myvel| = spd
+               // outspeed^2 - 2 * outspeed * (mydir * myvel) + myvel^2 - spd^2 = 0
+               // outspeed = (mydir * myvel) +- sqrt((mydir * myvel)^2 - myvel^2 + spd^2)
+               // PLUS SIGN!
+               // not defined?
+               // then...
+               // myvel^2 - (mydir * myvel)^2 > spd^2
+               // velocity without mydir component > spd
+               // fire at smallest possible spd that works?
+               // |(mydir * myvel) * myvel - myvel| = spd
+
+               vector solution = solve_quadratic(1, -2 * (mydir * myvel), myvel * myvel - spd * spd);
+
+               float outspeed;
+               if(solution_z)
+                       outspeed = solution_y; // the larger one
+               else
+               {
+                       //outspeed = 0; // slowest possible shot
+                       outspeed = solution_x; // the real part (that is, the average!)
+                       //dprint("impossible shot, adjusting\n");
+               }
+
+               outspeed = bound(spd * mi, outspeed, spd * ma);
+               return mydir * outspeed;
+       }
+
+       // real Newtonian
+       return myvel + spd * mydir;
+}
+
 void check_unacceptable_compiler_bugs()
 {
        if(cvar("_allow_unacceptable_compiler_bugs"))
index 64830ca1d73330931919e01e2b5d537f8c5141ab..c409de3544578c00acc39b6b4e0c2248fabe65f3 100644 (file)
@@ -168,6 +168,9 @@ vector solve_quadratic(float a, float b, float c);
 // z = 1 if a real solution exists, 0 if not
 // if no real solution exists, x contains the real part and y the imaginary part of the complex solutions x+iy and x-iy
 
+vector solve_shotdirection(vector myorg, vector myvel, vector eorg, vector evel, float spd, float newton_style);
+vector get_shotvelocity(vector myvel, vector mydir, float spd, float newton_style, float mi, float ma);
+
 void check_unacceptable_compiler_bugs();
 
 float compressShotOrigin(vector v);
@@ -314,3 +317,6 @@ float ReadApproxPastTime();
 // execute-stuff-next-frame subsystem
 void execute_next_frame();
 void queue_to_execute_next_frame(string s);
+
+// for marking written-to values as unused where it's a good idea to do this
+noref float unused_float;
index bf6eefa6971b0b0c3f9687c61e60608e9e13ff3d..e6e4cfe43a091e3f2fd1a5efa615a8e2d6132e66 100644 (file)
@@ -29,6 +29,10 @@ float CSQCModel_Send(entity to, float sf)
        float islocalplayer = (self == to);
        float isnolocalplayer = (isplayer && (self != to));
 
+       unused_float = isplayer;
+       unused_float = islocalplayer;
+       unused_float = isnolocalplayer;
+
        WriteByte(MSG_ENTITY, ENT_CLIENT_MODEL);
        WriteShort(MSG_ENTITY, sf);
 
@@ -59,6 +63,10 @@ void CSQCModel_CheckUpdate()
        float islocalplayer = isplayer; // we set BOTH to 1 here as we need the sendflags
        float isnolocalplayer = isplayer; // we set BOTH to 1 here as we need the sendflags
 
+       unused_float = isplayer;
+       unused_float = islocalplayer;
+       unused_float = isnolocalplayer;
+
 #ifdef CSQCPLAYER_FORCE_UPDATES
        if(isplayer && time > self.csqcmodel_nextforcedupdate)
        {
index e426e93f932f1cce4a59af1e5ccf84ed7df7d5cf..dd4fd45f3c6c474df9403afa5e06319fa2ead225 100644 (file)
@@ -1,4 +1,5 @@
 void error(...) = #1;
+float id(float x) { return x; }
 
 void Oassignments(float foo) // pass 1
 {
@@ -21,3 +22,9 @@ void Oreturn_only_trap(void)
 {
        error("FTEQCC SUCKS");
 }
+
+.float fld;
+void Ono_assignments(entity e, float wep) // pass an e with e.fld == 1, and wep == 3. e.fld will be 2 instead of 3. Observe the INDIRECT and the SUB use the same field for storage, wreaking havoc.
+{
+               ((e).fld |= id(wep - 1));
+}
index 48a45bda8465795e8883373ab088918783c4c0d3..ae84e0957da7be5efaff03271861b81b5810d6c4 100644 (file)
@@ -29,8 +29,7 @@ void AnimHost_addAnim(entity me, entity other)
 
        other.parent = me;
 
-       entity f, l;
-       f = me.firstChild;
+       entity l;
        l = me.lastChild;
 
        if(l)
@@ -50,9 +49,7 @@ void AnimHost_removeAnim(entity me, entity other)
 
        other.parent = NULL;
 
-       entity n, p, f, l;
-       f = me.firstChild;
-       l = me.lastChild;
+       entity n, p;
        n = other.nextSibling;
        p = other.prevSibling;
 
index de5d54ae1002ad79486867e1a8f4d83da5a152f0..3bcda94e692939b733c668cf09e46b27e59364c6 100644 (file)
@@ -75,8 +75,7 @@ void Keyframe_addAnim(entity me, entity other)
 
        other.parent = me;
 
-       entity f, l;
-       f = me.firstChild;
+       entity l;
        l = me.lastChild;
 
        if(l)
index 0e8fa9ea0a6d1d627e780759e33edb3dac1fa557..6241cee03968c077249d62bfbdcb8b81a91ec3a9 100644 (file)
@@ -304,8 +304,7 @@ void Container_addItem(entity me, entity other, vector theOrigin, vector theSize
        other.Container_size = theSize;
        me.setAlphaOf(me, other, theAlpha);
 
-       entity f, l;
-       f = me.firstChild;
+       entity l;
        l = me.lastChild;
 
        if(l)
@@ -330,9 +329,7 @@ void Container_removeItem(entity me, entity other)
 
        other.parent = NULL;
 
-       entity n, p, f, l;
-       f = me.firstChild;
-       l = me.lastChild;
+       entity n, p;
        n = other.nextSibling;
        p = other.prevSibling;
 
@@ -371,13 +368,11 @@ void Container_setFocus(entity me, entity other)
 void Container_moveItemAfter(entity me, entity other, entity dest)
 {
        // first: remove other from the chain
-       entity n, p, f, l;
+       entity n, p;
 
        if(other.parent != me)
                error("Can't move in wrong container!");
 
-       f = me.firstChild;
-       l = me.lastChild;
        n = other.nextSibling;
        p = other.prevSibling;
 
index af6587b5a67ebca90ecdb614524bd94923b5fdd0..572d3a0710dd866bef056667cb2862165d80cf0b 100644 (file)
@@ -226,7 +226,6 @@ void InputBox_draw(entity me)
                                else if(ch2 == "x") // ^x found
                                {
                                        theColor = '1 1 1';
-                                       theTempColor = '0 0 0';
                                        
                                        component = HEXDIGIT_TO_DEC(substring(me.text, i+2, 1));
                                        if (component >= 0) // ^xr found
index e1b14d3b1602d468d08ccdf6b26ef0aaf48b43df..65129b294dd6c0229436da186734c244d30b6b6f 100644 (file)
@@ -153,8 +153,7 @@ float InputContainer_mousePress(entity me, vector pos)
 }
 float InputContainer_mouseRelease(entity me, vector pos)
 {
-       float r;
-       r = SUPER(InputContainer).mouseRelease(me, pos);
+       SUPER(InputContainer).mouseRelease(me, pos); // return value?
        if(me.focused) // am I still eligible for this? (UGLY HACK, but a mouse event could have changed focus away)
                if(me._changeFocusXY(me, pos))
                        return 1;
index 4f8dca622c239e0294ba023b68f8101f737c6f15..0c4f349029236d78c365cc6afdc99df033809ac4 100644 (file)
@@ -182,7 +182,6 @@ float ListBox_mouseRelease(entity me, vector pos)
                // and give it a nice click event
                if(me.nItems > 0)
                {
-                       absSize = boxToGlobalSize(me.size, eX * (1 - me.controlWidth) + eY * me.itemHeight);
                        me.clickListBoxItem(me, me.selectedItem, globalToBox(pos, eY * (me.selectedItem * me.itemHeight - me.scrollPos), eX * (1 - me.controlWidth) + eY * me.itemHeight));
                }
        }
index 226f346b643ae55e715a7b5e5cf87eea887412cf..3fcabaaab6f8aa2e25030b7e420c45b52f308baf 100644 (file)
@@ -25,36 +25,36 @@ void XonoticAdvancedDialog_fill(entity me)
                me.TD(me, 1, 3, makeXonoticTextLabel(0, _("Game settings:")));
        me.TR(me);
                me.TDempty(me, 0.2);
-               me.TD(me, 1, 2.8, e = makeXonoticCheckBox(0, "sv_spectate", _("Allow spectating")));
+               me.TD(me, 1, 2.8, makeXonoticCheckBox(0, "sv_spectate", _("Allow spectating")));
        me.TR(me);
                me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Spawn shield:")));
-               me.TD(me, 1, 1.6, e = makeXonoticSlider(0, 15, 0.5, "g_spawnshieldtime"));
+               me.TD(me, 1, 1.2, makeXonoticTextLabel(0, _("Spawn shield:")));
+               me.TD(me, 1, 1.6, makeXonoticSlider(0, 15, 0.5, "g_spawnshieldtime"));
        me.TR(me);
        me.TR(me);
                me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Game speed:")));
-               me.TD(me, 1, 1.6, e = makeXonoticSlider(0.5, 2.0, 0.1, "slowmo"));
+               me.TD(me, 1, 1.2, makeXonoticTextLabel(0, _("Game speed:")));
+               me.TD(me, 1, 1.6, makeXonoticSlider(0.5, 2.0, 0.1, "slowmo"));
        me.TR(me);
        me.TR(me);
                me.TD(me, 1, 3, makeXonoticTextLabel(0, _("Teamplay settings:")));
        me.TR(me);
                me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Friendly fire scale:")));
-               me.TD(me, 1, 1.6, e = makeXonoticSlider(0, 1.0, 0.05, "g_friendlyfire"));
+               me.TD(me, 1, 1.2, makeXonoticTextLabel(0, _("Friendly fire scale:")));
+               me.TD(me, 1, 1.6, makeXonoticSlider(0, 1.0, 0.05, "g_friendlyfire"));
        me.TR(me);
                me.TDempty(me, 0.4);
-               me.TD(me, 1, 2.6, e = makeXonoticCheckBox(0, "g_friendlyfire_virtual", _("Virtual friendly fire (effect only)")));
+               me.TD(me, 1, 2.6, makeXonoticCheckBox(0, "g_friendlyfire_virtual", _("Virtual friendly fire (effect only)")));
        me.TR(me);
                me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Friendly fire penalty:")));
-               me.TD(me, 1, 1.6, e = makeXonoticSlider(0, 1.0, 0.05, "g_mirrordamage"));
+               me.TD(me, 1, 1.2, makeXonoticTextLabel(0, _("Friendly fire penalty:")));
+               me.TD(me, 1, 1.6, makeXonoticSlider(0, 1.0, 0.05, "g_mirrordamage"));
        me.TR(me);
                me.TDempty(me, 0.4);
-               me.TD(me, 1, 2.6, e = makeXonoticCheckBox(0, "g_mirrordamage_virtual", _("Virtual penalty (effect only)")));
+               me.TD(me, 1, 2.6, makeXonoticCheckBox(0, "g_mirrordamage_virtual", _("Virtual penalty (effect only)")));
        me.TR(me);
                me.TDempty(me, 0.2);
-               me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Teams:")));
+               me.TD(me, 1, 1.2, makeXonoticTextLabel(0, _("Teams:")));
                me.TD(me, 1, 1.6, e = makeXonoticTextSlider("g_tdm_teams_override g_domination_teams_override g_keyhunt_teams_override"));
                        e.addValue(e, "Default", "0");
                        e.addValue(e, "2 teams", "2");
@@ -63,7 +63,7 @@ void XonoticAdvancedDialog_fill(entity me)
                        e.configureXonoticTextSliderValues(e);
        me.TR(me);
        me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Map voting:")));
+               me.TD(me, 1, 1, makeXonoticTextLabel(0, _("Map voting:")));
                me.TD(me, 1, 2, e = makeXonoticTextSlider("g_maplist_votable"));
                        e.addValue(e, _("No voting"), "0");
                        e.addValue(e, _("2 choices"), "2");
@@ -76,7 +76,7 @@ void XonoticAdvancedDialog_fill(entity me)
                        e.addValue(e, _("9 choices"), "9");
                        e.configureXonoticTextSliderValues(e);
        me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBoxEx(0.5, 0, "sv_vote_simple_majority_factor", _("Simple majority wins vcall")));
+               me.TD(me, 1, 3, makeXonoticCheckBoxEx(0.5, 0, "sv_vote_simple_majority_factor", _("Simple majority wins vcall")));
 
        me.gotoRC(me, me.rows - 1, 0);
                me.TD(me, 1, me.columns, e = makeXonoticButton(_("OK"), '0 0 0'));
index 1f1ee385b219b762945dee382ff2916e355a4286..174873fe7fc79f211a41d0321a1bae083b977e65 100644 (file)
@@ -114,12 +114,12 @@ void XonoticAudioSettingsTab_fill(entity me)
                setDependentStringNotEqual(s, "mastervolume", "0");
        me.TR(me);
        me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "menu_snd_attenuation_method", _("New style sound attenuation")));
+               me.TD(me, 1, 3, makeXonoticCheckBox(0, "menu_snd_attenuation_method", _("New style sound attenuation")));
        me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "snd_mutewhenidle", _("Mute sounds when not active")));
+               me.TD(me, 1, 3, makeXonoticCheckBox(0, "snd_mutewhenidle", _("Mute sounds when not active")));
        
        me.gotoRC(me, 0, 3.2); me.setFirstColumn(me, me.currentColumn);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Frequency:")));
+               me.TD(me, 1, 1, makeXonoticTextLabel(0, _("Frequency:")));
                me.TD(me, 1, 2, e = makeXonoticTextSlider("snd_speed"));
                        e.addValue(e, _("8 kHz"), "8000");
                        e.addValue(e, _("11.025 kHz"), "11025");
@@ -131,7 +131,7 @@ void XonoticAudioSettingsTab_fill(entity me)
                        e.addValue(e, _("48 kHz"), "48000");
                        e.configureXonoticTextSliderValues(e);
        me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Channels:")));
+               me.TD(me, 1, 1, makeXonoticTextLabel(0, _("Channels:")));
                me.TD(me, 1, 2, e = makeXonoticTextSlider("snd_channels"));
                        e.addValue(e, _("Mono"), "1");
                        e.addValue(e, _("Stereo"), "2");
@@ -148,33 +148,15 @@ void XonoticAudioSettingsTab_fill(entity me)
                me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "snd_spatialization_control", _("Headphone friendly mode")));
                setDependent(e, "snd_channels", 1.5, 0.5);
        me.TR(me);
-       /*me.TR(me); // Samual: I REALLY don't think these are relevant to anyone, and just clutter up the menu pointlessly. The defaults are fine.
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Spatial voices:")));
-               me.TD(me, 1, 2/3, e = makeXonoticRadioButton(1, "cl_voice_directional", "0", ZCTX(_("VOCS^None"))));
-               me.TD(me, 1, 2/3, e = makeXonoticRadioButton(1, "cl_voice_directional", "2", ZCTX(_("VOCS^Taunts"))));
-               me.TD(me, 1, 2/3, e = makeXonoticRadioButton(1, "cl_voice_directional", "1", ZCTX(_("VOCS^All"))));
        me.TR(me);
-               me.TDempty(me, 0.2);
-               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Taunt range:")));
-               setDependent(e, "cl_voice_directional", 0.5, -0.5);
-               me.TD(me, 1, 2, e = makeXonoticTextSlider("cl_voice_directional_taunt_attenuation"));
-                       e.addValue(e, ZCTX(_("RNG^Very short")), "3");
-                       e.addValue(e, ZCTX(_("RNG^Short")), "2");
-                       e.addValue(e, ZCTX(_("RNG^Normal")), "0.5");
-                       e.addValue(e, ZCTX(_("RNG^Long")), "0.25");
-                       e.addValue(e, ZCTX(_("RNG^Full")), "0.015625");
-                       e.configureXonoticTextSliderValues(e);
-               setDependent(e, "cl_voice_directional", 0.5, -0.5);
-       me.TR(me);*/
+               me.TD(me, 1, 3, makeXonoticCheckBox(0, "cl_hitsound", _("Hit indication sound")));
        me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "cl_hitsound", _("Hit indication sound")));
+               me.TD(me, 1, 3, makeXonoticCheckBox(0, "con_chatsound", _("Chat message sound")));
        me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "con_chatsound", _("Chat message sound")));
+               me.TD(me, 1, 3, makeXonoticCheckBoxEx(2, 0, "menu_sounds", _("Menu sounds")));
        me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBoxEx(2, 0, "menu_sounds", _("Menu sounds")));
        me.TR(me);
-       me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Time announcer:")));
+               me.TD(me, 1, 1, makeXonoticTextLabel(0, _("Time announcer:")));
                me.TD(me, 1, 2, e = makeXonoticTextSlider("cl_announcer_maptime"));
                        e.addValue(e, ZCTX(_("WRN^Disabled")), "0");
                        e.addValue(e, _("1 minute"), "1");
@@ -191,13 +173,12 @@ void XonoticAudioSettingsTab_fill(entity me)
                        e.savedValue = 0.65; // default
        me.TR(me);
                me.TDempty(me, 0.2);
-               me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Frequency:")));
+               me.TD(me, 1, 0.8, makeXonoticTextLabel(0, _("Frequency:")));
                me.TD(me, 1, 2, sl);
        me.TR(me);
        me.TR(me);
                if(cvar("developer"))
-                       me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "showsound", _("Debug info about sounds")));
-       
+                       me.TD(me, 1, 3, makeXonoticCheckBox(0, "showsound", _("Debug info about sounds")));
 
        me.gotoRC(me, me.rows - 1, 0);
                me.TD(me, 1, me.columns, makeXonoticCommandButton(_("Apply immediately"), '0 0 0', "snd_restart; snd_attenuation_method_$menu_snd_attenuation_method; sendcvar cl_hitsound; sendcvar cl_autotaunt; sendcvar cl_voice_directional; sendcvar cl_voice_directional_taunt_attenuation", COMMANDBUTTON_APPLY));
index 78ac9de46c1bc96aeda3db938b27d8bc29b49cfd..4c03eaa5f9caa9edb5255ee3f4a217a904799463 100644 (file)
@@ -622,6 +622,8 @@ float GameType_GetID(float cnt)
        #define GAMETYPE(id) if(i++ == cnt) return id;
        GAMETYPES
        #undef GAMETYPE
+
+       unused_float = i;
        
        return 0;
 }
index fcc1cca97914ab03ecb4ff69ee10afc57bf377df..d6715e95044371e319137f2943e9cf08a40d586f 100644 (file)
@@ -1564,7 +1564,6 @@ void ClientConnect (void)
                        rr = CTS_RECORD;
                else
                        rr = RACE_RECORD;
-               t = stof(db_get(ServerProgsDB, strcat(GetMapname(), rr, "time")));
 
                msg_entity = self;
                race_send_recordtime(MSG_ONE);
index 824266db021b7b708ff855db04a0022dae369efc..402b692af1230fba959a89c1fce3aef5a999ab13 100644 (file)
@@ -558,7 +558,6 @@ void CL_Weaponentity_Think()
 
        self.angles = '0 0 0';
        float f;
-       f = 0;
        if (self.state == WS_RAISE && !intermission_running)
        {
                f = (self.owner.weapon_nextthink - time) * g_weaponratefactor / autocvar_g_balance_weaponswitchdelay;
@@ -1078,8 +1077,6 @@ vector W_CalculateProjectileVelocity(vector pvelocity, vector mvelocity, float f
 {
        vector mdirection;
        float mspeed;
-       float outspeed;
-       float nstyle;
        vector outvelocity;
 
        mvelocity = mvelocity * g_weaponspeedfactor;
@@ -1087,61 +1084,7 @@ vector W_CalculateProjectileVelocity(vector pvelocity, vector mvelocity, float f
        mdirection = normalize(mvelocity);
        mspeed = vlen(mvelocity);
 
-       nstyle = autocvar_g_projectiles_newton_style;
-       if(nstyle == 0 || forceAbsolute)
-       {
-               // absolute velocity
-               outvelocity = mvelocity;
-       }
-       else if(nstyle == 1)
-       {
-               // true Newtonian projectiles
-               outvelocity = pvelocity + mvelocity;
-       }
-       else if(nstyle == 2)
-       {
-               // true Newtonian projectiles with automatic aim adjustment
-               //
-               // solve: |outspeed * mdirection - pvelocity| = mspeed
-               // outspeed^2 - 2 * outspeed * (mdirection * pvelocity) + pvelocity^2 - mspeed^2 = 0
-               // outspeed = (mdirection * pvelocity) +- sqrt((mdirection * pvelocity)^2 - pvelocity^2 + mspeed^2)
-               // PLUS SIGN!
-               // not defined?
-               // then...
-               // pvelocity^2 - (mdirection * pvelocity)^2 > mspeed^2
-               // velocity without mdirection component > mspeed
-               // fire at smallest possible mspeed that works?
-               // |(mdirection * pvelocity) * pvelocity - pvelocity| = mspeed
-
-               vector solution;
-               solution = solve_quadratic(1, -2 * (mdirection * pvelocity), pvelocity * pvelocity - mspeed * mspeed);
-               if(solution_z)
-                       outspeed = solution_y; // the larger one
-               else
-               {
-                       //outspeed = 0; // slowest possible shot
-                       outspeed = solution_x; // the real part (that is, the average!)
-                       //dprint("impossible shot, adjusting\n");
-               }
-
-               outspeed = bound(mspeed * autocvar_g_projectiles_newton_style_2_minfactor, outspeed, mspeed * autocvar_g_projectiles_newton_style_2_maxfactor);
-               outvelocity = mdirection * outspeed;
-       }
-       else if(nstyle == 3)
-       {
-               // pseudo-Newtonian:
-               outspeed = mspeed + mdirection * pvelocity;
-               outspeed = bound(mspeed * 0.7, outspeed, mspeed * 5.0);
-               outvelocity = mdirection * outspeed;
-       }
-       else if(nstyle == 4)
-       {
-               // tZorkian:
-               outspeed = mspeed + vlen(pvelocity);
-               outvelocity = mdirection * outspeed;
-       }
-       else
-               error("g_projectiles_newton_style must be 0 (absolute), 1 (Newtonian), 2 (Newtonian + aimfix), 3 (pseudo Newtonian) or 4 (tZorkian)!");
+       outvelocity = get_shotvelocity(pvelocity, mdirection, mspeed, (forceAbsolute ? 0 : autocvar_g_projectiles_newton_style), autocvar_g_projectiles_newton_style_2_minfactor, autocvar_g_projectiles_newton_style_2_maxfactor);
 
        return outvelocity;
 }
index f5510d73f92bf5156cfe1f9e3ebd9f18c937b97e..b659d44ccab532d2c12502fe4dee0e160bc0662e 100644 (file)
@@ -226,40 +226,6 @@ void ClientCommand_ready(float request) // todo: anti-spam for toggling readynes
        }
 }
 
-void ClientCommand_reportcvar(float request, float argc, string command)
-{      
-       switch(request)
-       {
-               case CMD_REQUEST_COMMAND:
-               {
-                       if(argv(1) != "")
-                       {
-                               float tokens;
-                               string s;
-                               
-                               if(substring(argv(2), 0, 1) == "$") // undefined cvar: use the default value on the server then
-                               {
-                                       s = strcat(substring(command, argv_start_index(0), argv_end_index(1) - argv_start_index(0)), " \"", cvar_defstring(argv(1)), "\"");
-                                       tokens = tokenize_console(s);
-                               }
-                               
-                               GetCvars(1);
-                               
-                               return;
-                       }
-               }
-                       
-               default:
-                       sprint(self, "Incorrect parameters for ^2reportcvar^7\n");
-               case CMD_REQUEST_USAGE:
-               {
-                       sprint(self, "\nUsage:^3 cmd reportcvar <cvar>\n");
-                       sprint(self, "  Where 'cvar' is the cvar plus arguments to send to the server.\n");
-                       return;
-               }
-       }
-}
-
 void ClientCommand_say(float request, float argc, string command)
 {
        switch(request)
@@ -398,7 +364,7 @@ void ClientCommand_sentcvar(float request, float argc, string command)
                                if(argc == 2) // undefined cvar: use the default value on the server then
                                {
                                        s = strcat(substring(command, argv_start_index(0), argv_end_index(1) - argv_start_index(0)), " \"", cvar_defstring(argv(1)), "\"");
-                                       tokens = tokenize_console(s);
+                                       tokenize_console(s);
                                }
                                
                                GetCvars(1);
@@ -595,7 +561,6 @@ void ClientCommand_(float request)
        CLIENT_COMMAND("mv_getpicture", ClientCommand_mv_getpicture(request, arguments), "Retrieve mapshot picture from the server") \
        CLIENT_COMMAND("join", ClientCommand_join(request), "Become a player in the game") \
        CLIENT_COMMAND("ready", ClientCommand_ready(request), "Qualify as ready to end warmup stage (or restart server if allowed)") \
-       CLIENT_COMMAND("reportcvar", ClientCommand_reportcvar(request, arguments, command), "Old system for sending a client cvar to the server") \
        CLIENT_COMMAND("say", ClientCommand_say(request, arguments, command), "Print a message to chat to all players") \
        CLIENT_COMMAND("say_team", ClientCommand_say_team(request, arguments, command), "Print a message to chat to all team mates") \
        CLIENT_COMMAND("selectteam", ClientCommand_selectteam(request, arguments), "Attempt to choose a team to join into") \
@@ -683,7 +648,6 @@ void SV_ParseClientCommand(string command)
                case "mv_getpicture": break; // handled by server in this file
                case "pause": break; // handled by engine in host_cmd.c
                case "prespawn": break; // handled by engine in host_cmd.c
-               case "reportcvar": break; // handled by server in this file
                case "sentcvar": break; // handled by server in this file
                case "spawn": break; // handled by engine in host_cmd.c
                
index fea89005aa980cf3ba4cf3316c453c18f83cc446..3554f1ff67235142f837507183b772c41c841c09 100644 (file)
@@ -80,9 +80,9 @@ void CSQCProjectile(entity e, float clientanimate, float type, float docull)
        else
                e.gravity = 0;
 
-       e.csqcprojectile_type = type;
        if(!sound_allowed(MSG_BROADCAST, e))
                type |= 0x80;
+       e.csqcprojectile_type = type;
 }
 
 void UpdateCSQCProjectile(entity e)
index f0ace5ea889ccd7cfc37ee9f8bd846034438dc2d..a49aad27bdc401027a66ca15a1e181140cf765c4 100644 (file)
@@ -140,7 +140,9 @@ void GiveFrags (entity attacker, entity targ, float f, float deathtype)
                // after a frag, exchange the current weapon (or the culprit, if detectable) by a new random weapon
                float culprit;
                culprit = DEATH_WEAPONOF(deathtype);
-               if(!culprit || !WEPSET_CONTAINS_EW(attacker, culprit))
+               if(!culprit)
+                       culprit = attacker.weapon;
+               else if(!WEPSET_CONTAINS_EW(attacker, culprit))
                        culprit = attacker.weapon;
 
                if(g_weaponarena_random_with_laser && culprit == WEP_LASER)
@@ -645,9 +647,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
 
                                                        if(autocvar_g_mirrordamage_virtual)
                                                        {
-                                                               vector v;
-                                                               v = healtharmor_applydamage(attacker.armorvalue, autocvar_g_balance_armor_blockpercent, mirrordamage);
-                                                               v_z = 0; // fteqcc sucks
+                                                               vector v = healtharmor_applydamage(attacker.armorvalue, autocvar_g_balance_armor_blockpercent, mirrordamage);
                                                                attacker.dmg_take += v_x;
                                                                attacker.dmg_save += v_y;
                                                                attacker.dmg_inflictor = inflictor;
@@ -657,9 +657,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
 
                                                        if(autocvar_g_friendlyfire_virtual)
                                                        {
-                                                               vector v;
-                                                               v = healtharmor_applydamage(targ.armorvalue, autocvar_g_balance_armor_blockpercent, damage);
-                                                               v_z = 0; // fteqcc sucks
+                                                               vector v = healtharmor_applydamage(targ.armorvalue, autocvar_g_balance_armor_blockpercent, damage);
                                                                targ.dmg_take += v_x;
                                                                targ.dmg_save += v_y;
                                                                targ.dmg_inflictor = inflictor;
index 1b8585eb60c9fd2e36819745406198c320ed4e71..3826b683af6c16ceb8ca7d33aa108ed06269e8e7 100644 (file)
@@ -2442,12 +2442,8 @@ vector shotorg_adjust(vector vecs, float y_is_right, float visual)
 void attach_sameorigin(entity e, entity to, string tag)
 {
     vector org, t_forward, t_left, t_up, e_forward, e_up;
-    vector org0, ang0;
     float tagscale;
 
-    ang0 = e.angles;
-    org0 = e.origin;
-
     org = e.origin - gettaginfo(to, gettagindex(to, tag));
     tagscale = pow(vlen(v_forward), -2); // undo a scale on the tag
     t_forward = v_forward * tagscale;
index fa5a365ba48316b07c96ed3cdfc6b53619b3a2bb..2a2ae9ee2900fea47c6d90233a5fbae180281d96 100644 (file)
@@ -351,13 +351,11 @@ MUTATOR_DEFINITION(gamemode_freezetag)
        {
                if(time > 1) // game loads at time 1
                        error("This is a game type and it cannot be added at runtime.");
-               g_freezetag = 1;
                freezetag_Initialize();
        }
 
        MUTATOR_ONREMOVE
        {
-               g_freezetag = 0;
                error("This is a game type and it cannot be removed at runtime.");
        }
 
index 9134353e015574860dc4478938633ba80e3a56ec..1f6a82b84b7c9475a29f5d1fdfcd21aa5d624720 100644 (file)
@@ -329,13 +329,11 @@ MUTATOR_DEFINITION(gamemode_keepaway)
        {
                if(time > 1) // game loads at time 1
                        error("This is a game type and it cannot be added at runtime.");
-               g_keepaway = 1;
                ka_Initialize();
        }
 
        MUTATOR_ONREMOVE
        {
-               g_keepaway = 0;
                error("This is a game type and it cannot be removed at runtime.");
        }
 
index d6413d33fab9d1500219fbd0e934d6357aa27507..58d732d7f70b926c6cb13c6f93aa0f9a5807f48e 100644 (file)
@@ -32,11 +32,11 @@ float kh_no_radar_circles;
 .float siren_time;  //  time delay the siren
 //.float stuff_time;  //  time delay to stuffcmd a cvar
 
-float test[17] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
-//test[0] = status of dropped keys, test[1 - 16] = player #
+float kh_keystatus[17];
+//kh_keystatus[0] = status of dropped keys, kh_keystatus[1 - 16] = player #
 //replace 17 with cvar("maxplayers") or similar !!!!!!!!!
 //for(i = 0; i < maxplayers; ++i)
-//     test[i] = "0";
+//     kh_keystatus[i] = "0";
 
 float kh_Team_ByID(float t)
 {
@@ -342,7 +342,7 @@ void kh_Key_AssignTo(entity key, entity player)  // runs every time a key is pic
                        key.kh_next.kh_prev = key;
 
                float i;
-               i = test[key.owner.playerid];
+               i = kh_keystatus[key.owner.playerid];
                        if(key.netname == "^1red key")
                                i += 1;
                        if(key.netname == "^4blue key")
@@ -351,7 +351,7 @@ void kh_Key_AssignTo(entity key, entity player)  // runs every time a key is pic
                                i += 4;
                        if(key.netname == "^6pink key")
                                i += 8;
-               test[key.owner.playerid] = i;
+               kh_keystatus[key.owner.playerid] = i;
 
                kh_Key_Attach(key);
 
@@ -1108,13 +1108,11 @@ MUTATOR_DEFINITION(gamemode_keyhunt)
        {
                if(time > 1) // game loads at time 1
                        error("This is a game type and it cannot be added at runtime.");
-               g_keyhunt = 1;
                kh_Initialize();
        }
 
        MUTATOR_ONREMOVE
        {
-               g_keyhunt = 0;
                error("This is a game type and it cannot be removed at runtime.");
        }
 
index aa56d7647772ac4c5c5593bb6d324ce39b69dcf2..ec8de781e257fa754167f2c028c3e6c5dc5ea3cc 100644 (file)
@@ -962,7 +962,6 @@ MUTATOR_DEFINITION(gamemode_nexball)
 
        MUTATOR_ONADD
        {
-           g_nexball = 1;
                g_nexball_meter_period = autocvar_g_nexball_meter_period;
                if(g_nexball_meter_period <= 0)
                        g_nexball_meter_period = 2; // avoid division by zero etc. due to silly users
index c3a9a7390fc45fa4bd2d32bfdeb939221ce55f47..239afb04a81c4d72702fa840078e50dc1928c29f 100644 (file)
@@ -343,7 +343,6 @@ void DropAllRunes(entity pl)
 
        entity curse1, rune1, curse2, rune2;
 
-       rune = curse = world;
        rcount = ccount = r = c = 0;
        rune = find(rune, classname, "rune");
        while(rune)
@@ -363,7 +362,6 @@ void DropAllRunes(entity pl)
        numtodrop = autocvar_g_runematch_drop_runes_max;
        prevent_same = !autocvar_g_runematch_allow_same;
 
-       rune = curse = world;
        do
        {
                rune = find(rune, classname, "rune");
index 1fb823da91fcedad865f5cec22a3ebab3008c94d..3134a8bb3b66805ac2981732e10952a432a4478d 100644 (file)
@@ -326,7 +326,6 @@ float w_porto(float req)
                                        ClientData_Touch(self);
                                }
                        }
-                       v_angle_save = self.v_angle;
                        if(self.porto_v_angle_held)
                                makevectors(self.porto_v_angle); // override the previously set angles