static void Rulesets_Smackdown (qbool enable) { extern cvar_t cl_independentPhysics, cl_c2spps; extern cvar_t cl_hud; extern cvar_t cl_rollalpha; extern cvar_t r_shiftbeam; #ifndef GLQUAKE extern cvar_t r_aliasstats; #endif int i; locked_cvar_t disabled_cvars[] = { {&cl_hud, "0"}, // allows you place any text on the screen & filter incoming messages (hud strings) {&cl_rollalpha, "20"}, // allows you to not dodge while seeing enemies dodging {&r_shiftbeam, "0"}, // perphaps some people would think this allows you to aim better (maybe should be added for demo playback and spectating only) #ifndef GLQUAKE {&r_aliasstats, "0"} #endif }; if (enable) { for (i = 0; i < (sizeof(disabled_cvars) / sizeof(disabled_cvars[0])); i++) { Cvar_RulesetSet(disabled_cvars[i].var, disabled_cvars[i].value, 2); Cvar_Set(disabled_cvars[i].var, disabled_cvars[i].value); Cvar_SetFlags(disabled_cvars[i].var, Cvar_GetFlags(disabled_cvars[i].var) | CVAR_ROM); } if (cl_independentPhysics.value) { Cvar_Set(&cl_c2spps, "0"); // people were complaining that player move is jerky with this. however this has not much to do with independent physics, but people are too paranoid about it Cvar_SetFlags(&cl_c2spps, Cvar_GetFlags(&cl_c2spps) | CVAR_ROM); } rulesetDef.maxfps = 77; rulesetDef.restrictTriggers = true; rulesetDef.restrictPacket = true; // packet command could have been exploited for external timers rulesetDef.restrictParticles = true; rulesetDef.ruleset = rs_smackdown; } else { for (i = 0; i < (sizeof(disabled_cvars) / sizeof(disabled_cvars[0])); i++) Cvar_SetFlags(disabled_cvars[i].var, Cvar_GetFlags(disabled_cvars[i].var) & ~CVAR_ROM); if (cl_independentPhysics.value) Cvar_SetFlags(&cl_c2spps, Cvar_GetFlags(&cl_c2spps) & ~CVAR_ROM); rulesetDef.maxfps = 72.0; rulesetDef.restrictTriggers = false; rulesetDef.restrictPacket = false; rulesetDef.restrictParticles = false; rulesetDef.ruleset = rs_default; } }
void V_TF_FlashSettings (qbool flashed) { static float old_gamma, old_contrast; // remove read only flag if it was set if (Cvar_GetFlags(&v_gamma) & CVAR_ROM) Cvar_SetFlags(&v_gamma, Cvar_GetFlags(&v_gamma) & ~CVAR_ROM); if (Cvar_GetFlags(&v_contrast) & CVAR_ROM) Cvar_SetFlags(&v_contrast, Cvar_GetFlags(&v_contrast) & ~CVAR_ROM); if (flashed) { // store normal settings old_gamma = v_gamma.value; old_contrast = v_contrast.value; // set MTFL flash settings Cvar_SetValue (&v_gamma, flash_gamma); Cvar_SetValue (&v_contrast, flash_contrast); // made gamma&contrast read only Cvar_SetFlags(&v_gamma, Cvar_GetFlags(&v_gamma) | CVAR_ROM); Cvar_SetFlags(&v_contrast, Cvar_GetFlags(&v_contrast) | CVAR_ROM); } else { // restore old settings Cvar_SetValue (&v_gamma, old_gamma); Cvar_SetValue (&v_contrast, old_contrast); } return; }
void Host_Init (int argc, char **argv, int default_memsize) { vfsfile_t *vf; cvar_t *v; char cfg[MAX_PATH] = {0}; int i; char *cfg_name; COM_InitArgv (argc, argv); COM_StoreOriginalCmdline(argc, argv); #ifdef WITH_DP_MEM Memory2_Init (); #endif Host_InitMemory (default_memsize); #ifdef WITH_TCL // interpreter should be initialized // before any cvar definitions TCL_InterpInit (); #endif Cbuf_Init (); Cmd_Init (); Cvar_Init (); COM_Init (); Key_Init (); #ifdef WITH_DP_MEM Memory2_Init_Commands (); #endif Cache_Init_Commands (); FS_InitFilesystem (); NET_Init (); Commands_For_Configs_Init (); ConfigManager_Init(); ResetBinds(); i = COM_CheckParm("+cfg_load"); if (i && (i + 1 < COM_Argc())) { cfg_name = COM_Argv(i + 1); } else { cfg_name = MAIN_CONFIG_FILENAME; } snprintf(cfg, sizeof(cfg), "%s", cfg_name); COM_ForceExtensionEx (cfg, ".cfg", sizeof (cfg)); Cbuf_AddText(va("cfg_load %s\n", cfg)); Cbuf_Execute(); Cbuf_AddEarlyCommands (); Cbuf_Execute (); Con_Init (); NET_InitClient (); Netchan_Init (); #if (!defined WITH_PNG_STATIC || !defined WITH_JPEG_STATIC || defined WITH_MP3_PLAYER) QLib_Init(); #endif Sys_Init (); CM_Init (); PM_Init (); Mod_Init (); SV_Init (); CL_Init (); Cvar_CleanUpTempVars (); SYSINFO_Init(); #ifdef WITH_TCL if (!TCL_InterpLoaded()) Com_Printf_State (PRINT_FAIL, "Could not load "TCL_LIB_NAME", embedded Tcl disabled\n"); #endif Hunk_AllocName (0, "-HOST_HUNKLEVEL-"); host_hunklevel = Hunk_LowMark (); host_initialized = true; // walk through all vars and forse OnChange event if cvar was modified, // also apply that to variables which mirrored in userinfo because of cl_parsefunchars was't applyed as this moment, // same for serverinfo and may be this fix something also. for ( v = NULL; (v = Cvar_Next ( v )); ) { char val[2048]; // if ( !v->modified ) // continue; // not modified even that strange at this moment if ( Cvar_GetFlags( v ) & (CVAR_ROM | CVAR_INIT) ) continue; snprintf(val, sizeof(val), "%s", v->string); Cvar_Set(v, val); } Hud_262LoadOnFirstStart(); Com_Printf_State (PRINT_INFO, "Exe: "__TIME__" "__DATE__"\n"); Com_Printf_State (PRINT_INFO, "Hunk allocation: %4.1f MB.\n", (float) host_memsize / (1024 * 1024)); Com_Printf ("\nezQuake %s\n\n", VersionString()); Com_Printf(Host_PrintBars("ezQuake\x9c" "SourceForge\x9c" "net", 38)); Com_Printf(Host_PrintBars("ezQuake Initialized", 38)); Com_Printf("\n"); Com_Printf ("\nType /help to access the manual.\nUse /describe to learn about commands.\n", VersionString()); if ((vf = FS_OpenVFS("autoexec.cfg", "rb", FS_ANY))) { Cbuf_AddText ("exec autoexec.cfg\n"); VFS_CLOSE(vf); } Cmd_StuffCmds_f (); // process command line arguments Cbuf_AddText ("cl_warncmd 1\n"); #ifdef WIN32 // // Verify that ezQuake is associated with the QW:// protocl handler. // { extern qbool CL_CheckIfQWProtocolHandler(); extern cvar_t cl_verify_qwprotocol; if (cl_verify_qwprotocol.integer >= 2) { // Always register the qw:// protocol. Cbuf_AddText("register_qwurl_protocol\n"); } else if (cl_verify_qwprotocol.integer == 1 && !CL_CheckIfQWProtocolHandler()) { // Check if the running exe is the one associated with the qw:// protocol. Com_PrintVerticalBar(0.8 * vid.conwidth / 8); Com_Printf("\n"); Com_Printf("This ezQuake is not associated with the "); Com_Printf("\x02QW:// protocol.\n"); Com_Printf("Register it using "); Com_Printf("\x02/register_qwurl_protocol\n"); Com_Printf("(set "); Com_Printf("\x02 cl_verify_qwprotocol "); Com_Printf("to 0 to hide this warning)\n"); Com_PrintVerticalBar(0.8 * vid.conwidth / 8); Com_Printf("\n"); } } #endif // WIN32 // Check if a qtv/demo file is specified as the first argument, in that case play that // otherwise, do some more checks of what to show at startup. { char cmd[1024] = {0}; if (COM_CheckArgsForPlayableFiles(cmd, sizeof(cmd))) { Cbuf_AddText(cmd); } else { Startup_Place(); } } #ifdef _WIN32 SetForegroundWindow(mainwindow); SetActiveWindow(mainwindow); #endif host_everything_loaded = true; }
static void Rulesets_MTFL (qbool enable) { /* TODO: f_flashout trigger block all other ways to made textures flat(simple) ?disable external textures for detpacks, grenades, sentry, disp, etc? */ extern cvar_t cl_c2spps, r_fullbrightSkins; #ifdef GLQUAKE extern cvar_t amf_detpacklights; extern cvar_t gl_picmip, gl_max_size, r_drawflat; extern cvar_t vid_hwgammacontrol; extern cvar_t gl_textureless; #endif int i = 0; locked_cvar_t disabled_cvars[] = { #ifdef GLQUAKE {&r_drawflat, "0"}, {&amf_detpacklights, "0"}, {&vid_hwgammacontrol, "2"}, {&gl_textureless, "0"}, #endif {&r_fullbrightSkins, "0"}, {&cl_c2spps, "0"}, }; #ifdef GLQUAKE limited_cvar_max_t limited_max_cvars[] = { {&gl_picmip, "3"}, }; limited_cvar_min_t limited_min_cvars[] = { {&gl_max_size, "512"}, }; #endif if (enable) { for (; i < (sizeof(disabled_cvars) / sizeof(disabled_cvars[0])); i++) { Cvar_RulesetSet(disabled_cvars[i].var, disabled_cvars[i].value, 2); Cvar_Set(disabled_cvars[i].var, disabled_cvars[i].value); Cvar_SetFlags(disabled_cvars[i].var, Cvar_GetFlags(disabled_cvars[i].var) | CVAR_ROM); } #ifdef GLQUAKE for (i = 0; i < (sizeof(limited_max_cvars) / sizeof(limited_max_cvars[0])); i++) { Cvar_RulesetSet(limited_max_cvars[i].var, limited_max_cvars[i].maxrulesetvalue, 1); Cvar_SetFlags(limited_max_cvars[i].var, Cvar_GetFlags(limited_max_cvars[i].var) | CVAR_RULESET_MAX); } for (i = 0; i < (sizeof(limited_min_cvars) / sizeof(limited_min_cvars[0])); i++) { Cvar_RulesetSet(limited_min_cvars[i].var, limited_min_cvars[i].minrulesetvalue, 0); Cvar_SetFlags(limited_min_cvars[i].var, Cvar_GetFlags(limited_min_cvars[i].var) | CVAR_RULESET_MIN); } #endif rulesetDef.ruleset = rs_mtfl; } else { for (i = 0; i < (sizeof(disabled_cvars) / sizeof(disabled_cvars[0])); i++) Cvar_SetFlags(disabled_cvars[i].var, Cvar_GetFlags(disabled_cvars[i].var) & ~CVAR_ROM); #ifdef GLQUAKE for (i = 0; i < (sizeof(limited_max_cvars) / sizeof(limited_max_cvars[0])); i++) Cvar_SetFlags(limited_max_cvars[i].var, Cvar_GetFlags(limited_max_cvars[i].var) & ~CVAR_RULESET_MAX); for (i = 0; i < (sizeof(limited_min_cvars) / sizeof(limited_min_cvars[0])); i++) Cvar_SetFlags(limited_min_cvars[i].var, Cvar_GetFlags(limited_min_cvars[i].var) & ~CVAR_RULESET_MIN); #endif rulesetDef.ruleset = rs_default; } }