当前位置: 首页>>代码示例>>C++>>正文


C++ game_import_t::Printf方法代码示例

本文整理汇总了C++中game_import_t::Printf方法的典型用法代码示例。如果您正苦于以下问题:C++ game_import_t::Printf方法的具体用法?C++ game_import_t::Printf怎么用?C++ game_import_t::Printf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在game_import_t的用法示例。


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

示例1: ShutdownGame

/*
=================
ShutdownGame
=================
*/
void ShutdownGame( void ) {
	gi.Printf ("==== ShutdownGame ====\n");

	gi.Printf ("... ICARUS_Shutdown\n");
	ICARUS_Shutdown ();	//Shut ICARUS down

	gi.Printf ("... Reference Tags Cleared\n");
	TAG_Init();	//Clear the reference tags

	gi.Printf ("... Navigation Data Cleared\n");
	NAV_Shutdown();

	// write all the client session data so we can get it back
	G_WriteSessionData();

/*
Ghoul2 Insert Start
*/
	gi.Printf ("... Ghoul2 Models Shutdown\n");
	for (int i=0; i<MAX_GENTITIES; i++)
	{
		gi.G2API_CleanGhoul2Models(g_entities[i].ghoul2);
	}
/*
Ghoul2 Insert End
*/
}
开发者ID:5Quintessential,项目名称:jedioutcast,代码行数:32,代码来源:g_main.cpp

示例2: NAV_CheckCalcPaths

void NAV_CheckCalcPaths( void )
{	
	if ( navCalcPathTime && navCalcPathTime < level.time )
	{//first time we've ever loaded this map...
		//clear all the failed edges
		navigator.ClearAllFailedEdges();

		//Calculate all paths
		NAV_CalculatePaths( level.mapname, giMapChecksum );
		
		navigator.CalculatePaths();

#ifndef FINAL_BUILD
		if ( fatalErrors )
		{
			gi.Printf( S_COLOR_RED"Not saving .nav file due to fatal nav errors\n" );
		}
		else 
#endif
		if ( navigator.Save( level.mapname, giMapChecksum ) == qfalse )
		{
			gi.Printf("Unable to save navigations data for map \"%s\" (checksum:%d)\n", level.mapname, giMapChecksum );
		}
		navCalcPathTime = 0;
	}
}
开发者ID:5Quintessential,项目名称:jedioutcast,代码行数:26,代码来源:g_main.cpp

示例3: vmMain

extern "C" __declspec( dllexport ) int __cdecl vmMain ( int command, int arg1, int arg2 /*, ..., arg10); (?) no more than 2 seems to ever be used. */ )
{
	assert( g_realVmMain );
	int retVal = g_realVmMain( command, arg1, arg2 );
	if( command == 1 && g_inShutdown )
	{
		g_inShutdown = qfalse;

		g_realDllEntry = 0;
		g_realGetGameAPI = 0;
		g_realShutdown = 0;
		g_realVmMain = 0;

		if( g_modShutdown )
		{
			g_imports.Printf( "^5Calling mod_jagamex86.dll's Shutdown()\n" );
			g_modShutdown();
		}
		if( g_modJagamex86 )
		{
			g_imports.Printf( "^5Unloading mod_jagamex86.dll\n" );
			FreeLibrary( g_modJagamex86 );
		}

		g_imports.Printf( "^5Unloading original_jagamex86.dll\n" );

		g_exports = 0;
		assert( FreeLibrary( g_originalJagamex86 ) );
		g_originalJagamex86 = 0;
	}
	return retVal;
}
开发者ID:mrwonko,项目名称:jagamex86proxy,代码行数:32,代码来源:dllMain.cpp

示例4: FindProcAddress

template< typename FncPtr > bool FindProcAddress( char* procName, char* dllName, FncPtr& out_func )
{
	if( !( out_func = (FncPtr) GetProcAddress( g_modJagamex86, procName ) ) )
	{
		g_imports.Printf( "^5Warning: No %s in %s! Ignoring it.\n", procName, dllName );
		return false;
	}
	return true;
}
开发者ID:mrwonko,项目名称:jagamex86proxy,代码行数:9,代码来源:dllMain.cpp

示例5: Com_Printf

void Com_Printf( const char *msg, ... ) {
	va_list		argptr;
	char		text[1024];

	va_start (argptr, msg);
	vsprintf (text, msg, argptr);
	va_end (argptr);

	gi.Printf ("%s", text);
}
开发者ID:5Quintessential,项目名称:jedioutcast,代码行数:10,代码来源:g_main.cpp

示例6: G_FindTeams

/*
================
G_FindTeams

Chain together all entities with a matching team field.
Entity teams are used for item groups and multi-entity mover groups.

All but the first will have the FL_TEAMSLAVE flag set and teammaster field set
All but the last will have the teamchain field set to the next one
================
*/
void G_FindTeams( void ) {
	gentity_t	*e, *e2;
	int		i, j;
	int		c, c2;

	c = 0;
	c2 = 0;
//	for ( i=1, e=g_entities,i ; i < globals.num_entities ; i++,e++ )
	for ( i=1 ; i < globals.num_entities ; i++ )
	{
//		if (!e->inuse)
//			continue;
		if(!PInUse(i))
			continue;
		e=&g_entities[i];

		if (!e->team)
			continue;
		if (e->flags & FL_TEAMSLAVE)
			continue;
		e->teammaster = e;
		c++;
		c2++;
//		for (j=i+1, e2=e+1 ; j < globals.num_entities ; j++,e2++)
		for (j=i+1; j < globals.num_entities ; j++)
		{
//			if (!e2->inuse)
//				continue;
			if(!PInUse(j))
				continue;
			
			e2=&g_entities[j];
			if (!e2->team)
				continue;
			if (e2->flags & FL_TEAMSLAVE)
				continue;
			if (!strcmp(e->team, e2->team))
			{
				c2++;
				e2->teamchain = e->teamchain;
				e->teamchain = e2;
				e2->teammaster = e;
				e2->flags |= FL_TEAMSLAVE;

				// make sure that targets only point at the master
				if ( e2->targetname ) {
					e->targetname = e2->targetname;
					e2->targetname = NULL;
				}
			}
		}
	}

	gi.Printf ("%i teams with %i entities\n", c, c2);
}
开发者ID:5Quintessential,项目名称:jedioutcast,代码行数:66,代码来源:g_main.cpp

示例7: InitGame

void InitGame(  const char *mapname, const char *spawntarget, int checkSum, const char *entities, int levelTime, int randomSeed, int globalTime, SavedGameJustLoaded_e eSavedGameJustLoaded, qboolean qbLoadTransition )
{
	int		i;

	giMapChecksum = checkSum;
	g_eSavedGameJustLoaded = eSavedGameJustLoaded;
	g_qbLoadTransition = qbLoadTransition;

	gi.Printf ("------- Game Initialization -------\n");
	gi.Printf ("gamename: %s\n", GAMEVERSION);
	gi.Printf ("gamedate: %s\n", __DATE__);

	srand( randomSeed );

	G_InitCvars();

	G_InitMemory();

	// set some level globals
	memset( &level, 0, sizeof( level ) );
	level.time = levelTime;
	level.globalTime = globalTime;
	Q_strncpyz( level.mapname, mapname, sizeof(level.mapname) );
	if ( spawntarget != NULL && spawntarget[0] )
	{
		Q_strncpyz( level.spawntarget, spawntarget, sizeof(level.spawntarget) );
	}
	else
	{
		level.spawntarget[0] = 0;
	}


	G_InitWorldSession();

	// initialize all entities for this game
	memset( g_entities, 0, MAX_GENTITIES * sizeof(g_entities[0]) );
	globals.gentities = g_entities;
	ClearAllInUse();
	// initialize all clients for this game
	level.maxclients = 1;
	level.clients = (struct gclient_s *) G_Alloc( level.maxclients * sizeof(level.clients[0]) );

	// set client fields on player
	g_entities[0].client = level.clients;

	// always leave room for the max number of clients,
	// even if they aren't all used, so numbers inside that
	// range are NEVER anything but clients
	globals.num_entities = MAX_CLIENTS;

	//Set up NPC init data
	NPC_InitGame();
	
	TIMER_Clear();

	//
	//ICARUS INIT START

	gi.Printf("------ ICARUS Initialization ------\n");
	gi.Printf("ICARUS version : %1.2f\n", ICARUS_VERSION);

	Interface_Init( &interface_export );
	ICARUS_Init();

	gi.Printf ("-----------------------------------\n");

	//ICARUS INIT END
	//

	IT_LoadItemParms ();

	ClearRegisteredItems();

	//FIXME: if this is from a loadgame, it needs to be sure to write this out whenever you do a savegame since the edges and routes are dynamic...
	navCalculatePaths	= ( navigator.Load( mapname, checkSum ) == qfalse );

	// parse the key/value pairs and spawn gentities
	G_SpawnEntitiesFromString( entities );

	// general initialization
	G_FindTeams();

//	SaveRegisteredItems();

	gi.Printf ("-----------------------------------\n");

	//randomize the rand functions
	byte num_calls = (byte)timeGetTime();

	for(i = 0; i < (int)num_calls; i++)
	{
		rand();
	}

	if ( navCalculatePaths )
	{//not loaded - need to calc paths
		navCalcPathTime = level.time + START_TIME_NAV_CALC;//make sure all ents are in and linked
	}
	else
//.........这里部分代码省略.........
开发者ID:5Quintessential,项目名称:jedioutcast,代码行数:101,代码来源:g_main.cpp

示例8: G_RunFrame


//.........这里部分代码省略.........
		if ( i == 0 ) 
		{
			// decay batteries if the goggles are active
			if ( cg.zoomMode == 1 && ent->client->ps.batteryCharge > 0 )
			{
				ent->client->ps.batteryCharge--;
			}
			else if ( cg.zoomMode == 3 && ent->client->ps.batteryCharge > 0 )
			{
				ent->client->ps.batteryCharge -= 2;

				if ( ent->client->ps.batteryCharge < 0 )
				{
					ent->client->ps.batteryCharge = 0;
				}
			}

			G_CheckEndLevelTimers( ent );
			//Recalculate the nearest waypoint for the coming NPC updates
			NAV_FindPlayerWaypoint();

			if( ent->taskManager && !stop_icarus )
			{
				ent->taskManager->Update();
			}
			//dead
			if ( ent->health <= 0 )
			{
				if ( ent->client->ps.groundEntityNum != ENTITYNUM_NONE )
				{//on the ground
					pitch_roll_for_slope( ent, NULL );
				}
			}

			continue;	// players are ucmd driven
		}

		G_RunThink( ent );	// be aware that ent may be free after returning from here, at least one func frees them
		ClearNPCGlobals();			//	but these 2 funcs are ok
		//UpdateTeamCounters( ent );	//	   to call anyway on a freed ent.
	}

	// perform final fixups on the player
	ent = &g_entities[0];
	if ( ent->inuse ) 
	{
		ClientEndFrame( ent );
	}
	if( g_numEntities->integer )
	{
		gi.Printf( S_COLOR_WHITE"Number of Entities in use : %d\n", ents_inuse );
	}
	//DEBUG STUFF
	NAV_ShowDebugInfo();
	NPC_ShowDebugInfo();

	G_DynamicMusicUpdate();

#if	AI_TIMERS
	AITime -= navTime;
	if ( AITime > 20 )
	{
		gi.Printf( S_COLOR_RED"ERROR: total AI time: %d\n", AITime );
	}
	else if ( AITime > 10 )
	{
		gi.Printf( S_COLOR_YELLOW"WARNING: total AI time: %d\n", AITime );
	}
	else if ( AITime > 2 )
	{
		gi.Printf( S_COLOR_GREEN"total AI time: %d\n", AITime );
	}
	if ( navTime > 20 )
	{
		gi.Printf( S_COLOR_RED"ERROR: total nav time: %d\n", navTime );
	}
	else if ( navTime > 10 )
	{
		gi.Printf( S_COLOR_YELLOW"WARNING: total nav time: %d\n", navTime );
	}
	else if ( navTime > 2 )
	{
		gi.Printf( S_COLOR_GREEN"total nav time: %d\n", navTime );
	}
#endif//	AI_TIMERS

#ifndef FINAL_BUILD
	if ( delayedShutDown != 0 && delayedShutDown < level.time )
	{
		G_Error( "Game Errors. Scroll up the console to read them.\n" );
	}
#endif

#ifdef _DEBUG
	if(!(level.framenum&0xff))
	{
		ValidateInUseBits();
	}
#endif
}
开发者ID:5Quintessential,项目名称:jedioutcast,代码行数:101,代码来源:g_main.cpp

示例9: GetGameAPI

/**
	@brief First function called when the DLL is loaded: Server API?
**/
extern "C" __declspec( dllexport ) game_export_t* __cdecl GetGameAPI( game_import_t* imports )
{
	// static global variables are guaranteed to be 0, I heard. Let's assert that.
	assert( !g_exports );
	assert( !g_originalJagamex86 );
	assert( !g_modJagamex86 );
	assert( !g_inShutdown );
	assert( !g_realDllEntry );
	assert( !g_realGetGameAPI );
	assert( !g_originalJagamex86 );
	assert( !g_realShutdown );
	assert( !g_realVmMain );
	assert( !g_modShutdown );

	imports->Printf( "^5Loading original_jagamex86.dll\n" );
	g_inShutdown = qfalse;

	g_originalJagamex86 = LoadLibrary( "original_jagamex86.dll" );
	if( !g_originalJagamex86 )
	{
		// imports->Error would be a bad idea because that'd jmp out of the cleanup code for failed dll loading, causing "Sys_GetGameAPI without Sys_UnloadingGame"
		imports->Printf( "^1Error: Could not load original_jagamex86.dll!\n" );
		return 0;
	}

	// Get the original functions
	if( ! (g_realGetGameAPI = (GetGameAPI_t) GetProcAddress( g_originalJagamex86, "GetGameAPI" ) ) )
	{
		imports->Printf( "^1Error: No GetGameAPI in original_jagamex86.dll!\n" );
		return 0;
	}
	if( ! (g_realDllEntry = (dllEntry_t) GetProcAddress( g_originalJagamex86, "dllEntry" ) ) )
	{
		imports->Printf( "^1Error: No dllEntry in original_jagamex86.dll!\n" );
		return 0;
	}
	if( ! (g_realVmMain = (vmMain_t) GetProcAddress( g_originalJagamex86, "vmMain" ) ) )
	{
		imports->Printf( "^1Error: No vmMain in original_jagamex86.dll!\n" );
		return 0;
	}

	// save the imports for later usage
	g_imports = *imports;

	// Get the active mod
	char fs_game[ 256 + 1 ]; // variables can be up to 256 chars - not sure about trailing \0, so + 1
	g_imports.Cvar_VariableStringBuffer( "fs_game", fs_game, sizeof( fs_game ) / sizeof( char ) );
	if( *fs_game == '\0' )
	{
		fs_game[0] = 'b';
		fs_game[1] = 'a';
		fs_game[2] = 's';
		fs_game[3] = 'e';
		fs_game[4] = '\0';
	}
	g_imports.Printf( "fs_game = %s\n", fs_game );

	if( strcmp( fs_game, "base" ) )
	{
		char dllName[ MAX_QPATH + 19 ]; // "/mod_jagamex86.dll\0" is 19 chars.
		sprintf_s( dllName, 256 + 19, "%s/mod_jagamex86.dll", fs_game );
		g_modJagamex86 = LoadLibrary( dllName );
		if( g_modJagamex86 )
		{
			g_imports.Printf( "^5Found %s - looking for functions.\n", dllName );
			GetGameAPI_t modGetGameAPI;
			vmMain_t modVmMain;
			dllEntry_t modDllEntry;
			SetOriginalFunctions_t modSetOriginalFunctions;

			if( !FindProcAddress( "GetGameAPI", dllName, modGetGameAPI ) ||
				!FindProcAddress( "vmMain", dllName, modVmMain ) ||
				!FindProcAddress( "dllEntry", dllName, modDllEntry ) ||
				!FindProcAddress( "SetOriginalFunctions", dllName, modSetOriginalFunctions ) )
			{
				FreeLibrary( g_modJagamex86 );
				g_modJagamex86 = 0;
			}
			else
			{
				FindProcAddress( "Shutdown", dllName, g_modShutdown ); // optional - not bad if it fails.
				modSetOriginalFunctions( g_realGetGameAPI, g_realDllEntry, g_realVmMain );
				g_realGetGameAPI = modGetGameAPI;
				g_realDllEntry = modDllEntry;
				g_realVmMain = modVmMain;
			}
		}
		else
		{
			g_imports.Printf( "^5No %s available - forwarding to original_jagamex86.dll.\n", dllName );
		}
	}

	// call the "real" GetGameAPI
	g_exports = g_realGetGameAPI( &g_imports );
	if( !g_exports )
//.........这里部分代码省略.........
开发者ID:mrwonko,项目名称:jagamex86proxy,代码行数:101,代码来源:dllMain.cpp


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