]> de.git.xonotic.org Git - voretournament/voretournament.git/blobdiff - data/qcsrc/server/cl_player.qc
Fix and improve prey animations
[voretournament/voretournament.git] / data / qcsrc / server / cl_player.qc
index ed94dc4d5949acfa877ad44bd51bad182dfcdef0..148170f7f0f898b80df894ef9fbf1194f3a1a748 100644 (file)
@@ -143,6 +143,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
@@ -218,10 +219,6 @@ float player_getspecies()
 \r
 void player_setupanimsformodel()\r
 {\r
-       // if this is the stomach model (or any model that can't be animated), don't attempt to animate\r
-       if(substring(self.model, strlen(self.model) - 3, 3) == "md3") // check model extension\r
-               return;\r
-\r
        local string animfilename;\r
        local float animfile;\r
        // defaults for legacy .zym models without animinfo files\r
@@ -249,7 +246,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
@@ -292,10 +289,6 @@ void player_setupanimsformodel()
 \r
 void player_anim (void)\r
 {\r
-       // if this is the stomach model (or any model that can't be animated), don't attempt to animate\r
-       if(substring(self.model, strlen(self.model) - 3, 3) == "md3") // check model extension\r
-               return;\r
-\r
        updateanim(self);\r
        if (self.weaponentity)\r
                updateanim(self.weaponentity);\r
@@ -316,7 +309,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
@@ -756,7 +756,7 @@ 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
@@ -1240,7 +1240,7 @@ void GlobalSound(string sample, float chan, float voicetype)
                                        {\r
                                                if(msg_entity.cvar_cl_voice_directional == 1)\r
                                                {\r
-                                                       if(self.predator.classname == "player")\r
+                                                       if(self.stat_eaten)\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
@@ -1259,7 +1259,7 @@ void GlobalSound(string sample, float chan, float voicetype)
                                        {\r
                                                if(msg_entity.cvar_cl_voice_directional == 1)\r
                                                {\r
-                                                       if(self.predator.classname == "player")\r
+                                                       if(self.stat_eaten)\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
@@ -1278,7 +1278,7 @@ void GlobalSound(string sample, float chan, float voicetype)
                                {\r
                                        if(msg_entity.cvar_cl_voice_directional == 1)\r
                                        {\r
-                                               if(self.predator.classname == "player")\r
+                                               if(self.stat_eaten)\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
@@ -1299,7 +1299,7 @@ void GlobalSound(string sample, float chan, float voicetype)
                                if (tauntrand < msg_entity.cvar_cl_autotaunt)\r
                                if (msg_entity.cvar_cl_voice_directional >= 1)\r
                                {\r
-                                       if(self.predator.classname == "player")\r
+                                       if(self.stat_eaten)\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
@@ -1319,7 +1319,7 @@ void GlobalSound(string sample, float chan, float voicetype)
                        {\r
                                if (msg_entity.cvar_cl_voice_directional >= 1)\r
                                {\r
-                                       if(self.predator.classname == "player")\r
+                                       if(self.stat_eaten)\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
@@ -1328,7 +1328,7 @@ void GlobalSound(string sample, float chan, float voicetype)
                                        soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE);\r
                        }\r
                case VOICETYPE_PLAYERSOUND:\r
-                       if(self.predator.classname == "player")\r
+                       if(self.stat_eaten)\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