]> git.xonotic.org Git - voretournament/voretournament.git/commitdiff
Beginning of a helper system (voice that speaks to warn you of things, such as low...
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Tue, 2 Aug 2011 15:37:36 +0000 (18:37 +0300)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Tue, 2 Aug 2011 15:37:36 +0000 (18:37 +0300)
data/defaultVT.cfg
data/qcsrc/client/View.qc
data/qcsrc/client/miscfunctions.qc
data/sound/helper/default/health_low.wav [new file with mode: 0644]

index 38346f643a9f58d9b711b1088d5472aa2719faed..18eceece9ec0da27ca07971e79d6229a60dd7810 100644 (file)
@@ -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"\r
 seta cl_announcer default "name of the announcer you wish to use from data/sound/announcer"\r
 \r
+seta cl_helper 1 "enable helper system"\r
+seta cl_helper_voice default "name of the helper you wish to use from data/sound/helper"\r
+seta cl_helper_pause 2 "number of seconds that must pass before the helper system can be triggered again"\r
+seta cl_helper_health_value 25 "the helper will warn you when going below this amount of health"\r
+\r
 seta cl_eventchase_death 1 "camera goes into 3rd person mode when the player is dead"\r
 seta cl_eventchase_distance 140 "final camera distance"\r
 seta cl_eventchase_speed 1.3 "how fast the camera slides back, 0 is instant"\r
index aed53ade42fb5300c4baec8435bdb186847f822e..d8ea89ba780871107665b4c680f8a1af8a347ea2 100644 (file)
@@ -258,6 +258,7 @@ float stomachsplash_alpha;
 float volume_modify_1, volume_modify_2, volume_modify_default_1, volume_modify_default_2;\r
 float volume_modify_changed_1, volume_modify_changed_2;\r
 float eventchase_current_distance;\r
+float helper_pause, helper_health;\r
 vector myhealth_gentlergb;\r
 vector liquidcolor_prev;\r
 vector damage_blurpostprocess, content_blurpostprocess;\r
@@ -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\r
                respawned = TRUE; // stays true for one frame\r
 \r
+       // helper system\r
+       if(cvar("cl_helper"))\r
+       if(helper_pause <= time)\r
+       {\r
+               if(getstati(STAT_HEALTH) <= cvar("cl_helper_health_value"))\r
+               {\r
+                       if(!helper_health)\r
+                       {\r
+                               sound(self, CHAN_VOICE, strcat("helper/", cvar_string("cl_helper_voice"), "/health_low.wav"), VOL_BASEVOICE, ATTN_NONE);\r
+                               helper_health = TRUE;\r
+                               helper_pause = time + cvar("cl_helper_pause");\r
+                       }\r
+               }\r
+               else if(helper_health)\r
+                       helper_health = FALSE;\r
+       }\r
+\r
        // event chase camera\r
        if(cvar("chase_active") <= 0) // greater than 0 means it's enabled manually, and this code is skipped\r
        {\r
index 5e098d9a089f037ea718e1c73c9c7b3b83c5954f..1c3da912326e42b4750bab6ccfeb8b5453b33116 100644 (file)
@@ -180,6 +180,8 @@ void Announcer_Precache () {
 \r
        precache_sound (strcat("announcer/", cvar_string("cl_announcer"), "/lastsecond.wav"));\r
        precache_sound (strcat("announcer/", cvar_string("cl_announcer"), "/narrowly.wav"));\r
+\r
+       precache_sound (strcat("helper/", cvar_string("cl_helper_voice"), "/health_low.wav"));\r
 }\r
 \r
 void AuditLists()\r
diff --git a/data/sound/helper/default/health_low.wav b/data/sound/helper/default/health_low.wav
new file mode 100644 (file)
index 0000000..081e3bc
Binary files /dev/null and b/data/sound/helper/default/health_low.wav differ