Capture per-client chat commands for demo recording
Chat messages use per-client trap_SendServerCommand (not broadcast), so they weren't captured. Move capture hook to SV_GameSendServerCommand which is the game module boundary. Capture broadcasts (clientNum=-1) and chat/tchat commands sent to client 0 (first in the per-client loop, deduplicated by only capturing once). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
8b7ec11034
commit
90b26dc2a1
2 changed files with 13 additions and 4 deletions
|
|
@ -83,6 +83,18 @@ Sends a command string to a client
|
|||
===============
|
||||
*/
|
||||
void SV_GameSendServerCommand( int clientNum, const char *text ) {
|
||||
// capture for demo recording (deduplicate: only capture broadcasts
|
||||
// and first per-client send of chat/print commands)
|
||||
if ( clientNum == -1 ) {
|
||||
SVD_CaptureServerCommand( text );
|
||||
} else if ( clientNum == 0 ) {
|
||||
// per-client commands sent to client 0 first — capture "chat" and
|
||||
// "tchat" once (they'll be sent to all clients in a loop)
|
||||
if ( !strncmp( text, "chat", 4 ) || !strncmp( text, "tchat", 5 ) ) {
|
||||
SVD_CaptureServerCommand( text );
|
||||
}
|
||||
}
|
||||
|
||||
if ( clientNum == -1 ) {
|
||||
SV_SendServerCommand( NULL, "%s", text );
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -177,9 +177,6 @@ void QDECL SV_SendServerCommand(client_t *cl, const char *fmt, ...) {
|
|||
return;
|
||||
}
|
||||
|
||||
// capture broadcast commands for demo recording
|
||||
SVD_CaptureServerCommand( (char *)message );
|
||||
|
||||
// hack to echo broadcast prints to console
|
||||
if ( com_dedicated->integer && !strncmp( (char *)message, "print", 5) ) {
|
||||
Com_Printf ("broadcast: %s\n", SV_ExpandNewlines((char *)message) );
|
||||
|
|
|
|||
Loading…
Reference in a new issue