这篇教程C++ trap_Cmd_ExecuteText函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中trap_Cmd_ExecuteText函数的典型用法代码示例。如果您正苦于以下问题:C++ trap_Cmd_ExecuteText函数的具体用法?C++ trap_Cmd_ExecuteText怎么用?C++ trap_Cmd_ExecuteText使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了trap_Cmd_ExecuteText函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: CG_SC_MenuCustom/** CG_SC_MenuCustom*/static void CG_SC_MenuCustom( void ){ char request[MAX_STRING_CHARS]; int i, c; if( cgs.demoPlaying || cgs.tv ) return; if( trap_Cmd_Argc() < 2 ) return; Q_strncpyz( request, va( "menu_open custom title /"%s/" ", trap_Cmd_Argv( 1 ) ), sizeof( request ) ); for( i = 2, c = 1; i < trap_Cmd_Argc() - 1; i += 2, c++ ) { Q_strncatz( request, va( "btn%i /"%s/" ", c, trap_Cmd_Argv( i ) ), sizeof( request ) ); Q_strncatz( request, va( "cmd%i /"%s/" ", c, trap_Cmd_Argv( i + 1 ) ), sizeof( request ) ); } trap_Cmd_ExecuteText( EXEC_APPEND, va( "%s/n", request ) );}
开发者ID:hettoo,项目名称:racesow,代码行数:24,
示例2: Main_MenuEvent/*=================Main_MenuEvent=================*/void Main_MenuEvent (void* ptr, int event) { if( event != QM_ACTIVATED ) { return; } switch( ((menucommon_s*)ptr)->id ) { case ID_SINGLEPLAYER: UI_SPLevelMenu(); break; case ID_MULTIPLAYER: UI_ArenaServersMenu(); break; case ID_SETUP: UI_SetupMenu(); break; case ID_DEMOS: UI_DemosMenu(); break; case ID_CINEMATICS: UI_CinematicsMenu(); break; case ID_MODS: UI_ModsMenu(); break; case ID_TEAMARENA: trap_Cvar_Set( "fs_game", "missionpack"); trap_Cmd_ExecuteText( EXEC_APPEND, "vid_restart;" ); break; case ID_EXIT: UI_ConfirmMenu( "EXIT GAME?", 0, MainMenu_ExitAction ); break; }}
开发者ID:bludshot,项目名称:alturt,代码行数:45,
示例3: CG_UseItem/** CG_UseItem*/void CG_UseItem( const char *name ){ gsitem_t *item; if( !cg.frame.valid || cgs.demoPlaying ) return; if( !name ) return; item = GS_Cmd_UseItem( &cg.frame.playerState, name, 0 ); if( item ) { if( item->type & IT_WEAPON ) { CG_Predict_ChangeWeapon( item->tag ); cg.lastWeapon = cg.predictedPlayerState.stats[STAT_PENDING_WEAPON]; } trap_Cmd_ExecuteText( EXEC_NOW, va( "cmd use %i", item->tag ) ); }}
开发者ID:hettoo,项目名称:racesow,代码行数:25,
示例4: UI_TeamOrdersMenu_ListEvent/*===============UI_TeamOrdersMenu_ListEvent===============*/static void UI_TeamOrdersMenu_ListEvent(void *ptr, int event){ int id; int selection; char message[256]; if (event != QM_ACTIVATED) return; id = ((menulist_s *)ptr)->generic.id; selection = ((menulist_s *)ptr)->curvalue; if (id == ID_LIST_BOTS) { teamOrdersMenuInfo.selectedBot = selection; if (teamOrdersMenuInfo.gametype == GT_CTF || teamOrdersMenuInfo.gametype == GT_INVASION) { UI_TeamOrdersMenu_SetList(ID_LIST_CTF_ORDERS); } else { UI_TeamOrdersMenu_SetList(ID_LIST_TEAM_ORDERS); } return; } if (id == ID_LIST_CTF_ORDERS) { Com_sprintf(message, sizeof(message), ctfMessages[selection], teamOrdersMenuInfo.botNames[teamOrdersMenuInfo.selectedBot]); } else { Com_sprintf(message, sizeof(message), teamMessages[selection], teamOrdersMenuInfo.botNames[teamOrdersMenuInfo.selectedBot]); } trap_Cmd_ExecuteText(EXEC_APPEND, va("say_team /"%s/"/n", message)); UI_PopMenu();}
开发者ID:ElderPlayerX,项目名称:Invasion,代码行数:43,
示例5: SpecifyPassword_Event/*=================SpecifyPassword_Event=================*/static void SpecifyPassword_Event( void* ptr, int event ) { switch (((menucommon_s*)ptr)->id) { case ID_SPECIFYPASSWORDGO: if (event != QM_ACTIVATED) break; if (s_specifypassword.password.field.buffer[0]) { trap_Cvar_Set("password",s_specifypassword.password.field.buffer); trap_Cmd_ExecuteText( EXEC_APPEND, s_specifypassword.connectstring ); } break; case ID_SPECIFYPASSWORDBACK: if (event != QM_ACTIVATED) break; UI_PopMenu(); break; }}
开发者ID:OpenArena,项目名称:legacy,代码行数:28,
示例6: SoundQualityActionstatic void SoundQualityAction( qboolean result ) { if ( result ) { soundOptionsInfo.holdSoundQuality = soundOptionsInfo.quality.curvalue; if( soundOptionsInfo.quality.curvalue ) { trap_Cvar_SetValue( "s_khz", 22 );// trap_Cvar_SetValue( "s_compression", 0 ); } else { trap_Cvar_SetValue( "s_khz", 11 );// trap_Cvar_SetValue( "s_compression", 1 ); } //UI_ForceMenuOff(); trap_Cmd_ExecuteText( EXEC_APPEND, "snd_restart/n" ); } else { soundOptionsInfo.quality.curvalue = soundOptionsInfo.holdSoundQuality; }}
开发者ID:gitter-badger,项目名称:rpgxEF,代码行数:23,
示例7: Controls_SetConfig/*=================Controls_SetConfig=================*/static void Controls_SetConfig(void){ int i; bind_t* bindptr; // set the bindings from the local store bindptr = g_bindings; // iterate each command, get its numeric binding for (i=0;;i++,bindptr++) { if (!bindptr->label) break; if (bindptr->bind1 != -1) { trap_Key_SetBinding(bindptr->bind1, bindptr->command); if (bindptr->bind2 != -1) trap_Key_SetBinding(bindptr->bind2, bindptr->command); } } if (s_controls.invertmouse.curvalue) trap_Cvar_SetValue("m_pitch", -fabs(trap_Cvar_VariableValue("m_pitch"))); else trap_Cvar_SetValue("m_pitch", fabs(trap_Cvar_VariableValue("m_pitch"))); trap_Cvar_SetValue("m_filter", s_controls.smoothmouse.curvalue); trap_Cvar_SetValue("cl_run", s_controls.alwaysrun.curvalue); trap_Cvar_SetValue("cg_autoswitch", s_controls.autoswitch.curvalue); trap_Cvar_SetValue("sensitivity", s_controls.sensitivity.curvalue); trap_Cvar_SetValue("in_joystick", s_controls.joyenable.curvalue); trap_Cvar_SetValue("joy_threshold", s_controls.joythreshold.curvalue); trap_Cvar_SetValue("cl_freelook", s_controls.freelook.curvalue); trap_Cmd_ExecuteText(EXEC_APPEND, "in_restart/n");}
开发者ID:ElderPlayerX,项目名称:Invasion,代码行数:42,
示例8: LoadConfig_MenuEvent/*===============LoadConfig_MenuEvent===============*/static void LoadConfig_MenuEvent( void *ptr, int event ) { if( event != QM_ACTIVATED ) { return; } switch ( ((menucommon_s*)ptr)->id ) { case ID_GO: trap_Cmd_ExecuteText( EXEC_APPEND, va( "exec %s/n", s_configs.list.itemnames[s_configs.list.curvalue] ) ); UI_PopMenu(); break; case ID_BACK: UI_PopMenu(); break; case ID_LEFT: ScrollList_Key( &s_configs.list, K_LEFTARROW ); break; case ID_RIGHT: ScrollList_Key( &s_configs.list, K_RIGHTARROW ); break; }}
开发者ID:KuehnhammerTobias,项目名称:ioid3-game,代码行数:29,
示例9: G_Match_Autorecord_Start/** G_Match_Autorecord_Start*/void G_Match_Autorecord_Start( void ){ int team, i, playerCount; G_Match_SetAutorecordState( "start" ); // do not start autorecording if all playing clients are bots for( playerCount = 0, team = TEAM_PLAYERS; team < GS_MAX_TEAMS; team++ ) { // add our team info to the string for( i = 0; i < teamlist[team].numplayers; i++ ) { if( game.edicts[ teamlist[team].playerIndices[i] ].r.svflags & SVF_FAKECLIENT ) continue; playerCount++; break; // we only need one for this check } } if( playerCount && g_autorecord->integer ) { char datetime[17], players[MAX_STRING_CHARS]; time_t long_time; struct tm *newtime; // date & time time( &long_time ); newtime = localtime( &long_time ); Q_snprintfz( datetime, sizeof( datetime ), "%04d-%02d-%02d_%02d-%02d", newtime->tm_year + 1900, newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min ); // list of players Q_strncpyz( players, trap_GetConfigString( CS_MATCHNAME ), sizeof( players ) ); if( players[0] == '/0' ) { if( GS_InvidualGameType() ) { const char *netname; int team; edict_t *ent; for( team = TEAM_ALPHA; team < GS_MAX_TEAMS; team++ ) { if( !teamlist[team].numplayers ) continue; ent = game.edicts + teamlist[team].playerIndices[0]; netname = ent->r.client->netname; Q_strncatz( players, netname, sizeof( players ) ); if( team != GS_MAX_TEAMS - 1 ) Q_strncatz( players, " vs ", sizeof( players ) ); } } } if( players[0] != '/0' ) { char *t = strstr( players, " vs " ); if( t ) memcpy( t, "_vs_", strlen( "_vs_" ) ); Q_strncpyz( players, COM_RemoveJunkChars( COM_RemoveColorTokens( players ) ), sizeof( players ) ); } // combine Q_snprintfz( level.autorecord_name, sizeof( level.autorecord_name ), "%s_%s_%s%s%s_auto%04i", datetime, gs.gametypeName, level.mapname, players[0] == '/0' ? "" : "_", players, (int)brandom( 1, 9999 ) ); trap_Cmd_ExecuteText( EXEC_APPEND, va( "serverrecord %s/n", level.autorecord_name ) ); }}
开发者ID:MaryJaneInChain,项目名称:qfusion,代码行数:74,
示例10: GraphicsOptions_ApplyChanges/*=================GraphicsOptions_ApplyChanges=================*/static void GraphicsOptions_ApplyChanges(void *unused, int notification){ if (notification != QM_ACTIVATED) return; switch (s_graphicsoptions.texturebits.curvalue) { case 0: trap_Cvar_SetValue("r_texturebits", 0); break; case 1: trap_Cvar_SetValue("r_texturebits", 16); break; case 2: trap_Cvar_SetValue("r_texturebits", 32); break; } trap_Cvar_SetValue("r_picmip", 3 - s_graphicsoptions.tq.curvalue); trap_Cvar_SetValue("r_allowExtensions", s_graphicsoptions.allow_extensions.curvalue); trap_Cvar_SetValue("r_mode", s_graphicsoptions.mode.curvalue); trap_Cvar_SetValue("r_fullscreen", s_graphicsoptions.fs.curvalue); trap_Cvar_Set("r_glDriver", (char *) s_drivers[s_graphicsoptions.driver.curvalue]); switch (s_graphicsoptions.colordepth.curvalue) { case 0: trap_Cvar_SetValue("r_colorbits", 0); trap_Cvar_SetValue("r_depthbits", 0); trap_Cvar_SetValue("r_stencilbits", 0); break; case 1: trap_Cvar_SetValue("r_colorbits", 16); trap_Cvar_SetValue("r_depthbits", 16); trap_Cvar_SetValue("r_stencilbits", 0); break; case 2: trap_Cvar_SetValue("r_colorbits", 32); trap_Cvar_SetValue("r_depthbits", 24); break; } trap_Cvar_SetValue("r_vertexLight", s_graphicsoptions.lighting.curvalue); if (s_graphicsoptions.geometry.curvalue == 2) { trap_Cvar_SetValue("r_lodBias", 0); trap_Cvar_SetValue("r_subdivisions", 4); } else if (s_graphicsoptions.geometry.curvalue == 1) { trap_Cvar_SetValue("r_lodBias", 1); trap_Cvar_SetValue("r_subdivisions", 12); } else { trap_Cvar_SetValue("r_lodBias", 1); trap_Cvar_SetValue("r_subdivisions", 20); } if (s_graphicsoptions.filter.curvalue) { trap_Cvar_Set("r_textureMode", "GL_LINEAR_MIPMAP_LINEAR"); } else { trap_Cvar_Set("r_textureMode", "GL_LINEAR_MIPMAP_NEAREST"); } trap_Cmd_ExecuteText(EXEC_APPEND, "vid_restart/n");}
开发者ID:ElderPlayerX,项目名称:Invasion,代码行数:73,
示例11: ModsMenuFuncstatic void ModsMenuFunc( menucommon_t *unused ){ trap_Cmd_ExecuteText( EXEC_APPEND, "menu_mods/n" );}
开发者ID:Racenet,项目名称:racesow,代码行数:4,
示例12: SetUpMenuFuncstatic void SetUpMenuFunc( menucommon_t *unused ){ trap_Cmd_ExecuteText( EXEC_APPEND, "menu_setup/n" );}
开发者ID:Racenet,项目名称:racesow,代码行数:4,
示例13: Console_Key/*====================Console_KeyHandles history and console scrollback====================*/void Console_Key ( int key, qboolean down ) { if ( !down ) { return; } if ( key & K_CHAR_FLAG ) { key &= ~K_CHAR_FLAG; MField_CharEvent( &g_consoleField, key ); return; } // ctrl-L clears screen if ( key == 'l' && trap_Key_IsDown( K_CTRL ) ) { trap_Cmd_ExecuteText( EXEC_APPEND, "clear/n" ); return; } // enter finishes the line if ( key == K_ENTER || key == K_KP_ENTER ) { uiClientState_t cls; trap_GetClientState( &cls ); // if not in the game explicitly prepend a slash if needed if ( cls.connState != CA_ACTIVE && con_autochat.integer && g_consoleField.buffer[0] && g_consoleField.buffer[0] != '//' && g_consoleField.buffer[0] != '/' ) { char temp[MAX_EDIT_LINE-1]; Q_strncpyz( temp, g_consoleField.buffer, sizeof( temp ) ); Com_sprintf( g_consoleField.buffer, sizeof( g_consoleField.buffer ), "//%s", temp ); g_consoleField.cursor++; } Com_Printf ( "]%s/n", g_consoleField.buffer ); // leading slash is an explicit command if ( g_consoleField.buffer[0] == '//' || g_consoleField.buffer[0] == '/' ) { trap_Cmd_ExecuteText( EXEC_APPEND, g_consoleField.buffer+1 ); // valid command trap_Cmd_ExecuteText( EXEC_APPEND, "/n" ); } else { // other text will be chat messages if ( !g_consoleField.buffer[0] ) { return; // empty lines just scroll the console without adding to history } else { if ( con_autochat.integer ) { trap_Cmd_ExecuteText( EXEC_APPEND, "cmd say " ); } trap_Cmd_ExecuteText( EXEC_APPEND, g_consoleField.buffer ); trap_Cmd_ExecuteText( EXEC_APPEND, "/n" ); } } // copy line to history buffer historyEditLines[nextHistoryLine % COMMAND_HISTORY] = g_consoleField; nextHistoryLine++; historyLine = nextHistoryLine; MField_Clear( &g_consoleField ); g_consoleField.widthInChars = g_console_field_width; CG_SaveConsoleHistory( ); if ( cls.connState == CA_DISCONNECTED ) { trap_UpdateScreen(); // force an update, because the command } // may take some time return; } // command completion if (key == K_TAB) { char newbuf[MAX_EDIT_LINE]; trap_Cmd_AutoComplete( g_consoleField.buffer, newbuf, sizeof ( newbuf ) ); if ( strcmp( newbuf, g_consoleField.buffer ) != 0 ) { Q_strncpyz( g_consoleField.buffer, newbuf, sizeof ( g_consoleField.buffer ) ); g_consoleField.cursor = strlen( g_consoleField.buffer ); } return; } // command history (ctrl-p ctrl-n for unix style) if ( ( key == K_MWHEELUP && trap_Key_IsDown( K_SHIFT ) ) || ( key == K_UPARROW ) || ( key == K_KP_UPARROW ) || ( ( tolower(key) == 'p' ) && trap_Key_IsDown( K_CTRL ) ) ) { if ( nextHistoryLine - historyLine < COMMAND_HISTORY && historyLine > 0 ) { historyLine--;//.........这里部分代码省略.........
开发者ID:mecwerks,项目名称:spearmint-ios,代码行数:101,
示例14: UI_SoundOptionsMenu_Event/* * UI_SoundOptionsMenu_Event */static voidUI_SoundOptionsMenu_Event(void* ptr, int event){ if(event != QM_ACTIVATED) return; switch(((menucommon_s*)ptr)->id){ case ID_GRAPHICS: UI_PopMenu(); UI_GraphicsOptionsMenu(); break; case ID_DISPLAY: UI_PopMenu(); UI_DisplayOptionsMenu(); break; case ID_SOUND: break; case ID_NETWORK: UI_PopMenu(); UI_NetworkOptionsMenu(); break; case ID_BACK: UI_PopMenu(); break; case ID_APPLY: trap_cvarsetf("s_volume", soundOptionsInfo.sfxvolume.curvalue / 10); soundOptionsInfo.sfxvolume_original = soundOptionsInfo.sfxvolume.curvalue; trap_cvarsetf("s_musicvolume", soundOptionsInfo.musicvolume.curvalue / 10); soundOptionsInfo.musicvolume_original = soundOptionsInfo.musicvolume.curvalue; /* Check if something changed that requires the sound system to be restarted. */ if(soundOptionsInfo.quality_original != soundOptionsInfo.quality.curvalue || soundOptionsInfo.soundSystem_original != soundOptionsInfo.soundSystem.curvalue){ int speed; switch(soundOptionsInfo.quality.curvalue){ default: case 0: speed = 11025; break; case 1: speed = 22050; break; case 2: speed = 44100; break; } if(speed == DEFAULT_SDL_SND_SPEED) speed = 0; trap_cvarsetf("s_sdlSpeed", speed); soundOptionsInfo.quality_original = soundOptionsInfo.quality.curvalue; soundOptionsInfo.soundSystem_original = soundOptionsInfo.soundSystem.curvalue; UI_ForceMenuOff(); trap_Cmd_ExecuteText(EXEC_APPEND, "snd_restart/n"); } break; }}
开发者ID:icanhas,项目名称:yantar,代码行数:79,
示例15: TutorialsFuncstatic void TutorialsFunc( menucommon_t *unused ){ trap_Cmd_ExecuteText( EXEC_APPEND, "menu_tutorials/n" );}
开发者ID:Racenet,项目名称:racesow,代码行数:4,
示例16: StartNetworkServerFuncstatic void StartNetworkServerFunc( menucommon_t *unused ){ trap_Cmd_ExecuteText( EXEC_APPEND, "menu_startserver/n" );}
开发者ID:Racenet,项目名称:racesow,代码行数:4,
示例17: M_Turbolift_Event/*=================M_Turbolift_Event=================*/static void M_Turbolift_Event (void* ptr, int notification){ int id; menubitmap_s *holdDeck; id = ((menucommon_s*)ptr)->id; /*if ( notification != QM_ACTIVATED ) { return; }*/ switch (id) { case ID_QUIT: if ( notification == QM_ACTIVATED ) UI_PopMenu(); break; case ID_DECK1: case ID_DECK2: case ID_DECK3: case ID_DECK4: case ID_DECK5: case ID_DECK6: case ID_DECK7: case ID_DECK8: case ID_DECK9: case ID_DECK10: case ID_DECK11: case ID_DECK12: case ID_DECK13: case ID_DECK14: case ID_DECK15: case ID_DECK16: if ( notification == QM_ACTIVATED ) { if (s_turbolift.chosenDeck >= 0) { holdDeck = &s_turbolift.deck1; holdDeck += s_turbolift.chosenDeck; holdDeck->textcolor = CT_BLACK; } s_turbolift.chosenDeck = id - ID_DECK1; s_turbolift.engage.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; holdDeck = &s_turbolift.deck1; holdDeck += s_turbolift.chosenDeck; //holdDeck->textcolor = CT_WHITE;//CT_LTGOLD1; } else if ( notification == QM_GOTFOCUS ) { s_turbolift.highLightedDeck = id - ID_DECK1; } break; case ID_ENGAGE: // Active only if a deck has been chosen if ( notification == QM_ACTIVATED ) { UI_ForceMenuOff(); trap_Cmd_ExecuteText( EXEC_APPEND, va( "deck %i %i", s_turbolift.liftNum, s_turbolift.deckData[s_turbolift.chosenDeck].deckNum ) ); } break; }}
开发者ID:gitter-badger,项目名称:rpgxEF,代码行数:69,
示例18: ConsoleFuncstatic void ConsoleFunc( menucommon_t *unused ){ if( uis.clientState > CA_DISCONNECTED ) M_ForceMenuOff(); trap_Cmd_ExecuteText( EXEC_APPEND, "toggleconsole/n" );}
开发者ID:Racenet,项目名称:racesow,代码行数:6,
示例19: ArenaServers_StartRefresh/*=================ArenaServers_StartRefresh=================*/static void ArenaServers_StartRefresh( void ){ int i; char myargs[32], protocol[32]; memset( g_arenaservers.serverlist, 0, g_arenaservers.maxservers*sizeof(table_t) ); for (i=0; i<MAX_PINGREQUESTS; i++) { g_arenaservers.pinglist[i].adrstr[0] = '/0'; trap_LAN_ClearPing( i ); } g_arenaservers.refreshservers = qtrue; g_arenaservers.currentping = 0; g_arenaservers.nextpingtime = 0; *g_arenaservers.numservers = 0; g_arenaservers.numqueriedservers = 0; // allow max 5 seconds for responses g_arenaservers.refreshtime = uis.realtime + 5000; // place menu in zeroed state ArenaServers_UpdateMenu(); if( g_servertype == UIAS_LOCAL ) { trap_Cmd_ExecuteText( EXEC_APPEND, "localservers/n" ); return; } if( g_servertype >= UIAS_GLOBAL1 && g_servertype <= UIAS_GLOBAL5 ) { switch( g_arenaservers.gametype.curvalue ) { default: case GAMES_ALL: myargs[0] = 0; break; case GAMES_FFA: strcpy( myargs, " ffa" ); break; case GAMES_TEAMPLAY: strcpy( myargs, " team" ); break; case GAMES_TOURNEY: strcpy( myargs, " tourney" ); break; case GAMES_CTF: strcpy( myargs, " ctf" ); break; } if (g_emptyservers) { strcat(myargs, " empty"); } if (g_fullservers) { strcat(myargs, " full"); } protocol[0] = '/0'; trap_Cvar_VariableStringBuffer( "debug_protocol", protocol, sizeof(protocol) ); if (strlen(protocol)) { trap_Cmd_ExecuteText( EXEC_APPEND, va( "globalservers %d %s%s/n", g_servertype - 1, protocol, myargs )); } else { trap_Cmd_ExecuteText( EXEC_APPEND, va( "globalservers %d %d%s/n", g_servertype - 1, (int)trap_Cvar_VariableValue( "protocol" ), myargs ) ); } }}
开发者ID:ghostmod,项目名称:ioquake3_sql_log,代码行数:78,
示例20: QuitMenuFuncstatic void QuitMenuFunc( menucommon_t *unused ){ trap_Cmd_ExecuteText( EXEC_APPEND, "menu_quit/n" );}
开发者ID:Racenet,项目名称:racesow,代码行数:4,
示例21: ArenaServers_DoRefresh//.........这里部分代码省略......... continue; } // find ping result in our local list for (j=0; j<MAX_PINGREQUESTS; j++) if (!Q_stricmp( adrstr, g_arenaservers.pinglist[j].adrstr )) break; if (j < MAX_PINGREQUESTS) { // found it if (!time) { time = uis.realtime - g_arenaservers.pinglist[j].start; if (time < maxPing) { // still waiting continue; } } if (time > maxPing) { // stale it out info[0] = '/0'; time = maxPing; } else { trap_LAN_GetPingInfo( i, info, MAX_INFO_STRING ); } // insert ping results ArenaServers_Insert( adrstr, info, time ); // clear this query from internal list g_arenaservers.pinglist[j].adrstr[0] = '/0'; } // clear this query from external list trap_LAN_ClearPing( i ); } // get results of servers query // counts can increase as servers respond if (g_servertype == UIAS_FAVORITES) { g_arenaservers.numqueriedservers = g_arenaservers.numfavoriteaddresses; } else { g_arenaservers.numqueriedservers = trap_LAN_GetServerCount(ArenaServers_SourceForLAN()); }// if (g_arenaservers.numqueriedservers > g_arenaservers.maxservers)// g_arenaservers.numqueriedservers = g_arenaservers.maxservers; // send ping requests in reasonable bursts // iterate ping through all found servers for (i=0; i<MAX_PINGREQUESTS && g_arenaservers.currentping < g_arenaservers.numqueriedservers; i++) { if (trap_LAN_GetPingQueueCount() >= MAX_PINGREQUESTS) { // ping queue is full break; } // find empty slot for (j=0; j<MAX_PINGREQUESTS; j++) if (!g_arenaservers.pinglist[j].adrstr[0]) break; if (j >= MAX_PINGREQUESTS) // no empty slots available yet - wait for timeout break; // get an address to ping if (g_servertype == UIAS_FAVORITES) { strcpy( adrstr, g_arenaservers.favoriteaddresses[g_arenaservers.currentping] ); } else { trap_LAN_GetServerAddressString(ArenaServers_SourceForLAN(), g_arenaservers.currentping, adrstr, MAX_ADDRESSLENGTH ); } strcpy( g_arenaservers.pinglist[j].adrstr, adrstr ); g_arenaservers.pinglist[j].start = uis.realtime; trap_Cmd_ExecuteText( EXEC_NOW, va( "ping %s/n", adrstr ) ); // advance to next server g_arenaservers.currentping++; } if (!trap_LAN_GetPingQueueCount()) { // all pings completed ArenaServers_StopRefresh(); return; } // update the user interface with ping status ArenaServers_UpdateMenu();}
开发者ID:ghostmod,项目名称:ioquake3_sql_log,代码行数:101,
示例22: GraphicsOptions_ApplyChanges/*=================GraphicsOptions_ApplyChanges=================*/static void GraphicsOptions_ApplyChanges( void *unused, int notification ){ if (notification != QM_ACTIVATED) return; switch ( s_graphicsoptions.texturebits.curvalue ) { case 0: trap_Cvar_SetValue( "r_texturebits", 0 ); break; case 1: trap_Cvar_SetValue( "r_texturebits", 16 ); break; case 2: trap_Cvar_SetValue( "r_texturebits", 32 ); break; } trap_Cvar_SetValue( "r_picmip", 3 - s_graphicsoptions.tq.curvalue ); trap_Cvar_SetValue( "r_allowExtensions", s_graphicsoptions.allow_extensions.curvalue ); if( resolutionsDetected ) { // search for builtin mode that matches the detected mode int mode = GraphicsOptions_FindBuiltinResolution( s_graphicsoptions.mode.curvalue ); if( mode == -1 ) { char w[ 16 ], h[ 16 ]; Q_strncpyz( w, detectedResolutions[ s_graphicsoptions.mode.curvalue ], sizeof( w ) ); *strchr( w, 'x' ) = 0; Q_strncpyz( h, strchr( detectedResolutions[ s_graphicsoptions.mode.curvalue ], 'x' ) + 1, sizeof( h ) ); trap_Cvar_Set( "r_customwidth", w ); trap_Cvar_Set( "r_customheight", h ); } trap_Cvar_SetValue( "r_mode", mode ); } else trap_Cvar_SetValue( "r_mode", s_graphicsoptions.mode.curvalue ); trap_Cvar_SetValue( "r_fullscreen", s_graphicsoptions.fs.curvalue ); trap_Cvar_SetValue( "r_colorbits", 0 ); trap_Cvar_SetValue( "r_depthbits", 0 ); trap_Cvar_SetValue( "r_stencilbits", 0 ); trap_Cvar_SetValue( "r_vertexLight", s_graphicsoptions.lighting.curvalue ); if ( s_graphicsoptions.geometry.curvalue == 2 ) { trap_Cvar_SetValue( "r_lodBias", 0 ); trap_Cvar_SetValue( "r_subdivisions", 4 ); } else if ( s_graphicsoptions.geometry.curvalue == 1 ) { trap_Cvar_SetValue( "r_lodBias", 1 ); trap_Cvar_SetValue( "r_subdivisions", 12 ); } else { trap_Cvar_SetValue( "r_lodBias", 1 ); trap_Cvar_SetValue( "r_subdivisions", 20 ); } if ( s_graphicsoptions.filter.curvalue ) { trap_Cvar_Set( "r_textureMode", "GL_LINEAR_MIPMAP_LINEAR" ); } else { trap_Cvar_Set( "r_textureMode", "GL_LINEAR_MIPMAP_NEAREST" ); } trap_Cmd_ExecuteText( EXEC_APPEND, "vid_restart/n" );}
开发者ID:Barbatos,项目名称:ioq3-for-UrbanTerror-4,代码行数:78,
示例23: SV_ReadIPList/** SV_ReadIPList*/void SV_ReadIPList( void ){ SV_ResetPacketFiltersTimeouts (); trap_Cmd_ExecuteText( EXEC_APPEND, "exec listip.cfg silent/n" );}
开发者ID:Clever-Boy,项目名称:qfusion,代码行数:9,
示例24: UI_StartDemoLoop/*=================UI_StartDemoLoop=================*/void UI_StartDemoLoop( void ) { trap_Cmd_ExecuteText( EXEC_APPEND, "d1/n" );}
开发者ID:elhobbs,项目名称:quake3,代码行数:8,
示例25: G_Gametype_Init/** G_Gametype_Init*/void G_Gametype_Init( void ){ bool changed = false; const char *mapGametype; g_gametypes_list = trap_Cvar_Get( "g_gametypes_list", "", CVAR_NOSET|CVAR_ARCHIVE ); G_Gametype_GenerateGametypesList(); // fill the g_gametypes_list cvar // empty string to allow all g_votable_gametypes = trap_Cvar_Get( "g_votable_gametypes", "", CVAR_ARCHIVE ); if( !g_gametype ) // first time initialized changed = true; g_gametype = trap_Cvar_Get( "g_gametype", "dm", CVAR_SERVERINFO|CVAR_ARCHIVE|CVAR_LATCH ); //get the match cvars too g_warmup_timelimit = trap_Cvar_Get( "g_warmup_timelimit", "5", CVAR_ARCHIVE ); g_postmatch_timelimit = trap_Cvar_Get( "g_postmatch_timelimit", "4", CVAR_ARCHIVE ); g_countdown_time = trap_Cvar_Get( "g_countdown_time", "5", CVAR_ARCHIVE ); g_match_extendedtime = trap_Cvar_Get( "g_match_extendedtime", "2", CVAR_ARCHIVE ); // game settings g_timelimit = trap_Cvar_Get( "g_timelimit", "10", CVAR_ARCHIVE ); g_scorelimit = trap_Cvar_Get( "g_scorelimit", "0", CVAR_ARCHIVE ); g_allow_falldamage = trap_Cvar_Get( "g_allow_falldamage", "1", CVAR_ARCHIVE ); g_allow_selfdamage = trap_Cvar_Get( "g_allow_selfdamage", "1", CVAR_ARCHIVE ); g_allow_teamdamage = trap_Cvar_Get( "g_allow_teamdamage", "1", CVAR_ARCHIVE ); g_allow_bunny = trap_Cvar_Get( "g_allow_bunny", "1", CVAR_ARCHIVE|CVAR_READONLY ); // map-specific gametype mapGametype = G_asCallMapGametype(); if( mapGametype[0] && G_Gametype_Exists( mapGametype ) ) trap_Cvar_Set( g_gametype->name, mapGametype ); // update latched gametype change if( g_gametype->latched_string ) { if( G_Gametype_Exists( g_gametype->latched_string ) ) { trap_Cvar_ForceSet( "g_gametype", va( "%s", g_gametype->latched_string ) ); changed = true; } else { G_Printf( "G_Gametype: Invalid new gametype, change ignored/n" ); trap_Cvar_ForceSet( "g_gametype", va( "%s", g_gametype->string ) ); } } if( !G_Gametype_Exists( g_gametype->string ) ) { G_Printf( "G_Gametype: Wrong value: '%s'. Setting up with default (dm)/n", g_gametype->string ); trap_Cvar_ForceSet( "g_gametype", "dm" ); changed = true; } G_Printf( "-------------------------------------/n" ); G_Printf( "Initalizing '%s' gametype/n", g_gametype->string ); if( changed ) { const char *configs_path = "configs/server/gametypes/"; G_InitChallengersQueue(); // print a hint for admins so they know there's a chance to execute a // config here, but don't show it as an error, because it isn't G_Printf( "loading %s%s.cfg/n", configs_path, g_gametype->string ); trap_Cmd_ExecuteText( EXEC_NOW, va( "exec %s%s.cfg silent/n", configs_path, g_gametype->string ) ); trap_Cbuf_Execute(); // on a listen server, override gametype-specific settings in config trap_Cmd_ExecuteText( EXEC_NOW, "vstr ui_startservercmd/n" ); trap_Cbuf_Execute(); } // fixme: we are doing this twice because the gametype may check for GS_Instagib G_CheckCvars(); // update GS_Instagib, GS_FallDamage, etc G_Gametype_SetDefaults(); // Init the current gametype if( !GT_asLoadScript( g_gametype->string ) ) G_Gametype_GENERIC_Init(); GS_SetGametypeName( g_gametype->string ); trap_ConfigString( CS_GAMETYPENAME, g_gametype->string ); G_CheckCvars(); // update GS_Instagib, GS_FallDamage, etc // ch : if new gametype has been initialized, transfer the // client-specific ratings to gametype-specific list if( changed ) G_TransferRatings();}
开发者ID:MaryJaneInChain,项目名称:qfusion,代码行数:100,
示例26: UI_KeyConnect/*===================UI_KeyConnect===================*/void UI_KeyConnect( int key ) { if ( key == K_ESCAPE ) { trap_Cmd_ExecuteText( EXEC_APPEND, "disconnect/n" ); return; }}
开发者ID:xzero450,项目名称:revolution,代码行数:11,
示例27: Menu_DefaultKeysfxHandle_t Menu_DefaultKey(menuframework_s *m, int key){ sfxHandle_t sound = 0; menucommon_s *item; int cursor_prev; // menu system keys switch (key) { case K_MOUSE2: case K_ESCAPE: UI_PopMenu(); return menu_out_sound; } if (!m || !m->nitems) { return 0; } // route key stimulus to widget item = Menu_ItemAtCursor(m); if (item && !(item->flags & (QMF_GRAYED|QMF_INACTIVE))) { switch (item->type) { case MTYPE_SPINCONTROL: sound = SpinControl_Key((menulist_s*)item, key); break; case MTYPE_RADIOBUTTON: sound = RadioButton_Key((menuradiobutton_s*)item, key); break; case MTYPE_SLIDER: sound = Slider_Key((menuslider_s*)item, key); break; case MTYPE_SCROLLLIST: sound = ScrollList_Key((menulist_s*)item, key); break; case MTYPE_FIELD: sound = MenuField_Key((menufield_s*)item, &key); break; } if (sound) { // key was handled return sound; } } // default handling switch (key) {#ifndef NDEBUG case K_F11: uis.debug ^= 1; break; case K_F12: trap_Cmd_ExecuteText(EXEC_APPEND, "screenshot/n"); break;#endif case K_KP_UPARROW: case K_UPARROW: cursor_prev = m->cursor; m->cursor_prev = m->cursor; m->cursor--; Menu_AdjustCursor(m, -1); if (cursor_prev != m->cursor) { Menu_CursorMoved(m); sound = menu_move_sound; } break; case K_TAB: case K_KP_DOWNARROW: case K_DOWNARROW: cursor_prev = m->cursor; m->cursor_prev = m->cursor; m->cursor++; Menu_AdjustCursor(m, 1); if (cursor_prev != m->cursor) { Menu_CursorMoved(m); sound = menu_move_sound; } break; case K_MOUSE1: case K_MOUSE3: if (item) if ((item->flags & QMF_HASMOUSEFOCUS) && !(item->flags & (QMF_GRAYED|QMF_INACTIVE))) return (Menu_ActivateItem(m, item)); break; case K_JOY1: case K_JOY2: case K_JOY3: case K_JOY4: case K_AUX1: case K_AUX2: case K_AUX3: case K_AUX4://.........这里部分代码省略.........
开发者ID:baseas,项目名称:aftershock,代码行数:101,
示例28: MatchMakerFuncstatic void MatchMakerFunc( menucommon_t *unused ){ trap_Cmd_ExecuteText( EXEC_APPEND, "menu_matchmaker/n" );}
开发者ID:Racenet,项目名称:racesow,代码行数:4,
注:本文中的trap_Cmd_ExecuteText函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ trap_Cvar_Register函数代码示例 C++ trap_Cmd_Argc函数代码示例 |