move freezetag specific damage/force code into a PlayerDamage hook, fix the mapinfo...
authorFruitieX <fruitiex@gmail.com>
Tue, 30 Nov 2010 14:33:53 +0000 (16:33 +0200)
committerFruitieX <fruitiex@gmail.com>
Tue, 30 Nov 2010 14:33:53 +0000 (16:33 +0200)
qcsrc/menu/xonotic/dialog_multiplayer_create_mapinfo.c
qcsrc/server/g_damage.qc
qcsrc/server/mutators/gamemode_freezetag.qc

index 4673578..10bd56b 100644 (file)
@@ -28,6 +28,7 @@ CLASS(XonoticMapInfoDialog) EXTENDS(XonoticDialog)
        ATTRIB(XonoticMapInfoDialog, typeRaceLabel, entity, NULL)
        ATTRIB(XonoticMapInfoDialog, typeCTSLabel, entity, NULL)
        ATTRIB(XonoticMapInfoDialog, typeNexballLabel, entity, NULL)
+       ATTRIB(XonoticMapInfoDialog, typeFreezetagLabel, entity, NULL)
 
        ATTRIB(XonoticMapInfoDialog, currentMapIndex, float, 0)
        ATTRIB(XonoticMapInfoDialog, currentMapBSPName, string, string_null)
@@ -83,6 +84,7 @@ void XonoticMapInfoDialog_loadMapInfo(entity me, float i, entity mlb)
        me.typeRaceLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_RACE);
        me.typeCTSLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_CTS);
        me.typeNexballLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_NEXBALL);
+       me.typeFreezetagLabel.disabled = !(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_FREEZETAG);
 
        MapInfo_ClearTemps();
 }
index 7af3a86..cde87fe 100644 (file)
@@ -528,15 +528,6 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
                if (attacker.isbot)
                        damage = damage * bound(0.1, (skill + 5) * 0.1, 1);
 
-               if(g_freezetag)
-               {
-                       if(targ.freezetag_frozen == 1)
-                       {
-                               damage = 0;
-                               force = force * cvar("g_freezetag_frozen_force");
-                       }
-               }
-
                // nullify damage if teamplay is on
                if(deathtype != DEATH_TELEFRAG)
                if(attacker.classname == "player")
index 6682158..7ecde36 100644 (file)
@@ -257,6 +257,20 @@ MUTATOR_HOOKFUNCTION(freezetag_PlayerPhysics)
        return 1;
 }
 
+MUTATOR_HOOKFUNCTION(freezetag_PlayerDamage)
+{
+    if(g_freezetag)
+    {
+        if(frag_target.freezetag_frozen == 1)
+        {
+            damage_take = 0;
+            damage_save = 0;
+            damage_force = damage_force * cvar("g_freezetag_frozen_force");
+        }
+    }
+    return 1;
+}
+
 MUTATOR_DEFINITION(gamemode_freezetag)
 {
        MUTATOR_HOOK(MakePlayerObserver, freezetag_RemovePlayer, CBC_ORDER_ANY);
@@ -266,6 +280,7 @@ MUTATOR_DEFINITION(gamemode_freezetag)
        MUTATOR_HOOK(GiveFragsForKill, freezetag_GiveFragsForKill, CBC_ORDER_FIRST);
        MUTATOR_HOOK(PlayerPreThink, freezetag_PlayerPreThink, CBC_ORDER_FIRST);
        MUTATOR_HOOK(PlayerPhysics, freezetag_PlayerPhysics, CBC_ORDER_FIRST);
+       MUTATOR_HOOK(PlayerDamage, freezetag_PlayerDamage, CBC_ORDER_ANY);
 
        MUTATOR_ONADD
        {