From: terencehill Date: Thu, 10 May 2012 16:11:09 +0000 (+0200) Subject: Merge branch 'master' into terencehill/mutators_dialog_cleanup X-Git-Tag: xonotic-v0.7.0~267^2 X-Git-Url: http://git.xonotic.org/?a=commitdiff_plain;h=cc8895c290e5b20ea8f3d47dd6110f2f0fc7b3ac;hp=50967b631057ea1677416437a83c281eb324cdbd;p=xonotic%2Fxonotic-data.pk3dir.git Merge branch 'master' into terencehill/mutators_dialog_cleanup --- diff --git a/balance25.cfg b/balance25.cfg index 9783f5e8b..bea9ad263 100644 --- a/balance25.cfg +++ b/balance25.cfg @@ -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 diff --git a/balanceFruitieX.cfg b/balanceFruitieX.cfg index 54e232dc4..16286fe0f 100644 --- a/balanceFruitieX.cfg +++ b/balanceFruitieX.cfg @@ -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 diff --git a/balanceXPM.cfg b/balanceXPM.cfg index ea933d272..d3478a969 100644 --- a/balanceXPM.cfg +++ b/balanceXPM.cfg @@ -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 diff --git a/balanceXonotic.cfg b/balanceXonotic.cfg index 2f1d16d82..b7dbd3db8 100644 --- a/balanceXonotic.cfg +++ b/balanceXonotic.cfg @@ -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 diff --git a/effects-ultra.cfg b/effects-ultra.cfg index 4c4c09baf..f92230f16 100644 --- a/effects-ultra.cfg +++ b/effects-ultra.cfg @@ -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 diff --git a/qcsrc/Makefile b/qcsrc/Makefile index 66fc02720..27f6fc993 100644 --- a/qcsrc/Makefile +++ b/qcsrc/Makefile @@ -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 ?= diff --git a/qcsrc/common/campaign_file.qc b/qcsrc/common/campaign_file.qc index 067cd8054..5ab3da67c 100644 --- a/qcsrc/common/campaign_file.qc +++ b/qcsrc/common/campaign_file.qc @@ -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) diff --git a/qcsrc/common/command/markup.qc b/qcsrc/common/command/markup.qc index cb1a8cc37..d1562aaac 100644 --- a/qcsrc/common/command/markup.qc +++ b/qcsrc/common/command/markup.qc @@ -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) diff --git a/qcsrc/common/mapinfo.qc b/qcsrc/common/mapinfo.qc index 9de5098cb..05c93865d 100644 --- a/qcsrc/common/mapinfo.qc +++ b/qcsrc/common/mapinfo.qc @@ -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; diff --git a/qcsrc/common/util.qc b/qcsrc/common/util.qc index a1e059589..b973850cc 100644 --- a/qcsrc/common/util.qc +++ b/qcsrc/common/util.qc @@ -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")) diff --git a/qcsrc/common/util.qh b/qcsrc/common/util.qh index 64830ca1d..c409de354 100644 --- a/qcsrc/common/util.qh +++ b/qcsrc/common/util.qh @@ -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; diff --git a/qcsrc/csqcmodellib/sv_model.qc b/qcsrc/csqcmodellib/sv_model.qc index bf6eefa69..e6e4cfe43 100644 --- a/qcsrc/csqcmodellib/sv_model.qc +++ b/qcsrc/csqcmodellib/sv_model.qc @@ -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) { diff --git a/qcsrc/fteqcc-bugs.qc b/qcsrc/fteqcc-bugs.qc index e426e93f9..dd4fd45f3 100644 --- a/qcsrc/fteqcc-bugs.qc +++ b/qcsrc/fteqcc-bugs.qc @@ -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)); +} diff --git a/qcsrc/menu/anim/animhost.c b/qcsrc/menu/anim/animhost.c index 48a45bda8..ae84e0957 100644 --- a/qcsrc/menu/anim/animhost.c +++ b/qcsrc/menu/anim/animhost.c @@ -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; diff --git a/qcsrc/menu/anim/keyframe.c b/qcsrc/menu/anim/keyframe.c index de5d54ae1..3bcda94e6 100644 --- a/qcsrc/menu/anim/keyframe.c +++ b/qcsrc/menu/anim/keyframe.c @@ -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) diff --git a/qcsrc/menu/item/container.c b/qcsrc/menu/item/container.c index 0e8fa9ea0..6241cee03 100644 --- a/qcsrc/menu/item/container.c +++ b/qcsrc/menu/item/container.c @@ -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; diff --git a/qcsrc/menu/item/inputbox.c b/qcsrc/menu/item/inputbox.c index af6587b5a..572d3a071 100644 --- a/qcsrc/menu/item/inputbox.c +++ b/qcsrc/menu/item/inputbox.c @@ -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 diff --git a/qcsrc/menu/item/inputcontainer.c b/qcsrc/menu/item/inputcontainer.c index e1b14d3b1..65129b294 100644 --- a/qcsrc/menu/item/inputcontainer.c +++ b/qcsrc/menu/item/inputcontainer.c @@ -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; diff --git a/qcsrc/menu/item/listbox.c b/qcsrc/menu/item/listbox.c index 4f8dca622..0c4f34902 100644 --- a/qcsrc/menu/item/listbox.c +++ b/qcsrc/menu/item/listbox.c @@ -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)); } } diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_create_advanced.c b/qcsrc/menu/xonotic/dialog_multiplayer_create_advanced.c index 226f346b6..3fcabaaab 100644 --- a/qcsrc/menu/xonotic/dialog_multiplayer_create_advanced.c +++ b/qcsrc/menu/xonotic/dialog_multiplayer_create_advanced.c @@ -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')); diff --git a/qcsrc/menu/xonotic/dialog_settings_audio.c b/qcsrc/menu/xonotic/dialog_settings_audio.c index 1f1ee385b..174873fe7 100644 --- a/qcsrc/menu/xonotic/dialog_settings_audio.c +++ b/qcsrc/menu/xonotic/dialog_settings_audio.c @@ -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)); diff --git a/qcsrc/menu/xonotic/util.qc b/qcsrc/menu/xonotic/util.qc index 78ac9de46..4c03eaa5f 100644 --- a/qcsrc/menu/xonotic/util.qc +++ b/qcsrc/menu/xonotic/util.qc @@ -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; } diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index fcc1cca97..d6715e950 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -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); diff --git a/qcsrc/server/cl_weaponsystem.qc b/qcsrc/server/cl_weaponsystem.qc index 824266db0..402b692af 100644 --- a/qcsrc/server/cl_weaponsystem.qc +++ b/qcsrc/server/cl_weaponsystem.qc @@ -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; } diff --git a/qcsrc/server/command/cmd.qc b/qcsrc/server/command/cmd.qc index f5510d73f..b659d44cc 100644 --- a/qcsrc/server/command/cmd.qc +++ b/qcsrc/server/command/cmd.qc @@ -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 \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 diff --git a/qcsrc/server/csqcprojectile.qc b/qcsrc/server/csqcprojectile.qc index fea89005a..3554f1ff6 100644 --- a/qcsrc/server/csqcprojectile.qc +++ b/qcsrc/server/csqcprojectile.qc @@ -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) diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index f0ace5ea8..a49aad27b 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -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; diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index 1b8585eb6..3826b683a 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -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; diff --git a/qcsrc/server/mutators/gamemode_freezetag.qc b/qcsrc/server/mutators/gamemode_freezetag.qc index fa5a365ba..2a2ae9ee2 100644 --- a/qcsrc/server/mutators/gamemode_freezetag.qc +++ b/qcsrc/server/mutators/gamemode_freezetag.qc @@ -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."); } diff --git a/qcsrc/server/mutators/gamemode_keepaway.qc b/qcsrc/server/mutators/gamemode_keepaway.qc index 9134353e0..1f6a82b84 100644 --- a/qcsrc/server/mutators/gamemode_keepaway.qc +++ b/qcsrc/server/mutators/gamemode_keepaway.qc @@ -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."); } diff --git a/qcsrc/server/mutators/gamemode_keyhunt.qc b/qcsrc/server/mutators/gamemode_keyhunt.qc index d6413d33f..58d732d7f 100644 --- a/qcsrc/server/mutators/gamemode_keyhunt.qc +++ b/qcsrc/server/mutators/gamemode_keyhunt.qc @@ -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."); } diff --git a/qcsrc/server/mutators/gamemode_nexball.qc b/qcsrc/server/mutators/gamemode_nexball.qc index aa56d7647..ec8de781e 100644 --- a/qcsrc/server/mutators/gamemode_nexball.qc +++ b/qcsrc/server/mutators/gamemode_nexball.qc @@ -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 diff --git a/qcsrc/server/runematch.qc b/qcsrc/server/runematch.qc index c3a9a7390..239afb04a 100644 --- a/qcsrc/server/runematch.qc +++ b/qcsrc/server/runematch.qc @@ -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"); diff --git a/qcsrc/server/w_porto.qc b/qcsrc/server/w_porto.qc index 1fb823da9..3134a8bb3 100644 --- a/qcsrc/server/w_porto.qc +++ b/qcsrc/server/w_porto.qc @@ -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