Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion game/neo/sound/playlist/default.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ playlist
song
{
fromgame 1
relativepath "ui\gamestartup1.mp3"
relativepath "..\soundtrack\112 - out.mp3"
}
}
88 changes: 1 addition & 87 deletions src/game/client/cdll_client_int.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1187,80 +1187,6 @@ bool CHLClient::ReplayPostInit()
#endif
}

static inline void UpdateBgm(ConVar *volCvar)
{
if (!volCvar)
{
Assert(false);
return;
}

#ifdef LINUX
#define DIR_SLASH "/"
#elif defined(_WIN32)
#define DIR_SLASH "\\"
#else
#error Unimplemented!
#endif
const char* bgmFiles[] = {
"ui" DIR_SLASH "gamestartup1.mp3", // main menu bgm should be at first index
"gameplay" DIR_SLASH "draw.mp3",
"gameplay" DIR_SLASH "jinrai.mp3",
"gameplay" DIR_SLASH "nsf.mp3",
};

CUtlVector<SndInfo_t> sounds;
enginesound->GetActiveSounds(sounds);

// If we are playing a music track, update its current volume.
char filename[MAX_PATH];
for (int i = 0; i < sounds.Size(); i++)
{
if (!g_pFullFileSystem->String(sounds[i].m_filenameHandle, filename, sizeof(filename)))
{
continue;
}
else if (!*filename)
{
continue;
}

for (int j = 0; j < ARRAYSIZE(bgmFiles); ++j)
{
if (Q_strcmp(filename, bgmFiles[j]) == 0)
{
enginesound->SetVolumeByGuid(sounds[i].m_nGuid, volCvar->GetFloat());
return; // should only ever be playing one jingle at a time; return early
}
}
}
#ifndef NEO
// We were not in a server nor joining a server, and there was no music playing.
// Start playing the main menu bgm.
if (!engine->IsConnected())
{
enginesound->EmitAmbientSound(bgmFiles[0], volCvar->GetFloat());
}
#endif // NEO
}

void MusicVol_ChangeCallback(IConVar *cvar, const char *pOldVal, float flOldVal)
{
if (!g_pFullFileSystem)
{
Assert(false);
return;
}

// We are in a level, don't start playing menu music.
if (Q_strcmp(engine->GetLevelName(), "") != 0)
{
return;
}

UpdateBgm((ConVar*)cvar);
}

#ifdef NEO
extern void NeoToggleConsoleEnforce();

Expand Down Expand Up @@ -1368,7 +1294,7 @@ static void NeoDeleteDownloadedSprays()
}
filesystem->FindClose(findHdlFL);
}
#endif
#endif // NEO

//-----------------------------------------------------------------------------
// Purpose: Called after client & server DLL are loaded and all systems initialized
Expand Down Expand Up @@ -1403,7 +1329,6 @@ void CHLClient::PostInit()
#ifdef NEO
if (g_pCVar)
{
g_pCVar->FindVar("snd_musicvolume")->InstallChangeCallback(MusicVol_ChangeCallback);
g_pCVar->FindVar("neo_name")->InstallChangeCallback(NeoConVarStrLimitChangeCallback<MAX_PLAYER_NAME_LENGTH>);
g_pCVar->FindVar("neo_clantag")->InstallChangeCallback(NeoConVarStrLimitChangeCallback<NEO_MAX_CLANTAG_LENGTH>);
g_pCVar->FindVar("cl_neo_crosshair")->InstallChangeCallback(NeoConVarStrLimitChangeCallback<NEO_XHAIR_SEQMAX>);
Expand Down Expand Up @@ -2086,17 +2011,6 @@ void CHLClient::LevelShutdown( void )
CReplayRagdollRecorder::Instance().Shutdown();
CReplayRagdollCache::Instance().Shutdown();
#endif

#ifdef NEO
if (g_pCVar)
{
UpdateBgm(g_pCVar->FindVar("snd_musicvolume"));
}
else
{
Assert(false);
}
#endif
}


Expand Down
93 changes: 72 additions & 21 deletions src/game/shared/neo/neo_gamerules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,29 @@
#include "basegrenade_shared.h"

#ifdef CLIENT_DLL
#include "c_neo_player.h"
#include "c_team.h"
#include "c_playerresource.h"
#include "c_neo_player.h"
#include "c_team.h"
#include "c_playerresource.h"
#include "engine/SndInfo.h"
#include "engine/IEngineSound.h"
#include "filesystem.h"
#else
#include "neo_player.h"
#include "team.h"
#include "neo_model_manager.h"
#include "neo_ghost_spawn_point.h"
#include "neo_ghost_cap_point.h"
#include "neo/weapons/weapon_ghost.h"
#include "neo/weapons/weapon_neobasecombatweapon.h"
#include "eventqueue.h"
#include "mapentities.h"
#include "hl2mp_gameinterface.h"
#include "player_resource.h"
#include "inetchannelinfo.h"
#include "neo_dm_spawn.h"
#include "neo_misc.h"
#include "neo_game_config.h"
#include "nav_mesh.h"
#include "neo_player.h"
#include "team.h"
#include "neo_model_manager.h"
#include "neo_ghost_spawn_point.h"
#include "neo_ghost_cap_point.h"
#include "neo/weapons/weapon_ghost.h"
#include "neo/weapons/weapon_neobasecombatweapon.h"
#include "eventqueue.h"
#include "mapentities.h"
#include "hl2mp_gameinterface.h"
#include "player_resource.h"
#include "inetchannelinfo.h"
#include "neo_dm_spawn.h"
#include "neo_misc.h"
#include "neo_game_config.h"
#include "nav_mesh.h"

extern ConVar weaponstay;
#endif
Expand Down Expand Up @@ -150,7 +153,56 @@ ConVar sv_neo_comp("sv_neo_comp", "0", FCVAR_REPLICATED, "Enables competitive ga
);

#ifdef CLIENT_DLL
ConVar snd_victory_volume("snd_victory_volume", "0.33", FCVAR_ARCHIVE | FCVAR_DONTRECORD | FCVAR_USERINFO, "Loudness of the victory jingle (0-1).", true, 0.0, true, 1.0);
extern ConVar snd_victory_volume;
void sndVictoryVolumeChangeCallback(IConVar* cvar [[maybe_unused]], const char* pOldVal [[maybe_unused]], float flOldVal [[maybe_unused]])
{
if (!g_pFullFileSystem)
{
Assert(false);
return;
}

#ifdef LINUX
#define DIR_SLASH "/"
#elif defined(_WIN32)
#define DIR_SLASH "\\"
#else
#error Unimplemented!
#endif
const char* jingles[] = {
"gameplay" DIR_SLASH "draw.mp3",
"gameplay" DIR_SLASH "jinrai.mp3",
"gameplay" DIR_SLASH "nsf.mp3",
};

CUtlVector<SndInfo_t> sounds;
enginesound->GetActiveSounds(sounds);

// If we are playing a victory jingle, update its volume
char filename[MAX_PATH];
for (int i = 0; i < sounds.Size(); i++)
{
if (!g_pFullFileSystem->String(sounds[i].m_filenameHandle, filename, sizeof(filename)))
{
continue;
}
else if (!*filename)
{
continue;
}

for (int j = 0; j < ARRAYSIZE(jingles); ++j)
{
if (Q_strcmp(filename, jingles[j]) == 0)
{
enginesound->SetVolumeByGuid(sounds[i].m_nGuid, snd_victory_volume.GetFloat());
return; // should only ever be playing one jingle at a time; return early
}
}
}
}

ConVar snd_victory_volume("snd_victory_volume", "0.33", FCVAR_ARCHIVE | FCVAR_DONTRECORD | FCVAR_USERINFO, "Loudness of the victory jingle (0-1).", true, 0.0, true, 1.0, sndVictoryVolumeChangeCallback);
#endif // CLIENT_DLL

REGISTER_GAMERULES_CLASS( CNEORules );
Expand Down Expand Up @@ -2927,7 +2979,6 @@ bool CNEORules::RoundIsMatchPoint() const
}

#ifdef GAME_DLL
extern ConVar snd_musicvolume;
void CNEORules::SetWinningTeam(int team, int iWinReason, bool bForceMapReset, bool bSwitchTeams, bool bDontAddScore, bool bFinal)
{
if (IsRoundOver())
Expand Down
Loading