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


C++ Cbuf_ExecuteText函数代码示例

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


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

示例1: SV_RunGameFrame

/*
static qboolean SV_RunGameFrame( int msec )
{
int extraTime = 0;
static unsigned int accTime = 0;

accTime += msec;

// move autonomous things around if enough time has passed
if( svs.gametime < sv.nextSnapTime )
{
if( svs.gametime + svc.snapFrameTime < sv.nextSnapTime )
{
if( sv_showclamp->integer )
Com_Printf( "sv lowclamp\n" );
sv.nextSnapTime = svs.gametime + svc.snapFrameTime;
return qfalse;
}

// see if it's time to advance the world
if( accTime >= WORLDFRAMETIME )
{
if( host_speeds->integer )
time_before_game = Sys_Milliseconds();

ge->RunFrame( WORLDFRAMETIME, svs.gametime );

if( host_speeds->integer )
time_after_game = Sys_Milliseconds();

accTime = accTime - WORLDFRAMETIME;
}

if( !SV_SendClientsFragments() )
{
// FIXME: gametime might slower/faster than real time
if( dedicated->integer )
{
socket_t *sockets[] = { &svs.socket_udp, NULL };
NET_Sleep( min( WORLDFRAMETIME - accTime, sv.nextSnapTime - svs.gametime ), sockets );
}
}

return qfalse;
}

if( sv.nextSnapTime <= svs.gametime )
{
extraTime = (int)( svs.gametime - sv.nextSnapTime );
}
if( extraTime >= msec )
extraTime = msec - 1;

sv.nextSnapTime = ( svs.gametime + svc.snapFrameTime ) - extraTime;

// Execute all clients pending move commands
if( accTime )
{
ge->RunFrame( accTime, svs.gametime );
accTime = 0;
}

// update ping based on the last known frame from all clients
SV_CalcPings();

sv.framenum++;
ge->SnapFrame();

return qtrue;
}
*/
static void SV_CheckDefaultMap( void )
{
	if( svc.autostarted )
		return;

	svc.autostarted = qtrue;
	if( dedicated->integer )
	{
		if( sv.state == ss_dead && !strlen( sv.mapname ) )
        {
            int filehandle;
            if( sv_write_defaultmap && sv_write_defaultmap->integer && FS_FOpenFile( "defaultmap", &filehandle, FS_READ ) != -1 )
            {
                static char buffer[MAX_QPATH];
                buffer[0] = '\0';
                FS_Read( buffer, MAX_QPATH - 1, filehandle );
                FS_FCloseFile( filehandle );
                if( buffer[0] )
                {
                    Cbuf_ExecuteText( EXEC_APPEND, va( "map %s\n", buffer ) );
                    return;
                }
            }
            if( sv_defaultmap && strlen( sv_defaultmap->string ) )
                Cbuf_ExecuteText( EXEC_APPEND, va( "map %s\n", sv_defaultmap->string ) );
        }
	}
}
开发者ID:hettoo,项目名称:racesow,代码行数:99,代码来源:sv_main.c

示例2: 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

示例3: Sys_StartProcess

/*
==================
Sys_StartProcess
if !doexit, start the process asap
otherwise, push it for execution at exit
(i.e. let complete shutdown of the game and freeing of resources happen)
NOTE: might even want to add a small delay?
==================
*/
void Sys_StartProcess( char *cmdline, qboolean doexit ) {

	if ( doexit ) {
		Com_DPrintf( "Sys_StartProcess %s (delaying to final exit)\n", cmdline );
		Q_strncpyz( exit_cmdline, cmdline, MAX_CMD );
		Cbuf_ExecuteText( EXEC_APPEND, "quit" );
	}

	Cbuf_ExecuteText( EXEC_NOW, "net_stop" );
	Com_DPrintf( "Sys_StartProcess %s\n", cmdline );
	Sys_DoStartProcess( cmdline );
}
开发者ID:zturtleman,项目名称:iortcw,代码行数:21,代码来源:sys_unix.c

示例4: SetTag

static void SetTag(void) {
    // Add minqlx tag.
    char tags[1024]; // Surely 1024 is enough?
    cvar_t* sv_tags = Cvar_FindVar("sv_tags");
    if (strlen(sv_tags->string) > 2) { // Does it already have tags?
        snprintf(tags, sizeof(tags), "sv_tags \"" SV_TAGS_PREFIX ",%s\"", sv_tags->string);
        Cbuf_ExecuteText(EXEC_APPEND, tags);
    }
    else {
        Cbuf_ExecuteText(EXEC_APPEND, "sv_tags \"" SV_TAGS_PREFIX "\"");
    }
}
开发者ID:PerpetualWar,项目名称:minqlx,代码行数:12,代码来源:hooks.c

示例5: Cheat_AllForce

bool Cheat_AllForce( void )
{
	// Do not do this while the force config UI is running. That causes SERIOUS problems:
	extern bool UI_ForceConfigUIActive( void );
	if( UI_ForceConfigUIActive() )
		return false;

	// Set all Light powers to level 3:
	Cbuf_ExecuteText( EXEC_APPEND, "setForceHeal 3\nsetMindTrick 3\nsetForceProtect 3\nsetForceAbsorb 3\n" );
	// Set all Dark powers to level 3:
	Cbuf_ExecuteText( EXEC_APPEND, "setForceGrip 3\nsetForceLightning 3\nsetForceRage 3\nsetForceDrain 3\n" );

	return true;
}
开发者ID:3ddy,项目名称:Jedi-Academy,代码行数:14,代码来源:win_input_console.cpp

示例6: Com_ExecuteCfg

void Com_ExecuteCfg(void)
{
	Cbuf_ExecuteText(EXEC_NOW, "exec default.cfg\n");
	Cbuf_Execute(); // Always execute after exec to prevent text buffer overflowing

	if(!Com_SafeMode())
	{
		// skip the q3config.cfg and autoexec.cfg if "safe" is on the command line
		Cbuf_ExecuteText(EXEC_NOW, "exec " Q3CONFIG_NAME "\n");
		Cbuf_Execute();
		Cbuf_ExecuteText(EXEC_NOW, "exec autoexec_sp.cfg\n");
		Cbuf_Execute();
	}
}
开发者ID:Aura15,项目名称:OpenJK,代码行数:14,代码来源:common.cpp

示例7: ExitLevel

/*
=============
ExitLevel

When the intermission has been exited, the server is either killed
or moved to a New level based on the "nextmap" cvar 

=============
*/
void ExitLevel() 
{
	//bot interbreeding
//	BotInterbreedEndMatch();

	// if we are running a tournement map, kick the loser to spectator status,
	// which will automatically grab the next spectator and restart
	if ( g_gametype.integer == GT_TOURNAMENT  ) 
	{
		if ( !theLevel.restarted_ ) 
		{
			RemoveTournamentLoser();
			Cbuf_ExecuteText( EXEC_APPEND, "map_restart 0\n" );
			theLevel.restarted_ = true;
			theLevel.changemap_ = 0;
			theLevel.intermissiontime_ = 0;
		}
		return;	
	}

	Cbuf_ExecuteText( EXEC_APPEND, "vstr nextmap\n" );
	theLevel.changemap_ = 0;
	theLevel.intermissiontime_ = 0;

	// reset all the scores so we don't enter the intermission again
	theLevel.teamScores_[ClientBase::TEAM_RED] = 0;
	theLevel.teamScores_[ClientBase::TEAM_BLUE] = 0;
	for( int i=1 ; i<= g_maxclients.integer ; i++ )
	{
		GameClient *cl = theLevel.getClient(i);
		if ( !cl || cl->pers_.connected_ != GameClient::ClientPersistant::CON_CONNECTED ) 
			continue;
		cl->ps_.persistant[PERS_SCORE] = 0;
	}

	// we need to do this here before chaning to CON_CONNECTING
	G_WriteSessionData();

	// change all client states to connecting, so the early players into the
	// next level will know the others aren't done reconnecting
	for( int i=1 ; i<= g_maxclients.integer ; i++ ) 
	{
		GameClient *cl = theLevel.getClient(i);
		if( cl->pers_.connected_ == GameClient::ClientPersistant::CON_CONNECTED ) 
			cl->pers_.connected_ = GameClient::ClientPersistant::CON_CONNECTING;
	}

}
开发者ID:osfpsproject,项目名称:MF2,代码行数:57,代码来源:g_main.c

示例8: Sys_StartProcess

/*
==================
Sys_StartProcess

NERVE - SMF
==================
*/
void Sys_StartProcess(char *exeName, qboolean doexit)
{
	TCHAR               szPathOrig[_MAX_PATH];
	STARTUPINFO         si;
	PROCESS_INFORMATION pi;

	ZeroMemory(&si, sizeof(si));
	si.cb = sizeof(si);

	GetCurrentDirectory(_MAX_PATH, szPathOrig);

	// JPW NERVE swiped from Sherman's SP code
	if (!CreateProcess(NULL, va("%s\\%s", szPathOrig, exeName), NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))
	{
		// couldn't start it, popup error box
		Com_Error(ERR_DROP, "Could not start process: '%s\\%s'", szPathOrig, exeName);
		return;
	}

	// similar way of exiting as used in Sys_OpenURL below
	if (doexit)
	{
		Cbuf_ExecuteText(EXEC_APPEND, "quit\n");
	}
}
开发者ID:scenna,项目名称:etlegacy,代码行数:32,代码来源:sys_win32.c

示例9: GetBindingUp

void HotSwapManager::ExecuteUp(void)
{
	const char *binding = GetBindingUp();
	if(binding) {
		Cbuf_ExecuteText(EXEC_NOW, binding);
	}
}
开发者ID:3ddy,项目名称:Jedi-Academy,代码行数:7,代码来源:cl_input_hotswap.cpp

示例10: SpecifyServer_Event

/*
=================
SpecifyServer_Event
=================
*/
static void SpecifyServer_Event( void* ptr, int event )
{
    char	buff[256];

    switch (((menucommon_s*)ptr)->id)
    {
    case ID_SPECIFYSERVERGO:
        if (event != QM_ACTIVATED)
            break;

        if (s_specifyserver.domain.field.buffer[0])
        {
            strcpy(buff,s_specifyserver.domain.field.buffer);
            if (s_specifyserver.port.field.buffer[0])
                Com_sprintf( buff+strlen(buff), 128, ":%s", s_specifyserver.port.field.buffer );

            Cbuf_ExecuteText( EXEC_APPEND, va( "connect %s\n", buff ) );
        }
        break;

    case ID_SPECIFYSERVERBACK:
        if (event != QM_ACTIVATED)
            break;

        UI_PopMenu();
        break;
    }
}
开发者ID:zturtleman,项目名称:recoil,代码行数:33,代码来源:ui_specifyserver.c

示例11: Cdelay_Frame

void Cdelay_Frame( void ) {
	int i;
	bool run_it;
	
	for(i=0; (i<MAX_DELAYED_COMMANDS); i++)
	{
		run_it = false;
		
		if(delayed_cmd[i].delay == CMD_DELAY_UNUSED)
			continue;
		
		//check if we should run the command (both type)
		if(delayed_cmd[i].type == CMD_DELAY_MSEC && delayed_cmd[i].delay < Sys_Milliseconds())
		{			
			run_it = true;
		} else if(delayed_cmd[i].type == CMD_DELAY_FRAME)
		{
			delayed_cmd[i].delay -= 1;
			if(delayed_cmd[i].delay == CMD_DELAY_FRAME_FIRE)
				run_it = true;
		}
		
		if(run_it)
		{
			delayed_cmd[i].delay = CMD_DELAY_UNUSED;
			Cbuf_ExecuteText(EXEC_NOW, delayed_cmd[i].text);
		}
	}
}
开发者ID:TheDushan,项目名称:OpenWolf,代码行数:29,代码来源:cmd.cpp

示例12: ShellExecute

/*
==============
Sys_ShellExecute

-	Windows only

	Performs an operation on a specified file. 

	See info on ShellExecute() for details
  
==============
*/
int Sys_ShellExecute(char *op, char *file, qboolean doexit, char *params, char *dir ) {
	unsigned int retval;
	char *se_op;
	
	// set default operation to "open"
	if(op)	se_op = op;
	else	se_op = "open";


	// probably need to protect this some in the future so people have
	// less chance of system invasion with this powerful interface
	// (okay, not so invasive, but could be annoying/rude)


	retval = (UINT)ShellExecute(NULL, se_op, file, params, dir, SW_NORMAL);	// only option forced by game is 'sw_normal'
	
	if( retval <= 32) {	// ERROR
		Com_DPrintf("Sys_ShellExecuteERROR: %d\n", retval);
		return retval;
	}

	if ( doexit ) {
		// (SA) this works better for exiting cleanly...
		Cbuf_ExecuteText( EXEC_APPEND, "quit" );
	}

	return 999;	// success
}
开发者ID:BishopExile,项目名称:OpenJK,代码行数:40,代码来源:win_main_common.cpp

示例13: UI_SPPostgameMenu_MenuKey

/*
=================
UI_SPPostgameMenu_MenuKey
=================
*/
static sfxHandle_t UI_SPPostgameMenu_MenuKey( int key )
{
    if ( uis.realtime < postgameMenuInfo.ignoreKeysTime )
    {
        return 0;
    }

    if( postgameMenuInfo.phase == 1 )
    {
        Cbuf_ExecuteText( EXEC_APPEND, "abort_podium\n" );
        postgameMenuInfo.phase = 2;
        postgameMenuInfo.starttime = uis.realtime;
        postgameMenuInfo.ignoreKeysTime	= uis.realtime + 250;
        return 0;
    }

    if( postgameMenuInfo.phase == 2 )
    {
        postgameMenuInfo.phase = 3;
        postgameMenuInfo.starttime = uis.realtime;
        postgameMenuInfo.ignoreKeysTime	= uis.realtime + 250;
        return 0;
    }

    if( key == K_ESCAPE || key == K_MOUSE2 )
    {
        return 0;
    }

    return Menu_DefaultKey( &postgameMenuInfo.menu, key );
}
开发者ID:zturtleman,项目名称:recoil,代码行数:36,代码来源:ui_sppostgame.c

示例14: UI_CreateGame_Begin

/*
=================
UI_CreateGame_Begin
=================
*/
static void UI_CreateGame_Begin( void )
{
	if( Host_ServerState())
		Cbuf_ExecuteText( EXEC_NOW, "killserver\n" );

	Cvar_SetValue( "deathmatch", 1.0f );	// FIXME
	Cvar_SetValue( "sv_maxclients", com.atoi( uiCreateGame.maxClients.buffer ));
	Cvar_Set( "sv_hostname", uiCreateGame.hostName.buffer );
	Cvar_Set( "defaultmap", uiCreateGame.mapName[uiCreateGame.mapsList.curItem] );
	Host_WriteServerConfig ();

	// all done, start server
	if( uiCreateGame.dedicatedServer.enabled )
		Sys_NewInstance( va("#%s", GI->gamefolder ), "Starting dedicated server...\n" );
	else Cbuf_ExecuteText( EXEC_APPEND, "exec server.rc\n" );
}
开发者ID:a1batross,项目名称:Xash3D_ancient,代码行数:21,代码来源:ui_creategame.c

示例15: BotInterbreeding

/*
==============
BotInterbreeding
==============
*/
void BotInterbreeding(void)
{
    int i;

    if (!strlen(bot_interbreedchar->string)) return;
    //make sure we are in tournament mode
    if (gametype != GT_TOURNAMENT)
    {
        Cvar_Set("g_gametype", va("%d", GT_TOURNAMENT));
        ExitLevel();
        return;
    }
    //shutdown all the bots
    for (i = 0; i < MAX_CLIENTS; i++)
    {
        if (botstates[i] && botstates[i]->inuse)
        {
            BotAIShutdownClient(botstates[i]->client, qfalse);
        }
    }
    //make sure all item weight configs are reloaded and Not shared
    botlib_export->BotLibVarSet("bot_reloadcharacters", "1");
    //add a number of bots using the desired bot character
    for (i = 0; i < bot_interbreedbots->integer; i++)
    {
        Cbuf_ExecuteText(EXEC_APPEND, va("addbot %s 4 free %i %s%d\n",
                                         bot_interbreedchar->string, i * 50, bot_interbreedchar->string, i) );
    }
    //
    Cvar_Set("bot_interbreedchar", "");
    bot_interbreed = qtrue;
}
开发者ID:zturtleman,项目名称:recoil,代码行数:37,代码来源:ai_main.c


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