From: Mario Date: Fri, 19 Apr 2013 05:16:04 +0000 (+1000) Subject: Attempt to remove more g_minstagib checks from the code X-Git-Tag: xonotic-v0.7.0~55^2~3^2~9 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=69e51ab7d82fb98e5437cc367ef7ca45e5c27602;p=xonotic%2Fxonotic-data.pk3dir.git Attempt to remove more g_minstagib checks from the code --- diff --git a/qcsrc/server/autocvars.qh b/qcsrc/server/autocvars.qh index 1febc23d2..ed1c560ee 100644 --- a/qcsrc/server/autocvars.qh +++ b/qcsrc/server/autocvars.qh @@ -891,6 +891,7 @@ float autocvar_g_midair_shieldtime; float autocvar_g_minstagib_ammo_drop; float autocvar_g_minstagib_extralives; float autocvar_g_minstagib_speed_highspeed; +float autocvar_g_minstagib_invis_alpha; #define autocvar_g_mirrordamage cvar("g_mirrordamage") #define autocvar_g_mirrordamage_virtual cvar("g_mirrordamage_virtual") diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index 668433ce0..b56648de3 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -16,7 +16,7 @@ noref float require_spawnfunc_prefix; // if this float exists, only functions wi // Globals -float g_cloaked, g_footsteps, g_jump_grunt, g_grappling_hook, g_midair, g_minstagib, g_pinata, g_norecoil, g_minstagib_invis_alpha, g_bloodloss; +float g_cloaked, g_footsteps, g_jump_grunt, g_grappling_hook, g_midair, g_minstagib, g_pinata, g_norecoil, g_bloodloss; float g_warmup_limit; float g_warmup_allguns; float g_warmup_allow_timeout; diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index 4a5282e45..bea0bf7e0 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -824,7 +824,6 @@ void readplayerstartcvars() if (g_weaponarena) { - g_minstagib = 0; // incompatible g_pinata = 0; // incompatible g_weapon_stay = 0; // incompatible WEPSET_COPY_AA(start_weapons, g_weaponarena_weapons); @@ -986,8 +985,6 @@ float sv_taunt; string GetGametype(); // g_world.qc void readlevelcvars(void) { - g_minstagib = cvar("g_minstagib"); - // load ALL the mutators if(cvar("g_dodging")) MUTATOR_ADD(mutator_dodging); @@ -996,23 +993,20 @@ void readlevelcvars(void) if(cvar("g_physical_items")) MUTATOR_ADD(mutator_physical_items); if(cvar("g_minstagib")) - MUTATOR_ADD(mutator_minstagib); - - 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); - if(cvar("g_superspectate")) - MUTATOR_ADD(mutator_superspec); - } + MUTATOR_ADD(mutator_minstagib); + if(cvar("g_invincible_projectiles")) + MUTATOR_ADD(mutator_invincibleprojectiles); + if(cvar("g_new_toys")) + MUTATOR_ADD(mutator_new_toys); + if(!cvar("g_minstagib")) // TODO: nix support? + 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); + if(cvar("g_superspectate")) + MUTATOR_ADD(mutator_superspec); // is this a mutator? is this a mode? if(cvar("g_sandbox")) @@ -1036,6 +1030,8 @@ void readlevelcvars(void) g_bugrigs_speed_ref = cvar("g_bugrigs_speed_ref"); g_bugrigs_speed_pow = cvar("g_bugrigs_speed_pow"); g_bugrigs_steer = cvar("g_bugrigs_steer"); + + g_minstagib = cvar("g_minstagib"); g_touchexplode = cvar("g_touchexplode"); g_touchexplode_radius = cvar("g_touchexplode_radius"); @@ -1065,7 +1061,7 @@ void readlevelcvars(void) g_warmup_allguns = cvar("g_warmup_allguns"); g_warmup_allow_timeout = cvar("g_warmup_allow_timeout"); - if ((g_race && g_race_qualifying == 2) || g_arena || g_assault || cvar("g_campaign")) + if ((g_race && g_race_qualifying == 2) || g_arena || g_minstagib || g_assault || cvar("g_campaign")) inWarmupStage = 0; // these modes cannot work together, sorry g_pickup_respawntime_weapon = cvar("g_pickup_respawntime_weapon"); diff --git a/qcsrc/server/mutators/mutator_minstagib.qc b/qcsrc/server/mutators/mutator_minstagib.qc index f8c833144..e1e4ebf5c 100644 --- a/qcsrc/server/mutators/mutator_minstagib.qc +++ b/qcsrc/server/mutators/mutator_minstagib.qc @@ -146,8 +146,8 @@ MUTATOR_HOOKFUNCTION(minstagib_PlayerPowerups) { if (time < self.strength_finished) { - self.alpha = g_minstagib_invis_alpha; - self.exteriorweaponentity.alpha = g_minstagib_invis_alpha; + self.alpha = autocvar_g_minstagib_invis_alpha; + self.exteriorweaponentity.alpha = autocvar_g_minstagib_invis_alpha; self.items |= IT_STRENGTH; Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_INVISIBILITY, self.netname); Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERUP_INVISIBILITY); @@ -259,17 +259,10 @@ MUTATOR_HOOKFUNCTION(minstagib_SetStartItems) { start_ammo_cells = cvar("g_minstagib_ammo_start"); - g_pinata = 0; // incompatible - g_weapon_stay = 0; // incompatible - g_bloodloss = 0; // incompatible start_health = 100; start_armorvalue = 0; WEPSET_COPY_AW(start_weapons, WEP_MINSTANEX); - g_minstagib_invis_alpha = cvar("g_minstagib_invis_alpha"); start_items |= IT_UNLIMITED_SUPERWEAPONS; - - if (g_minstagib_invis_alpha <= 0) - g_minstagib_invis_alpha = -1; return FALSE; } diff --git a/qcsrc/server/mutators/mutator_vampire.qc b/qcsrc/server/mutators/mutator_vampire.qc index 40a925b3c..baeadac1c 100644 --- a/qcsrc/server/mutators/mutator_vampire.qc +++ b/qcsrc/server/mutators/mutator_vampire.qc @@ -2,6 +2,8 @@ MUTATOR_HOOKFUNCTION(vampire_PlayerDamage) { if(time < self.spawnshieldtime) return 0; + if(frag_attacker == frag_target) + return 0; if(g_minstagib) { // minstagib: each hit means +1 ammo