Ejemplo n.º 1
0
/*
* SCR_RunCinematic
*/
void SCR_RunCinematic( void )
{
	if( cls.state != CA_CINEMATIC ) {
		return;
	}

	if( ( cls.key_dest != key_game && cls.key_dest != key_console )
		|| (cls.key_dest == key_console && !SCR_AllowCinematicConsole()) ) {
		// stop if menu or console is up
		SCR_FinishCinematic();
		return;
	}

	cl.cin.absPrevTime = cl.cin.absCurrentTime;
	cl.cin.absCurrentTime = SCR_CinematicTime();

	if( cl.cin.paused ) {
		return;
	}

	cl.cin.currentTime += cl.cin.absCurrentTime - cl.cin.absPrevTime;

	if( !CIN_NeedNextFrame( cl.cin.h, cl.cin.currentTime ) ) {
		cl.cin.redraw = qfalse;
		return;
	}

	// read next frame
	SCR_ReadNextCinematicFrame();
	if( !cl.cin.pic ) {
		// end of cinematic
		SCR_FinishCinematic();
		return;
	}
}
Ejemplo n.º 2
0
/*
* SCR_PlayCinematic
*/
static void SCR_PlayCinematic( const char *arg, int flags )
{
	struct cinematics_s *cin;

	CL_SoundModule_Clear();

	cin = CIN_Open( arg, 0, qfalse, qtrue );
	if( !cin )
	{
		Com_Printf( "SCR_PlayCinematic: couldn't find %s\n", arg );
		return;
	}

	CL_Disconnect( NULL );

	cl.cin.h = cin;
	cl.cin.keepRatio = (flags & 1) ? qfalse : qtrue;
	cl.cin.allowConsole = (flags & 2) ? qfalse : qtrue;
	cl.cin.paused = qfalse;
	cl.cin.absStartTime = cl.cin.absCurrentTime = cl.cin.absPrevTime = SCR_CinematicTime();
	cl.cin.currentTime = 0;

	CL_SetClientState( CA_CINEMATIC );

	CL_SoundModule_StopAllSounds();

	SCR_EndLoadingPlaque();

	SCR_ReadNextCinematicFrame();
}
Ejemplo n.º 3
0
/*
* SCR_RunCinematic
*/
void SCR_RunCinematic( void )
{
	if( cls.state != CA_CINEMATIC ) {
		return;
	}

	if( ( cls.key_dest != key_game && cls.key_dest != key_console )
		|| (cls.key_dest == key_console && !SCR_AllowCinematicConsole()) ) {
		// stop if menu or console is up
		SCR_FinishCinematic();
		return;
	}

	if( cl.cin.pause_cnt > 0 ) {
		return;
	}

	// CIN_NeedNextFrame is going to query us for raw samples length
	CIN_AddRawSamplesListener( cl.cin.h, NULL, 
		&SCR_CinematicRawSamples, &SCR_CinematicGetRawSamplesLength );

	if( !CIN_NeedNextFrame( cl.cin.h, SCR_CinematicTime() - cl.cin.startTime ) ) {
		cl.cin.redraw = false;
		return;
	}

	// read next frame
	SCR_ReadNextCinematicFrame();
	if( !cl.cin.pic ) {
		// end of cinematic
		SCR_FinishCinematic();
		return;
	}
}
Ejemplo n.º 4
0
/*
* SCR_PlayCinematic
*/
static void SCR_PlayCinematic( const char *arg, int flags )
{
	struct cinematics_s *cin;
	bool has_ogg;
	bool yuv;
	float framerate;
	size_t name_size = strlen( "video/" ) + strlen( arg ) + 1;
	char *name = alloca( name_size );

	if( strstr( arg, "/" ) == NULL && strstr( arg, "\\" ) == NULL ) {
		Q_snprintfz( name, name_size, "video/%s", arg );
	} else {
		Q_snprintfz( name, name_size, "%s", arg );
	}

	cin = CIN_Open( name, 0, 0, &yuv, &framerate );
	if( !cin )
	{
		Com_Printf( "SCR_PlayCinematic: couldn't find %s\n", name );
		return;
	}

	has_ogg = CIN_HasOggAudio( cin );

	CIN_Close( cin );

	SCR_FinishCinematic();

	CL_SoundModule_StopAllSounds( true, true );

	cin = CIN_Open( name, 0, has_ogg ? CIN_NOAUDIO : 0, &yuv, &framerate );
	if( !cin )
	{
		Com_Printf( "SCR_PlayCinematic: (FIXME) couldn't find %s\n", name );
		return;
	}

	if( has_ogg ) {
		CL_SoundModule_StartBackgroundTrack( CIN_FileName( cin ), NULL, 4 );
	}

	cl.cin.h = cin;
	cl.cin.keepRatio = (flags & 1) ? false : true;
	cl.cin.allowConsole = (flags & 2) ? false : true;
	cl.cin.startTime = SCR_CinematicTime();
	cl.cin.paused = false;
	cl.cin.pause_cnt = 0;
	cl.cin.yuv = yuv;
	cl.cin.framerate = framerate;

	CL_SetClientState( CA_CINEMATIC );

	SCR_EndLoadingPlaque();

	SCR_RunCinematic();
}
Ejemplo n.º 5
0
/*
* SCR_PauseCinematic
*/
void SCR_PauseCinematic( bool pause )
{
	if( cls.state != CA_CINEMATIC ) {
		return;
	}

	cl.cin.pause_cnt += pause ? 1 : -1;
	if( cl.cin.pause_cnt == 1 && pause ) {
		cl.cin.pauseTime = SCR_CinematicTime();
		CL_SoundModule_LockBackgroundTrack( true );
		CL_SoundModule_Clear();
	}
	else if( cl.cin.pause_cnt == 0 && !pause ) {
		cl.cin.startTime += SCR_CinematicTime() - cl.cin.pauseTime;
		cl.cin.pauseTime = 0;
		CL_SoundModule_LockBackgroundTrack( false );
	}
	if( cl.cin.pause_cnt < 0 ) {
		cl.cin.pause_cnt = 0;
	}
}