[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4787: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4789: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4790: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4791: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
InsideQC Forums • View topic - Looping sound that stays with player

Looping sound that stays with player

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Looping sound that stays with player

Postby Baker » Mon May 07, 2012 7:02 am

I am trying to set up some triggers that play an ambient wav warning the player that some sort of danger is imminent. (I'm actually using this to limit player freedom to just go anywhere they want and if they ignore this ... kill them. Sure I could just centerprint a warning only but I'd rather freak out the player).

1. Now I am rather certain there is no way in standard Quake to have this play only for the player (and not other players). Not a problem. However, anyone know what extension (if any) can do a player only sound (no CSQC)?

2. Is there a way that the origin of the looping sound can move with the player in standard Quake? If not, what extension would allow such a thing?

I'd dig in QuakeC except ... well ... I'm not sure what mod has such a feature (if any).
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Re: Looping sound that stays with player

Postby Spike » Mon May 07, 2012 7:09 am

stuffcmd("play foo/warning.wav\n");
many engines either have a play2 command, or directly modified the play command such that the sound follows the player (audio code already accepts some specific entity value to mean 'follow player').
.
Spike
 
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: Looping sound that stays with player

Postby Baker » Mon May 07, 2012 10:04 am

Not on topic, but QuakeC would royally suck without fteqcc :D

I've been looking at Nexuiz source codes and I see div0 wrote most of his QuakeC sensibly :D Stock QuakeC without fteqcc is quite the bit of a mess.
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Re: Looping sound that stays with player

Postby Spike » Mon May 07, 2012 11:06 am

still offtopic, but qc even with fteqcc is a bit of a mess, when it comes to complex stuff.
noone is brave enough to use classes and pointers and other stuff that would really help out quite a lot of things, mostly on account of those things being the most likely to blow up. :P
Still, I would like to see people use classes more (which are meant to work without engine extensions). It would greatly help readability in mods like TF that munge all fields together and then forget what each field was used for, in theory at least.
Xonotic's code on the other hand uses some seriously evil features that I had never intended, like #defines within #defines. Utterly evil, but also quite useful (and I often wished #pragma worked in #defines in C as well), and also an unintentional feature. Still, a feature is a feature and people tend to use features. :P
Arrays are handy, but you have to remember that they are emulated with V6 progs, and so somewhat inefficient.
Heads up for you: from here on in, I'm just gonna start using malloc in qc, when I can get away with targetting just fte. :)

on topic:
*no text*
.
Spike
 
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: Looping sound that stays with player

Postby Seven » Mon May 07, 2012 11:29 am

Hello Baker,

I know that you asked for a standard Quake possibility. I cannot gve you one.
But then you also asked: "If not, what extension would allow such a thing ?"

At least I want to throw this extension into this thread, that I personally use for sounds with fixed coordinates:
DP_SV_POINTSOUND
It is similar to the standard Quake sound function, but it uses an origin instead of an entity.
Which is, I guess, exactly what you wanted.
Again, this is only an engine specific extension, but you (as an engine dev yourself) can easily implement it into your engine.

Then again, maybe this extension is not capable to do this, but maybe worth a try.
void(vector origin, string sample, float volume, float attenuation) pointsound = #483;
vector origin = player origin

Please dont punish me for mentioning a dpextension...

Kind regards,
Seven
Seven
 
Posts: 301
Joined: Sat Oct 06, 2007 8:49 pm
Location: Germany

Re: Looping sound that stays with player

Postby Baker » Mon May 07, 2012 12:30 pm

The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Re: Looping sound that stays with player

Postby qbism » Mon May 07, 2012 4:20 pm

Some engines have a built-in called localsound that calls PF_localsound or similar. Only a specific player hears it, and it's non-locational. (it's all in your head...) "PF_privatesound" might be more accurate.
User avatar
qbism
 
Posts: 1236
Joined: Thu Nov 04, 2004 5:51 am

Re: Looping sound that stays with player

Postby Spike » Mon May 07, 2012 6:38 pm

its also unusable.
single player because its no different from calling sound - only one player hears anyway.
multiplayer because you really get no control over *who* hears it - only the person playing on the server hears it, which is useless if its a dedicated server.

note that fte's dimension stuff includes dimension_send which allows filtering sound calls. However, as an extension that encompasses so much more than just that, its a little clumsy to use for specific players, and non-trivial to implement into an engine (fte multicasts everything), but it does exist and can be used to send sounds to specific players.
.
Spike
 
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: Looping sound that stays with player

Postby r00k » Mon May 07, 2012 10:57 pm

play the sound from the viewentity?
r00k
 
Posts: 1111
Joined: Sat Nov 13, 2004 10:39 pm

Re: Looping sound that stays with player

Postby goldenboy » Tue May 08, 2012 11:35 am

I'm playing radio transmissions on the player in RMQ, via trigger.

The trigger code simply uses sound(). The engine does the moving sound stuff (no csqc). Sound in rmqe was buggy though recently.
User avatar
goldenboy
 
Posts: 924
Joined: Fri Sep 05, 2008 11:04 pm
Location: Kiel

Re: Looping sound that stays with player

Postby qbism » Tue May 08, 2012 5:13 pm

User avatar
qbism
 
Posts: 1236
Joined: Thu Nov 04, 2004 5:51 am

Re: Looping sound that stays with player

Postby Spike » Tue May 08, 2012 6:47 pm

fte's pf_localsound was added for compatibility with telejano. I don't recommend using it.
qbism, which builtin number are you using? I assume it uses channel=0, attenuation=0 over the wire...

I guess you can do it with unmodified QW servers but its really hacky!
create a room in some far away corner of the map.
when you want a sound, setorigin the player into that room, play the sound (quakeworld plays sounds using multicast so it won't be sent to anyone not in that obscure room), then teleport the player back where they were. :P
You'll near to center the sound on the player though, which can cause problems with sounds overriding each other. An attenuation of 0.001 is also a possibility, but it will still be spacialised (ie: stronger in one ear, depending on which way you're facing).


From an engine perspective, all you really have to do is to build the svc_startsound message into a unicast message instead of broadcast, and make sure SND_Spatialize sets the leftvol and rightvol to the same value for the sound.
.
Spike
 
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: Looping sound that stays with player

Postby qbism » Wed May 09, 2012 6:09 am

I'm using #33, which in some engines is 'PF_Fixme'. I wrote that pf_localsound independently in 2002 which is slightly different, but I was looking at telejano code at the time. I don't really remember why svc_localsound had to be different that svc_sound in the first place but somehow it did for a mod at the time.
User avatar
qbism
 
Posts: 1236
Joined: Thu Nov 04, 2004 5:51 am

Re: Looping sound that stays with player

Postby Spike » Wed May 09, 2012 7:59 am

#33...
flymove in qtest (unused)...
tracebox in hexen2...

the (handicapped) telejano one is apparently #177
.
Spike
 
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: Looping sound that stays with player

Postby qbism » Wed May 09, 2012 4:59 pm

User avatar
qbism
 
Posts: 1236
Joined: Thu Nov 04, 2004 5:51 am


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest