Initial Mapbase commit (squashed from mapbase-beta)

This commit is contained in:
Blixibon
2019-08-31 19:28:20 +00:00
parent 0d8dceea43
commit 3d464bc051
816 changed files with 105527 additions and 957 deletions

View File

@@ -77,6 +77,9 @@ class CHudVote;
static vgui::HContext s_hVGuiContext = DEFAULT_VGUI_CONTEXT;
ConVar cl_drawhud( "cl_drawhud", "1", FCVAR_CHEAT, "Enable the rendering of the hud" );
#ifdef DEMO_AUTORECORD
ConVar cl_autorecord("cl_autorecord", "0", FCVAR_CLIENTDLL | FCVAR_ARCHIVE, "Start recording demos automatically with an incremental name based on this value.");
#endif
ConVar hud_takesshots( "hud_takesshots", "0", FCVAR_CLIENTDLL | FCVAR_ARCHIVE, "Auto-save a scoreboard screenshot at the end of a map." );
ConVar hud_freezecamhide( "hud_freezecamhide", "0", FCVAR_CLIENTDLL | FCVAR_ARCHIVE, "Hide the HUD during freeze-cam" );
ConVar cl_show_num_particle_systems( "cl_show_num_particle_systems", "0", FCVAR_CLIENTDLL, "Display the number of active particle systems." );
@@ -830,8 +833,54 @@ void ClientModeShared::LevelInit( const char *newmap )
// Reset any player explosion/shock effects
CLocalPlayerFilter filter;
enginesound->SetPlayerDSP( filter, 0, true );
#ifdef DEMO_AUTORECORD
AutoRecord(newmap);
#endif
}
#ifdef DEMO_AUTORECORD
void ClientModeShared::AutoRecord(const char *map)
{
if (!cl_autorecord.GetBool()) {
return;
}
if (map == nullptr) {
Warning("null map in ClientModeShared::AutoRecord");
return;
}
// stop any demo to make sure they're saved
engine->ClientCmd("stop");
// KLEMS: sanitize space in client name because having to type "" while playing back lots of demos is annoying
ConVarRef name("name");
char nameStr[128];
memset(nameStr, 0, sizeof(nameStr));
Q_snprintf(nameStr, sizeof(nameStr), "%s", name.GetString());
int i = 0;
while (nameStr[i]) {
char c = nameStr[i];
if (!( (c >= '0' && c <= '9') ||
(c >= 'a' && c <= 'z') ||
(c >= 'A' && c <= 'Z'))) {
nameStr[i] = '_';
}
i++;
}
nameStr[127] = 0;
char cmd[256];
Q_snprintf(cmd, sizeof(cmd), "record \"%s_%04d_%s\"", nameStr, cl_autorecord.GetInt(), map);
cl_autorecord.SetValue(cl_autorecord.GetInt() + 1);
engine->ClientCmd(cmd);
// write to config to make sure the cvar is recorded
engine->ClientCmd("host_writeconfig");
}
#endif
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------