X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fmiscfunctions.qc;h=25b42821ed3621735722e23194374d4922396458;hb=b41f7ee415c9cc35d6304ca237986a9e445ffd4c;hp=051b476002e0563cedb3db7cdb9b78fc1e6755fd;hpb=54ef76df460d8ec00e5058372b383561e11d04b9;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index 051b47600..25b42821e 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -526,7 +526,7 @@ string W_FixWeaponOrder_ForceComplete_AndBuildImpulseList(string wo) } void GetCvars(float f) { - string s; + string s = string_null; if (f > 0) s = strcat1(argv(f)); @@ -772,7 +772,6 @@ float warmup_start_ammo_fuel; float warmup_start_health; float warmup_start_armorvalue; float g_weapon_stay; -float g_ghost_items; entity get_weaponinfo(float w); @@ -785,13 +784,19 @@ float want_weapon(string cvarprefix, entity weaponinfo, float allguns) return 0; if (g_lms || g_ca || allguns) - d = (weaponinfo.spawnflags & WEP_FLAG_NORMAL); + { + if(weaponinfo.spawnflags & WEP_FLAG_NORMAL) + d = TRUE; + else + d = FALSE; + } else if (g_cts) d = (i == WEP_SHOTGUN); else if (g_nexball) d = 0; // weapon is set a few lines later else d = (i == WEP_LASER || i == WEP_SHOTGUN); + if(g_grappling_hook) // if possible, redirect off-hand hook to on-hand hook d |= (i == WEP_HOOK); if(weaponinfo.spawnflags & WEP_FLAG_MUTATORBLOCKED) // never default mutator blocked guns @@ -799,6 +804,8 @@ float want_weapon(string cvarprefix, entity weaponinfo, float allguns) var float t = cvar(strcat(cvarprefix, weaponinfo.netname)); + //print(strcat("want_weapon: ", weaponinfo.netname, " - d: ", ftos(d), ", t: ", ftos(t), ". \n")); + // bit order in t: // 1: want or not // 2: is default? @@ -852,8 +859,11 @@ void readplayerstartcvars() g_weaponarena = 1; g_weaponarena_list = "All Weapons"; for (j = WEP_FIRST; j <= WEP_LAST; ++j) + { + e = get_weaponinfo(j); if not(e.spawnflags & WEP_FLAG_MUTATORBLOCKED) WEPSET_OR_AW(g_weaponarena_weapons, j); + } } else if (s == "most") { @@ -1010,6 +1020,8 @@ void readplayerstartcvars() warmup_start_health = cvar("g_warmup_start_health"); warmup_start_armorvalue = cvar("g_warmup_start_armor"); WEPSET_CLEAR_A(warmup_start_weapons); + WEPSET_CLEAR_A(warmup_start_weapons_default); + WEPSET_CLEAR_A(warmup_start_weapons_defaultmask); for (i = WEP_FIRST; i <= WEP_LAST; ++i) { e = get_weaponinfo(i); @@ -1236,11 +1248,6 @@ void readlevelcvars(void) if(!g_weapon_stay) g_weapon_stay = cvar("g_weapon_stay"); - g_ghost_items = cvar("g_ghost_items"); - - if(g_ghost_items >= 1) - g_ghost_items = 0.25; // default alpha value - if not(inWarmupStage && !g_ca) game_starttime = cvar("g_start_delay"); @@ -1686,7 +1693,7 @@ void make_safe_for_remove(entity e) { if (e.initialize_entity) { - entity ent, prev; + entity ent, prev = world; for (ent = initialize_entity_first; ent; ) { if ((ent == e) || ((ent.classname == "initialize_entity") && (ent.enemy == e))) @@ -1758,6 +1765,7 @@ void InitializeEntity(entity e, void(void) func, float order) e.initialize_entity_order = order; cur = initialize_entity_first; + prev = world; for (;;) { if (!cur || cur.initialize_entity_order > order) @@ -2016,6 +2024,9 @@ float WarpZone_Projectile_Touch_ImpactFilter_Callback() } #define PROJECTILE_TOUCH if(WarpZone_Projectile_Touch()) return +#define ITEM_TOUCH_NEEDKILL() (((trace_dpstartcontents | trace_dphitcontents) & DPCONTENTS_NODROP) || (trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY)) +#define ITEM_DAMAGE_NEEDKILL(dt) (((dt) == DEATH_HURTTRIGGER) || ((dt) == DEATH_SLIME) || ((dt) == DEATH_LAVA) || ((dt) == DEATH_SWAMP)) + void URI_Get_Callback(float id, float status, string data) { if(url_URI_Get_Callback(id, status, data)) @@ -2105,7 +2116,7 @@ void race_writeTime(string map, float t, string myuid) float newpos; newpos = race_readPos(map, t); - float i, prevpos; + float i, prevpos = 0; for(i = 1; i <= RANKINGS_CNT; ++i) { if(race_readUID(map, i) == myuid) @@ -2167,6 +2178,8 @@ float MoveToRandomMapLocation(entity e, float goodcontents, float badcontents, f org = world.mins; delta = world.maxs - world.mins; + start = end = org; + for (i = 0; i < attempts; ++i) { start_x = org_x + random() * delta_x; @@ -2423,12 +2436,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;