From: Mario Date: Sat, 21 Apr 2018 04:34:38 +0000 (+1000) Subject: Remove the g_instagib global and use an autocvar macro for it (should fix campaign) X-Git-Tag: xonotic-v0.8.5~2183 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d2103fff45069a3eea862441558ddf536371e59d;p=xonotic%2Fxonotic-data.pk3dir.git Remove the g_instagib global and use an autocvar macro for it (should fix campaign) --- diff --git a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc index 937f4cbde..4a54d8117 100644 --- a/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc +++ b/qcsrc/common/mutators/mutator/buffs/sv_buffs.qc @@ -926,7 +926,7 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerPreThink) BUFF_ONADD(BUFF_INVISIBLE) { - if(time < player.strength_finished && g_instagib) + if(time < player.strength_finished && autocvar_g_instagib) player.buff_invisible_prev_alpha = default_player_alpha; // we don't want to save the powerup's alpha, as player may lose the powerup while holding the buff else player.buff_invisible_prev_alpha = player.alpha; @@ -935,7 +935,7 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerPreThink) BUFF_ONREM(BUFF_INVISIBLE) { - if(time < player.strength_finished && g_instagib) + if(time < player.strength_finished && autocvar_g_instagib) player.alpha = autocvar_g_instagib_invis_alpha; else player.alpha = player.buff_invisible_prev_alpha; diff --git a/qcsrc/common/mutators/mutator/melee_only/sv_melee_only.qc b/qcsrc/common/mutators/mutator/melee_only/sv_melee_only.qc index 5603dd490..2f8b45a99 100644 --- a/qcsrc/common/mutators/mutator/melee_only/sv_melee_only.qc +++ b/qcsrc/common/mutators/mutator/melee_only/sv_melee_only.qc @@ -1,7 +1,7 @@ #include "sv_melee_only.qh" string autocvar_g_melee_only; -REGISTER_MUTATOR(melee_only, expr_evaluate(autocvar_g_melee_only) && !cvar("g_instagib") && !cvar("g_overkill") && !g_nexball); +REGISTER_MUTATOR(melee_only, expr_evaluate(autocvar_g_melee_only) && !autocvar_g_instagib && !cvar("g_overkill") && !g_nexball); MUTATOR_HOOKFUNCTION(melee_only, SetStartItems, CBC_ORDER_LAST) { diff --git a/qcsrc/common/mutators/mutator/new_toys/sv_new_toys.qc b/qcsrc/common/mutators/mutator/new_toys/sv_new_toys.qc index ec2593215..1ecbf37ec 100644 --- a/qcsrc/common/mutators/mutator/new_toys/sv_new_toys.qc +++ b/qcsrc/common/mutators/mutator/new_toys/sv_new_toys.qc @@ -74,7 +74,7 @@ string autocvar_g_new_toys; bool nt_IsNewToy(int w); -REGISTER_MUTATOR(nt, expr_evaluate(autocvar_g_new_toys) && !cvar("g_instagib") && !cvar("g_overkill")) +REGISTER_MUTATOR(nt, expr_evaluate(autocvar_g_new_toys) && !autocvar_g_instagib && !cvar("g_overkill")) { MUTATOR_ONADD { diff --git a/qcsrc/common/mutators/mutator/nix/sv_nix.qc b/qcsrc/common/mutators/mutator/nix/sv_nix.qc index 953321cc0..f67cf7870 100644 --- a/qcsrc/common/mutators/mutator/nix/sv_nix.qc +++ b/qcsrc/common/mutators/mutator/nix/sv_nix.qc @@ -36,7 +36,7 @@ float nix_nextweapon; bool NIX_CanChooseWeapon(int wpn); -REGISTER_MUTATOR(nix, expr_evaluate(autocvar_g_nix) && !cvar("g_instagib") && !cvar("g_overkill")) +REGISTER_MUTATOR(nix, expr_evaluate(autocvar_g_nix) && !autocvar_g_instagib && !cvar("g_overkill")) { MUTATOR_ONADD { diff --git a/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc b/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc index e91062394..582a8d35b 100644 --- a/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc +++ b/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc @@ -11,7 +11,7 @@ bool autocvar_g_overkill_itemwaypoints = true; .Weapon ok_lastwep[MAX_WEAPONSLOTS]; -REGISTER_MUTATOR(ok, expr_evaluate(autocvar_g_overkill) && !cvar("g_instagib") && !g_nexball && cvar_string("g_mod_balance") == "Overkill") +REGISTER_MUTATOR(ok, expr_evaluate(autocvar_g_overkill) && !autocvar_g_instagib && !g_nexball && cvar_string("g_mod_balance") == "Overkill") { MUTATOR_ONADD { diff --git a/qcsrc/common/mutators/mutator/pinata/sv_pinata.qc b/qcsrc/common/mutators/mutator/pinata/sv_pinata.qc index 1084ff778..c5bf2262e 100644 --- a/qcsrc/common/mutators/mutator/pinata/sv_pinata.qc +++ b/qcsrc/common/mutators/mutator/pinata/sv_pinata.qc @@ -1,7 +1,7 @@ #include "sv_pinata.qh" string autocvar_g_pinata; -REGISTER_MUTATOR(pinata, expr_evaluate(autocvar_g_pinata) && !cvar("g_instagib") && !cvar("g_overkill")); +REGISTER_MUTATOR(pinata, expr_evaluate(autocvar_g_pinata) && !autocvar_g_instagib && !cvar("g_overkill")); MUTATOR_HOOKFUNCTION(pinata, PlayerDies) { diff --git a/qcsrc/common/mutators/mutator/rocketminsta/sv_rocketminsta.qc b/qcsrc/common/mutators/mutator/rocketminsta/sv_rocketminsta.qc index 7edef9813..c6def68e1 100644 --- a/qcsrc/common/mutators/mutator/rocketminsta/sv_rocketminsta.qc +++ b/qcsrc/common/mutators/mutator/rocketminsta/sv_rocketminsta.qc @@ -3,7 +3,7 @@ #include #include -REGISTER_MUTATOR(rm, cvar("g_instagib")); +REGISTER_MUTATOR(rm, autocvar_g_instagib); MUTATOR_HOOKFUNCTION(rm, Damage_Calculate) { diff --git a/qcsrc/common/mutators/mutator/vampire/sv_vampire.qc b/qcsrc/common/mutators/mutator/vampire/sv_vampire.qc index 199b4e202..b599805a4 100644 --- a/qcsrc/common/mutators/mutator/vampire/sv_vampire.qc +++ b/qcsrc/common/mutators/mutator/vampire/sv_vampire.qc @@ -1,7 +1,7 @@ #include "sv_vampire.qh" string autocvar_g_vampire; -REGISTER_MUTATOR(vampire, expr_evaluate(autocvar_g_vampire) && !cvar("g_instagib")); +REGISTER_MUTATOR(vampire, expr_evaluate(autocvar_g_vampire) && !autocvar_g_instagib); MUTATOR_HOOKFUNCTION(vampire, PlayerDamage_SplitHealthArmor) { diff --git a/qcsrc/common/turrets/turret/plasma.qc b/qcsrc/common/turrets/turret/plasma.qc index 96fa81f8e..c4e50a7e7 100644 --- a/qcsrc/common/turrets/turret/plasma.qc +++ b/qcsrc/common/turrets/turret/plasma.qc @@ -6,7 +6,7 @@ spawnfunc(turret_plasma) { if (!turret_initialize(this, TUR_PLASMA)) delete(this METHOD(PlasmaTurret, tr_attack, void(PlasmaTurret this, entity it)) { - if(g_instagib) + if(autocvar_g_instagib) { .entity weaponentity = weaponentities[0]; // TODO: unhardcode FireRailgunBullet (it, weaponentity, it.tur_shotorg, it.tur_shotorg + it.tur_shotdir_updated * max_shot_distance, 10000000000, diff --git a/qcsrc/common/turrets/turret/plasma_dual.qc b/qcsrc/common/turrets/turret/plasma_dual.qc index 2a6f997cf..8d20da5b6 100644 --- a/qcsrc/common/turrets/turret/plasma_dual.qc +++ b/qcsrc/common/turrets/turret/plasma_dual.qc @@ -6,7 +6,7 @@ spawnfunc(turret_plasma_dual) { if (!turret_initialize(this, TUR_PLASMA_DUAL)) d METHOD(DualPlasmaTurret, tr_attack, void(DualPlasmaTurret thistur, entity it)) { - if (g_instagib) { + if (autocvar_g_instagib) { .entity weaponentity = weaponentities[0]; // TODO: unhardcode FireRailgunBullet (it, weaponentity, it.tur_shotorg, it.tur_shotorg + it.tur_shotdir_updated * max_shot_distance, 10000000000, 800, 0, 0, 0, 0, DEATH_TURRET_PLASMA.m_id); diff --git a/qcsrc/common/weapons/weapon/vaporizer.qc b/qcsrc/common/weapons/weapon/vaporizer.qc index e46745c2a..c3baa1212 100644 --- a/qcsrc/common/weapons/weapon/vaporizer.qc +++ b/qcsrc/common/weapons/weapon/vaporizer.qc @@ -144,7 +144,7 @@ void W_Vaporizer_Attack(Weapon thiswep, entity actor, .entity weaponentity) if(!(trace_dphitq3surfaceflags & (Q3SURFACEFLAG_SKY | Q3SURFACEFLAG_NOIMPACT))) W_RocketMinsta_Explosion(actor, weaponentity, trace_endpos); - W_DecreaseAmmo(thiswep, actor, ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo)), weaponentity); + W_DecreaseAmmo(thiswep, actor, ((autocvar_g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo)), weaponentity); } void W_RocketMinsta_Laser_Explode (entity this, entity directhitentity) @@ -288,7 +288,7 @@ METHOD(Vaporizer, wr_aim, void(entity thiswep, entity actor, .entity weaponentit } METHOD(Vaporizer, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { - float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo)); + float vaporizer_ammo = ((autocvar_g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo)); // if the laser uses load, we also consider its ammo for reloading if(WEP_CVAR(vaporizer, reload_ammo) && WEP_CVAR_SEC(vaporizer, ammo) && actor.(weaponentity).clip_load < min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo))) { // forced reload thiswep.wr_reload(thiswep, actor, weaponentity); @@ -349,7 +349,7 @@ METHOD(Vaporizer, wr_setup, void(entity thiswep, entity actor, .entity weaponent } METHOD(Vaporizer, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity)) { - float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo)); + float vaporizer_ammo = ((autocvar_g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo)); float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= vaporizer_ammo; ammo_amount += actor.(weaponentity).(weapon_load[WEP_VAPORIZER.m_id]) >= vaporizer_ammo; return ammo_amount; @@ -368,7 +368,7 @@ METHOD(Vaporizer, wr_resetplayer, void(entity thiswep, entity actor)) } METHOD(Vaporizer, wr_reload, void(entity thiswep, entity actor, .entity weaponentity)) { - float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo)); + float vaporizer_ammo = ((autocvar_g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo)); float used_ammo; if(WEP_CVAR_SEC(vaporizer, ammo)) used_ammo = min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo)); diff --git a/qcsrc/server/autocvars.qh b/qcsrc/server/autocvars.qh index e9bacafa7..2842a5431 100644 --- a/qcsrc/server/autocvars.qh +++ b/qcsrc/server/autocvars.qh @@ -167,7 +167,7 @@ int autocvar_g_maxplayers; float autocvar_g_maxplayers_spectator_blocktime; float autocvar_g_maxpushtime; float autocvar_g_maxspeed; -bool autocvar_g_instagib; +#define autocvar_g_instagib cvar("g_instagib") #define autocvar_g_mirrordamage cvar("g_mirrordamage") #define autocvar_g_mirrordamage_virtual cvar("g_mirrordamage_virtual") bool autocvar_g_mirrordamage_onlyweapons; diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index 663d16ed7..d374876d0 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -1496,7 +1496,7 @@ void player_powerups(entity this) Fire_ApplyDamage(this); Fire_ApplyEffect(this); - if (!g_instagib) + if (!autocvar_g_instagib) { if (this.items & ITEM_Strength.m_itemid) { diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index f85d6e2b6..e005d0ca8 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -7,7 +7,7 @@ // Globals -float g_footsteps, g_grappling_hook, g_instagib; +float g_footsteps, g_grappling_hook; float g_warmup_allguns; float g_warmup_allow_timeout; float warmup_stage; diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index b5ab77d41..b36cfc95a 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -779,7 +779,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d } } - if(!g_instagib) + if(!autocvar_g_instagib) { // apply strength multiplier if (attacker.items & ITEM_Strength.m_itemid) diff --git a/qcsrc/server/miscfunctions.qh b/qcsrc/server/miscfunctions.qh index 5538a5744..41e725946 100644 --- a/qcsrc/server/miscfunctions.qh +++ b/qcsrc/server/miscfunctions.qh @@ -222,8 +222,6 @@ void readlevelcvars() if(cvar("sv_allow_fullbright")) serverflags |= SERVERFLAG_ALLOW_FULLBRIGHT; - g_instagib = cvar("g_instagib"); - sv_clones = cvar("sv_clones"); sv_foginterval = cvar("sv_foginterval"); g_footsteps = cvar("g_footsteps");