"Right" Way To Play CD Track
Moderator: InsideQC Admins
14 posts
• Page 1 of 1
"Right" Way To Play CD Track
Spirit said that Quoth has in the mod the ability to send to the client the "cd play xxx" command to play "cd music" [although I'm thinking MP3 or OGG, personally].
I think that's a great idea, but I'm looking for the "right" way to do it.
With DarkPlaces is there a proper way to tell the client via QuakeC to play a "cd track" or music?
The reason that the "cd play xxx" command is the wrong way in my opinion is that direct cd functionality shouldn't even accessible via a mod.
Although I think it would be hilarious for a server admin to have a mod repeatedly send "cd eject" and "cd close" to a troublesome player (LOL
) and have his/her cd player open and close.
Basically, some commands like "cd <anything>" should be offlimits to the server and the client should ignore such commands. (ProQuake 4, for example, won't act upon a server "unbindall" keys and do that; historically jerk admins would do that people they didn't like and abuse the "profile" command which would crash a client -- referred to as "superkick" in the NQ community -- something of which LordHavoc shared to fix for a couple of years back).
I think that's a great idea, but I'm looking for the "right" way to do it.
With DarkPlaces is there a proper way to tell the client via QuakeC to play a "cd track" or music?
The reason that the "cd play xxx" command is the wrong way in my opinion is that direct cd functionality shouldn't even accessible via a mod.
Although I think it would be hilarious for a server admin to have a mod repeatedly send "cd eject" and "cd close" to a troublesome player (LOL
Basically, some commands like "cd <anything>" should be offlimits to the server and the client should ignore such commands. (ProQuake 4, for example, won't act upon a server "unbindall" keys and do that; historically jerk admins would do that people they didn't like and abuse the "profile" command which would crash a client -- referred to as "superkick" in the NQ community -- something of which LordHavoc shared to fix for a couple of years back).
The night is young. How else can I annoy the world before sunsrise?
Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
-

Baker - Posts: 3666
- Joined: Tue Mar 14, 2006 5:15 am
I'd assume that it does it by "stuffcmd", which is quite evil and I'd totally agree with most of what you said here (where I disagree is that I think "cd play/stop/pause" should be allowed as mods could use it to dramatic effect). I'd even go so far as saying that some cvars should be off-limits ("vid_mode", anyone?) and unless it's explicitly marked as a server cvar there should be some means of interception, and clients should be allowed the option of rejecting or accepting the change.
I'd like to see extended QC builtins to replace most of the current uses of "stuffcmd" in fact, so that mods could do these things in a safer manner and without needing to resort to brute force.
I'd like to see extended QC builtins to replace most of the current uses of "stuffcmd" in fact, so that mods could do these things in a safer manner and without needing to resort to brute force.
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
We knew the words, we knew the score, we knew what we were fighting for
-

mh - Posts: 2292
- Joined: Sat Jan 12, 2008 1:38 am
Ah!
Well, looks like a good case for "cd tracks" to be numbered then [since this is supported in base Q1], instead of actual music titles.
Whatever that mysterious "looptrack" is for the 2nd byte, I'm not seeing that being used in the engine anywhere.
Well, looks like a good case for "cd tracks" to be numbered then [since this is supported in base Q1], instead of actual music titles.
- Code: Select all
case svc_cdtrack:
cl.cdtrack = MSG_ReadByte ();
cl.looptrack = MSG_ReadByte ();
if ( (cls.demoplayback || cls.demorecording) && (cls.forcetrack != -1) )
CDAudio_Play ((byte)cls.forcetrack, true);
else
CDAudio_Play ((byte)cl.cdtrack, true);
break;
Whatever that mysterious "looptrack" is for the 2nd byte, I'm not seeing that being used in the engine anywhere.
TextPad 5 search of q1/qw source: wrote:Searching for: looptrack
WinQuake\cl_parse.c(65): "svc_cdtrack", // [byte] track [byte] looptrack
WinQuake\cl_parse.c(930): cl.looptrack = MSG_ReadByte ();
WinQuake\client.h(224): int cdtrack, looptrack; // cd audio
WinQuake\protocol.h(128): #define svc_cdtrack 32 // [byte] track [byte] looptrack
Found 4 occurrence(s) in 3 file(s)
Searching for: cdtrack
QW\client\cl_demo.c(457): MSG_WriteByte (&buf, svc_cdtrack);
QW\client\cl_parse.c(63): "svc_cdtrack",
QW\client\cl_parse.c(1277): case svc_cdtrack:
QW\client\cl_parse.c(1278): cl.cdtrack = MSG_ReadByte ();
QW\client\cl_parse.c(1279): CDAudio_Play ((byte)cl.cdtrack, true);
QW\client\client.h(285): int cdtrack; // cd audio
QW\client\protocol.h(102): #define svc_cdtrack 32 // [byte] track
QW\progs\client.qc(194): WriteByte (MSG_ALL, SVC_CDTRACK);
QW\progs\defs.qc(341): float SVC_CDTRACK = 32;
QW\server\sv_user.c(111): MSG_WriteByte (&host_client->netchan.message, svc_cdtrack);
WinQuake\cl_parse.c(65): "svc_cdtrack", // [byte] track [byte] looptrack
WinQuake\cl_parse.c(928): case svc_cdtrack:
WinQuake\cl_parse.c(929): cl.cdtrack = MSG_ReadByte ();
WinQuake\cl_parse.c(934): CDAudio_Play ((byte)cl.cdtrack, true);
WinQuake\client.h(224): int cdtrack, looptrack; // cd audio
WinQuake\protocol.h(128): #define svc_cdtrack 32 // [byte] track [byte] looptrack
WinQuake\sv_main.c(220): MSG_WriteByte (&client->message, svc_cdtrack);
Found 17 occurrence(s) in 11 file(s)
The night is young. How else can I annoy the world before sunsrise?
Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
-

Baker - Posts: 3666
- Joined: Tue Mar 14, 2006 5:15 am
Check out the Darkplaces source for the CD stuff, it is beautiful.
Quoth has *_command entities that allow you to send commands and cvar changes (I think).
Quoth has *_command entities that allow you to send commands and cvar changes (I think).
Improve Quaddicted, send me a pull request: https://github.com/SpiritQuaddicted/Quaddicted-reviews
- Spirit
- Posts: 1031
- Joined: Sat Nov 20, 2004 9:00 pm
From the looks of it cl.looptrack should indicate whether or not the track is to repeat forever, but yeah, I don't see cl.looptrack being used anywhere either (not even in the DOS code).
I'd guess that either the CDAudio_Play calls for svc_cdtrack should use cl.looptrack instead of true as a param and you've just discovered a bug, or else this was a feature of the game (perhaps playing monster or other sounds from CD instead of from PAK files) that got abandoned during development but was left in the protocol.
v.sounds even goes into both byte fields from the server side so it looks like the latter.
That's something interesting for mods to play around with potentially, or otherwise an unused 8 bits during server spawning that engine developers can have a party with.
I'd guess that either the CDAudio_Play calls for svc_cdtrack should use cl.looptrack instead of true as a param and you've just discovered a bug, or else this was a feature of the game (perhaps playing monster or other sounds from CD instead of from PAK files) that got abandoned during development but was left in the protocol.
v.sounds even goes into both byte fields from the server side so it looks like the latter.
That's something interesting for mods to play around with potentially, or otherwise an unused 8 bits during server spawning that engine developers can have a party with.
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
We knew the words, we knew the score, we knew what we were fighting for
-

mh - Posts: 2292
- Joined: Sat Jan 12, 2008 1:38 am
mh wrote:That's something interesting for mods to play around with potentially, or otherwise an unused 8 bits during server spawning that engine developers can have a party with.
*Snort*
The night is young. How else can I annoy the world before sunsrise?
Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
-

Baker - Posts: 3666
- Joined: Tue Mar 14, 2006 5:15 am
Baker wrote:mh wrote:That's something interesting for mods to play around with potentially, or otherwise an unused 8 bits during server spawning that engine developers can have a party with.
*Snort*Haha.
A special prize goes to the first person who puts porn in there.
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
We knew the words, we knew the score, we knew what we were fighting for
-

mh - Posts: 2292
- Joined: Sat Jan 12, 2008 1:38 am
mh wrote:That's something interesting for mods to play around with potentially, or otherwise an unused 8 bits during server spawning that engine developers can have a party with.
I think I may have found a good use for this extra byte.
The night is young. How else can I annoy the world before sunsrise?
Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
-

Baker - Posts: 3666
- Joined: Tue Mar 14, 2006 5:15 am
An obvious use for non-looping tracks is for intermission/ending audio.
I can't check this at the moment, but I guess this is what I used in the "Loop" option here:

mh wrote:From the looks of it cl.looptrack should indicate whether or not the track is to repeat forever, but yeah, I don't see cl.looptrack being used anywhere either (not even in the DOS code).
I can't check this at the moment, but I guess this is what I used in the "Loop" option here:

-

mankrip - Posts: 915
- Joined: Fri Jul 04, 2008 3:02 am
looptrack isn't a true/false, its a second track to play (and loop) after the first has ended.
it was removed in quakeworld.
it was removed in quakeworld.
- Spike
- Posts: 2892
- Joined: Fri Nov 05, 2004 3:12 am
- Location: UK
at my old pc, when i entered cd_eject my whole PC began to open/close it O_O
the CD player. such an LOL feature.
Anyways, the thread reminds me of one city map, truly Quake City map, in Quake (lol!) if there is one known, i would really love to know this.
the CD player. such an LOL feature.
Anyways, the thread reminds me of one city map, truly Quake City map, in Quake (lol!) if there is one known, i would really love to know this.
-

Ranger366 - Posts: 203
- Joined: Thu Mar 18, 2010 5:51 pm
Back in the day I ripped out the important parts of quake's cd code and just made a prog that constantly ejected and then injected in a loop.
Killed the entire machine, well, everything but the cd tray.
Yay windows! :P
Incidentilly, does Quake still lock up briefly when using a different thread to start cd tracks?... I wonder.
But yeah, anyway, there's a faketracks extension in DP, that works either via the cd command or via the svc. faketracks are generally better than cds, as faketracks do not generally require seeking/spinning up cds.
Killed the entire machine, well, everything but the cd tray.
Yay windows! :P
Incidentilly, does Quake still lock up briefly when using a different thread to start cd tracks?... I wonder.
But yeah, anyway, there's a faketracks extension in DP, that works either via the cd command or via the svc. faketracks are generally better than cds, as faketracks do not generally require seeking/spinning up cds.
- Spike
- Posts: 2892
- Joined: Fri Nov 05, 2004 3:12 am
- Location: UK
14 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest