这篇教程C++ trap_Cvar_Set函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中trap_Cvar_Set函数的典型用法代码示例。如果您正苦于以下问题:C++ trap_Cvar_Set函数的具体用法?C++ trap_Cvar_Set怎么用?C++ trap_Cvar_Set使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了trap_Cvar_Set函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: 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:entdark,项目名称:q3mme,代码行数:73,
示例2: CG_CalcVrectstatic void CG_CalcVrect (void) { int xsize, ysize; float lbheight, lbdiff; // NERVE - SMF if ( cg.limboMenu ){ float x, y, w, h; x = LIMBO_3D_X; y = LIMBO_3D_Y; w = LIMBO_3D_W; h = LIMBO_3D_H; cg.refdef.width = 0; CG_AdjustFrom640( &x, &y, &w, &h ); cg.refdef.x = x; cg.refdef.y = y; cg.refdef.width = w; cg.refdef.height = h; return; } // -NERVE - SMF // the intermission should allways be full screen if ( cg.snap->ps.pm_type == PM_INTERMISSION ) { xsize = ysize = 100; } else { // bound normal viewsize if (cg_viewsize.integer < 30) { trap_Cvar_Set ("cg_viewsize","30"); xsize = ysize = 30; } else if (cg_viewsize.integer > 100) { trap_Cvar_Set ("cg_viewsize","100"); xsize = ysize = 100; } else { xsize = ysize = cg_viewsize.integer; } }//----(SA) added transition to/from letterbox// normal aspect is xx:xx// letterbox is yy:yy (85% of 'normal' height) lbheight = ysize * 0.85; lbdiff = ysize - lbheight; if(cg_letterbox.integer) { ysize = lbheight;// if(letterbox_frac != 0) {// letterbox_frac -= 0.01f; // (SA) TODO: make non fps dependant// if(letterbox_frac < 0)// letterbox_frac = 0;// ysize += (lbdiff * letterbox_frac);// }// } else {// if(letterbox_frac != 1) {// letterbox_frac += 0.01f; // (SA) TODO: make non fps dependant// if(letterbox_frac > 1)// letterbox_frac = 1;// ysize = lbheight + (lbdiff * letterbox_frac);// } }//----(SA) end cg.refdef.width = cgs.glconfig.vidWidth*xsize/100; cg.refdef.width &= ~1; cg.refdef.height = cgs.glconfig.vidHeight*ysize/100; cg.refdef.height &= ~1; cg.refdef.x = (cgs.glconfig.vidWidth - cg.refdef.width)/2; cg.refdef.y = (cgs.glconfig.vidHeight - cg.refdef.height)/2;}
开发者ID:natelo,项目名称:rtcwPub,代码行数:74,
示例3: CheckFloodqboolean CheckFlood( edict_t *ent, qboolean teamonly ){ int i; gclient_t *client = ent->r.client; assert( ent && client ); if( g_floodprotection_messages->modified ) { if( g_floodprotection_messages->integer < 0 ) trap_Cvar_Set( "g_floodprotection_messages", "0" ); if( g_floodprotection_messages->integer > MAX_FLOOD_MESSAGES ) trap_Cvar_Set( "g_floodprotection_messages", va( "%i", MAX_FLOOD_MESSAGES ) ); g_floodprotection_messages->modified = qfalse; } if( g_floodprotection_team->modified ) { if( g_floodprotection_team->integer < 0 ) trap_Cvar_Set( "g_floodprotection_team", "0" ); if( g_floodprotection_team->integer > MAX_FLOOD_MESSAGES ) trap_Cvar_Set( "g_floodprotection_team", va( "%i", MAX_FLOOD_MESSAGES ) ); g_floodprotection_team->modified = qfalse; } if( g_floodprotection_seconds->modified ) { if( g_floodprotection_seconds->value <= 0 ) trap_Cvar_Set( "g_floodprotection_seconds", "4" ); g_floodprotection_seconds->modified = qfalse; } if( g_floodprotection_penalty->modified ) { if( g_floodprotection_penalty->value < 0 ) trap_Cvar_Set( "g_floodprotection_penalty", "10" ); g_floodprotection_penalty->modified = qfalse; } // old protection still active if( !teamonly || g_floodprotection_team->integer ) { if( game.realtime < client->level.flood_locktill ) { G_PrintMsg( ent, "You can't talk for %d more seconds/n", (int)( ( client->level.flood_locktill - game.realtime ) / 1000.0f ) + 1 ); return qtrue; } } if( teamonly ) { if( g_floodprotection_team->integer && g_floodprotection_penalty->value > 0 ) { i = client->level.flood_team_whenhead - g_floodprotection_team->integer + 1; if( i < 0 ) i = MAX_FLOOD_MESSAGES + i; if( client->level.flood_team_when[i] && client->level.flood_team_when[i] <= game.realtime && ( game.realtime < client->level.flood_team_when[i] + g_floodprotection_seconds->integer * 1000 ) ) { client->level.flood_locktill = game.realtime + g_floodprotection_penalty->value * 1000; G_PrintMsg( ent, "Flood protection: You can't talk for %d seconds./n", g_floodprotection_penalty->integer ); return qtrue; } } client->level.flood_team_whenhead = ( client->level.flood_team_whenhead + 1 ) % MAX_FLOOD_MESSAGES; client->level.flood_team_when[client->level.flood_team_whenhead] = game.realtime; } else { if( g_floodprotection_messages->integer && g_floodprotection_penalty->value > 0 ) { i = client->level.flood_whenhead - g_floodprotection_messages->integer + 1; if( i < 0 ) i = MAX_FLOOD_MESSAGES + i; if( client->level.flood_when[i] && client->level.flood_when[i] <= game.realtime && ( game.realtime < client->level.flood_when[i] + g_floodprotection_seconds->integer * 1000 ) ) { client->level.flood_locktill = game.realtime + g_floodprotection_penalty->value * 1000; G_PrintMsg( ent, "Flood protection: You can't talk for %d seconds./n", g_floodprotection_penalty->integer ); return qtrue; } } client->level.flood_whenhead = ( client->level.flood_whenhead + 1 ) % MAX_FLOOD_MESSAGES; client->level.flood_when[client->level.flood_whenhead] = game.realtime; } return qfalse;}
开发者ID:j0ki,项目名称:racesow,代码行数:94,
示例4: UI_SaberDrawBladesvoid UI_SaberDrawBlades( itemDef_t *item, vec3_t origin, vec3_t angles ){ //NOTE: only allows one saber type in view at a time char saber[MAX_QPATH]; int saberNum = 0; int saberModel = 0; int numSabers = 1; if ( (item->flags&ITF_ISCHARACTER)//hacked sabermoves sabers in character's hand && uiInfo.movesTitleIndex == 4 /*MD_DUAL_SABERS*/ ) { numSabers = 2; } for ( saberNum = 0; saberNum < numSabers; saberNum++ ) { if ( (item->flags&ITF_ISCHARACTER) )//hacked sabermoves sabers in character's hand { UI_GetSaberForMenu( saber, saberNum ); saberModel = saberNum + 1; } else if ( (item->flags&ITF_ISSABER) ) { trap_Cvar_VariableStringBuffer("ui_saber", saber, sizeof(saber) ); if ( !UI_SaberValidForPlayerInMP( saber ) ) { trap_Cvar_Set( "ui_saber", "kyle" ); trap_Cvar_VariableStringBuffer("ui_saber", saber, sizeof(saber) ); } saberModel = 0; } else if ( (item->flags&ITF_ISSABER2) ) { trap_Cvar_VariableStringBuffer("ui_saber2", saber, sizeof(saber) ); if ( !UI_SaberValidForPlayerInMP( saber ) ) { trap_Cvar_Set( "ui_saber2", "kyle" ); trap_Cvar_VariableStringBuffer("ui_saber2", saber, sizeof(saber) ); } saberModel = 0; } else { return; } if ( saber[0] ) { saberType_t saberType; int curBlade = 0; int numBlades = UI_SaberNumBladesForSaber( saber ); if ( numBlades ) {//okay, here we go, time to draw each blade... char saberTypeString[MAX_QPATH]={0}; UI_SaberTypeForSaber( saber, saberTypeString ); saberType = TranslateSaberType( saberTypeString ); for ( curBlade = 0; curBlade < numBlades; curBlade++ ) { if ( UI_SaberShouldDrawBlade( saber, curBlade ) ) { UI_SaberDrawBlade( item, saber, saberModel, saberType, origin, angles, curBlade ); } } } } }}
开发者ID:ForcePush,项目名称:OJPRPFZ,代码行数:66,
示例5: SP_worldspawnvoid SP_worldspawn( void ) { char *text, temp[32]; int i; int lengthRed, lengthBlue, lengthGreen; //I want to "cull" entities out of net sends to clients to reduce //net traffic on our larger open maps -rww G_SpawnFloat("distanceCull", "6000.0", &g_cullDistance); trap_SetServerCull(g_cullDistance); G_SpawnString( "classname", "", &text ); if ( Q_stricmp( text, "worldspawn" ) ) { G_Error( "SP_worldspawn: The first entity isn't 'worldspawn'" ); } for ( i = 0 ; i < level.numSpawnVars ; i++ ) { if ( Q_stricmp( "spawnscript", level.spawnVars[i][0] ) == 0 ) {//ONly let them set spawnscript, we don't want them setting an angle or something on the world. G_ParseField( level.spawnVars[i][0], level.spawnVars[i][1], &g_entities[ENTITYNUM_WORLD] ); } } //The server will precache the standard model and animations, so that there is no hit //when the first client connnects. if (!BGPAFtextLoaded) { BG_ParseAnimationFile("models/players/_humanoid/animation.cfg", bgHumanoidAnimations, qtrue); } if (!precachedKyle) { int defSkin; trap_G2API_InitGhoul2Model(&precachedKyle, "models/players/kyle/model.glm", 0, 0, -20, 0, 0); if (precachedKyle) { defSkin = trap_R_RegisterSkin("models/players/kyle/model_default.skin"); trap_G2API_SetSkin(precachedKyle, 0, defSkin, defSkin); } } if (!g2SaberInstance) { trap_G2API_InitGhoul2Model(&g2SaberInstance, "models/weapons2/saber/saber_w.glm", 0, 0, -20, 0, 0); if (g2SaberInstance) { // indicate we will be bolted to model 0 (ie the player) on bolt 0 (always the right hand) when we get copied trap_G2API_SetBoltInfo(g2SaberInstance, 0, 0); // now set up the gun bolt on it trap_G2API_AddBolt(g2SaberInstance, 0, "*blade1"); } } if (g_gametype.integer == GT_SIEGE) { //a tad bit of a hack, but.. EWebPrecache(); } // make some data visible to connecting client trap_SetConfigstring( CS_GAME_VERSION, GAME_VERSION ); trap_SetConfigstring( CS_LEVEL_START_TIME, va("%i", level.startTime ) ); G_SpawnString( "music", "", &text ); trap_SetConfigstring( CS_MUSIC, text ); G_SpawnString( "message", "", &text ); trap_SetConfigstring( CS_MESSAGE, text ); // map specific message trap_SetConfigstring( CS_MOTD, g_motd.string ); // message of the day G_SpawnString( "gravity", "800", &text ); trap_Cvar_Set( "g_gravity", text ); G_SpawnString( "enableBreath", "0", &text ); trap_Cvar_Set( "g_enableBreath", text ); G_SpawnString( "soundSet", "default", &text ); trap_SetConfigstring( CS_GLOBAL_AMBIENT_SET, text ); g_entities[ENTITYNUM_WORLD].s.number = ENTITYNUM_WORLD; g_entities[ENTITYNUM_WORLD].classname = "worldspawn"; // see if we want a warmup time trap_SetConfigstring( CS_WARMUP, "" ); if ( g_restarted.integer ) { trap_Cvar_Set( "g_restarted", "0" ); level.warmupTime = 0; } //Raz: Fix warmup#if 0 /* else if ( g_doWarmup.integer && g_gametype.integer != GT_DUEL && g_gametype.integer != GT_POWERDUEL ) { // Turn it on else if ( g_doWarmup.integer && level.gametype != GT_DUEL && level.gametype != GT_POWERDUEL ) { // Turn it on level.warmupTime = -1; trap_SetConfigstring( CS_WARMUP, va("%i", level.warmupTime) ); G_LogPrintf( "Warmup:/n" );//.........这里部分代码省略.........
开发者ID:Camron,项目名称:OpenJK,代码行数:101,
示例6: CG_EventHandling/*==================CG_EventHandling==================*/void CG_EventHandling(int type, qboolean fForced){ if (cg.demoPlayback && type == CGAME_EVENT_NONE && !fForced) { type = CGAME_EVENT_DEMO; } if (type != CGAME_EVENT_NONE) { trap_Cvar_Set("cl_bypassMouseInput", 0); } switch (type) { // Demo support case CGAME_EVENT_DEMO: cgs.fResize = qfalse; cgs.fSelect = qfalse; cgs.cursorUpdate = cg.time + 10000; cgs.timescaleUpdate = cg.time + 4000; CG_ScoresUp_f(); break; case CGAME_EVENT_SPEAKEREDITOR: case CGAME_EVENT_GAMEVIEW: case CGAME_EVENT_NONE: case CGAME_EVENT_CAMPAIGNBREIFING: case CGAME_EVENT_FIRETEAMMSG: default: // default handling (cleanup mostly) if (cgs.eventHandling == CGAME_EVENT_GAMEVIEW) { cg.showGameView = qfalse; trap_S_FadeBackgroundTrack(0.0f, 500, 0); trap_S_StopStreamingSound(-1); cg.limboEndCinematicTime = 0; if (fForced) { if (cgs.limboLoadoutModified) { trap_SendClientCommand("rs"); cgs.limboLoadoutSelected = qfalse; } } } else if (cgs.eventHandling == CGAME_EVENT_SPEAKEREDITOR) { if (type == -CGAME_EVENT_SPEAKEREDITOR) { type = CGAME_EVENT_NONE; } else { trap_Key_SetCatcher(KEYCATCH_CGAME); return; } } else if (cgs.eventHandling == CGAME_EVENT_CAMPAIGNBREIFING) { type = CGAME_EVENT_GAMEVIEW; } else if (cgs.eventHandling == CGAME_EVENT_FIRETEAMMSG) { cg.showFireteamMenu = qfalse; trap_Cvar_Set("cl_bypassmouseinput", "0"); } else if (cg.snap && cg.snap->ps.pm_type == PM_INTERMISSION && fForced) { trap_UI_Popup(UIMENU_INGAME); } break; } cgs.eventHandling = type; if (type == CGAME_EVENT_NONE) { trap_Key_SetCatcher(trap_Key_GetCatcher() & ~KEYCATCH_CGAME); ccInitial = qfalse; if (cg.demoPlayback && cg.demohelpWindow != SHOW_OFF) { CG_ShowHelp_Off(&cg.demohelpWindow); } } else if (type == CGAME_EVENT_GAMEVIEW) { cg.showGameView = qtrue; CG_LimboPanel_Setup(); trap_Key_SetCatcher(KEYCATCH_CGAME); } else if (type == CGAME_EVENT_FIRETEAMMSG)//.........这里部分代码省略.........
开发者ID:Ponce,项目名称:etlegacy,代码行数:101,
示例7: UI_SetBestScoresvoid UI_SetBestScores(postGameInfo_t * newInfo, qboolean postGame){ trap_Cvar_Set("ui_scoreAccuracy", va("%i%%", newInfo->accuracy)); trap_Cvar_Set("ui_scoreImpressives", va("%i", newInfo->impressives)); trap_Cvar_Set("ui_scoreExcellents", va("%i", newInfo->excellents)); trap_Cvar_Set("ui_scoreDefends", va("%i", newInfo->defends)); trap_Cvar_Set("ui_scoreAssists", va("%i", newInfo->assists)); trap_Cvar_Set("ui_scoreGauntlets", va("%i", newInfo->gauntlets)); trap_Cvar_Set("ui_scoreScore", va("%i", newInfo->score)); trap_Cvar_Set("ui_scorePerfect", va("%i", newInfo->perfects)); trap_Cvar_Set("ui_scoreTeam", va("%i to %i", newInfo->redScore, newInfo->blueScore)); trap_Cvar_Set("ui_scoreBase", va("%i", newInfo->baseScore)); trap_Cvar_Set("ui_scoreTimeBonus", va("%i", newInfo->timeBonus)); trap_Cvar_Set("ui_scoreSkillBonus", va("%i", newInfo->skillBonus)); trap_Cvar_Set("ui_scoreShutoutBonus", va("%i", newInfo->shutoutBonus)); trap_Cvar_Set("ui_scoreTime", va("%02i:%02i", newInfo->time / 60, newInfo->time % 60)); trap_Cvar_Set("ui_scoreCaptures", va("%i", newInfo->captures)); if (postGame) { trap_Cvar_Set("ui_scoreAccuracy2", va("%i%%", newInfo->accuracy)); trap_Cvar_Set("ui_scoreImpressives2", va("%i", newInfo->impressives)); trap_Cvar_Set("ui_scoreExcellents2", va("%i", newInfo->excellents)); trap_Cvar_Set("ui_scoreDefends2", va("%i", newInfo->defends)); trap_Cvar_Set("ui_scoreAssists2", va("%i", newInfo->assists)); trap_Cvar_Set("ui_scoreGauntlets2", va("%i", newInfo->gauntlets)); trap_Cvar_Set("ui_scoreScore2", va("%i", newInfo->score)); trap_Cvar_Set("ui_scorePerfect2", va("%i", newInfo->perfects)); trap_Cvar_Set("ui_scoreTeam2", va("%i to %i", newInfo->redScore, newInfo->blueScore)); trap_Cvar_Set("ui_scoreBase2", va("%i", newInfo->baseScore)); trap_Cvar_Set("ui_scoreTimeBonus2", va("%i", newInfo->timeBonus)); trap_Cvar_Set("ui_scoreSkillBonus2", va("%i", newInfo->skillBonus)); trap_Cvar_Set("ui_scoreShutoutBonus2", va("%i", newInfo->shutoutBonus)); trap_Cvar_Set("ui_scoreTime2", va("%02i:%02i", newInfo->time / 60, newInfo->time % 60)); trap_Cvar_Set("ui_scoreCaptures2", va("%i", newInfo->captures)); }}
开发者ID:Zekom,项目名称:reaction,代码行数:35,
示例8: G_voteSetValuevoid G_voteSetValue(const char *desc, const char *cvar){ AP(va("cpm /"^3%s set to: ^5%s/n/"", desc, level.voteInfo.vote_value)); //trap_SendConsoleCommand(EXEC_APPEND, va("%s %s/n", cvar, level.voteInfo.vote_value)); trap_Cvar_Set(cvar, level.voteInfo.vote_value);}
开发者ID:morsik,项目名称:war-territory,代码行数:6,
示例9: G_ReadSessionData//.........这里部分代码省略......... &client->sess.referee, &client->sess.spec_invite, &client->sess.spec_team, &client->sess.kills, &client->sess.deaths, &client->sess.gibs, &client->sess.self_kills, &client->sess.team_kills, &client->sess.team_gibs, &client->sess.time_axis, &client->sess.time_allies, &client->sess.time_played,#ifdef FEATURE_RATING &client->sess.mu, &client->sess.sigma, &client->sess.oldmu, &client->sess.oldsigma,#endif#ifdef FEATURE_MULTIVIEW &mvc_l, &mvc_h,#endif // Damage and round count rolled in with weapon stats (below) (int *)&client->sess.muted, &client->sess.ignoreClients[0], &client->sess.ignoreClients[1], &client->pers.enterTime, &client->sess.spawnObjectiveIndex, &client->sess.uci );#ifdef FEATURE_MULTIVIEW // reinstate MV clients client->pers.mvReferenceList = (mvc_h << 16) | mvc_l;#endif // pull and parse weapon stats *s = 0; trap_Cvar_VariableStringBuffer(va("wstats%i", (int)(client - level.clients)), s, sizeof(s)); if (*s) { G_parseStats(s); if (g_gamestate.integer == GS_PLAYING) { client->sess.rounds++; } } // likely there are more cases in which we don't want this if (g_gametype.integer != GT_SINGLE_PLAYER && g_gametype.integer != GT_COOP && g_gametype.integer != GT_WOLF && g_gametype.integer != GT_WOLF_STOPWATCH && !(g_gametype.integer == GT_WOLF_CAMPAIGN && (g_campaigns[level.currentCampaign].current == 0 || level.newCampaign)) && !(g_gametype.integer == GT_WOLF_LMS && g_currentRound.integer == 0)) { trap_Cvar_VariableStringBuffer(va("sessionstats%i", (int)(client - level.clients)), s, sizeof(s)); // read the clients stats (7) and medals (7) sscanf(s, "%f %f %f %f %f %f %f %i %i %i %i %i %i %i", &client->sess.skillpoints[0], &client->sess.skillpoints[1], &client->sess.skillpoints[2], &client->sess.skillpoints[3], &client->sess.skillpoints[4], &client->sess.skillpoints[5], &client->sess.skillpoints[6], &client->sess.medals[0], &client->sess.medals[1], &client->sess.medals[2], &client->sess.medals[3], &client->sess.medals[4], &client->sess.medals[5], &client->sess.medals[6] ); } G_CalcRank(client); test = (g_altStopwatchMode.integer != 0 || g_currentRound.integer == 1); if (g_gametype.integer == GT_WOLF_STOPWATCH && g_gamestate.integer != GS_PLAYING && test) { G_ClientSwap(client); } if (g_swapteams.integer) { trap_Cvar_Set("g_swapteams", "0"); G_ClientSwap(client); } client->sess.startxptotal = 0; for (j = 0; j < SK_NUM_SKILLS; j++) { client->sess.startskillpoints[j] = client->sess.skillpoints[j]; client->sess.startxptotal += client->sess.skillpoints[j]; }}
开发者ID:belstgut,项目名称:etlegacy,代码行数:101,
示例10: SP_worldspawn/*QUAKED worldspawn (0 0 0) ?Every map should have exactly one worldspawn."music" music wav file"gravity" 800 is default gravity"message" Text to print during connection process*/void SP_worldspawn( void ){ char *s; G_SpawnString( "classname", "", &s ); if( Q_stricmp( s, "worldspawn" ) ) G_Error( "SP_worldspawn: The first entity isn't 'worldspawn'" ); // make some data visible to connecting client trap_SetConfigstring( CS_GAME_VERSION, GAME_VERSION ); trap_SetConfigstring( CS_LEVEL_START_TIME, va( "%i", level.startTime ) ); G_SpawnString( "music", "", &s ); trap_SetConfigstring( CS_MUSIC, s ); G_SpawnString( "message", "", &s ); trap_SetConfigstring( CS_MESSAGE, s ); // map specific message trap_SetConfigstring( CS_MOTD, g_motd.string ); // message of the day G_SpawnString( "gravity", "800", &s ); trap_Cvar_Set( "g_gravity", s ); G_SpawnString( "humanBuildPoints", DEFAULT_HUMAN_BUILDPOINTS, &s ); trap_Cvar_Set( "g_humanBuildPoints", s ); G_SpawnString( "humanMaxStage", DEFAULT_HUMAN_MAX_STAGE, &s ); trap_Cvar_Set( "g_humanMaxStage", s ); G_SpawnString( "humanStage2Threshold", DEFAULT_HUMAN_STAGE2_THRESH, &s ); trap_Cvar_Set( "g_humanStage2Threshold", s ); G_SpawnString( "humanStage3Threshold", DEFAULT_HUMAN_STAGE3_THRESH, &s ); trap_Cvar_Set( "g_humanStage3Threshold", s ); G_SpawnString( "alienBuildPoints", DEFAULT_ALIEN_BUILDPOINTS, &s ); trap_Cvar_Set( "g_alienBuildPoints", s ); G_SpawnString( "alienMaxStage", DEFAULT_ALIEN_MAX_STAGE, &s ); trap_Cvar_Set( "g_alienMaxStage", s ); G_SpawnString( "alienStage2Threshold", DEFAULT_ALIEN_STAGE2_THRESH, &s ); trap_Cvar_Set( "g_alienStage2Threshold", s ); G_SpawnString( "alienStage3Threshold", DEFAULT_ALIEN_STAGE3_THRESH, &s ); trap_Cvar_Set( "g_alienStage3Threshold", s ); G_SpawnString( "enableDust", "0", &s ); trap_Cvar_Set( "g_enableDust", s ); G_SpawnString( "enableBreath", "0", &s ); trap_Cvar_Set( "g_enableBreath", s ); G_SpawnString( "disabledEquipment", "", &s ); trap_Cvar_Set( "g_disabledEquipment", s ); G_SpawnString( "disabledClasses", "", &s ); trap_Cvar_Set( "g_disabledClasses", s ); G_SpawnString( "disabledBuildables", "", &s ); trap_Cvar_Set( "g_disabledBuildables", s ); g_entities[ ENTITYNUM_WORLD ].s.number = ENTITYNUM_WORLD; g_entities[ ENTITYNUM_WORLD ].classname = "worldspawn"; // see if we want a warmup time trap_SetConfigstring( CS_WARMUP, "" ); if( g_restarted.integer ) { trap_Cvar_Set( "g_restarted", "0" ); level.warmupTime = 0; } else if( g_doWarmup.integer ) { // Turn it on level.warmupTime = -1; trap_SetConfigstring( CS_WARMUP, va( "%i", level.warmupTime ) ); G_LogPrintf( "Warmup:/n" ); }}
开发者ID:redrumrobot,项目名称:korx,代码行数:90,
示例11: G_voteSetOnOff//// Several commands to help with cvar setting//void G_voteSetOnOff(const char *desc, const char *cvar){ AP(va("cpm /"^3%s is: ^5%s/n/"", desc, (atoi(level.voteInfo.vote_value)) ? ENABLED : DISABLED)); //trap_SendConsoleCommand(EXEC_APPEND, va("%s %s/n", cvar, level.voteInfo.vote_value)); trap_Cvar_Set(cvar, level.voteInfo.vote_value);}
开发者ID:morsik,项目名称:war-territory,代码行数:9,
示例12: G_StopMapRotation/*===============G_StopMapRotationStop the current map rotation===============*/void G_StopMapRotation( void ){ trap_Cvar_Set( "g_currentMapRotation", va( "%d", NOT_ROTATING ) ); trap_Cvar_Update( &g_currentMapRotation );}
开发者ID:redrumrobot,项目名称:korx,代码行数:12,
示例13: AICast_CheckLoadGame/*==================AICast_CheckLoadGame at the start of a level, the game is either saved, or loaded we must wait for all AI to spawn themselves, and a real client to connect==================*/void AICast_CheckLoadGame( void ) { char loading[4]; gentity_t *ent = NULL; // TTimo: VC6 'may be used without having been init' qboolean ready; cast_state_t *pcs; // have we already done the save or load? if ( !saveGamePending ) { return; } // tell the cgame NOT to render the scene while we are waiting for things to settle trap_Cvar_Set( "cg_norender", "1" ); trap_Cvar_VariableStringBuffer( "savegame_loading", loading, sizeof( loading ) );// reloading = qtrue; trap_Cvar_Set( "g_reloading", "1" ); if ( strlen( loading ) > 0 && atoi( loading ) != 0 ) { // screen should be black if we are at this stage trap_SetConfigstring( CS_SCREENFADE, va( "1 %i 1", level.time - 10 ) );// if (!reloading && atoi(loading) == 2) { if ( !( g_reloading.integer ) && atoi( loading ) == 2 ) { // (SA) hmm, this seems redundant when it sets it above...// reloading = qtrue; // this gets reset at the Map_Restart() since the server unloads the game dll trap_Cvar_Set( "g_reloading", "1" ); } ready = qtrue; if ( numSpawningCast != numcast ) { ready = qfalse; } else if ( !( ent = AICast_FindEntityForName( "player" ) ) ) { ready = qfalse; } else if ( !ent->client || ent->client->pers.connected != CON_CONNECTED ) { ready = qfalse; } if ( ready ) { trap_Cvar_Set( "savegame_loading", "0" ); // in-case it aborts saveGamePending = qfalse; G_LoadGame( NULL ); // always load the "current" savegame // RF, spawn a thinker that will enable rendering after the client has had time to process the entities and setup the display //trap_Cvar_Set( "cg_norender", "0" ); ent = G_Spawn(); ent->nextthink = level.time + 200; ent->think = AICast_EnableRenderingThink; // wait for the clients to return from faded screen //trap_SetConfigstring( CS_SCREENFADE, va("0 %i 1500", level.time + 500) ); trap_SetConfigstring( CS_SCREENFADE, va( "0 %i 750", level.time + 500 ) ); level.reloadPauseTime = level.time + 1100; // make sure sound fades up trap_SendServerCommand( -1, va( "snd_fade 1 %d", 2000 ) ); //----(SA) added AICast_CastScriptThink(); } } else { ready = qtrue; if ( numSpawningCast != numcast ) { ready = qfalse; } else if ( !( ent = AICast_FindEntityForName( "player" ) ) ) { ready = qfalse; } else if ( !ent->client || ent->client->pers.connected != CON_CONNECTED ) { ready = qfalse; } // not loading a game, we must be in a new level, so look for some persistant data to read in, then save the game if ( ready ) { G_LoadPersistant(); // make sure we save the game after we have brought across the items trap_Cvar_Set( "g_totalPlayTime", "0" ); // reset play time trap_Cvar_Set( "g_attempts", "0" ); pcs = AICast_GetCastState( ent->s.number ); pcs->totalPlayTime = 0; pcs->lastLoadTime = 0; pcs->attempts = 0; // RF, disabled, since the pregame menu turns this off after the button is pressed, this isn't // required here // RF, spawn a thinker that will enable rendering after the client has had time to process the entities and setup the display //trap_Cvar_Set( "cg_norender", "0" ); //ent = G_Spawn(); //ent->nextthink = level.time + 200; //ent->think = AICast_EnableRenderingThink; saveGamePending = qfalse;//.........这里部分代码省略.........
开发者ID:MAN-AT-ARMS,项目名称:iortcw-archive,代码行数:101,
示例14: AICast_EnableRenderingThink/*==================AICast_EnableRenderingThink==================*/void AICast_EnableRenderingThink( gentity_t *ent ) { trap_Cvar_Set( "cg_norender", "0" );// trap_S_FadeAllSound(1.0f, 1000); // fade sound up G_FreeEntity( ent );}
开发者ID:MAN-AT-ARMS,项目名称:iortcw-archive,代码行数:10,
示例15: CG_SizeUp_f/*=================CG_SizeUp_fKeybinding command=================*/static void CG_SizeUp_f(){ trap_Cvar_Set( "cg_viewsize", va( "%i", std::min( cg_viewsize.integer + 10, 100 ) ) );}
开发者ID:Unvanquished,项目名称:Unvanquished,代码行数:11,
示例16: G_WriteClientSessionData/*================G_WriteClientSessionDataCalled on game shutdown================*/void G_WriteClientSessionData(gclient_t *client, qboolean restart){#ifdef FEATURE_MULTIVIEW int mvc = G_smvGenerateClientList(g_entities + (client - level.clients));#endif const char *s; // stats reset check //if (level.fResetStats) //{ G_deleteStats(client - level.clients); //}#ifdef FEATURE_MULTIVIEW#ifdef FEATURE_RATING s = va("%i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %f %f %f %f %i %i %i %i %i %i %i %i",#else s = va("%i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i",#endif#else#ifdef FEATURE_RATING s = va("%i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %f %f %f %f %i %i %i %i %i %i",#else s = va("%i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i",#endif#endif client->sess.sessionTeam, client->sess.spectatorTime, client->sess.spectatorState, client->sess.spectatorClient, client->sess.playerType, client->sess.playerWeapon, client->sess.playerWeapon2, client->sess.latchPlayerType, client->sess.latchPlayerWeapon, client->sess.latchPlayerWeapon2, client->sess.coach_team, client->sess.referee, client->sess.spec_invite, client->sess.spec_team, client->sess.kills, client->sess.deaths, client->sess.gibs, client->sess.self_kills, client->sess.team_kills, client->sess.team_gibs, client->sess.time_axis, client->sess.time_allies, client->sess.time_played,#ifdef FEATURE_RATING client->sess.mu, client->sess.sigma, client->sess.oldmu, client->sess.oldsigma,#endif#ifdef FEATURE_MULTIVIEW (mvc & 0xFFFF), ((mvc >> 16) & 0xFFFF),#endif // Damage and rounds played rolled in with weapon stats (below) client->sess.muted, client->sess.ignoreClients[0], client->sess.ignoreClients[1], client->pers.enterTime, restart ? client->sess.spawnObjectiveIndex : 0, client->sess.uci ); trap_Cvar_Set(va("session%i", (int)(client - level.clients)), s); // store the clients stats (7) and medals (7) // addition: but only if it isn't a forced map_restart (done by someone on the console) if (!(restart && !level.warmupTime)) { s = va("%.2f %.2f %.2f %.2f %.2f %.2f %.2f %i %i %i %i %i %i %i", client->sess.skillpoints[0], client->sess.skillpoints[1], client->sess.skillpoints[2], client->sess.skillpoints[3], client->sess.skillpoints[4], client->sess.skillpoints[5], client->sess.skillpoints[6], client->sess.medals[0], client->sess.medals[1], client->sess.medals[2], client->sess.medals[3], client->sess.medals[4], client->sess.medals[5], client->sess.medals[6] );//.........这里部分代码省略.........
开发者ID:belstgut,项目名称:etlegacy,代码行数:101,
示例17: CG_SizeDown_f/*=================CG_SizeDown_fKeybinding command=================*/static void CG_SizeDown_f(){ trap_Cvar_Set( "cg_viewsize", va( "%i", std::max( cg_viewsize.integer - 10, 30 ) ) );}
开发者ID:Unvanquished,项目名称:Unvanquished,代码行数:11,
示例18: CG_PanelButton_EditClickqboolean CG_PanelButton_EditClick( panel_button_t* button, int key ) { if( key == K_MOUSE1 ) { if( !CG_CursorInRect( &button->rect ) && cg_focusButton == button ) { CG_PanelButtons_SetFocusButton( NULL ); if( button->onFinish ) { button->onFinish( button ); } return qfalse; } else { CG_PanelButtons_SetFocusButton( button ); return qtrue; } } else { char buffer[256]; char *s; int len, maxlen; qboolean useCvar = button->data[0] ? qfalse : qtrue; if( useCvar ) { maxlen = sizeof(buffer); trap_Cvar_VariableStringBuffer( button->text, buffer, sizeof(buffer) ); len = strlen( buffer ); } else { maxlen = button->data[0]; s = (char *)button->text; len = strlen( s ); } if( key & K_CHAR_FLAG ) { key &= ~K_CHAR_FLAG; if( key == 'h' - 'a' + 1 ) { // ctrl-h is backspace if( len ) { if( useCvar ) { buffer[len-1] = '/0'; trap_Cvar_Set( button->text, buffer ); } else { s[len-1] = '/0'; } } return qtrue; } if( key < 32 ) { return qtrue; } if( len >= maxlen - 1 ) { return qtrue; } if( useCvar ) { buffer[len] = key; buffer[len+1] = '/0'; trap_Cvar_Set( button->text, buffer ); } else { s[len] = key; s[len+1] = '/0'; } return qtrue; } else { // Gordon: FIXME: have this work with all our stuff (use data[x] to store cursorpos etc)/* if ( key == K_DEL || key == K_KP_DEL ) { if ( item->cursorPos < len ) { memmove( buff + item->cursorPos, buff + item->cursorPos + 1, len - item->cursorPos); DC->setCVar(item->cvar, buff); } return qtrue; }*//* if ( key == K_RIGHTARROW || key == K_KP_RIGHTARROW ) { if (editPtr->maxPaintChars && item->cursorPos >= editPtr->paintOffset + editPtr->maxPaintChars && item->cursorPos < len) { item->cursorPos++; editPtr->paintOffset++; return qtrue; } if (item->cursorPos < len) { item->cursorPos++; } return qtrue; } if ( key == K_LEFTARROW || key == K_KP_LEFTARROW ) { if ( item->cursorPos > 0 ) { item->cursorPos--; } if (item->cursorPos < editPtr->paintOffset) { editPtr->paintOffset--; } return qtrue; } if ( key == K_HOME || key == K_KP_HOME) {// || ( tolower(key) == 'a' && trap_Key_IsDown( K_CTRL ) ) ) { item->cursorPos = 0; editPtr->paintOffset = 0; return qtrue; }//.........这里部分代码省略.........
开发者ID:rabb,项目名称:eth32nix-rabbmod,代码行数:101,
示例19: G_voteSetOnOff//// Several commands to help with cvar setting//void G_voteSetOnOff(const char *desc, const char *cvar) { AP(va("cpm /"^3%s is: ^5%s/n/"", desc, (atoi(level.voteInfo.vote_value)) ? ENABLED : DISABLED)); trap_Cvar_Set(cvar, level.voteInfo.vote_value);}
开发者ID:ETrun,项目名称:ETrun,代码行数:7,
示例20: ClientThink_real/*==============ClientThinkThis will be called once for each client frame, which willusually be a couple times for each server frame on fast clients.If "g_synchronousClients 1" is set, this will be called exactlyonce for each server frame, which makes for smooth demo recording.==============*/void ClientThink_real(gentity_t * ent){ gclient_t *client; pmove_t pm; int oldEventSequence; int msec; usercmd_t *ucmd; int bJumping = 0; client = ent->client; // don't think if the client is not yet connected (and thus not yet spawned in) if (client->pers.connected != CON_CONNECTED) { return; } // mark the time, so the connection sprite can be removed ucmd = &ent->client->pers.cmd; // sanity check the command time to prevent speedup cheating if (ucmd->serverTime > level.time + 200) { ucmd->serverTime = level.time + 200; } if (ucmd->serverTime < level.time - 1000) { ucmd->serverTime = level.time - 1000; } client->lastUpdateFrame = level.framenum; msec = ucmd->serverTime - client->ps.commandTime; // following others may result in bad times, but we still want // to check for follow toggles if (msec < 1 && client->sess.spectatorState != SPECTATOR_FOLLOW) { return; } if (msec > 200) { msec = 200; } if (pmove_msec.integer < 8) { trap_Cvar_Set("pmove_msec", "8"); } else if (pmove_msec.integer > 33) { trap_Cvar_Set("pmove_msec", "33"); } if (pmove_fixed.integer || client->pers.pmoveFixed) { ucmd->serverTime = ((ucmd->serverTime + pmove_msec.integer - 1) / pmove_msec.integer) * pmove_msec.integer; } // // check for exiting intermission // if (level.intermissiontime) { ClientIntermissionThink(client); return; } // spectators don't do much if (client->sess.sessionTeam == TEAM_SPECTATOR) { if (client->sess.spectatorState == SPECTATOR_SCOREBOARD) { return; } SpectatorThink(ent, ucmd); return; } // check for inactivity timer, but never drop the local client of a non-dedicated server if (!ClientInactivityTimer(client)) { return; } // clear the rewards if time if (level.time > client->rewardTime) { client->ps.eFlags &= ~(EF_AWARD_IMPRESSIVE | EF_AWARD_EXCELLENT | EF_AWARD_GAUNTLET | EF_AWARD_ASSIST | EF_AWARD_DEFEND | EF_AWARD_CAP); } if (client->noclip) { client->ps.pm_type = PM_NOCLIP; } else if (client->ps.stats[STAT_HEALTH] <= 0) { client->ps.pm_type = PM_DEAD; } else { client->ps.pm_type = PM_NORMAL; } client->ps.gravity = g_gravity.value; // set speed client->ps.speed = g_speed.value; // set up for pmove oldEventSequence = client->ps.eventSequence;//.........这里部分代码省略.........
开发者ID:Zekom,项目名称:reaction,代码行数:101,
示例21: UI_CalcPostGameStats/*=======================UI_CalcPostGameStats=======================*/static void UI_CalcPostGameStats( void ){ char map[MAX_QPATH]; char fileName[MAX_QPATH]; char info[MAX_INFO_STRING]; fileHandle_t f; int size, game, time, adjustedTime; postGameInfo_t oldInfo; postGameInfo_t newInfo; qboolean newHigh = qfalse; trap_GetConfigString(CS_SERVERINFO, info, sizeof(info)); Q_strncpyz(map, Info_ValueForKey(info, "mapname"), sizeof(map)); game = atoi(Info_ValueForKey(info, "g_gametype")); // compose file name Com_sprintf(fileName, MAX_QPATH, "games/%s_%i.game", map, game); // see if we have one already memset(&oldInfo, 0, sizeof(postGameInfo_t)); if (trap_FS_FOpenFile(fileName, &f, FS_READ) >= 0) { // if so load it size = 0; trap_FS_Read(&size, sizeof(int), f); if (size == sizeof(postGameInfo_t)) { trap_FS_Read(&oldInfo, sizeof(postGameInfo_t), f); } trap_FS_FCloseFile(f); } newInfo.accuracy = atoi(UI_Argv(3)); newInfo.impressives = atoi(UI_Argv(4)); newInfo.excellents = atoi(UI_Argv(5)); newInfo.defends = atoi(UI_Argv(6)); newInfo.assists = atoi(UI_Argv(7)); newInfo.gauntlets = atoi(UI_Argv(8)); newInfo.baseScore = atoi(UI_Argv(9)); newInfo.perfects = atoi(UI_Argv(10)); newInfo.redScore = atoi(UI_Argv(11)); newInfo.blueScore = atoi(UI_Argv(12)); time = atoi(UI_Argv(13)); newInfo.captures = atoi(UI_Argv(14)); newInfo.time = (time - trap_Cvar_VariableValue("ui_matchStartTime")) / 1000; adjustedTime = uiInfo.mapList[ui_currentMap.integer].timeToBeat[game]; if (newInfo.time < adjustedTime) { newInfo.timeBonus = (adjustedTime - newInfo.time) * 10; } else { newInfo.timeBonus = 0; } if (newInfo.redScore > newInfo.blueScore && newInfo.blueScore <= 0) { newInfo.shutoutBonus = 100; } else { newInfo.shutoutBonus = 0; } newInfo.skillBonus = trap_Cvar_VariableValue("g_spSkill"); if (newInfo.skillBonus <= 0) { newInfo.skillBonus = 1; } newInfo.score = newInfo.baseScore + newInfo.shutoutBonus + newInfo.timeBonus; newInfo.score *= newInfo.skillBonus; // see if the score is higher for this one newHigh = (newInfo.redScore > newInfo.blueScore && newInfo.score > oldInfo.score); if (newHigh) { // if so write out the new one uiInfo.newHighScoreTime = uiInfo.uiDC.realTime + 20000; if (trap_FS_FOpenFile(fileName, &f, FS_WRITE) >= 0) { size = sizeof(postGameInfo_t); trap_FS_Write(&size, sizeof(int), f); trap_FS_Write(&newInfo, sizeof(postGameInfo_t), f); trap_FS_FCloseFile(f); } } if (newInfo.time < oldInfo.time) { uiInfo.newBestTime = uiInfo.uiDC.realTime + 20000; } // put back all the ui overrides trap_Cvar_Set("capturelimit", UI_Cvar_VariableString("ui_saveCaptureLimit")); trap_Cvar_Set("fraglimit", UI_Cvar_VariableString("ui_saveFragLimit")); trap_Cvar_Set("cg_drawTimer", UI_Cvar_VariableString("ui_drawTimer")); trap_Cvar_Set("g_doWarmup", UI_Cvar_VariableString("ui_doWarmup")); trap_Cvar_Set("g_Warmup", UI_Cvar_VariableString("ui_Warmup")); trap_Cvar_Set("sv_pure", UI_Cvar_VariableString("ui_pure")); trap_Cvar_Set("g_friendlyFire", UI_Cvar_VariableString("ui_friendlyFire")); UI_SetBestScores(&newInfo, qtrue); UI_ShowPostGame(newHigh);}
开发者ID:Zekom,项目名称:reaction,代码行数:98,
示例22: G_ParseCampaignsvoid G_ParseCampaigns(void){ int i; qboolean mapFound = qfalse; level.campaignCount = 0; level.currentCampaign = -1; memset(&g_campaigns, 0, sizeof(g_campaignInfo_t) * MAX_CAMPAIGNS); if (g_gametype.integer != GT_WOLF_CAMPAIGN) { trap_Cvar_Set("g_oldCampaign", ""); trap_Cvar_Set("g_currentCampaign", ""); trap_Cvar_Set("g_currentCampaignMap", "0"); return; } if (g_campaignFile.string[0]) { if (G_LoadCampaignsFromFile(g_campaignFile.string)) { mapFound = qtrue; } } if (!mapFound) { // get all campaigns from .campaign files int dirlen; int numdirs = trap_FS_GetFileList("scripts", ".campaign", bigTextBuffer, sizeof(bigTextBuffer)); char filename[MAX_QPATH]; // was 128 char *dirptr = bigTextBuffer; for (i = 0; i < numdirs; i++, dirptr += dirlen + 1) { // log a warning if server has more than MAX_CAMPAIGNS if (level.campaignCount >= MAX_CAMPAIGNS) { G_LogPrintf("WARNING G_ParseCampaigns: number of campaigns larger then MAX_CAMPAIGNS/n"); break; } dirlen = strlen(dirptr); strcpy(filename, "scripts/"); strcat(filename, dirptr); if (G_LoadCampaignsFromFile(filename)) { mapFound = qtrue; } } } if (!mapFound) { // map isn't found in the current campaign, see if it's the first map in another campaign for (i = 0; i < level.campaignCount; i++) { if (!Q_stricmp(g_campaigns[i].mapnames[0], level.rawmapname)) { // someone manually specified a /map command, and it's the first map in a campaign trap_Cvar_Set("g_currentCampaign", g_campaigns[i].shortname); trap_Cvar_Set("g_currentCampaignMap", "0"); level.newCampaign = qtrue; g_campaigns[level.campaignCount].current = 0; level.currentCampaign = i; break; } } if (i == level.campaignCount) { char buf[MAX_STRING_CHARS]; if (trap_Argc() < 1) // command not found, throw error { G_Error("Usage 'map <mapname>/n'"); } trap_Argv(0, buf, sizeof(buf)); if (!(*buf)) // command not found, throw error { G_Error("Usage 'map <mapname>/n'"); } // no campaign found, fallback to GT_WOLF // and reload the map trap_Cvar_Set("g_gametype", "2"); trap_SendConsoleCommand(EXEC_APPEND, va("%s %s/n", buf, level.rawmapname)); } }}
开发者ID:dstaesse,项目名称:etlegacy,代码行数:96,
示例23: ErrorMessage_KeysfxHandle_t ErrorMessage_Key(int key){ trap_Cvar_Set( "com_errorMessage", "" ); UI_MainMenu(); return (menu_null_sound);}
开发者ID:coltongit,项目名称:mint-arena-demotest-work,代码行数:6,
示例24: CG_LimboPanel_NameEditFinishvoid CG_LimboPanel_NameEditFinish(panel_button_t *button) { char buffer[256]; trap_Cvar_VariableStringBuffer(button->text, buffer, 256); trap_Cvar_Set("name", buffer);}
开发者ID:ETrun,项目名称:ETrun,代码行数:6,
示例25: CG_CalcViewValues/*===============CG_CalcViewValuesSets cg.refdef view values===============*/static int CG_CalcViewValues( void ) { playerState_t *ps; memset( &cg.refdef, 0, sizeof( cg.refdef ) ); // strings for in game rendering // Q_strncpyz( cg.refdef.text[0], "Park Ranger", sizeof(cg.refdef.text[0]) ); // Q_strncpyz( cg.refdef.text[1], "19", sizeof(cg.refdef.text[1]) ); // calculate size of 3D view CG_CalcVrect(); ps = &cg.predictedPlayerState; if (cg.cameraMode) { vec3_t origin, angles; float fov = 90; float x; if (trap_getCameraInfo(CAM_PRIMARY, cg.time, &origin, &angles, &fov)) { VectorCopy(origin, cg.refdef.vieworg); angles[ROLL] = 0; angles[PITCH] = -angles[PITCH]; // (SA) compensate for reversed pitch (this makes the game match the editor, however I'm guessing the real fix is to be done there) VectorCopy(angles, cg.refdefViewAngles); AnglesToAxis( cg.refdefViewAngles, cg.refdef.viewaxis ); x = cg.refdef.width / tan( fov / 360 * M_PI ); cg.refdef.fov_y = atan2( cg.refdef.height, x ); cg.refdef.fov_y = cg.refdef.fov_y * 360 / M_PI; cg.refdef.fov_x = fov; trap_SendClientCommand(va("setCameraOrigin %f %f %f", origin[0], origin[1], origin[2])); return 0; } else { cg.cameraMode = qfalse; trap_Cvar_Set( "cg_letterbox", "0" ); trap_SendClientCommand("stopCamera"); CG_Fade(0, 0, 0, 255, 0); // go black CG_Fade(0, 0, 0, 0, 1500); // then fadeup } } // intermission view if ( ps->pm_type == PM_INTERMISSION ) { VectorCopy( ps->origin, cg.refdef.vieworg ); VectorCopy( ps->viewangles, cg.refdefViewAngles ); AnglesToAxis( cg.refdefViewAngles, cg.refdef.viewaxis ); return CG_CalcFov(); } cg.bobcycle = ( ps->bobCycle & 128 ) >> 7; cg.bobfracsin = fabs( sin( ( ps->bobCycle & 127 ) / 127.0 * M_PI ) ); cg.xyspeed = sqrt( ps->velocity[0] * ps->velocity[0] + ps->velocity[1] * ps->velocity[1] ); VectorCopy( ps->origin, cg.refdef.vieworg ); VectorCopy( ps->viewangles, cg.refdefViewAngles ); // add error decay if ( cg_errorDecay.value > 0 ) { int t; float f; t = cg.time - cg.predictedErrorTime; f = ( cg_errorDecay.value - t ) / cg_errorDecay.value; if ( f > 0 && f < 1 ) { VectorMA( cg.refdef.vieworg, f, cg.predictedError, cg.refdef.vieworg ); } else { cg.predictedErrorTime = 0; } } // Ridah, lock the viewangles if the game has told us to if (ps->viewlocked) { /* if (ps->viewlocked == 4) { centity_t *tent; tent = &cg_entities[ps->viewlocked_entNum]; VectorCopy (tent->currentState.apos.trBase, cg.refdefViewAngles); } else */ // DHM - Nerve :: don't bother evaluating if set to 7 (look at medic) if ( ps->viewlocked != 7 ) BG_EvaluateTrajectory( &cg_entities[ps->viewlocked_entNum].currentState.apos, cg.time, cg.refdefViewAngles ); if (ps->viewlocked == 2) { cg.refdefViewAngles[0] += crandom ();//.........这里部分代码省略.........
开发者ID:natelo,项目名称:rtcwPub,代码行数:101,
示例26: trap_Cvar_CopyValue_ivoid trap_Cvar_CopyValue_i(const char *in_var, const char *out_var){ int v1 = trap_Cvar_VariableValue(in_var); trap_Cvar_Set(out_var, va("%i", v1));}
开发者ID:morsik,项目名称:warpig,代码行数:5,
示例27: CG_KickAngles/*================CG_KickAngles================*/void CG_KickAngles(void) { const vec3_t centerSpeed = {2400, 2400, 2400}; const float recoilCenterSpeed = 200; const float recoilIgnoreCutoff = 15; const float recoilMaxSpeed = 50; const vec3_t maxKickAngles = {10,10,10}; float idealCenterSpeed, kickChange; int i, frametime, t; float ft; #define STEP 20 char buf[32]; // NERVE - SMF // this code is frametime-dependant, so split it up into small chunks //cg.kickAngles[PITCH] = 0; cg.recoilPitchAngle = 0; for (t=cg.frametime; t>0; t-=STEP) { if (t > STEP) frametime = STEP; else frametime = t; ft = ((float)frametime/1000); // kickAngles is spring-centered for (i=0; i<3; i++) { if (cg.kickAVel[i] || cg.kickAngles[i]) { // apply centering forces to kickAvel if (cg.kickAngles[i] && frametime) { idealCenterSpeed = -(2.0*(cg.kickAngles[i] > 0) - 1.0) * centerSpeed[i]; if (idealCenterSpeed) { cg.kickAVel[i] += idealCenterSpeed * ft; } } // add the kickAVel to the kickAngles kickChange = cg.kickAVel[i] * ft; if (cg.kickAngles[i] && (cg.kickAngles[i] < 0) != (kickChange < 0)) // slower when returning to center kickChange *= 0.06; // check for crossing back over the center point if (!cg.kickAngles[i] || ((cg.kickAngles[i] + kickChange) < 0) == (cg.kickAngles[i] < 0)) { cg.kickAngles[i] += kickChange; if (!cg.kickAngles[i] && frametime) { cg.kickAVel[i] = 0; } else if (fabs(cg.kickAngles[i]) > maxKickAngles[i]) { cg.kickAngles[i] = maxKickAngles[i] * ((2*(cg.kickAngles[i]>0))-1); cg.kickAVel[i] = 0; // force Avel to return us to center rather than keep going outside range } } else { // about to cross, so just zero it out cg.kickAngles[i] = 0; cg.kickAVel[i] = 0; } } } // recoil is added to input viewangles per frame if (cg.recoilPitch) { // apply max recoil if (fabs(cg.recoilPitch) > recoilMaxSpeed) { if (cg.recoilPitch > 0) cg.recoilPitch = recoilMaxSpeed; else cg.recoilPitch = -recoilMaxSpeed; } // apply centering forces to kickAvel if (frametime) { idealCenterSpeed = -(2.0*(cg.recoilPitch > 0) - 1.0) * recoilCenterSpeed * ft; if (idealCenterSpeed) { if (fabs(idealCenterSpeed) < fabs(cg.recoilPitch)) { cg.recoilPitch += idealCenterSpeed; } else { // back zero out cg.recoilPitch = 0; } } } } if (fabs(cg.recoilPitch) > recoilIgnoreCutoff) { cg.recoilPitchAngle += cg.recoilPitch*ft; } } // NERVE - SMF - only change cg_recoilPitch cvar when we need to trap_Cvar_VariableStringBuffer( "cg_recoilPitch", buf, sizeof( buf ) ); if ( atof( buf ) != cg.recoilPitchAngle ) { // encode the kick angles into a 24bit number, for sending to the client exe trap_Cvar_Set( "cg_recoilPitch", va("%f", cg.recoilPitchAngle) ); }}
开发者ID:natelo,项目名称:rtcwPub,代码行数:92,
示例28: BotAIStartFrame/*==================BotAIStartFrame==================*/int BotAIStartFrame( int time ) { int i; gentity_t *ent; bot_entitystate_t state; //entityState_t entitystate; //vec3_t mins = {-15, -15, -24}, maxs = {15, 15, 32}; int elapsed_time, thinktime; static int local_time; static int botlib_residual; static int lastbotthink_time; if ( g_gametype.integer != GT_SINGLE_PLAYER ) { G_CheckBotSpawn(); } trap_Cvar_Update( &bot_rocketjump ); trap_Cvar_Update( &bot_grapple ); trap_Cvar_Update( &bot_fastchat ); trap_Cvar_Update( &bot_nochat ); trap_Cvar_Update( &bot_testrchat ); trap_Cvar_Update( &bot_thinktime ); // Ridah, set the default AAS world trap_AAS_SetCurrentWorld( 0 ); trap_Cvar_Update( &memorydump ); if ( memorydump.integer ) { trap_BotLibVarSet( "memorydump", "1" ); trap_Cvar_Set( "memorydump", "0" ); } //if the bot think time changed we should reschedule the bots if ( bot_thinktime.integer != lastbotthink_time ) { lastbotthink_time = bot_thinktime.integer; BotScheduleBotThink(); } elapsed_time = time - local_time; local_time = time; botlib_residual += elapsed_time; if ( elapsed_time > bot_thinktime.integer ) { thinktime = elapsed_time; } else { thinktime = bot_thinktime.integer;} // update the bot library if ( botlib_residual >= thinktime ) { botlib_residual -= thinktime; trap_BotLibStartFrame( (float) time / 1000 ); // Ridah, only check the default world trap_AAS_SetCurrentWorld( 0 ); if ( !trap_AAS_Initialized() ) { return BLERR_NOERROR; } //update entities in the botlib for ( i = 0; i < MAX_GENTITIES; i++ ) { // Ridah, in single player, we only need client entity information if ( g_gametype.integer == GT_SINGLE_PLAYER && i > level.maxclients ) { break; } ent = &g_entities[i]; if ( !ent->inuse ) { continue; } if ( !ent->r.linked ) { continue; } if ( ent->r.svFlags & SVF_NOCLIENT ) { continue; } if ( ent->aiInactive ) { continue; } // memset( &state, 0, sizeof( bot_entitystate_t ) ); // VectorCopy( ent->r.currentOrigin, state.origin ); VectorCopy( ent->r.currentAngles, state.angles ); VectorCopy( ent->s.origin2, state.old_origin ); VectorCopy( ent->r.mins, state.mins ); VectorCopy( ent->r.maxs, state.maxs ); state.type = ent->s.eType; state.flags = ent->s.eFlags; if ( ent->r.bmodel ) { state.solid = SOLID_BSP; } else { state.solid = SOLID_BBOX;} state.groundent = ent->s.groundEntityNum; state.modelindex = ent->s.modelindex; state.modelindex2 = ent->s.modelindex2;//.........这里部分代码省略.........
开发者ID:MAN-AT-ARMS,项目名称:iortcw-archive,代码行数:101,
示例29: CG_SizeDown_f/*=================CG_SizeDown_fKeybinding command=================*/static void CG_SizeDown_f (void) { trap_Cvar_Set("cg_viewsize", va("%i",(int)(cg_viewsize.integer-10)));}
开发者ID:bnoordhuis,项目名称:entityplus,代码行数:10,
示例30: CG_DrawActiveFrame//.........这里部分代码省略......... CG_ProcessSnapshots(); // if we haven't received any snapshots yet, all // we can draw is the information screen if ( !cg.snap || ( cg.snap->snapFlags & SNAPFLAG_NOT_ACTIVE ) ) {// loadingscreen#ifdef SCRIPTHUD CG_DrawLoadingScreen( );#else CG_DrawInformation();#endif// end loadingscreen return; } // let the client system know what our weapon and zoom settings are trap_SetUserCmdValue( cg.weaponSelect, cg.zoomSensitivity ); // this counter will be bumped for every valid scene we generate cg.clientFrame++; // update cg.predictedPlayerState CG_PredictPlayerState(); // decide on third person view if (!cg_deathcam.integer) // leilei - allow first person deathcam cg.renderingThirdPerson = cg_thirdPerson.integer; else cg.renderingThirdPerson = cg_thirdPerson.integer || (cg.snap->ps.stats[STAT_HEALTH] <= 0); // build cg.refdef inwater = CG_CalcViewValues(); // first person blend blobs, done after AnglesToAxis if ( !cg.renderingThirdPerson ) { CG_DamageBlendBlob(); } // build the render lists if ( !cg.hyperspace ) { CG_AddPacketEntities(); // adter calcViewValues, so predicted player state is correct CG_AddMarks(); CG_AddLocalEntities(); } CG_AddViewWeapon( &cg.predictedPlayerState ); // add buffered sounds CG_PlayBufferedSounds(); // play buffered voice chats CG_PlayBufferedVoiceChats(); // finish up the rest of the refdef if ( cg.testModelEntity.hModel ) { CG_AddTestModel(); } cg.refdef.time = cg.time; memcpy( cg.refdef.areamask, cg.snap->areamask, sizeof( cg.refdef.areamask ) ); // warning sounds when powerup is wearing off CG_PowerupTimerSounds(); // update audio positions trap_S_Respatialize( cg.snap->ps.clientNum, cg.refdef.vieworg, cg.refdef.viewaxis, inwater ); // make sure the lagometerSample and frame timing isn't done twice when in stereo if ( stereoView != STEREO_RIGHT ) { cg.frametime = cg.time - cg.oldTime; if ( cg.frametime < 0 ) { cg.frametime = 0; } cg.oldTime = cg.time; CG_AddLagometerFrameInfo(); } if (cg_timescale.value != cg_timescaleFadeEnd.value) { if (cg_timescale.value < cg_timescaleFadeEnd.value) { cg_timescale.value += cg_timescaleFadeSpeed.value * ((float)cg.frametime) / 1000; if (cg_timescale.value > cg_timescaleFadeEnd.value) cg_timescale.value = cg_timescaleFadeEnd.value; } else { cg_timescale.value -= cg_timescaleFadeSpeed.value * ((float)cg.frametime) / 1000; if (cg_timescale.value < cg_timescaleFadeEnd.value) cg_timescale.value = cg_timescaleFadeEnd.value; } if (cg_timescaleFadeSpeed.value) { trap_Cvar_Set("timescale", va("%f", cg_timescale.value)); } } // actually issue the rendering calls CG_DrawActive( stereoView ); if ( cg_stats.integer ) { CG_Printf( "cg.clientFrame:%i/n", cg.clientFrame ); }}
开发者ID:OpenArena,项目名称:leixperimental,代码行数:101,
注:本文中的trap_Cvar_Set函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ trap_Cvar_SetValue函数代码示例 C++ trap_Cvar_Register函数代码示例 |