diff --git a/Documentation/bug-compatibility.md b/Documentation/bug-compatibility.md index 7feddce1..aa368206 100644 --- a/Documentation/bug-compatibility.md +++ b/Documentation/bug-compatibility.md @@ -14,3 +14,4 @@ When `-bugcomp` is specified with argument, it interpreted as flags separated wi | ------- | ----------- | ---------------------------- | | `peoei` | Reverts `pfnPEntityOfEntIndex` behavior to GoldSrc, where it returns NULL for last player due to incorrect player index comparison | * Counter-Strike: Condition Zero - Deleted Scenes | | `gsmrf` | Rewrites message at the moment when Game DLL attempts to write an internal engine message, usually specific to GoldSrc protocol. Right now only supports `svc_spawnstaticsound`, more messages added by request. | * MetaMod/AMXModX based mods | +| `sp_attn_none` | Makes sounds with attenuation zero spatialized, i.e. have a stereo effect. | Possibly, every game that was made for GoldSrc. | diff --git a/engine/client/s_main.c b/engine/client/s_main.c index 3dc44b2e..1b264d73 100644 --- a/engine/client/s_main.c +++ b/engine/client/s_main.c @@ -524,8 +524,11 @@ static void SND_Spatialize( channel_t *ch ) dist = VectorNormalizeLength( source_vec ); dot = DotProduct( s_listener.right, source_vec ); - // don't pan sounds with no attenuation - if( ch->dist_mult <= 0.0f ) dot = 0.0f; + if( !FBitSet( host.bugcomp, BUGCOMP_SPATIALIZE_SOUND_WITH_ATTN_NONE )) + { + // don't pan sounds with no attenuation + if( ch->dist_mult <= 0.0f ) dot = 0.0f; + } // fill out channel volumes for single location S_SpatializeChannel( &ch->leftvol, &ch->rightvol, ch->master_vol, gain, dot, dist * ch->dist_mult ); diff --git a/engine/common/common.h b/engine/common/common.h index ba55a194..59dae364 100644 --- a/engine/common/common.h +++ b/engine/common/common.h @@ -273,6 +273,9 @@ typedef enum bugcomp_e // rewrites mod's attempts to write GoldSrc-specific messages into Xash protocol // (new wrappers are added by request) BUGCOMP_MESSAGE_REWRITE_FACILITY_FLAG = BIT( 1 ), + + // makes sound with no attenuation spatialized, like in GoldSrc + BUGCOMP_SPATIALIZE_SOUND_WITH_ATTN_NONE = BIT( 2 ), } bugcomp_t; typedef struct host_parm_s diff --git a/engine/common/host.c b/engine/common/host.c index 0cdb66fb..adf364ff 100644 --- a/engine/common/host.c +++ b/engine/common/host.c @@ -73,6 +73,7 @@ static feature_message_t bugcomp_features[] = { { BUGCOMP_PENTITYOFENTINDEX_FLAG, "pfnPEntityOfEntIndex bugfix revert", "peoei" }, { BUGCOMP_MESSAGE_REWRITE_FACILITY_FLAG, "GoldSrc Message Rewrite Facility", "gsmrf" }, +{ BUGCOMP_SPATIALIZE_SOUND_WITH_ATTN_NONE, "spatialize sounds with zero attenuation", "sp_attn_none" }, }; static feature_message_t engine_features[] =