Ejemplo n.º 1
0
/*
====================
CL_PlayVideo_f

movie <moviename>
====================
*/
void CL_PlayVideo_f( void )
{
	string	path;

	if( Cmd_Argc() != 2 && Cmd_Argc() != 3 )
	{
		Msg( "movie <moviename> [full]\n" );
		return;
	}

	if( cls.state == ca_active )
	{
		Msg( "Can't play movie while connected to a server.\nPlease disconnect first.\n" );
		return;
	}

	switch( Cmd_Argc( ))
	{
	case 2:	// simple user version
		Q_snprintf( path, sizeof( path ), "media/%s.avi", Cmd_Argv( 1 ));
		SCR_PlayCinematic( path );
		break;
	case 3:	// sequenced cinematics used this
		SCR_PlayCinematic( Cmd_Argv( 1 ));
		break;
	}
}
Ejemplo n.º 2
0
/*
==================
CL_ParseServerData
==================
*/
void CL_ParseServerData (void)
{
	extern cvar_t	*fs_gamedirvar;
	char	*str;
	int		i;
	
	Com_DPrintf ("Serverdata packet received.\n");
//
// wipe the client_state_t struct
//
	CL_ClearState ();
	cls.state = ca_connected;

// parse protocol version number
	i = MSG_ReadLong (&net_message);
	cls.serverProtocol = i;

	// BIG HACK to let demos from release work with the 3.0x patch!!!
	// Knightmare- also allow connectivity with servers using the old protocol
//	if (Com_ServerState() && (i < PROTOCOL_VERSION) /*== 35*/)
	if ( LegacyProtocol() ) {} // do nothing
	else if (i != PROTOCOL_VERSION)
		Com_Error (ERR_DROP,"Server returned version %i, not %i", i, PROTOCOL_VERSION);

	cl.servercount = MSG_ReadLong (&net_message);
	cl.attractloop = MSG_ReadByte (&net_message);

	// game directory
	str = MSG_ReadString (&net_message);
	strncpy (cl.gamedir, str, sizeof(cl.gamedir)-1);

	// set gamedir
	if ( ( (*str && (!fs_gamedirvar->string || !*fs_gamedirvar->string || strcmp(fs_gamedirvar->string, str)))
		|| (!*str && (fs_gamedirvar->string || *fs_gamedirvar->string)) )
		&& !cl.attractloop ) // Knightmare- don't allow demos to change this
		Cvar_Set("game", str);

	// parse player entity number
	cl.playernum = MSG_ReadShort (&net_message);

	// get the full level name
	str = MSG_ReadString (&net_message);

	if (cl.playernum == -1)
	{	// playing a cinematic or showing a pic, not a level
		SCR_PlayCinematic (str);
	}
	else
	{
		// seperate the printfs so the server message can have a color
		Com_Printf("\n\n\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\37\n\n");
		con.ormask = 128;
		Com_Printf ("%c"S_COLOR_SHADOW S_COLOR_ALT"%s\n", 2, str);
		con.ormask = 0;

		// need to prep refresh at next oportunity
		cl.refresh_prepped = false;
	}
}
Ejemplo n.º 3
0
/*
==================
CL_ParseServerData
==================
*/
void CL_ParseServerData(void)
{
    extern cvar_t * fs_gamedirvar;
    char * str;
    int i;

    Com_DPrintf("Serverdata packet received.\n");
    //
    // wipe the client_state_t struct
    //
    CL_ClearState();
    cls.state = ca_connected;

    // parse protocol version number
    i = MSG_ReadLong(&net_message);
    cls.serverProtocol = i;

    // BIG HACK to let demos from release work with the 3.0x patch!!!
    if (Com_ServerState() && PROTOCOL_VERSION == 34)
    {
    }
    else if (i != PROTOCOL_VERSION)
    {
        Com_Error(ERR_DROP, "Server returned version %i, not %i", i, PROTOCOL_VERSION);
    }

    cl.servercount = MSG_ReadLong(&net_message);
    cl.attractloop = MSG_ReadByte(&net_message);

    // game directory
    str = MSG_ReadString(&net_message);
    strncpy(cl.gamedir, str, sizeof(cl.gamedir) - 1);

    // set gamedir
    if ((*str && (!fs_gamedirvar->string || !*fs_gamedirvar->string || strcmp(fs_gamedirvar->string, str))) || (!*str && (fs_gamedirvar->string || *fs_gamedirvar->string)))
        Cvar_Set("game", str);

    // parse player entity number
    cl.playernum = MSG_ReadShort(&net_message);

    // get the full level name
    str = MSG_ReadString(&net_message);

    if (cl.playernum == -1)
    {
        // playing a cinematic or showing a pic, not a level
        SCR_PlayCinematic(str);
    }
    else
    {
        // separate the printfs so the server message can have a color
        Com_Printf("\n\n\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\37\n\n");
        Com_Printf("%c%s\n", 2, str);

        // need to prep refresh at next opportunity
        cl.refresh_prepped = false;
    }
}
Ejemplo n.º 4
0
/*
* CL_PlayCinematic_f
*/
void CL_PlayCinematic_f( void )
{
	if( Cmd_Argc() < 1 )
	{
		Com_Printf( "Usage: %s <name> [flags]\n", Cmd_Argv( 0 ) );
		return;
	}

	SCR_PlayCinematic( Cmd_Argv( 1 ), atoi( Cmd_Argv( 2 ) ) );
}
Ejemplo n.º 5
0
/*
* CL_PlayCinematic_f
*/
void CL_PlayCinematic_f( void )
{
	if( Cmd_Argc() != 2 )
	{
		Com_Printf( "USAGE: cinematic <name>\n" );
		return;
	}

	SCR_PlayCinematic( Cmd_Argv( 1 ) );
}
Ejemplo n.º 6
0
/*
====================
CL_PlayVideo_f

movie <moviename>
====================
*/
void CL_PlayVideo_f( void )
{
	if( Cmd_Argc() != 2 )
	{
		Msg( "movie <moviename>\n" );
		return;
	}
	if( cls.state == ca_active )
	{
		// FIXME: get rid of this stupid alias
		Cbuf_AddText( va( "killserver\n; wait\n; movie %s\n;", Cmd_Argv( 1 )));
		return;
	}
	SCR_PlayCinematic( Cmd_Argv( 1 ));
}
Ejemplo n.º 7
0
void
CL_ParseServerData(void)
{
    extern cvar_t *fs_gamedirvar;
    char *str;
    int i;

    Com_DPrintf("Serverdata packet received.\n");

    /* wipe the client_state_t struct */
    CL_ClearState();
    cls.state = ca_connected;

    /* parse protocol version number */
    i = MSG_ReadLong(&net_message);
    cls.serverProtocol = i;

    /* another demo hack */
    if (Com_ServerState() && (PROTOCOL_VERSION == 34))
    {
    }
    else if (i != PROTOCOL_VERSION)
    {
        Com_Error(ERR_DROP, "Server returned version %i, not %i",
                  i, PROTOCOL_VERSION);
    }

    cl.servercount = MSG_ReadLong(&net_message);
    cl.attractloop = MSG_ReadByte(&net_message);

    /* game directory */
    str = MSG_ReadString(&net_message);
    Q_strlcpy(cl.gamedir, str, sizeof(cl.gamedir));

    /* set gamedir */
    if ((*str && (!fs_gamedirvar->string || !*fs_gamedirvar->string ||
                  strcmp(fs_gamedirvar->string, str))) ||
            (!*str && (fs_gamedirvar->string || *fs_gamedirvar->string)))
    {
        Cvar_Set("game", str);
    }

    /* parse player entity number */
    cl.playernum = MSG_ReadShort(&net_message);

    /* get the full level name */
    str = MSG_ReadString(&net_message);

    if (cl.playernum == -1)
    {
        /* playing a cinematic or showing a pic, not a level */
        SCR_PlayCinematic(str);
    }
    else
    {
        /* seperate the printfs so the server
         * message can have a color */
        Com_Printf("\n\n\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\37\n\n");
        Com_Printf("%c%s\n", 2, str);

        /* need to prep refresh at next oportunity */
        cl.refresh_prepped = false;
    }
}
Ejemplo n.º 8
0
/*
==================
CL_ParseServerData
==================
*/
qboolean CL_ParseServerData (sizebuf_t *msg)
{
	char	*str;
	int		i;
	
	Com_DPrintf ("Serverdata packet received.\n");
//
// wipe the client_state_t struct
//
	CL_ClearState ();
	cls.state = ca_connected;

// parse protocol version number
	i = MSG_ReadLong (msg);
	cls.serverProtocol = i;

	cl.servercount = MSG_ReadLong (msg);
	cl.attractloop = MSG_ReadByte (msg);

	if (cl.attractloop) {
		//cls.serverProtocol = PROTOCOL_VERSION_DEFAULT;
	}
	else if (i != PROTOCOL_VERSION_DEFAULT && i != PROTOCOL_VERSION_R1Q2) {
		Com_Error (ERR_DROP, "Server is using unknown protocol %d.", i);
	}

	// game directory
	str = MSG_ReadString (msg);
	Q_strncpyz (cl.gamedir, str, sizeof(cl.gamedir));
	str = cl.gamedir;

	// set gamedir
	if (!Com_ServerState()) {
		Cvar_SetLatched("game", str);
		if( FS_NeedRestart() ) {
			CL_RestartFilesystem(true);
		}
	}

	// parse player entity number
	cl.playernum = MSG_ReadShort (msg);

	// get the full level name
	str = MSG_ReadString (msg);

	cl.pmp.strafeHack = false;
	cl.pmp.speedMultiplier = 1;
	cl.pmp.airaccelerate = 0;
	cls.protocolVersion = 0;

	if (cls.serverProtocol == PROTOCOL_VERSION_R1Q2)
	{
		i = MSG_ReadByte(msg);
		if( i ) {
			Com_Printf("'Enhanced' R1Q2 servers are not supported, falling back to protocol 34.\n" );
			CL_Disconnect();		
			cls.serverProtocol = PROTOCOL_VERSION_DEFAULT;
			CL_Reconnect_f ();
			return false;
		}
		i = MSG_ReadShort(msg);
		if (i < PROTOCOL_VERSION_R1Q2_MINIMUM || i > PROTOCOL_VERSION_R1Q2_CURRENT)
		{
			if (cl.attractloop)
			{
				if ( i < PROTOCOL_VERSION_R1Q2_MINIMUM )
					Com_Printf("This demo was recorded with an earlier version of the R1Q2 protocol. It may not play back properly.\n");
				else
					Com_Printf("This demo was recorded with a later version of the R1Q2 protocol. It may not play back properly.\n");
			}
			else
			{
				if( i < PROTOCOL_VERSION_R1Q2_MINIMUM ) {
					Com_Printf("Server uses OLDER minor R1Q2 protocol version than minimum supported (%i < %i), falling back to protocol 34.\n", i, PROTOCOL_VERSION_R1Q2_MINIMUM);
					CL_Disconnect();
					cls.serverProtocol = PROTOCOL_VERSION_DEFAULT;
					CL_Reconnect_f ();
					return false;
				}
				Com_Printf("Server uses NEWER minor R1Q2 protocol version (%i > %i), some features will be unavailable.\n", i, PROTOCOL_VERSION_R1Q2_CURRENT);
			}
		}

		if (i >= 1903) {
			MSG_ReadByte(msg);
			cl.pmp.strafeHack = MSG_ReadByte(msg);
		}

		cl.pmp.speedMultiplier = 2;
		cls.protocolVersion = i;
	}


	if (cl.playernum == -1)
	{	// playing a cinematic or showing a pic, not a level
		SCR_PlayCinematic (str);
	}
	else
	{
		// seperate the printfs so the server message can have a color
		Com_Printf("\n\n\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\37\n\n");
		Com_Printf ("%c%s\n", 2, str);

		// need to prep refresh at next oportunity
		cl.refresh_prepped = false;

        if((unsigned)cl.playernum >= MAX_CLIENTS) {
            cl.playernum = ( MAX_CLIENTS - 1 );
        }
	}

	return true;
}