diff --git a/Quake/common.c b/Quake/common.c index 7830028e..6bc4cdcc 100644 --- a/Quake/common.c +++ b/Quake/common.c @@ -950,6 +950,10 @@ void MSG_WriteString (sizebuf_t *sb, const char *s) else SZ_Write (sb, s, Q_strlen(s)+1); } +void MSG_WriteStringUnterminated (sizebuf_t *sb, const char *s) +{ + SZ_Write (sb, s, Q_strlen(s)); +} //johnfitz -- original behavior, 13.3 fixed point coords, max range +-4096 void MSG_WriteCoord16 (sizebuf_t *sb, float f) diff --git a/Quake/common.h b/Quake/common.h index 2e84095b..5cd20eed 100644 --- a/Quake/common.h +++ b/Quake/common.h @@ -101,6 +101,7 @@ void MSG_WriteByte (sizebuf_t *sb, int c); void MSG_WriteShort (sizebuf_t *sb, int c); void MSG_WriteLong (sizebuf_t *sb, int c); void MSG_WriteFloat (sizebuf_t *sb, float f); +void MSG_WriteStringUnterminated (sizebuf_t *sb, const char *s); void MSG_WriteString (sizebuf_t *sb, const char *s); void MSG_WriteCoord (sizebuf_t *sb, float f, unsigned int flags); void MSG_WriteAngle (sizebuf_t *sb, float f, unsigned int flags); diff --git a/Quake/sv_main.c b/Quake/sv_main.c index e2827e2e..43029048 100644 --- a/Quake/sv_main.c +++ b/Quake/sv_main.c @@ -1706,7 +1706,7 @@ This will be sent on the initial connection and upon each server load. */ void SV_SendServerinfo (client_t *client) { - const char **s; + const char **s, *noise; char message[2048]; unsigned int i; //johnfitz qboolean cantruncate; @@ -1862,9 +1862,19 @@ retry: } // send music - MSG_WriteByte (&client->message, svc_cdtrack); - MSG_WriteByte (&client->message, qcvm->edicts->v.sounds); - MSG_WriteByte (&client->message, qcvm->edicts->v.sounds); + if (qcvm->edicts->v.sounds == -1 && *(noise = PR_GetString(qcvm->edicts->v.noise)) && !strchr(noise, '\"') && !strchr(noise, '\n')) + { //world.sounds ==-1 && world.noise!="" + MSG_WriteByte (&client->message, svc_stufftext); + MSG_WriteStringUnterminated (&client->message, "music \""); + MSG_WriteStringUnterminated (&client->message, noise); + MSG_WriteString(&client->message, "\"\n"); + } + else + { + MSG_WriteByte (&client->message, svc_cdtrack); + MSG_WriteByte (&client->message, qcvm->edicts->v.sounds); + MSG_WriteByte (&client->message, qcvm->edicts->v.sounds); + } // set view MSG_WriteByte (&client->message, svc_setview);