Skip to content

Commit

Permalink
chaos_volume_multiplier + allow multiple EGJ song plays
Browse files Browse the repository at this point in the history
  • Loading branch information
ScriptedSnark committed Nov 3, 2024
1 parent 1f1fcb4 commit 9e300df
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
12 changes: 1 addition & 11 deletions GSChaos/CFeatureExtremeGrieferJesus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,11 @@ void CFeatureExtremeGrieferJesus::ActivateFeature()
m_bActivated = true;
m_bSpawned = false;

if (!m_bMusicIsPlaying) // TODO: remove this logic because SoLoud handles that already
{
m_bMusicIsPlaying = true;
m_flMusicTime = gChaos.GetGlobalTime() + 192.0; // track duration (3:12)
ChaosLoud::EmitSound(MUSIC_JESUS);
}
ChaosLoud::EmitSound(MUSIC_JESUS);
}

void CFeatureExtremeGrieferJesus::OnFrame(double time)
{
if (m_bMusicIsPlaying && gChaos.GetGlobalTime() > m_flMusicTime)
{
m_bMusicIsPlaying = false;
}

if (g_bDespawnJesus)
{
m_bSpawned = false;
Expand Down
12 changes: 10 additions & 2 deletions GSChaos/ChaosLoudManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@ namespace ChaosLoud
{
SoLoud::Wav g_wBank[SOUNDBANK_SIZE];
float g_flVolume = 0.0f;
cvar_t* volume;
cvar_t* volume, *chaos_volume_multiplier;

void LoadSounds()
{
if (chaos_volume_multiplier == nullptr)
{
chaos_volume_multiplier = pEngfuncs->pfnRegisterVariable("chaos_volume_multiplier", "8", 0);
}

g_wBank[MUSIC_JESUS].load("chaos/egj.mp3");
g_wBank[MUSIC_OPFOR01].load("chaos/opfor01.mp3");
g_wBank[SND_SLAP].load("chaos/slap.mp3");
Expand Down Expand Up @@ -65,13 +70,16 @@ namespace ChaosLoud

void UpdateVolume()
{
if (chaos_volume_multiplier)
chaos_volume_multiplier->value = std::clamp(chaos_volume_multiplier->value, 1.0f, 100.0f); // just for sanity

if (volume == nullptr)
{
volume = pEngfuncs->pfnGetCvarPointer("volume");
}
else
{
g_flVolume = std::clamp(volume->value, 0.0f, 2.0f) * 2.0f;
g_flVolume = std::clamp(volume->value, 0.0f, 2.0f) * (chaos_volume_multiplier ? chaos_volume_multiplier->value : 10.0f);

for (int i = 0; i < SOUNDBANK_SIZE; i++)
{
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Additional info:
- `chaos_draw_as_overlay` - if enabled, it draws Chaos UI as overlay and requires enabling 3rd-party overlays in OBS
- `chaos_consistent_mode` - switches consistent mode. Consistent mode involves turning on certain effects for an unlimited amount of time without Chaos bar/timer.
- `chaos_consistent_effects_add` - activate consistent effect (works only with consistent mode enabled)
- `chaos_volume_multiplier` - increases volume from SoLoud sounds (volume->value * chaos_volume_multiplier->value)

## Twitch voting integration (WIP)
GSChaos supports Twitch chat voting. If you want to use it, then do some steps:
Expand Down

0 comments on commit 9e300df

Please sign in to comment.