[nexuiz-commits] r6662 - in trunk/data: . qcsrc/client qcsrc/menu/nexuiz qcsrc/server
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Mon May 4 13:56:44 EDT 2009
Author: greenmarine
Date: 2009-05-04 13:56:43 -0400 (Mon, 04 May 2009)
New Revision: 6662
Modified:
trunk/data/defaultNexuiz.cfg
trunk/data/qcsrc/client/Defs.qc
trunk/data/qcsrc/client/Main.qc
trunk/data/qcsrc/client/View.qc
trunk/data/qcsrc/client/miscfunctions.qc
trunk/data/qcsrc/menu/nexuiz/dialog_settings_audio.c
trunk/data/qcsrc/server/g_world.qc
trunk/data/qcsrc/server/miscfunctions.qc
Log:
Move announcer sounds for remaining map time to CSQC. Fixed resetting the "already played sound"-markers after ready-restart. Client can now define (see audio settings menu) whether he wants:
- no announcer played
- 1minute announcer
- 5minute announcer
- both
Modified: trunk/data/defaultNexuiz.cfg
===================================================================
--- trunk/data/defaultNexuiz.cfg 2009-05-04 16:24:40 UTC (rev 6661)
+++ trunk/data/defaultNexuiz.cfg 2009-05-04 17:56:43 UTC (rev 6662)
@@ -790,6 +790,7 @@
cl_sound_r_exp3 ""
sv_sound_land ""
sv_sound_watersplash ""
+seta cl_sound_maptime_warning "1" "play announcer sound telling you the remaining maptime - 0: do not play at all, 1: play at one minute, 2: play at five minutes, 3: play both"
seta cl_hitsound 1
Modified: trunk/data/qcsrc/client/Defs.qc
===================================================================
--- trunk/data/qcsrc/client/Defs.qc 2009-05-04 16:24:40 UTC (rev 6661)
+++ trunk/data/qcsrc/client/Defs.qc 2009-05-04 17:56:43 UTC (rev 6662)
@@ -209,6 +209,10 @@
// short mapname
string shortmapname;
+//remaining maptime announcer sounds, true when sound was already played
+float announcer_1min;
+float announcer_5min;
+
// database for misc stuff
float tempdb;
vector hook_shotorigin;
Modified: trunk/data/qcsrc/client/Main.qc
===================================================================
--- trunk/data/qcsrc/client/Main.qc 2009-05-04 16:24:40 UTC (rev 6661)
+++ trunk/data/qcsrc/client/Main.qc 2009-05-04 17:56:43 UTC (rev 6662)
@@ -147,6 +147,7 @@
GibSplash_Precache();
Casings_Precache();
DamageInfo_Precache();
+ Announcer_Precache();
get_mi_min_max_texcoords(1); // try the CLEVER way first
minimapname = strcat("gfx/", mi_shortname, "_radar.tga");
Modified: trunk/data/qcsrc/client/View.qc
===================================================================
--- trunk/data/qcsrc/client/View.qc 2009-05-04 16:24:40 UTC (rev 6661)
+++ trunk/data/qcsrc/client/View.qc 2009-05-04 17:56:43 UTC (rev 6662)
@@ -316,6 +316,7 @@
PostInit();
CheckForGamestartChange();
+ maptimeAnnouncer();
fov = cvar("fov");
if(button_zoom || fov <= 59.5)
Modified: trunk/data/qcsrc/client/miscfunctions.qc
===================================================================
--- trunk/data/qcsrc/client/miscfunctions.qc 2009-05-04 16:24:40 UTC (rev 6661)
+++ trunk/data/qcsrc/client/miscfunctions.qc 2009-05-04 17:56:43 UTC (rev 6662)
@@ -11,7 +11,10 @@
if (!spectatee_status) //do cprint only for players
centerprint("^1Begin!");
- sound(self, CHAN_VOICE, "announcer/robotic/begin.wav", VOL_BASEVOICE, ATTN_NONE);
+ sound(self, CHAN_VOICE, "announcer/robotic/begin.wav", VOL_BASEVOICE, ATTN_NONE);
+ //reset maptime announcers now as well
+ announcer_5min = announcer_1min = FALSE;
+
remove(self);
return;
}
@@ -25,6 +28,44 @@
self.nextthink = getstatf(STAT_GAMESTARTTIME) - (countdown - 1);
}
+}
+
+/**
+ * Plays the 1minute or 5 minutes (of maptime) remaining sound, if client wants it
+ */
+void maptimeAnnouncer() {
+ float timelimit;
+ timelimit = getstatf(STAT_TIMELIMIT);
+ float timeleft;
+ timeleft = max(0, timelimit * 60 + getstatf(STAT_GAMESTARTTIME) - time);
+
+ //5 minute check
+ if (cvar("cl_sound_maptime_warning") >= 2) {
+ //make sure that after connect (and e.g. 4 minutes left) we will not get a wrong sound
+ if (!announcer_5min && timelimit > 0 && timeleft < 300 && timeleft > 299) {
+ announcer_5min = TRUE;
+ //dprint("i will play the sound, I promise!\n");
+ sound(self, CHAN_VOICE, "announcer/robotic/5minutesremain.wav", VOL_BASEVOICE, ATTN_NONE);
+ }
+
+ }
+
+ //1 minute check
+ if (cvar("cl_sound_maptime_warning") == 1 || cvar("cl_sound_maptime_warning") == 3) {
+ if (!announcer_1min && timelimit > 0 && timeleft < 60) {
+ announcer_1min = TRUE;
+ sound(self, CHAN_VOICE, "announcer/robotic/1minuteremains.wav", VOL_BASEVOICE, ATTN_NONE);
+ }
+ }
+}
+
+/**
+ * Add all future announcer sounds precaches here.
+ * TODO: make all announcer sound() calls client-side in the end, to allow queues etc.
+ */
+void Announcer_Precache () {
+ precache_sound ("announcer/robotic/1minuteremains.wav");
+ precache_sound ("announcer/robotic/5minutesremain.wav");
}
void AuditLists()
Modified: trunk/data/qcsrc/menu/nexuiz/dialog_settings_audio.c
===================================================================
--- trunk/data/qcsrc/menu/nexuiz/dialog_settings_audio.c 2009-05-04 16:24:40 UTC (rev 6661)
+++ trunk/data/qcsrc/menu/nexuiz/dialog_settings_audio.c 2009-05-04 17:56:43 UTC (rev 6662)
@@ -157,6 +157,14 @@
me.TD(me, 1, 2, sl);
me.TR(me);
me.TR(me);
+ me.TD(me, 1, 1, e = makeNexuizTextLabel(0, "Time warning:"));
+ me.TD(me, 1, 2, e = makeNexuizTextSlider("cl_sound_maptime_warning"));
+ e.addValue(e, "None", "0");
+ e.addValue(e, "1 minute", "1");
+ e.addValue(e, "5 minutes", "2");
+ e.addValue(e, "Both", "3");
+ e.configureNexuizTextSliderValues(e);
+ me.TR(me);
me.TD(me, 1, 3, e = makeNexuizCheckBox(0, "cl_hitsound", "Hit indicator"));
me.gotoRC(me, me.rows - 1, 0);
Modified: trunk/data/qcsrc/server/g_world.qc
===================================================================
--- trunk/data/qcsrc/server/g_world.qc 2009-05-04 16:24:40 UTC (rev 6661)
+++ trunk/data/qcsrc/server/g_world.qc 2009-05-04 17:56:43 UTC (rev 6662)
@@ -1368,8 +1368,6 @@
// (div0: and that in CheckRules_World please)
};
-float checkrules_oneminutewarning;
-
float checkrules_equality;
float checkrules_suddendeathwarning;
float checkrules_suddendeathend;
@@ -1901,12 +1899,6 @@
return;
}
- if (!checkrules_oneminutewarning && timelimit > 0 && time > timelimit - 60)
- {
- checkrules_oneminutewarning = TRUE;
- play2all("announcer/robotic/1minuteremains.wav");
- }
-
checkrules_status = WinningCondition_RanOutOfSpawns();
if(checkrules_status == WINNING_YES)
{
Modified: trunk/data/qcsrc/server/miscfunctions.qc
===================================================================
--- trunk/data/qcsrc/server/miscfunctions.qc 2009-05-04 16:24:40 UTC (rev 6661)
+++ trunk/data/qcsrc/server/miscfunctions.qc 2009-05-04 17:56:43 UTC (rev 6662)
@@ -1437,7 +1437,6 @@
precache_sound ("announcer/robotic/begin.wav");
precache_sound ("announcer/robotic/timeoutcalled.wav");
precache_sound ("announcer/robotic/1fragleft.wav");
- precache_sound ("announcer/robotic/1minuteremains.wav");
precache_sound ("announcer/robotic/2fragsleft.wav");
precache_sound ("announcer/robotic/3fragsleft.wav");
if (g_minstagib)
More information about the nexuiz-commits
mailing list