Calling Cmd_SetViewpos_f from cgame while playing a demo


(uvhannes) #1

in the game engine (referenced to quake3 code) i found the following


/*
===================
CL_ForwardCommandToServer

adds the current command line as a clientCommand
things like godmode, noclip, etc, are commands directed to the server,
so when they are typed in at the console, they will need to be forwarded.
===================
*/
void CL_ForwardCommandToServer( const char *string ) {
	char	*cmd;

	cmd = Cmd_Argv(0);

	// ignore key up commands
	if ( cmd[0] == '-' ) {
		return;
	}

###################################
###################################
if ( clc.demoplaying || cls.state < CA_CONNECTED || cmd[0] == '+' ) {
		Com_Printf ("Unknown command \"%s\"
", cmd);
		return;
	}
###################################
###################################

	if ( Cmd_Argc() > 1 ) {
		CL_AddReliableCommand( string );
	} else {
		CL_AddReliableCommand( cmd );
	}
}

So because im playing a demo the “Cmd_SetViewpos_f” function is not reachable for me. I did get it to work when i start a server but not for demos.

Any1 got an idea how to fix it that i can use all the commands in demoplayback too?

cg_consolecmds.c


trap_AddCommand ("freecamsetpos");

|
–> cl_main.c (here the command gets blocked!)
|
–> g_cmds.c

else if (Q_stricmp (cmd, "freecamsetpos") == 0) {		
		Cmd_SetViewpos_f( ent );

|
–>

void Cmd_SetViewpos_f( gentity_t *ent ) {

<-- this is the goal.

So how can i get over the block @ cl_main.c

No need to say that i do not have ET Engine code :slight_smile:

thx in advance


(kamikazee) #2

I highly doubt if this would be possible. When running a demo, no server is active so code in g_cmds.c cannot be executed.


(uvhannes) #3

so the only way is porting it completely to clientgame?

well gonna make this then.

EDIT:

well its a 2 liner (if u have a freecam yet in et)

Just define a new command or replace the old and parse the values again.

then just vector copy it to the CAM not the client -.-
Thats been my fault all the time -.-

–> can be closed