Add fte's sounds=-1,noise=filename for named music tracks instead of just numbers.

This commit is contained in:
Shpoike 2021-03-08 00:20:15 +00:00
parent 5695ffe2d5
commit 2735d0f960
3 changed files with 19 additions and 4 deletions

View File

@ -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)

View File

@ -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);

View File

@ -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
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);