]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Move some more functions out of miscfunctions, split eliminated players handling...
authorMario <mario.mario@y7mail.com>
Mon, 21 Sep 2020 12:57:50 +0000 (22:57 +1000)
committerMario <mario.mario@y7mail.com>
Mon, 21 Sep 2020 12:57:50 +0000 (22:57 +1000)
13 files changed:
qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qh
qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qc
qcsrc/common/mapobjects/triggers.qc
qcsrc/common/physics/player.qh
qcsrc/server/_mod.inc
qcsrc/server/_mod.qh
qcsrc/server/elimination.qc [new file with mode: 0644]
qcsrc/server/elimination.qh [new file with mode: 0644]
qcsrc/server/gamelog.qc
qcsrc/server/main.qc
qcsrc/server/main.qh
qcsrc/server/miscfunctions.qc
qcsrc/server/miscfunctions.qh

index f6420b85261b7efaa9435db2ae1e8b90e091e0e8..78526bc262b5dba7f885cb154ae63cbbac3f3321 100644 (file)
@@ -1,6 +1,7 @@
 #pragma once
 
 #include <common/mutators/base.qh>
+#include <server/elimination.qh>
 #include <server/round_handler.qh>
 #include <server/miscfunctions.qh>
 #include <server/command/sv_cmd.qh>
index 360dc7a4ea8bb1f15ca4274c6ad2225a9625cf75..5378fb346abf9793aa38e76cbc16dc100cf09d8e 100644 (file)
@@ -1,5 +1,6 @@
 #include "sv_freezetag.qh"
 
+#include <server/elimination.qh>
 #include <server/resources.qh>
 
 float autocvar_g_freezetag_frozen_maxtime;
index 29b00d5dbcc7f34932ae1154438d88688d1b6d14..54550dcb263e33b66e520b5434246e5600474335 100644 (file)
@@ -1,5 +1,37 @@
 #include "triggers.qh"
 
+bool isPushable(entity e)
+{
+       if(e.pushable)
+               return true;
+#ifdef SVQC
+       if(IS_VEHICLE(e))
+               return false;
+       if(e.iscreature)
+               return true;
+       if (Item_IsLoot(e))
+       {
+               return true;
+       }
+       switch(e.classname)
+       {
+               case "body":
+                       return true;
+               case "bullet": // antilagged bullets can't hit this either
+                       return false;
+       }
+       if (e.projectiledeathtype)
+               return true;
+#endif
+#ifdef CSQC
+       if(e.flags & FL_PROJECTILE)
+               return true;
+       if(e.isplayermodel)
+               return true;
+#endif
+       return false;
+}
+
 void SUB_DontUseTargets(entity this, entity actor, entity trigger) { }
 
 void SUB_UseTargets(entity this, entity actor, entity trigger);
index da45243b63ae0b3f6b9738a71b418e40cbea92a4..5d2fcf7263afd1d8dad0c75e8658eba1eed5d21f 100644 (file)
@@ -190,7 +190,6 @@ STATIC_INIT(PHYS_INPUT_BUTTON)
        #define IS_CLIENT(s)                        (((s).isplayermodel & ISPLAYER_CLIENT) || (s) == csqcplayer)
        #define IS_PLAYER(s)                        ((s).isplayermodel & ISPLAYER_PLAYER)
        #define IS_NOT_A_CLIENT(s)                  (!(s).isplayermodel && (s) != csqcplayer)
-       #define isPushable(s)                       ((s).isplayermodel || (s).pushable || ((s).flags & FL_PROJECTILE))
 
        //float player_multijump;
        //float player_jumpheight;
index fed18941bee69f191fcb44346d55989d3617ab4f..b4c287a89d7014731f92c0714a0af8eb6fcbe182 100644 (file)
@@ -6,6 +6,7 @@
 #include <server/client.qc>
 #include <server/clientkill.qc>
 #include <server/damage.qc>
+#include <server/elimination.qc>
 #include <server/gamelog.qc>
 #include <server/handicap.qc>
 #include <server/hook.qc>
index d8679eb8aefe77dfefd848e3a9456a3bbb9c208a..f9b39314ab1787b51ea877b8a66a6f7d4e72dcc9 100644 (file)
@@ -6,6 +6,7 @@
 #include <server/client.qh>
 #include <server/clientkill.qh>
 #include <server/damage.qh>
+#include <server/elimination.qh>
 #include <server/gamelog.qh>
 #include <server/handicap.qh>
 #include <server/hook.qh>
diff --git a/qcsrc/server/elimination.qc b/qcsrc/server/elimination.qc
new file mode 100644 (file)
index 0000000..8024c9a
--- /dev/null
@@ -0,0 +1,36 @@
+#include "elimination.qh"
+
+#include <common/net_linked.qh>
+#include <server/utils.qh>
+
+.float(entity) isEliminated;
+bool EliminatedPlayers_SendEntity(entity this, entity to, float sendflags)
+{
+       Stream out = MSG_ENTITY;
+       WriteHeader(out, ENT_CLIENT_ELIMINATEDPLAYERS);
+       serialize(byte, out, sendflags);
+       if (sendflags & 1) {
+               for (int i = 1; i <= maxclients; i += 8) {
+                       int f = 0;
+                       entity e = edict_num(i);
+                       for (int b = 0; b < 8; ++b, e = nextent(e)) {
+                               if (eliminatedPlayers.isEliminated(e)) {
+                                       f |= BIT(b);
+                               }
+                       }
+                       serialize(byte, out, f);
+               }
+       }
+       return true;
+}
+
+void EliminatedPlayers_Init(float(entity) isEliminated_func)
+{
+       if(eliminatedPlayers)
+       {
+               backtrace("Can't spawn eliminatedPlayers again!");
+               return;
+       }
+       Net_LinkEntity(eliminatedPlayers = spawn(), false, 0, EliminatedPlayers_SendEntity);
+       eliminatedPlayers.isEliminated = isEliminated_func;
+}
diff --git a/qcsrc/server/elimination.qh b/qcsrc/server/elimination.qh
new file mode 100644 (file)
index 0000000..5a50beb
--- /dev/null
@@ -0,0 +1,4 @@
+#pragma once
+
+entity eliminatedPlayers;
+void EliminatedPlayers_Init(float(entity) isEliminated_func);
index 2c61419c51a142aa7066d64d739f794d221315c7..a3e747cab6419a307034b227ca63bbbaf421d6f1 100644 (file)
@@ -1,7 +1,7 @@
 #include "gamelog.qh"
 
 #include <server/autocvars.qh>
-#include <server/miscfunctions.qh>
+#include <server/main.qh>
 
 string GameLog_ProcessIP(string s)
 {
index bbafd022df286bcdd8c96a93e347dbc0225e5dd1..351cf738df250f48678812e6371a4817de4d039e 100644 (file)
@@ -173,6 +173,11 @@ void SV_PausedTic(float elapsedtime)
        if (!server_is_dedicated) Pause_TryPause(false);
 }
 
+void dedicated_print(string input)
+{
+       if (server_is_dedicated) print(input);
+}
+
 /*
 =============
 StartFrame
index dc3d80dbea81f83548c0cd977a68fcd75d6e70bb..e89d68304fca70e855c4d7a53377942db095f15d 100644 (file)
@@ -1,5 +1,8 @@
 #pragma once
 
+/** print(), but only print if the server is not local */
+void dedicated_print(string input);
+
 bool expr_evaluate(string s);
 
 #ifdef PROFILING
index e8b4ab681c5bb91a64e7ef650dd89c2dfd3018cd..cc5c2d139eb83eb14ed5fb65e9c7991589d0277f 100644 (file)
@@ -87,11 +87,6 @@ void WarpZone_crosshair_trace(entity pl)
        WarpZone_traceline_antilag(pl, CS(pl).cursor_trace_start, CS(pl).cursor_trace_start + normalize(CS(pl).cursor_trace_endpos - CS(pl).cursor_trace_start) * max_shot_distance, MOVE_NORMAL, pl, ANTILAG_LATENCY(pl));
 }
 
-void dedicated_print(string input)
-{
-       if (server_is_dedicated) print(input);
-}
-
 entity findnearest(vector point, bool checkitems, vector axismod)
 {
     vector dist;
@@ -966,41 +961,6 @@ void InitializeEntitiesRun()
     delete_fn = remove_unsafely;
 }
 
-.float(entity) isEliminated;
-bool EliminatedPlayers_SendEntity(entity this, entity to, float sendflags)
-{
-       Stream out = MSG_ENTITY;
-       WriteHeader(out, ENT_CLIENT_ELIMINATEDPLAYERS);
-       serialize(byte, out, sendflags);
-       if (sendflags & 1) {
-               for (int i = 1; i <= maxclients; i += 8) {
-                       int f = 0;
-                       entity e = edict_num(i);
-                       for (int b = 0; b < 8; ++b, e = nextent(e)) {
-                               if (eliminatedPlayers.isEliminated(e)) {
-                                       f |= BIT(b);
-                               }
-                       }
-                       serialize(byte, out, f);
-               }
-       }
-       return true;
-}
-
-void EliminatedPlayers_Init(float(entity) isEliminated_func)
-{
-       if(eliminatedPlayers)
-       {
-               backtrace("Can't spawn eliminatedPlayers again!");
-               return;
-       }
-       Net_LinkEntity(eliminatedPlayers = spawn(), false, 0, EliminatedPlayers_SendEntity);
-       eliminatedPlayers.isEliminated = isEliminated_func;
-}
-
-
-
-
 void adaptor_think2use_hittype_splash(entity this) // for timed projectile detonation
 {
        if(!(IS_ONGROUND(this))) // if onground, we ARE touching something, but HITTYPE_SPLASH is to be networked if the damage causing projectile is not touching ANYTHING
@@ -1421,28 +1381,3 @@ float LostMovetypeFollow(entity ent)
        }
        return 0;
 }
-
-.bool pushable;
-bool isPushable(entity e)
-{
-       if(e.pushable)
-               return true;
-       if(IS_VEHICLE(e))
-               return false;
-       if(e.iscreature)
-               return true;
-       if (Item_IsLoot(e))
-       {
-               return true;
-       }
-       switch(e.classname)
-       {
-               case "body":
-                       return true;
-               case "bullet": // antilagged bullets can't hit this either
-                       return false;
-       }
-       if (e.projectiledeathtype)
-               return true;
-       return false;
-}
index 8a2406316cc9038549fc15f38fa303a40c349245..f79c9e84ac288f554137803f655e8e25c3923982 100644 (file)
@@ -15,9 +15,6 @@
 
 .vector dropped_origin;
 
-entity eliminatedPlayers;
-void EliminatedPlayers_Init(float(entity) isEliminated_func);
-
 void write_recordmarker(entity pl, float tstart, float dt);
 
 void play2all(string samp);
@@ -61,15 +58,10 @@ void follow_sameorigin(entity e, entity to);
 
 string formatmessage(entity this, string msg);
 
-/** print(), but only print if the server is not local */
-void dedicated_print(string input);
-
 void GetCvars(entity this, entity store, int f);
 
 string GetMapname();
 
-float isPushable(entity e);
-
 float LostMovetypeFollow(entity ent);
 
 string uid2name(string myuid);