summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrey Nazarov <skuller@skuller.net>2012-12-29 19:07:38 +0400
committerAndrey Nazarov <skuller@skuller.net>2012-12-29 21:36:20 +0400
commit374033c5c75725218f04390859ccf73d120d5c2c (patch)
tree6c7f400e43b45f26ed2e894d36afb7c3f30b577d /src
parent1e065662be8f46ffdd21ab2499f91921f4f0e9d1 (diff)
Communicate ss_broadcast state to Q2PRO clients.
Disable message triggers when playing back MVD streams. Process MVD spectator chat normally on the client so that ignore filters work. Add new minor Q2PRO protocol version 1019.
Diffstat (limited to 'src')
-rw-r--r--src/client/client.h1
-rw-r--r--src/client/parse.c19
-rw-r--r--src/server/mvd/game.c30
-rw-r--r--src/server/user.c2
4 files changed, 41 insertions, 11 deletions
diff --git a/src/client/client.h b/src/client/client.h
index 070274f..d63a763 100644
--- a/src/client/client.h
+++ b/src/client/client.h
@@ -242,6 +242,7 @@ typedef struct client_state_s {
//
// server state information
//
+ int serverstate; // ss_* constants
int servercount; // server identification for prespawns
char gamedir[MAX_QPATH];
int clientNum; // never changed during gameplay, set by serverdata packet
diff --git a/src/client/parse.c b/src/client/parse.c
index bbff5c7..29bc8d2 100644
--- a/src/client/parse.c
+++ b/src/client/parse.c
@@ -545,6 +545,9 @@ static void CL_ParseServerData(void)
cl.framediv = 1;
#endif
+ // setup default server state
+ cl.serverstate = ss_game;
+
if (cls.serverProtocol == PROTOCOL_VERSION_R1Q2) {
i = MSG_ReadByte();
if (i) {
@@ -583,7 +586,11 @@ static void CL_ParseServerData(void)
}
Com_DPrintf("Using minor Q2PRO protocol version %d\n", i);
cls.protocolVersion = i;
- MSG_ReadByte(); // used to be gametype
+ i = MSG_ReadByte();
+ if (cls.protocolVersion >= PROTOCOL_VERSION_Q2PRO_SERVER_STATE) {
+ Com_DPrintf("Q2PRO server state %d\n", i);
+ cl.serverstate = i;
+ }
i = MSG_ReadByte();
if (i) {
Com_DPrintf("Q2PRO strafejump hack enabled\n");
@@ -931,7 +938,7 @@ static void CL_ParsePrint(void)
if (level != PRINT_CHAT) {
Com_Printf("%s", s);
- if (!cls.demo.playback) {
+ if (!cls.demo.playback && cl.serverstate != ss_broadcast) {
COM_strclr(s);
Cmd_ExecTrigger(s);
}
@@ -943,7 +950,7 @@ static void CL_ParsePrint(void)
}
#if USE_AUTOREPLY
- if (!cls.demo.playback) {
+ if (!cls.demo.playback && cl.serverstate != ss_broadcast) {
CL_CheckForVersion(s);
}
#endif
@@ -971,6 +978,10 @@ static void CL_ParsePrint(void)
SCR_AddToChatHUD(s);
#endif
+ // silence MVD spectator chat
+ if (cl.serverstate == ss_broadcast && !strncmp(s, "[MVD] ", 6))
+ return;
+
// play sound
if (cl_chat_sound->integer > 1)
S_StartLocalSound_("misc/talk1.wav");
@@ -986,7 +997,7 @@ static void CL_ParseCenterPrint(void)
SHOWNET(2, " \"%s\"\n", s);
SCR_CenterPrint(s);
- if (!cls.demo.playback) {
+ if (!cls.demo.playback && cl.serverstate != ss_broadcast) {
COM_strclr(s);
Cmd_ExecTrigger(s);
}
diff --git a/src/server/mvd/game.c b/src/server/mvd/game.c
index e2eb54c..7f8e914 100644
--- a/src/server/mvd/game.c
+++ b/src/server/mvd/game.c
@@ -862,7 +862,9 @@ static void MVD_Say_f(mvd_client_t *client, int argnum)
mvd_t *mvd = client->mvd;
unsigned delta, delay = mvd_flood_waitdelay->value * 1000;
unsigned treshold = mvd_flood_persecond->value * 1000;
- char text[150], *p;
+ char text[150], hightext[150];
+ mvd_client_t *other;
+ client_t *cl;
unsigned i, j;
if (mvd_flood_mute->integer && !client->admin) {
@@ -903,12 +905,28 @@ static void MVD_Say_f(mvd_client_t *client, int argnum)
Q_snprintf(text, sizeof(text), "[MVD] %s: %s",
client->cl->name, Cmd_ArgsFrom(argnum));
- for (p = text; *p; p++) {
- *p |= 128;
- }
- MVD_BroadcastPrintf(mvd, PRINT_HIGH, client->admin ?
- 0 : UF_MUTE_OBSERVERS, "%s\n", text);
+ // color text for legacy clients
+ for (i = 0; text[i]; i++)
+ hightext[i] = text[i] | 128;
+ hightext[i] = 0;
+
+ FOR_EACH_MVDCL(other, mvd) {
+ cl = other->cl;
+ if (cl->state < cs_spawned) {
+ continue;
+ }
+ if (!client->admin && (other->uf & UF_MUTE_OBSERVERS)) {
+ continue;
+ }
+
+ if (cl->protocol == PROTOCOL_VERSION_Q2PRO &&
+ cl->version >= PROTOCOL_VERSION_Q2PRO_SERVER_STATE) {
+ SV_ClientPrintf(cl, PRINT_CHAT, "%s\n", text);
+ } else {
+ SV_ClientPrintf(cl, PRINT_HIGH, "%s\n", hightext);
+ }
+ }
}
static void MVD_Observe_f(mvd_client_t *client)
diff --git a/src/server/user.c b/src/server/user.c
index d5ba9a2..36df361 100644
--- a/src/server/user.c
+++ b/src/server/user.c
@@ -421,7 +421,7 @@ void SV_New_f(void)
break;
case PROTOCOL_VERSION_Q2PRO:
MSG_WriteShort(sv_client->version);
- MSG_WriteByte(2); // used to be GT_DEATHMATCH
+ MSG_WriteByte(sv.state);
MSG_WriteByte(sv_client->pmp.strafehack);
MSG_WriteByte(sv_client->pmp.qwmode);
if (sv_client->version >= PROTOCOL_VERSION_Q2PRO_WATERJUMP_HACK) {