]> git.rm.cloudns.org Git - voretournament/voretournament.git/commitdiff
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 448fb8d33c525e38fecdeacf8a669eb280daa03d..2cbfbd20cacd631dd601e203d4501a803ca3a56a 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 120c6d2f090c732f85dc24be6d1a098ee9137c46..14d44a236eeee3c4b0b265891a38deab044eba2b 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 0041e79dba17cdae1015821b0ee1007e848872c3..85140336ca96cbea050b6a313dc623382b3dc144 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 863f8b61c1f9d1775b5ad76d8e5626c2ee4f24df..94d4fb1e293c052546904537f272ddfd28caa26f 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