Local parameters for A_PlaySound and ACS PlaySound

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: Local parameters for A_PlaySound and ACS PlaySound

Re: Local parameters for A_PlaySound and ACS PlaySound

by Nash » Tue Nov 01, 2016 8:42 am

Sorry for the double post... just a reminder that the ACC side hasn't been merged yet.

Re: Local parameters for A_PlaySound and ACS PlaySound

by Nash » Tue Nov 01, 2016 8:35 am

Thanks! And no problem, we understand by now.

One step closer to removing crappy mod-side hacks... :D

Re: Local parameters for A_PlaySound and ACS PlaySound

by Graf Zahl » Tue Nov 01, 2016 8:13 am

Yes, this is better. Sorry, I missed it while I was busy elsewhere.

Re: Local parameters for A_PlaySound and ACS PlaySound

by Nash » Sat Oct 15, 2016 1:08 pm

New PRs in the OP. Is this better?

Re: Local parameters for A_PlaySound and ACS PlaySound

by Nash » Sat Oct 15, 2016 2:52 am

Confirming my suspicions...

Test WAD for regular ZDoom/GZDoom: https://www.dropbox.com/s/5g1l4t6bwsee2 ... t.wad?dl=1

Press the blood wall to hear a long, repetitive sound of the Cyberdemon, using [wiki]LocalAmbientSound[/wiki].

- Sound will be fired off and you will hear it if you are currently viewing through yourself (either in first or third person)

- Use command AddBot then F12 to coop-spy through the bot. Press the wall. Sound will fail to fire off if you aren't viewing through yourself.

- More over, if you first fired off the sound in your own view, then do coop spy to view through the bot, the sound will continue playing like as if it's coming from the bot, and not you. :O

So in conclusion, ZDoom's sound playing mechanism has no way to play a sound and then selectively filter its "audience" in real-time. A sound will either be fired off or it won't. I won't concern myself with this issue then and just go ahead and do my thing.

Re: Local parameters for A_PlaySound and ACS PlaySound

by Nash » Sat Oct 15, 2016 1:40 am

Okay I did the subfunction and there's no more code redundancy, but this turned out to be a little more complicated... the sound actually needs to be started unconditionally no matter what. Only if the current view is actually the same as the sound source, should the sound be audible. If the current view != source, cut out the sound volume (but DON'T stop the sound! It has to continue playing inaudibly).

Currently with my test WAD, if the sound was started with the local parameter, but you don't happen to be viewing through the source's view at that moment, the sound will just not play at all. Hmm...

Makes me wonder if the original logic of [wiki]LocalAmbientSound[/wiki] has been broken all along (what if the script was called but the current view happens to be another non-player camera?...

Re: Local parameters for A_PlaySound and ACS PlaySound

by Nash » Mon May 30, 2016 1:12 am

Just dropping a note to say that I will be very busy with work and won't be able to do anything related to my gaming hobbies until the 2nd week of June, please don't close this 'til then!

July 2016 mini update: I've read Graf's suggestion and have it done in a local copy but no time to push the PR yet, still busy with IRL currently

August 2016 update: I'm working on this right now

Re: Local parameters for A_PlaySound and ACS PlaySound

by Nash » Sun May 29, 2016 6:34 am

I think that's what I was talking about in that striked out part in my other post. I'll see if I can clean it all up as soon as I get some time!

Re: Local parameters for A_PlaySound and ACS PlaySound

by Graf Zahl » Sun May 29, 2016 4:42 am

The feature is ok, but I have problems with the amount of redundant code this adds.

Re: Local parameters for A_PlaySound and ACS PlaySound

by Nash » Mon Apr 18, 2016 11:56 pm

Would it be better to assign the loop flag constant (CHAN_LOOP) to a variable so that there would only be a single call to S_Sound? Even before I intervened, there were already 2 S_Sound calls to handle the looping stuff. Wanted to ask first if that's better before I touch code that wasn't mine... Scratch this, this doesn't make sense at all, and will not even work. my bad

UPDATE: Resolved conflicts with the recent de-actionifying rewrite.

Local parameters for A_PlaySound and ACS PlaySound

by Nash » Mon Apr 18, 2016 10:26 am

ZDoom PR: https://github.com/rheit/zdoom/pull/862
ACC PR: https://github.com/rheit/acc/pull/64
Example file: https://www.dropbox.com/s/hs622re9eykoz ... n.pk3?dl=1 (each player is locally playing a raining sound loop, which is only ever heard by himself and not by any other players, so for example, 2 or more players won't cause sound build-up because only 1 copy of the sound is heard on the player's machine)

This adds a "local" parameter to A_PlaySound and ACS Playsound which would make the sound behave exactly like if it were played with [wiki]LocalAmbientSound[/wiki]. "Local" in this context means:

Code: Select all

//============================================================================
//
// AActor :: CheckLocalView
//
// Returns true if this actor is local for the player. Here, local means the
// player is either looking out this actor's eyes, or this actor is the player
// and the player is looking out the eyes of something non-"sentient."
//
//============================================================================
So whatever worked with LocalAmbientSound.

Spoiler: old crap

Top