本文整理汇总了C++中Cbuf_AddText函数的典型用法代码示例。如果您正苦于以下问题:C++ Cbuf_AddText函数的具体用法?C++ Cbuf_AddText怎么用?C++ Cbuf_AddText使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Cbuf_AddText函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Cbuf_ExecuteText
/*
-----------------------------------------------------------------------------
Function: Cbuf_ExecuteText -Execute string.
Parameters: exec_when -[in] see execwhen_t definition.
text -[in] string with command to execute.
Returns:
Notes:
-----------------------------------------------------------------------------
*/
PUBLIC void Cbuf_ExecuteText( execwhen_t exec_when, char *text )
{
switch( exec_when )
{
case EXEC_NOW:
Cmd_ExecuteString( text );
break;
case EXEC_INSERT:
Cbuf_InsertText( text );
break;
case EXEC_APPEND:
Cbuf_AddText( text );
break;
default:
Com_DPrintf( "Cbuf_ExecuteText: bad exec_when" );
}
}
示例2: Cbuf_AddEarlyCommands
/*
===============
Cbuf_AddEarlyCommands
Adds command line parameters as script statements
Commands lead with a +, and continue until another +
Set commands are added early, so they are guaranteed to be set before
the client and server initialize for the first time.
Other commands are added late, after all initialization is complete.
===============
*/
void Cbuf_AddEarlyCommands (qboolean clear)
{
int i;
char *s;
for (i=0 ; i<COM_Argc() ; i++)
{
s = COM_Argv(i);
if (strcmp (s, "+set"))
continue;
Cbuf_AddText (va("set %s %s\n", COM_Argv(i+1), COM_Argv(i+2)));
if (clear)
{
COM_ClearArgv(i);
COM_ClearArgv(i+1);
COM_ClearArgv(i+2);
}
i+=2;
}
}
示例3: Cbuf_ExecuteText
/*
============
Cbuf_ExecuteText
============
*/
void Cbuf_ExecuteText( int exec_when, const char *text ) {
switch ( exec_when )
{
case EXEC_NOW:
if ( text && strlen( text ) > 0 ) {
Cmd_ExecuteString( text );
} else {
Cbuf_Execute();
}
break;
case EXEC_INSERT:
Cbuf_InsertText( text );
break;
case EXEC_APPEND:
Cbuf_AddText( text );
break;
default:
Com_Error( ERR_FATAL, "Cbuf_ExecuteText: bad exec_when" );
}
}
示例4: TP_SoundTrigger
qboolean TP_SoundTrigger(char *message) //if there is a trigger there, play it. Return true if we found one, stripping off the file (it's neater that way).
{
char *strip;
char *lineend = NULL;
char soundname[128];
int filter = 0;
for (strip = message+strlen(message)-1; *strip && strip >= message; strip--)
{
if (*strip == '#')
filter++;
if (*strip == ':')
break; //if someone says just one word, we can take any tidles in their name to be a voice command
if (*strip == '\n')
lineend = strip;
else if (*strip <= ' ')
{
if (filter == 0 || filter == 1) //allow one space in front of a filter.
{
filter++;
continue;
}
break;
}
else if (*strip == '~')
{
//looks like a trigger, whoopie!
if (lineend-strip > sizeof(soundname)-1)
{
Con_Printf("Sound trigger's file-name was too long\n");
return false;
}
Q_strncpyz(soundname, strip+1, lineend-strip);
memmove(strip, lineend, strlen(lineend)+1);
Cbuf_AddText(va("play %s\n", soundname), RESTRICT_LOCAL);
return true;
}
}
return false;
}
示例5: main
int main(int argc, char **argv)
{
char cmdline[] = "+set sv_pure 0 +set vm_ui 0 +set vm_game 0 +set vm_cgame 0 +set fs_basepath ./app/native";
cvar_t *cv = NULL;
char cmd_rundemo[100];
Sys_SetDefaultCDPath("./app/native");
//saved_euid = geteuid();
// Clear the queues
memset( &eventQue[0], 0, MAX_QUED_EVENTS*sizeof(sysEvent_t) );
memset( &sys_packetReceived[0], 0, MAX_MSGLEN*sizeof(byte) );
// Initialize game
Com_Init(cmdline);
NET_Init();
// Start game with running demo
#if 0
cv = Cvar_Get("rundemo", "0", 0);
Cvar_Set("rundemo", "demo1.dm_68");
if (strcmp(cv->string, "0")) {
memset(cmd_rundemo, 0, sizeof(cmd_rundemo));
sprintf(cmd_rundemo, "demo %s", cv->string, sizeof(cmd_rundemo));
Cbuf_AddText(cmd_rundemo);
Com_Printf(" -- starting execution --- ");
Cbuf_Execute();
Com_Printf(" -- execution done --- ");
}
#endif
while (1) {
#if 0
Cvar_Set("nextdemo", "demo1.dm_68");
#endif
Com_Frame( );
}
}
示例6: GL_Init
/*
===============
GL_Init
===============
*/
static void GL_Init (void)
{
gl_vendor = (const char *) glGetString (GL_VENDOR);
gl_renderer = (const char *) glGetString (GL_RENDERER);
gl_version = (const char *) glGetString (GL_VERSION);
gl_extensions = (const char *) glGetString (GL_EXTENSIONS);
if (gl_extensions_nice != NULL)
Z_Free (gl_extensions_nice);
gl_extensions_nice = GL_MakeNiceExtensionsList (gl_extensions);
GL_CheckExtensions (); //johnfitz
//johnfitz -- intel video workarounds from Baker
if (!strcmp(gl_vendor, "Intel"))
{
Con_Printf ("Intel Display Adapter detected, enabling gl_clear\n");
Cbuf_AddText ("gl_clear 1");
}
//johnfitz
}
示例7: SV_RemoteCmdInit
void SV_RemoteCmdInit(){
sv_rconsys = Cvar_RegisterBool("sv_rconsys", qtrue, CVAR_ARCHIVE, "Disable/enable the internal remote-command-system");
if(!sv_rconsys->boolean) return;
//Init the permission table with default values
Cmd_ResetPower();
Cmd_SetPower("cmdlist", 1);
Cmd_SetPower("serverinfo", 1);
Cmd_SetPower("systeminfo", 1);
Cmd_SetPower("ministatus", 1);
Cmd_SetPower("status", 30);
Cmd_SetPower("dumpuser", 40);
Cmd_SetPower("kick", 35);
Cmd_SetPower("tempban", 50);
Cmd_SetPower("unban", 50);
Cmd_SetPower("permban", 80);
Cmd_SetPower("btempban", 80);
Cmd_SetPower("bpermban", 70);
Cmd_SetPower("map", 60);
Cmd_SetPower("map_restart", 50);
Cmd_SetPower("adminlist", 90);
Cmd_SetPower("cmdpowerlist", 90);
Cmd_SetPower("tell", 60);
Cmd_SetPower("say", 60);
Cmd_SetPower("screentell", 70);
Cmd_SetPower("screensay", 70);
Cmd_SetPower("dumpbanlist", 30);
Cmd_SetPower("setcmdminpower", 95);
Cmd_SetPower("setadmin", 95);
Cmd_SetPower("unsetadmin", 95);
Cbuf_AddText(0, "addCommand gametype \"set g_gametype $arg; map_restart\"");
Cmd_SetPower("gametype", 60);
cmdInvoker.currentCmdPower = 100; //Set the default to 100 to prevent any blocking on local system. If a command gets remotely executed it will be set temporarely to the expected power
//Now read the rest from file - Changed this will happen by executing nvconfig.cfg (nonvolatile config)
cmdSystemInitialized = qtrue;
}
示例8: IN_Frame
/*
===============
IN_Frame
===============
*/
void IN_Frame( void )
{
qboolean loading;
IN_JoyMove( );
IN_ProcessEvents( );
// If not DISCONNECTED (main menu) or ACTIVE (in game), we're loading
loading = ( clc.state != CA_DISCONNECTED && clc.state != CA_ACTIVE );
if( !cls.glconfig.isFullscreen && ( Key_GetCatcher( ) & KEYCATCH_CONSOLE ) )
{
// Console is down in windowed mode
IN_DeactivateMouse( );
}
else if( !cls.glconfig.isFullscreen && ( Key_GetCatcher( ) & KEYCATCH_CHATCONSOLE ) )
{
// Console is down in windowed mode
IN_DeactivateMouse( );
}
else if( !cls.glconfig.isFullscreen && loading )
{
// Loading in windowed mode
IN_DeactivateMouse( );
}
else if( !( SDL_GetWindowFlags( SDL_window ) & SDL_WINDOW_INPUT_FOCUS ) )
{
// Window not got focus
IN_DeactivateMouse( );
}
else
IN_ActivateMouse( );
// In case we had to delay actual restart of video system
if( ( vidRestartTime != 0 ) && ( vidRestartTime < Sys_Milliseconds( ) ) )
{
vidRestartTime = 0;
Cbuf_AddText( "vid_restart\n" );
}
}
示例9: FS_ExecAutoexec
/**
* \brief Execute autoexec script
*/
PUBLIC void FS_ExecAutoexec( void )
{
char *dir;
char name[ MAX_GAMEPATH ];
dir = Cvar_VariableString( "gamedir" );
if( *dir )
{
com_snprintf( name, sizeof( name ), "%s%c%s%cautoexec.cfg", fs_basedir->string, PATH_SEP, dir, PATH_SEP );
}
else
{
com_snprintf(name, sizeof(name), "%s%c%s%cautoexec.cfg", fs_basedir->string, PATH_SEP, BASE_DIRECTORY, PATH_SEP);
}
if( FS_FindFirst( name, 0, FA_DIR | FA_HIDDEN | FA_SYSTEM ) )
{
Cbuf_AddText( "exec autoexec.cfg\n" );
}
FS_FindClose();
}
示例10: IN_Frame
void IN_Frame(void)
{
qboolean loading;
qboolean fullscreen;
IN_JoyMove();
IN_ProcessEvents();
// If not DISCONNECTED (main menu) or ACTIVE (in game), we're loading
loading = !!(cls.state != CA_DISCONNECTED && cls.state != CA_ACTIVE);
fullscreen = Cvar_VariableIntegerValue("r_fullscreen");
if (!fullscreen && (Key_GetCatcher() & KEYCATCH_CONSOLE))
{
// Console is down in windowed mode
IN_DeactivateMouse();
}
else if (!fullscreen && loading)
{
// Loading in windowed mode
IN_DeactivateMouse();
}
else if (!(SDL_GetAppState() & SDL_APPINPUTFOCUS))
{
// Window not got focus
IN_DeactivateMouse();
}
else
{
IN_ActivateMouse();
}
/* in case we had to delay actual restart of video system... */
if ((vidRestartTime != 0) && (vidRestartTime < Sys_Milliseconds()))
{
vidRestartTime = 0;
Cbuf_AddText("vid_restart");
}
}
示例11: SCR_Init
/*
==================
SCR_Init
==================
*/
void SCR_Init( void )
{
if( scr_init ) return;
MsgDev( D_NOTE, "SCR_Init()\n" );
scr_centertime = Cvar_Get( "scr_centertime", "2.5", 0, "centerprint hold time" );
cl_levelshot_name = Cvar_Get( "cl_levelshot_name", "*black", 0, "contains path to current levelshot" );
cl_allow_levelshots = Cvar_Get( "allow_levelshots", "0", CVAR_ARCHIVE, "allow engine to use indivdual levelshots instead of 'loading' image" );
scr_loading = Cvar_Get( "scr_loading", "0", 0, "loading bar progress" );
scr_download = Cvar_Get( "scr_download", "0", 0, "downloading bar progress" );
cl_testlights = Cvar_Get( "cl_testlights", "0", 0, "test dynamic lights" );
cl_envshot_size = Cvar_Get( "cl_envshot_size", "256", CVAR_ARCHIVE, "envshot size of cube side" );
scr_dark = Cvar_Get( "v_dark", "0", 0, "starts level from dark screen" );
scr_viewsize = Cvar_Get( "viewsize", "120", CVAR_ARCHIVE, "screen size" );
// register our commands
Cmd_AddCommand( "timerefresh", SCR_TimeRefresh_f, "turn quickly and print rendering statistcs" );
Cmd_AddCommand( "skyname", CL_SetSky_f, "set new skybox by basename" );
Cmd_AddCommand( "viewpos", SCR_Viewpos_f, "prints current player origin" );
if( host.state != HOST_RESTART && !UI_LoadProgs( ))
{
Msg( "^1Error: ^7can't initialize MainUI.dll\n" ); // there is non fatal for us
if( !host.developer ) host.developer = 1; // we need console, because menu is missing
}
SCR_RegisterShaders ();
SCR_InitCinematic();
SCR_VidInit();
if( host.state != HOST_RESTART )
{
if( host.developer && Sys_CheckParm( "-toconsole" ))
Cbuf_AddText( "toggleconsole\n" );
else UI_SetActiveMenu( true );
}
scr_init = true;
}
示例12: GLimp_EndFrame
/*
** GLimp_EndFrame
**
** Responsible for doing a swapbuffers and possibly for other stuff
** as yet to be determined. Probably better not to make this a GLimp
** function and instead do a call to GLimp_SwapBuffers.
*/
void GLimp_EndFrame (void)
{
// don't flip if drawing to front buffer
if ( Q_stricmp( r_drawBuffer->string, "GL_FRONT" ) != 0 )
{
SDL_GL_SwapBuffers();
}
if( r_fullscreen->modified )
{
qboolean fullscreen;
qboolean sdlToggled = qfalse;
SDL_Surface *s = SDL_GetVideoSurface( );
if( s )
{
// Find out the current state
if( s->flags & SDL_FULLSCREEN )
fullscreen = qtrue;
else
fullscreen = qfalse;
// Is the state we want different from the current state?
if( !!r_fullscreen->integer != fullscreen )
sdlToggled = SDL_WM_ToggleFullScreen( s );
else
sdlToggled = qtrue;
}
// SDL_WM_ToggleFullScreen didn't work, so do it the slow way
if( !sdlToggled )
Cbuf_AddText( "vid_restart" );
r_fullscreen->modified = qfalse;
}
// check logging
QGL_EnableLogging( (qboolean)r_logFile->integer ); // bk001205 - was ->value
}
示例13: GFXPresetToggle
void GFXPresetToggle(qbool back) {
if (back) fps_mode--; else fps_mode++;
if (fps_mode < 0) fps_mode = mode_undef - 1;
if (fps_mode >= mode_undef) fps_mode = 0;
switch (GFXPreset()) {
#ifdef GLQUAKE
case mode_fastest: Cbuf_AddText ("exec cfg/gfx_gl_fast.cfg\n"); return;
case mode_higheyecandy: Cbuf_AddText ("exec cfg/gfx_gl_higheyecandy.cfg\n"); return;
case mode_faithful: Cbuf_AddText ("exec cfg/gfx_gl_faithful.cfg\n"); return;
case mode_eyecandy: Cbuf_AddText ("exec cfg/gfx_gl_eyecandy.cfg\n"); return;
#else
case mode_fastest: Cbuf_AddText ("exec cfg/gfx_sw_fast.cfg\n"); return;
case mode_default: Cbuf_AddText ("exec cfg/gfx_sw_default.cfg\n"); return;
#endif
}
}
示例14: qtvlist_joinfromqtv_cmd
void qtvlist_joinfromqtv_cmd(void)
{
/* FIXME: Make this prettier */
char addr[512];
char httpaddr[512];
char gameaddress[512];
char *currstream, *server;
currstream = CL_QTV_GetCurrentStream();
if (currstream == NULL) {
Com_Printf("Not connected to a QTV, can't join\n");
return;
}
strlcpy(&addr[0], currstream, sizeof(addr));
/* Bleh, transformation of [email protected]:port to http://server:port/watch.qtv?sid=id */
server = strchr(&addr[0], '@');
if (server == NULL) {
Com_Printf("error: wrong format on input\n");
return;
}
*server++ = 0;
snprintf(&httpaddr[0], sizeof(httpaddr), "http://%s/watch.qtv?sid=%s", server, &addr[0]);
if (SDL_TryLockMutex(qtvlist_mutex) != 0) {
Com_Printf("qtvlist is being updated, please try again soon\n");
return;
}
qtvlist_get_gameaddress((const char*)&httpaddr[0], &gameaddress[0], sizeof(gameaddress));
SDL_UnlockMutex(qtvlist_mutex);
if (gameaddress[0] != 0) {
Cbuf_AddText(va("connect %s\n", &gameaddress[0]));
} else {
Com_Printf("No game address found for this QTV stream\n");
}
}
示例15: FChecks_CheckFRulesetRequest
static qbool FChecks_CheckFRulesetRequest (const char *s)
{
// format of the reply:
// [nick: ]
// [padding] - so that "nick: " + padding is 17 chars long
// [ip address] - padded with spaces to 21 chars
// - this fits to 38 chars which is length of line with conwidth 320
// [space]
// [client version] - padded to 16 chars
// [ruleset name]
// [ruleset addition]
// - these 4 should be less than 38 chars so that reply does never take up more than 2 lines
char *fServer;
const char *features;
char *emptystring = "";
char *brief_version = "ezq" VERSION_NUMBER;
char *ruleset = Rulesets_Ruleset();
size_t name_len = strlen(cl.players[cl.playernum].name);
size_t pad_len = 15 - min(name_len, 15);
if (cl.spectator || (f_ruleset_reply_time && cls.realtime - f_ruleset_reply_time < 20))
return false;
if (Util_F_Match(s, "f_ruleset")) {
features = FChecks_RulesetAdditionString();
fServer = FChecks_FServerResponse_Text();
if (!fServer) {
fServer = "server-na";
}
Cbuf_AddText(va("say \"%*s%21s %16s %s%s\"\n",
pad_len, emptystring, fServer, brief_version, ruleset, features));
f_ruleset_reply_time = cls.realtime;
return true;
}
return false;
}