]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Clean up some misplaced fields/globals in sv_main
authorMario <mario@smbclan.net>
Sat, 10 Aug 2019 14:19:09 +0000 (00:19 +1000)
committerMario <mario@smbclan.net>
Sat, 10 Aug 2019 14:19:09 +0000 (00:19 +1000)
qcsrc/server/defs.qh
qcsrc/server/g_hook.qc
qcsrc/server/g_hook.qh
qcsrc/server/g_world.qc
qcsrc/server/sv_main.qc
qcsrc/server/sv_main.qh

index 28a61cf1cd4120e270bd8fa491049d9f9e2e8f21..b52649a34ead3389310bb9ef544b4c3e4e1bc3d2 100644 (file)
@@ -298,11 +298,6 @@ string matchid;
 
 bool radar_showennemies;
 
 
 bool radar_showennemies;
 
-#ifdef PROFILING
-float client_cefc_accumulator;
-float client_cefc_accumulatortime;
-#endif
-
 .float weapon_load[Weapons_MAX];
 .int ammo_none; // used by the reloading system, must always be 0
 .int clip_load;
 .float weapon_load[Weapons_MAX];
 .int ammo_none; // used by the reloading system, must always be 0
 .int clip_load;
index 453cfc1e70d3664d1725e795c685c36c1e00cb69..b2b91bc02baf71cea1adf089e8236eea2a397667 100644 (file)
@@ -21,8 +21,6 @@
 #include "../lib/warpzone/common.qh"
 #include "../lib/warpzone/server.qh"
 
 #include "../lib/warpzone/common.qh"
 #include "../lib/warpzone/server.qh"
 
-.int state;
-
 /*============================================
 
       Wazat's Xonotic Grappling Hook
 /*============================================
 
       Wazat's Xonotic Grappling Hook
@@ -72,8 +70,6 @@ And you should be done!
 
 ============================================*/
 
 
 ============================================*/
 
-.float hook_length;
-
 void RemoveGrapplingHooks(entity pl)
 {
        if(pl.move_movetype == MOVETYPE_FLY)
 void RemoveGrapplingHooks(entity pl)
 {
        if(pl.move_movetype == MOVETYPE_FLY)
index c0df31662a7d5cea6c95584dd7a13bfd7d969dad..1ed78e2745d9d4a4cdfff18792f9399af50fb7e6 100644 (file)
@@ -8,12 +8,16 @@ void RemoveHook(entity this);
 // (note: you can change the hook impulse #'s to whatever you please)
 .float hook_time;
 
 // (note: you can change the hook impulse #'s to whatever you please)
 .float hook_time;
 
+.float hook_length;
+
 const float HOOK_FIRING = BIT(0);
 const float HOOK_REMOVING = BIT(1);
 const float HOOK_PULLING = BIT(2);
 const float HOOK_RELEASING = BIT(3);
 const float HOOK_WAITING_FOR_RELEASE = BIT(4);
 .float hook_state;
 const float HOOK_FIRING = BIT(0);
 const float HOOK_REMOVING = BIT(1);
 const float HOOK_PULLING = BIT(2);
 const float HOOK_RELEASING = BIT(3);
 const float HOOK_WAITING_FOR_RELEASE = BIT(4);
 .float hook_state;
+.int state;
 
 void GrappleHookInit();
 vector hook_shotorigin[4];
 
 void GrappleHookInit();
 vector hook_shotorigin[4];
+
index 98c274282e1219c28820ba97524e3da514451dc0..79b7d971b73e4d7231f5ba3592b415b1b43dd5cc 100644 (file)
@@ -984,22 +984,27 @@ float Map_Count, Map_Current;
 string Map_Current_Name;
 
 // NOTE: this now expects the map list to be already tokenized and the count in Map_Count
 string Map_Current_Name;
 
 // NOTE: this now expects the map list to be already tokenized and the count in Map_Count
-float GetMaplistPosition()
+int GetMaplistPosition()
 {
 {
-       float pos, idx;
-       string map;
-
-       map = GetMapname();
-       idx = autocvar_g_maplist_index;
+       string map = GetMapname();
+       int idx = autocvar_g_maplist_index;
 
        if(idx >= 0)
 
        if(idx >= 0)
+       {
                if(idx < Map_Count)
                if(idx < Map_Count)
+               {
                        if(map == argv(idx))
                        if(map == argv(idx))
+                       {
                                return idx;
                                return idx;
+                       }
+               }
+       }
 
 
-       for(pos = 0; pos < Map_Count; ++pos)
+       for(int pos = 0; pos < Map_Count; ++pos)
+       {
                if(map == argv(pos))
                        return pos;
                if(map == argv(pos))
                        return pos;
+       }
 
        // resume normal maplist rotation if current map is not in g_maplist
        return idx;
 
        // resume normal maplist rotation if current map is not in g_maplist
        return idx;
@@ -1234,10 +1239,8 @@ void Maplist_Init()
 
 string GetNextMap()
 {
 
 string GetNextMap()
 {
-       float nextMap;
-
        Maplist_Init();
        Maplist_Init();
-       nextMap = -1;
+       float nextMap = -1;
 
        if(nextMap == -1)
                if(autocvar_g_maplist_shuffle > 0)
 
        if(nextMap == -1)
                if(autocvar_g_maplist_shuffle > 0)
@@ -1332,9 +1335,7 @@ void GotoNextMap(float reinit)
                return;
        alreadychangedlevel = true;
 
                return;
        alreadychangedlevel = true;
 
-       string nextMap;
-
-       nextMap = GetNextMap();
+       string nextMap = GetNextMap();
        if(nextMap == "")
                error("Everything is broken - cannot find a next map. Please report this to the developers.");
        Map_Goto(reinit);
        if(nextMap == "")
                error("Everything is broken - cannot find a next map. Please report this to the developers.");
        Map_Goto(reinit);
index 9be3c18f6017183f8d81319e0cdb75e4a2d16e51..cd38d61e284c0e99ab7c7548a6aae68a2eb50b88 100644 (file)
 #include "../lib/warpzone/common.qh"
 #include "../lib/warpzone/server.qh"
 
 #include "../lib/warpzone/common.qh"
 #include "../lib/warpzone/server.qh"
 
-.float lastground;
-.int state;
-
 void CreatureFrame_hotliquids(entity this)
 {
 void CreatureFrame_hotliquids(entity this)
 {
-       if (this.dmgtime < time)
+       if(this.dmgtime <= time)
        {
        {
-               this.dmgtime = time + autocvar_g_balance_contents_damagerate;
+               return;
+       }
 
 
-               if (this.flags & FL_PROJECTILE)
-               {
-                       if (this.watertype == CONTENT_LAVA)
-                               Damage (this, NULL, NULL, autocvar_g_balance_contents_projectiledamage * autocvar_g_balance_contents_damagerate * this.waterlevel, DEATH_LAVA.m_id, DMG_NOWEP, this.origin, '0 0 0');
-                       else if (this.watertype == CONTENT_SLIME)
-                               Damage (this, NULL, NULL, autocvar_g_balance_contents_projectiledamage * autocvar_g_balance_contents_damagerate * this.waterlevel, DEATH_SLIME.m_id, DMG_NOWEP, this.origin, '0 0 0');
-               }
-               else
+       this.dmgtime = time + autocvar_g_balance_contents_damagerate;
+
+       if (this.flags & FL_PROJECTILE)
+       {
+               if (this.watertype == CONTENT_LAVA)
+                       Damage (this, NULL, NULL, autocvar_g_balance_contents_projectiledamage * autocvar_g_balance_contents_damagerate * this.waterlevel, DEATH_LAVA.m_id, DMG_NOWEP, this.origin, '0 0 0');
+               else if (this.watertype == CONTENT_SLIME)
+                       Damage (this, NULL, NULL, autocvar_g_balance_contents_projectiledamage * autocvar_g_balance_contents_damagerate * this.waterlevel, DEATH_SLIME.m_id, DMG_NOWEP, this.origin, '0 0 0');
+       }
+       else
+       {
+               if (this.watertype == CONTENT_LAVA)
                {
                {
-                       if (this.watertype == CONTENT_LAVA)
+                       if (this.watersound_finished < time)
                        {
                        {
-                               if (this.watersound_finished < time)
-                               {
-                                       this.watersound_finished = time + 0.5;
-                                       sound (this, CH_PLAYER_SINGLE, SND_LAVA, VOL_BASE, ATTEN_NORM);
-                               }
-                               Damage (this, NULL, NULL, autocvar_g_balance_contents_playerdamage_lava * autocvar_g_balance_contents_damagerate * this.waterlevel, DEATH_LAVA.m_id, DMG_NOWEP, this.origin, '0 0 0');
-                               if(autocvar_g_balance_contents_playerdamage_lava_burn)
-                                       Fire_AddDamage(this, NULL, autocvar_g_balance_contents_playerdamage_lava_burn * this.waterlevel, autocvar_g_balance_contents_playerdamage_lava_burn_time * this.waterlevel, DEATH_LAVA.m_id);
+                               this.watersound_finished = time + 0.5;
+                               sound (this, CH_PLAYER_SINGLE, SND_LAVA, VOL_BASE, ATTEN_NORM);
                        }
                        }
-                       else if (this.watertype == CONTENT_SLIME)
+                       Damage (this, NULL, NULL, autocvar_g_balance_contents_playerdamage_lava * autocvar_g_balance_contents_damagerate * this.waterlevel, DEATH_LAVA.m_id, DMG_NOWEP, this.origin, '0 0 0');
+                       if(autocvar_g_balance_contents_playerdamage_lava_burn)
+                               Fire_AddDamage(this, NULL, autocvar_g_balance_contents_playerdamage_lava_burn * this.waterlevel, autocvar_g_balance_contents_playerdamage_lava_burn_time * this.waterlevel, DEATH_LAVA.m_id);
+               }
+               else if (this.watertype == CONTENT_SLIME)
+               {
+                       if (this.watersound_finished < time)
                        {
                        {
-                               if (this.watersound_finished < time)
-                               {
-                                       this.watersound_finished = time + 0.5;
-                                       sound (this, CH_PLAYER_SINGLE, SND_SLIME, VOL_BASE, ATTEN_NORM);
-                               }
-                               Damage (this, NULL, NULL, autocvar_g_balance_contents_playerdamage_slime * autocvar_g_balance_contents_damagerate * this.waterlevel, DEATH_SLIME.m_id, DMG_NOWEP, this.origin, '0 0 0');
+                               this.watersound_finished = time + 0.5;
+                               sound (this, CH_PLAYER_SINGLE, SND_SLIME, VOL_BASE, ATTEN_NORM);
                        }
                        }
+                       Damage (this, NULL, NULL, autocvar_g_balance_contents_playerdamage_slime * autocvar_g_balance_contents_damagerate * this.waterlevel, DEATH_SLIME.m_id, DMG_NOWEP, this.origin, '0 0 0');
                }
        }
 }
                }
        }
 }
@@ -96,35 +95,36 @@ void CreatureFrame_Liquids(entity this)
 
 void CreatureFrame_FallDamage(entity this)
 {
 
 void CreatureFrame_FallDamage(entity this)
 {
-       if(!IS_VEHICLE(this) && !(this.flags & FL_PROJECTILE)) // vehicles don't get falling damage
-       if(this.velocity || this.oldvelocity) // moving or has moved
+       if(IS_VEHICLE(this) || (this.flags & FL_PROJECTILE))
+               return; // vehicles and projectiles don't receive fall damage
+       if(!(this.velocity || this.oldvelocity))
+               return; // if the entity hasn't moved and isn't moving, then don't do anything
+
+       // check for falling damage
+       float velocity_len = vlen(this.velocity);
+       bool have_hook = false;
+       for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
        {
        {
-               // check for falling damage
-               float velocity_len = vlen(this.velocity);
-               bool have_hook = false;
-               for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
+           .entity weaponentity = weaponentities[slot];
+           if(this.(weaponentity).hook && this.(weaponentity).hook.state)
            {
            {
-               .entity weaponentity = weaponentities[slot];
-               if(this.(weaponentity).hook && this.(weaponentity).hook.state)
-               {
-                       have_hook = true;
-                       break;
-               }
+               have_hook = true;
+               break;
            }
            }
-               if(!have_hook)
-               {
-                       float dm = vlen(this.oldvelocity) - velocity_len; // dm is now the velocity DECREASE. Velocity INCREASE should never cause a sound or any damage.
-                       if (IS_DEAD(this))
-                               dm = (dm - autocvar_g_balance_falldamage_deadminspeed) * autocvar_g_balance_falldamage_factor;
-                       else
-                               dm = min((dm - autocvar_g_balance_falldamage_minspeed) * autocvar_g_balance_falldamage_factor, autocvar_g_balance_falldamage_maxdamage);
-                       if (dm > 0)
-                               Damage (this, NULL, NULL, dm, DEATH_FALL.m_id, DMG_NOWEP, this.origin, '0 0 0');
-               }
-
-               if(autocvar_g_maxspeed > 0 && velocity_len > autocvar_g_maxspeed)
-                       Damage (this, NULL, NULL, 100000, DEATH_SHOOTING_STAR.m_id, DMG_NOWEP, this.origin, '0 0 0');
        }
        }
+       if(!have_hook)
+       {
+               float dm = vlen(this.oldvelocity) - velocity_len; // dm is now the velocity DECREASE. Velocity INCREASE should never cause a sound or any damage.
+               if (IS_DEAD(this))
+                       dm = (dm - autocvar_g_balance_falldamage_deadminspeed) * autocvar_g_balance_falldamage_factor;
+               else
+                       dm = min((dm - autocvar_g_balance_falldamage_minspeed) * autocvar_g_balance_falldamage_factor, autocvar_g_balance_falldamage_maxdamage);
+               if (dm > 0)
+                       Damage (this, NULL, NULL, dm, DEATH_FALL.m_id, DMG_NOWEP, this.origin, '0 0 0');
+       }
+
+       if(autocvar_g_maxspeed > 0 && velocity_len > autocvar_g_maxspeed)
+               Damage (this, NULL, NULL, 100000, DEATH_SHOOTING_STAR.m_id, DMG_NOWEP, this.origin, '0 0 0');
 }
 
 void CreatureFrame_All()
 }
 
 void CreatureFrame_All()
index 93480cf282ec6c5377ac13197eea0dbe009ddfd2..46284fde2e51f134609dc067532d25428d8de487 100644 (file)
@@ -2,6 +2,11 @@
 
 bool expr_evaluate(string s);
 
 
 bool expr_evaluate(string s);
 
+#ifdef PROFILING
+float client_cefc_accumulator;
+float client_cefc_accumulatortime;
+#endif
+
 /*
 ==================
 main
 /*
 ==================
 main