]> de.git.xonotic.org Git - voretournament/voretournament.git/blobdiff - data/qcsrc/server/cl_player.qc
Use pow() for all scale differences, which should make them much more correct, and...
[voretournament/voretournament.git] / data / qcsrc / server / cl_player.qc
index 120c6d2f090c732f85dc24be6d1a098ee9137c46..7e4f410553821cc8308b53d4403e353f42a73e00 100644 (file)
@@ -114,6 +114,7 @@ void CopyBody(float keepvelocity)
        self.lip = oldself.lip;\r
        self.colormap = oldself.colormap;\r
        self.colormod = oldself.colormod;\r
+       self.glowmod = oldself.glowmod;\r
        self.iscreature = oldself.iscreature;\r
        self.angles = oldself.angles;\r
        self.avelocity = oldself.avelocity;\r
@@ -143,6 +144,7 @@ void CopyBody(float keepvelocity)
        self.solid = oldself.solid;\r
        self.takedamage = oldself.takedamage;\r
        self.think = oldself.think;\r
+       self.scale = oldself.scale;\r
        self.customizeentityforclient = oldself.customizeentityforclient;\r
        self.uncustomizeentityforclient = oldself.uncustomizeentityforclient;\r
        self.uncustomizeentityforclient_set = oldself.uncustomizeentityforclient_set;\r
@@ -245,7 +247,7 @@ void player_setupanimsformodel()
        self.anim_backright = '21 1 1';\r
        self.anim_backleft  = '22 1 1';\r
        animparseerror = FALSE;\r
-       animfilename = strcat(self.model, ".animinfo");\r
+       animfilename = strcat(self.playermodel, ".animinfo"); // only the normal player model may contain animation info\r
        animfile = fopen(animfilename, FILE_READ);\r
        if (animfile >= 0)\r
        {\r
@@ -282,12 +284,8 @@ void player_setupanimsformodel()
        else\r
                dprint("File ", animfilename, " not found, assuming legacy .zym model animation timings\n");\r
 \r
-       // the line below is disabled due to issues with the stomach model, which cannot be animated.\r
-       // customizeentityforclient cannot let this part of the code know whether it's the stomach model or normal\r
-       // player model we're using. Attempting to animate the stomach model causes BIG issues, and must not be allowed.\r
-\r
        // reset animstate now\r
-       //setanim(self, self.anim_idle, TRUE, FALSE, TRUE);\r
+       setanim(self, self.anim_idle, TRUE, FALSE, TRUE);\r
 };\r
 \r
 void player_anim (void)\r
@@ -312,7 +310,14 @@ void player_anim (void)
 \r
        if (!self.animstate_override)\r
        {\r
-               if (!(self.flags & FL_ONGROUND))\r
+               if(self.stat_eaten)\r
+               {\r
+                       if(self.BUTTON_ATCK || self.predator.digesting)\r
+                               setanim(self, self.anim_pain2, FALSE, TRUE, FALSE); // looks good for prey attacking the stomach or being digested\r
+                       else\r
+                               setanim(self, self.anim_jump, FALSE, TRUE, FALSE); // looks good for prey idling inside the stomach\r
+               }\r
+               else if (!(self.flags & FL_ONGROUND))\r
                {\r
                        if (self.crouch)\r
                                setanim(self, self.anim_duckjump, FALSE, TRUE, self.restart_jump);\r
@@ -357,9 +362,9 @@ void player_anim (void)
                setanim(self.weaponentity, self.weaponentity.anim_idle, TRUE, FALSE, FALSE);\r
 }\r
 \r
-void SpawnThrownWeapon (vector org, float w)\r
+void SpawnThrownWeapon (vector org, float w, float doreduce)\r
 {\r
-       W_ThrowWeapon(randomvec() * 125 + '0 0 200', org - self.origin, FALSE);\r
+       W_ThrowWeapon(randomvec() * 125 + '0 0 200', org - self.origin, doreduce);\r
 }\r
 \r
 void PlayerCorpseDamage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)\r
@@ -402,7 +407,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 <= -75 && self.modelindex != 0)\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
@@ -593,7 +598,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht
                // clear selected player display\r
                ClearSelectedPlayer();\r
                // throw a weapon\r
-               SpawnThrownWeapon (self.origin + (self.mins + self.maxs) * 0.5, self.switchweapon);\r
+               SpawnThrownWeapon (self.origin + (self.mins + self.maxs) * 0.5, self.switchweapon, FALSE);\r
                // print an obituary message\r
                Obituary (attacker, inflictor, self, deathtype);\r
                race_PreDie();\r
@@ -745,7 +750,6 @@ void ClearSelectedPlayer()
        }\r
 }\r
 \r
-.float dropweapon_check;\r
 void UpdateSelectedPlayer()\r
 {\r
        entity selected;\r
@@ -753,12 +757,12 @@ void UpdateSelectedPlayer()
        selected = world;\r
        selected_score = 0.95; // 18 degrees\r
 \r
-       if(self.predator.classname == "player")\r
+       if(self.stat_eaten)\r
        {\r
                if(!self.dropweapon_check)\r
                if(self.predator.team != self.team) // don't disarm team mates when swallowing them\r
                if(random() < cvar("g_balance_vore_swallow_dropweapon"))\r
-                       SpawnThrownWeapon (self.origin + (self.mins + self.maxs) * 0.5, self.switchweapon);\r
+                       SpawnThrownWeapon (self.origin + (self.mins + self.maxs) * 0.5, self.switchweapon, TRUE);\r
                self.dropweapon_check = TRUE;\r
        }\r
        else\r
@@ -1215,6 +1219,7 @@ void GlobalSound(string sample, float chan, float voicetype)
 {\r
        float n;\r
        float tauntrand;\r
+       float vol;\r
 \r
        if(sample == "")\r
                return;\r
@@ -1226,6 +1231,14 @@ void GlobalSound(string sample, float chan, float voicetype)
        else\r
                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
+       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
+\r
        switch(voicetype)\r
        {\r
                case VOICETYPE_LASTATTACKER_ONLY:\r
@@ -1236,12 +1249,7 @@ 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
-                                               {\r
-                                                       if(self.predator.classname == "player")\r
-                                                               soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE * bound(0, cvar("g_vore_soundocclusion"), 1), ATTN_MIN);\r
-                                                       else\r
-                                                               soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_MIN);\r
-                                               }\r
+                                                       soundto(MSG_ONE, self, chan, sample, vol, ATTN_MIN);\r
                                                else\r
                                                        soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE);\r
                                        }\r
@@ -1255,12 +1263,7 @@ 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
-                                               {\r
-                                                       if(self.predator.classname == "player")\r
-                                                               soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE * bound(0, cvar("g_vore_soundocclusion"), 1), ATTN_MIN);\r
-                                                       else\r
-                                                               soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_MIN);\r
-                                               }\r
+                                                       soundto(MSG_ONE, self, chan, sample, vol, ATTN_MIN);\r
                                                else\r
                                                        soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE);\r
                                        }\r
@@ -1274,12 +1277,7 @@ 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
-                                       {\r
-                                               if(self.predator.classname == "player")\r
-                                                       soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE * bound(0, cvar("g_vore_soundocclusion"), 1), ATTN_MIN);\r
-                                               else\r
-                                                       soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_MIN);\r
-                                       }\r
+                                               soundto(MSG_ONE, self, chan, sample, vol, ATTN_MIN);\r
                                        else\r
                                                soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE);\r
                                }\r
@@ -1296,12 +1294,7 @@ 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
-                                       {\r
-                                               if(self.predator.classname == "player")\r
-                                                       soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE * bound(0, cvar("g_vore_soundocclusion"), 1), bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX));\r
-                                               else\r
-                                                       soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX));\r
-                                       }\r
+                                               soundto(MSG_ONE, self, chan, sample, vol, bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX));\r
                                        else\r
                                                soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE);\r
                                }\r
@@ -1317,24 +1310,16 @@ void GlobalSound(string sample, float chan, float voicetype)
                        FOR_EACH_REALCLIENT(msg_entity)\r
                        {\r
                                if (msg_entity.cvar_cl_voice_directional >= 1)\r
-                               {\r
-                                       if(self.predator.classname == "player")\r
-                                               soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE * bound(0, cvar("g_vore_soundocclusion"), 1), bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX));\r
-                                       else\r
-                                               soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX));\r
-                               }\r
+                                       soundto(MSG_ONE, self, chan, sample, vol, bound(ATTN_MIN, msg_entity.cvar_cl_voice_directional_taunt_attenuation, ATTN_MAX));\r
                                else\r
                                        soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE);\r
                        }\r
                case VOICETYPE_PLAYERSOUND:\r
-                       if(self.predator.classname == "player")\r
-                               sound(self, chan, sample, VOL_BASE * bound(0, cvar("g_vore_soundocclusion"), 1), ATTN_NORM);\r
-                       else\r
-                               sound(self, chan, sample, VOL_BASE, ATTN_NORM);\r
+                               sound(self, chan, sample, vol, ATTN_NORM);\r
                        break;\r
                case VOICETYPE_GURGLE:\r
                        if(self.stomach_load)\r
-                               sound(self, chan, sample, VOL_BASE * self.stomach_load / cvar("g_balance_vore_swallow_limit"), ATTN_NORM);\r
+                               sound(self, chan, sample, vol * self.stomach_load / g_balance_vore_swallow_limit, ATTN_NORM);\r
                        else\r
                                stopsound(self, chan);\r
                        break;\r