From: MirceaKitsune Date: Tue, 2 Aug 2011 15:37:36 +0000 (+0300) Subject: Beginning of a helper system (voice that speaks to warn you of things, such as low... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=ffc3663089ed86f8641e910172aa2a89549a4e34;p=voretournament%2Fvoretournament.git Beginning of a helper system (voice that speaks to warn you of things, such as low health). Do it for health so far. --- diff --git a/data/defaultVT.cfg b/data/defaultVT.cfg index 38346f64..18eceece 100644 --- a/data/defaultVT.cfg +++ b/data/defaultVT.cfg @@ -674,6 +674,11 @@ seta cl_notify_carried_items "3" "notify you of carried items when you obtain th seta cl_hitsound 1 "play a hit notifier sound when you have hit an enemy" seta cl_announcer default "name of the announcer you wish to use from data/sound/announcer" +seta cl_helper 1 "enable helper system" +seta cl_helper_voice default "name of the helper you wish to use from data/sound/helper" +seta cl_helper_pause 2 "number of seconds that must pass before the helper system can be triggered again" +seta cl_helper_health_value 25 "the helper will warn you when going below this amount of health" + seta cl_eventchase_death 1 "camera goes into 3rd person mode when the player is dead" seta cl_eventchase_distance 140 "final camera distance" seta cl_eventchase_speed 1.3 "how fast the camera slides back, 0 is instant" diff --git a/data/qcsrc/client/View.qc b/data/qcsrc/client/View.qc index aed53ade..d8ea89ba 100644 --- a/data/qcsrc/client/View.qc +++ b/data/qcsrc/client/View.qc @@ -258,6 +258,7 @@ float stomachsplash_alpha; float volume_modify_1, volume_modify_2, volume_modify_default_1, volume_modify_default_2; float volume_modify_changed_1, volume_modify_changed_2; float eventchase_current_distance; +float helper_pause, helper_health; vector myhealth_gentlergb; vector liquidcolor_prev; vector damage_blurpostprocess, content_blurpostprocess; @@ -297,6 +298,23 @@ void CSQC_UpdateView(float w, float h) if not(spectatee_status && last_spectatee != spectatee_status) // not if we switched players and that detects a different health respawned = TRUE; // stays true for one frame + // helper system + if(cvar("cl_helper")) + if(helper_pause <= time) + { + if(getstati(STAT_HEALTH) <= cvar("cl_helper_health_value")) + { + if(!helper_health) + { + sound(self, CHAN_VOICE, strcat("helper/", cvar_string("cl_helper_voice"), "/health_low.wav"), VOL_BASEVOICE, ATTN_NONE); + helper_health = TRUE; + helper_pause = time + cvar("cl_helper_pause"); + } + } + else if(helper_health) + helper_health = FALSE; + } + // event chase camera if(cvar("chase_active") <= 0) // greater than 0 means it's enabled manually, and this code is skipped { diff --git a/data/qcsrc/client/miscfunctions.qc b/data/qcsrc/client/miscfunctions.qc index 5e098d9a..1c3da912 100644 --- a/data/qcsrc/client/miscfunctions.qc +++ b/data/qcsrc/client/miscfunctions.qc @@ -180,6 +180,8 @@ void Announcer_Precache () { precache_sound (strcat("announcer/", cvar_string("cl_announcer"), "/lastsecond.wav")); precache_sound (strcat("announcer/", cvar_string("cl_announcer"), "/narrowly.wav")); + + precache_sound (strcat("helper/", cvar_string("cl_helper_voice"), "/health_low.wav")); } void AuditLists() diff --git a/data/sound/helper/default/health_low.wav b/data/sound/helper/default/health_low.wav new file mode 100644 index 00000000..081e3bc2 Binary files /dev/null and b/data/sound/helper/default/health_low.wav differ