]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/miscfunctions.qc
Join ifs
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / miscfunctions.qc
index 4e2113f53fe3baf148c7c7308c371c51efc45c87..e8b4ab681c5bb91a64e7ef650dd89c2dfd3018cd 100644 (file)
@@ -2,16 +2,22 @@
 
 #include "antilag.qh"
 #include "command/common.qh"
-#include "constants.qh"
-#include "g_hook.qh"
+#include "client.qh"
+#include "damage.qh"
+#include "hook.qh"
+#include "world.qh"
+#include <server/gamelog.qh>
 #include "ipban.qh"
+#include <server/items/items.qh>
 #include <server/mutators/_mod.qh>
-#include "../common/t_items.qh"
+#include <server/spawnpoints.qh>
+#include <server/main.qh>
 #include "mapvoting.qh"
 #include "resources.qh"
-#include "items.qh"
+#include <server/items/spawning.qh>
 #include "player.qh"
 #include "weapons/accuracy.qh"
+#include "weapons/common.qh"
 #include "weapons/csqcprojectile.qh"
 #include "weapons/selection.qh"
 #include "../common/command/_mod.qh"
@@ -24,6 +30,8 @@
 #include "../common/playerstats.qh"
 #include "../common/teams.qh"
 #include "../common/mapobjects/subs.qh"
+#include <common/mapobjects/trigger/hurt.qh>
+#include <common/mapobjects/target/location.qh>
 #include "../common/util.qh"
 #include "../common/turrets/sv_turrets.qh"
 #include <common/weapons/_all.qh>
@@ -84,61 +92,6 @@ void dedicated_print(string input)
        if (server_is_dedicated) print(input);
 }
 
-string GameLog_ProcessIP(string s)
-{
-       if(!autocvar_sv_eventlog_ipv6_delimiter)
-               return s;
-       return strreplace(":", "_", s);
-}
-
-void GameLogEcho(string s)
-{
-    string fn;
-    int matches;
-
-    if (autocvar_sv_eventlog_files)
-    {
-        if (!logfile_open)
-        {
-            logfile_open = true;
-            matches = autocvar_sv_eventlog_files_counter + 1;
-            cvar_set("sv_eventlog_files_counter", itos(matches));
-            fn = ftos(matches);
-            if (strlen(fn) < 8)
-                fn = strcat(substring("00000000", 0, 8 - strlen(fn)), fn);
-            fn = strcat(autocvar_sv_eventlog_files_nameprefix, fn, autocvar_sv_eventlog_files_namesuffix);
-            logfile = fopen(fn, FILE_APPEND);
-            fputs(logfile, ":logversion:3\n");
-        }
-        if (logfile >= 0)
-        {
-            if (autocvar_sv_eventlog_files_timestamps)
-                fputs(logfile, strcat(":time:", strftime(true, "%Y-%m-%d %H:%M:%S", "\n", s, "\n")));
-            else
-                fputs(logfile, strcat(s, "\n"));
-        }
-    }
-    if (autocvar_sv_eventlog_console)
-    {
-        dedicated_print(strcat(s, "\n"));
-    }
-}
-
-void GameLogInit()
-{
-    logfile_open = 0;
-    // will be opened later
-}
-
-void GameLogClose()
-{
-    if (logfile_open && logfile >= 0)
-    {
-        fclose(logfile);
-        logfile = -1;
-    }
-}
-
 entity findnearest(vector point, bool checkitems, vector axismod)
 {
     vector dist;
@@ -243,7 +196,7 @@ string WeaponNameFromWeaponentity(entity this, .entity weaponentity)
                return wepent.m_weapon.m_name;
        else if(wepent.m_switchweapon != WEP_Null)
                return wepent.m_switchweapon.m_name;
-       return "none"; //Weapons_from(wepent.cnt).m_name;
+       return "none"; //REGISTRY_GET(Weapons, wepent.cnt).m_name;
 }
 
 string formatmessage(entity this, string msg)
@@ -404,46 +357,6 @@ string W_FixWeaponOrder_ForceComplete_AndBuildImpulseList(entity this, string wo
        return o;
 }
 
-REPLICATE(autoswitch, bool, "cl_autoswitch");
-
-REPLICATE(cvar_cl_allow_uid2name, bool, "cl_allow_uid2name");
-
-REPLICATE(cvar_cl_allow_uidranking, bool, "cl_allow_uidranking");
-
-REPLICATE(cvar_cl_autoscreenshot, int, "cl_autoscreenshot");
-
-REPLICATE(cvar_cl_autotaunt, float, "cl_autotaunt");
-
-REPLICATE(cvar_cl_clippedspectating, bool, "cl_clippedspectating");
-
-REPLICATE(cvar_cl_handicap, float, "cl_handicap");
-
-REPLICATE(cvar_cl_gunalign, int, "cl_gunalign");
-
-REPLICATE(cvar_cl_jetpack_jump, bool, "cl_jetpack_jump");
-
-REPLICATE(cvar_cl_movement_track_canjump, bool, "cl_movement_track_canjump");
-
-REPLICATE(cvar_cl_newusekeysupported, bool, "cl_newusekeysupported");
-
-REPLICATE(cvar_cl_noantilag, bool, "cl_noantilag");
-
-REPLICATE(cvar_cl_physics, string, "cl_physics");
-
-REPLICATE(cvar_cl_voice_directional, int, "cl_voice_directional");
-
-REPLICATE(cvar_cl_voice_directional_taunt_attenuation, float, "cl_voice_directional_taunt_attenuation");
-
-REPLICATE(cvar_cl_weaponimpulsemode, int, "cl_weaponimpulsemode");
-
-REPLICATE(cvar_g_xonoticversion, string, "g_xonoticversion");
-
-REPLICATE(cvar_cl_cts_noautoswitch, bool, "cl_cts_noautoswitch");
-
-REPLICATE(cvar_cl_weapon_switch_reload, bool, "cl_weapon_switch_reload");
-
-REPLICATE(cvar_cl_weapon_switch_fallback_to_impulse, bool, "cl_weapon_switch_fallback_to_impulse");
-
 /**
  * @param f -1: cleanup, 0: request, 1: receive
  */
@@ -719,7 +632,7 @@ void readplayerstartcvars()
                for (int j = 0; j < t; ++j)
                {
                        s = argv(j);
-                       Weapon wep = Weapons_fromstr(s);
+                       Weapon wep = Weapon_from_name(s);
                        if(wep != WEP_Null)
                        {
                                g_weaponarena_weapons |= (wep.m_wepset);
@@ -856,9 +769,14 @@ void readplayerstartcvars()
 
 void precache_playermodel(string m)
 {
-       float globhandle, i, n;
+       int globhandle, i, n;
        string f;
 
+       // remove :<skinnumber> suffix
+       int j = strstrofs(m, ":", 0);
+       if(j >= 0)
+               m = substring(m, 0, j);
+
        if(substring(m, -9, 5) == "_lod1")
                return;
        if(substring(m, -9, 5) == "_lod2")