Author Topic: Patch for one-shot sounds to be played at the beginning of a firing event  (Read 2870 times)

0 Members and 1 Guest are viewing this topic.

Offline Halleck

  • 24
Patch for one-shot sounds to be played at the beginning of a firing event
I have made a first pass at a feature request from Diaspora. The feature is the ability to specify a one-shot sound that will play at the beginning of a stream firing weapon, and will not repeat until firing is ceased and then resumed again. Diaspora will use this for the clunk that precedes continuous gun fire in BSG, hopefully it will be useful for other mods as well. I decided not to hard-code a limit for it to only be used by stream-firing weapons, so it can actually be specified for all weapon types if you wanted to.

I have included a description of the issue and my code patch in this mantis ticket:
http://scp.indiegames.us/mantis/view.php?id=2451

Feedback/code review welcome!

 

Offline Fury

  • The Curmudgeon
  • 213
Re: Patch for one-shot sounds to be played at the beginning of a firing event
I decided not to hard-code a limit for it to only be used by stream-firing weapons, so it can actually be specified for all weapon types if you wanted to.
Good choice because "stream" flag doesn't do anything useful except adds an extra trigger press check (iirc). The flag's useless.

 

Offline Sushi

  • Art Critic
  • 211
Re: Patch for one-shot sounds to be played at the beginning of a firing event
Patch looks good to me. Tested on Diaspora, works as advertised.

IMO it might make sense to have a time threshold to decide whether or not to fire, though, instead of just checking the last frame... the current solution means that if you tap-fire really fast you get the starting sound every time. That may be the behavior Diaspora wants (I'm not sure), but I'll bet there's somebody who would only want to play the start sound rarely.

Anyone else have thoughts on this?

 

Offline Halleck

  • 24
Re: Patch for one-shot sounds to be played at the beginning of a firing event
Agreed. Looking in to it now...

Edit: I've implemented a delay timer based on the end of the firing stream. It's adjustable via an optional setting in the weapons table. I'll post the patch as soon as I have cleaned up the code.
« Last Edit: June 09, 2011, 11:39:24 am by Halleck »

 

Offline Halleck

  • 24
Re: Patch for one-shot sounds to be played at the beginning of a firing event
I have implemented an optional interval timer setting and uploaded a new patch to mantis!  :D

Details on how to use it are in the ticket comments.

  

Offline Dragon

  • Citation needed
  • 212
  • The sky is the limit.
Re: Patch for one-shot sounds to be played at the beginning of a firing event
Sounds great.
BTW, would that be possible to implement a "force burst" feature, that will force the weapon to always fire the entire burst?
Using these two features, it would be possible to implement a sound for an entire burst, instead of coupling single shot sounds together (that's how a lot of simulators handle gatling guns).

 

Offline Halleck

  • 24
Re: Patch for one-shot sounds to be played at the beginning of a firing event
I don't know enough about the weapons system yet to answer that question.
What do you mean by "entire burst?" In FS2 and the BtRL demo, your primary seems to fire continuously until you run out of ammo (or possibly energy.)

 

Offline Dragon

  • Citation needed
  • 212
  • The sky is the limit.
Re: Patch for one-shot sounds to be played at the beginning of a firing event
It would be used with $Burst shots: . If set, one trigger press would fire the entire burst.

 

Offline Halleck

  • 24
Re: Patch for one-shot sounds to be played at the beginning of a firing event
Is there an example of that somewhere? I can't find "Burst" in the FS2 weapons.tbl.

 

Offline Dragon

  • Citation needed
  • 212
  • The sky is the limit.
Re: Patch for one-shot sounds to be played at the beginning of a firing event

 

Offline Sushi

  • Art Critic
  • 211
Re: Patch for one-shot sounds to be played at the beginning of a firing event
Aren't we talking about an entirely new feature at this point? It may be a good idea, but let's not feature creep Halleck's first contribution too badly. :)

I'll take a look at the new patch when I get home later.

 

Offline Sushi

  • Art Critic
  • 211
Re: Patch for one-shot sounds to be played at the beginning of a firing event
Reviewed and tested the latest patch. I think it looks fantastic... if nobody objects in the near future, I'll go ahead and commit it on Halleck's behalf.

 

Offline Halleck

  • 24
Re: Patch for one-shot sounds to be played at the beginning of a firing event
That would be great! Thanks, Sushi!

I think I will continue to look into this Burst fire thing and see if there's anything I can do about it in the future, but I can separate that out easily. I'm keeping all my code under a local git repo and squashing it into a patch so it's very flexible. I could make it into a series of patches, work on several different projects at once using local branches, or even selectively check my git commits directly into to SVN if I'm given commit access later on.

Anything that Diaspora needs done (that I think I can do) takes priority - I will try to make features as general as practical, but Diaspora is the main reason I'm here, at least for now. :)

 

Offline Halleck

  • 24
Re: Patch for one-shot sounds to be played at the beginning of a firing event
Patch is now in trunk, thanks Sushi! :)

 

Offline Ace

  • Truth of Babel
  • 212
    • http://www.lordofrigel.com
Re: Patch for one-shot sounds to be played at the beginning of a firing event
Awesome work! We'll need to do some additional weapon press sounds now for different guns now :)
Ace
Self-plagiarism is style.
-Alfred Hitchcock

 

Offline Halleck

  • 24
Re: Patch for one-shot sounds to be played at the beginning of a firing event
Thanks, Ace! Glad to be of service...

I've updated the wiki with docs on the 2 new table fields:
http://www.hard-light.net/wiki/index.php/Weapons.tbl#.24PreLaunchSnd:

I marked these fields as available in 3.6.13, is that correct?

 

Offline Sushi

  • Art Critic
  • 211
Re: Patch for one-shot sounds to be played at the beginning of a firing event
Thanks, Ace! Glad to be of service...

I've updated the wiki with docs on the 2 new table fields:
http://www.hard-light.net/wiki/index.php/Weapons.tbl#.24PreLaunchSnd:

I marked these fields as available in 3.6.13, is that correct?

Yes, that's correct. Thanks for being on the ball with the documentation.