From 42a0c75587c88d249f5795154dd9f7781e66063d Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Mon, 20 Dec 2010 14:29:25 +0100 Subject: [PATCH] virtual mirror damage --- defaultXonotic.cfg | 3 ++- .../xonotic/dialog_multiplayer_create_advanced.c | 5 ++++- qcsrc/server/autocvars.qh | 2 ++ qcsrc/server/g_damage.qc | 16 ++++++++++++++-- 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index 18ce4a988..27bf9ae2d 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -638,7 +638,8 @@ seta timelimit_suddendeath 5 "number of minutes suddendeath mode lasts after all set g_tdm 0 "Team Deathmatch: the team who kills their opponents most often wins" seta teamplay_mode 4 "default teamplay setting in team games. 1 = no friendly fire, self damage. 2 = friendly fire and self damage enabled. 3 = no friendly fire, but self damage enabled. 4 = obey the following four cvars" -seta g_mirrordamage 0.300000 "for teamplay 4: mirror damage factor" +seta g_mirrordamage 0.500000 "for teamplay 4: mirror damage factor" +seta g_mirrordamage_virtual 1 "for teamplay 4: do not actually apply mirror damage, just show graphics effect for it" seta g_friendlyfire 0.100000 "for teamplay 4: fiendly fire factor" seta g_teamdamage_threshold 50 "for teamplay 4: threshold over which to apply mirror damage" seta g_teamdamage_resetspeed 30 "for teamplay 4: how fast player's teamdamage count decreases" diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_create_advanced.c b/qcsrc/menu/xonotic/dialog_multiplayer_create_advanced.c index 417cfa610..e61b5e3cd 100644 --- a/qcsrc/menu/xonotic/dialog_multiplayer_create_advanced.c +++ b/qcsrc/menu/xonotic/dialog_multiplayer_create_advanced.c @@ -6,7 +6,7 @@ CLASS(XonoticAdvancedDialog) EXTENDS(XonoticDialog) ATTRIB(XonoticAdvancedDialog, title, string, "Advanced server settings") ATTRIB(XonoticAdvancedDialog, color, vector, SKINCOLOR_DIALOG_ADVANCED) ATTRIB(XonoticAdvancedDialog, intendedWidth, float, 0.5) - ATTRIB(XonoticAdvancedDialog, rows, float, 12) + ATTRIB(XonoticAdvancedDialog, rows, float, 13) ATTRIB(XonoticAdvancedDialog, columns, float, 3) ATTRIB(XonoticAdvancedDialog, refilterEntity, entity, NULL) ENDCLASS(XonoticAdvancedDialog) @@ -46,6 +46,9 @@ void XonoticAdvancedDialog_fill(entity me) me.TDempty(me, 0.2); me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, "Friendly fire penalty:")); me.TD(me, 1, 1.7, e = 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.TR(me); me.TDempty(me, 0.2); me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, "Teams:")); diff --git a/qcsrc/server/autocvars.qh b/qcsrc/server/autocvars.qh index c5beab269..12731fd73 100644 --- a/qcsrc/server/autocvars.qh +++ b/qcsrc/server/autocvars.qh @@ -789,7 +789,9 @@ 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_mirrordamage; #define autocvar_g_mirrordamage cvar("g_mirrordamage") +#define autocvar_g_mirrordamage_virtual cvar("g_mirrordamage_virtual") float autocvar_g_monster_zombie_attack_run_damage; float autocvar_g_monster_zombie_attack_run_delay; float autocvar_g_monster_zombie_attack_run_force; diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index 6ab29006d..9d7a49740 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -852,8 +852,20 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float } mirrordamage = 0; } - force = normalize(attacker.origin + attacker.view_ofs - hitloc) * mirrorforce; - Damage(attacker, inflictor, attacker, mirrordamage, DEATH_MIRRORDAMAGE, attacker.origin, force); + + if(autocvar_g_mirrordamage_virtual) + { + vector v; + 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; + } + else + { + force = normalize(attacker.origin + attacker.view_ofs - hitloc) * mirrorforce; + Damage(attacker, inflictor, attacker, mirrordamage, DEATH_MIRRORDAMAGE, attacker.origin, force); + } } } -- 2.39.2