From 4410d8e32cf8b4cfefabef9f26943154d39c685b Mon Sep 17 00:00:00 2001 From: IronClawTrem Date: Fri, 21 Feb 2020 00:27:51 +0000 Subject: add g_specNoclip cvar --- src/game/g_active.c | 7 ++++++- src/game/g_local.h | 1 + src/game/g_main.c | 4 +++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/game/g_active.c b/src/game/g_active.c index b5df273..b9ab899 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -407,7 +407,12 @@ void SpectatorThink( gentity_t *ent, usercmd_t *ucmd ) if( client->sess.spectatorState == SPECTATOR_LOCKED || client->sess.spectatorState == SPECTATOR_FOLLOW ) client->ps.pm_type = PM_FREEZE; else - client->ps.pm_type = PM_SPECTATOR; + { + if( g_specNoclip.integer ) + client->ps.pm_type = PM_NOCLIP; + else + client->ps.pm_type = PM_SPECTATOR; + } if ( client->sess.spectatorState == SPECTATOR_FOLLOW ) { diff --git a/src/game/g_local.h b/src/game/g_local.h index a355265..b09f822 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -1495,6 +1495,7 @@ extern vmCvar_t g_schachtmeisterAutobahnThreshold; extern vmCvar_t g_schachtmeisterAutobahnMessage; extern vmCvar_t g_adminAutobahnNotify; extern vmCvar_t g_maxGhosts; +extern vmCvar_t g_specNoclip; void trap_Printf( const char *fmt ); void trap_Error( const char *fmt ); diff --git a/src/game/g_main.c b/src/game/g_main.c index 298b21b..a95dd5d 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -244,6 +244,7 @@ vmCvar_t g_schachtmeisterAutobahnThreshold; vmCvar_t g_schachtmeisterAutobahnMessage; vmCvar_t g_adminAutobahnNotify; vmCvar_t g_maxGhosts; +vmCvar_t g_specNoclip; static cvarTable_t gameCvarTable[ ] = { @@ -466,7 +467,8 @@ static cvarTable_t gameCvarTable[ ] = { &g_schachtmeisterAutobahnThreshold, "g_schachtmeisterAutobahnThreshold", "-30", CVAR_ARCHIVE, 0, qfalse }, { &g_schachtmeisterAutobahnMessage, "g_schachtmeisterAutobahnMessage", "Your host is blacklisted.", CVAR_ARCHIVE, 0, qfalse }, { &g_adminAutobahnNotify, "g_adminAutobahnNotify", "1", CVAR_ARCHIVE, 0, qfalse }, - { &g_maxGhosts, "g_maxGhosts", "0", CVAR_ARCHIVE, 0, qfalse } + { &g_maxGhosts, "g_maxGhosts", "0", CVAR_ARCHIVE, 0, qfalse }, + { &g_specNoclip, "g_specNoclip", "0", CVAR_ARCHIVE, 0, qtrue } }; static int gameCvarTableSize = sizeof( gameCvarTable ) / sizeof( gameCvarTable[ 0 ] ); -- cgit