]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Replace some of the remaining cvar globals with autocvars, allows changing a few...
authorMario <mario.mario@y7mail.com>
Wed, 23 Sep 2020 08:15:18 +0000 (18:15 +1000)
committerMario <mario.mario@y7mail.com>
Wed, 23 Sep 2020 08:15:18 +0000 (18:15 +1000)
30 files changed:
qcsrc/common/effects/qc/globalsound.qc
qcsrc/common/mutators/mutator/nades/nades.qc
qcsrc/common/mutators/mutator/overkill/okhmg.qc
qcsrc/common/mutators/mutator/overkill/okmachinegun.qc
qcsrc/common/mutators/mutator/overkill/oknex.qc
qcsrc/common/mutators/mutator/overkill/okrpc.qc
qcsrc/common/mutators/mutator/overkill/okshotgun.qc
qcsrc/common/physics/player.qc
qcsrc/common/sounds/all.qh
qcsrc/common/weapons/calculations.qc
qcsrc/common/weapons/weapon/crylink.qc
qcsrc/common/weapons/weapon/hagar.qc
qcsrc/ecs/systems/sv_physics.qc
qcsrc/server/autocvars.qh
qcsrc/server/bot/default/navigation.qc
qcsrc/server/cheats.qc
qcsrc/server/client.qc
qcsrc/server/client.qh
qcsrc/server/command/cmd.qc
qcsrc/server/command/common.qc
qcsrc/server/damage.qc
qcsrc/server/items/items.qh
qcsrc/server/main.qc
qcsrc/server/main.qh
qcsrc/server/miscfunctions.qc
qcsrc/server/miscfunctions.qh
qcsrc/server/utils.qh
qcsrc/server/weapons/tracing.qc
qcsrc/server/weapons/weaponsystem.qc
qcsrc/server/world.qh

index afc366ba0c2796bba55a73860224bf8c420a861c..8e671b17d755c574d72c8eac4c0b997567154cca 100644 (file)
                                {
                                        if (voicetype == VOICETYPE_AUTOTAUNT)
                                        {
-                                               if (!sv_autotaunt) break;
+                                               if (!autocvar_sv_autotaunt) break;
                                        }
                                        else if (IS_PLAYER(this) && !IS_DEAD(this))
                                                animdecide_setaction(this, ANIMACTION_TAUNT, true);
 
-                                       if (!sv_taunt) break;
+                                       if (!autocvar_sv_taunt) break;
                                        if (autocvar_sv_gentle) break;
                                        float tauntrand = 0;
                                        if (voicetype == VOICETYPE_AUTOTAUNT) tauntrand = random();
index bd539aa8e68bf84451c76eab1ec82276e98c4e37..64c67bd5434d912d4712ad6c051466708dd831db 100644 (file)
@@ -1208,7 +1208,7 @@ void nades_CheckThrow(entity this)
                        _force /= autocvar_g_nades_nade_lifetime;
                        _force = autocvar_g_nades_nade_minforce + (_force * (autocvar_g_nades_nade_maxforce - autocvar_g_nades_nade_minforce));
                        vector dir = (v_forward * 0.75 + v_up * 0.2 + v_right * 0.05);
-                       dir = W_CalculateSpread(dir, autocvar_g_nades_spread, g_weaponspreadfactor, autocvar_g_projectiles_spread_style);
+                       dir = W_CalculateSpread(dir, autocvar_g_nades_spread, autocvar_g_weaponspreadfactor, autocvar_g_projectiles_spread_style);
                        toss_nade(this, true, dir * _force, 0);
                }
        }
@@ -1252,7 +1252,7 @@ CLASS(NadeOffhand, OffhandWeapon)
                                _force /= autocvar_g_nades_nade_lifetime;
                                _force = autocvar_g_nades_nade_minforce + (_force * (autocvar_g_nades_nade_maxforce - autocvar_g_nades_nade_minforce));
                                vector dir = (v_forward * 0.7 + v_up * 0.2 + v_right * 0.1);
-                               dir = W_CalculateSpread(dir, autocvar_g_nades_spread, g_weaponspreadfactor, autocvar_g_projectiles_spread_style);
+                               dir = W_CalculateSpread(dir, autocvar_g_nades_spread, autocvar_g_weaponspreadfactor, autocvar_g_projectiles_spread_style);
                                toss_nade(player, false, dir * _force, 0);
                        }
                }
index 31db0c4db92e2663a54f0b3a9f0069220a8848a8..210b77ec4afdef8804de3e0bb71cf2d579421700 100644 (file)
@@ -73,7 +73,7 @@ METHOD(OverkillHeavyMachineGun, wr_think, void(entity thiswep, entity actor, .en
                        FOREACH_CLIENT(true, LAMBDA(
                                if (it == actor || (IS_SPEC(it) && it.enemy == actor))
                                {
-                                       wframe_send(it, actor.(weaponentity), WFRAME_FIRE2, g_weaponratefactor, true);
+                                       wframe_send(it, actor.(weaponentity), WFRAME_FIRE2, autocvar_g_weaponratefactor, true);
                                }
                        ));
                        animdecide_setaction(actor, ANIMACTION_SHOOT, true);
index 9ce9a2901856e313dd6d2c07f06f3412fb6a7e7d..597d17e2e1ea87f3732bd5ea63ad9737fd537268 100644 (file)
@@ -67,7 +67,7 @@ METHOD(OverkillMachineGun, wr_think, void(entity thiswep, entity actor, .entity
                        FOREACH_CLIENT(true, LAMBDA(
                                if (it == actor || (IS_SPEC(it) && it.enemy == actor))
                                {
-                                       wframe_send(it, actor.(weaponentity), WFRAME_FIRE2, g_weaponratefactor, true);
+                                       wframe_send(it, actor.(weaponentity), WFRAME_FIRE2, autocvar_g_weaponratefactor, true);
                                }
                        ));
                        animdecide_setaction(actor, ANIMACTION_SHOOT, true);
index 55afbe45c1112e4f2fdf04632f62dd71becdbbb5..3ece45bdee273998fd29d8cff20fdf556e33064e 100644 (file)
@@ -154,7 +154,7 @@ METHOD(OverkillNex, wr_think, void(entity thiswep, entity actor, .entity weapone
                        FOREACH_CLIENT(true, LAMBDA(
                                if (it == actor || (IS_SPEC(it) && it.enemy == actor))
                                {
-                                       wframe_send(it, actor.(weaponentity), WFRAME_FIRE2, g_weaponratefactor, true);
+                                       wframe_send(it, actor.(weaponentity), WFRAME_FIRE2, autocvar_g_weaponratefactor, true);
                                }
                        ));
                        animdecide_setaction(actor, ANIMACTION_SHOOT, true);
index 25704934f6fc0d73512b780c58f794284a456134..ea700a9ca37a3a85fc27780223d0d67561bd26cb 100644 (file)
@@ -148,7 +148,7 @@ METHOD(OverkillRocketPropelledChainsaw, wr_think, void(entity thiswep, entity ac
                        FOREACH_CLIENT(true, LAMBDA(
                                if (it == actor || (IS_SPEC(it) && it.enemy == actor))
                                {
-                                       wframe_send(it, actor.(weaponentity), WFRAME_FIRE2, g_weaponratefactor, true);
+                                       wframe_send(it, actor.(weaponentity), WFRAME_FIRE2, autocvar_g_weaponratefactor, true);
                                }
                        ));
                        animdecide_setaction(actor, ANIMACTION_SHOOT, true);
index da4c4749d04763e4fab32d8624e00ab11e1430d3..627c14f20d47142047b98680bad575d35d20548f 100644 (file)
@@ -28,7 +28,7 @@ METHOD(OverkillShotgun, wr_think, void(entity thiswep, entity actor, .entity wea
                        FOREACH_CLIENT(true, LAMBDA(
                                if (it == actor || (IS_SPEC(it) && it.enemy == actor))
                                {
-                                       wframe_send(it, actor.(weaponentity), WFRAME_FIRE2, g_weaponratefactor, true);
+                                       wframe_send(it, actor.(weaponentity), WFRAME_FIRE2, autocvar_g_weaponratefactor, true);
                                }
                        ));
                        animdecide_setaction(actor, ANIMACTION_SHOOT, true);
index 7e63442ca2bea6fb7bfeffb4b02f32107c9139b4..5e9460c83109e4aa399c7199792a63c2cc0a32b8 100644 (file)
@@ -650,7 +650,7 @@ void PM_check_hitground(entity this)
 void PM_Footsteps(entity this)
 {
 #ifdef SVQC
-       if (!g_footsteps) return;
+       if (!autocvar_g_footsteps) return;
        if (IS_DUCKED(this)) return;
        if (time >= this.lastground + 0.2) return;
        if (vdist(this.velocity, <=, autocvar_sv_maxspeed * 0.6)) return;
index 6d011e21ad0b3f9cb29102fc438fca1e47233b7c..2a0d7ac4f04645600541ede6d9d8c704ab45b70d 100644 (file)
@@ -2,6 +2,28 @@
 
 #include "sound.qh"
 
+#ifdef SVQC
+void soundat(entity e, vector o, float chan, string samp, float vol, float _atten);
+
+void stopsoundto(float _dest, entity e, float chan);
+
+void soundtoat(float _dest, entity e, vector o, float chan, string samp, float vol, float _atten, float _pitch);
+
+bool sound_allowed(int dest, entity e);
+
+float spamsound(entity e, float chan, Sound samp, float vol, float _atten);
+
+void play2(entity e, string filename);
+
+void play2all(string samp);
+
+void play2team(float t, string filename);
+
+void soundto(float dest, entity e, float chan, string samp, float vol, float atten, float _pitch);
+
+void stopsound(entity e, float chan);
+#endif
+
 REGISTRY(Sounds, BITS(9))
 REGISTER_REGISTRY(Sounds)
 
index 3323d8e36a5372eb6041e2348010a735b5f6e251..cd2d925bc56004223c86899c0c1b66e07db0c8f5 100644 (file)
@@ -189,7 +189,7 @@ vector W_CalculateSpread(vector forward, float spread, float spreadfactor, float
        float sigma;
        vector v1 = '0 0 0', v2;
        float dx, dy, r;
-       spread *= spreadfactor; //g_weaponspreadfactor;
+       spread *= spreadfactor; //autocvar_g_weaponspreadfactor;
        if(spread <= 0)
                return forward;
 
index 51d17575074cfe405ca1afe5896de162655c517b..5458a2496b92e9ab241660b0079fdcad09324092 100644 (file)
@@ -357,7 +357,7 @@ void W_Crylink_Attack(Weapon thiswep, entity actor, .entity weaponentity)
                        s.y = v_forward.x;
                        s.z = v_forward.y;
                }
-               s = s * WEP_CVAR_PRI(crylink, spread) * g_weaponspreadfactor;
+               s = s * WEP_CVAR_PRI(crylink, spread) * autocvar_g_weaponspreadfactor;
                W_SetupProjVelocity_Explicit(proj, w_shotdir + right * s.y + up * s.z, v_up, WEP_CVAR_PRI(crylink, speed), 0, 0, 0, false);
                settouch(proj, W_Crylink_Touch);
 
@@ -471,12 +471,12 @@ void W_Crylink_Attack2(Weapon thiswep, entity actor, .entity weaponentity)
                                s.y = v_forward.x;
                                s.z = v_forward.y;
                        }
-                       s = s * WEP_CVAR_SEC(crylink, spread) * g_weaponspreadfactor;
+                       s = s * WEP_CVAR_SEC(crylink, spread) * autocvar_g_weaponspreadfactor;
                        s = w_shotdir + right * s.y + up * s.z;
                }
                else
                {
-                       s = (w_shotdir + (((counter + 0.5) / shots) * 2 - 1) * v_right * WEP_CVAR_SEC(crylink, spread) * g_weaponspreadfactor);
+                       s = (w_shotdir + (((counter + 0.5) / shots) * 2 - 1) * v_right * WEP_CVAR_SEC(crylink, spread) * autocvar_g_weaponspreadfactor);
                }
 
                W_SetupProjVelocity_Explicit(proj, s, v_up, WEP_CVAR_SEC(crylink, speed), 0, 0, 0, false);
index 73cb2b8b97afbe57ed97dc22255f5118b8a86eba..bfda2124de9119b3c7d87804a25f895a88786510 100644 (file)
@@ -221,7 +221,7 @@ void W_Hagar_Attack2_Load_Release(Weapon thiswep, entity actor, .entity weaponen
                // per-shot spread calculation: the more shots there are, the less spread is applied (based on the bias cvar)
                spread_pershot = ((shots - 1) / (WEP_CVAR_SEC(hagar, load_max) - 1));
                spread_pershot = (1 - (spread_pershot * WEP_CVAR_SEC(hagar, load_spread_bias)));
-               spread_pershot = (WEP_CVAR_SEC(hagar, spread) * spread_pershot * g_weaponspreadfactor);
+               spread_pershot = (WEP_CVAR_SEC(hagar, spread) * spread_pershot * autocvar_g_weaponspreadfactor);
 
                // pattern spread calculation
                s = '0 0 0';
@@ -233,7 +233,7 @@ void W_Hagar_Attack2_Load_Release(Weapon thiswep, entity actor, .entity weaponen
                        s.y = v_forward.x;
                        s.z = v_forward.y;
                }
-               s = s * WEP_CVAR_SEC(hagar, load_spread) * g_weaponspreadfactor;
+               s = s * WEP_CVAR_SEC(hagar, load_spread) * autocvar_g_weaponspreadfactor;
 
                W_SetupProjVelocity_Explicit(missile, w_shotdir + right * s.y + up * s.z, v_up, WEP_CVAR_SEC(hagar, speed), 0, 0, spread_pershot, false);
 
index 175c57c4844de5206959de1031ad4adff23577fa..31304012607b96c6f12169559489402042953d5b 100644 (file)
@@ -22,7 +22,7 @@ void sys_phys_monitor(entity this, float dt)
 {
        int buttons = PHYS_INPUT_BUTTON_MASK(this);
        anticheat_physics(this);
-       if (sv_maxidle > 0) {
+       if (autocvar_sv_maxidle > 0) {
                if (buttons != CS(this).buttons_old
                    || CS(this).movement != CS(this).movement_old
                    || this.v_angle != CS(this).v_angle_old) { CS(this).parm_idlesince = time; }
index 99077dcfe7b237fc8e1c5e59f888e6d666c4feb5..83ea702ae729f91ca1465aa2ad5254510bb3ef8b 100644 (file)
@@ -534,3 +534,22 @@ bool autocvar_g_weaponswitch_debug;
 bool autocvar_g_weaponswitch_debug_alternate;
 bool autocvar_g_allow_checkpoints;
 bool autocvar_sv_q3defragcompat_changehitbox = false;
+int autocvar_sv_clones;
+bool autocvar_g_footsteps;
+float autocvar_sv_maxidle;
+bool autocvar_sv_maxidle_spectatorsareidle;
+int autocvar_sv_maxidle_slots;
+bool autocvar_sv_maxidle_slots_countbots;
+bool autocvar_sv_autotaunt;
+bool autocvar_g_warmup_allguns;
+bool autocvar_g_warmup_allow_timeout;
+float autocvar_g_weaponspreadfactor;
+float autocvar_g_weaponforcefactor;
+float autocvar_g_weapondamagefactor;
+float autocvar_g_weaponratefactor;
+float autocvar_g_weaponspeedfactor;
+float autocvar_sv_foginterval;
+bool autocvar_sv_ready_restart_repeatable;
+bool autocvar_g_jetpack;
+bool autocvar_sv_taunt;
+bool autocvar_sv_ready_restart;
index cf7cd99c2199f6e49b1761d5c060404b51dde7ad..ff361388b297b988548dffa4c1c125817f79eb91 100644 (file)
@@ -1462,8 +1462,7 @@ bool navigation_routetogoal(entity this, entity e, vector startposition)
                this.wp_goal_prev0 = e;
        }
 
-       if(g_jetpack)
-       if(e==this.navigation_jetpack_goal)
+       if((this.items & IT_JETPACK) && e == this.navigation_jetpack_goal)
                return true;
 
        // if it can reach the goal there is nothing more to do
index 9d5cc1d42e3a051760ad5c528382d6448b465a2a..eb0b95e078ec6d2a1ca47cc411291fc6615cc3fb 100644 (file)
@@ -72,7 +72,7 @@ float CheatsAllowed(entity this, float i, int argc, float fr) // the cheat gets
                return 0;
 
        if(i == CHIMPULSE_CLONE_MOVING.impulse || i == CHIMPULSE_CLONE_STANDING.impulse)
-               if(this.lip < sv_clones)
+               if(this.lip < autocvar_sv_clones)
                        return 1;
 
        // haha
index 5aca281ae053ff29166d093b474b202a215ba7cf..3afbf4dedf58873d0c1540d8ad667c575036a07d 100644 (file)
@@ -862,7 +862,7 @@ void ClientInit_misc(entity this)
        WriteInt24_t(channel, compressShotOrigin(arc_shotorigin[2]));
        WriteInt24_t(channel, compressShotOrigin(arc_shotorigin[3]));
 
-       if(sv_foginterval && world.fog != "")
+       if(autocvar_sv_foginterval && world.fog != "")
                WriteString(channel, world.fog);
        else
                WriteString(channel, "");
@@ -935,7 +935,7 @@ void DecodeLevelParms(entity this)
                CS(this).parm_idlesince = time;
 
        // whatever happens, allow 60 seconds of idling directly after connect for map loading
-       CS(this).parm_idlesince = max(CS(this).parm_idlesince, time - sv_maxidle + 60);
+       CS(this).parm_idlesince = max(CS(this).parm_idlesince, time - autocvar_sv_maxidle + 60);
 
        MUTATOR_CALLHOOK(DecodeLevelParms);
 }
@@ -1048,7 +1048,7 @@ string getwelcomemessage(entity this)
                modifications = strcat(modifications, ", Low gravity");
        if(g_weapon_stay && !g_cts)
                modifications = strcat(modifications, ", Weapons stay");
-       if(g_jetpack)
+       if(autocvar_g_jetpack)
                modifications = strcat(modifications, ", Jet pack");
        if(autocvar_g_powerups == 0)
                modifications = strcat(modifications, ", No powerups");
@@ -1167,7 +1167,7 @@ void ClientConnect(entity this)
                        stuffcmd(this, "cl_cmd settemp chase_active 1\n");
        }
 
-       if (!sv_foginterval && world.fog != "")
+       if (!autocvar_sv_foginterval && world.fog != "")
                stuffcmd(this, strcat("\nfog ", world.fog, "\nr_fog_exp2 0\nr_drawfog 1\n"));
 
        if (autocvar_sv_teamnagger && !(autocvar_bot_vs_human && AvailableTeams() == 2))
@@ -2754,21 +2754,21 @@ void PlayerPostThink (entity this)
 {
        Player_Physics(this);
 
-       if (sv_maxidle > 0)
+       if (autocvar_sv_maxidle > 0)
        if (frametime) // WORKAROUND: only use dropclient in server frames (frametime set). Never use it in cl_movement frames (frametime zero).
        if (IS_REAL_CLIENT(this))
-       if (IS_PLAYER(this) || sv_maxidle_spectatorsareidle)
+       if (IS_PLAYER(this) || autocvar_sv_maxidle_spectatorsareidle)
        {
                int totalClients = 0;
-               if(sv_maxidle_slots > 0)
+               if(autocvar_sv_maxidle_slots > 0)
                {
-                       FOREACH_CLIENT(IS_REAL_CLIENT(it) || sv_maxidle_slots_countbots,
+                       FOREACH_CLIENT(IS_REAL_CLIENT(it) || autocvar_sv_maxidle_slots_countbots,
                        {
                                ++totalClients;
                        });
                }
 
-               if (sv_maxidle_slots > 0 && (maxclients - totalClients) > sv_maxidle_slots)
+               if (autocvar_sv_maxidle_slots > 0 && (maxclients - totalClients) > autocvar_sv_maxidle_slots)
                { /* do nothing */ }
                else if (time - CS(this).parm_idlesince < 1) // instead of (time == this.parm_idlesince) to support sv_maxidle <= 10
                {
@@ -2780,8 +2780,8 @@ void PlayerPostThink (entity this)
                }
                else
                {
-                       float timeleft = ceil(sv_maxidle - (time - CS(this).parm_idlesince));
-                       if (timeleft == min(10, sv_maxidle - 1)) { // - 1 to support sv_maxidle <= 10
+                       float timeleft = ceil(autocvar_sv_maxidle - (time - CS(this).parm_idlesince));
+                       if (timeleft == min(10, autocvar_sv_maxidle - 1)) { // - 1 to support sv_maxidle <= 10
                                if (!CS(this).idlekick_lasttimeleft)
                                        Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_DISCONNECT_IDLING, timeleft);
                        }
index e288bebfcb27ad10248c46fdd8ec2acbb22f1ecd..a4309822d692d7e2bc8218a275fee8268cc801bc 100644 (file)
@@ -297,12 +297,6 @@ const int SVC_SETVIEW = 5; // TODO: move to dpdefs where this belongs!
 .float pauserotarmor_finished;
 .float pauserotfuel_finished;
 
-// idle kicking
-float sv_maxidle;
-float sv_maxidle_spectatorsareidle;
-int sv_maxidle_slots;
-bool sv_maxidle_slots_countbots;
-
 // g_<gametype>_str:
 // If 0, default is used.
 // If <0, 0 is used.
index fe92d36673552852495602cd46b6d798450b752f..67ac6d641c5f58bc8c67eaca8dab6b930f28394b 100644 (file)
@@ -384,9 +384,9 @@ void ClientCommand_ready(entity caller, int request)  // todo: anti-spam for tog
                {
                        if (IS_CLIENT(caller))
                        {
-                               if (warmup_stage || sv_ready_restart || g_race_qualifying == 2)
+                               if (warmup_stage || autocvar_sv_ready_restart || g_race_qualifying == 2)
                                {
-                                       if (!readyrestart_happened || sv_ready_restart_repeatable)
+                                       if (!readyrestart_happened || autocvar_sv_ready_restart_repeatable)
                                        {
                                                if (time < game_starttime) // game is already restarting
                                                        return;
index 0f59802dd5960e3bdfb72230a7d2d877584ee00a..01fb5ad48048a6e7605636ffa0c37211a73db5f2 100644 (file)
@@ -720,7 +720,7 @@ void CommonCommand_timeout(int request, entity caller)  // DEAR GOD THIS COMMAND
                                {
                                        print_to(caller, "^7Error: You can not call a timeout while a vote is active.");
                                }
-                               else if (warmup_stage && !g_warmup_allow_timeout)
+                               else if (warmup_stage && !autocvar_g_warmup_allow_timeout)
                                {
                                        print_to(caller, "^7Error: You can not call a timeout in warmup-stage.");
                                }
index f799e96f7451b3fcd7ee563afdab5199388ed5f2..02a795bba4c3d0e328ad025af3e0259e13163b91 100644 (file)
@@ -686,11 +686,11 @@ void Damage(entity targ, entity inflictor, entity attacker, float damage, int de
 
                if (!DEATH_ISSPECIAL(deathtype))
                {
-                       damage *= g_weapondamagefactor;
-                       mirrordamage *= g_weapondamagefactor;
-                       complainteamdamage *= g_weapondamagefactor;
-                       force = force * g_weaponforcefactor;
-                       mirrorforce *= g_weaponforcefactor;
+                       damage *= autocvar_g_weapondamagefactor;
+                       mirrordamage *= autocvar_g_weapondamagefactor;
+                       complainteamdamage *= autocvar_g_weapondamagefactor;
+                       force = force * autocvar_g_weaponforcefactor;
+                       mirrorforce *= autocvar_g_weaponforcefactor;
                }
 
                // should this be changed at all? If so, in what way?
index 8dbb47283d59532ba96cc952dfbc6b503923eb61..49fea39d092e0bb74b2336acaba73e99cba57921 100644 (file)
@@ -112,3 +112,6 @@ float GiveItems(entity e, float beginarg, float endarg);
 
 IntrusiveList g_items;
 STATIC_INIT(g_items) { g_items = IL_NEW(); }
+
+#define ITEM_TOUCH_NEEDKILL() (((trace_dpstartcontents | trace_dphitcontents) & DPCONTENTS_NODROP) || (trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY))
+#define ITEM_DAMAGE_NEEDKILL(dt) (((dt) == DEATH_HURTTRIGGER.m_id) || ((dt) == DEATH_SLIME.m_id) || ((dt) == DEATH_LAVA.m_id) || ((dt) == DEATH_SWAMP.m_id))
index 359456b393f4fd25a69aabcce7968609e9603a36..3db2a0f8e7c9ea227126aec2f1d26629a5fbf7d6 100644 (file)
@@ -178,6 +178,58 @@ void dedicated_print(string input)
        if (server_is_dedicated) print(input);
 }
 
+void make_safe_for_remove(entity e)
+{
+    if (e.initialize_entity)
+    {
+        entity ent, prev = NULL;
+        for (ent = initialize_entity_first; ent; )
+        {
+            if ((ent == e) || ((ent.classname == "initialize_entity") && (ent.enemy == e)))
+            {
+                //print("make_safe_for_remove: getting rid of initializer ", etos(ent), "\n");
+                // skip it in linked list
+                if (prev)
+                {
+                    prev.initialize_entity_next = ent.initialize_entity_next;
+                    ent = prev.initialize_entity_next;
+                }
+                else
+                {
+                    initialize_entity_first = ent.initialize_entity_next;
+                    ent = initialize_entity_first;
+                }
+            }
+            else
+            {
+                prev = ent;
+                ent = ent.initialize_entity_next;
+            }
+        }
+    }
+}
+
+.float remove_except_protected_forbidden;
+void remove_except_protected(entity e)
+{
+       if(e.remove_except_protected_forbidden)
+               error("not allowed to remove this at this point");
+       builtin_remove(e);
+}
+
+void remove_unsafely(entity e)
+{
+    if(e.classname == "spike")
+        error("Removing spikes is forbidden (crylink bug), please report");
+    builtin_remove(e);
+}
+
+void remove_safely(entity e)
+{
+    make_safe_for_remove(e);
+    builtin_remove(e);
+}
+
 /*
 =============
 StartFrame
index e89d68304fca70e855c4d7a53377942db095f15d..515ec62e61fba5b1336a411c7bfa8d397929c254 100644 (file)
@@ -3,6 +3,10 @@
 /** print(), but only print if the server is not local */
 void dedicated_print(string input);
 
+void remove_safely(entity e);
+
+void remove_unsafely(entity e);
+
 bool expr_evaluate(string s);
 
 #ifdef PROFILING
index cc5c2d139eb83eb14ed5fb65e9c7991589d0277f..df830d13edd7467566fa5631b2692588b21a10ba 100644 (file)
@@ -714,7 +714,7 @@ void readplayerstartcvars()
                warmup_start_weapons_default = '0 0 0';
                warmup_start_weapons_defaultmask = '0 0 0';
                FOREACH(Weapons, it != WEP_Null, {
-                       int w = want_weapon(it, g_warmup_allguns);
+                       int w = want_weapon(it, autocvar_g_warmup_allguns);
                        WepSet s = it.m_wepset;
                        if(w & 1)
                                warmup_start_weapons |= s;
@@ -725,7 +725,7 @@ void readplayerstartcvars()
                });
        }
 
-       if (g_jetpack)
+       if (autocvar_g_jetpack)
                start_items |= ITEM_Jetpack.m_itemid;
 
        MUTATOR_CALLHOOK(SetStartItems);
@@ -837,59 +837,6 @@ PRECACHE(PlayerModels)
     }
 }
 
-
-void make_safe_for_remove(entity e)
-{
-    if (e.initialize_entity)
-    {
-        entity ent, prev = NULL;
-        for (ent = initialize_entity_first; ent; )
-        {
-            if ((ent == e) || ((ent.classname == "initialize_entity") && (ent.enemy == e)))
-            {
-                //print("make_safe_for_remove: getting rid of initializer ", etos(ent), "\n");
-                // skip it in linked list
-                if (prev)
-                {
-                    prev.initialize_entity_next = ent.initialize_entity_next;
-                    ent = prev.initialize_entity_next;
-                }
-                else
-                {
-                    initialize_entity_first = ent.initialize_entity_next;
-                    ent = initialize_entity_first;
-                }
-            }
-            else
-            {
-                prev = ent;
-                ent = ent.initialize_entity_next;
-            }
-        }
-    }
-}
-
-.float remove_except_protected_forbidden;
-void remove_except_protected(entity e)
-{
-       if(e.remove_except_protected_forbidden)
-               error("not allowed to remove this at this point");
-       builtin_remove(e);
-}
-
-void remove_unsafely(entity e)
-{
-    if(e.classname == "spike")
-        error("Removing spikes is forbidden (crylink bug), please report");
-    builtin_remove(e);
-}
-
-void remove_safely(entity e)
-{
-    make_safe_for_remove(e);
-    builtin_remove(e);
-}
-
 void InitializeEntity(entity e, void(entity this) func, int order)
 {
     entity prev, cur;
index f79c9e84ac288f554137803f655e8e25c3923982..82618160a479588af2714f93c3d40fd087970447 100644 (file)
 
 void write_recordmarker(entity pl, float tstart, float dt);
 
-void play2all(string samp);
-
-void play2team(float t, string filename);
-
 void GetCvars_handleFloat(entity this, entity store, string thisname, float f, .float field, string name);
 
-float spamsound(entity e, float chan, Sound samp, float vol, float _atten);
-
 void GetCvars_handleString(entity this, entity store, string thisname, float f, .string field, string name);
 
 void precache_all_playermodels(string pattern);
 
-void soundat(entity e, vector o, float chan, string samp, float vol, float _atten);
-
 void InitializeEntitiesRun();
 
-void stopsoundto(float _dest, entity e, float chan);
-void soundtoat(float _dest, entity e, vector o, float chan, string samp, float vol, float _atten, float _pitch);
-
 void droptofloor(entity this);
 
 float trace_hits_box_1d(float end, float thmi, float thma);
@@ -60,8 +49,6 @@ string formatmessage(entity this, string msg);
 
 void GetCvars(entity this, entity store, int f);
 
-string GetMapname();
-
 float LostMovetypeFollow(entity ent);
 
 string uid2name(string myuid);
@@ -72,20 +59,10 @@ float MoveToRandomMapLocation(entity e, float goodcontents, float badcontents, f
 
 string NearestLocation(vector p);
 
-void play2(entity e, string filename);
-
 string playername(entity p, bool team_colorize);
 
-void remove_safely(entity e);
-
-void remove_unsafely(entity e);
-
 void SetMovetypeFollow(entity ent, entity e);
 
-void soundto(float dest, entity e, float chan, string samp, float vol, float atten, float _pitch);
-
-void stopsound(entity e, float chan);
-
 float tracebox_hits_box(vector start, vector mi, vector ma, vector end, vector thmi, vector thma);
 
 void traceline_antilag (entity source, vector v1, vector v2, float nomonst, entity forent, float lag);
@@ -94,41 +71,11 @@ void WarpZone_crosshair_trace(entity pl);
 
 void WarpZone_traceline_antilag (entity source, vector v1, vector v2, float nomonst, entity forent, float lag);
 
-#define IS_DEAD(s) ((s).deadflag != DEAD_NO)
-
-
-#define ITEM_TOUCH_NEEDKILL() (((trace_dpstartcontents | trace_dphitcontents) & DPCONTENTS_NODROP) || (trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY))
-#define ITEM_DAMAGE_NEEDKILL(dt) (((dt) == DEATH_HURTTRIGGER.m_id) || ((dt) == DEATH_SLIME.m_id) || ((dt) == DEATH_LAVA.m_id) || ((dt) == DEATH_SWAMP.m_id))
-
 #define PROJECTILE_TOUCH(e,t) MACRO_BEGIN if (WarpZone_Projectile_Touch(e,t)) return; MACRO_END
 
-#define CENTER_OR_VIEWOFS(ent) (ent.origin + (IS_PLAYER(ent) ? ent.view_ofs : ((ent.mins + ent.maxs) * 0.5)))
-
 // copies a string to a tempstring (so one can strunzone it)
 string strcat1(string s) = #115; // FRIK_FILE
 
-/*
-// NOTE: DO NOT USE THIS FUNCTION TOO OFTEN.
-// IT WILL MOST PROBABLY DESTROY _ALL_ OTHER TEMP
-// STRINGS AND TAKE QUITE LONG. haystack and needle MUST
-// BE CONSTANT OR strzoneD!
-float strstrofs(string haystack, string needle, float offset)
-{
-       float len, endpos;
-       string found;
-       len = strlen(needle);
-       endpos = strlen(haystack) - len;
-       while(offset <= endpos)
-       {
-               found = substring(haystack, offset, len);
-               if(found == needle)
-                       return offset;
-               offset = offset + 1;
-       }
-       return -1;
-}
-*/
-
 const float NUM_NEAREST_ENTITIES = 4;
 entity nearest_entity[NUM_NEAREST_ENTITIES];
 float nearest_length[NUM_NEAREST_ENTITIES];
@@ -147,11 +94,6 @@ float g_weaponarena;
 WepSet g_weaponarena_weapons;
 float g_weaponarena_random; // TODO
 string g_weaponarena_list;
-float g_weaponspeedfactor;
-float g_weaponratefactor;
-float g_weapondamagefactor;
-float g_weaponforcefactor;
-float g_weaponspreadfactor;
 
 WepSet start_weapons;
 WepSet start_weapons_default;
@@ -175,7 +117,7 @@ float start_armorvalue;
 WepSet warmup_start_weapons;
 WepSet warmup_start_weapons_default;
 WepSet warmup_start_weapons_defaultmask;
-#define WARMUP_START_WEAPONS ((g_warmup_allguns == 1) ? (warmup_start_weapons & (weaponsInMap | start_weapons)) : warmup_start_weapons)
+#define WARMUP_START_WEAPONS ((autocvar_g_warmup_allguns == 1) ? (warmup_start_weapons & (weaponsInMap | start_weapons)) : warmup_start_weapons)
 float warmup_start_ammo_shells;
 float warmup_start_ammo_nails;
 float warmup_start_ammo_rockets;
@@ -189,45 +131,20 @@ float g_weapon_stay;
 float want_weapon(entity weaponinfo, float allguns); // WEAPONTODO: what still needs done?
 void readplayerstartcvars();
 
-float sv_autotaunt;
-float sv_taunt;
-
-float g_footsteps, g_grappling_hook;
-float g_warmup_allguns;
-float g_warmup_allow_timeout;
+float g_grappling_hook;
 float warmup_stage;
-float g_jetpack;
 
-bool sv_ready_restart;
 bool sv_ready_restart_after_countdown;
-bool sv_ready_restart_repeatable;
-
-float sv_clones;
-float sv_foginterval;
 
 void readlevelcvars()
 {
        if(cvar("sv_allow_fullbright"))
                serverflags |= SERVERFLAG_ALLOW_FULLBRIGHT;
 
-       sv_clones = cvar("sv_clones");
-       sv_foginterval = cvar("sv_foginterval");
-       g_footsteps = cvar("g_footsteps");
-       g_jetpack = cvar("g_jetpack");
-       sv_maxidle = cvar("sv_maxidle");
-       sv_maxidle_spectatorsareidle = cvar("sv_maxidle_spectatorsareidle");
-       sv_maxidle_slots = cvar("sv_maxidle_slots");
-       sv_maxidle_slots_countbots = cvar("sv_maxidle_slots_countbots");
-       sv_autotaunt = cvar("sv_autotaunt");
-       sv_taunt = cvar("sv_taunt");
-       sv_ready_restart = cvar("sv_ready_restart");
        sv_ready_restart_after_countdown = cvar("sv_ready_restart_after_countdown");
-       sv_ready_restart_repeatable = cvar("sv_ready_restart_repeatable");
 
        warmup_stage = cvar("g_warmup");
        warmup_limit = cvar("g_warmup_limit");
-       g_warmup_allguns = cvar("g_warmup_allguns");
-       g_warmup_allow_timeout = cvar("g_warmup_allow_timeout");
 
        if(cvar("g_campaign"))
                warmup_stage = 0; // no warmup during campaign
@@ -247,12 +164,6 @@ void readlevelcvars()
        g_pickup_respawntimejitter_long = cvar("g_pickup_respawntimejitter_long");
        g_pickup_respawntimejitter_powerup = cvar("g_pickup_respawntimejitter_powerup");
 
-       g_weaponspeedfactor = cvar("g_weaponspeedfactor");
-       g_weaponratefactor = cvar("g_weaponratefactor");
-       g_weapondamagefactor = cvar("g_weapondamagefactor");
-       g_weaponforcefactor = cvar("g_weaponforcefactor");
-       g_weaponspreadfactor = cvar("g_weaponspreadfactor");
-
        g_pickup_shells = cvar("g_pickup_shells");
        g_pickup_shells_max = cvar("g_pickup_shells_max");
        g_pickup_nails = cvar("g_pickup_nails");
@@ -324,11 +235,6 @@ const int INITPRIO_LAST            = 99;
 .entity initialize_entity_next;
 entity initialize_entity_first;
 
-
-
-
-
-bool sound_allowed(int dest, entity e);
 void InitializeEntity(entity e, void(entity this) func, int order);
 
 IntrusiveList g_ctrace_changed;
index a37029590a220137294fd26392fd0425550d58d2..ae0c284fe5e0c626111fb3fa59415d5615dfc1be 100644 (file)
@@ -23,6 +23,9 @@ const string STR_OBSERVER = "observer";
 #define IS_TURRET(v) (v.turret_flags & TUR_FLAG_ISTURRET)
 
 #define IS_MOVABLE(v) ((IS_PLAYER(v) || IS_MONSTER(v)) && !STAT(FROZEN, v))
+#define IS_DEAD(s) ((s).deadflag != DEAD_NO)
+
+#define CENTER_OR_VIEWOFS(ent) (ent.origin + (IS_PLAYER(ent) ? ent.view_ofs : ((ent.mins + ent.maxs) * 0.5)))
 
 // NOTE: FOR_EACH_CLIENTSLOT deprecated! Use the following instead: FOREACH_CLIENTSLOT(true, { code; });
 // NOTE: FOR_EACH_CLIENT deprecated! Use the following instead: FOREACH_CLIENT(true, { code; });
index f4de0e1bf15996ac12aed1a31e64652493d96822..3e838265266dd4d44e0fdd4fbdc294587eeb1365 100644 (file)
@@ -196,7 +196,7 @@ void W_SetupProjVelocity_Explicit(entity proj, vector dir, vector upDir, float p
        mspercallsum -= gettime(GETTIME_HIRES);
        #endif
 
-       dir = W_CalculateSpread(dir, spread, g_weaponspreadfactor, autocvar_g_projectiles_spread_style);
+       dir = W_CalculateSpread(dir, spread, autocvar_g_weaponspreadfactor, autocvar_g_projectiles_spread_style);
 
        #if 0
        mspercallsum += gettime(GETTIME_HIRES);
index 7638813882d306ca3e67544c10290ed80231d866..487154fe36009147d099934de0fd30363517e66f 100644 (file)
@@ -31,8 +31,8 @@
 float W_WeaponRateFactor(entity this)
 {
        float t = 1;
-       if(g_weaponratefactor > 0)
-               t = 1.0 / g_weaponratefactor;
+       if(autocvar_g_weaponratefactor > 0)
+               t = 1.0 / autocvar_g_weaponratefactor;
 
        MUTATOR_CALLHOOK(WeaponRateFactor, t, this);
        t = M_ARGV(0, float);
@@ -42,7 +42,7 @@ float W_WeaponRateFactor(entity this)
 
 float W_WeaponSpeedFactor(entity this)
 {
-       float t = 1.0 * g_weaponspeedfactor;
+       float t = 1.0 * autocvar_g_weaponspeedfactor;
 
        MUTATOR_CALLHOOK(WeaponSpeedFactor, t, this);
        t = M_ARGV(0, float);
@@ -409,7 +409,7 @@ void weapon_thinkf(entity actor, .entity weaponentity, WFRAME fr, float t, void(
        {
                FOREACH_CLIENT(true, {
                        if(it == actor || (IS_SPEC(it) && it.enemy == actor))
-                               wframe_send(it, this, fr, g_weaponratefactor, restartanim);
+                               wframe_send(it, this, fr, autocvar_g_weaponratefactor, restartanim);
                });
        }
 
index 3bbaad68246e942d4288f379d326686a6cb970ae..f49346a1cd21d9ce5f1cc7d6a4206ea6a316f4e1 100644 (file)
@@ -60,6 +60,7 @@ void Map_MarkAsRecent(string m);
 float DoNextMapOverride(float reinit);
 void CheckRules_World();
 float RedirectionThink();
+string GetMapname();
 
 IntrusiveList g_moveables;
 STATIC_INIT(g_moveables) { g_moveables = IL_NEW(); }