From: MirceaKitsune Date: Mon, 28 Feb 2011 00:09:47 +0000 (+0200) Subject: Implement ambient taunts for predators, and rework the autotaunt code for better... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=44d897b12c1ccdd0f2b7fb8624a023b01282dcd9;p=voretournament%2Fvoretournament.git Implement ambient taunts for predators, and rework the autotaunt code for better and easier support of the new features --- diff --git a/data/qcsrc/server/cl_client.qc b/data/qcsrc/server/cl_client.qc index 448fb8d3..2cbfbd20 100644 --- a/data/qcsrc/server/cl_client.qc +++ b/data/qcsrc/server/cl_client.qc @@ -2640,10 +2640,10 @@ void PlayerPreThink (void) PlayerSound(self, playersound_taunt, CHAN_VOICE, VOICETYPE_AUTOTAUNT); break; case TAUNTTYPE_VOREPRED: - PlayerSound(self, playersound_pred, CHAN_VOICE, VOICETYPE_AUTOTAUNT); // change this properly + PlayerSound(self, playersound_pred, CHAN_VOICE, VOICETYPE_AUTOTAUNT); break; case TAUNTTYPE_VOREPREY: - PlayerSound(self, playersound_prey, CHAN_VOICE, VOICETYPE_AUTOTAUNT); // change this properly + PlayerSound(self, playersound_prey, CHAN_VOICE, VOICETYPE_AUTOTAUNT); break; default: dprint("Incorrect autotaunt type\n"); @@ -2651,6 +2651,7 @@ void PlayerPreThink (void) } self.taunt_soundtime = 0; + self.taunt_soundtimefiltered = FALSE; self.taunt_soundtype = 0; } diff --git a/data/qcsrc/server/cl_player.qc b/data/qcsrc/server/cl_player.qc index 120c6d2f..14d44a23 100644 --- a/data/qcsrc/server/cl_player.qc +++ b/data/qcsrc/server/cl_player.qc @@ -1211,6 +1211,7 @@ void UpdatePlayerSounds() LoadPlayerSounds(strcat(self.model, ".sounds"), 0); } +.float soundtimefilter; void GlobalSound(string sample, float chan, float voicetype) { float n; @@ -1294,6 +1295,7 @@ void GlobalSound(string sample, float chan, float voicetype) tauntrand = random(); FOR_EACH_REALCLIENT(msg_entity) if (tauntrand < msg_entity.cvar_cl_autotaunt) + if not (self.taunt_soundtimefiltered && msg_entity.soundtimefilter > time) { if (msg_entity.cvar_cl_voice_directional >= 1) { @@ -1304,6 +1306,9 @@ void GlobalSound(string sample, float chan, float voicetype) } else soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE); + + if(self.taunt_soundtimefiltered) + msg_entity.soundtimefilter = time + msg_entity.cvar_cl_autotaunt_repeat; } break; case VOICETYPE_TAUNT: diff --git a/data/qcsrc/server/g_damage.qc b/data/qcsrc/server/g_damage.qc index 0041e79d..85140336 100644 --- a/data/qcsrc/server/g_damage.qc +++ b/data/qcsrc/server/g_damage.qc @@ -56,9 +56,17 @@ float damage_headshotbonus; // bonus multiplier for head shots, set to 0 after u .float teamkill_soundtime; .entity teamkill_soundsource; .entity pusher; + .float taunt_soundtime; +.float taunt_soundtimefiltered; .float taunt_soundtype; +void SetAutoTaunt(entity e, float t_soundtime, float t_soundtimefiltered, float soundtype) +{ + e.taunt_soundtime = t_soundtime; + e.taunt_soundtimefiltered = t_soundtimefiltered; + e.taunt_soundtype = soundtype; +} float IsDifferentTeam(entity a, entity b) { @@ -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))); centerprint(targ, strcat(DAMAGE_CENTERPRINT_SPACER, victim_message, "^1You were eaten by ^7", a, GetAdvancedDeathReports(attacker))); } - attacker.taunt_soundtime = time + 1; - attacker.taunt_soundtype = TAUNTTYPE_DEATH; + SetAutoTaunt(attacker, time + 1, FALSE, TAUNTTYPE_DEATH); } } else @@ -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))); centerprint(targ, strcat(DAMAGE_CENTERPRINT_SPACER, victim_message, "^1You were killed by ^7", a, GetAdvancedDeathReports(attacker))); } - attacker.taunt_soundtime = time + 1; - attacker.taunt_soundtype = TAUNTTYPE_DEATH; + SetAutoTaunt(attacker, time + 1, FALSE, TAUNTTYPE_DEATH); } } diff --git a/data/qcsrc/server/vore.qc b/data/qcsrc/server/vore.qc index 863f8b61..94d4fb1e 100644 --- a/data/qcsrc/server/vore.qc +++ b/data/qcsrc/server/vore.qc @@ -403,6 +403,26 @@ void Vore_StomachLeave() } } +void Vore_AutoTaunt() +{ + // triggers ambient vore taunts, for both pred and prey + + // predator taunts + if(self.stomach_load) + { + // taunt_soundtime is set to 0 after the taunt has played, so this indicates a new start + if(!self.taunt_soundtime) + { + SetAutoTaunt(self, time, TRUE, TAUNTTYPE_VOREPRED); + } + } + else if(self.taunt_soundtype == TAUNTTYPE_VOREPRED) + { + // we have a predator taunt scheduled, but we're no longer a predator, so remove it + SetAutoTaunt(self, 0, FALSE, 0); + } +} + void Vore() { // main vore code, this is where it all happens @@ -413,6 +433,8 @@ void Vore() return; } + Vore_AutoTaunt(); + // wash the goo away from players once they leave the stomach if(self.predator.classname != "player") if(stov(cvar_string("g_vore_regurgitatecolor_release")))