r4507 - in trunk/data/qcsrc: client common server
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Fri Sep 26 14:36:48 EDT 2008
Author: div0
Date: 2008-09-26 14:36:47 -0400 (Fri, 26 Sep 2008)
New Revision: 4507
Modified:
trunk/data/qcsrc/client/Main.qc
trunk/data/qcsrc/client/main.qh
trunk/data/qcsrc/client/sbar.qc
trunk/data/qcsrc/common/constants.qh
trunk/data/qcsrc/server/cl_client.qc
trunk/data/qcsrc/server/clientcommands.qc
trunk/data/qcsrc/server/defs.qh
trunk/data/qcsrc/server/g_world.qc
trunk/data/qcsrc/server/miscfunctions.qc
trunk/data/qcsrc/server/scores.qc
trunk/data/qcsrc/server/teamplay.qc
trunk/data/qcsrc/server/vote.qc
trunk/data/qcsrc/server/vote.qh
Log:
new vote/ready nagger display (untested, can't test this alone)
fix MOTD display for spectators for now
Modified: trunk/data/qcsrc/client/Main.qc
===================================================================
--- trunk/data/qcsrc/client/Main.qc 2008-09-26 18:00:54 UTC (rev 4506)
+++ trunk/data/qcsrc/client/Main.qc 2008-09-26 18:36:47 UTC (rev 4507)
@@ -444,6 +444,26 @@
Sbar_UpdateTeamPos(o);
}
+void Ent_Nagger()
+{
+ float nags;
+ string s;
+
+ nags = ReadByte();
+
+ if(nags & 128)
+ {
+ if(vote_called_vote)
+ strunzone(vote_called_vote);
+ vote_called_vote = strzone(ReadString());
+ }
+
+ ready_waiting = (nags & 1);
+ ready_waiting_for_me = (nags & 2);
+ vote_waiting = (nags & 4);
+ vote_waiting_for_me = (nags & 8);
+}
+
// CSQC_Ent_Update : Called every frame that the server has indicated an update to the SSQC / CSQC entity has occured.
// The only parameter reflects if the entity is "new" to the client, meaning it just came into the client's PVS.
void(float bIsNewEntity) CSQC_Ent_Update =
@@ -484,6 +504,8 @@
Ent_RainOrSnow();
else if(self.enttype == ENT_CLIENT_LASER)
Ent_Laser();
+ else if(self.enttype == ENT_CLIENT_NAGGER)
+ Ent_Nagger();
else
error("unknown entity type in CSQC_Ent_Update\n");
Modified: trunk/data/qcsrc/client/main.qh
===================================================================
--- trunk/data/qcsrc/client/main.qh 2008-09-26 18:00:54 UTC (rev 4506)
+++ trunk/data/qcsrc/client/main.qh 2008-09-26 18:36:47 UTC (rev 4507)
@@ -129,3 +129,9 @@
string getcommandkey(string text, string command);
float sbar_showbinds;
float sbar_showbinds_limit;
+
+string vote_called_vote;
+float ready_waiting;
+float ready_waiting_for_me;
+float vote_waiting;
+float vote_waiting_for_me;
Modified: trunk/data/qcsrc/client/sbar.qc
===================================================================
--- trunk/data/qcsrc/client/sbar.qc 2008-09-26 18:00:54 UTC (rev 4506)
+++ trunk/data/qcsrc/client/sbar.qc 2008-09-26 18:36:47 UTC (rev 4507)
@@ -1323,6 +1323,19 @@
return 0;
}
+vector Sbar_DrawNoteLine(vector offset, string s)
+{
+ dummyfunction(0, 0, 0, 0, 0, 0, 0, 0); // work around DP bug (set OFS_PARAM5 to 0)
+ drawcolorcodedstring(
+ offset - sbar_fontsize_x * '1 0 0' * stringwidth(s, TRUE),
+ s,
+ sbar_fontsize,
+ sbar_alpha_fg,
+ 0
+ );
+ return offset + sbar_fontsize_y * '0 1 0';
+}
+
void Sbar_Draw (void)
{
float i;
@@ -1333,63 +1346,25 @@
sbar_fontsize = Sbar_GetFontsize();
- if(warmup_stage)
- {
- s = strcat("^1Press ^3", getcommandkey("ready", "ready"), "^1 to end warmup");
- dummyfunction(0, 0, 0, 0, 0, 0, 0, 0); // work around DP bug (set OFS_PARAM5 to 0)
- drawcolorcodedstring(
- o - sbar_fontsize_x * '2 0 0' * stringwidth(s, TRUE),
- s,
- sbar_fontsize * 2,
- sbar_alpha_fg,
- 0
- );
- o += sbar_fontsize_y * '0 2 0';
- }
-
if(spectatee_status)
{
if(spectatee_status == -1)
s = "^1Observing";
else
s = strcat("^1Spectating ^7", getplayerkey(spectatee_status - 1, "name"));
- dummyfunction(0, 0, 0, 0, 0, 0, 0, 0); // work around DP bug (set OFS_PARAM5 to 0)
- drawcolorcodedstring(
- o - sbar_fontsize_x * '1 0 0' * stringwidth(s, TRUE),
- s,
- sbar_fontsize,
- sbar_alpha_fg,
- 0
- );
- o += sbar_fontsize_y * '0 1 0';
+ o = Sbar_DrawNoteLine(o, s);
if(spectatee_status == -1)
s = strcat("^1Press ^3", getcommandkey("primary fire", "+attack"), "^1 to spectate");
else
s = strcat("^1Press ^3", getcommandkey("primary fire", "+attack"), "^1 for another player");
- dummyfunction(0, 0, 0, 0, 0, 0, 0, 0); // work around DP bug (set OFS_PARAM5 to 0)
- drawcolorcodedstring(
- o - sbar_fontsize_x * '1 0 0' * stringwidth(s, TRUE),
- s,
- sbar_fontsize,
- sbar_alpha_fg,
- 0
- );
- o += sbar_fontsize_y * '0 1 0';
+ o = Sbar_DrawNoteLine(o, s);
if(spectatee_status == -1)
s = strcat("^1Use ^3", getcommandkey("next-weapon", "weapnext"), "^1 or ^3", getcommandkey("previous-weapon", "weapprev"), "^1 to change the speed");
else
s = strcat("^1Press ^3", getcommandkey("secondary fire", "+altattack"), getcommandkey("", "weapprev"), "^1 to observe");
- dummyfunction(0, 0, 0, 0, 0, 0, 0, 0); // work around DP bug (set OFS_PARAM5 to 0)
- drawcolorcodedstring(
- o - sbar_fontsize_x * '1 0 0' * stringwidth(s, TRUE),
- s,
- sbar_fontsize,
- sbar_alpha_fg,
- 0
- );
- o += sbar_fontsize_y * '0 1 0';
+ o = Sbar_DrawNoteLine(o, s);
if(gametype == GAME_ARENA)
s = "^1Wait for your turn to join";
@@ -1406,17 +1381,50 @@
}
else
s = strcat("^1Press ^7", getcommandkey("jump", "+jump"), "^1 to join");
- dummyfunction(0, 0, 0, 0, 0, 0, 0, 0); // work around DP bug (set OFS_PARAM5 to 0)
- drawcolorcodedstring(
- o - sbar_fontsize_x * '1 0 0' * stringwidth(s, TRUE),
- s,
- sbar_fontsize,
- sbar_alpha_fg,
- 0
- );
- o += sbar_fontsize_y * '0 1 0';
+ o = Sbar_DrawNoteLine(o, s);
}
+ if(ready_waiting)
+ {
+ if(ready_waiting_for_me)
+ {
+ if(warmup_stage)
+ s = strcat("^1Press ^3", getcommandkey("ready", "ready"), "^1 to end warmup");
+ else
+ s = strcat("^1Press ^3", getcommandkey("ready", "ready"), "^1 once you are ready");
+ }
+ else
+ {
+ if(warmup_stage)
+ s = strcat("^1Waiting for others to ready up to end warmup...");
+ else
+ s = strcat("^1Waiting for others to ready up...");
+ }
+ o = Sbar_DrawNoteLine(o, s);
+ }
+ if(vote_waiting)
+ {
+ s = strcat("^1A vote has been called for ", vote_called_vote);
+ o = Sbar_DrawNoteLine(o, s);
+
+ if(vote_waiting_for_me)
+ {
+ s = strcat("^1Press ^3", getcommandkey("vyes", "vyes"), "^1 to accept");
+ o = Sbar_DrawNoteLine(o, s);
+
+ s = strcat("^1Press ^3", getcommandkey("vno", "vno"), "^1 to reject");
+ o = Sbar_DrawNoteLine(o, s);
+
+ s = strcat("^1Press ^3", getcommandkey("vabstain", "vabstain"), "^1 to abstain");
+ o = Sbar_DrawNoteLine(o, s);
+ }
+ else
+ {
+ s = strcat("^1Waiting for others to vote...");
+ o = Sbar_DrawNoteLine(o, s);
+ }
+ }
+
//Sbar_SortFrags();
Sbar_UpdatePlayerTeams();
Modified: trunk/data/qcsrc/common/constants.qh
===================================================================
--- trunk/data/qcsrc/common/constants.qh 2008-09-26 18:00:54 UTC (rev 4506)
+++ trunk/data/qcsrc/common/constants.qh 2008-09-26 18:36:47 UTC (rev 4507)
@@ -18,7 +18,8 @@
// Revision 17: multi-weaponimpulses
// Revision 18: warmup
// Revision 19: fog
-#define CSQC_REVISION 19
+// Revision 20: naggers
+#define CSQC_REVISION 20
// probably put these in common/
// so server/ and client/ can be synced better
@@ -48,6 +49,7 @@
const float ENT_CLIENT_POINTPARTICLES = 6;
const float ENT_CLIENT_RAINSNOW = 7;
const float ENT_CLIENT_LASER = 8;
+const float ENT_CLIENT_NAGGER = 9; // [flags] [votecalledvote]
///////////////////////////
// key constants
Modified: trunk/data/qcsrc/server/cl_client.qc
===================================================================
--- trunk/data/qcsrc/server/cl_client.qc 2008-09-26 18:00:54 UTC (rev 4506)
+++ trunk/data/qcsrc/server/cl_client.qc 2008-09-26 18:36:47 UTC (rev 4507)
@@ -1937,8 +1937,10 @@
self.flags = self.flags | FL_JUMPRELEASED;
}
}
+ /*
if(self.BUTTON_ZOOM)
self.wantswelcomemessage = 0;
+ */
if(self.wantswelcomemessage)
PrintWelcomeMessage(self);
}
@@ -1974,8 +1976,10 @@
self.flags = self.flags | FL_JUMPRELEASED;
}
}
+ /*
if(self.BUTTON_ZOOM)
self.wantswelcomemessage = 0;
+ */
if(self.wantswelcomemessage)
PrintWelcomeMessage(self);
self.flags = self.flags | FL_CLIENT | FL_NOTARGET;
@@ -1989,7 +1993,6 @@
=============
*/
void() ctf_setstatus;
-.float vote_nagtime;
.float spectatee_status;
void PlayerPreThink (void)
{
@@ -2039,14 +2042,6 @@
self.version_nagtime = 0;
}
- // vote nagging
- if(self.cvar_scr_centertime)
- if(time > self.vote_nagtime)
- {
- VoteNag();
- self.vote_nagtime = time + self.cvar_scr_centertime * 0.6;
- }
-
// GOD MODE info
if(!(self.flags & FL_GODMODE)) if(self.max_armorvalue)
{
Modified: trunk/data/qcsrc/server/clientcommands.qc
===================================================================
--- trunk/data/qcsrc/server/clientcommands.qc 2008-09-26 18:00:54 UTC (rev 4506)
+++ trunk/data/qcsrc/server/clientcommands.qc 2008-09-26 18:36:47 UTC (rev 4507)
@@ -1,3 +1,48 @@
+entity nagger;
+float readycount;
+void Nagger_SendEntity(entity to, float sendflags)
+{
+ float nags;
+ WriteByte(MSG_ENTITY, ENT_CLIENT_NAGGER);
+
+ nags = 0;
+ if(readycount)
+ {
+ nags |= 1;
+ if(to.ready == 0)
+ nags |= 2;
+ }
+ if(votecalled)
+ {
+ nags |= 4;
+ if(to.vote_vote == 0)
+ nags |= 8;
+ }
+
+ if(sendflags & 128)
+ {
+ WriteByte(MSG_ENTITY, nags | 128);
+ WriteString(MSG_ENTITY, votecalledvote);
+ }
+ else
+ WriteByte(MSG_ENTITY, nags);
+}
+void Nagger_Init()
+{
+ nagger = spawn();
+ Net_LinkEntity(nagger);
+ nagger.SendFlags = 128;
+ nagger.SendEntity = Nagger_SendEntity;
+}
+void Nagger_VoteChanged()
+{
+ nagger.SendFlags = 128;
+}
+void Nagger_ReadyCounted()
+{
+ nagger.SendFlags = 1;
+}
+
void ReadyCount();
string MapVote_Suggest(string m);
@@ -395,11 +440,6 @@
if(checkrules_overtimeend)
checkrules_overtimeend = 0;
- if(readyNagActive) { //if every player is ready, remove the ready-nagger again
- readyNagActive = 0;
- remove(readyNagger);
- }
-
restart_countdown = time + RESTART_COUNTDOWN;
restart_mapalreadyrestarted = 0; //reset this var, needed when cvar sv_ready_restart_repeatable is in use
if(0 < cvar("timelimit") || inWarmupStage)
@@ -480,60 +520,16 @@
r += 1;
}
- if(!r)
- return; // NOTE: this also excludes !p, as r <= p
+ readycount = r;
- if(cvar("sv_ready_restart_nag")) {
- if(!readyNagActive) {
- readyNagger = spawn();
- readyNagger.think = readyNagger_Think;
- readyNagger.cnt = cvar("sv_ready_restart_nag_duration");
- readyNagger.nextthink = time;
- readyNagActive = 1;
- }
- }
+ if(r) // at least one is ready
+ if(r == p) // and, everyone is ready
+ ReadyRestart();
- if(r < p)
- return;
-
- ReadyRestart();
+ Nagger_ReadyCounted();
}
/**
- * Centerprints the information to all players who didn't ready up yet to do so.
- */
-void readyNagger_Think() {
- local entity plr;
- if(self.cnt <= 0) { //have a break showing the ready nag
- //make sure that the old ready-nag-centerprint isn't shown too long:
- FOR_EACH_REALCLIENT(plr) {
- if(plr.classname == "player") {
- if (!plr.ready)
- centerprint_atprio(plr, CENTERPRIO_SPAM, "");
- }
- }
- self.cnt = cvar("sv_ready_restart_nag_duration");
- self.nextthink = time + cvar("sv_ready_restart_nag_interval");
- }
- else {
- //show the ready nagging to all players who aren't ready yet
- FOR_EACH_REALCLIENT(plr) {
- if(plr.classname == "player") {
- if (!plr.ready) {
- centerprint_atprio(plr, CENTERPRIO_SPAM, "^2Please ready up (F4 by default)!");
- //play reminder sound once the centerprint appears for the first time after the pause:
- if (self.cnt == cvar("sv_ready_restart_nag_duration"))
- play2(plr, "misc/talk2.wav");
- }
- }
- }
-
- self.nextthink = time + 1;
- self.cnt -= 1;
- }
-}
-
-/**
* Shows the restart countdown for all players.
* Plays the countdown sounds for the seconds 3, 2 1, begin for everyone.
* Restarts the map after the countdown is over (and cvar sv_ready_restart_after_countdown
Modified: trunk/data/qcsrc/server/defs.qh
===================================================================
--- trunk/data/qcsrc/server/defs.qh 2008-09-26 18:00:54 UTC (rev 4506)
+++ trunk/data/qcsrc/server/defs.qh 2008-09-26 18:36:47 UTC (rev 4507)
@@ -281,9 +281,6 @@
float restart_mapalreadyrestarted; //bool, indicates whether reset_map() was already executed
entity restartAnnouncer; //a temporary entity which will play the countdown sounds 3, 2, 1 for all clients, will also reset the map after the countdown
void restartAnnouncer_Think();
-entity readyNagger; //manages printing the ready-nag to active players who are not ready yet
-void readyNagger_Think();
-float readyNagActive; //if set to 1, the readyNagger entity was already spawned (boolean)
float blockSpectators; //if set, new or existing spectators or observers will be removed unless they become a player within g_maxplayers_spectator_blocktime seconds
.float spectatortime; //point in time since the client is spectating or observing
void checkSpectatorBlock();
Modified: trunk/data/qcsrc/server/g_world.qc
===================================================================
--- trunk/data/qcsrc/server/g_world.qc 2008-09-26 18:00:54 UTC (rev 4506)
+++ trunk/data/qcsrc/server/g_world.qc 2008-09-26 18:36:47 UTC (rev 4507)
@@ -156,6 +156,7 @@
float world_already_spawned;
void RegisterWeapons();
+void Nagger_Init();
void spawnfunc_worldspawn (void)
{
float fd, l;
@@ -357,6 +358,7 @@
addstat(STAT_SYS_TICRATE, AS_FLOAT, stat_sys_ticrate);
addstat(STAT_WEAPONS, AS_INT, weapons);
addstat(STAT_SWITCHWEAPON, AS_INT, switchweapon);
+ Nagger_Init();
next_pingtime = time + 5;
world_initialized = 1;
Modified: trunk/data/qcsrc/server/miscfunctions.qc
===================================================================
--- trunk/data/qcsrc/server/miscfunctions.qc 2008-09-26 18:00:54 UTC (rev 4506)
+++ trunk/data/qcsrc/server/miscfunctions.qc 2008-09-26 18:36:47 UTC (rev 4507)
@@ -657,8 +657,6 @@
centerprint_atprio(e, CENTERPRIO_NORMAL, s);
}
-void VoteNag();
-
// decolorizes and team colors the player name when needed
string playername(entity p)
{
@@ -1454,3 +1452,11 @@
self.use = assault_destructible_use; // shared use function, b/c they woudl do the same thing anyways
self.event_damage = func_breakable_damage;
}
+
+void Net_LinkEntity(entity e)
+{
+ e.model = "net_entity";
+ e.modelindex = 1;
+ e.effects = EF_NODEPTHTEST | EF_LOWPRECISION;
+}
+
Modified: trunk/data/qcsrc/server/scores.qc
===================================================================
--- trunk/data/qcsrc/server/scores.qc 2008-09-26 18:00:54 UTC (rev 4506)
+++ trunk/data/qcsrc/server/scores.qc 2008-09-26 18:36:47 UTC (rev 4507)
@@ -10,13 +10,6 @@
float scores_flags_primary;
float teamscores_flags_primary;
-void Net_LinkEntity(entity e)
-{
- e.model = "net_entity";
- e.modelindex = 1;
- e.effects = EF_NODEPTHTEST | EF_LOWPRECISION;
-}
-
vector ScoreField_Compare(entity t1, entity t2, .float field, float fieldflags, vector previous) // returns: cmp value, best prio
{
if(!(fieldflags & SFL_SORT_PRIO_MASK)) // column does not sort
Modified: trunk/data/qcsrc/server/teamplay.qc
===================================================================
--- trunk/data/qcsrc/server/teamplay.qc 2008-09-26 18:00:54 UTC (rev 4506)
+++ trunk/data/qcsrc/server/teamplay.qc 2008-09-26 18:36:47 UTC (rev 4507)
@@ -387,10 +387,15 @@
else if (timeoutStatus != 0)
specString = strcat(specString, "\n\n", getTimeoutText(1));
else
- return;
+ {
+ if(!self.BUTTON_INFO && self.classname == "player")
+ return;
+ goto normal;
+ }
return centerprint_atprio(self, CENTERPRIO_SPAM, specString);
}
+:normal
if(g_minstagib)
mutator = "^2Minstagib ^1";
else if(g_rocketarena)
Modified: trunk/data/qcsrc/server/vote.qc
===================================================================
--- trunk/data/qcsrc/server/vote.qc 2008-09-26 18:00:54 UTC (rev 4506)
+++ trunk/data/qcsrc/server/vote.qc 2008-09-26 18:36:47 UTC (rev 4507)
@@ -137,6 +137,7 @@
if(cvar("sv_eventlog"))
GameLogEcho(strcat(":vote:vcall:", ftos(votecaller.playerid), ":", votecalledvote_display));
VoteCount(); // needed if you are the only one
+ Nagger_VoteChanged();
} else {
print_to(e, "^1This vote is not ok. See help for more info.");
}
@@ -175,6 +176,7 @@
if(cvar("sv_eventlog"))
GameLogEcho(strcat(":vote:vcall:", ftos(votecaller.playerid), ":", votecalledvote_display));
VoteCount(); // needed if you are the only one
+ Nagger_VoteChanged();
}
} else {
print_to(e, "^1Vote to become master is NOT allowed.");
@@ -420,6 +422,7 @@
votecalled = FALSE;
votecalledmaster = FALSE;
votefinished = 0;
+ Nagger_VoteChanged();
}
void VoteAccept() {
@@ -462,12 +465,6 @@
VoteReset();
}
-void VoteNag() {
- if(votecalled)
- if(self.vote_vote == 0)
- centerprint_atprio(self, CENTERPRIO_VOTE, strcat("^7^3", VoteNetname(votecaller), "^2 called a vote for ", votecalledvote_display, "\n\n^2You have not voted yet!\n^2HINT: By default, F1 is yes and F2 is no."));
-}
-
void VoteSpam(float yescount, float nocount, float abstaincount, float notvoters, float mincount, string result)
{
string s;
Modified: trunk/data/qcsrc/server/vote.qh
===================================================================
--- trunk/data/qcsrc/server/vote.qh 2008-09-26 18:00:54 UTC (rev 4506)
+++ trunk/data/qcsrc/server/vote.qh 2008-09-26 18:36:47 UTC (rev 4507)
@@ -15,6 +15,5 @@
void VoteReject();
void VoteTimeout();
void VoteStop(entity stopper);
-void VoteNag();
void VoteSpam(float yescount, float nocount, float abstaincount, float notvoters, float mincount, string result);
void VoteCount();
More information about the nexuiz-commits
mailing list