• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ FS_ReadFile函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中FS_ReadFile函数的典型用法代码示例。如果您正苦于以下问题:C++ FS_ReadFile函数的具体用法?C++ FS_ReadFile怎么用?C++ FS_ReadFile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了FS_ReadFile函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: SV_LoadGame_f

/*
=================
SV_LoadGame_f
=================
*/
void    SV_LoadGame_f( void ) {
	char filename[MAX_QPATH], mapname[MAX_QPATH];
	byte *buffer;
	int size;

	Q_strncpyz( filename, Cmd_Argv( 1 ), sizeof( filename ) );
	if ( !filename[0] ) {
		Com_Printf( "You must specify a savegame to load\n" );
		return;
	}
	if ( Q_strncmp( filename, "save/", 5 ) && Q_strncmp( filename, "save\\", 5 ) ) {
		Q_strncpyz( filename, va( "save/%s", filename ), sizeof( filename ) );
	}
	if ( !strstr( filename, ".svg" ) ) {
		Q_strcat( filename, sizeof( filename ), ".svg" );
	}

	size = FS_ReadFile( filename, NULL );
	if ( size < 0 ) {
		Com_Printf( "Can't find savegame %s\n", filename );
		return;
	}

	buffer = Hunk_AllocateTempMemory( size );
	FS_ReadFile( filename, (void **)&buffer );

	// read the mapname, if it is the same as the current map, then do a fast load
	Com_sprintf( mapname, sizeof( mapname ), buffer + sizeof( int ) );

	if ( com_sv_running->integer && ( com_frameTime != sv.serverId ) ) {
		// check mapname
		if ( !Q_stricmp( mapname, sv_mapname->string ) ) {    // same

			if ( Q_stricmp( filename, "save/current.svg" ) != 0 ) {
				// copy it to the current savegame file
				FS_WriteFile( "save/current.svg", buffer, size );
			}

			Hunk_FreeTempMemory( buffer );

			Cvar_Set( "savegame_loading", "2" );  // 2 means it's a restart, so stop rendering until we are loaded
			SV_MapRestart_f();  // savegame will be loaded after restart

			return;
		}
	}

	Hunk_FreeTempMemory( buffer );

	// otherwise, do a slow load
	if ( Cvar_VariableIntegerValue( "sv_cheats" ) ) {
		Cbuf_ExecuteText( EXEC_APPEND, va( "spdevmap %s", filename ) );
	} else {    // no cheats
		Cbuf_ExecuteText( EXEC_APPEND, va( "spmap %s", filename ) );
	}
}
开发者ID:chegestar,项目名称:omni-bot,代码行数:61,代码来源:sv_ccmds.c


示例2: SV_ChangeMap

static void SV_ChangeMap( qbool cheats )
{
	const char* map = Cmd_Argv(1);
	if ( !map ) {
		return;
	}

	// make sure the level exists before trying to change
	// so that a typo at the server console won't end the game
	const char* mapfile = va( "maps/%s.bsp", map );
	if ( FS_ReadFile( mapfile, NULL ) == -1 ) {
		Com_Printf( "Can't find map %s\n", mapfile );
		return;
	}

	// force latched values to get set
	Cvar_Get( "g_gametype", "0", CVAR_SERVERINFO | CVAR_LATCH );

	// save the map name here cause on a map restart we reload the q3config.cfg
	// and thus nuke the arguments of the map command
	char mapname[MAX_QPATH];
	Q_strncpyz( mapname, map, sizeof(mapname) );

	// start up the map
	SV_SpawnServer( mapname );

	Cvar_Set( "sv_cheats", cheats ? "1" : "0" );
}
开发者ID:ShaneIsley,项目名称:challengeq3,代码行数:28,代码来源:sv_ccmds.cpp


示例3: Cmd_Exec_f

/*
===============
Cmd_Exec_f
===============
*/
void Cmd_Exec_f( void ) {
	qboolean quiet;
	union {
		char	*c;
		void	*v;
	} f;
	char	filename[MAX_QPATH];

	quiet = !Q_stricmp(Cmd_Argv(0), "execq");

	if (Cmd_Argc () != 2) {
		Com_Printf ("exec%s <filename> : execute a script file%s\n",
		            quiet ? "q" : "", quiet ? " without notification" : "");
		return;
	}

	Q_strncpyz( filename, Cmd_Argv(1), sizeof( filename ) );
	COM_DefaultExtension( filename, sizeof( filename ), ".cfg" );
	FS_ReadFile( filename, &f.v);
	if (!f.c) {
		Com_Printf ("couldn't exec %s\n", filename);
		return;
	}
	if (!quiet)
		Com_Printf ("execing %s\n", filename);
	
	Cbuf_InsertText (f.c);

	FS_FreeFile (f.v);
}
开发者ID:darklegion,项目名称:tremulous,代码行数:35,代码来源:cmd.c


示例4: Java_xreal_Engine_readFile

/*
 * Class:     xreal_Engine
 * Method:    readFile
 * Signature: (Ljava/lang/String;)[B
 */
jbyteArray JNICALL Java_xreal_Engine_readFile(JNIEnv *env, jclass cls, jstring jfileName)
{
	char           *fileName;
	jbyteArray		array;
	int				length;
	byte           *buf;

	fileName = (char *)((*env)->GetStringUTFChars(env, jfileName, 0));

	length = FS_ReadFile(fileName, (void **)&buf);
	if(!buf)
	{
		return NULL;
	}

	//Com_Printf("Java_xreal_Engine_readFile: file '%s' has length = %i\n", filename, length);

	array = (*env)->NewByteArray(env, length);
	(*env)->SetByteArrayRegion(env, array, 0, length, buf);

	(*env)->ReleaseStringUTFChars(env, jfileName, fileName);

	FS_FreeFile(buf);

	return array;
}
开发者ID:redrumrobot,项目名称:dretchstorm,代码行数:31,代码来源:vm_java.c


示例5: Cmd_Exec_f

/*
===============
Cmd_Exec_f
===============
*/
void Cmd_Exec_f( void ) {
	char	*f;
	int		len;
	char	filename[MAX_QPATH];

	if (Cmd_Argc () != 2) {
		Com_Printf ("exec <filename> : execute a script file\n");
		return;
	}

	Q_strncpyz( filename, Cmd_Argv(1), sizeof( filename ) );
	COM_DefaultExtension( filename, sizeof( filename ), ".cfg" ); 
	len = FS_ReadFile( filename, (void **)&f);
	if (!f) {
		Com_Printf ("couldn't exec %s\n",Cmd_Argv(1));
		return;
	}
#ifndef FINAL_BUILD
	Com_Printf ("execing %s\n",Cmd_Argv(1));
#endif

	Cbuf_InsertText (f);

	FS_FreeFile (f);
}
开发者ID:3ddy,项目名称:Jedi-Academy,代码行数:30,代码来源:cmd_common.cpp


示例6: CLQ2_Download_f

//	Request a download from the server
static void CLQ2_Download_f() {
	if ( Cmd_Argc() != 2 ) {
		common->Printf( "Usage: download <filename>\n" );
		return;
	}

	char filename[ MAX_OSPATH ];
	String::Sprintf( filename, sizeof ( filename ), "%s", Cmd_Argv( 1 ) );

	if ( strstr( filename, ".." ) ) {
		common->Printf( "Refusing to download a path with ..\n" );
		return;
	}

	if ( FS_ReadFile( filename, NULL ) != -1 ) {// it exists, no need to download
		common->Printf( "File already exists.\n" );
		return;
	}

	String::Cpy( clc.downloadName, filename );
	common->Printf( "Downloading %s\n", clc.downloadName );

	// download to a temp name, and only rename
	// to the real name when done, so if interrupted
	// a runt file wont be left
	String::StripExtension( clc.downloadName, clc.downloadTempName );
	String::Cat( clc.downloadTempName, sizeof ( clc.downloadTempName ), ".tmp" );

	CL_AddReliableCommand( va( "download %s", clc.downloadName ) );

	clc.downloadNumber++;
}
开发者ID:janisl,项目名称:jlquake,代码行数:33,代码来源:main.cpp


示例7: SV_Map_

//=========================================================
// don't call this directly, it should only be called from SV_Map_f() or SV_MapTransition_f()
//
static void SV_Map_( ForceReload_e eForceReload ) 
{
	char	*map;
	char	expanded[MAX_QPATH];

	map = Cmd_Argv(1);
	if ( !*map ) {
		return;
	}

	// make sure the level exists before trying to change, so that
	// a typo at the server console won't end the game
	if (strchr (map, '\\') ) {
		Com_Printf ("Can't have mapnames with a \\\n");
		return;
	}
	
	Com_sprintf (expanded, sizeof(expanded), "maps/%s.bsp", map);
	if ( FS_ReadFile (expanded, NULL) == -1 ) {
		Com_Printf ("Can't find map %s\n", expanded);
		return;
	}
	
	if (map[0]!='_')
	{
		SG_WipeSavegame("auto");
	}

	SP_Unload(SP_REGISTER_CLIENT);	//clear the previous map srings

	SV_SpawnServer( map, eForceReload, qtrue );	// start up the map
}
开发者ID:CairnTrenor,项目名称:OpenJK,代码行数:35,代码来源:sv_ccmds.cpp


示例8: S_LoadSound

/*
==============
S_LoadSound

The filename may be different than sfx->name in the case
of a forced fallback of a player specific sound
==============
*/
bool S_LoadSound( sfx_t *sfx )
{
	byte	*data;
	short	*samples;
	wavinfo_t	info;
	int		size;

	// player specific sounds are never directly loaded
	if ( sfx->soundName[0] == '*')
		return false;

	// load it in
	size = FS_ReadFile( sfx->soundName, (void **)&data );
	if ( !data ) 
		return false;

	info = GetWavinfo( sfx->soundName, data, size );
	if ( info.channels != 1 ) 
	{
		Com_Printf ("%s is a stereo wav file\n", sfx->soundName);
		FS_FreeFile (data);
		return false;
	}

	if ( info.width == 1 ) 
		Com_DPrintf(S_COLOR_YELLOW "WARNING: %s is a 8 bit wav file\n", sfx->soundName);

	if ( info.rate != 22050 ) 
		Com_DPrintf(S_COLOR_YELLOW "WARNING: %s is not a 22kHz wav file\n", sfx->soundName);

	samples = reinterpret_cast<short*>(Hunk_AllocateTempMemory(info.samples * sizeof(short) * 2));

	sfx->lastTimeUsed = Com_Milliseconds()+1;

	// each of these compression schemes works just fine
	// but the 16bit quality is much nicer and with a local
	// install assured we can rely upon the sound memory
	// manager to do the right thing for us and page
	// sound in as needed

	if( sfx->soundCompressed == true) 
	{
		sfx->soundCompressionMethod = 1;
		sfx->soundData = NULL;
		sfx->soundLength = ResampleSfxRaw( samples, info.rate, info.width, info.samples, (data + info.dataofs) );
		S_AdpcmEncodeSound(sfx, samples);
	} 
	else 
	{
		sfx->soundCompressionMethod = 0;
		sfx->soundLength = info.samples;
		sfx->soundData = NULL;
		ResampleSfx( sfx, info.rate, info.width, data + info.dataofs, false );
	}
	
	Hunk_FreeTempMemory(samples);
	FS_FreeFile( data );

	return true;
}
开发者ID:MilitaryForces,项目名称:MilitaryForces,代码行数:68,代码来源:snd_mem.c


示例9: S_FileExtension

/*
=================
S_FindCodecForFile

Select an appropriate codec for a file based on its extension
=================
*/
static snd_codec_t *S_FindCodecForFile(const char *filename)
{
	char *ext = S_FileExtension(filename);
	snd_codec_t *codec = codecs;

	if(!ext)
	{
		// No extension - auto-detect
		while(codec)
		{
			char fn[MAX_QPATH];
			Q_strncpyz(fn, filename, sizeof(fn) - 4);
			COM_DefaultExtension(fn, sizeof(fn), codec->ext);

			// Check it exists
			if(FS_ReadFile(fn, NULL) != -1)
				return codec;

			// Nope. Next!
			codec = codec->next;
		}

		// Nothin'
		return NULL;
	}

	while(codec)
	{
		if(!Q_stricmp(ext, codec->ext))
			return codec;
		codec = codec->next;
	}

	return NULL;
}
开发者ID:ballju,项目名称:SpaceTrader-GPL-1.1.14,代码行数:42,代码来源:snd_codec.c


示例10: FS_InitFilesystem

/*
================
FS_InitFilesystem

Called only at inital startup, not when the filesystem
is resetting due to a game change
================
*/
void FS_InitFilesystem( void ) {
	// allow command line parms to override our defaults
	// we don't have to specially handle this, because normal command
	// line variable sets happen before the filesystem
	// has been initialized
	//
	// UPDATE: BTO (VV)
	// we have to specially handle this, because normal command
	// line variable sets don't happen until after the filesystem
	// has already been initialized
	Com_StartupVariable( "fs_cdpath" );
	Com_StartupVariable( "fs_basepath" );
	Com_StartupVariable( "fs_game" );
	Com_StartupVariable( "fs_copyfiles" );
	Com_StartupVariable( "fs_restrict" );

	// try to start up normally
	FS_Startup( BASEGAME );
	initialized = qtrue;

	// see if we are going to allow add-ons
	FS_SetRestrictions();

	// if we can't find default.cfg, assume that the paths are
	// busted and error out now, rather than getting an unreadable
	// graphics screen when the font fails to load
	if ( FS_ReadFile( "default.cfg", NULL ) <= 0 ) {
		Com_Error( ERR_FATAL, "Couldn't load default.cfg" );
	}
}
开发者ID:AlexCSilva,项目名称:jediacademy,代码行数:38,代码来源:files_common.cpp


示例11: FS_InitFilesystem

/*
================
FS_InitFilesystem

Called only at inital startup, not when the filesystem
is resetting due to a game change
================
*/
void FS_InitFilesystem( void ) {
	// allow command line parms to override our defaults
	// we have to specially handle this, because normal command
	// line variable sets don't happen until after the filesystem
	// has already been initialized
	Com_StartupVariable( "fs_cdpath" );
	Com_StartupVariable( "fs_basepath" );
	Com_StartupVariable( "fs_homepath" );
	Com_StartupVariable( "fs_game" );
	Com_StartupVariable( "fs_copyfiles" );
	Com_StartupVariable( "fs_dirbeforepak" );

	if(!FS_FilenameCompare(Cvar_VariableString("fs_game"), BASEGAME))
		Cvar_Set("fs_game", "");

	// try to start up normally
	FS_Startup( BASEGAME );
	initialized = qtrue;

	// if we can't find default.cfg, assume that the paths are
	// busted and error out now, rather than getting an unreadable
	// graphics screen when the font fails to load
	if ( FS_ReadFile( "mpdefault.cfg", NULL ) <= 0 ) {
		Com_Error( ERR_FATAL, "Couldn't load mpdefault.cfg" );
		// bk001208 - SafeMode see below, FIXME?
	}

	Q_strncpyz(lastValidBase, fs_basepath->string, sizeof(lastValidBase));
	Q_strncpyz(lastValidGame, fs_gamedirvar->string, sizeof(lastValidGame));

  // bk001208 - SafeMode see below, FIXME?
}
开发者ID:CaptainSkyhawk,项目名称:OpenJK-VR,代码行数:40,代码来源:files_common.cpp


示例12: Cmd_Exec_f

/*
===============
Cmd_Exec_f
===============
*/
void Cmd_Exec_f( void ) {
    union {
        char	*c;
        void	*v;
    } f;
    int		len;
    char	filename[MAX_QPATH];

    if (Cmd_Argc () != 2) {
        Com_Printf ("exec <filename> : execute a script file\n");
        return;
    }

    Q_strncpyz( filename, Cmd_Argv(1), sizeof( filename ) );
    COM_DefaultExtension( filename, sizeof( filename ), ".cfg" );
    len = FS_ReadFile( filename, &f.v);
    if (!f.c) {
        Com_Printf ("couldn't exec %s\n",Cmd_Argv(1));
        return;
    }
    Com_Printf ("execing %s\n",Cmd_Argv(1));

    Cbuf_InsertText (f.c);

    FS_FreeFile (f.v);
}
开发者ID:norfenstein,项目名称:umbra,代码行数:31,代码来源:cmd.c


示例13: DoFileFindReplace

static qboolean DoFileFindReplace( LPCSTR psMenuFile, LPCSTR psFind, LPCSTR psReplace )
{
	char *buffer;

	OutputDebugString(va("Loading: \"%s\"\n",psMenuFile));

	int iLen = FS_ReadFile( psMenuFile,(void **) &buffer);
	if (iLen<1) 
	{
		OutputDebugString("Failed!\n");
		assert(0);
		return qfalse;
	}
	

	// find/rep...
	//
	string	str(buffer);
			str += "\r\n";	// safety for *(char+1) stuff


	FS_FreeFile( buffer );	// let go of the buffer

	// originally this kept looping for replacements, but now it only does one (since the find/replace args are repeated
	//	and this is called again if there are >1 replacements of the same strings to be made...
	//
//	int iReplacedCount = 0;
	char *pFound;
	int iSearchPos = 0;
	while ( (pFound = strstr(str.c_str()+iSearchPos,psFind)) != NULL)
	{
		// special check, the next char must be whitespace or carriage return etc, or we're not on a whole-word position...
		//
		int iFoundLoc = pFound - str.c_str();
		char cAfterFind = pFound[strlen(psFind)];
		if (cAfterFind > 32)
		{
			// ... then this string was part of a larger one, so ignore it...
			//
			iSearchPos = iFoundLoc+1;
			continue;
		}		

		str.replace(iFoundLoc, strlen(psFind), psReplace);
//		iSearchPos = iFoundLoc+1;
//		iReplacedCount++;
		break;
	}

//	assert(iReplacedCount);
//	if (iReplacedCount>1)
//	{
//		int z=1;
//	}
	FS_WriteFile( psMenuFile, str.c_str(), strlen(str.c_str()));

	OutputDebugString("Ok\n");

	return qtrue;
}
开发者ID:Agustinlv,项目名称:BlueHarvest,代码行数:60,代码来源:ui_debug.cpp


示例14: SV_Map_f

/**
 * @brief Restart the server on a different map
 */
static void SV_Map_f(void)
{
	char     *cmd;
	char     *map;
	char     mapname[MAX_QPATH];
	qboolean cheat;
	char     expanded[MAX_QPATH];

	map = Cmd_Argv(1);
	if (!map || !map[0])
	{
		Com_Printf("Usage: \n    map <map name>\n    devmap <map name>\n");
		return;
	}

	// make sure the level exists before trying to change, so that
	// a typo at the server console won't end the game
	Com_sprintf(expanded, sizeof(expanded), "maps/%s.bsp", map);
	if (FS_ReadFile(expanded, NULL) == -1)
	{
		Com_Printf("Can't find map %s\n", expanded);
		return;
	}

	Cvar_Set("gamestate", va("%i", GS_INITIALIZE)); // reset gamestate on map/devmap
	Cvar_Set("g_currentRound", "0");                // reset the current round
	Cvar_Set("g_nextTimeLimit", "0");               // reset the next time limit

	cmd = Cmd_Argv(0);

	if (!Q_stricmp(cmd, "devmap"))
	{
		cheat = qtrue;
	}
	else
	{
		cheat = qfalse;
	}

	// save the map name here cause on a map restart we reload the etconfig.cfg
	// and thus nuke the arguments of the map command
	Q_strncpyz(mapname, map, sizeof(mapname));

	// start up the map
	SV_SpawnServer(mapname);

	// set the cheat value
	// if the level was started with "map <mapname>", then
	// cheats will not be allowed.
	// If started with "devmap <mapname>"
	// then cheats will be allowed
	if (cheat)
	{
		Cvar_Set("sv_cheats", "1");
	}
	else
	{
		Cvar_Set("sv_cheats", "0");
	}
}
开发者ID:vishen,项目名称:etlegacy,代码行数:63,代码来源:sv_ccmds.c


示例15: TTF_Load

// can't unload TTFs, so we'll need to make sure we don't keep reloading them, sadly
void* TTF_Load(Asset &asset) {
	TTFFont_t *fnt = new TTFFont_t();

	if (ctx == nullptr) {
		ctx = glfonsCreate(512, 512, FONS_ZERO_TOPLEFT);
	}

	int found = fonsGetFontByName(ctx, asset.name);
	if (found != FONS_INVALID) {
		fnt->valid = true;
		fnt->hnd = found;
		found++;
		return fnt;
	}

	unsigned char *font;
	auto sz = FS_ReadFile(asset.path, (void **)&font);

	if (sz == -1) {
		Con_Errorf(ERR_GAME, "couldn't load file %s", asset.path);
		return nullptr;
	}

	int hnd = fonsAddFontMem(ctx, asset.name, font, sz, 1);
	if (hnd < 0) {
		return nullptr;
	}

	fnt->valid = true;
	fnt->hnd = hnd;

	return (void*)fnt;
}
开发者ID:sponge,项目名称:sdlgame,代码行数:34,代码来源:asset_ttf.cpp


示例16: ExecIsFSHookFunc

// note this function has to return 'int', as otherwise only the bottom byte will get cleared
int ExecIsFSHookFunc(const char* execFilename, const char* dummyMatch) { // dummyMatch isn't used by us
    // check if the file exists in our FS_* path
    if (FS_ReadFile(execFilename, NULL) >= 0)
    {
        return false;
    }

    return true;
}
开发者ID:JohannesHei,项目名称:iw4m-lan,代码行数:10,代码来源:PatchMW2Modding.cpp


示例17: JK2SP_Register

/************************************************************************************************
 * JK2SP_Register : Load given string package file. Register it.
 *
 * Inputs:
 *	Package File name
 *	Registration flag
 *
 * Return:
 *	success/fail
 *
 ************************************************************************************************/
qboolean JK2SP_Register(const char *inPackage, unsigned char Registration)
{
	char											*buffer;
	char											Package[MAX_QPATH];
	int												size;
	cStringPackageSingle							*new_sp;
	std::map<std::string, cStringPackageSingle *>::iterator	i;


	assert(JK2SP_ListByName.size() == JK2SP_ListByID.size());

	Q_strncpyz(Package, inPackage, MAX_QPATH);
	Q_strupr(Package);

	i = JK2SP_ListByName.find(Package);
	if (i != JK2SP_ListByName.end())
	{
		new_sp = (*i).second;
	}
	else
	{

		size = FS_ReadFile(va("strip/%s.sp", Package), (void **)&buffer);
		if (size == -1)
		{
			if ( Registration & SP_REGISTER_REQUIRED )
			{
				Com_Error(ERR_FATAL, "Could not open string package '%s'", Package);
			}
			return qfalse;
		}

		// Create the new string package
		new_sp = new cStringPackageSingle(Package);
		new_sp->Load(buffer, size );
		FS_FreeFile(buffer);

		if (Registration & SP_REGISTER_CLIENT)
		{
			Com_DPrintf(S_COLOR_YELLOW "JK2SP_Register: Registered client string package '%s' with ID %02x\n", Package, (int)new_sp->GetID());
		}
		else
		{
			Com_DPrintf(S_COLOR_YELLOW "JK2SP_Register: Registered string package '%s' with ID %02x\n", Package, (int)new_sp->GetID());
		}

		// Insert into the name vs package map
		JK2SP_ListByName[Package] = new_sp;
		// Insert into the id vs package map
		JK2SP_ListByID[new_sp->GetID()] = new_sp;
	}
	// Or in the new registration data
	new_sp->Register(Registration);

//	return new_sp;
	return qtrue;
}
开发者ID:AlexXT,项目名称:OpenJK,代码行数:68,代码来源:strip.cpp


示例18: ovc_read

PRIVATE size_t ovc_read( void *ptr, size_t size, size_t nmemb, void *dataSource )
{
	if( ! size || ! nmemb )
	{
		return 0;
	}
		
	return FS_ReadFile( ptr, size, nmemb, fh );
}
开发者ID:Anters,项目名称:Wolf3D-iOS,代码行数:9,代码来源:oggfile.c


示例19: R_LoadPIC

void R_LoadPIC( const char* fileName, byte** pic, int* width, int* height, int mode ) {
	idList<byte> buffer;
	if ( FS_ReadFile( fileName, buffer ) <= 0 ) {
		*pic = NULL;
		return;
	}

	R_LoadPICMem( buffer.Ptr(), pic, width, height, mode );
}
开发者ID:janisl,项目名称:jlquake,代码行数:9,代码来源:pic.cpp


示例20: R_ScreenShotTGA_f

/* 
================== 
R_ScreenShotTGA_f

screenshot
screenshot [silent]
screenshot [levelshot]
screenshot [filename]

Doesn't print the pacifier message if there is a second arg
================== 
*/  
void R_ScreenShotTGA_f (void) {
#ifndef _XBOX
	char		checkname[MAX_OSPATH];
	int			len;
	static	int	lastNumber = -1;
	qboolean	silent;

	if ( !strcmp( Cmd_Argv(1), "levelshot" ) ) {
		R_LevelShot();
		return;
	}
	if ( !strcmp( Cmd_Argv(1), "silent" ) ) {
		silent = qtrue;
	} else {
		silent = qfalse;
	}

	if ( Cmd_Argc() == 2 && !silent ) {
		// explicit filename
		Com_sprintf( checkname, MAX_OSPATH, "screenshots/%s.tga", Cmd_Argv( 1 ) );
	} else {
		// scan for a free filename

		// if we have saved a previous screenshot, don't scan
		// again, because recording demo avis can involve
		// thousands of shots
		if ( lastNumber == -1 ) {
			// scan for a free number
			for ( lastNumber = 0 ; lastNumber <= 9999 ; lastNumber++ ) {
				R_ScreenshotFilename( lastNumber, checkname, ".tga" );

				len = FS_ReadFile( checkname, NULL );
				if ( len <= 0 ) {
					break;	// file doesn't exist
				}
			}
		} else {
			R_ScreenshotFilename( lastNumber, checkname, ".tga" );
		}

		if ( lastNumber == 10000 ) {
			VID_Printf (PRINT_ALL, "ScreenShot: Couldn't create a file\n"); 
			return;
 		}

		lastNumber++;
	}


	R_TakeScreenshot( 0, 0, glConfig.vidWidth, glConfig.vidHeight, checkname );

	if ( !silent ) {
		VID_Printf (PRINT_ALL, "Wrote %s\n", checkname);
	}
#endif
} 
开发者ID:Camron,项目名称:OpenJK,代码行数:68,代码来源:tr_init.cpp



注:本文中的FS_ReadFile函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ FS_SV_FOpenFileWrite函数代码示例发布时间:2022-05-30
下一篇:
C++ FS_Printf函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap