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", ""); }
/* * 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 ); }
/* * 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" ); }
/* * 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" ); }
/* * 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 ); }
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; } }
/* * CM_Free */ void CM_Free( cmodel_state_t *cms ) { CM_Clear( cms ); Mem_Free( cms ); Cvar_ForceSet( "cm_mapHeader", "" ); Cvar_ForceSet( "cm_mapVersion", "0" ); }
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; }
/** * @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); }
/* * 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 ); } }
/* =============== 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); }
/** 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); } }
/** * @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); }
/* * 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"); }
/** * @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 }
/* * 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 ); }
/* * SCR_RegisterConsoleFont */ static void SCR_RegisterConsoleFont( void ) { const char *con_fontSystemFamilyName; const int con_fontSystemStyle = DEFAULT_SYSTEM_FONT_STYLE; int size; float pixelRatio = Con_GetPixelRatio(); // register system fonts con_fontSystemFamilyName = con_fontSystemFamily->string; if( !con_fontSystemConsoleSize->integer ) { Cvar_SetValue( con_fontSystemConsoleSize->name, DEFAULT_SYSTEM_FONT_SMALL_SIZE ); } else if( con_fontSystemConsoleSize->integer > DEFAULT_SYSTEM_FONT_SMALL_SIZE * 2 ) { Cvar_SetValue( con_fontSystemConsoleSize->name, DEFAULT_SYSTEM_FONT_SMALL_SIZE * 2 ); } else if( con_fontSystemConsoleSize->integer < DEFAULT_SYSTEM_FONT_SMALL_SIZE / 2 ) { Cvar_SetValue( con_fontSystemConsoleSize->name, DEFAULT_SYSTEM_FONT_SMALL_SIZE / 2 ); } size = ceil( con_fontSystemConsoleSize->integer * pixelRatio ); cls.consoleFont = SCR_RegisterFont( con_fontSystemFamilyName, con_fontSystemStyle, size ); if( !cls.consoleFont ) { Cvar_ForceSet( con_fontSystemFamily->name, con_fontSystemFamily->dvalue ); con_fontSystemFamilyName = con_fontSystemFamily->dvalue; size = DEFAULT_SYSTEM_FONT_SMALL_SIZE; cls.consoleFont = SCR_RegisterFont( con_fontSystemFamilyName, con_fontSystemStyle, size ); if( !cls.consoleFont ) Com_Error( ERR_FATAL, "Couldn't load default font \"%s\"", con_fontSystemFamily->dvalue ); Con_CheckResize(); } }
/* * SCR_ChangeSystemFontSmallSize */ void SCR_ChangeSystemFontSmallSize( int ch ) { if( !con_fontSystemSmallSize ) { return; } Cvar_ForceSet( con_fontSystemSmallSize->name, va( "%i", con_fontSystemSmallSize->integer + ch ) ); SCR_CheckSystemFontsModified(); }
/* * SCR_ResetSystemFontConsoleSize */ void SCR_ResetSystemFontConsoleSize( void ) { if( !con_fontSystemConsoleSize ) { return; } Cvar_ForceSet( con_fontSystemConsoleSize->name, con_fontSystemConsoleSize->dvalue ); SCR_CheckSystemFontsModified(); }
static inline void UI_ExecuteSetAction (const uiAction_t* action, const uiCallContext_t *context) { const char* path; uiNode_t *node; const value_t *property; const uiAction_t *left; uiAction_t *right; left = action->d.nonTerminal.left; if (left == NULL) { Com_Printf("UI_ExecuteSetAction: Action without left operand skipped.\n"); return; } right = action->d.nonTerminal.right; if (right == NULL) { Com_Printf("UI_ExecuteSetAction: Action without right operand skipped.\n"); return; } if (left->type == EA_VALUE_CVARNAME || left->type == EA_VALUE_CVARNAME_WITHINJECTION) { const char *cvarName; const char* textValue; if (left->type == EA_VALUE_CVARNAME) cvarName = left->d.terminal.d1.constString; else cvarName = UI_GenInjectedString(left->d.terminal.d1.constString, false, context); textValue = UI_GetStringFromExpression(right, context); if (textValue[0] == '_') textValue = _(textValue + 1); Cvar_ForceSet(cvarName, textValue); return; } /* search the node */ if (left->type == EA_VALUE_PATHPROPERTY) path = left->d.terminal.d1.constString; else if (left->type == EA_VALUE_PATHPROPERTY_WITHINJECTION) path = UI_GenInjectedString(left->d.terminal.d1.constString, false, context); else Com_Error(ERR_FATAL, "UI_ExecuteSetAction: Property setter with wrong type '%d'", left->type); UI_ReadNodePath(path, context->source, &node, &property); if (!node) { Com_Printf("UI_ExecuteSetAction: node \"%s\" doesn't exist (source: %s)\n", path, UI_GetPath(context->source)); return; } if (!property) { Com_Printf("UI_ExecuteSetAction: property \"%s\" doesn't exist (source: %s)\n", path, UI_GetPath(context->source)); return; } UI_NodeSetPropertyFromActionValue(node, property, context, right); }
/* ==================== SV_MVDStop stop recording a demo ==================== */ void SV_MVDStop (int reason) { if (!sv.mvdrecording) { Com_Printf ("Not recording a demo.\n"); return; } if (reason == 2) { DestCloseAllFlush(true); // stop and remove if (!demo.dest) sv.mvdrecording = false; SV_BroadcastPrintf (PRINT_CHAT, "Server recording canceled, demo removed\n"); Cvar_ForceSet(Cvar_Get("serverdemo", "", CVAR_ROM), ""); return; } // write a disconnect message to the demo file // clearup to be sure message will fit demo.dbuf->cursize = 0; demo.dbuf->h = NULL; demo.dbuf->bufsize = 0; MVDWrite_Begin(dem_all, 0, 2+strlen("EndOfDemo")); MSG_WriteByte ((sizebuf_t*)demo.dbuf, svc_disconnect); MSG_WriteString ((sizebuf_t*)demo.dbuf, "EndOfDemo"); SV_MVDWritePackets(demo.parsecount - demo.lastwritten + 1); // finish up DestCloseAllFlush(false); if (!demo.dest) sv.mvdrecording = false; if (!reason) SV_BroadcastPrintf (PRINT_CHAT, "Server recording completed\n"); else SV_BroadcastPrintf (PRINT_CHAT, "Server recording stoped\nMax demo size exceeded\n"); Cvar_ForceSet(Cvar_Get("serverdemo", "", CVAR_ROM), ""); }
// only one .. is allowed (so we can get to the same dir as the quake exe) static void SV_DemoDir_Callback(struct cvar_s *var, char *oldvalue, qbool *cancel) { char *value; value = var->string; if (!value[0] || value[0] == '/' || (value[0] == '\\' && value[1] == '\\')) { Cvar_ForceSet(&sv_demoDir, "demos"); return; } if (value[0] == '.' && value[1] == '.') value += 2; if (strstr(value,"..")) { Cvar_ForceSet(&sv_demoDir, "demos"); return; } }
/* * SV_AutoUpdateFromWeb */ void SV_AutoUpdateFromWeb( bool checkOnly ) { if( checkOnly ) { Com_Autoupdate_Run( true, NULL ); return; } Cvar_ForceSet( "sv_lastAutoUpdate", va( "%i", (int)Com_DaysSince1900() ) ); Com_Autoupdate_Run( false, &SV_AutoUpdateComplete_f ); }
/* * R_Bloom_InitTextures */ static void R_Bloom_InitTextures( void ) { qbyte *data; int size; if( glConfig.ext.texture_non_power_of_two ) { screen_texture_width = glState.width; screen_texture_height = glState.height; } else { // find closer power of 2 to screen size for (screen_texture_width = 1;screen_texture_width < glState.width;screen_texture_width <<= 1); for (screen_texture_height = 1;screen_texture_height < glState.height;screen_texture_height <<= 1); } // disable blooms if we can't handle a texture of that size if( screen_texture_width > glConfig.maxTextureSize || screen_texture_height > glConfig.maxTextureSize ) { screen_texture_width = screen_texture_height = 0; Cvar_ForceSet( "r_bloom", "0" ); Com_Printf( S_COLOR_YELLOW "WARNING: 'R_InitBloomScreenTexture' too high resolution for light bloom, effect disabled\n" ); return; } // init the screen texture size = screen_texture_width * screen_texture_height * 4; data = Mem_TempMalloc( size ); memset( data, 255, size ); r_bloomscreentexture = R_LoadPic( "***r_bloomscreentexture***", &data, screen_texture_width, screen_texture_height, IT_CLAMP|IT_NOMIPMAP|IT_NOCOMPRESS|IT_NOPICMIP, 3 ); Mem_TempFree( data ); // validate bloom size and init the bloom effect texture R_Bloom_InitEffectTexture(); // if screensize is more than 2x the bloom effect texture, set up for stepped downsampling r_bloomdownsamplingtexture = NULL; r_screendownsamplingtexture_size = 0; if( (glState.width > (BLOOM_SIZE * 2) || glState.height > (BLOOM_SIZE * 2)) && !r_bloom_fast_sample->integer ) { r_screendownsamplingtexture_size = (int)( BLOOM_SIZE * 2 ); data = Mem_TempMalloc( r_screendownsamplingtexture_size * r_screendownsamplingtexture_size * 4 ); memset( data, 0, r_screendownsamplingtexture_size * r_screendownsamplingtexture_size * 4 ); r_bloomdownsamplingtexture = R_LoadPic( "***r_bloomdownsamplingtexture***", &data, r_screendownsamplingtexture_size, r_screendownsamplingtexture_size, IT_CLAMP|IT_NOMIPMAP|IT_NOCOMPRESS|IT_NOPICMIP, 3 ); Mem_TempFree( data ); } // init the screen backup texture if( r_screendownsamplingtexture_size ) R_Bloom_InitBackUpTexture( r_screendownsamplingtexture_size, r_screendownsamplingtexture_size ); else R_Bloom_InitBackUpTexture( BLOOM_SIZE, BLOOM_SIZE ); }
void FS_Tick() { // process "fs_logFile" changes if (fs_logFile->modified) { fs_logFile->modified = false; if (FSLog != GNull && FSLog != GLog) delete FSLog; switch (fs_logFile->integer) { case 0: FSLog = GNull; break; case 1: FSLog = GLog; //?? colorized log break; default: // case 2 FSLog = new COutputDeviceFile(FS_LOG); FSLog->Printf("\n*** File system activity, %s ***\n\n", appTimestamp()); break; } } // process "game" changes if (fs_game->modified) { //!! WARNING: configuration will be saved even if game is not changed (bad game or "baseq2"->"") if (!stricmp(fs_game->string, BASEDIRNAME)) Cvar_ForceSet("game", ""); // BASEDIRNAME->"" CL_WriteConfiguration(fs_configfile->string); if (FS.SetGameDir(fs_game->string)) { LoadGameConfig(); if (!DEDICATED) Cbuf_AddText("vid_restart\nsnd_restart\n"); } Cvar_ForceSet("game", (FS.GameDir == BASEDIRNAME) ? "" : *FS.GameDir); fs_game->modified = false; } }
/* * SCR_RegisterSystemFonts */ static void SCR_RegisterSystemFonts( void ) { const char *con_fontSystemFamilyName; const int con_fontSystemStyle = DEFAULT_SYSTEM_FONT_STYLE; // register system fonts con_fontSystemFamilyName = con_fontSystemFamily->string; if( !con_fontSystemSmallSize->integer ) { Cvar_ForceSet( con_fontSystemSmallSize->name, con_fontSystemSmallSize->dvalue ); } if( !con_fontSystemMediumSize->integer ) { Cvar_ForceSet( con_fontSystemMediumSize->name, con_fontSystemMediumSize->dvalue ); } if( !con_fontSystemBigSize->integer ) { Cvar_ForceSet( con_fontSystemBigSize->name, con_fontSystemBigSize->dvalue ); } cls.fontSystemSmall = SCR_RegisterFont( con_fontSystemFamilyName, con_fontSystemStyle, con_fontSystemSmallSize->integer ); if( !cls.fontSystemSmall ) { Cvar_ForceSet( con_fontSystemFamily->name, con_fontSystemFamily->dvalue ); con_fontSystemFamilyName = con_fontSystemFamily->dvalue; cls.fontSystemSmall = SCR_RegisterFont( con_fontSystemFamilyName, con_fontSystemStyle, DEFAULT_SYSTEM_FONT_SMALL_SIZE ); if( !cls.fontSystemSmall ) Com_Error( ERR_FATAL, "Couldn't load default font \"%s\"", con_fontSystemFamily->dvalue ); } cls.fontSystemMedium = SCR_RegisterFont( con_fontSystemFamilyName, con_fontSystemStyle, con_fontSystemMediumSize->integer ); if( !cls.fontSystemMedium ) cls.fontSystemMedium = SCR_RegisterFont( con_fontSystemFamilyName, con_fontSystemStyle, DEFAULT_SYSTEM_FONT_MEDIUM_SIZE ); cls.fontSystemBig = SCR_RegisterFont( con_fontSystemFamily->string, con_fontSystemStyle, con_fontSystemBigSize->integer ); if( !cls.fontSystemBig ) cls.fontSystemBig = SCR_RegisterFont( con_fontSystemFamilyName, con_fontSystemStyle, DEFAULT_SYSTEM_FONT_BIG_SIZE ); }
static void CL_CharacterSkillAndScoreCvars (const character_t *chr, const char* cvarPrefix) { const chrScoreGlobal_t *score = &chr->score; Cvar_ForceSet(va("%s%s", cvarPrefix, "name"), chr->name); Cvar_ForceSet(va("%s%s", cvarPrefix, "body"), CHRSH_CharGetBody(chr)); Cvar_ForceSet(va("%s%s", cvarPrefix, "head"), CHRSH_CharGetHead(chr)); Cvar_ForceSet(va("%s%s", cvarPrefix, "skin"), va("%i", chr->bodySkin)); Cvar_ForceSet(va("%s%s", cvarPrefix, "skinname"), CL_GetTeamSkinName(chr->bodySkin)); Cvar_Set(va("%s%s", cvarPrefix, "vpwr"), va("%i", score->skills[ABILITY_POWER])); Cvar_Set(va("%s%s", cvarPrefix, "vspd"), va("%i", score->skills[ABILITY_SPEED])); Cvar_Set(va("%s%s", cvarPrefix, "vacc"), va("%i", score->skills[ABILITY_ACCURACY])); Cvar_Set(va("%s%s", cvarPrefix, "vmnd"), va("%i", score->skills[ABILITY_MIND])); Cvar_Set(va("%s%s", cvarPrefix, "vcls"), va("%i", score->skills[SKILL_CLOSE])); Cvar_Set(va("%s%s", cvarPrefix, "vhvy"), va("%i", score->skills[SKILL_HEAVY])); Cvar_Set(va("%s%s", cvarPrefix, "vass"), va("%i", score->skills[SKILL_ASSAULT])); Cvar_Set(va("%s%s", cvarPrefix, "vsnp"), va("%i", score->skills[SKILL_SNIPER])); Cvar_Set(va("%s%s", cvarPrefix, "vexp"), va("%i", score->skills[SKILL_EXPLOSIVE])); Cvar_Set(va("%s%s", cvarPrefix, "vpwri"), va("%i", score->initialSkills[ABILITY_POWER])); Cvar_Set(va("%s%s", cvarPrefix, "vspdi"), va("%i", score->initialSkills[ABILITY_SPEED])); Cvar_Set(va("%s%s", cvarPrefix, "vacci"), va("%i", score->initialSkills[ABILITY_ACCURACY])); Cvar_Set(va("%s%s", cvarPrefix, "vmndi"), va("%i", score->initialSkills[ABILITY_MIND])); Cvar_Set(va("%s%s", cvarPrefix, "vclsi"), va("%i", score->initialSkills[SKILL_CLOSE])); Cvar_Set(va("%s%s", cvarPrefix, "vhvyi"), va("%i", score->initialSkills[SKILL_HEAVY])); Cvar_Set(va("%s%s", cvarPrefix, "vassi"), va("%i", score->initialSkills[SKILL_ASSAULT])); Cvar_Set(va("%s%s", cvarPrefix, "vsnpi"), va("%i", score->initialSkills[SKILL_SNIPER])); Cvar_Set(va("%s%s", cvarPrefix, "vexpi"), va("%i", score->initialSkills[SKILL_EXPLOSIVE])); Cvar_Set(va("%s%s", cvarPrefix, "vhp"), va("%i", chr->HP)); Cvar_Set(va("%s%s", cvarPrefix, "vhpmax"), va("%i", chr->maxHP)); Cvar_Set(va("%s%s", cvarPrefix, "tpwr"), va("%s (%i)", CL_ActorGetSkillString(score->skills[ABILITY_POWER]), score->skills[ABILITY_POWER])); Cvar_Set(va("%s%s", cvarPrefix, "tspd"), va("%s (%i)", CL_ActorGetSkillString(score->skills[ABILITY_SPEED]), score->skills[ABILITY_SPEED])); Cvar_Set(va("%s%s", cvarPrefix, "tacc"), va("%s (%i)", CL_ActorGetSkillString(score->skills[ABILITY_ACCURACY]), score->skills[ABILITY_ACCURACY])); Cvar_Set(va("%s%s", cvarPrefix, "tmnd"), va("%s (%i)", CL_ActorGetSkillString(score->skills[ABILITY_MIND]), score->skills[ABILITY_MIND])); Cvar_Set(va("%s%s", cvarPrefix, "tcls"), va("%s (%i)", CL_ActorGetSkillString(score->skills[SKILL_CLOSE]), score->skills[SKILL_CLOSE])); Cvar_Set(va("%s%s", cvarPrefix, "thvy"), va("%s (%i)", CL_ActorGetSkillString(score->skills[SKILL_HEAVY]), score->skills[SKILL_HEAVY])); Cvar_Set(va("%s%s", cvarPrefix, "tass"), va("%s (%i)", CL_ActorGetSkillString(score->skills[SKILL_ASSAULT]), score->skills[SKILL_ASSAULT])); Cvar_Set(va("%s%s", cvarPrefix, "tsnp"), va("%s (%i)", CL_ActorGetSkillString(score->skills[SKILL_SNIPER]), score->skills[SKILL_SNIPER])); Cvar_Set(va("%s%s", cvarPrefix, "texp"), va("%s (%i)", CL_ActorGetSkillString(score->skills[SKILL_EXPLOSIVE]), score->skills[SKILL_EXPLOSIVE])); Cvar_Set(va("%s%s", cvarPrefix, "thp"), va("%i (%i)", chr->HP, chr->maxHP)); }
/* * sv_mm_login_done * callback for login post request */ static void sv_mm_login_done( stat_query_t *query, qboolean success, void *customp ) { stat_query_section_t *root; sv_mm_initialized = qfalse; sv_login_query = NULL; if( !success ) { Com_Printf( "SV_MM_Login_Done: Error\n" ); Cvar_ForceSet( sv_mm_enable->name, "0" ); return; } Com_DPrintf( "SV_MM_Login: %s\n", sq_api->GetRawResponse( query ) ); /* * ch : JSON API * { * id: [int], // 0 on error, > 0 on success * } */ root = sq_api->GetRoot( query ); if( root == NULL ) { Com_Printf("SV_MM_Login: Failed to parse data\n"); } else { sv_mm_session = (int)sq_api->GetNumber( root, "id" ); sv_mm_initialized = ( sv_mm_session == 0 ? qfalse : qtrue ); } if( sv_mm_initialized ) Com_Printf( "SV_MM_Login: Success, session id %u\n", sv_mm_session ); else { Com_Printf( "SV_MM_Login: Failed, no session id\n" ); Cvar_ForceSet( sv_mm_enable->name, "0" ); } }
/* ================ SV_Shutdown Called when each game quits, and before exitting application ================ */ void SV_Shutdown(const char *finalmsg, bool reconnect) { guard(SV_Shutdown); if (svs.clients) // NOTE: this required even for attractloop: if disable, when demo finishes, client will not be automatically disconnected { int i; client_t *cl; // Send a final message to all connected clients before the server goes down. // The messages are sent immediately, not just stuck on the outgoing message // list, because the server is going to totally exit after returning from this function. for (i = 0, cl = svs.clients; i < sv_maxclients->integer; i++, cl++) { if (cl->state < cs_connected) continue; net_message.Clear(); MSG_WriteByte(&net_message, svc_print); MSG_WriteByte(&net_message, PRINT_HIGH); if (cl->newprotocol && !reconnect) // colorize exit message MSG_WriteString(&net_message, va(S_RED"%s", finalmsg)); else MSG_WriteString(&net_message, finalmsg); MSG_WriteByte(&net_message, reconnect ? svc_reconnect : svc_disconnect); cl->netchan.Transmit(net_message.data, net_message.cursize); } } Master_Shutdown(); SV_ShutdownGameLibrary(); // free current level if (sv.rdemofile) delete sv.rdemofile; memset(&sv, 0, sizeof(sv)); Com_SetServerState(ss_dead); // == 0 // free server static data sv_client = NULL; if (svs.clients) delete svs.clients; if (svs.client_entities) delete svs.client_entities; if (svs.wdemofile) fclose(svs.wdemofile); memset(&svs, 0, sizeof(svs)); SV_InitVars(); // called for unlocking latched vars Cvar_ForceSet("nointro", "1"); unguard; }
void SV_ReadServerFile(void) { fileHandle_t f; char name[MAX_OSPATH], string[128]; char comment[32]; char mapcmd[MAX_TOKEN_CHARS]; Com_DPrintf("SV_ReadServerFile()\n"); Com_sprintf(name, sizeof(name), "save/current/server.ssv"); FS_FOpenFile(name, &f, FS_READ); if (!f) { Com_Printf("Couldn't read %s\n", name); return; } /* read the comment field */ FS_Read(comment, sizeof(comment), f); /* read the mapcmd */ FS_Read(mapcmd, sizeof(mapcmd), f); /* read all CVAR_LATCH cvars these will be things like coop, skill, deathmatch, etc */ while (1) { char cvarname[LATCH_CVAR_SAVELENGTH] = {0}; if (!FS_FRead(cvarname, 1, sizeof(cvarname), f)) { break; } FS_Read(string, sizeof(string), f); Com_DPrintf("Set %s = %s\n", cvarname, string); Cvar_ForceSet(cvarname, string); } FS_FCloseFile(f); /* start a new game fresh with new cvars */ SV_InitGame(); strcpy(svs.mapcmd, mapcmd); /* read game state */ Com_sprintf(name, sizeof(name), "%s/save/current/game.ssv", FS_Gamedir()); ge->ReadGame(name); }