]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Reorganise some more definitions out of defs.qh, show all racers on the radar in...
authorMario <mario.mario@y7mail.com>
Sat, 1 Aug 2020 23:57:47 +0000 (09:57 +1000)
committerMario <mario.mario@y7mail.com>
Sat, 1 Aug 2020 23:57:47 +0000 (09:57 +1000)
15 files changed:
qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qh
qcsrc/common/gamemodes/gamemode/keyhunt/sv_keyhunt.qc
qcsrc/common/gamemodes/gamemode/race/sv_race.qc
qcsrc/common/turrets/sv_turrets.qc
qcsrc/common/vehicles/vehicle/racer.qc
qcsrc/common/vehicles/vehicle/raptor.qc
qcsrc/common/vehicles/vehicle/spiderbot.qc
qcsrc/server/bot/default/scripting.qc
qcsrc/server/client.qc
qcsrc/server/client.qh
qcsrc/server/defs.qh
qcsrc/server/g_world.qc
qcsrc/server/player.qc
qcsrc/server/player.qh
qcsrc/server/weapons/weaponsystem.qh

index 4cffb0c488a30a332b12235b228cd606e7c97af4..d0e13c132b603660d7bf5c9d75f9b349019595ad 100644 (file)
@@ -75,6 +75,9 @@ const float VEHICLE_FLAG_SCALE = 1.0;
 .float score_return;
 .float score_team_capture; // shouldn't be too high
 
+// property set on objects to point to the flag they're carrying (if any)
+.entity flagcarried;
+
 // effects
 .string toucheffect;
 .string passeffect;
index 40870a7903c559a48841f5c641362140ad2057fb..d13ec1ac8982c315fbb2e11cf41fcc6d602e32b0 100644 (file)
@@ -1,6 +1,7 @@
 #include "sv_keyhunt.qh"
 
 #include <server/gamelog.qh>
+#include <server/g_damage.qh>
 
 float autocvar_g_balance_keyhunt_damageforcescale;
 float autocvar_g_balance_keyhunt_delay_collect;
index baf2131c80784a8f80aefa6ff925c6da3a5cff91..29415649ec95a1e3da306d386d443c466848033f 100644 (file)
@@ -445,6 +445,7 @@ void race_Initialize()
        race_ScoreRules();
        if(g_race_qualifying == 2)
                warmup_stage = 0;
+       radar_showennemies = true;
 }
 
 void rc_SetLimits()
index c3f2af089a667f0a6abfb6db6bee33396f4aec86..4b852d5986dfe0d9c92b648b3f5a004c46e67b5a 100644 (file)
@@ -1,6 +1,7 @@
 #include "sv_turrets.qh"
 #ifdef SVQC
 #include <server/autocvars.qh>
+#include <server/weapons/weaponsystem.qh>
 #include <common/mapobjects/defs.qh>
 
 // Generic aiming
index a0e35e02ee37a9a7a44f948901c77ab3ba406032..784b3355e511f0e2a11aa956c2fb7bc8c882562a 100644 (file)
@@ -1,5 +1,9 @@
 #include "racer.qh"
 
+#if defined(SVQC)
+       #include <common/gamemodes/gamemode/ctf/sv_ctf.qh>
+#endif
+
 #ifdef GAMEQC
 
 #ifdef SVQC
index a868eb4aa1f65b9c56d098ceeb779d68ba55038b..b2ee42e1cc1ad9d77f865eb3e193ebb0c6f3187b 100644 (file)
@@ -1,5 +1,9 @@
 #include "raptor.qh"
 
+#if defined(SVQC)
+       #include <common/gamemodes/gamemode/ctf/sv_ctf.qh>
+#endif
+
 #ifdef GAMEQC
 
 #ifdef SVQC
index e031222714e7b758496115675dbf3ed23b2c6846..069696639f8f1b2bfc6f917ca8e1934ef0cabe68 100644 (file)
@@ -1,5 +1,9 @@
 #include "spiderbot.qh"
 
+#if defined(SVQC)
+       #include <common/gamemodes/gamemode/ctf/sv_ctf.qh>
+#endif
+
 #ifdef GAMEQC
 
 const int SBRM_FIRST = 1;
index 210e9710486dc7ea9624d50da6f71280e77a6297..65935cd68d11c7176d82077d160c633065880217 100644 (file)
@@ -3,9 +3,11 @@
 #include <server/defs.qh>
 #include <server/miscfunctions.qh>
 #include <server/weapons/selection.qh>
+#include <server/weapons/weaponsystem.qh>
 #include "cvars.qh"
 
 #include <common/state.qh>
+#include <common/gamemodes/gamemode/ctf/sv_ctf.qh>
 #include <common/physics/player.qh>
 #include <common/wepent.qh>
 
index 4990ed7eeeee454bbd3474018d841c09d76363ab..c0d3898377679f67633108c3b672aeb3c3ba4375 100644 (file)
@@ -1309,6 +1309,91 @@ void UpdateChatBubble(entity this)
        }
 }
 
+void calculate_player_respawn_time(entity this)
+{
+       if(MUTATOR_CALLHOOK(CalculateRespawnTime, this))
+               return;
+
+       float gametype_setting_tmp;
+       float sdelay_max = GAMETYPE_DEFAULTED_SETTING(respawn_delay_max);
+       float sdelay_small = GAMETYPE_DEFAULTED_SETTING(respawn_delay_small);
+       float sdelay_large = GAMETYPE_DEFAULTED_SETTING(respawn_delay_large);
+       float sdelay_small_count = GAMETYPE_DEFAULTED_SETTING(respawn_delay_small_count);
+       float sdelay_large_count = GAMETYPE_DEFAULTED_SETTING(respawn_delay_large_count);
+       float waves = GAMETYPE_DEFAULTED_SETTING(respawn_waves);
+
+       float pcount = 1;  // Include myself whether or not team is already set right and I'm a "player".
+       if (teamplay)
+       {
+               FOREACH_CLIENT(IS_PLAYER(it) && it != this, {
+                       if(it.team == this.team)
+                               ++pcount;
+               });
+               if (sdelay_small_count == 0)
+                       sdelay_small_count = 1;
+               if (sdelay_large_count == 0)
+                       sdelay_large_count = 1;
+       }
+       else
+       {
+               FOREACH_CLIENT(IS_PLAYER(it) && it != this, {
+                       ++pcount;
+               });
+               if (sdelay_small_count == 0)
+               {
+                       if (IS_INDEPENDENT_PLAYER(this))
+                       {
+                               // Players play independently. No point in requiring enemies.
+                               sdelay_small_count = 1;
+                       }
+                       else
+                       {
+                               // Players play AGAINST each other. Enemies required.
+                               sdelay_small_count = 2;
+                       }
+               }
+               if (sdelay_large_count == 0)
+               {
+                       if (IS_INDEPENDENT_PLAYER(this))
+                       {
+                               // Players play independently. No point in requiring enemies.
+                               sdelay_large_count = 1;
+                       }
+                       else
+                       {
+                               // Players play AGAINST each other. Enemies required.
+                               sdelay_large_count = 2;
+                       }
+               }
+       }
+
+       float sdelay;
+
+       if (pcount <= sdelay_small_count)
+               sdelay = sdelay_small;
+       else if (pcount >= sdelay_large_count)
+               sdelay = sdelay_large;
+       else  // NOTE: this case implies sdelay_large_count > sdelay_small_count.
+               sdelay = sdelay_small + (sdelay_large - sdelay_small) * (pcount - sdelay_small_count) / (sdelay_large_count - sdelay_small_count);
+
+       if(waves)
+               this.respawn_time = ceil((time + sdelay) / waves) * waves;
+       else
+               this.respawn_time = time + sdelay;
+
+       if(sdelay < sdelay_max)
+               this.respawn_time_max = time + sdelay_max;
+       else
+               this.respawn_time_max = this.respawn_time;
+
+       if((sdelay + waves >= 5.0) && (this.respawn_time - time > 1.75))
+               this.respawn_countdown = 10; // first number to count down from is 10
+       else
+               this.respawn_countdown = -1; // do not count down
+
+       if(autocvar_g_forced_respawn)
+               this.respawn_flags = this.respawn_flags | RESPAWN_FORCE;
+}
 
 // LordHavoc: this hack will be removed when proper _pants/_shirt layers are
 // added to the model skins
index 2f380ae2fda49fdf68d9ba6cd6186a8f7f7fe146..328726df9ca696c7725fa538617550e7af8f64e2 100644 (file)
@@ -231,8 +231,27 @@ METHOD(Client, m_unwind, bool(Client this))
     return false;
 }
 
+.int respawn_flags;
+.float respawn_time;
+.float respawn_time_max;
+
+// g_<gametype>_str:
+// If 0, default is used.
+// If <0, 0 is used.
+// Otherwise, g_str (default value) is used.
+// For consistency, negative values there are mapped to zero too.
+#define GAMETYPE_DEFAULTED_SETTING(str) \
+    ((gametype_setting_tmp = cvar(strcat("g_", GetGametype(), "_" #str))), \
+    (gametype_setting_tmp < 0) ? 0 \
+    : (gametype_setting_tmp == 0 || autocvar_g_respawn_delay_forced) ? max(0, autocvar_g_##str) \
+    : gametype_setting_tmp)
+
+void calculate_player_respawn_time(entity this);
+
 bool PlayerInList(entity player, string list);
 
+void ClientData_Touch(entity e);
+
 /// \brief Print the string to the client's chat.
 /// \param[in] client Client to print to.
 /// \param[in] text Text to print.
index c36f033c91eb0847c5faa2c360b753ec052347db..9aebfebb58c3a5ead7bc49f624eb87013fced778 100644 (file)
@@ -3,8 +3,6 @@
 #include <common/weapons/_all.qh>
 #include <common/stats.qh>
 
-#define INDEPENDENT_ATTACK_FINISHED 1
-
 // Globals
 
 float g_footsteps, g_grappling_hook;
@@ -24,8 +22,7 @@ float player_count;
 float currentbots;
 float bots_would_leave;
 
-void UpdateFrags(entity player, int f);
-.int totalfrags;
+.int totalfrags; // NOTE: reused for multiple purposes
 
 // flag set on worldspawn so that the code knows if it is dedicated or not
 float server_is_dedicated;
@@ -57,15 +54,10 @@ const .float air_finished = _STAT(AIR_FINISHED);
 .float count;
 //.float cnt2;
 
-.int respawn_flags;
-.float respawn_time;
-.float respawn_time_max;
 .float death_time;
 .float fade_time;
 .float fade_rate;
 
-void player_setupanimsformodel(entity this);
-
 .string mdl;
 
 .string playermodel;
@@ -139,8 +131,6 @@ int nJoinAllowed(entity this, entity ignore);
 .float spawnshieldtime;
 .float item_spawnshieldtime;
 
-.entity flagcarried;
-
 .int playerid;
 .float noalign;                // if set to 1, the item or spawnpoint won't be dropped to the floor
 
@@ -181,15 +171,6 @@ void FixClientCvars(entity e);
 
 float bot_waypoints_for_items;
 
-.float attack_finished_for[REGISTRY_MAX(Weapons) * MAX_WEAPONSLOTS];
-.float attack_finished_single[MAX_WEAPONSLOTS];
-#if INDEPENDENT_ATTACK_FINISHED
-#define ATTACK_FINISHED_FOR(ent, w, slot) ((ent).(attack_finished_for[((w) - WEP_FIRST) * MAX_WEAPONSLOTS + (slot)]))
-#else
-#define ATTACK_FINISHED_FOR(ent, w, slot) ((ent).attack_finished_single[slot])
-#endif
-#define ATTACK_FINISHED(ent, w) ATTACK_FINISHED_FOR(ent, ent.(w).m_weapon.m_id, weaponslot(w))
-
 // speedrun: when 1, player auto teleports back when capture timeout happens
 .float speedrunning;
 
@@ -217,8 +198,6 @@ bool sv_maxidle_slots_countbots;
 
 float tracebox_hits_trigger_hurt(vector start, vector mi, vector ma, vector end);
 
-float next_pingtime;
-
 // autotaunt system
 .float cvar_cl_autotaunt;
 .float cvar_cl_voice_directional;
@@ -259,8 +238,6 @@ float g_nexball_meter_period;
 .void(entity this) reset; // if set, an entity is reset using this
 .void(entity this) reset2; // if set, an entity is reset using this (after calling ALL the reset functions for other entities)
 
-void ClientData_Touch(entity e);
-
 //vector debug_shotorg; // if non-zero, overrides the shot origin of all weapons
 
 .bool wasplayer;
index 88d531ae9ac8ce4503e6b85d09d58b09089403d7..5dddc2fb3d00924ec3e257d83717c672ace9c1e4 100644 (file)
@@ -935,8 +935,6 @@ spawnfunc(worldspawn)
 
        Nagger_Init();
 
-       next_pingtime = time + 5;
-
        // set up information replies for clients and server to use
        maplist_reply = strzone(getmaplist());
        lsmaps_reply = strzone(getlsmaps());
index 1333b2386d81e59d4673858b5f1cac89a81bbc8c..8a626642e03499e094658afd5f322f44baa054d0 100644 (file)
@@ -3,6 +3,7 @@
 #include <common/effects/all.qh>
 #include "bot/api.qh"
 #include "cheats.qh"
+#include "client.qh"
 #include "clientkill.qh"
 #include "g_damage.qh"
 #include "handicap.qh"
@@ -32,6 +33,7 @@
 #include "../common/wepent.qh"
 
 #include "weapons/weaponstats.qh"
+#include <server/weapons/weaponsystem.qh>
 
 #include "../common/animdecide.qh"
 
@@ -222,92 +224,6 @@ void PlayerCorpseDamage(entity this, entity inflictor, entity attacker, float da
        }
 }
 
-void calculate_player_respawn_time(entity this)
-{
-       if(MUTATOR_CALLHOOK(CalculateRespawnTime, this))
-               return;
-
-       float gametype_setting_tmp;
-       float sdelay_max = GAMETYPE_DEFAULTED_SETTING(respawn_delay_max);
-       float sdelay_small = GAMETYPE_DEFAULTED_SETTING(respawn_delay_small);
-       float sdelay_large = GAMETYPE_DEFAULTED_SETTING(respawn_delay_large);
-       float sdelay_small_count = GAMETYPE_DEFAULTED_SETTING(respawn_delay_small_count);
-       float sdelay_large_count = GAMETYPE_DEFAULTED_SETTING(respawn_delay_large_count);
-       float waves = GAMETYPE_DEFAULTED_SETTING(respawn_waves);
-
-       float pcount = 1;  // Include myself whether or not team is already set right and I'm a "player".
-       if (teamplay)
-       {
-               FOREACH_CLIENT(IS_PLAYER(it) && it != this, {
-                       if(it.team == this.team)
-                               ++pcount;
-               });
-               if (sdelay_small_count == 0)
-                       sdelay_small_count = 1;
-               if (sdelay_large_count == 0)
-                       sdelay_large_count = 1;
-       }
-       else
-       {
-               FOREACH_CLIENT(IS_PLAYER(it) && it != this, {
-                       ++pcount;
-               });
-               if (sdelay_small_count == 0)
-               {
-                       if (IS_INDEPENDENT_PLAYER(this))
-                       {
-                               // Players play independently. No point in requiring enemies.
-                               sdelay_small_count = 1;
-                       }
-                       else
-                       {
-                               // Players play AGAINST each other. Enemies required.
-                               sdelay_small_count = 2;
-                       }
-               }
-               if (sdelay_large_count == 0)
-               {
-                       if (IS_INDEPENDENT_PLAYER(this))
-                       {
-                               // Players play independently. No point in requiring enemies.
-                               sdelay_large_count = 1;
-                       }
-                       else
-                       {
-                               // Players play AGAINST each other. Enemies required.
-                               sdelay_large_count = 2;
-                       }
-               }
-       }
-
-       float sdelay;
-
-       if (pcount <= sdelay_small_count)
-               sdelay = sdelay_small;
-       else if (pcount >= sdelay_large_count)
-               sdelay = sdelay_large;
-       else  // NOTE: this case implies sdelay_large_count > sdelay_small_count.
-               sdelay = sdelay_small + (sdelay_large - sdelay_small) * (pcount - sdelay_small_count) / (sdelay_large_count - sdelay_small_count);
-
-       if(waves)
-               this.respawn_time = ceil((time + sdelay) / waves) * waves;
-       else
-               this.respawn_time = time + sdelay;
-
-       if(sdelay < sdelay_max)
-               this.respawn_time_max = time + sdelay_max;
-       else
-               this.respawn_time_max = this.respawn_time;
-
-       if((sdelay + waves >= 5.0) && (this.respawn_time - time > 1.75))
-               this.respawn_countdown = 10; // first number to count down from is 10
-       else
-               this.respawn_countdown = -1; // do not count down
-
-       if(autocvar_g_forced_respawn)
-               this.respawn_flags = this.respawn_flags | RESPAWN_FORCE;
-}
-
 void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force)
 {
        vector v;
index 514b34726c2edf295dc9c79e00bfca8f6dbc5f00..0232c302ef0fb72452275023acd9b344ab730b73 100644 (file)
@@ -15,19 +15,6 @@ void player_anim(entity this);
 
 void PlayerCorpseDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force);
 
-// g_<gametype>_str:
-// If 0, default is used.
-// If <0, 0 is used.
-// Otherwise, g_str (default value) is used.
-// For consistency, negative values there are mapped to zero too.
-#define GAMETYPE_DEFAULTED_SETTING(str) \
-       ((gametype_setting_tmp = cvar(strcat("g_", GetGametype(), "_" #str))), \
-       (gametype_setting_tmp < 0) ? 0 \
-       : (gametype_setting_tmp == 0 || autocvar_g_respawn_delay_forced) ? max(0, autocvar_g_##str) \
-       : gametype_setting_tmp)
-
-void calculate_player_respawn_time(entity this);
-
 void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force);
 
 bool PlayerHeal(entity targ, entity inflictor, float amount, float limit);
index dd9e42a24687f49fd0a7c3d9e9d3be93b498194e..23d1e5972ffe74f86298f5fb22f206635bcfe49d 100644 (file)
@@ -2,6 +2,8 @@
 
 #include <server/miscfunctions.qh>
 
+#define INDEPENDENT_ATTACK_FINISHED 1
+
 // there is 2 weapon tics that can run in one server frame
 const int W_TICSPERFRAME = 2;
 
@@ -20,6 +22,15 @@ entity weapon_dropevent_item;
 .int old_clip_load;
 .int clip_size;
 
+.float attack_finished_for[REGISTRY_MAX(Weapons) * MAX_WEAPONSLOTS];
+.float attack_finished_single[MAX_WEAPONSLOTS];
+#if INDEPENDENT_ATTACK_FINISHED
+#define ATTACK_FINISHED_FOR(ent, w, slot) ((ent).(attack_finished_for[((w) - WEP_FIRST) * MAX_WEAPONSLOTS + (slot)]))
+#else
+#define ATTACK_FINISHED_FOR(ent, w, slot) ((ent).attack_finished_single[slot])
+#endif
+#define ATTACK_FINISHED(ent, w) ATTACK_FINISHED_FOR(ent, ent.(w).m_weapon.m_id, weaponslot(w))
+
 void CL_SpawnWeaponentity(entity e, .entity weaponentity);
 
 void w_clear(Weapon thiswep, entity actor, .entity weaponentity, int fire);