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

C++ FS_Gamedir函数代码示例

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

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



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

示例1: SV_WriteLevelFile

void
SV_WriteLevelFile(void)
{
	char name[MAX_OSPATH];
	FILE *f;

	Com_DPrintf("SV_WriteLevelFile()\n");

	Com_sprintf(name, sizeof(name), "%s/save/current/%s.sv2",
				FS_Gamedir(), sv.name);
	f = fopen(name, "wb");

	if (!f)
	{
		Com_Printf("Failed to open %s\n", name);
		return;
	}

	fwrite(sv.configstrings, sizeof(sv.configstrings), 1, f);
	CM_WritePortalState(f);
	fclose(f);

	Com_sprintf(name, sizeof(name), "%s/save/current/%s.sav",
				FS_Gamedir(), sv.name);
	ge->WriteLevel(name);
}
开发者ID:bradc6,项目名称:yquake2,代码行数:26,代码来源:sv_save.c


示例2: SV_WipeSavegame

/*
=====================
SV_WipeSavegame

Delete save/<XXX>/
=====================
*/
static void SV_WipeSavegame (const char *savename)
{
	char	name[MAX_OSPATH];
	char	*s;

	Com_DPrintf("SV_WipeSaveGame(%s)\n", savename);

	Com_sprintf (name, sizeof(name), "%s/save/%s/server.ssv", FS_Gamedir (), savename);
	FS_RemoveFile(name);
	Com_sprintf (name, sizeof(name), "%s/save/%s/game.ssv", FS_Gamedir (), savename);
	FS_RemoveFile(name);

	Com_sprintf (name, sizeof(name), "%s/save/%s/*.sav", FS_Gamedir (), savename);
	s = Sys_FindFirst( name, 0, 0 );
	while (s)
	{
		FS_RemoveFile(s);
		s = Sys_FindNext( 0, 0 );
	}
	Sys_FindClose ();
	Com_sprintf (name, sizeof(name), "%s/save/%s/*.sv2", FS_Gamedir (), savename);
	s = Sys_FindFirst(name, 0, 0 );
	while (s)
	{
		FS_RemoveFile(s);
		s = Sys_FindNext( 0, 0 );
	}
	Sys_FindClose ();
}
开发者ID:mattx86,项目名称:aprq2,代码行数:36,代码来源:sv_ccmds.c


示例3: binaryWrite

int binaryWrite(char *file, char *data, int bytenum)
{

	char tmpfile[512];
	char tmpfile2[512];
	FILE *fh = NULL;
	sprintf(tmpfile,"%s/%s.tmp2",FS_Gamedir(),file);
	sprintf(tmpfile2,"%s/%s",FS_Gamedir(),file);

	//Com_Printf("[mio] try to write %d bytes to %s..\n", bytenum, tmpfile);

	fh = fopen(tmpfile,"wb");
	if (!fh) return 1;
	
	fwrite(data,1,bytenum,fh);

	fclose(fh);

	//CL_RestartFilesystem( false );
	//Com_Printf("fetched 100 ok, rename time...\n");

	//Com_Printf("rename %s to %s ..\n", tmpfile,tmpfile2);
	if (rename(tmpfile,tmpfile2) == 0)
		remove(tmpfile);

	return 0;
}
开发者ID:wavecollapser,项目名称:nofuzz-quake2,代码行数:27,代码来源:cl_http.c


示例4: SV_WipeSavegame

/*
=====================
SV_WipeSavegame

Delete save/<XXX>/
=====================
*/
void SV_WipeSavegame (char *savename)
{
	char	name[MAX_OSPATH];
	char	*s;

	Com_DPrintf("SV_WipeSaveGame(%s)\n", savename);

	Com_sprintf (name, sizeof(name), "%s/save/%s/server.ssv", FS_Gamedir (), savename);
	remove (name);
	Com_sprintf (name, sizeof(name), "%s/save/%s/game.ssv", FS_Gamedir (), savename);
	remove (name);
	// Knightmare- delete screenshot
	Com_sprintf (name, sizeof(name), "%s/save/%s/shot.png", FS_Gamedir (), savename);
	remove (name);

	Com_sprintf (name, sizeof(name), "%s/save/%s/*.sav", FS_Gamedir (), savename);
	s = Sys_FindFirst( name, 0, 0 );
	while (s)
	{
		remove (s);
		s = Sys_FindNext( 0, 0 );
	}
	Sys_FindClose ();
	Com_sprintf (name, sizeof(name), "%s/save/%s/*.sv2", FS_Gamedir (), savename);
	s = Sys_FindFirst(name, 0, 0 );
	while (s)
	{
		remove (s);
		s = Sys_FindNext( 0, 0 );
	}
	Sys_FindClose ();
}
开发者ID:Nephatrine,项目名称:nephq2,代码行数:39,代码来源:sv_ccmds.c


示例5: CDAudio_Play2

void CDAudio_Play2(int track, qboolean looping)
{
	HANDLE playingThread;
	char filename[MAX_PATH];
	struct ThreadArgList_t *tal;

	if (!enabled)
		return;
	
	if (!cdValid)
	{
		CDAudio_GetAudioDiskInfo();
		if (!cdValid)
			return;
	}

	track = remap[track];

	if (track < 1 || track > maxTrack)
	{
		Com_DPrintf("CDAudio: Bad track number %u.\n", track);
		return;
	}

	if (playing)
	{
		if (playTrack == track)
			return;
		CDAudio_Stop();
	}

	tal = malloc(sizeof(struct ThreadArgList_t));
	tal->playLooping = looping;
	tal->playTrack = track;

	sprintf(filename, "%s\\Track%03d.ogg", FS_Gamedir(), track);
	if (!OpenOGG(filename, tal))
	{
		sprintf(filename, "%s\\Track%02d.ogg", FS_Gamedir(), track);
		if (!OpenOGG(filename, tal))
		{
			Com_DPrintf("CDAudio: Cannot open Vorbis file \"%s\"", filename);
			return;
		}
	}

	playLooping = looping;
	playTrack = track;
	playing = true;

	// force volume update
	cdvolume = -1;

	playingThread = (HANDLE)_beginthreadex(NULL, 0, PlayingThreadProc, tal, CREATE_SUSPENDED, NULL);
	SetThreadPriority(playingThread, THREAD_PRIORITY_TIME_CRITICAL);
	ResumeThread(playingThread);
}
开发者ID:Azarien,项目名称:SoftQuake2,代码行数:57,代码来源:cd_win.c


示例6: R_ScreenShot_f

/*
-----------------------------------------------------------------------------
 Function: 

 Parameters:

 Returns:

 Notes: 
-----------------------------------------------------------------------------
*/
PRIVATE void R_ScreenShot_f( void ) 
{
	W8		*buffer;
	char	picname[ 80 ]; 
	char	checkname[ MAX_OSPATH ];
	int		i;
	FILE	*f;

	// create the scrnshots directory if it doesn't exist
	my_snprintf( checkname, sizeof( checkname ), "%s/scrnshot", FS_Gamedir() );
	FS_CreateDirectory( checkname );

// 
// find a file name to save it to 
// 
	my_strlcpy( picname, "scrn00.tga", sizeof( picname ) );

	for( i = 0 ; i <= 99 ; ++i ) 
	{ 
		picname[ 4 ] = i / 10 + '0'; 
		picname[ 5 ] = i % 10 + '0'; 
		my_snprintf( checkname, sizeof( checkname ), "%s/scrnshot/%s", FS_Gamedir(), picname );
		f = fopen( checkname, "rb" );
		if( ! f )
		{
			break;	// file doesn't exist
		}

		fclose( f );
	} 

	if( i == 100 ) 
	{
		Com_Printf( "R_ScreenShot_f: Couldn't create a file\n" ); 
		return;
 	}


	buffer = MM_MALLOC( viddef.width * viddef.height * 3 );
	

	pfglReadPixels( 0, 0, viddef.width, viddef.height, GL_RGB, GL_UNSIGNED_BYTE, buffer ); 

	
	WriteTGA( checkname, 24, viddef.width, viddef.height, buffer, 1, 1 );
	

	MM_FREE( buffer );
	Com_Printf( "Wrote %s\n", picname );
}
开发者ID:Anters,项目名称:Wolf3D-iOS,代码行数:61,代码来源:opengl_main.c


示例7: SV_ReadLevelFile

void
SV_ReadLevelFile(void)
{
	char name[MAX_OSPATH];
	fileHandle_t f;

	Com_DPrintf("SV_ReadLevelFile()\n");

	Com_sprintf(name, sizeof(name), "save/current/%s.sv2", sv.name);
	FS_FOpenFile(name, &f, FS_READ);

	if (!f)
	{
		Com_Printf("Failed to open %s\n", name);
		return;
	}

	FS_Read(sv.configstrings, sizeof(sv.configstrings), f);
	CM_ReadPortalState(f);
	FS_FCloseFile(f);

	Com_sprintf(name, sizeof(name), "%s/save/current/%s.sav",
				FS_Gamedir(), sv.name);
	ge->ReadLevel(name);
}
开发者ID:bradc6,项目名称:yquake2,代码行数:25,代码来源:sv_save.c


示例8: SV_GameMap_f

/*
==================
SV_GameMap_f

Saves the state of the map just being exited and goes to a new map.

If the initial character of the map string is '*', the next map is
in a new unit, so the current savegame directory is cleared of
map files.

Example:

*inter.cin+jail

Clears the archived maps, plays the inter.cin cinematic, then
goes to map jail.bsp.
==================
*/
void SV_GameMap_f (void)
{
	char		*map;
	int			i;
	client_t	*cl;
	qboolean	*savedInuse;

	if (Cmd_Argc() != 2)
	{
		Com_Printf ("USAGE: gamemap <map>\n");
		return;
	}

	Com_DPrintf("SV_GameMap(%s)\n", Cmd_Argv(1));

	FS_CreatePath (va("%s/save/current/", FS_Gamedir()));

	// check for clearing the current savegame
	map = Cmd_Argv(1);
	if (map[0] == '*')
	{
		// wipe all the *.sav files
		SV_WipeSavegame ("current");
	}
	else
	{	// save the map just exited
		if (sv.state == ss_game)
		{
			// clear all the client inuse flags before saving so that
			// when the level is re-entered, the clients will spawn
			// at spawn points instead of occupying body shells
			savedInuse = malloc(maxclients->value * sizeof(qboolean));
			for (i=0,cl=svs.clients ; i<maxclients->value; i++,cl++)
			{
				savedInuse[i] = cl->edict->inuse;
				cl->edict->inuse = false;
			}

			SV_WriteLevelFile ();

			// we must restore these for clients to transfer over correctly
			for (i=0,cl=svs.clients ; i<maxclients->value; i++,cl++)
				cl->edict->inuse = savedInuse[i];
			free (savedInuse);
		}
	}

	// start up the next map
	SV_Map (false, Cmd_Argv(1), false );

	// archive server state
	strncpy (svs.mapcmd, Cmd_Argv(1), sizeof(svs.mapcmd)-1);

	// copy off the level to the autosave slot
	if (!dedicated->value)
	{
		SV_WriteServerFile (true);
		SV_CopySaveGame ("current", "save0");
	}
}
开发者ID:AJenbo,项目名称:Quake-2,代码行数:78,代码来源:sv_ccmds.c


示例9: CL_WriteConfiguration

/*
 * Writes key bindings and archived cvars to config.cfg
 */
void
CL_WriteConfiguration(void)
{
	FILE *f;
	char path[MAX_OSPATH];

	if (cls.state == ca_uninitialized)
	{
		return;
	}

	Com_sprintf(path, sizeof(path), "%s/config.cfg", FS_Gamedir());

	f = Q_fopen(path, "w");

	if (!f)
	{
		Com_Printf("Couldn't write config.cfg.\n");
		return;
	}

	fprintf(f, "// generated by quake, do not modify\n");

	Key_WriteBindings(f);

	fflush(f);
	fclose(f);

	Cvar_WriteVariables(path);
}
开发者ID:Pickle,项目名称:yquake2,代码行数:33,代码来源:cl_main.c


示例10: ConsoleLogfile

static void ConsoleLogfile (const char *msg)
{
	// logfile
	if (logfile_active && logfile_active->value)
	{
		char name[MAX_QPATH];
		
		if (!logfile)
		{
			// ===
			// jit -- allow multiple console logs for servers on multiple ports. 
			int port;

			port = Cvar_Get("port", va("%i", PORT_SERVER), CVAR_NOSET)->value;
			Com_sprintf(name, sizeof(name), "%s/qconsole%d.log", FS_Gamedir(), port);
			// ===

			if (logfile_active->value > 2)
				logfile = fopen(name, "a");
			else
				logfile = fopen(name, "w");
		}

		if (logfile)
			fprintf(logfile, "%s", msg);

		if (logfile_active->value > 1)
			fflush(logfile);		// force it to save every time
	}
}
开发者ID:jitspoe,项目名称:starviewer,代码行数:30,代码来源:common.c


示例11: Com_Printf

/*
 * Both client and server can use this, and it will output
 * to the apropriate place.
 */
void
Com_Printf(char *fmt, ...)
{
	va_list argptr;
	char msg[MAXPRINTMSG];

	va_start(argptr, fmt);
	vsnprintf(msg, MAXPRINTMSG, fmt, argptr);
	va_end(argptr);

	if (rd_target)
	{
		if ((strlen(msg) + strlen(rd_buffer)) > (rd_buffersize - 1))
		{
			rd_flush(rd_target, rd_buffer);
			*rd_buffer = 0;
		}

		strcat(rd_buffer, msg);
		return;
	}

#ifndef DEDICATED_ONLY
	Con_Print(msg);
#endif

	/* also echo to debugging console */
	Sys_ConsoleOutput(msg);

	/* logfile */
	if (logfile_active && logfile_active->value)
	{
		char name[MAX_QPATH];

		if (!logfile)
		{
			Com_sprintf(name, sizeof(name), "%s/qconsole.log", FS_Gamedir());

			if (logfile_active->value > 2)
			{
				logfile = fopen(name, "a");
			}

			else
			{
				logfile = fopen(name, "w");
			}
		}

		if (logfile)
		{
			fprintf(logfile, "%s", msg);
		}

		if (logfile_active->value > 1)
		{
			fflush(logfile);  /* force it to save every time */
		}
	}
}
开发者ID:Clever-Boy,项目名称:yquake2,代码行数:64,代码来源:clientserver.c


示例12: SV_Loadgame_f

/*
 * ============== SV_Loadgame_f
 *
 * ==============
 */
void
SV_Loadgame_f(void)
{
	char		name[MAX_OSPATH];
	FILE           *f;
	char           *dir;

	if (Cmd_Argc() != 2) {
		Com_Printf("USAGE: loadgame <directory>\n");
		return;
	}
	Com_Printf("Loading game...\n");

	dir = Cmd_Argv(1);
	if (strstr(dir, "..") || strstr(dir, "/") || strstr(dir, "\\")) {
		Com_Printf("Bad savedir.\n");
	}
	/* make sure the server.ssv file exists */
	Com_sprintf(name, sizeof(name), "%s/save/%s/server.ssv", FS_Gamedir(), Cmd_Argv(1));
	f = fopen(name, "rb");
	if (!f) {
		Com_Printf("No such savegame: %s\n", name);
		return;
	}
	fclose(f);

	SV_CopySaveGame(Cmd_Argv(1), "current");

	SV_ReadServerFile();

	/* go to the map */
	sv.state = ss_dead;	/* don't save current level when changing */
	SV_Map(false, svs.mapcmd, true);
}
开发者ID:ZwS,项目名称:qudos,代码行数:39,代码来源:sv_ccmds.c


示例13: Maps_Scan

static void Maps_Scan( void)
{
	int		numFiles;
	char	findname[1024];
	char	**list;
	int		i;

	Maps_Free();

	Com_sprintf(findname, sizeof(findname), "%s/maps/*.bsp", FS_Gamedir());
	list = FS_ListFiles( findname, &numFiles, 0, SFF_SUBDIR | SFF_HIDDEN | SFF_SYSTEM );
	if( !list ) {
		return;
	}

	for( i = 0; i < numFiles - 1; i++ ) {
		if( map_count < MAX_MENU_MAPS ) {
			list[i][strlen(list[i]) - 4] = 0;
			if (strrchr( list[i], '/' ))
				mapnames[map_count] = CopyString( strrchr( list[i], '/' ) + 1, TAG_MENU);
			else
				mapnames[map_count] = CopyString( list[i], TAG_MENU);

			map_count++;
		}
		Z_Free( list[i] );
	}
	Z_Free( list );

}
开发者ID:hifi-unmaintained,项目名称:aprq2,代码行数:30,代码来源:ui_startserver.c


示例14: CL_DownloadFileName

void CL_DownloadFileName(char *dest, int destlen, char *fn)
{
	//if (strncmp(fn, "players", 7) == 0)
	//	Com_sprintf (dest, destlen, "%s/%s", BASEDIRNAME, fn);
	//else
	Com_sprintf (dest, destlen, "%s/%s", FS_Gamedir(), fn);
}
开发者ID:Slipyx,项目名称:r1q2,代码行数:7,代码来源:cl_parse.c


示例15: SV_CopySaveGame

/*
================
SV_CopySaveGame
================
*/
void SV_CopySaveGame (char *src, char *dst)
{
	char	name[MAX_OSPATH], name2[MAX_OSPATH];
	int		l, len;
	char	*found;

	Com_DPrintf("SV_CopySaveGame(%s, %s)\n", src, dst);

	SV_WipeSavegame (dst);

	// copy the savegame over
	Com_sprintf (name, sizeof(name), "%s/save/%s/server.ssv", FS_Gamedir(), src);
	Com_sprintf (name2, sizeof(name2), "%s/save/%s/server.ssv", FS_Gamedir(), dst);
	FS_CreatePath (name2);
	CopyFile (name, name2);

	Com_sprintf (name, sizeof(name), "%s/save/%s/game.ssv", FS_Gamedir(), src);
	Com_sprintf (name2, sizeof(name2), "%s/save/%s/game.ssv", FS_Gamedir(), dst);
	CopyFile (name, name2);

	// Knightmare- copy screenshot
	if (strcmp(dst, "kmq2save0")) // no screenshot for start of level autosaves
	{
		Com_sprintf (name, sizeof(name), "%s/save/%s/shot.jpg", FS_Gamedir(), src);
		Com_sprintf (name2, sizeof(name2), "%s/save/%s/shot.jpg", FS_Gamedir(), dst);
		CopyFile (name, name2);
	}

	Com_sprintf (name, sizeof(name), "%s/save/%s/", FS_Gamedir(), src);
	len = strlen(name);
	Com_sprintf (name, sizeof(name), "%s/save/%s/*.sav", FS_Gamedir(), src);
	found = Sys_FindFirst(name, 0, 0 );
	while (found)
	{
	//	strncpy (name+len, found+len);
		Q_strncpyz (name+len, found+len, sizeof(name)-len);
		Com_sprintf (name2, sizeof(name2), "%s/save/%s/%s", FS_Gamedir(), dst, found+len);
		CopyFile (name, name2);

		// change sav to sv2
		l = strlen(name);
	//	strncpy (name+l-3, "sv2");
		Q_strncpyz (name+l-3, "sv2", sizeof(name)-l+3);
		l = strlen(name2);
	//	strncpy (name2+l-3, "sv2");
		Q_strncpyz (name2+l-3, "sv2", sizeof(name2)-l+3);
		CopyFile (name, name2);

		found = Sys_FindNext( 0, 0 );
	}
	Sys_FindClose ();
}
开发者ID:Kiln707,项目名称:KMQuake2,代码行数:57,代码来源:sv_ccmds.c


示例16: serverlist_save

static void serverlist_save (void)
{
	FILE *fp;
	char szFilename[MAX_QPATH];

	if (!m_serverlist.actualsize)
		return; // don't write if there's no data.

	sprintf(szFilename, "%s/serverlist.dat", FS_Gamedir());

	if ((fp = fopen(szFilename, "wb")))
	{
		int endiantest = 123123123;
		register int i;
		short stemp;
		unsigned char ctemp;
		char *s;

		// Write Header:
		fwrite("PB2Serverlist1.00", sizeof("PB2Serverlist1.00")-1, 1, fp);
		fwrite(&endiantest, sizeof(int), 1, fp);
		
		// Write our data:
		pthread_mutex_lock(&m_mut_serverlist); // make sure no other threads are using it
		fwrite(&m_serverlist.actualsize, sizeof(int), 1, fp);
		fwrite(&m_serverlist.numservers, sizeof(int), 1, fp);
		fwrite(&m_serverlist.nummapped, sizeof(int), 1, fp);
		
		for (i=0; i<m_serverlist.numservers; i++)
		{
			fwrite(&m_serverlist.server[i].adr, sizeof(netadr_t), 1, fp);
			stemp = m_serverlist.server[i].remap;
			fwrite(&stemp, sizeof(short), 1, fp);
			s = m_serverlist.server[i].servername;
			fwrite(s, strlen(s)+1, 1, fp);
			s = m_serverlist.server[i].mapname;
			fwrite(s, strlen(s)+1, 1, fp);
			stemp = (short)m_serverlist.server[i].ping;
			fwrite(&stemp, sizeof(short), 1, fp);
			ctemp = (unsigned char)m_serverlist.server[i].players;
			fwrite(&ctemp, sizeof(unsigned char), 1, fp);
			ctemp = (unsigned char)m_serverlist.server[i].maxplayers;
			fwrite(&ctemp, sizeof(unsigned char), 1, fp);
		}

		for (i=0; i<m_serverlist.nummapped; i++)
		{
			s = m_serverlist.ips[i];
			fwrite(s, strlen(s)+1, 1, fp);
			s = m_serverlist.info[i];
			fwrite(s, strlen(s)+1, 1, fp);
		}
		
		pthread_mutex_unlock(&m_mut_serverlist); // tell other threads the serverlist is safe
		fclose(fp);
	}
}
开发者ID:jitspoe,项目名称:starviewer,代码行数:57,代码来源:cl_serverlist.c


示例17: CDAudio_GetAudioDiskInfo

static int CDAudio_GetAudioDiskInfo(void)
{
	int i;

	cdValid = false;

	maxTrack = 0;

	// CDDA track numbers are in range of 1..99
	for (i=1; i<100; i++)
	{
		FILE *f;
		char filename[MAX_PATH];
		sprintf(filename, "%s\\Track%03d.ogg", FS_Gamedir(), i);
		f = fopen(filename, "rb");
		if (!f)
		{
			sprintf(filename, "%s\\Track%02d.ogg", FS_Gamedir(), i);
			f = fopen(filename, "rb");
		}
		if (f)
		{
			maxTrack = i;
			remap[i] = i;
			fclose(f);
		}
		else
		{
			remap[i] = -1;
			// track 1 is allowed not to exist
			if (i > 1)
				break;
		}
	}

	if (maxTrack == 0)
	{
		Com_DPrintf("CDAudio: no music tracks\n");
		return -1;
	}

	cdValid = true;
	return 0;
}
开发者ID:Azarien,项目名称:SoftQuake2,代码行数:44,代码来源:cd_win.c


示例18: SV_ReadServerFile

/*
==============
SV_ReadServerFile

==============
*/
void SV_ReadServerFile (void)
{
	FILE	*f;
	char	name[MAX_OSPATH], string[128];
	char	comment[32];
	char	mapcmd[MAX_TOKEN_CHARS];

	Com_DPrintf("SV_ReadServerFile()\n");

	Com_sprintf (name, sizeof(name), "%s/save/current/server.ssv", FS_Gamedir());
	f = fopen (name, "rb");
	if (!f)
	{
		Com_Printf ("Couldn't read %s\n", name);
		return;
	}
	// read the comment field
	FS_Read (comment, sizeof(comment), f);

	// read the mapcmd
	FS_Read (mapcmd, sizeof(mapcmd), f);

	// read all CVAR_LATCH cvars
	// these will be things like coop, skill, deathmatch, etc
	while (1)
	{
		if (!fread (name, 1, sizeof(name), f))
			break;
		FS_Read (string, sizeof(string), f);
		Com_DPrintf ("Set %s = %s\n", name, string);
		Cvar_ForceSet (name, string);
	}

	fclose (f);

	// start a new game fresh with new cvars
	SV_InitGame ();

	strcpy (svs.mapcmd, mapcmd);

	// read game state
	Com_sprintf (name, sizeof(name), "%s/save/current/game.ssv", FS_Gamedir());
	ge->ReadGame (name);
}
开发者ID:AJenbo,项目名称:Quake-2,代码行数:50,代码来源:sv_ccmds.c


示例19: FS_OpenFile

filehandle_t* FS_OpenFile( const char *filename, char* mode  )
{
	char			netpath[ MAX_OSPATH ];
	filehandle_t	*hFile;
	const char		*pathBase;
	
	FILE*	fd;
	int		pos;
	int		end;
	
	memset(netpath,0,MAX_OSPATH);
	
	pathBase = FS_Gamedir();
		
	sprintf( netpath, "%s/%s", pathBase, filename );
	
	//printf("Absolute path: '%s'",netpath);
	
	// high performance file mapping path, avoiding stdio
	fd = fopen( netpath, mode );
	if ( !fd  ) {
		printf("Could not open file'%s'\n",netpath);
		return NULL;
	}
	
	
	hFile = (filehandle_t*) calloc(1, sizeof( filehandle_t ) );
	memset( hFile, 0, sizeof( filehandle_t ) );
	
	
	pos = ftell (fd);
	fseek (fd, 0, SEEK_END);
	end = ftell (fd);
	fseek (fd, pos, SEEK_SET);
	hFile->filesize = end;
	
	//if (!strcmp("data/scenes/techDemo.scene", filename))
	//{
	//	printf("techDemo.scene filesize = %d",hFile->filesize);
	//}
	
	hFile->filedata = calloc( hFile->filesize,sizeof(char) );
	
	fread(hFile->filedata, sizeof(char),hFile->filesize, fd);
	
	hFile->ptrStart =  hFile->ptrCurrent = (PW8)hFile->filedata;
	hFile->ptrEnd =  (PW8)hFile->filedata + hFile->filesize;
	hFile->bLoaded = 1;
	
	//printf("Closing file: '%s'\n",netpath);
	
	
	fclose( fd );
	return hFile;
}
开发者ID:fabiensanglard,项目名称:dEngine,代码行数:55,代码来源:filesystem.c


示例20: loadNativePNG

void loadNativePNG(texture_t* tmpTex)
{
	ILuint texid;
	ILenum error ;
	char fullpath[256];

	if (!devILinitialized)
	{
		ilInit(); 
		Log_Printf("[DevIL] Initialized.\n");
		devILinitialized = 1;
	}

	//Shmup ask texture loading via relative path, we need to append the game directory.
	fullpath[0] = '\0';
	strcat(fullpath,FS_Gamedir());
	strcat(fullpath,"/");
	strcat(fullpath,tmpTex->path);

	ilGenImages(1, &texid); // Generation of one image name 
	ilBindImage(texid); // Binding of image name 
	ilLoadImage((const wchar_t*)fullpath);

	tmpTex->bpp = ilGetInteger(IL_IMAGE_BPP);
	tmpTex->width = ilGetInteger(IL_IMAGE_WIDTH) ; 
	tmpTex->height =  ilGetInteger(IL_IMAGE_HEIGHT) ;
	tmpTex->numMipmaps = 1;

	tmpTex->data = (ubyte**)calloc(1,sizeof(ubyte*));
	tmpTex->data[0] = (ubyte*)calloc(tmpTex->width*tmpTex->height*tmpTex->bpp,sizeof(ubyte*));
	tmpTex->dataLength = 0;

	error = ilGetError();

	if (error != IL_NO_ERROR)
	{
		Log_Printf("Could not load texture: '%s'\n",tmpTex->path);
		return;
	}


	if (tmpTex->bpp == 4)
	{
		ilConvertImage(IL_RGBA, IL_UNSIGNED_BYTE);
		tmpTex->format = TEXTURE_GL_RGBA;
	}
	else
	{
		ilConvertImage(IL_RGB, IL_UNSIGNED_BYTE);
		tmpTex->format = TEXTURE_GL_RGB;
	}

	memcpy(tmpTex->data[0],(void*)ilGetData(), tmpTex->width*tmpTex->height * tmpTex->bpp);
}
开发者ID:Davidslv,项目名称:Shmup,代码行数:54,代码来源:native.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ FS_GetFileList函数代码示例发布时间:2022-05-30
下一篇:
C++ FS_FreeFile函数代码示例发布时间: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