}
void GetCvars(float f)
{
- string s;
+ string s = string_null;
if (f > 0)
s = strcat1(argv(f));
float g_pickup_ammo_anyway;
float g_pickup_weapons_anyway;
float g_weaponarena;
+WEPSET_DECLARE_A(g_weaponarena_weapons);
float g_weaponarena_random;
float g_weaponarena_random_with_laser;
string g_weaponarena_list;
float g_weaponforcefactor;
float g_weaponspreadfactor;
-float start_weapons;
+WEPSET_DECLARE_A(start_weapons);
+WEPSET_DECLARE_A(start_weapons_default);
+WEPSET_DECLARE_A(start_weapons_defaultmask);
float start_items;
float start_ammo_shells;
float start_ammo_nails;
float start_ammo_fuel;
float start_health;
float start_armorvalue;
-float warmup_start_weapons;
+WEPSET_DECLARE_A(warmup_start_weapons);
+WEPSET_DECLARE_A(warmup_start_weapons_default);
+WEPSET_DECLARE_A(warmup_start_weapons_defaultmask);
float warmup_start_ammo_shells;
float warmup_start_ammo_nails;
float warmup_start_ammo_rockets;
float want_weapon(string cvarprefix, entity weaponinfo, float allguns)
{
var float i = weaponinfo.weapon;
+ var float d = 0;
if (!i)
return 0;
- var float t = cvar(strcat(cvarprefix, weaponinfo.netname));
-
- if (t < 0) // "default" weapon selection
+ if (g_lms || g_ca || allguns)
{
- if (g_lms || g_ca || allguns)
- t = (weaponinfo.spawnflags & WEP_FLAG_NORMAL);
- else if(t < -1)
- t = 0;
- else if (g_cts)
- t = (i == WEP_SHOTGUN);
- else if (g_nexball)
- t = 0; // weapon is set a few lines later
+ if(weaponinfo.spawnflags & WEP_FLAG_NORMAL)
+ d = TRUE;
else
- t = (i == WEP_LASER || i == WEP_SHOTGUN);
- if(g_grappling_hook) // if possible, redirect off-hand hook to on-hand hook
- t |= (i == WEP_HOOK);
+ 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
+ d = 0;
- // we cannot disable porto in Nexball, we must force it
- if(g_nexball && i == WEP_PORTO)
- t = 1;
+ 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?
+ // 4: is set by default?
+ if(t < 0)
+ t = 4 | (3 * d);
+ else
+ t |= (2 * d);
return t;
}
string s;
// initialize starting values for players
- start_weapons = 0;
+ WEPSET_CLEAR_A(start_weapons);
+ WEPSET_CLEAR_A(start_weapons_default);
+ WEPSET_CLEAR_A(start_weapons_defaultmask);
start_items = 0;
start_ammo_shells = 0;
start_ammo_nails = 0;
start_armorvalue = cvar("g_balance_armor_start");
g_weaponarena = 0;
+ WEPSET_CLEAR_A(g_weaponarena_weapons);
+
s = cvar_string("g_weaponarena");
if (s == "0" || s == "")
{
}
else if (s == "all")
{
+ g_weaponarena = 1;
g_weaponarena_list = "All Weapons";
for (j = WEP_FIRST; j <= WEP_LAST; ++j)
{
e = get_weaponinfo(j);
- g_weaponarena |= e.weapons;
- weapon_action(e.weapon, WR_PRECACHE);
+ if not(e.spawnflags & WEP_FLAG_MUTATORBLOCKED)
+ WEPSET_OR_AW(g_weaponarena_weapons, j);
}
}
else if (s == "most")
{
+ g_weaponarena = 1;
g_weaponarena_list = "Most Weapons";
for (j = WEP_FIRST; j <= WEP_LAST; ++j)
{
e = get_weaponinfo(j);
- if (e.spawnflags & WEP_FLAG_NORMAL)
- {
- g_weaponarena |= e.weapons;
- weapon_action(e.weapon, WR_PRECACHE);
- }
+ if not(e.spawnflags & WEP_FLAG_MUTATORBLOCKED)
+ if (e.spawnflags & WEP_FLAG_NORMAL)
+ WEPSET_OR_AW(g_weaponarena_weapons, j);
}
}
else if (s == "none")
{
+ g_weaponarena = 1;
g_weaponarena_list = "No Weapons";
- g_weaponarena = WEPBIT_ALL + 1; // this supports no single weapon bit!
}
else
{
+ g_weaponarena = 1;
t = tokenize_console(s);
g_weaponarena_list = "";
for (i = 0; i < t; ++i)
e = get_weaponinfo(j);
if (e.netname == s)
{
- g_weaponarena |= e.weapons;
- weapon_action(e.weapon, WR_PRECACHE);
+ WEPSET_OR_AW(g_weaponarena_weapons, j);
g_weaponarena_list = strcat(g_weaponarena_list, e.message, " & ");
break;
}
if (g_weaponarena)
{
- start_weapons = g_weaponarena;
+ g_minstagib = 0; // incompatible
+ g_pinata = 0; // incompatible
+ g_weapon_stay = 0; // incompatible
+ WEPSET_COPY_AA(start_weapons, g_weaponarena_weapons);
if(!(g_lms || g_ca))
start_items |= IT_UNLIMITED_AMMO;
}
else if (g_minstagib)
{
+ g_pinata = 0; // incompatible
+ g_weapon_stay = 0; // incompatible
+ g_bloodloss = 0; // incompatible
start_health = 100;
start_armorvalue = 0;
- start_weapons = WEPBIT_MINSTANEX;
- weapon_action(WEP_MINSTANEX, WR_PRECACHE);
+ WEPSET_COPY_AW(start_weapons, WEP_MINSTANEX);
g_minstagib_invis_alpha = cvar("g_minstagib_invis_alpha");
start_items |= IT_UNLIMITED_SUPERWEAPONS;
for (i = WEP_FIRST; i <= WEP_LAST; ++i)
{
e = get_weaponinfo(i);
- if(want_weapon("g_start_weapon_", e, FALSE))
- start_weapons |= e.weapons;
+ float w = want_weapon("g_start_weapon_", e, FALSE);
+ if(w & 1)
+ WEPSET_OR_AW(start_weapons, i);
+ if(w & 2)
+ WEPSET_OR_AW(start_weapons_default, i);
+ if(w & 4)
+ WEPSET_OR_AW(start_weapons_defaultmask, i);
}
}
if(!cvar("g_use_ammunition"))
start_items |= IT_UNLIMITED_AMMO;
+ if(cvar("g_nexball"))
+ start_items |= IT_UNLIMITED_SUPERWEAPONS; // FIXME BAD BAD BAD BAD HACK, NEXBALL SHOULDN'T ABUSE PORTO'S WEAPON SLOT
+
if(g_minstagib)
{
start_ammo_cells = cvar("g_minstagib_ammo_start");
warmup_start_ammo_fuel = start_ammo_fuel;
warmup_start_health = start_health;
warmup_start_armorvalue = start_armorvalue;
- warmup_start_weapons = start_weapons;
+ WEPSET_COPY_AA(warmup_start_weapons, start_weapons);
+ WEPSET_COPY_AA(warmup_start_weapons_default, start_weapons_default);
+ WEPSET_COPY_AA(warmup_start_weapons_defaultmask, start_weapons_defaultmask);
if (!g_weaponarena && !g_minstagib && !g_ca)
{
warmup_start_ammo_fuel = cvar("g_warmup_start_ammo_fuel");
warmup_start_health = cvar("g_warmup_start_health");
warmup_start_armorvalue = cvar("g_warmup_start_armor");
- warmup_start_weapons = 0;
+ 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);
- if(want_weapon("g_start_weapon_", e, cvar("g_warmup_allguns")))
- warmup_start_weapons |= e.weapons;
+ float w = want_weapon("g_start_weapon_", e, cvar("g_warmup_allguns"));
+ if(w & 1)
+ WEPSET_OR_AW(warmup_start_weapons, i);
+ if(w & 2)
+ WEPSET_OR_AW(warmup_start_weapons_default, i);
+ if(w & 4)
+ WEPSET_OR_AW(warmup_start_weapons_defaultmask, i);
}
}
}
- if (g_jetpack || (g_grappling_hook && (start_weapons & WEPBIT_HOOK)))
+ if (g_jetpack)
+ start_items |= IT_JETPACK;
+
+ MUTATOR_CALLHOOK(SetStartItems);
+
+ if ((start_items & IT_JETPACK) || (g_grappling_hook && WEPSET_CONTAINS_AW(start_weapons, WEP_HOOK)))
{
g_grappling_hook = 0; // these two can't coexist, as they use the same button
start_items |= IT_FUEL_REGEN;
warmup_start_ammo_fuel = max(warmup_start_ammo_fuel, cvar("g_balance_fuel_rotstable"));
}
- if (g_jetpack)
- start_items |= IT_JETPACK;
-
- MUTATOR_CALLHOOK(SetStartItems);
-
for (i = WEP_FIRST; i <= WEP_LAST; ++i)
{
e = get_weaponinfo(i);
- if(e.weapons & (start_weapons | warmup_start_weapons))
- weapon_action(e.weapon, WR_PRECACHE);
+ if(WEPSET_CONTAINS_AW(start_weapons, i) || WEPSET_CONTAINS_AW(warmup_start_weapons, i))
+ weapon_action(i, WR_PRECACHE);
}
start_ammo_shells = max(0, start_ammo_shells);
string GetGametype(); // g_world.qc
void readlevelcvars(void)
{
- // first load all the mutators
- if(cvar("g_invincible_projectiles"))
- MUTATOR_ADD(mutator_invincibleprojectiles);
- if(cvar("g_nix"))
- MUTATOR_ADD(mutator_nix);
+ g_minstagib = cvar("g_minstagib");
+
+ // load ALL the mutators
if(cvar("g_dodging"))
MUTATOR_ADD(mutator_dodging);
- if(cvar("g_rocket_flying"))
- MUTATOR_ADD(mutator_rocketflying);
- if(cvar("g_vampire"))
- MUTATOR_ADD(mutator_vampire);
if(cvar("g_spawn_near_teammate"))
MUTATOR_ADD(mutator_spawn_near_teammate);
+ if(!g_minstagib)
+ {
+ if(cvar("g_invincible_projectiles"))
+ MUTATOR_ADD(mutator_invincibleprojectiles);
+ if(cvar("g_new_toys"))
+ MUTATOR_ADD(mutator_new_toys);
+ if(cvar("g_nix"))
+ MUTATOR_ADD(mutator_nix);
+ if(cvar("g_rocket_flying"))
+ MUTATOR_ADD(mutator_rocketflying);
+ if(cvar("g_vampire"))
+ MUTATOR_ADD(mutator_vampire);
+ }
// is this a mutator? is this a mode?
if(cvar("g_sandbox"))
g_grappling_hook = cvar("g_grappling_hook");
g_jetpack = cvar("g_jetpack");
g_midair = cvar("g_midair");
- g_minstagib = cvar("g_minstagib");
g_norecoil = cvar("g_norecoil");
g_bloodloss = cvar("g_bloodloss");
sv_maxidle = cvar("sv_maxidle");
{
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)))
e.initialize_entity_order = order;
cur = initialize_entity_first;
+ prev = world;
for (;;)
{
if (!cur || cur.initialize_entity_order > order)
}
#define PROJECTILE_TOUCH if(WarpZone_Projectile_Touch()) return
-float MAX_IPBAN_URIS = 16;
-
-float URI_GET_DISCARD = 0;
-float URI_GET_IPBAN = 1;
-float URI_GET_IPBAN_END = 16;
+#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)
{
- dprint("Received HTTP request data for id ", ftos(id), "; status is ", ftos(status), "\nData is:\n");
- dprint(data);
- dprint("\nEnd of data.\n");
-
- if(url_URI_Get_Callback(id, status, data))
- {
- // handled
- }
- else if (id == URI_GET_DISCARD)
- {
- // discard
- }
- else if (id >= URI_GET_IPBAN && id <= URI_GET_IPBAN_END)
- {
- // online ban list
- OnlineBanList_URI_Get_Callback(id, status, data);
- }
- else
- {
- print("Received HTTP request data for an invalid id ", ftos(id), ".\n");
- }
+ if(url_URI_Get_Callback(id, status, data))
+ {
+ // handled
+ }
+ else if (id == URI_GET_DISCARD)
+ {
+ // discard
+ }
+ else if (id >= URI_GET_CURL && id <= URI_GET_CURL_END)
+ {
+ // sv_cmd curl
+ Curl_URI_Get_Callback(id, status, data);
+ }
+ else if (id >= URI_GET_IPBAN && id <= URI_GET_IPBAN_END)
+ {
+ // online ban list
+ OnlineBanList_URI_Get_Callback(id, status, data);
+ }
+ else
+ {
+ print("Received HTTP request data for an invalid id ", ftos(id), ".\n");
+ }
}
string uid2name(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)
org = world.mins;
delta = world.maxs - world.mins;
+ start = end = org;
+
for (i = 0; i < attempts; ++i)
{
start_x = org_x + random() * delta_x;