]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
simplify code for falling damage
authorRudolf Polzer <divverent@alientrap.org>
Sat, 30 Oct 2010 18:52:57 +0000 (20:52 +0200)
committerRudolf Polzer <divverent@alientrap.org>
Sat, 30 Oct 2010 18:52:57 +0000 (20:52 +0200)
qcsrc/server/cl_player.qc
qcsrc/server/sv_main.qc

index db8bc4bfc94ec7b8bda49b0a2146bc58576348eb..b00c4b4fd73e8fc47770854e966aa871f5c8515f 100644 (file)
@@ -488,15 +488,18 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht
 
                                        if(sound_allowed(MSG_BROADCAST, attacker))
                                        if(!DEATH_ISWEAPON(deathtype, WEP_LASER) || attacker != self || self.health < 2 * cvar("g_balance_laser_primary_damage") * cvar("g_balance_selfdamagepercent") + 1)
+                                       if(self.health > 1)
                                        // exclude pain sounds for laserjumps as long as you aren't REALLY low on health and would die of the next two
                                        {
-                                               if(self.health > 75) // TODO make a "gentle" version?
+                                               if(deathtype == DEATH_FALL)
+                                                       PlayerSound(playersound_fall, CHAN_PAIN, VOICETYPE_PLAYERSOUND);
+                                               else if(self.health > 75) // TODO make a "gentle" version?
                                                        PlayerSound(playersound_pain100, CHAN_PAIN, VOICETYPE_PLAYERSOUND);
                                                else if(self.health > 50)
                                                        PlayerSound(playersound_pain75, CHAN_PAIN, VOICETYPE_PLAYERSOUND);
                                                else if(self.health > 25)
                                                        PlayerSound(playersound_pain50, CHAN_PAIN, VOICETYPE_PLAYERSOUND);
-                                               else if(self.health > 1)
+                                               else
                                                        PlayerSound(playersound_pain25, CHAN_PAIN, VOICETYPE_PLAYERSOUND);
                                        }
                                }
index 3b7d77d58be6ef819dfcd4ae68266588e1ed36fc..5b8ca7ff867daae82bfe1f4f9ac5f03fabe2f037 100644 (file)
@@ -75,13 +75,7 @@ void CreatureFrame (void)
                                else
                                        dm = min((dm - cvar("g_balance_falldamage_minspeed")) * cvar("g_balance_falldamage_factor"), cvar("g_balance_falldamage_maxdamage"));
                                if (dm > 0)
-                               {
                                        Damage (self, world, world, dm, DEATH_FALL, self.origin, '0 0 0');
-                                       // this must be allowed to cut the normal pain sounds (played after them and on the same channel)
-                                       // there's no way to detect falling damage and prevent the pain sounds for this to be played instead
-                                       if(self.health > 0)
-                                               PlayerSound(playersound_fall, CHAN_PAIN, VOICETYPE_PLAYERSOUND);
-                               }
                        }
 
                        maxspeed = cvar("g_maxspeed");