本文整理汇总了C++中Cvar_ForceSet函数的典型用法代码示例。如果您正苦于以下问题:C++ Cvar_ForceSet函数的具体用法?C++ Cvar_ForceSet怎么用?C++ Cvar_ForceSet使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Cvar_ForceSet函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CL_LocPlace
void CL_LocPlace (void)
{
trace_t tr;
vec3_t end;
short there[3];
int index1, index2 = -1;
index1 = CL_LocIndex(cl.frame.playerstate.pmove.origin);
VectorMA(cl.predicted_origin, 8192, cl.v_forward, end);
tr = CM_BoxTrace(cl.predicted_origin, end, vec3_origin, vec3_origin, 0, MASK_PLAYERSOLID);
there[0] = tr.endpos[0] * 8;
there[1] = tr.endpos[1] * 8;
there[2] = tr.endpos[2] * 8;
index2 = CL_LocIndex(there);
if (index1 != -1)
Cvar_ForceSet("loc_here", locations[index1].name);
else
Cvar_ForceSet("loc_here", "");
if (index2 != -1)
Cvar_ForceSet("loc_there", locations[index2].name);
else
Cvar_ForceSet("loc_there", "");
}
示例2: R_Bloom_InitEffectTexture
/*
* R_Bloom_InitEffectTexture
*/
static void R_Bloom_InitEffectTexture( void )
{
qbyte *data;
int limit;
if( r_bloom_sample_size->integer < 32 )
Cvar_ForceSet( "r_bloom_sample_size", "32" );
// make sure bloom size doesn't have stupid values
limit = min( r_bloom_sample_size->integer, min( screen_texture_width, screen_texture_height ) );
if( glConfig.ext.texture_non_power_of_two )
BLOOM_SIZE = limit;
else // make sure bloom size is a power of 2
for( BLOOM_SIZE = 32; (BLOOM_SIZE<<1) <= limit; BLOOM_SIZE <<= 1 );
if( BLOOM_SIZE != r_bloom_sample_size->integer )
Cvar_ForceSet( "r_bloom_sample_size", va( "%i", BLOOM_SIZE ) );
data = Mem_TempMalloc( BLOOM_SIZE * BLOOM_SIZE * 4 );
memset( data, 0, BLOOM_SIZE * BLOOM_SIZE * 4 );
r_bloomeffecttexture = R_LoadPic( "***r_bloomeffecttexture***", &data, BLOOM_SIZE, BLOOM_SIZE, IT_CLAMP|IT_NOMIPMAP|IT_NOCOMPRESS|IT_NOPICMIP, 3 );
Mem_TempFree( data );
}
示例3: CL_StopServerDownload
/*
* CL_StopServerDownload
*/
void CL_StopServerDownload( void )
{
if( cls.download.filenum > 0 ) {
FS_FCloseFile( cls.download.filenum );
cls.download.filenum = 0;
}
if( cls.download.cancelled ) {
FS_RemoveBaseFile( cls.download.tempname );
}
Mem_ZoneFree( cls.download.name );
cls.download.name = NULL;
Mem_ZoneFree( cls.download.tempname );
cls.download.tempname = NULL;
cls.download.offset = 0;
cls.download.size = 0;
cls.download.percent = 0;
cls.download.timeout = 0;
cls.download.retries = 0;
cls.download.web = qfalse;
Cvar_ForceSet( "cl_download_name", "" );
Cvar_ForceSet( "cl_download_percent", "0" );
}
示例4: Con_SetMessageModeCvar
/*
* Con_SetMessageModeCvar
*
* Called from CL_SetKeyDest
*/
void Con_SetMessageModeCvar( void )
{
if( cls.key_dest == key_message )
Cvar_ForceSet( "con_messageMode", chat_team ? "2" : "1" );
else
Cvar_ForceSet( "con_messageMode", "0" );
}
示例5: SV_MOTD_LoadFromFile
/*
* SV_MOTD_LoadFromFile
*
* Attempts to load the MOTD from sv_MOTDFile, on success sets
* sv_MOTDString.
*/
void SV_MOTD_LoadFromFile( void )
{
char *f;
FS_LoadFile( sv_MOTDFile->string, (void **)&f, NULL, 0 );
if( !f )
{
Com_Printf( "Couldn't load MOTD file: %s\n", sv_MOTDFile->string );
Cvar_ForceSet( "sv_MOTDFile", "" );
SV_MOTD_SetMOTD( "" );
return;
}
if( strchr( f, '"' ) ) // FIXME: others?
{
Com_Printf( "Warning: MOTD file contains illegal characters.\n" );
Cvar_ForceSet( "sv_MOTDFile", "" );
SV_MOTD_SetMOTD( "" );
}
else
{
SV_MOTD_SetMOTD( f );
}
FS_FreeFile( f );
}
示例6: SV_AntiCheat_ParseBuffer
static void SV_AntiCheat_ParseBuffer (void)
{
byte *buff;
int bufflen;
if (!packetLen)
return;
buff = packetBuffer;
bufflen = packetLen;
Com_DPrintf ("Anticheat packet type %d\n", buff[0]);
switch (buff[0])
{
case ACS_VIOLATION:
SV_AntiCheat_ParseViolation (buff + 1, bufflen - 1);
break;
case ACS_CLIENTACK:
SV_AntiCheat_ParseClientAck (buff + 1, bufflen - 1);
break;
case ACS_FILE_VIOLATION:
SV_AntiCheat_ParseFileViolation (buff + 1, bufflen - 1);
break;
case ACS_READY:
SV_AntiCheat_ParseReady ();
break;
case ACS_QUERYREPLY:
SV_AntiCheat_ParseQueryReply (buff + 1, bufflen - 1);
break;
case ACS_ERROR:
Com_Printf ("ANTICHEAT ERROR: %s\n", LOG_ANTICHEAT|LOG_ERROR|LOG_SERVER, buff + 1);
SV_AntiCheat_Disconnect ();
Cvar_ForceSet ("sv_anticheat_required", "0");
break;
case ACS_NOACCESS:
Com_Printf ("ANTICHEAT WARNING: You do not have permission to use the anticheat server. Anticheat disabled.\n", LOG_ANTICHEAT|LOG_WARNING|LOG_SERVER);
SV_AntiCheat_Disconnect ();
Cvar_ForceSet ("sv_anticheat_required", "0");
break;
case ACS_UPDATE_REQUIRED:
Com_Printf ("ANTICHEAT WARNING: The anticheat server is no longer compatible with this version of R1Q2. Please make sure you are using the latest R1Q2 server version. Anticheat disabled.\n", LOG_ANTICHEAT|LOG_WARNING|LOG_SERVER);
SV_AntiCheat_Disconnect ();
Cvar_ForceSet ("sv_anticheat_required", "0");
break;
case ACS_DISCONNECT:
SV_AntiCheat_ParseDisconnect (buff + 1, bufflen - 1);
break;
case ACS_PONG:
ping_pending = false;
break;
default:
Com_Printf ("ANTICHEAT ERROR: Unknown command byte %d, please make sure you are using the latest R1Q2 server version. Anticheat disabled.\n", LOG_ANTICHEAT|LOG_WARNING|LOG_SERVER, buff[0]);
SV_AntiCheat_Disconnect ();
Cvar_ForceSet ("sv_anticheat_required", "0");
break;
}
}
示例7: prepareVideoRefresh
static void prepareVideoRefresh( void )
{
// set the right mode for refresh
Cvar_ForceSet( "vid_ref", "gl" );
Cvar_ForceSet( "gl_driver", "opengl32" );
// tell them they're modified so they refresh
vid_ref->modified = true;
}
示例8: CL_CharacterSkillAndScoreCvars
/**
* @todo: replace this cvar hell with confuncs
*/
static void CL_CharacterSkillAndScoreCvars (const character_t* chr)
{
const chrScoreGlobal_t* score = &chr->score;
Cvar_ForceSet("mn_name", chr->name);
Cvar_ForceSet("mn_body", CHRSH_CharGetBody(chr));
Cvar_ForceSet("mn_head", CHRSH_CharGetHead(chr));
Cvar_ForceSet("mn_body_skin", va("%i", chr->bodySkin));
Cvar_ForceSet("mn_head_skin", va("%i", chr->headSkin));
Cvar_SetValue("mn_vpwr", score->skills[ABILITY_POWER]);
Cvar_SetValue("mn_vspd", score->skills[ABILITY_SPEED]);
Cvar_SetValue("mn_vacc", score->skills[ABILITY_ACCURACY]);
Cvar_SetValue("mn_vmnd", score->skills[ABILITY_MIND]);
Cvar_SetValue("mn_vcls", score->skills[SKILL_CLOSE]);
Cvar_SetValue("mn_vhvy", score->skills[SKILL_HEAVY]);
Cvar_SetValue("mn_vass", score->skills[SKILL_ASSAULT]);
Cvar_SetValue("mn_vsnp", score->skills[SKILL_SNIPER]);
Cvar_SetValue("mn_vexp", score->skills[SKILL_EXPLOSIVE]);
Cvar_SetValue("mn_vpil", score->skills[SKILL_PILOTING]);
Cvar_SetValue("mn_vtar", score->skills[SKILL_TARGETING]);
Cvar_SetValue("mn_vevad", score->skills[SKILL_EVADING]);
Cvar_SetValue("mn_vpwri", score->initialSkills[ABILITY_POWER]);
Cvar_SetValue("mn_vspdi", score->initialSkills[ABILITY_SPEED]);
Cvar_SetValue("mn_vacci", score->initialSkills[ABILITY_ACCURACY]);
Cvar_SetValue("mn_vmndi", score->initialSkills[ABILITY_MIND]);
Cvar_SetValue("mn_vclsi", score->initialSkills[SKILL_CLOSE]);
Cvar_SetValue("mn_vhvyi", score->initialSkills[SKILL_HEAVY]);
Cvar_SetValue("mn_vassi", score->initialSkills[SKILL_ASSAULT]);
Cvar_SetValue("mn_vsnpi", score->initialSkills[SKILL_SNIPER]);
Cvar_SetValue("mn_vexpi", score->initialSkills[SKILL_EXPLOSIVE]);
Cvar_SetValue("mn_vpili", score->initialSkills[SKILL_PILOTING]);
Cvar_SetValue("mn_vtari", score->initialSkills[SKILL_TARGETING]);
Cvar_SetValue("mn_vevadi", score->initialSkills[SKILL_EVADING]);
Cvar_SetValue("mn_vhp", chr->HP);
Cvar_SetValue("mn_vhpmax", chr->maxHP);
Cvar_Set("mn_tpwr", "%s (%i)", CL_ActorGetSkillString(score->skills[ABILITY_POWER]), score->skills[ABILITY_POWER]);
Cvar_Set("mn_tspd", "%s (%i)", CL_ActorGetSkillString(score->skills[ABILITY_SPEED]), score->skills[ABILITY_SPEED]);
Cvar_Set("mn_tacc", "%s (%i)", CL_ActorGetSkillString(score->skills[ABILITY_ACCURACY]), score->skills[ABILITY_ACCURACY]);
Cvar_Set("mn_tmnd", "%s (%i)", CL_ActorGetSkillString(score->skills[ABILITY_MIND]), score->skills[ABILITY_MIND]);
Cvar_Set("mn_tcls", "%s (%i)", CL_ActorGetSkillString(score->skills[SKILL_CLOSE]), score->skills[SKILL_CLOSE]);
Cvar_Set("mn_thvy", "%s (%i)", CL_ActorGetSkillString(score->skills[SKILL_HEAVY]), score->skills[SKILL_HEAVY]);
Cvar_Set("mn_tass", "%s (%i)", CL_ActorGetSkillString(score->skills[SKILL_ASSAULT]), score->skills[SKILL_ASSAULT]);
Cvar_Set("mn_tsnp", "%s (%i)", CL_ActorGetSkillString(score->skills[SKILL_SNIPER]), score->skills[SKILL_SNIPER]);
Cvar_Set("mn_texp", "%s (%i)", CL_ActorGetSkillString(score->skills[SKILL_EXPLOSIVE]), score->skills[SKILL_EXPLOSIVE]);
Cvar_Set("mn_tpil", "%s (%i)", CL_ActorGetSkillString(score->skills[SKILL_PILOTING]), score->skills[SKILL_PILOTING]);
Cvar_Set("mn_ttar", "%s (%i)", CL_ActorGetSkillString(score->skills[SKILL_TARGETING]), score->skills[SKILL_TARGETING]);
Cvar_Set("mn_tevad", "%s (%i)", CL_ActorGetSkillString(score->skills[SKILL_EVADING]), score->skills[SKILL_EVADING]);
Cvar_Set("mn_thp", "%i (%i)", chr->HP, chr->maxHP);
}
示例9: SV_ReloadPureList
/*
* SV_ReloadPureList
*/
static void SV_ReloadPureList( void ) {
char **paks;
int i, numpaks;
Com_FreePureList( &svs.purelist );
// game modules
if( sv_pure_forcemodulepk3->string[0] ) {
if( Q_strnicmp( COM_FileBase( sv_pure_forcemodulepk3->string ), "modules", strlen( "modules" ) ) ||
!FS_IsPakValid( sv_pure_forcemodulepk3->string, NULL ) ) {
Com_Printf( "Warning: Invalid value for sv_pure_forcemodulepk3, disabling\n" );
Cvar_ForceSet( "sv_pure_forcemodulepk3", "" );
} else {
SV_AddPurePak( sv_pure_forcemodulepk3->string );
}
}
if( !sv_pure_forcemodulepk3->string[0] ) {
char *libname;
int libname_size;
libname_size = strlen( LIB_PREFIX ) + 5 + strlen( ARCH ) + strlen( LIB_SUFFIX ) + 1;
libname = Mem_TempMalloc( libname_size );
Q_snprintfz( libname, libname_size, LIB_PREFIX "game_" ARCH LIB_SUFFIX );
if( !FS_PakNameForFile( libname ) ) {
if( sv_pure->integer ) {
Com_Printf( "Warning: Game module not in pk3, disabling pure mode\n" );
Com_Printf( "sv_pure_forcemodulepk3 can be used to force the pure system to use a different module\n" );
Cvar_ForceSet( "sv_pure", "0" );
}
} else {
SV_AddPureFile( libname );
}
Mem_TempFree( libname );
libname = NULL;
}
// *pure.(pk3|pak)
paks = NULL;
numpaks = FS_GetExplicitPurePakList( &paks );
if( numpaks ) {
for( i = 0; i < numpaks; i++ ) {
SV_AddPurePak( paks[i] );
Mem_ZoneFree( paks[i] );
}
Mem_ZoneFree( paks );
}
}
示例10: GL_Init
/*
===============
GL_Init
===============
*/
void GL_Init (void)
{
gl_vendor = glGetString (GL_VENDOR);
Com_Printf ("GL_VENDOR: %s\n", gl_vendor);
gl_renderer = glGetString (GL_RENDERER);
Com_Printf ("GL_RENDERER: %s\n", gl_renderer);
gl_version = glGetString (GL_VERSION);
Com_Printf ("GL_VERSION: %s\n", gl_version);
gl_extensions = glGetString (GL_EXTENSIONS);
// Com_Printf ("GL_EXTENSIONS: %s\n", gl_extensions);
Cvar_Register (&gl_strings);
Cvar_ForceSet (&gl_strings, va("GL_VENDOR: %s\nGL_RENDERER: %s\n"
"GL_VERSION: %s\nGL_EXTENSIONS: %s", gl_vendor, gl_renderer, gl_version, gl_extensions));
glClearColor (1,0,0,0);
glCullFace(GL_FRONT);
glEnable(GL_TEXTURE_2D);
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, 0.666);
glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
glShadeModel (GL_FLAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
// glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
}
示例11: UI_TabNodeInit
/** called when the window is pushed
* check cvar then, reduce runtime check
* @todo move cvar check to AbstractOption
*/
static void UI_TabNodeInit (uiNode_t *node, linkedList_t *params)
{
const char *cvarName;
/* no cvar given? */
if (!(EXTRADATA(node).cvar))
return;
/* not a cvar? */
if (!Q_strstart(EXTRADATA(node).cvar, "*cvar:")) {
/* normalize */
Com_Printf("UI_TabNodeInit: node '%s' doesn't have a valid cvar assigned (\"%s\" read)\n", UI_GetPath(node), EXTRADATA(node).cvar);
EXTRADATA(node).cvar = NULL;
return;
}
/* cvar do not exists? */
cvarName = &EXTRADATA(node).cvar[6];
if (Cvar_FindVar(cvarName) == NULL) {
/* search default value, if possible */
uiNode_t* option = node->firstChild;
assert(option->behaviour == ui_optionBehaviour);
Cvar_ForceSet(cvarName, OPTIONEXTRADATA(option).value);
}
}
示例12: UI_TextEntryNodeEdit
/**
* @brief edit the current cvar with a char
*/
static void UI_TextEntryNodeEdit (uiNode_t* node, unsigned int unicode)
{
char buffer[MAX_CVAR_EDITING_LENGTH];
/* copy the cvar */
Q_strncpyz(buffer, editedCvar->string, sizeof(buffer));
/* compute result */
if (unicode == K_BACKSPACE) {
if (EXTRADATA(node).cursorPosition > 0){
UTF8_delete_char_at(buffer, EXTRADATA(node).cursorPosition - 1);
EXTRADATA(node).cursorPosition--;
}
} else if (unicode == K_DEL) {
if (EXTRADATA(node).cursorPosition < UTF8_strlen(editedCvar->string)){
UTF8_delete_char_at(buffer, EXTRADATA(node).cursorPosition);
}
} else {
int length = strlen(buffer);
int charLength = UTF8_encoded_len(unicode);
/* is buffer full? */
if (length + charLength >= sizeof(buffer))
return;
int insertedLength = UTF8_insert_char_at(buffer, sizeof(buffer), EXTRADATA(node).cursorPosition, unicode);
if (insertedLength > 0)
EXTRADATA(node).cursorPosition++;
}
/* update the cvar */
Cvar_ForceSet(editedCvar->name, buffer);
}
示例13: Cl_Record_f
/*
* Cl_Record_f
*
* record <demo name>
*
* Begin recording a demo from the current frame until `stop` is issued.
*/
void Cl_Record_f(void) {
if (Cmd_Argc() != 2) {
Com_Print("Usage: %s <demo name>\n", Cmd_Argv(0));
return;
}
if (cls.demo_file) {
Com_Print("Already recording.\n");
return;
}
if (cls.state != CL_ACTIVE) {
Com_Print("You must be in a level to record.\n");
return;
}
// open the demo file
snprintf(cls.demo_path, sizeof(cls.demo_path), "%s/demos/%s.dem", Fs_Gamedir(), Cmd_Argv(1));
Fs_CreatePath(cls.demo_path);
cls.demo_file = fopen(cls.demo_path, "wb");
if (!cls.demo_file) {
Com_Warn("Cl_Record_f: couldn't open %s.\n", cls.demo_path);
return;
}
// don't start saving messages until a non-delta compressed message is received
cls.demo_waiting = true;
// update user info var to inform server to send angles
Cvar_ForceSet("recording", "1");
Com_Print("Requesting demo support from server...\n");
}
示例14: assert
/**
* @brief Called when the node got the focus
*/
void uiTextEntryNode::onFocusGained (uiNode_t* node)
{
assert(editedCvar == nullptr);
/* skip '*cvar ' */
const char* cvarRef = "*cvar:";
editedCvar = Cvar_Get(&((const char*)node->text)[strlen(cvarRef)]);
assert(editedCvar);
Q_strncpyz(cvarValueBackup, editedCvar->string, sizeof(cvarValueBackup));
isAborted = false;
EXTRADATA(node).cursorPosition = UTF8_strlen(editedCvar->string);
#if SDL_VERSION_ATLEAST(2,0,0)
SDL_StartTextInput();
vec2_t pos;
UI_GetNodeAbsPos(node, pos);
SDL_Rect r = {static_cast<int>(pos[0]), static_cast<int>(pos[1]), static_cast<int>(node->box.size[0]), static_cast<int>(node->box.size[1])};
SDL_SetTextInputRect(&r);
#else
#ifdef ANDROID
char buf[MAX_CVAR_EDITING_LENGTH];
Q_strncpyz(buf, editedCvar->string, sizeof(buf));
SDL_ANDROID_GetScreenKeyboardTextInput(buf, sizeof(buf));
Cvar_ForceSet(editedCvar->name, buf);
UI_TextEntryNodeValidateEdition(node);
UI_RemoveFocus();
#endif
#endif
}
示例15: CL_MM_Login
/*
* CL_MM_Login
*/
qboolean CL_MM_Login( const char *user, const char *password )
{
// first figure out the user
if( !user || user[0] == '\0' )
user = cl_mm_user->string;
else
{
if( cl_mm_autologin->integer )
Cvar_ForceSet( "cl_mm_user", user );
}
// TODO: nicer error announcing
if( !password || password[0] == '\0' )
password = MM_PasswordRead( user );
else
{
if( cl_mm_autologin->integer )
MM_PasswordWrite( user, password );
}
if( password == NULL )
{
CL_MM_ErrorMessage( qtrue, "MM Login: Password error");
return qfalse;
}
return CL_MM_LoginReal( user, password );
}