]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Stop the powerup sound when the countdown to game start is over (also in this case...
authorterencehill <piuntn@gmail.com>
Wed, 27 Jan 2021 16:27:36 +0000 (17:27 +0100)
committerterencehill <piuntn@gmail.com>
Wed, 27 Jan 2021 16:27:36 +0000 (17:27 +0100)
qcsrc/server/client.qc
qcsrc/server/command/vote.qc

index 048d606bb5efcff781ab6d1dc645d64a3f01717f..0777297a22021deaec89a27152ae96b2de6367c9 100644 (file)
@@ -1444,6 +1444,19 @@ void play_countdown(entity this, float finished, Sound samp)
                                sound (this, CH_INFO, samp, VOL_BASE, ATTEN_NORM);
 }
 
+void player_powerups_remove_all(entity this)
+{
+       if (this.items & (ITEM_Strength.m_itemid | ITEM_Shield.m_itemid | IT_SUPERWEAPON))
+       {
+               if (time > game_starttime + 1)
+                       sound(this, CH_INFO, SND_POWEROFF, VOL_BASE, ATTEN_NORM);
+               stopsound(this, CH_TRIGGER_SINGLE); // get rid of the pickup sound
+               this.items &= ~ITEM_Strength.m_itemid;
+               this.items &= ~ITEM_Shield.m_itemid;
+               this.items -= (this.items & IT_SUPERWEAPON);
+       }
+}
+
 void player_powerups(entity this)
 {
        if((this.items & IT_USING_JETPACK) && !IS_DEAD(this) && !game_stopped)
@@ -1454,16 +1467,7 @@ void player_powerups(entity this)
        this.effects &= ~(EF_RED | EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT | EF_FLAME | EF_NODEPTHTEST);
 
        if (IS_DEAD(this))
-       {
-               if (this.items & (ITEM_Strength.m_itemid | ITEM_Shield.m_itemid | IT_SUPERWEAPON))
-               {
-                       sound(this, CH_INFO, SND_POWEROFF, VOL_BASE, ATTEN_NORM);
-                       stopsound(this, CH_TRIGGER_SINGLE); // get rid of the pickup sound
-                       this.items &= ~ITEM_Strength.m_itemid;
-                       this.items &= ~ITEM_Shield.m_itemid;
-                       this.items -= (this.items & IT_SUPERWEAPON);
-               }
-       }
+               player_powerups_remove_all(this);
 
        if((this.alpha < 0 || IS_DEAD(this)) && !this.vehicle) // don't apply the flags if the player is gibbed
                return;
index f8301e70a616bef3d02c89d7313b13c92a3dbe3a..746630aec2b46f5bc0f62f7636175d32f9004ac7 100644 (file)
@@ -353,6 +353,9 @@ void reset_map(bool dorespawn)
 
        FOREACH_CLIENT(IS_PLAYER(it),
        {
+               if (STAT(FROZEN, it))
+                       Unfreeze(it, false);
+               player_powerups_remove_all(it);
                entity store = PS(it);
                if (store)
                {
@@ -381,8 +384,6 @@ void reset_map(bool dorespawn)
                if (it.reset2) it.reset2(it);
        });
 
-       FOREACH_CLIENT(IS_PLAYER(it) && STAT(FROZEN, it), { Unfreeze(it, false); });
-
        // Moving the player reset code here since the player-reset depends
        // on spawnpoint entities which have to be reset first --blub
        if (dorespawn)
@@ -399,7 +400,6 @@ void reset_map(bool dorespawn)
                                        restart_mapalreadyrestarted to 1 after the countdown ended or when
                                        sv_ready_restart_after_countdown is not used and countdown is still running
                                        */
-                                       // NEW: changed behaviour so that it prevents that previous spectators/observers suddenly spawn as players
                                        // PlayerScore_Clear(it);
                                        CS(it).killcount = 0;
                                        // stop the player from moving so that he stands still once he gets respawned