Raised This Month: $51 Target: $400
 12% 

[HL2DM] - Missing Sounds Fix


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Peter Brev
Member
Join Date: Aug 2023
Plugin ID:
8596
Plugin Version:
1.0.0
Plugin Category:
Gameplay
Plugin Game:
Half-Life 2 Deathmatch
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Adds missing weapon sounds.
    Old 11-22-2023 , 06:43   [HL2DM] - Missing Sounds Fix
    Reply With Quote #1

    This plugin adds some missing sounds that would be present in the regular Half-Life 2 games, but not in HL2DM.

    Sounds that are added back in are:
    • weapons/crossbow/bolt_load1.wav ( when attaching the bolt to the crossbow during reload )
    • weapons/crossbow/bolt_load2.wav ( when attaching the bolt to the crossbow during reload )
    • weapons/physcannon/physcannon_claws_close.wav
    • weapons/physcannon/physcannon_claws_open.wav
    • weapons/physcannon/physcannon_tooheavy.wav
    • weapons/physcannon/physcannon_pickup.wav
    • weapons/physcannon/physcannon_drop.wav
    • weapons/physcannon/hold_loop.wav ( does not seem to be working )
    • weapons/slam/throw.wav ( underhand grenade throw while crouched )

    Latest version: hl2mpsoundsfix_1_1

    Updates
    --------
    Pushed an update (1.1.). This is a quality of life update and is recommended you update. Less resources will be used by the plugin.
    • Code overhaul/optimization.
      • All sounds are now under one sound hook, which uses less resources.
      • Replaced StrContains by strcmp, which uses less resources.
      • Superfluous code has been removed.
    Attached Files
    File Type: sp Get Plugin or Get Source (hl2mpsoundsfix.sp - 142 views - 9.5 KB)
    File Type: sp Get Plugin or Get Source (hl2mpsoundsfix_1_1.sp - 32 views - 4.6 KB)

    Last edited by Peter Brev; 03-18-2024 at 03:37.
    Peter Brev is offline
    belgvr
    Member
    Join Date: Dec 2008
    Location: Brazil
    Old 11-25-2023 , 23:50   Re: [HL2DM] - Missing Sounds Fix
    Reply With Quote #2

    Nice!
    I've been looking for this for a long time. Thanks!

    One thing i noticed though, is that the other player's sounds play as if they were close to you, instead of their real position.
    belgvr is offline
    Peter Brev
    Member
    Join Date: Aug 2023
    Old 11-27-2023 , 04:38   Re: [HL2DM] - Missing Sounds Fix
    Reply With Quote #3

    I am not sure I understood. It is possible to hear other players' sounds if they are close to you, but they are originating from their position. I have not touched anything that has to do with sound position. Sounds are all emitted from the client as the function name suggests.
    Peter Brev is offline
    Silvers
    SourceMod Plugin Approver
    Join Date: Aug 2010
    Location: SpaceX
    Old 11-27-2023 , 07:21   Re: [HL2DM] - Missing Sounds Fix
    Reply With Quote #4

    - You don't need to check "IsClientConnected" if you're checking "IsClientInGame" since that already checks they're connected.

    - I highly recommend consolidating all the sound hook callbacks into 1, right now this is very inefficient since you're checking all the strings when 1 of them could have triggered already.

    - You should replace "StrContains" with "strcmp" or "strncmp". Right now you're checking every position of the string for a match, this is inefficient and resourceful especially for something triggered as often as the sound hooks.

    - Don't understand why you're blocking commands in "OnPlayerRunCmd" for bots. This might affect other plugins expecting bots to have commands coming through.

    - You're returning "Plugin_Changed" from the sound callbacks, but nothing is actually being changed.

    - Lastly you don't need "public" for callbacks you named yourself. Just for plugin forwards (such as those from SM and 3rd party plugins).
    __________________

    Last edited by Silvers; 11-27-2023 at 07:23.
    Silvers is offline
    Peter Brev
    Member
    Join Date: Aug 2023
    Old 11-27-2023 , 13:33   Re: [HL2DM] - Missing Sounds Fix
    Reply With Quote #5

    Thanks for the feedback.

    Quote:
    Originally Posted by Silvers View Post
    - You don't need to check "IsClientConnected" if you're checking "IsClientInGame" since that already checks they're connected.
    I will keep this in mind for next time.

    Quote:
    Originally Posted by Silvers View Post
    - I highly recommend consolidating all the sound hook callbacks into 1, right now this is very inefficient since you're checking all the strings when 1 of them could have triggered already.
    That is how I initially wrote the plugin, but ran into issues where sounds would double up in-game for no good reason and other weird artifacts that would not happen when separated. I will take another crack at it in the future.

    Quote:
    Originally Posted by Silvers View Post
    - You should replace "StrContains" with "strcmp" or "strncmp". Right now you're checking every position of the string for a match, this is inefficient and resourceful especially for something triggered as often as the sound hooks.
    That is a good point. I essentially copy pasted from my footstep sounds plugin and did not think of making this kind of change. I will also keep it in mind.

    Quote:
    Originally Posted by Silvers View Post
    - Don't understand why you're blocking commands in "OnPlayerRunCmd" for bots. This might affect other plugins expecting bots to have commands coming through.
    That would be an oversight. That is leftover code from a larger plugin I was working on, fixing a whole bunch of HL2DM issues. Ultimately, that larger plugin was replaced by custom C++ fixes instead, hence the smaller plugins released.

    Quote:
    Originally Posted by Silvers View Post
    - You're returning "Plugin_Changed" from the sound callbacks, but nothing is actually being changed.
    I will make the necessary changes.

    Quote:
    Originally Posted by Silvers View Post
    - Lastly you don't need "public" for callbacks you named yourself. Just for plugin forwards (such as those from SM and 3rd party plugins).
    Thanks for the tip!

    Take care!
    Peter Brev is offline
    Silvers
    SourceMod Plugin Approver
    Join Date: Aug 2010
    Location: SpaceX
    Old 11-27-2023 , 18:05   Re: [HL2DM] - Missing Sounds Fix
    Reply With Quote #6

    Good stuff, nice to see HL2 getting some love. I should probably release the spawner plugin I made for HL2 games some 12 years ago but that's really bad code, and I haven't played since.

    If you need any help or advice PM me.
    __________________
    Silvers is offline
    belgvr
    Member
    Join Date: Dec 2008
    Location: Brazil
    Old 01-24-2024 , 14:18   Re: [HL2DM] - Missing Sounds Fix
    Reply With Quote #7

    Suggestion:
    It would be awesome if you could bring back the ricochet and bullet near miss sounds.
    belgvr is offline
    hl2dmgamer
    Junior Member
    Join Date: Dec 2023
    Old 02-03-2024 , 13:21   Re: [HL2DM] - Missing Sounds Fix
    Reply With Quote #8

    nice
    hl2dmgamer is offline
    Peter Brev
    Member
    Join Date: Aug 2023
    Old 03-17-2024 , 11:05   Re: [HL2DM] - Missing Sounds Fix
    Reply With Quote #9

    Pushed an update (1.1.). This is a quality of life update and is recommended you update. Less resources will be used by the plugin.
    • Code overhaul/optimization.
      • All sounds are now under one sound hook, which uses less resources.
      • Replaced StrContains by strcmp, which uses less resources.
      • Superfluous code has been removed.
    The old version will be left online for a little while in case bugs in the new version are discovered.
    Peter Brev is offline
    Reply



    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off

    Forum Jump


    All times are GMT -4. The time now is 15:01.


    Powered by vBulletin®
    Copyright ©2000 - 2024, vBulletin Solutions, Inc.
    Theme made by Freecode