View previous topic :: View next topic |
Author |
Message |
Baker

Joined: 14 Mar 2006 Posts: 1538
|
Posted: Tue Jan 12, 2010 7:11 pm Post subject: "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). _________________ Tomorrow Never Dies. I feel this Tomorrow knocking on the door ... |
|
Back to top |
|
 |
mh

Joined: 12 Jan 2008 Posts: 909
|
Posted: Tue Jan 12, 2010 7:22 pm Post subject: |
|
|
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. _________________ DirectQ Engine - New release 1.8.666a, 9th August 2010
MHQuake Blog (General)
Direct3D 8 Quake Engines |
|
Back to top |
|
 |
leileilol

Joined: 15 Oct 2004 Posts: 1321
|
Posted: Tue Jan 12, 2010 7:55 pm Post subject: |
|
|
Quake does it by a SVC builtin actually _________________
 |
|
Back to top |
|
 |
Baker

Joined: 14 Mar 2006 Posts: 1538
|
Posted: Tue Jan 12, 2010 8:12 pm Post subject: |
|
|
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.
Code: | 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) |
_________________ Tomorrow Never Dies. I feel this Tomorrow knocking on the door ... |
|
Back to top |
|
 |
Spirit

Joined: 20 Nov 2004 Posts: 476
|
Posted: Tue Jan 12, 2010 9:17 pm Post subject: |
|
|
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). _________________ Quake Maps |
|
Back to top |
|
 |
mh

Joined: 12 Jan 2008 Posts: 909
|
Posted: Tue Jan 12, 2010 9:39 pm Post subject: |
|
|
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. _________________ DirectQ Engine - New release 1.8.666a, 9th August 2010
MHQuake Blog (General)
Direct3D 8 Quake Engines |
|
Back to top |
|
 |
Baker

Joined: 14 Mar 2006 Posts: 1538
|
Posted: Tue Jan 12, 2010 9:45 pm Post subject: |
|
|
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. _________________ Tomorrow Never Dies. I feel this Tomorrow knocking on the door ... |
|
Back to top |
|
 |
mh

Joined: 12 Jan 2008 Posts: 909
|
Posted: Tue Jan 12, 2010 9:47 pm Post subject: |
|
|
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.  _________________ DirectQ Engine - New release 1.8.666a, 9th August 2010
MHQuake Blog (General)
Direct3D 8 Quake Engines |
|
Back to top |
|
 |
metlslime
Joined: 05 Feb 2008 Posts: 177
|
Posted: Tue Jan 12, 2010 11:07 pm Post subject: |
|
|
mh wrote: | A special prize goes to the first person who puts porn in there.  |
That would be difficult. At least with 16 bits you could put a Unicode penis symbol or something. |
|
Back to top |
|
 |
Baker

Joined: 14 Mar 2006 Posts: 1538
|
Posted: Tue Jun 29, 2010 1:19 pm Post subject: |
|
|
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.  _________________ Tomorrow Never Dies. I feel this Tomorrow knocking on the door ... |
|
Back to top |
|
 |
mk

Joined: 04 Jul 2008 Posts: 94
|
Posted: Tue Jun 29, 2010 2:47 pm Post subject: |
|
|
An obvious use for non-looping tracks is for intermission/ending audio.
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:
 _________________ Makaqu engine blog / website.
Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn. |
|
Back to top |
|
 |
Spike
Joined: 05 Nov 2004 Posts: 944 Location: UK
|
Posted: Tue Jun 29, 2010 6:10 pm Post subject: |
|
|
looptrack isn't a true/false, its a second track to play (and loop) after the first has ended.
it was removed in quakeworld. _________________ What's a signature? |
|
Back to top |
|
 |
Ranger366

Joined: 18 Mar 2010 Posts: 72 Location: Berlin (Germany)
|
Posted: Tue Jun 29, 2010 7:22 pm Post subject: |
|
|
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. _________________
 |
|
Back to top |
|
 |
Spike
Joined: 05 Nov 2004 Posts: 944 Location: UK
|
Posted: Tue Jun 29, 2010 9:54 pm Post subject: |
|
|
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. _________________ What's a signature? |
|
Back to top |
|
 |
|