forked from Panguins/OneTap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathemit_sound.cpp
61 lines (53 loc) · 1.57 KB
/
emit_sound.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include "context.h"
decltype( hooked::original::o_emit_sound ) hooked::original::o_emit_sound;
void __fastcall hooked::emit_sound(
void* ecx,
void* edx,
void* filter,
int index,
int sprite_channel,
const char* sound_entry,
uint32_t sound_entry_hash,
const char* name,
float volume,
float attenuation,
int seed,
int flags,
int pitch_scale,
const vec3* origin,
const vec3* dir,
int idk,
bool update_positions,
float sound_play_time,
int emitting_ent
)
{
if ( ctx.m_settings.misc_footstep_volume < 100 )
{
const float volume_scale = static_cast< float >( ctx.m_settings.misc_footstep_volume ) / 100;
if ( strstr( name, xors( "step" ) ) )
{
// allow for better echolocation
volume = std::clamp( volume * volume_scale, 0.0f, 1.0f );
}
}
if ( ctx.m_settings.misc_weapon_volume < 100 )
{
const float volume_scale = static_cast< float >( ctx.m_settings.misc_weapon_volume ) / 100;
if ( strstr( name, xors( "weapon" ) ) )
{
// we don't need that racket.
volume = std::clamp( volume * volume_scale, 0.0f, 1.0f );
}
}
if ( ctx.m_settings.misc_other_volume < 100 )
{
const float volume_scale = static_cast< float >( ctx.m_settings.misc_other_volume ) / 100;
if ( !strstr( name, xors( "weapon" ) ) && !strstr( name, xors( "step" ) ) )
{
// ...
volume = std::clamp( volume * volume_scale, 0.0f, 1.0f );
}
}
hooked::original::o_emit_sound( ecx, edx, filter, index, sprite_channel, sound_entry, sound_entry_hash, name, volume, attenuation, seed, flags, pitch_scale, origin, dir, idk, update_positions, sound_play_time, emitting_ent );
}