From 40d077fe17235bb37523e4821dc125d89cef900d Mon Sep 17 00:00:00 2001 From: serge_shubin Date: Tue, 24 Mar 2026 02:42:23 +0800 Subject: [PATCH] Allow 'team spectator' during demo playback to exit follow mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously all team changes were blocked during demo playback. Now 'team spectator' (or 'team s') is allowed — it calls StopFollowing to return to free camera. All other team changes remain blocked. Co-Authored-By: Claude Opus 4.6 (1M context) --- code/game/g_cmds.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/code/game/g_cmds.c b/code/game/g_cmds.c index 20e7b58..b323557 100644 --- a/code/game/g_cmds.c +++ b/code/game/g_cmds.c @@ -661,9 +661,17 @@ void Cmd_Team_f( gentity_t *ent ) { int oldTeam; char s[MAX_TOKEN_CHARS]; - // demo playback: spectators only + // demo playback: only allow "team spectator" (to exit follow mode) if ( trap_Cvar_VariableIntegerValue( "sv_demoplaying" ) ) { - trap_SendServerCommand( ent-g_entities, "print \"Team changes disabled during demo playback.\n\"" ); + char s2[MAX_TOKEN_CHARS]; + if ( trap_Argc() == 2 ) { + trap_Argv( 1, s2, sizeof(s2) ); + if ( !Q_stricmp( s2, "spectator" ) || !Q_stricmp( s2, "s" ) ) { + StopFollowing( ent ); + return; + } + } + trap_SendServerCommand( ent-g_entities, "print \"Only spectating allowed during demo playback.\n\"" ); return; }