]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/miscfunctions.qc
Merge remote-tracking branch 'remotes/origin/master' into TimePath/itemsys
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / miscfunctions.qc
index 1577acc13e92fc4f0c6201b6c41af45242c66b73..e8a1529e4e872209c96abef938ebde04875449fc 100644 (file)
@@ -1,35 +1,30 @@
-#if defined(CSQC)
-#elif defined(MENUQC)
-#elif defined(SVQC)
-       #include "miscfunctions.qh"
-       #include "../dpdefs/progsdefs.qc"
-    #include "../dpdefs/dpextensions.qc"
-    #include "sys-post.qh"
-    #include "../common/playerstats.qh"
-    #include "../warpzonelib/anglestransform.qh"
-    #include "../warpzonelib/server.qh"
-    #include "../common/constants.qh"
-    #include "../common/teams.qh"
-    #include "../common/util.qh"
-    #include "../common/urllib.qh"
-    #include "../common/command/generic.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 "../common/mapinfo.qh"
-    #include "command/common.qh"
-    #include "../csqcmodellib/sv_model.qh"
-    #include "ipban.qh"
-#endif
+#include "miscfunctions.qh"
+#include "_all.qh"
+
+#include "antilag.qh"
+#include "command/common.qh"
+#include "constants.qh"
+#include "g_hook.qh"
+#include "ipban.qh"
+#include "mutators/mutators_include.qh"
+#include "tturrets/include/turrets_early.qh"
+#include "t_items.qh"
+#include "weapons/accuracy.qh"
+#include "weapons/csqcprojectile.qh"
+#include "weapons/selection.qh"
+#include "../common/command/generic.qh"
+#include "../common/constants.qh"
+#include "../common/deathtypes.qh"
+#include "../common/mapinfo.qh"
+#include "../common/notifications.qh"
+#include "../common/playerstats.qh"
+#include "../common/teams.qh"
+#include "../common/urllib.qh"
+#include "../common/util.qh"
+#include "../common/weapons/all.qh"
+#include "../csqcmodellib/sv_model.qh"
+#include "../warpzonelib/anglestransform.qh"
+#include "../warpzonelib/server.qh"
 
 void crosshair_trace(entity pl)
 {
@@ -102,7 +97,7 @@ float DistributeEvenly_GetRandomized(float weight)
 void GameLogEcho(string s)
 {
     string fn;
-    float matches;
+    int matches;
 
     if (autocvar_sv_eventlog_files)
     {
@@ -110,7 +105,7 @@ void GameLogEcho(string s)
         {
             logfile_open = true;
             matches = autocvar_sv_eventlog_files_counter + 1;
-            cvar_set("sv_eventlog_files_counter", ftos(matches));
+            cvar_set("sv_eventlog_files_counter", itos(matches));
             fn = ftos(matches);
             if (strlen(fn) < 8)
                 fn = strcat(substring("00000000", 0, 8 - strlen(fn)), fn);
@@ -358,17 +353,17 @@ void GetCvars_handleString(string thisname, float f, .string field, string name)
 {
        if (f < 0)
        {
-               if (self.field)
-                       strunzone(self.field);
-               self.field = string_null;
+               if (self.(field))
+                       strunzone(self.(field));
+               self.(field) = string_null;
        }
        else if (f > 0)
        {
                if (thisname == name)
                {
-                       if (self.field)
-                               strunzone(self.field);
-                       self.field = strzone(argv(f + 1));
+                       if (self.(field))
+                               strunzone(self.(field));
+                       self.(field) = strzone(argv(f + 1));
                }
        }
        else
@@ -380,12 +375,11 @@ void GetCvars_handleString_Fixup(string thisname, float f, .string field, string
        if (f >= 0) // also initialize to the fitting value for "" when sending cvars out
                if (thisname == name)
                {
-                       string s;
-                       s = func(strcat1(self.field));
-                       if (s != self.field)
+                       string s = func(strcat1(self.(field)));
+                       if (s != self.(field))
                        {
-                               strunzone(self.field);
-                               self.field = strzone(s);
+                               strunzone(self.(field));
+                               self.(field) = strzone(s);
                        }
                }
 }
@@ -397,7 +391,7 @@ void GetCvars_handleFloat(string thisname, float f, .float field, string name)
        else if (f > 0)
        {
                if (thisname == name)
-                       self.field = stof(argv(f + 1));
+                       self.(field) = stof(argv(f + 1));
        }
        else
                stuffcmd(self, strcat("cl_cmd sendcvar ", name, "\n"));
@@ -411,17 +405,17 @@ void GetCvars_handleFloatOnce(string thisname, float f, .float field, string nam
        {
                if (thisname == name)
                {
-                       if(!self.field)
+                       if (!self.(field))
                        {
-                               self.field = stof(argv(f + 1));
-                               if(!self.field)
-                                       self.field = -1;
+                               self.(field) = stof(argv(f + 1));
+                               if (!self.(field))
+                                       self.(field) = -1;
                        }
                }
        }
        else
        {
-               if(!self.field)
+               if (!self.(field))
                        stuffcmd(self, strcat("cl_cmd sendcvar ", name, "\n"));
        }
 }
@@ -512,18 +506,277 @@ vector randompos(vector m1, vector m2)
 {
     vector v;
     m2 = m2 - m1;
-    v_x = m2_x * random() + m1_x;
-    v_y = m2_y * random() + m1_y;
-    v_z = m2_z * random() + m1_z;
+    v.x = m2_x * random() + m1_x;
+    v.y = m2_y * random() + m1_y;
+    v.z = m2_z * random() + m1_z;
     return  v;
 }
 
+float want_weapon(entity weaponinfo, float allguns) // WEAPONTODO: what still needs done?
+{
+       int i = weaponinfo.weapon;
+       int d = 0;
+
+       if (!i)
+               return 0;
+
+       if (g_lms || g_ca || allguns)
+       {
+               if(weaponinfo.spawnflags & WEP_FLAG_NORMAL)
+                       d = true;
+               else
+                       d = false;
+       }
+       else if (g_cts)
+               d = (i == WEP_SHOTGUN);
+       else if (g_nexball)
+               d = 0; // weapon is set a few lines later
+       else
+               d = !(!weaponinfo.weaponstart);
+
+       if(g_grappling_hook) // if possible, redirect off-hand hook to on-hand hook
+               d |= (i == WEP_HOOK);
+       if(!g_cts && (weaponinfo.spawnflags & WEP_FLAG_MUTATORBLOCKED)) // never default mutator blocked guns
+               d = 0;
+
+       float t = weaponinfo.weaponstartoverride;
+
+       //print(strcat("want_weapon: ", weaponinfo.netname, " - d: ", ftos(d), ", t: ", ftos(t), ". \n"));
+
+       // bit order in t:
+       // 1: want or not
+       // 2: is default?
+       // 4: is set by default?
+       if(t < 0)
+               t = 4 | (3 * d);
+       else
+               t |= (2 * d);
+
+       return t;
+}
+
+void readplayerstartcvars()
+{
+       entity e;
+       float i, j, t;
+       string s;
+
+       // initialize starting values for players
+       start_weapons = '0 0 0';
+       start_weapons_default = '0 0 0';
+       start_weapons_defaultmask = '0 0 0';
+       start_items = 0;
+       start_ammo_shells = 0;
+       start_ammo_nails = 0;
+       start_ammo_rockets = 0;
+       start_ammo_cells = 0;
+       start_ammo_plasma = 0;
+       start_health = cvar("g_balance_health_start");
+       start_armorvalue = cvar("g_balance_armor_start");
+
+       g_weaponarena = 0;
+       g_weaponarena_weapons = '0 0 0';
+
+       s = cvar_string("g_weaponarena");
+       if (s == "0" || s == "")
+       {
+               if(g_ca)
+                       s = "most";
+       }
+
+       if (s == "0" || s == "")
+       {
+               // no arena
+       }
+       else if (s == "off")
+       {
+               // forcibly turn off weaponarena
+       }
+       else if (s == "all" || s == "1")
+       {
+               g_weaponarena = 1;
+               g_weaponarena_list = "All Weapons";
+               for (j = WEP_FIRST; j <= WEP_LAST; ++j)
+               {
+                       e = get_weaponinfo(j);
+                       if (!(e.spawnflags & WEP_FLAG_MUTATORBLOCKED))
+                               g_weaponarena_weapons |= WepSet_FromWeapon(j);
+               }
+       }
+       else if (s == "most")
+       {
+               g_weaponarena = 1;
+               g_weaponarena_list = "Most Weapons";
+               for (j = WEP_FIRST; j <= WEP_LAST; ++j)
+               {
+                       e = get_weaponinfo(j);
+                       if (!(e.spawnflags & WEP_FLAG_MUTATORBLOCKED))
+                               if (e.spawnflags & WEP_FLAG_NORMAL)
+                                       g_weaponarena_weapons |= WepSet_FromWeapon(j);
+               }
+       }
+       else if (s == "none")
+       {
+               g_weaponarena = 1;
+               g_weaponarena_list = "No Weapons";
+       }
+       else
+       {
+               g_weaponarena = 1;
+               t = tokenize_console(s);
+               g_weaponarena_list = "";
+               for (i = 0; i < t; ++i)
+               {
+                       s = argv(i);
+                       for (j = WEP_FIRST; j <= WEP_LAST; ++j)
+                       {
+                               e = get_weaponinfo(j);
+                               if (e.netname == s)
+                               {
+                                       g_weaponarena_weapons |= WepSet_FromWeapon(j);
+                                       g_weaponarena_list = strcat(g_weaponarena_list, e.message, " & ");
+                                       break;
+                               }
+                       }
+                       if (j > WEP_LAST)
+                       {
+                               print("The weapon mutator list contains an unknown weapon ", s, ". Skipped.\n");
+                       }
+               }
+               g_weaponarena_list = strzone(substring(g_weaponarena_list, 0, strlen(g_weaponarena_list) - 3));
+       }
+
+       if(g_weaponarena)
+               g_weaponarena_random = cvar("g_weaponarena_random");
+       else
+               g_weaponarena_random = 0;
+       g_weaponarena_random_with_blaster = cvar("g_weaponarena_random_with_blaster");
+
+       if (g_weaponarena)
+       {
+               g_weapon_stay = 0; // incompatible
+               start_weapons = g_weaponarena_weapons;
+               start_items |= IT_UNLIMITED_AMMO;
+       }
+       else
+       {
+               for (i = WEP_FIRST; i <= WEP_LAST; ++i)
+               {
+                       e = get_weaponinfo(i);
+                       int w = want_weapon(e, false);
+                       if(w & 1)
+                               start_weapons |= WepSet_FromWeapon(i);
+                       if(w & 2)
+                               start_weapons_default |= WepSet_FromWeapon(i);
+                       if(w & 4)
+                               start_weapons_defaultmask |= WepSet_FromWeapon(i);
+               }
+       }
 
+       if(!cvar("g_use_ammunition"))
+               start_items |= IT_UNLIMITED_AMMO;
 
-float sound_allowed(float dest, entity e)
+       if(start_items & IT_UNLIMITED_WEAPON_AMMO)
+       {
+               start_ammo_shells = 999;
+               start_ammo_nails = 999;
+               start_ammo_rockets = 999;
+               start_ammo_cells = 999;
+               start_ammo_plasma = 999;
+               start_ammo_fuel = 999;
+       }
+       else
+       {
+               start_ammo_shells = cvar("g_start_ammo_shells");
+               start_ammo_nails = cvar("g_start_ammo_nails");
+               start_ammo_rockets = cvar("g_start_ammo_rockets");
+               start_ammo_cells = cvar("g_start_ammo_cells");
+               start_ammo_plasma = cvar("g_start_ammo_plasma");
+               start_ammo_fuel = cvar("g_start_ammo_fuel");
+       }
+
+       if (warmup_stage)
+       {
+               warmup_start_ammo_shells = start_ammo_shells;
+               warmup_start_ammo_nails = start_ammo_nails;
+               warmup_start_ammo_rockets = start_ammo_rockets;
+               warmup_start_ammo_cells = start_ammo_cells;
+               warmup_start_ammo_plasma = start_ammo_plasma;
+               warmup_start_ammo_fuel = start_ammo_fuel;
+               warmup_start_health = start_health;
+               warmup_start_armorvalue = start_armorvalue;
+               warmup_start_weapons = start_weapons;
+               warmup_start_weapons_default = start_weapons_default;
+               warmup_start_weapons_defaultmask = start_weapons_defaultmask;
+
+               if (!g_weaponarena && !g_ca)
+               {
+                       warmup_start_ammo_shells = cvar("g_warmup_start_ammo_shells");
+                       warmup_start_ammo_nails = cvar("g_warmup_start_ammo_nails");
+                       warmup_start_ammo_rockets = cvar("g_warmup_start_ammo_rockets");
+                       warmup_start_ammo_cells = cvar("g_warmup_start_ammo_cells");
+                       warmup_start_ammo_plasma = cvar("g_warmup_start_ammo_plasma");
+                       warmup_start_ammo_fuel = cvar("g_warmup_start_ammo_fuel");
+                       warmup_start_health = cvar("g_warmup_start_health");
+                       warmup_start_armorvalue = cvar("g_warmup_start_armor");
+                       warmup_start_weapons = '0 0 0';
+                       warmup_start_weapons_default = '0 0 0';
+                       warmup_start_weapons_defaultmask = '0 0 0';
+                       for (i = WEP_FIRST; i <= WEP_LAST; ++i)
+                       {
+                               e = get_weaponinfo(i);
+                               int w = want_weapon(e, g_warmup_allguns);
+                               if(w & 1)
+                                       warmup_start_weapons |= WepSet_FromWeapon(i);
+                               if(w & 2)
+                                       warmup_start_weapons_default |= WepSet_FromWeapon(i);
+                               if(w & 4)
+                                       warmup_start_weapons_defaultmask |= WepSet_FromWeapon(i);
+                       }
+               }
+       }
+
+       if (g_jetpack)
+               start_items |= IT_JETPACK;
+
+       MUTATOR_CALLHOOK(SetStartItems);
+
+       if ((start_items & IT_JETPACK) || (g_grappling_hook && (start_weapons & WEPSET_HOOK)))
+       {
+               start_items |= IT_FUEL_REGEN;
+               start_ammo_fuel = max(start_ammo_fuel, cvar("g_balance_fuel_rotstable"));
+               warmup_start_ammo_fuel = max(warmup_start_ammo_fuel, cvar("g_balance_fuel_rotstable"));
+       }
+
+       WepSet precache_weapons = start_weapons;
+       if (g_warmup_allguns != 1)
+               precache_weapons |= warmup_start_weapons;
+       for (i = WEP_FIRST; i <= WEP_LAST; ++i)
+       {
+               e = get_weaponinfo(i);
+               if(precache_weapons & WepSet_FromWeapon(i))
+                       WEP_ACTION(i, WR_INIT);
+       }
+
+       start_ammo_shells = max(0, start_ammo_shells);
+       start_ammo_nails = max(0, start_ammo_nails);
+       start_ammo_rockets = max(0, start_ammo_rockets);
+       start_ammo_cells = max(0, start_ammo_cells);
+       start_ammo_plasma = max(0, start_ammo_plasma);
+       start_ammo_fuel = max(0, start_ammo_fuel);
+
+       warmup_start_ammo_shells = max(0, warmup_start_ammo_shells);
+       warmup_start_ammo_nails = max(0, warmup_start_ammo_nails);
+       warmup_start_ammo_rockets = max(0, warmup_start_ammo_rockets);
+       warmup_start_ammo_cells = max(0, warmup_start_ammo_cells);
+       warmup_start_ammo_plasma = max(0, warmup_start_ammo_plasma);
+       warmup_start_ammo_fuel = max(0, warmup_start_ammo_fuel);
+}
+
+float sound_allowed(float _dest, entity e)
 {
     // sounds from world may always pass
-    for(0;;)
+    for (;;)
     {
         if (e.classname == "body")
             e = e.enemy;
@@ -535,7 +788,7 @@ float sound_allowed(float dest, entity e)
             break;
     }
     // sounds to self may always pass
-    if (dest == MSG_ONE)
+    if (_dest == MSG_ONE)
         if (e == msg_entity)
             return true;
     // sounds by players can be removed
@@ -547,81 +800,81 @@ float sound_allowed(float dest, entity e)
 }
 
 #undef sound
-void sound(entity e, float chan, string samp, float vol, float atten)
+void sound(entity e, float chan, string samp, float vol, float _atten)
 {
     if (!sound_allowed(MSG_BROADCAST, e))
         return;
-    sound7(e, chan, samp, vol, atten, 0, 0);
+    sound7(e, chan, samp, vol, _atten, 0, 0);
 }
 
-void soundtoat(float dest, entity e, vector o, float chan, string samp, float vol, float atten)
+void soundtoat(float _dest, entity e, vector o, float chan, string samp, float vol, float _atten)
 {
     float entno, idx;
 
-    if (!sound_allowed(dest, e))
+    if (!sound_allowed(_dest, e))
         return;
 
     entno = num_for_edict(e);
     idx = precache_sound_index(samp);
 
-    float sflags;
+    int sflags;
     sflags = 0;
 
-    atten = floor(atten * 64);
+    _atten = floor(_atten * 64);
     vol = floor(vol * 255);
 
     if (vol != 255)
         sflags |= SND_VOLUME;
-    if (atten != 64)
+    if (_atten != 64)
         sflags |= SND_ATTENUATION;
     if (entno >= 8192 || chan < 0 || chan > 7)
         sflags |= SND_LARGEENTITY;
     if (idx >= 256)
         sflags |= SND_LARGESOUND;
 
-    WriteByte(dest, SVC_SOUND);
-    WriteByte(dest, sflags);
+    WriteByte(_dest, SVC_SOUND);
+    WriteByte(_dest, sflags);
     if (sflags & SND_VOLUME)
-        WriteByte(dest, vol);
+        WriteByte(_dest, vol);
     if (sflags & SND_ATTENUATION)
-        WriteByte(dest, atten);
+        WriteByte(_dest, _atten);
     if (sflags & SND_LARGEENTITY)
     {
-        WriteShort(dest, entno);
-        WriteByte(dest, chan);
+        WriteShort(_dest, entno);
+        WriteByte(_dest, chan);
     }
     else
     {
-        WriteShort(dest, entno * 8 + chan);
+        WriteShort(_dest, entno * 8 + chan);
     }
     if (sflags & SND_LARGESOUND)
-        WriteShort(dest, idx);
+        WriteShort(_dest, idx);
     else
-        WriteByte(dest, idx);
+        WriteByte(_dest, idx);
 
-    WriteCoord(dest, o.x);
-    WriteCoord(dest, o.y);
-    WriteCoord(dest, o.z);
+    WriteCoord(_dest, o.x);
+    WriteCoord(_dest, o.y);
+    WriteCoord(_dest, o.z);
 }
-void soundto(float dest, entity e, float chan, string samp, float vol, float atten)
+void soundto(float _dest, entity e, float chan, string samp, float vol, float _atten)
 {
     vector o;
 
-    if (!sound_allowed(dest, e))
+    if (!sound_allowed(_dest, e))
         return;
 
     o = e.origin + 0.5 * (e.mins + e.maxs);
-    soundtoat(dest, e, o, chan, samp, vol, atten);
+    soundtoat(_dest, e, o, chan, samp, vol, _atten);
 }
-void soundat(entity e, vector o, float chan, string samp, float vol, float atten)
+void soundat(entity e, vector o, float chan, string samp, float vol, float _atten)
 {
-    soundtoat(((chan & 8) ? MSG_ALL : MSG_BROADCAST), e, o, chan, samp, vol, atten);
+    soundtoat(((chan & 8) ? MSG_ALL : MSG_BROADCAST), e, o, chan, samp, vol, _atten);
 }
-void stopsoundto(float dest, entity e, float chan)
+void stopsoundto(float _dest, entity e, float chan)
 {
     float entno;
 
-    if (!sound_allowed(dest, e))
+    if (!sound_allowed(_dest, e))
         return;
 
     entno = num_for_edict(e);
@@ -633,22 +886,22 @@ void stopsoundto(float dest, entity e, float chan)
         sflags = SND_LARGEENTITY;
         if (idx >= 256)
             sflags |= SND_LARGESOUND;
-        WriteByte(dest, SVC_SOUND);
-        WriteByte(dest, sflags);
-        WriteShort(dest, entno);
-        WriteByte(dest, chan);
+        WriteByte(_dest, SVC_SOUND);
+        WriteByte(_dest, sflags);
+        WriteShort(_dest, entno);
+        WriteByte(_dest, chan);
         if (sflags & SND_LARGESOUND)
-            WriteShort(dest, idx);
+            WriteShort(_dest, idx);
         else
-            WriteByte(dest, idx);
-        WriteCoord(dest, e.origin.x);
-        WriteCoord(dest, e.origin.y);
-        WriteCoord(dest, e.origin.z);
+            WriteByte(_dest, idx);
+        WriteCoord(_dest, e.origin.x);
+        WriteCoord(_dest, e.origin.y);
+        WriteCoord(_dest, e.origin.z);
     }
     else
     {
-        WriteByte(dest, SVC_STOPSOUND);
-        WriteShort(dest, entno * 8 + chan);
+        WriteByte(_dest, SVC_STOPSOUND);
+        WriteShort(_dest, entno * 8 + chan);
     }
 }
 void stopsound(entity e, float chan)
@@ -669,7 +922,7 @@ void play2(entity e, string filename)
 
 // use this one if you might be causing spam (e.g. from touch functions that might get called more than once per frame)
 .float spamtime;
-float spamsound(entity e, float chan, string samp, float vol, float atten)
+float spamsound(entity e, float chan, string samp, float vol, float _atten)
 {
     if (!sound_allowed(MSG_BROADCAST, e))
         return false;
@@ -677,7 +930,7 @@ float spamsound(entity e, float chan, string samp, float vol, float atten)
     if (time > e.spamtime)
     {
         e.spamtime = time;
-        sound(e, chan, samp, vol, atten);
+        sound(e, chan, samp, vol, _atten);
         return true;
     }
     return false;
@@ -945,7 +1198,7 @@ void InitializeEntity(entity e, void(void) func, float order)
 
     cur = initialize_entity_first;
     prev = world;
-    for(0;;)
+    for (;;)
     {
         if (!cur || cur.initialize_entity_order > order)
         {
@@ -1001,8 +1254,6 @@ void InitializeEntitiesRun()
     remove = remove_unsafely;
 }
 
-.float uncustomizeentityforclient_set;
-.void(void) uncustomizeentityforclient;
 void UncustomizeEntitiesRun()
 {
     entity oldself;
@@ -1018,11 +1269,8 @@ void SetCustomizer(entity e, float(void) customizer, void(void) uncustomizer)
     e.uncustomizeentityforclient_set = !!uncustomizer;
 }
 
-.float nottargeted;
-#define IFTARGETED if(!self.nottargeted && self.targetname != "")
 
-void() SUB_Remove;
-void Net_LinkEntity(entity e, float docull, float dt, float(entity, float) sendfunc)
+void Net_LinkEntity(entity e, bool docull, float dt, bool(entity, int) sendfunc)
 {
     vector mi, ma;
 
@@ -1051,7 +1299,6 @@ void Net_LinkEntity(entity e, float docull, float dt, float(entity, float) sendf
 }
 
 
-entity eliminatedPlayers;
 .float(entity) isEliminated;
 float EliminatedPlayers_SendEntity(entity to, float sendflags)
 {
@@ -1215,7 +1462,6 @@ float SUB_NoImpactCheck()
 
 #define SUB_OwnerCheck() (other && (other == self.owner))
 
-void RemoveGrapplingHook(entity pl);
 void W_Crylink_Dequeue(entity e);
 float WarpZone_Projectile_Touch_ImpactFilter_Callback()
 {
@@ -1240,10 +1486,7 @@ float WarpZone_Projectile_Touch_ImpactFilter_Callback()
                UpdateCSQCProjectile(self);
        return false;
 }
-#define PROJECTILE_TOUCH if(WarpZone_Projectile_Touch()) return
 
-#define ITEM_TOUCH_NEEDKILL() (((trace_dpstartcontents | trace_dphitcontents) & DPCONTENTS_NODROP) || (trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY))
-#define ITEM_DAMAGE_NEEDKILL(dt) (((dt) == DEATH_HURTTRIGGER) || ((dt) == DEATH_SLIME) || ((dt) == DEATH_LAVA) || ((dt) == DEATH_SWAMP))
 
 void URI_Get_Callback(float id, float status, string data)
 {
@@ -1308,9 +1551,9 @@ float MoveToRandomMapLocation(entity e, float goodcontents, float badcontents, f
 
     for (i = 0; i < attempts; ++i)
     {
-        start_x = org.x + random() * delta.x;
-        start_y = org.y + random() * delta.y;
-        start_z = org.z + random() * delta.z;
+        start.x = org.x + random() * delta.x;
+        start.y = org.y + random() * delta.y;
+        start.z = org.z + random() * delta.z;
 
         // rule 1: start inside world bounds, and outside
         // solid, and don't start from somewhere where you can
@@ -1367,9 +1610,9 @@ float MoveToRandomMapLocation(entity e, float goodcontents, float badcontents, f
        }
 
         // find a random vector to "look at"
-        end_x = org.x + random() * delta.x;
-        end_y = org.y + random() * delta.y;
-        end_z = org.z + random() * delta.z;
+        end.x = org.x + random() * delta.x;
+        end.y = org.y + random() * delta.y;
+        end.z = org.z + random() * delta.z;
         end = start + normalize(end - start) * vlen(delta);
 
         // rule 4: start TO end must not be too short
@@ -1423,14 +1666,14 @@ vector shotorg_adjustfromclient(vector vecs, float y_is_right, float allowcenter
                        break;
 
                case 4: // left
-                       vecs_y = -vecs.y;
+                       vecs.y = -vecs.y;
                        break;
 
                case 1:
                        if(allowcenter) // 2: allow center handedness
                        {
                                // center
-                               vecs_y = 0;
+                               vecs.y = 0;
                                vecs.z -= 2;
                        }
                        else
@@ -1443,13 +1686,13 @@ vector shotorg_adjustfromclient(vector vecs, float y_is_right, float allowcenter
                        if(allowcenter) // 2: allow center handedness
                        {
                                // center
-                               vecs_y = 0;
+                               vecs.y = 0;
                                vecs.z -= 2;
                        }
                        else
                        {
                                // left
-                               vecs_y = -vecs.y;
+                               vecs.y = -vecs.y;
                        }
                        break;
        }
@@ -1466,28 +1709,28 @@ vector shotorg_adjust_values(vector vecs, float y_is_right, float visual, float
                if (visual)
                {
                        if (autocvar_g_shootfromclient) { vecs = shotorg_adjustfromclient(vecs, y_is_right, (autocvar_g_shootfromclient >= 2), algn); }
-                       else { vecs_y = 0; vecs.z -= 2; }
+                       else { vecs.y = 0; vecs.z -= 2; }
                }
                else
                {
-                       vecs_y = 0;
-                       vecs_z = 0;
+                       vecs.y = 0;
+                       vecs.z = 0;
                }
        }
        else if (autocvar_g_shootfromcenter)
        {
-               vecs_y = 0;
+               vecs.y = 0;
                vecs.z -= 2;
        }
        else if ((s = autocvar_g_shootfromfixedorigin) != "")
        {
                v = stov(s);
                if (y_is_right)
-                       v_y = -v.y;
+                       v.y = -v.y;
                if (v.x != 0)
-                       vecs_x = v.x;
-               vecs_y = v.y;
-               vecs_z = v.z;
+                       vecs.x = v.x;
+               vecs.y = v.y;
+               vecs.z = v.z;
        }
        else if (autocvar_g_shootfromclient)
        {
@@ -1525,12 +1768,12 @@ void attach_sameorigin(entity e, entity to, string tag)
     fixedmakevectors(e.angles);
 
     // untransform forward, up!
-    e_forward_x = v_forward * t_forward;
-    e_forward_y = v_forward * t_left;
-    e_forward_z = v_forward * t_up;
-    e_up_x = v_up * t_forward;
-    e_up_y = v_up * t_left;
-    e_up_z = v_up * t_up;
+    e_forward.x = v_forward * t_forward;
+    e_forward.y = v_forward * t_left;
+    e_forward.z = v_forward * t_up;
+    e_up.x = v_up * t_forward;
+    e_up.y = v_up * t_left;
+    e_up.z = v_up * t_up;
 
     e.angles = fixedvectoangles2(e_forward, e_up);
     if (substring(e.model, 0, 1) == "*") // bmodels have their own rules
@@ -1586,7 +1829,7 @@ vector gettaginfo_relative(entity e, float tag)
 
 .float scale2;
 
-float modeleffect_SendEntity(entity to, float sf)
+float modeleffect_SendEntity(entity to, int sf)
 {
        float f;
        WriteByte(MSG_ENTITY, ENT_CLIENT_MODELEFFECT);
@@ -1729,26 +1972,6 @@ float ExponentialFalloff(float mindist, float maxdist, float halflifedist, float
 }
 
 
-
-
-#ifdef RELEASE
-#define cvar_string_normal builtin_cvar_string
-#define cvar_normal builtin_cvar
-#else
-string cvar_string_normal(string n)
-{
-       if (!(cvar_type(n) & 1))
-               backtrace(strcat("Attempt to access undefined cvar: ", n));
-       return builtin_cvar_string(n);
-}
-
-float cvar_normal(string n)
-{
-       return stof(cvar_string_normal(n));
-}
-#endif
-#define cvar_set_normal builtin_cvar_set
-
 void defer_think()
 {
     entity oself;