Simplify fall damage sound, as done in Xonotic
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 30 Oct 2010 21:06:12 +0000 (00:06 +0300)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 30 Oct 2010 21:06:12 +0000 (00:06 +0300)
data/qcsrc/server/cl_player.qc
data/qcsrc/server/sv_main.qc

index 740cc6a..932d0b9 100644 (file)
@@ -486,14 +486,17 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht
                                        }\r
 \r
                                        if(sound_allowed(MSG_BROADCAST, attacker))\r
+                                       if(self.health > 1)\r
                                        {\r
-                                               if(self.health > 75) // TODO make a "gentle" version?\r
+                                               if(deathtype == DEATH_FALL)\r
+                                                       PlayerSound(self, playersound_fall, CHAN_PAIN, VOICETYPE_PLAYERSOUND);\r
+                                               else if(self.health > 75) // TODO make a "gentle" version?\r
                                                        PlayerSound(self, playersound_pain100, CHAN_PAIN, VOICETYPE_PLAYERSOUND);\r
                                                else if(self.health > 50)\r
                                                        PlayerSound(self, playersound_pain75, CHAN_PAIN, VOICETYPE_PLAYERSOUND);\r
                                                else if(self.health > 25)\r
                                                        PlayerSound(self, playersound_pain50, CHAN_PAIN, VOICETYPE_PLAYERSOUND);\r
-                                               else if(self.health > 1)\r
+                                               else\r
                                                        PlayerSound(self, playersound_pain25, CHAN_PAIN, VOICETYPE_PLAYERSOUND);\r
                                        }\r
                                }\r
index 02ebff8..1a26c72 100644 (file)
@@ -75,13 +75,7 @@ void CreatureFrame (void)
                                else\r
                                        dm = min((dm - cvar("g_balance_falldamage_minspeed")) * cvar("g_balance_falldamage_factor"), cvar("g_balance_falldamage_maxdamage"));\r
                                if (dm > 0)\r
-                               {\r
                                        Damage (self, world, world, dm, DEATH_FALL, self.origin, '0 0 0');\r
-                                       // this must be allowed to cut the normal pain sounds (played after them and on the same channel)\r
-                                       // there's no way to detect falling damage and prevent the pain sounds for this to be played instead\r
-                                       if(self.health > 0)\r
-                                               PlayerSound(self, playersound_fall, CHAN_PAIN, VOICETYPE_PLAYERSOUND);\r
-                               }\r
                                else if(vlen(self.velocity) > 100000 && cvar("developer"))\r
                                {\r
                                        dprint(strcat(self.netname, " became too fast, please investigate: ", vtos(self.spawnorigin), "\n"));\r