/* <269cb> ../cstrike/dlls/buttons.cpp:355 */ void CBaseButton::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "changetarget")) { m_strChangeTarget = ALLOC_STRING(pkvd->szValue); pkvd->fHandled = TRUE; } else if (FStrEq(pkvd->szKeyName, "locked_sound")) { m_bLockedSound = (int)Q_atof(pkvd->szValue); pkvd->fHandled = TRUE; } else if (FStrEq(pkvd->szKeyName, "locked_sentence")) { m_bLockedSentence = (int)Q_atof(pkvd->szValue); pkvd->fHandled = TRUE; } else if (FStrEq(pkvd->szKeyName, "unlocked_sound")) { m_bUnlockedSound = (int)Q_atof(pkvd->szValue); pkvd->fHandled = TRUE; } else if (FStrEq(pkvd->szKeyName, "unlocked_sentence")) { m_bUnlockedSentence = (int)Q_atof(pkvd->szValue); pkvd->fHandled = TRUE; } else if (FStrEq(pkvd->szKeyName, "sounds")) { m_sounds = Q_atoi(pkvd->szValue); pkvd->fHandled = TRUE; } else CBaseToggle::KeyValue(pkvd); }
void CFuncRotating :: KeyValue( KeyValueData* pkvd) { if( FStrEq( pkvd->szKeyName, "fanfriction" )) { m_flFanFriction = Q_atof( pkvd->szValue ) / 100.0f; pkvd->fHandled = TRUE; } else if( FStrEq( pkvd->szKeyName, "spawnorigin" )) { Vector tmp = Q_atov( pkvd->szValue ); if( tmp != g_vecZero ) SetAbsOrigin( tmp ); } else if( FStrEq( pkvd->szKeyName, "sounds" )) { m_sounds = ALLOC_STRING( pkvd->szValue ); pkvd->fHandled = TRUE; } else if( FStrEq( pkvd->szKeyName, "volume" )) { m_flVolume = bound( 0.0f, Q_atof( pkvd->szValue ) / 10.0f, 1.0f ); pkvd->fHandled = TRUE; } else { CBaseDelay::KeyValue( pkvd ); } }
static void Cam_Pos_f (void) { if (Cmd_Argc() == 1) { Com_Printf ("\"%s %s %s\"\n", myftos(cl.simorg[0]), myftos(cl.simorg[1]), myftos(cl.simorg[2])); return; } if (Cmd_Argc() == 2) { // cam_pos "x y z" --> cam_pos x y z Cmd_TokenizeString (va("cam_pos %s", Cmd_Argv(1))); } if (Cmd_Argc() != 4) { Com_Printf("usage:\n" "cam_pos - show current coordinates\n" "cam pos x y z - set new coordinates\n"); return; } if (!cls.demoplayback && !cl.spectator) return; Cam_Reset(); Cam_Pos_Set(Q_atof(Cmd_Argv(1)), Q_atof(Cmd_Argv(2)), Q_atof(Cmd_Argv(3))); }
static void Cam_Angles_f (void) { if (Cmd_Argc() == 1) { Com_Printf ("\"%s %s %s\"\n", myftos(cl.viewangles[0]), myftos(cl.viewangles[1]), myftos(cl.viewangles[2])); return; } if (Cmd_Argc() == 2) { // cam_angles "pitch yaw roll" --> cam_pos pitch yaw roll Cmd_TokenizeString (va("cam_angles %s", Cmd_Argv(1))); } if (Cmd_Argc() != 4 && Cmd_Argc() != 3) { Com_Printf("usage:\n" "cam_pos - show current angles\n" "cam pos pitch yaw [roll] - set new angles\n"); return; } if (!cls.demoplayback && !cl.spectator) return; Cam_Angles_Set(Q_atof(Cmd_Argv(1)), Q_atof(Cmd_Argv(2)), Q_atof(Cmd_Argv(3))); }
/* <1836dc> ../cstrike/dlls/subs.cpp:397 */ void CBaseToggle::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "lip")) { m_flLip = Q_atof(pkvd->szValue); pkvd->fHandled = TRUE; } else if (FStrEq(pkvd->szKeyName, "wait")) { m_flWait = Q_atof(pkvd->szValue); pkvd->fHandled = TRUE; } else if (FStrEq(pkvd->szKeyName, "master")) { m_sMaster = ALLOC_STRING(pkvd->szValue); pkvd->fHandled = TRUE; } else if (FStrEq(pkvd->szKeyName, "distance")) { m_flMoveDistance = Q_atof(pkvd->szValue); pkvd->fHandled = TRUE; } else CBaseDelay::KeyValue(pkvd); }
void CFuncVehicle::KeyValue(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "length")) { m_length = Q_atof(pkvd->szValue); pkvd->fHandled = TRUE; } else if (FStrEq(pkvd->szKeyName, "width")) { m_width = Q_atof(pkvd->szValue); pkvd->fHandled = TRUE; } else if (FStrEq(pkvd->szKeyName, "height")) { m_height = Q_atof(pkvd->szValue); pkvd->fHandled = TRUE; } else if (FStrEq(pkvd->szKeyName, "startspeed")) { m_startSpeed = Q_atof(pkvd->szValue); pkvd->fHandled = TRUE; } else if (FStrEq(pkvd->szKeyName, "sounds")) { m_sounds = Q_atoi(pkvd->szValue); pkvd->fHandled = TRUE; } else if (FStrEq(pkvd->szKeyName, "volume")) { // rounding values to integer m_flVolume = Q_atoi(pkvd->szValue); m_flVolume *= 0.1f; pkvd->fHandled = TRUE; } else if (FStrEq(pkvd->szKeyName, "bank")) { m_flBank = Q_atof(pkvd->szValue); pkvd->fHandled = TRUE; } else if (FStrEq(pkvd->szKeyName, "acceleration")) { m_acceleration = Q_atoi(pkvd->szValue); if (m_acceleration < 1) m_acceleration = 1; else if (m_acceleration > 10) m_acceleration = 10; pkvd->fHandled = TRUE; } else { CBaseEntity::KeyValue(pkvd); } }
bool C_PhysPropClientside::KeyValue( const char *szKeyName, const char *szValue ) { if (FStrEq(szKeyName, "physdamagescale")) { m_impactEnergyScale = atof(szValue); } else if ( FStrEq(szKeyName, "health") ) { m_iHealth = Q_atoi(szValue); } else if (FStrEq(szKeyName, "spawnflags")) { m_spawnflags = Q_atoi(szValue); } else if (FStrEq(szKeyName, "model")) { SetModelName( AllocPooledString( szValue ) ); } else if (FStrEq(szKeyName, "fademaxdist")) { m_fadeMaxDist = Q_atof(szValue); } else if (FStrEq(szKeyName, "fademindist")) { m_fadeMinDist = Q_atof(szValue); } else if (FStrEq(szKeyName, "fadescale")) { m_flFadeScale = Q_atof(szValue); } else if (FStrEq(szKeyName, "inertiaScale")) { m_inertiaScale = Q_atof(szValue); } else if (FStrEq(szKeyName, "skin")) { m_nSkin = Q_atoi(szValue); } else if (FStrEq(szKeyName, "physicsmode")) { m_iPhysicsMode = Q_atoi(szValue); } else { if ( !BaseClass::KeyValue( szKeyName, szValue ) ) { // key hasn't been handled return false; } } return true; }
void CPendulum :: KeyValue( KeyValueData *pkvd ) { if( FStrEq( pkvd->szKeyName, "distance" )) { m_distance = Q_atof( pkvd->szValue ); pkvd->fHandled = TRUE; } else if( FStrEq( pkvd->szKeyName, "damp" )) { m_damp = Q_atof( pkvd->szValue ) * 0.001; pkvd->fHandled = TRUE; } else CBaseDelay::KeyValue( pkvd ); }
void Rulesets_OnChange_r_fullbrightSkins (cvar_t *var, char *value, qbool *cancel) { char *fbs; qbool fbskins_policy = (cls.demoplayback || cl.spectator) ? 1 : *(fbs = Info_ValueForKey(cl.serverinfo, "fbskins")) ? bound(0, Q_atof(fbs), 1) : cl.teamfortress ? 0 : 1; float fbskins = bound (0.0, Q_atof (value), fbskins_policy); if (!cl.spectator && cls.state != ca_disconnected) { if (fbskins > 0.0) Cbuf_AddText (va("say all skins %d%% fullbright\n", (int) (fbskins * 100.0))); else Cbuf_AddText (va("say not using fullbright skins\n")); } }
// check gamma settings void Check_Gamma (unsigned char *pal) { float f, inf; unsigned char palette[768]; int i; if ((i = COM_CheckParm("-gamma")) != 0 && i+1 < com_argc) vid_gamma = bound (0.3, Q_atof(com_argv[i+1]), 1); else vid_gamma = 1; Cvar_SetValue (&gl_gamma, vid_gamma); for (i=0 ; i<768 ; i++) { f = pow ( (pal[i]+1)/256.0 , vid_gamma ); inf = f*255 + 0.5; if (inf < 0) inf = 0; if (inf > 255) inf = 255; palette[i] = inf; } memcpy (pal, palette, sizeof(palette)); }
/* ====================== CSCR_ParseHeader Check version and seek to first cvar name ====================== */ qboolean CSCR_ParseHeader( parserstate_t *ps ) { if( !CSCR_ExpectString( ps, "VERSION", false, true ) ) return false; // Parse in the version # // Get the first token. ps->buf = COM_ParseFile( ps->buf, ps->token ); if( Q_atof( ps->token ) != 1 ) { MsgDev( D_ERROR, "File %s has wrong version %s!\n", ps->filename, ps->token ); return false; } if( !CSCR_ExpectString( ps, "DESCRIPTION", false, true ) ) return false; ps->buf = COM_ParseFile( ps->buf, ps->token ); if( Q_stricmp( ps->token, "INFO_OPTIONS") && Q_stricmp( ps->token, "SERVER_OPTIONS" ) ) { MsgDev( D_ERROR, "DESCRIPTION must be INFO_OPTIONS or SERVER_OPTIONS\n"); return false; } if( !CSCR_ExpectString( ps, "{", false, true ) ) return false; return true; }
void SV_Serverinfo_f (void) { cvar_t *var; if (Cmd_Argc() == 1) { Con_Printf ("Server info settings:\n"); Info_Print (svs.info); return; } if (Cmd_Argc() != 3) { Con_Printf ("usage: serverinfo [ <key> <value> ]\n"); return; } if (Cmd_Argv(1)[0] == '*') { Con_Printf ("Star variables cannot be changed.\n"); return; } Info_SetValueForKey (svs.info, Cmd_Argv(1), Cmd_Argv(2), MAX_SERVERINFO_STRING); // if this is a cvar, change it too var = Cvar_FindVar (Cmd_Argv(1)); if (var) { Z_Free (var->string); // free the old value string var->string = CopyString (Cmd_Argv(2)); var->value = Q_atof (var->string); } SV_SendServerInfoChange(Cmd_Argv(1), Cmd_Argv(2)); }
/* ============ Cvar_Value ============ */ float Cvar_Value (const char *name) { cvar_t *var = Cvar_Find (name); if (!var) return 0; return Q_atof (var->string); }
int ParseFloats(char *s, float *f, int *f_size) { int i, argc; if (!s || !f || !f_size) { Sys_Error("ParseFloats() wrong params"); } if (f_size[0] <= 0) { return (f_size[0] = 0); // array have no size, unusual but no crime } Cmd_TokenizeString(s); argc = min(Cmd_Argc(), f_size[0]); for (i = 0; i < argc; i++) { f[i] = Q_atof(Cmd_Argv(i)); } for (; i < f_size[0]; i++) { f[i] = 0; // zeroing unused elements } return (f_size[0] = argc); }
/* <f6d87> ../cstrike/dlls/mortar.cpp:71 */ void CFuncMortarField::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "m_iszXController")) { m_iszXController = ALLOC_STRING(pkvd->szValue); pkvd->fHandled = TRUE; } else if (FStrEq(pkvd->szKeyName, "m_iszYController")) { m_iszYController = ALLOC_STRING(pkvd->szValue); pkvd->fHandled = TRUE; } else if (FStrEq(pkvd->szKeyName, "m_flSpread")) { m_flSpread = Q_atof(pkvd->szValue); pkvd->fHandled = TRUE; } else if (FStrEq(pkvd->szKeyName, "m_fControl")) { m_fControl = Q_atoi(pkvd->szValue); pkvd->fHandled = TRUE; } else if (FStrEq(pkvd->szKeyName, "m_iCount")) { m_iCount = Q_atoi(pkvd->szValue); pkvd->fHandled = TRUE; } }
cvar_t *Cvar_Create (char *name, char *string, int cvarflags) { cvar_t *v; int key; if ((v = Cvar_Find(name))) { v->flags &= ~CVAR_TEMP; v->flags |= cvarflags; return v; } v = (cvar_t *) Q_malloc(sizeof(cvar_t)); memset(v, 0, sizeof(cvar_t)); // Cvar doesn't exist, so we create it v->next = cvar_vars; cvar_vars = v; key = Com_HashKey (name) % VAR_HASHPOOL_SIZE; v->hash_next = cvar_hash[key]; cvar_hash[key] = v; v->name = Q_strdup(name); v->string = Q_strdup(string); v->defaultvalue = Q_strdup(string); v->flags = cvarflags | CVAR_USER_CREATED; v->value = Q_atof (v->string); v->integer = Q_atoi (v->string); StringToRGB_W(v->string, v->color); v->modified = true; #ifdef WITH_TCL TCL_RegisterVariable (v); #endif return v; }
/* ============ Cvar_RegisterVariable Adds a freestanding variable to the variable list. ============ */ void Cvar_RegisterVariable (cvar_t *variable) { char *oldstr; // first check to see if it has allready been defined if (Cvar_FindVar (variable->name)) { Con_Printf ("Can't register variable %s, allready defined\n", variable->name); return; } // check for overlap with a command if (Cmd_Exists (variable->name)) { Con_Printf ("Cvar_RegisterVariable: %s is a command\n", variable->name); return; } // copy the value off, because future sets will Z_Free it oldstr = variable->string; variable->string = (char*) Z_Malloc (Q_strlen(variable->string)+1); Q_strcpy (variable->string, oldstr); variable->value = Q_atof (variable->string); // link the variable in variable->next = cvar_vars; cvar_vars = variable; }
// 2000-04-30 NVS HANDSHAKE SRV<->QC/SRV<->CL by Maddes void Host_NVS_Max_Server_f (void) { float value; if (Cmd_Argc() < 2) // not enough arguments { Con_Printf("%s: Maximum possible NVS server version is %1.2f", Cmd_Argv(0), nvs_current_ssvc->maxvalue); if (nvs_current_ssvc->maxvalue != MAX_NVS_VERSION) { Con_Printf(", highest maximum is %1.2f", MAX_NVS_VERSION); } Con_Printf("\nSyntax: %s <version>\n", Cmd_Argv(0)); return; } value = Q_atof(Cmd_Argv(1)); if (value > MAX_NVS_VERSION) { Con_Printf("%s: NVS server version %1.2f is not supported, highest version is %1.2f\n", Cmd_Argv(0), value, MAX_NVS_VERSION); return; } if (value < 0) { value = MAX_NVS_VERSION; } nvs_current_ssvc->maxvalue = value; Con_Printf("%s: Maximum possible NVS server version set to %1.2f, change will take effect on next level\n", Cmd_Argv(0), nvs_current_ssvc->maxvalue); }
/* ============ Cvar_Set ============ */ void Cvar_Set (const char *var_name, const char *value) { cvar_t *var; qboolean changed; var = Cvar_FindVar (var_name); if (!var) { // there is an error in C code if this happens Con_Printf ("Cvar_Set: variable %s not found\n", var_name); return; } changed = Q_strcmp(var->string, value); Z_Free (var->string); // free the old value string var->string = (char*) Z_Malloc (Q_strlen(value)+1); Q_strcpy (var->string, value); var->value = Q_atof (var->string); if (var->server && changed) { if (sv.active) SV_BroadcastPrintf ("\"%s\" changed to \"%s\"\n", var->name, var->string); } }
void OnChange_m_filter(struct cvar_s *var, char *value, qbool *cancel) { float fval = Q_atof(value); if (fval != 0) { Com_Printf("Warning: m_filter adds a delay to the input processing\n"); } }
/* ================ Sys_GetMemory ================ */ void Sys_GetMemory(void) { int j, tsize; j = COM_CheckParm("-mem"); if (j) { quakeparms.memsize = (int) (Q_atof(com_argv[j+1]) * 1024 * 1024); quakeparms.membase = malloc (quakeparms.memsize); } else { quakeparms.membase = dos_getmaxlockedmem (&quakeparms.memsize); } fprintf(stderr, "malloc'd: %d\n", quakeparms.memsize); if (COM_CheckParm ("-heapsize")) { tsize = Q_atoi (com_argv[COM_CheckParm("-heapsize") + 1]) * 1024; if (tsize < quakeparms.memsize) quakeparms.memsize = tsize; } }
/* ================== CL_FullServerinfo_f Sent by server when serverinfo changes ================== */ void CL_FullServerinfo_f (void) { char *p; float v; if (Cmd_Argc() != 2) return; strlcpy (cl.serverinfo, Cmd_Argv(1), sizeof(cl.serverinfo)); p = Info_ValueForKey (cl.serverinfo, "*cheats"); if (*p) { Com_Printf ("*** cheats are enabled ***\n"); // allow renderer cheats only if running a local server r_refdef2.allow_cheats = com_serveractive; } else r_refdef2.allow_cheats = false; if (cls.demoplayback) r_refdef2.allow_cheats = true; CL_ProcessServerInfo (); if (cls.state < ca_active) { if (!com_serveractive) { if (*(p = Info_ValueForKey(cl.serverinfo, "*version"))) { if ((v = Q_atof(p))) Com_Printf("QuakeWorld %1.2f server\n", v); else Com_Printf("Server is %s\n", p); } } } }
/* =========== Cvar_Get =========== */ cvar_t *Cvar_Get (const char *name, const char *string, int cvarflags) { cvar_t *var; int key; var = Cvar_Find(name); if (var) { var->flags &= ~CVAR_TEMP; var->flags |= cvarflags; return var; } // allocate a new cvar var = (cvar_t *) Q_malloc (sizeof(cvar_t)); // link it in var->next = cvar_vars; cvar_vars = var; key = Com_HashKey (name); var->hash_next = cvar_hash[key]; cvar_hash[key] = var; // Q_malloc returns unitialized memory, so make sure all fields // are initialized here var->name = Q_strdup (name); var->string = Q_strdup (string); var->flags = cvarflags | CVAR_DYNAMIC; var->value = Q_atof (var->string); var->OnChange = NULL; // FIXME, check userinfo/serverinfo return var; }
void VID_Gamma_f (void) { float g, f, inf; int i; if (Cmd_Argc () == 2) { g = Q_atof (Cmd_Argv(1)); for (i=0 ; i<255 ; i++) { f = pow ((i+1)/256.0, g); inf = f*255 + 0.5; if (inf < 0) inf = 0; if (inf > 255) inf = 255; vid_gamma[i] = inf; } VID_SetPalette (current_palette); vid.recalc_refdef = 1; // force a surface cache flush } }
virtual bool Init( IMaterial *pMaterial, KeyValues *pKeyValues ) { m_pMaterial = pMaterial; const char *pResult = pKeyValues->GetString( "resultVar", NULL ); if ( !pResult ) return false; bool found; m_pResult = m_pMaterial->FindVar( pResult, &found ); if ( !found ) { m_pResult = NULL; return false; } if ( !Q_stricmp( pResult, "$alpha" ) ) { pMaterial->SetMaterialVarFlag( MATERIAL_VAR_ALPHA_MODIFIED_BY_PROXY, true ); } pResult = pKeyValues->GetString( "easein", NULL ); if( pResult && Q_atoi( pResult ) != 0 ) { m_bEaseIn = true; } pResult = pKeyValues->GetString( "easeout", NULL ); if( pResult && Q_atoi( pResult ) != 0 ) { m_bEaseOut = true; } pResult = pKeyValues->GetString( "start", NULL ); if( pResult ) { m_fStart = Q_atof( pResult ); } pResult = pKeyValues->GetString( "end", NULL ); if( pResult ) { m_fEnd = Q_atof( pResult ); } return true; }
/* ============ Cvar_Register Adds a freestanding variable to the variable list. If the variable already exists, the value will not be set The flags will be or'ed in if the variable exists. ============ */ EXTERNC void Cvar_Register (cvar_t *var) { char string[512]; int key; cvar_t *old; // first check to see if it has already been defined old = Cvar_Find (var->name); if (old && !(old->flags & CVAR_DYNAMIC)) { if (old == var) return; Com_Printf ("Can't register variable %s, already defined\n", var->name); return; } #if 0 // check for overlap with a command if (Cmd_Exists (var->name)) { Com_Printf ("Cvar_Register: %s is a command\n", var->name); return; } #endif if (old) { var->flags |= old->flags & ~(CVAR_DYNAMIC|CVAR_TEMP); strlcpy (string, old->string, sizeof(string)); Cvar_Delete (old->name); if (!(var->flags & CVAR_ROM)) var->string = Q_strdup (string); else var->string = Q_strdup (var->string); } else { // allocate the string on heap because future sets will Q_free it var->string = Q_strdup (var->string); } var->value = Q_atof (var->string); // link the variable in key = Com_HashKey (var->name); var->hash_next = cvar_hash[key]; cvar_hash[key] = var; var->next = cvar_vars; cvar_vars = var; #ifndef CLIENTONLY if (var->flags & CVAR_SERVERINFO) SV_ServerinfoChanged (var->name, var->string); #endif #ifndef SERVERONLY if (var->flags & CVAR_USERINFO) CL_UserinfoChanged (var->name, var->string); #endif }
static qboolean vid_conheight_callback(cvar_t *var, char *value) { var->value = Q_atof(value); set_up_conwidth_conheight(); return false; }
/* <69a4f> ../cstrike/dlls/doors.cpp:201 */ void CBaseDoor::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { //skin is used for content type if (FStrEq(pkvd->szKeyName, "skin")) { pev->skin = (int)Q_atof(pkvd->szValue); pkvd->fHandled = TRUE; } else if (FStrEq(pkvd->szKeyName, "movesnd")) { m_bMoveSnd = (int)Q_atof(pkvd->szValue); pkvd->fHandled = TRUE; } else if (FStrEq(pkvd->szKeyName, "stopsnd")) { m_bStopSnd = (int)Q_atof(pkvd->szValue); pkvd->fHandled = TRUE; } else if (FStrEq(pkvd->szKeyName, "healthvalue")) { m_bHealthValue = (int)Q_atof(pkvd->szValue); pkvd->fHandled = TRUE; } else if (FStrEq(pkvd->szKeyName, "locked_sound")) { m_bLockedSound = (int)Q_atof(pkvd->szValue); pkvd->fHandled = TRUE; } else if (FStrEq(pkvd->szKeyName, "locked_sentence")) { m_bLockedSentence = (int)Q_atof(pkvd->szValue); pkvd->fHandled = TRUE; } else if (FStrEq(pkvd->szKeyName, "unlocked_sound")) { m_bUnlockedSound = (int)Q_atof(pkvd->szValue); pkvd->fHandled = TRUE; } else if (FStrEq(pkvd->szKeyName, "unlocked_sentence")) { m_bUnlockedSentence = (int)Q_atof(pkvd->szValue); pkvd->fHandled = TRUE; } else if (FStrEq(pkvd->szKeyName, "WaveHeight")) { pev->scale = Q_atof(pkvd->szValue) * (1.0 / 8.0); pkvd->fHandled = TRUE; } else CBaseToggle::KeyValue(pkvd); }
// 2000-04-30 NVS HANDSHAKE SRV<->CL/QC<->CL by Maddes void Host_NVS_Request_f (void) { float value; if (cmd_source == src_command) // this a client remote only command { Con_Printf("%s is not valid from the console\n", Cmd_Argv(0)); return; } if (Cmd_Argc() < 2) // not enough arguments { SV_ClientPrintf("%s: not enough arguments\n", Cmd_Argv(0)); SV_ClientPrintf("Syntax: %s <version>\n", Cmd_Argv(0)); return; } Con_DPrintf("Server received NVS client version %s from client %i\n", Cmd_Argv(1), NUM_FOR_EDICT(host_client->edict)); // 2001-12-24 Keeping full backwards compatibility by Maddes start if (sv_compatibility->value) // do not reply, like the original Quake executable { return; } // 2001-12-24 Keeping full backwards compatibility by Maddes end // get and check value value = Q_atof(Cmd_Argv(1)); if (value < 0) { SV_ClientPrintf ("Only positive NVS versions are accepted.\n"); return; } // determine and store client NVS versions host_client->nvs_cmax = value; host_client->nvs_cclc = (value < MAX_NVS_VERSION) ? value : MAX_NVS_VERSION; host_client->nvs_csvc = (value < nvs_current_ssvc->value) ? value : nvs_current_ssvc->value; // check client against required version if (NVS_RejectClient()) { return; } // tell client the NVS versions, only when necessary or when client changes during a running game // NECESSARY (GOOD) HACK: This is a special case were not the client's SVC is of importance if (host_client->nvs_cclc || nvs_current_ssvc->value || host_client->spawned) { MSG_WriteByte (&host_client->message, svc_extra_version); MSG_WriteByte (&host_client->message, VERSION_NVS); MSG_WriteFloat (&host_client->message, nvs_current_ssvc->value); MSG_WriteFloat (&host_client->message, host_client->nvs_csvc); MSG_WriteFloat (&host_client->message, host_client->nvs_cclc); Con_DPrintf("Server sends NVS versions SSVC %1.2f CSVC %1.2f CCLC %1.2f to client %i\n", nvs_current_ssvc->value, host_client->nvs_csvc, host_client->nvs_cclc, NUM_FOR_EDICT(host_client->edict)); } }
/* ============ Cvar_VariableValue ============ */ float Cvar_VariableValue (const char *var_name) { cvar_t *var; var = Cvar_FindVar (var_name); if (!var) return 0; return Q_atof (var->string); }