Implement ambient taunts for predators, and rework the autotaunt code for better...
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Mon, 28 Feb 2011 00:09:47 +0000 (02:09 +0200)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Mon, 28 Feb 2011 00:09:47 +0000 (02:09 +0200)
data/qcsrc/server/cl_client.qc
data/qcsrc/server/cl_player.qc
data/qcsrc/server/g_damage.qc
data/qcsrc/server/vore.qc

index 448fb8d..2cbfbd2 100644 (file)
@@ -2640,10 +2640,10 @@ void PlayerPreThink (void)
                                PlayerSound(self, playersound_taunt, CHAN_VOICE, VOICETYPE_AUTOTAUNT);\r
                                break;\r
                        case TAUNTTYPE_VOREPRED:\r
-                               PlayerSound(self, playersound_pred, CHAN_VOICE, VOICETYPE_AUTOTAUNT); // change this properly\r
+                               PlayerSound(self, playersound_pred, CHAN_VOICE, VOICETYPE_AUTOTAUNT);\r
                                break;\r
                        case TAUNTTYPE_VOREPREY:\r
-                               PlayerSound(self, playersound_prey, CHAN_VOICE, VOICETYPE_AUTOTAUNT); // change this properly\r
+                               PlayerSound(self, playersound_prey, CHAN_VOICE, VOICETYPE_AUTOTAUNT);\r
                                break;\r
                        default:\r
                                dprint("Incorrect autotaunt type\n");\r
@@ -2651,6 +2651,7 @@ void PlayerPreThink (void)
                }\r
 \r
                self.taunt_soundtime = 0;\r
+               self.taunt_soundtimefiltered = FALSE;\r
                self.taunt_soundtype = 0;\r
        }\r
 \r
index 120c6d2..14d44a2 100644 (file)
@@ -1211,6 +1211,7 @@ void UpdatePlayerSounds()
        LoadPlayerSounds(strcat(self.model, ".sounds"), 0);\r
 }\r
 \r
+.float soundtimefilter;\r
 void GlobalSound(string sample, float chan, float voicetype)\r
 {\r
        float n;\r
@@ -1294,6 +1295,7 @@ void GlobalSound(string sample, float chan, float voicetype)
                        tauntrand = random();\r
                        FOR_EACH_REALCLIENT(msg_entity)\r
                                if (tauntrand < msg_entity.cvar_cl_autotaunt)\r
+                               if not (self.taunt_soundtimefiltered && msg_entity.soundtimefilter > time)\r
                                {\r
                                        if (msg_entity.cvar_cl_voice_directional >= 1)\r
                                        {\r
@@ -1304,6 +1306,9 @@ void GlobalSound(string sample, float chan, float voicetype)
                                        }\r
                                        else\r
                                                soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE);\r
+\r
+                                       if(self.taunt_soundtimefiltered)\r
+                                               msg_entity.soundtimefilter = time + msg_entity.cvar_cl_autotaunt_repeat;\r
                                }\r
                        break;\r
                case VOICETYPE_TAUNT:\r
index 0041e79..8514033 100644 (file)
@@ -56,9 +56,17 @@ float damage_headshotbonus; // bonus multiplier for head shots, set to 0 after u
 .float teamkill_soundtime;\r
 .entity teamkill_soundsource;\r
 .entity pusher;\r
+\r
 .float taunt_soundtime;\r
+.float taunt_soundtimefiltered;\r
 .float taunt_soundtype;\r
 \r
+void SetAutoTaunt(entity e, float t_soundtime, float t_soundtimefiltered, float soundtype)\r
+{\r
+       e.taunt_soundtime = t_soundtime;\r
+       e.taunt_soundtimefiltered = t_soundtimefiltered;\r
+       e.taunt_soundtype = soundtype;\r
+}\r
 \r
 float IsDifferentTeam(entity a, entity b)\r
 {\r
@@ -374,8 +382,7 @@ void Obituary (entity attacker, entity inflictor, entity targ, float deathtype)
                                                        centerprint(attacker, strcat(DAMAGE_CENTERPRINT_SPACER, blood_message, "^4You ate ^7", s, GetAdvancedDeathReports(targ)));\r
                                                        centerprint(targ, strcat(DAMAGE_CENTERPRINT_SPACER, victim_message, "^1You were eaten by ^7", a, GetAdvancedDeathReports(attacker)));\r
                                                }\r
-                                               attacker.taunt_soundtime = time + 1;\r
-                                               attacker.taunt_soundtype = TAUNTTYPE_DEATH;\r
+                                               SetAutoTaunt(attacker, time + 1, FALSE, TAUNTTYPE_DEATH);\r
                                        }\r
                                }\r
                                else\r
@@ -391,8 +398,7 @@ void Obituary (entity attacker, entity inflictor, entity targ, float deathtype)
                                                        centerprint(attacker, strcat(DAMAGE_CENTERPRINT_SPACER, blood_message, "^4You killed ^7", s, GetAdvancedDeathReports(targ)));\r
                                                        centerprint(targ, strcat(DAMAGE_CENTERPRINT_SPACER, victim_message, "^1You were killed by ^7", a, GetAdvancedDeathReports(attacker)));\r
                                                }\r
-                                               attacker.taunt_soundtime = time + 1;\r
-                                               attacker.taunt_soundtype = TAUNTTYPE_DEATH;\r
+                                               SetAutoTaunt(attacker, time + 1, FALSE, TAUNTTYPE_DEATH);\r
                                        }\r
                                }\r
 \r
index 863f8b6..94d4fb1 100644 (file)
@@ -403,6 +403,26 @@ void Vore_StomachLeave()
        }\r
 }\r
 \r
+void Vore_AutoTaunt()\r
+{\r
+       // triggers ambient vore taunts, for both pred and prey\r
+\r
+       // predator taunts\r
+       if(self.stomach_load)\r
+       {\r
+               // taunt_soundtime is set to 0 after the taunt has played, so this indicates a new start\r
+               if(!self.taunt_soundtime)\r
+               {\r
+                       SetAutoTaunt(self, time, TRUE, TAUNTTYPE_VOREPRED);\r
+               }\r
+       }\r
+       else if(self.taunt_soundtype == TAUNTTYPE_VOREPRED)\r
+       {\r
+               // we have a predator taunt scheduled, but we're no longer a predator, so remove it\r
+               SetAutoTaunt(self, 0, FALSE, 0);\r
+       }\r
+}\r
+\r
 void Vore()\r
 {\r
        // main vore code, this is where it all happens\r
@@ -413,6 +433,8 @@ void Vore()
                return;\r
        }\r
 \r
+       Vore_AutoTaunt();\r
+\r
        // wash the goo away from players once they leave the stomach\r
        if(self.predator.classname != "player")\r
        if(stov(cvar_string("g_vore_regurgitatecolor_release")))\r