From b02d9c0f2dd9af2f545365fd237c02aec7cc9d00 Mon Sep 17 00:00:00 2001 From: esteel Date: Thu, 20 Oct 2005 17:37:39 +0000 Subject: [PATCH] added g_midair: only take damage while in the air git-svn-id: svn://svn.icculus.org/nexuiz/trunk@536 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- qcsrc/default.cfg | 1 + qcsrc/gamec/g_damage.c | 8 ++++++++ scmenu/creategame/gamemodes/gamemisc.menu | 5 +++++ scmenu/data/gamemodes/gamemisc.menu | 7 +++++++ 4 files changed, 21 insertions(+) diff --git a/qcsrc/default.cfg b/qcsrc/default.cfg index 070e01068..6e2347246 100755 --- a/qcsrc/default.cfg +++ b/qcsrc/default.cfg @@ -83,6 +83,7 @@ bot_number 0 // number of bots in server set g_instagib 0 set g_rocketarena 0 set g_vampire 0 +set g_midair 0 set g_fullbrightplayers 0 set g_fullbrightitems 0 set g_casings 0 diff --git a/qcsrc/gamec/g_damage.c b/qcsrc/gamec/g_damage.c index f6b00097e..51511445c 100644 --- a/qcsrc/gamec/g_damage.c +++ b/qcsrc/gamec/g_damage.c @@ -145,6 +145,14 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float if (attacker.team == targ.team) if (teamplay == 1 || (teamplay == 3 && attacker != targ)) damage = 0; + + // midair gamemode: damage only while in the air + if (cvar("g_midair") + && self.classname == "player" // e.g. grenades take damage + && self.flags & FL_ONGROUND) { + damage = 0; + } + // apply strength multiplier if (attacker.items & IT_STRENGTH) { diff --git a/scmenu/creategame/gamemodes/gamemisc.menu b/scmenu/creategame/gamemodes/gamemisc.menu index 7c3d3d893..296ea93b7 100644 --- a/scmenu/creategame/gamemodes/gamemisc.menu +++ b/scmenu/creategame/gamemodes/gamemisc.menu @@ -43,6 +43,11 @@ Item Layout Misc text "Vampire Mode" target "::Data::Game::Misc::Vampire::Switch" } + Derive Nex_Option_Switch MidAir + { + text "MidAir" + target "::Data::Game::Misc::MidAir::Switch" + } Derive Nex_Option_Switch Casings { text "Bullet Casings" diff --git a/scmenu/data/gamemodes/gamemisc.menu b/scmenu/data/gamemodes/gamemisc.menu index 6766d5e70..b22cc0f1a 100644 --- a/scmenu/data/gamemodes/gamemisc.menu +++ b/scmenu/data/gamemodes/gamemisc.menu @@ -53,6 +53,13 @@ Item DataContainer Misc [DataLink_OnOffSwitch] } + Item Data_Cvar MidAir + { + cvarName "g_midair" + defValue 0 + + [DataLink_OnOffSwitch] + } Item Data_Cvar Casings { cvarName "g_casings" -- 2.39.2