]> de.git.xonotic.org Git - voretournament/voretournament.git/blobdiff - data/qcsrc/server/cl_player.qc
Fix and improve my last tweaks
[voretournament/voretournament.git] / data / qcsrc / server / cl_player.qc
index 1e9f8d438e8d2165cc33257dd43ded389cd5d7a2..f7cae1c63e91919213bee6e60199d791b5d11158 100644 (file)
@@ -418,18 +418,7 @@ void PlayerCorpseDamage (entity inflictor, entity attacker, float damage, float
        self.dmg_take = self.dmg_take + take;//max(take - 10, 0);\r
        self.dmg_inflictor = inflictor;\r
 \r
-       if (self.health <= -cvar("sv_gibhealth") && self.modelindex != 0)\r
-       {\r
-               // don't use any animations as a gib\r
-               self.frame = 0;\r
-               self.dead_frame = 0;\r
-               // view just above the floor\r
-               self.view_ofs = '0 0 4';\r
-\r
-               Violence_GibSplash(self, 1, 1, attacker);\r
-               self.modelindex = 0; // restore later\r
-               self.solid = SOLID_NOT; // restore later\r
-       }\r
+       PlayerGib(self, attacker);\r
 }\r
 \r
 void ClientKill_Now_TeamChange();\r
@@ -630,19 +619,25 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht
                }\r
                // clear waypoints\r
                WaypointSprite_PlayerDead();\r
-               // make the corpse upright (not tilted)\r
-               self.angles_x = 0;\r
-               self.angles_z = 0;\r
-               // don't spin\r
-               self.avelocity = '0 0 0';\r
-               // view from the floor\r
-               self.view_ofs = '0 0 -8';\r
-               // toss the corpse\r
-               self.movetype = MOVETYPE_TOSS;\r
-               // shootable corpse\r
-               self.solid = SOLID_CORPSE;\r
-               // don't stick to the floor\r
-               self.flags &~= FL_ONGROUND;\r
+\r
+               // configure these properties if the dead body is not a prey\r
+               if(!self.stat_eaten)\r
+               {\r
+                       // make the corpse upright (not tilted)\r
+                       self.angles_x = 0;\r
+                       self.angles_z = 0;\r
+                       // don't spin\r
+                       self.avelocity = '0 0 0';\r
+                       // view from the floor\r
+                       self.view_ofs = '0 0 -8';\r
+                       // toss the corpse\r
+                       self.movetype = MOVETYPE_TOSS;\r
+                       // shootable corpse\r
+                       self.solid = SOLID_CORPSE;\r
+                       // don't stick to the floor\r
+                       self.flags &~= FL_ONGROUND;\r
+               }\r
+\r
                // dying animation\r
                self.deadflag = DEAD_DYING;\r
                // when to allow respawn\r
@@ -1230,7 +1225,7 @@ void GlobalSound(string sample, float chan, float voicetype)
 {\r
        float n;\r
        float tauntrand;\r
-       float vol;\r
+       float vol_scale, vol_prey, vol_apply;\r
 \r
        if(sample == "")\r
                return;\r
@@ -1243,12 +1238,11 @@ void GlobalSound(string sample, float chan, float voicetype)
                sample = strcat(argv(0), ".wav"); // randomization\r
 \r
        // modified volume, used for attenuated (non-radio) voices\r
-       vol = VOL_BASEVOICE;\r
-       if(self.stat_eaten && cvar("g_vore_soundocclusion")) // reduce sound volume for prey, to simulate stomach culling\r
-               vol *= cvar("g_vore_soundocclusion");\r
+       vol_scale = vol_prey = 1;\r
        if(cvar("g_healthsize") && cvar("g_healthsize_soundfactor")) // amplify or reduce sound volume based on the size of the player\r
-               vol *= pow(self.scale, cvar("g_healthsize_soundfactor"));\r
-       vol = bound(0, vol, 1);\r
+               vol_scale *= bound(0, pow(self.scale, cvar("g_healthsize_soundfactor")), 1);\r
+       if(self.stat_eaten && cvar("g_vore_soundocclusion")) // reduce sound volume for prey, to simulate stomach culling\r
+               vol_prey *= bound(0, cvar("g_vore_soundocclusion"), 1);\r
 \r
        switch(voicetype)\r
        {\r
@@ -1260,7 +1254,11 @@ void GlobalSound(string sample, float chan, float voicetype)
                                        if(clienttype(msg_entity) == CLIENTTYPE_REAL)\r
                                        {\r
                                                if(msg_entity.cvar_cl_voice_directional == 1)\r
-                                                       soundto(MSG_ONE, self, chan, sample, vol, ATTN_MIN);\r
+                                               {\r
+                                                       vol_apply = VOL_BASEVOICE;\r
+                                                       vol_apply *= (self.predator != msg_entity.predator && self != msg_entity) ? vol_scale * vol_prey : vol_scale;\r
+                                                       soundto(MSG_ONE, self, chan, sample, vol_apply, ATTN_MIN);\r
+                                               }\r
                                                else\r
                                                        soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE);\r
                                        }\r
@@ -1274,7 +1272,11 @@ void GlobalSound(string sample, float chan, float voicetype)
                                        if(clienttype(msg_entity) == CLIENTTYPE_REAL)\r
                                        {\r
                                                if(msg_entity.cvar_cl_voice_directional == 1)\r
-                                                       soundto(MSG_ONE, self, chan, sample, vol, ATTN_MIN);\r
+                                               {\r
+                                                       vol_apply = VOL_BASEVOICE;\r
+                                                       vol_apply *= (self.predator != msg_entity.predator && self != msg_entity) ? vol_scale * vol_prey : vol_scale;\r
+                                                       soundto(MSG_ONE, self, chan, sample, vol_apply, ATTN_MIN);\r
+                                               }\r
                                                else\r
                                                        soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE);\r
                                        }\r
@@ -1288,7 +1290,11 @@ void GlobalSound(string sample, float chan, float voicetype)
                                if(!teams_matter || msg_entity.team == self.team)\r
                                {\r
                                        if(msg_entity.cvar_cl_voice_directional == 1)\r
-                                               soundto(MSG_ONE, self, chan, sample, vol, ATTN_MIN);\r
+                                       {\r
+                                               vol_apply = VOL_BASEVOICE;\r
+                                               vol_apply *= (self.predator != msg_entity.predator && self != msg_entity) ? vol_scale * vol_prey : vol_scale;\r
+                                               soundto(MSG_ONE, self, chan, sample, vol_apply, ATTN_MIN);\r
+                                       }\r
                                        else\r
                                                soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE);\r
                                }\r
@@ -1305,7 +1311,11 @@ void GlobalSound(string sample, float chan, float voicetype)
                                if (tauntrand < msg_entity.cvar_cl_autotaunt)\r
                                {\r
                                        if (msg_entity.cvar_cl_voice_directional >= 1)\r
-                                               soundto(MSG_ONE, self, chan, sample, vol, bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX));\r
+                                       {\r
+                                               vol_apply = VOL_BASEVOICE;\r
+                                               vol_apply *= (self.predator != msg_entity.predator && self != msg_entity) ? vol_scale * vol_prey : vol_scale;\r
+                                               soundto(MSG_ONE, self, chan, sample, vol_apply, bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX));\r
+                                       }\r
                                        else\r
                                                soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE);\r
                                }\r
@@ -1321,16 +1331,26 @@ void GlobalSound(string sample, float chan, float voicetype)
                        FOR_EACH_REALCLIENT(msg_entity)\r
                        {\r
                                if (msg_entity.cvar_cl_voice_directional >= 1)\r
-                                       soundto(MSG_ONE, self, chan, sample, vol, bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX));\r
+                               {\r
+                                       vol_apply = VOL_BASEVOICE;\r
+                                       vol_apply *= (self.predator != msg_entity.predator && self != msg_entity) ? vol_scale * vol_prey : vol_scale;\r
+                                       soundto(MSG_ONE, self, chan, sample, vol_apply, bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX));\r
+                               }\r
                                else\r
                                        soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE);\r
                        }\r
                case VOICETYPE_PLAYERSOUND:\r
-                               sound(self, chan, sample, vol, ATTN_NORM);\r
+                       FOR_EACH_REALCLIENT(msg_entity)\r
+                       {\r
+                               vol_apply = VOL_BASEVOICE;\r
+                               vol_apply *= (self.predator != msg_entity.predator && self != msg_entity) ? vol_scale * vol_prey : vol_scale;\r
+                               soundto(MSG_ONE, self, chan, sample, vol_apply, ATTN_NORM);\r
+                       }\r
                        break;\r
                case VOICETYPE_GURGLE:\r
+                       // since players can't be prey and predators at the same time, we don't use the prey modifier for the gurgle sound volume\r
                        if(self.stomach_load)\r
-                               sound(self, chan, sample, bound(0, vol * (self.stomach_load / self.stomach_maxload), 1), ATTN_NORM);\r
+                               sound(self, chan, sample, bound(0, vol_scale * (self.stomach_load / self.stomach_maxload), 1), ATTN_NORM);\r
                        else\r
                                stopsound(self, chan);\r
                        break;\r