/* ================== SCR_RunCinematic ================== */ void SCR_RunCinematic( void ) { if( cls.state != ca_cinematic ) return; if( !AVI_IsActive( cin_state )) return; if( UI_IsVisible( )) { // these can happens when user set +menu_ option to cmdline AVI_CloseVideo( cin_state ); cls.state = ca_disconnected; Key_SetKeyDest( key_menu ); S_StopStreaming(); cls.movienum = -1; cin_time = 0.0f; return; } // advances cinematic time (ignores maxfps and host_framerate settings) cin_time += host.realframetime; // stop the video after it finishes if( cin_time > video_duration + 0.1f ) { SCR_NextMovie( ); return; } // read the next frame cin_frame = AVI_GetVideoFrameNumber( cin_state, cin_time ); }
/* ================= CL_Escape_f Escape to menu from game ================= */ void CL_Escape_f( void ) { if( cls.key_dest == key_menu ) return; // the final credits is running if( UI_CreditsActive( )) return; if( cls.state == ca_cinematic ) SCR_NextMovie(); // jump to next movie else UI_SetActiveMenu( true ); }
void SCR_CheckStartupVids( void ) { int c = 0; char *afile, *pfile; string token; if( Sys_CheckParm( "-nointro" ) || host.developer >= 2 || cls.demonum != -1 ) { // don't run movies where we in developer-mode cls.movienum = -1; return; } if( !FS_FileExists( "media/StartupVids.txt", false )) SCR_CreateStartupVids(); afile = FS_LoadFile( "media/StartupVids.txt", NULL, false ); if( !afile ) return; // something bad happens pfile = afile; while(( pfile = COM_ParseFile( pfile, token )) != NULL ) { Q_strncpy( cls.movies[c], token, sizeof( cls.movies[0] )); if( ++c > MAX_MOVIES - 1 ) { MsgDev( D_WARN, "Host_StartMovies: max %i movies in StartupVids\n", MAX_MOVIES ); break; } } Mem_Free( afile ); // run cinematic if( !SV_Active() && cls.movienum != -1 && cls.state != ca_cinematic ) { cls.movienum = 0; SCR_NextMovie (); } else cls.movienum = -1; }