Exemplo n.º 1
0
void CG_SC_PrintStatsToFile( const char *format, ... )
{
	va_list	argptr;
	char msg[1024];

	va_start( argptr, format );
	Q_vsnprintfz( msg, sizeof( msg ), format, argptr );
	va_end( argptr );

	trap_FS_Print( cg_statsFileHandle, msg );
}
Exemplo n.º 2
0
/*
* CG_SaveRecamScriptFile
*/
void CG_SaveRecamScriptFile( const char *filename ) {
	cg_democam_t *cam;
	cg_subtitle_t *sub;
	int filehandle;
	char str[256];

	if( !cg_cams_headnode && !cg_subs_headnode ) {
		CG_Printf( "CG_SaveRecamScriptFile: no cameras nor subtitles to save\n" );
		return;
	}

	if( !filename ) {
		filename = demoscriptname;
		if( !filename ) {
			return;
		}
	}

	if( trap_FS_FOpenFile( filename, &filehandle, FS_WRITE ) == -1 ) {
		CG_Printf( "CG_SaveRecamScriptFile: Couldn't create the file %s\n", demoscriptname );
		return;
	}

	Q_snprintfz( str, sizeof( str ), "// cam script file generated by %s\n", trap_Cvar_String( "gamename" ) );
	trap_FS_Print( filehandle, str );

	Q_snprintfz( str, sizeof( str ), "// demo start time: %" PRIi64 "\n", demo_initial_timestamp );
	trap_FS_Print( filehandle, str );

	cam = cg_cams_headnode;
	while( cam != NULL ) {
		Q_snprintfz( str, sizeof( str ), "%i %" PRIi64" %.2f %.2f %.2f %.2f %.2f %.2f %i %i\n",
					 cam->type,
					 cam->timeStamp,
					 cam->origin[0],
					 cam->origin[1],
					 cam->origin[2],
					 cam->angles[0],
					 cam->angles[1],
					 cam->angles[2],
					 cam->trackEnt,
					 cam->fov
					 );
		trap_FS_Print( filehandle, str );
		cam = cam->next;
	}

	sub = cg_subs_headnode;
	while( sub != NULL ) {
		Q_snprintfz( str, sizeof( str ), "%s %" PRIi64 " %" PRIi64 " ",
					 sub->highprint ? "print" : "subtitle",
					 sub->timeStamp,
					 sub->maxDuration
					 );
		trap_FS_Print( filehandle, str );
		trap_FS_Print( filehandle, "\"" );
		trap_FS_Print( filehandle, sub->text ? sub->text : "" );
		trap_FS_Print( filehandle, "\"\n" );
		sub = sub->next;
	}

	trap_FS_FCloseFile( filehandle );
	CG_Printf( "cam file saved\n" );
}