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 4cffb0c..d0e13c1 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 40870a7..d13ec1a 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 baf2131..2941564 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 c3f2af0..4b852d5 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 a0e35e0..784b335 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 a868eb4..b2ee42e 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 e031222..0696966 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 210e971..65935cd 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 4990ed7..c0d3898 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 2f380ae..328726d 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 c36f033..9aebfeb 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 88d531a..5dddc2f 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 1333b23..8a62664 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 514b347..0232c30 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 dd9e42a..23d1e59 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);