]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/g_damage.qc
Merge remote-tracking branch 'origin/master' into terencehill/menu_remove_tab_title
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / g_damage.qc
index 180997423656992ecb138de9748f28207858b8f9..1e7e72a1254b071efed0698119456530ed5c9de0 100644 (file)
@@ -1,38 +1,28 @@
-#if defined(CSQC)
-#elif defined(MENUQC)
-#elif defined(SVQC)
-       #include "../dpdefs/progsdefs.qh"
-    #include "../dpdefs/dpextensions.qh"
-    #include "../warpzonelib/common.qh"
-    #include "../common/constants.qh"
-    #include "../common/teams.qh"
-    #include "../common/util.qh"
-    #include "../common/weapons/weapons.qh"
-    #include "weapons/accuracy.qh"
-    #include "weapons/csqcprojectile.qh"
-    #include "weapons/selection.qh"
-    #include "t_items.qh"
-    #include "autocvars.qh"
-    #include "constants.qh"
-    #include "defs.qh"
-    #include "../common/notifications.qh"
-    #include "../common/deathtypes.qh"
-    #include "mutators/mutators_include.qh"
-    #include "tturrets/include/turrets_early.qh"
-    #include "vehicles/vehicles_def.qh"
-    #include "../csqcmodellib/sv_model.qh"
-    #include "../common/playerstats.qh"
-    #include "g_hook.qh"
-    #include "scores.qh"
-    #include "spawnpoints.qh"
-#endif
-
-.float dmg;
-.float dmg_edge;
-.float dmg_force;
-.float dmg_radius;
-
-float Damage_DamageInfo_SendEntity(entity to, float sf)
+#include "g_damage.qh"
+#include "_all.qh"
+
+#include "g_hook.qh"
+#include "mutators/mutators_include.qh"
+#include "scores.qh"
+#include "waypointsprites.qh"
+#include "spawnpoints.qh"
+#include "tturrets/include/turrets_early.qh"
+#include "t_items.qh"
+#include "vehicles/vehicle.qh"
+#include "weapons/accuracy.qh"
+#include "weapons/csqcprojectile.qh"
+#include "weapons/selection.qh"
+#include "../common/constants.qh"
+#include "../common/deathtypes.qh"
+#include "../common/notifications.qh"
+#include "../common/playerstats.qh"
+#include "../common/teams.qh"
+#include "../common/util.qh"
+#include "../common/weapons/weapons.qh"
+#include "../csqcmodellib/sv_model.qh"
+#include "../warpzonelib/common.qh"
+
+float Damage_DamageInfo_SendEntity(entity to, int sf)
 {
        WriteByte(MSG_ENTITY, ENT_CLIENT_DAMAGEINFO);
        WriteShort(MSG_ENTITY, self.projectiledeathtype);
@@ -47,7 +37,7 @@ float Damage_DamageInfo_SendEntity(entity to, float sf)
        return true;
 }
 
-void Damage_DamageInfo(vector org, float coredamage, float edgedamage, float rad, vector force, float deathtype, float bloodtype, entity dmgowner)
+void Damage_DamageInfo(vector org, float coredamage, float edgedamage, float rad, vector force, int deathtype, float bloodtype, entity dmgowner)
 {
        // TODO maybe call this from non-edgedamage too?
        // TODO maybe make the client do the particle effects for the weapons and the impact sounds using this info?
@@ -71,20 +61,6 @@ void Damage_DamageInfo(vector org, float coredamage, float edgedamage, float rad
        Net_LinkEntity(e, false, 0.2, Damage_DamageInfo_SendEntity);
 }
 
-float checkrules_firstblood;
-
-float yoda;
-float damage_goodhits;
-float damage_gooddamage;
-
-.float dmg_team;
-.float teamkill_complain;
-.float teamkill_soundtime;
-.entity teamkill_soundsource;
-.entity pusher;
-.float istypefrag;
-.float taunt_soundtime;
-
 float IsFlying(entity a)
 {
        if(a.flags & FL_ONGROUND)
@@ -102,10 +78,7 @@ void UpdateFrags(entity player, float f)
        PlayerTeamScore_AddScore(player, f);
 }
 
-// NOTE: f=0 means still count as a (positive) kill, but count no frags for it
-void W_SwitchWeapon_Force(entity e, float w);
-entity GiveFrags_randomweapons;
-void GiveFrags (entity attacker, entity targ, float f, float deathtype)
+void GiveFrags (entity attacker, entity targ, float f, int deathtype)
 {
        // TODO route through PlayerScores instead
        if(gameover) return;
@@ -225,7 +198,7 @@ string AppendItemcodes(string s, entity player)
        return s;
 }
 
-void LogDeath(string mode, float deathtype, entity killer, entity killed)
+void LogDeath(string mode, int deathtype, entity killer, entity killed)
 {
        string s;
        if(!autocvar_sv_eventlog)
@@ -247,7 +220,7 @@ void LogDeath(string mode, float deathtype, entity killer, entity killed)
 void Obituary_SpecialDeath(
        entity notif_target,
        float murder,
-       float deathtype,
+       int deathtype,
        string s1, string s2, string s3,
        float f1, float f2, float f3)
 {
@@ -304,11 +277,10 @@ void Obituary_SpecialDeath(
        else { backtrace("Obituary_SpecialDeath called without a special deathtype?\n"); return; }
 }
 
-float w_deathtype;
 float Obituary_WeaponDeath(
        entity notif_target,
        float murder,
-       float deathtype,
+       int deathtype,
        string s1, string s2, string s3,
        float f1, float f2)
 {
@@ -316,10 +288,10 @@ float Obituary_WeaponDeath(
        if(death_weapon)
        {
                w_deathtype = deathtype;
-               float death_message = WEP_ACTION(death_weapon, ((murder) ? WR_KILLMESSAGE : WR_SUICIDEMESSAGE));
+               int death_message = WEP_ACTION(death_weapon, ((murder) ? WR_KILLMESSAGE : WR_SUICIDEMESSAGE));
                w_deathtype = false;
 
-               if(death_message)
+               if (death_message)
                {
                        Send_Notification_WOCOVA(
                                NOTIF_ONE,
@@ -352,7 +324,7 @@ float Obituary_WeaponDeath(
        return false;
 }
 
-void Obituary(entity attacker, entity inflictor, entity targ, float deathtype)
+void Obituary(entity attacker, entity inflictor, entity targ, int deathtype)
 {
        // Sanity check
        if (!IS_PLAYER(targ)) { backtrace("Obituary called on non-player?!\n"); return; }
@@ -632,7 +604,7 @@ void Freeze (entity targ, float freeze_time, float frozen_type, float show_waypo
                RemoveGrapplingHook(head);
 
        // add waypoint
-       if(show_waypoint)       
+       if(show_waypoint)
                WaypointSprite_Spawn("frozen", 0, 0, targ, '0 0 64', world, targ.team, targ, waypointsprite_attached, true, RADARICON_WAYPOINT, '0.25 0.90 1');
 }
 
@@ -645,9 +617,9 @@ void Unfreeze (entity targ)
        targ.frozen = 0;
        targ.revive_progress = 0;
        targ.revival_time = time;
-       
+
        WaypointSprite_Kill(targ.waypointsprite_attached);
-       
+
        FOR_EACH_PLAYER(head)
        if(head.hook.aiment == targ)
                RemoveGrapplingHook(head);
@@ -658,12 +630,7 @@ void Unfreeze (entity targ)
        targ.iceblock = world;
 }
 
-// these are updated by each Damage call for use in button triggering and such
-entity damage_targ;
-entity damage_inflictor;
-entity damage_attacker;
-
-void Damage (entity targ, entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
+void Damage (entity targ, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
 {
        float mirrordamage;
        float mirrorforce;
@@ -816,22 +783,22 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
                        damage = 0;
                        force *= autocvar_g_freezetag_frozen_force;
                }
-               
+
                if(targ.frozen && deathtype == DEATH_HURTTRIGGER && !autocvar_g_freezetag_frozen_damage_trigger)
                {
                        pointparticles(particleeffectnum("teleport"), targ.origin, '0 0 0', 1);
-               
+
                        entity oldself = self;
                        self = targ;
                        entity spot = SelectSpawnPoint (false);
-                       
+
                        if(spot)
                        {
                                damage = 0;
                                self.deadflag = DEAD_NO;
 
                                self.angles = spot.angles;
-                               
+
                                self.effects = 0;
                                self.effects |= EF_TELEPORT_BIT;
 
@@ -842,16 +809,16 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
                                self.punchangle = '0 0 0';
                                self.punchvector = '0 0 0';
                                self.oldvelocity = self.velocity;
-                               
+
                                self.spawnorigin = spot.origin;
                                setorigin (self, spot.origin + '0 0 1' * (1 - self.mins.z - 24));
                                // don't reset back to last position, even if new position is stuck in solid
                                self.oldorigin = self.origin;
                                self.prevorigin = self.origin;
-                               
+
                                pointparticles(particleeffectnum("teleport"), self.origin, '0 0 0', 1);
                        }
-                       
+
                        self = oldself;
                }
 
@@ -977,8 +944,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
        }
 }
 
-float RadiusDamage_running;
-float RadiusDamageForSource (entity inflictor, vector inflictororigin, vector inflictorvelocity, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float inflictorselfdamage, float forceintensity, float deathtype, entity directhitentity)
+float RadiusDamageForSource (entity inflictor, vector inflictororigin, vector inflictorvelocity, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float inflictorselfdamage, float forceintensity, int deathtype, entity directhitentity)
        // Returns total damage applies to creatures
 {
        entity  targ;
@@ -1116,9 +1082,9 @@ float RadiusDamageForSource (entity inflictor, vector inflictororigin, vector in
                                                                else
                                                                        hitloc = nearest;
                                                        }
-                                                       nearest_x = targ.origin.x + targ.mins.x + random() * targ.size.x;
-                                                       nearest_y = targ.origin.y + targ.mins.y + random() * targ.size.y;
-                                                       nearest_z = targ.origin.z + targ.mins.z + random() * targ.size.z;
+                                                       nearest.x = targ.origin.x + targ.mins.x + random() * targ.size.x;
+                                                       nearest.y = targ.origin.y + targ.mins.y + random() * targ.size.y;
+                                                       nearest.z = targ.origin.z + targ.mins.z + random() * targ.size.z;
                                                }
 
                                                nearest = hitloc * (1 / max(1, hits));
@@ -1167,20 +1133,11 @@ float RadiusDamageForSource (entity inflictor, vector inflictororigin, vector in
        return total_damage_to_creatures;
 }
 
-float RadiusDamage (entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float forceintensity, float deathtype, entity directhitentity)
+float RadiusDamage (entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float forceintensity, int deathtype, entity directhitentity)
 {
        return RadiusDamageForSource (inflictor, (inflictor.origin + (inflictor.mins + inflictor.maxs) * 0.5), inflictor.velocity, attacker, coredamage, edgedamage, rad, cantbe, mustbe, false, forceintensity, deathtype, directhitentity);
 }
 
-.float fire_damagepersec;
-.float fire_endtime;
-.float fire_deathtype;
-.entity fire_owner;
-.float fire_hitsound;
-.entity fire_burner;
-
-void fireburner_think();
-
 float Fire_IsBurning(entity e)
 {
        return (time < e.fire_endtime);