本文整理汇总了C++中Cvar_VariableIntegerValue函数的典型用法代码示例。如果您正苦于以下问题:C++ Cvar_VariableIntegerValue函数的具体用法?C++ Cvar_VariableIntegerValue怎么用?C++ Cvar_VariableIntegerValue使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Cvar_VariableIntegerValue函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IN_DeactivateMouse
static void IN_DeactivateMouse(void)
{
if (!SDL_WasInit(SDL_INIT_VIDEO))
{
return;
}
SDL_SetRelativeMouseMode( SDL_FALSE );
// Always show the cursor when the mouse is disabled,
// but not when fullscreen
if (!Cvar_VariableIntegerValue("r_fullscreen"))
SDL_ShowCursor(1);
if (!mouseAvailable)
{
return;
}
if (mouseActive)
{
IN_GobbleMotionEvents();
SDL_SetWindowGrab( SDLvidscreen, SDL_FALSE );
mouseActive = qfalse;
}
}
示例2: exited
/*
==================
SV_Map_f
Restart the server on a different map, but clears a cvar so that typing "map blah" doesn't try and preserve
player weapons/ammo/etc from the previous level that you haven't really exited (ie ignores KEEP_PREV on spawn points)
==================
*/
static void SV_Map_f( void )
{
Cvar_Set( sCVARNAME_PLAYERSAVE, "");
Cvar_Set( "spawntarget", "" );
Cvar_Set("tier_storyinfo", "0");
Cvar_Set("tiers_complete", "");
// SCR_UnprecacheScreenshot();
ForceReload_e eForceReload = eForceReload_NOTHING; // default for normal load
char *cmd = Cmd_Argv( 0 );
if ( !Q_stricmp( cmd, "devmapbsp") )
eForceReload = eForceReload_BSP;
else if ( !Q_stricmp( cmd, "devmapmdl") )
eForceReload = eForceReload_MODELS;
else if ( !Q_stricmp( cmd, "devmapall") )
eForceReload = eForceReload_ALL;
qboolean cheat = (qboolean)(!Q_stricmpn( cmd, "devmap", 6 ) );
// retain old cheat state
if ( !cheat && Cvar_VariableIntegerValue( "helpUsObi" ) )
cheat = qtrue;
if (SV_Map_( eForceReload ))
{
// set the cheat value
// if the level was started with "map <levelname>", then
// cheats will not be allowed. If started with "devmap <levelname>"
// then cheats will be allowed
Cvar_Set( "helpUsObi", cheat ? "1" : "0" );
}
}
示例3: SCR_UpdateScreen
// This is called every frame, and can also be called explicitly to flush text to the screen.
void SCR_UpdateScreen( void ) {
static int recursive;
if ( !scr_initialized ) {
return; // not initialized yet
}
if ( ++recursive > 2 ) {
Com_Error( ERR_FATAL, "SCR_UpdateScreen: recursively called" );
}
recursive = 1;
// If there is no VM, there are also no rendering commands issued. Stop the renderer in
// that case.
if ( cls.uiStarted || com_dedicated->integer )
{
// XXX
int in_anaglyphMode = Cvar_VariableIntegerValue("r_anaglyphMode");
// if running in stereo, we need to draw the frame twice
if ( cls.glconfig.stereoEnabled || in_anaglyphMode) {
SCR_DrawScreenField( STEREO_LEFT );
SCR_DrawScreenField( STEREO_RIGHT );
} else {
SCR_DrawScreenField( STEREO_CENTER );
}
if ( com_speeds->integer ) {
re->EndFrame( &time_frontend, &time_backend );
} else {
re->EndFrame( NULL, NULL );
}
}
recursive = 0;
}
示例4: IN_AutoMapToggle
void IN_AutoMapToggle(void)
{
if (Cvar_VariableIntegerValue("cg_drawRadar"))
{
Cvar_Set("cg_drawRadar", "0");
}
else
{
Cvar_Set("cg_drawRadar", "1");
}
/*
if (r_autoMap && r_autoMap->integer)
{ //automap off, radar on
Cvar_Set("r_autoMap", "0");
Cvar_Set("cg_drawRadar", "1");
}
else if (Cvar_VariableIntegerValue("cg_drawRadar"))
{ //radar off, automap should be off too
Cvar_Set("cg_drawRadar", "0");
}
else
{ //turn automap on
Cvar_Set("r_autoMap", "1");
}
*/
}
示例5: IN_DeactivateMouse
/*
===============
IN_DeactivateMouse
===============
*/
void IN_DeactivateMouse( void )
{
if ( !SDL_WasInit( SDL_INIT_VIDEO ) )
{
return;
}
// Always show the cursor when the mouse is disabled,
// but not when fullscreen
if ( !Cvar_VariableIntegerValue( "r_fullscreen" ) )
{
SDL_ShowCursor( 1 );
}
if ( !mouseAvailable )
{
return;
}
#ifdef MACOS_X_ACCELERATION_HACK
if ( mouseActive ) // mac os x mouse accel hack
{
if ( originalMouseSpeed != -1.0 )
{
io_connect_t mouseDev = IN_GetIOHandle();
if ( mouseDev != 0 )
{
Com_DPrintf( "restoring mouse acceleration to: %f\n", originalMouseSpeed );
if ( IOHIDSetAccelerationWithKey( mouseDev, CFSTR( kIOHIDMouseAccelerationType ), originalMouseSpeed ) != kIOReturnSuccess )
{
Com_DPrintf( "Could not re-enable mouse acceleration (failed at IOHIDSetAccelerationWithKey).\n" );
}
IOServiceClose( mouseDev );
}
else
{
Com_DPrintf( "Could not re-enable mouse acceleration (failed at IO_GetIOHandle).\n" );
}
}
}
#endif
if ( mouseActive )
{
IN_GobbleMotionEvents();
SDL_WM_GrabInput( SDL_GRAB_OFF );
// Don't warp the mouse unless the cursor is within the window
//if( SDL_GetAppState( ) & SDL_APPMOUSEFOCUS )
//SDL_WarpMouse( cls.glconfig.vidWidth / 2, cls.glconfig.vidHeight / 2 );
mouseActive = qfalse;
}
}
示例6: BotNumTeamMates
/*
==================
BotNumTeamMates
==================
*/
int BotNumTeamMates(bot_state_t *bs)
{
int i, numplayers;
char buf[MAX_INFO_STRING];
static int maxclients;
if (!maxclients)
maxclients = Cvar_VariableIntegerValue("sv_maxclients");
numplayers = 0;
for (i = 0; i < maxclients && i < MAX_CLIENTS; i++)
{
SV_SetConfigstring(CS_PLAYERS+i, buf);
//if no config string or no name
if (!strlen(buf) || !strlen(Info_ValueForKey(buf, "n"))) continue;
//skip spectators
if (atoi(Info_ValueForKey(buf, "t")) == TEAM_SPECTATOR) continue;
//
if (BotSameTeam(bs, i))
{
numplayers++;
}
}
return numplayers;
}
示例7: Sys_GLimpInit
/*
==============
Sys_GLimpInit
Windows specific GL implementation initialisation
==============
*/
void Sys_GLimpInit( void )
{
#ifndef DEDICATED
if( !SDL_VIDEODRIVER_externallySet )
{
// It's a little bit weird having in_mouse control the
// video driver, but from ioq3's point of view they're
// virtually the same except for the mouse input anyway
if( Cvar_VariableIntegerValue( "in_mouse" ) == -1 )
{
// Use the windib SDL backend, which is closest to
// the behaviour of idq3 with in_mouse set to -1
_putenv( "SDL_VIDEODRIVER=windib" );
}
else
{
// Use the DirectX SDL backend
_putenv( "SDL_VIDEODRIVER=directx" );
}
// RTCW treats all keys the same by default.
_putenv("SDL_DISABLE_LOCK_KEYS=1");
}
#endif
}
示例8: IN_ActivateMouse
/*
===============
IN_ActivateMouse
===============
*/
static void IN_ActivateMouse( void )
{
if (!mouseAvailable || !SDL_WasInit( SDL_INIT_VIDEO ) )
return;
if( !mouseActive )
{
SDL_SetRelativeMouseMode( SDL_TRUE );
SDL_SetWindowGrab( SDL_window, 1 );
IN_GobbleMotionEvents( );
}
// in_nograb makes no sense in fullscreen mode
if( !Cvar_VariableIntegerValue("r_fullscreen") )
{
if( in_nograb->modified || !mouseActive )
{
if( in_nograb->integer )
SDL_SetWindowGrab( SDL_window, 0 );
else
SDL_SetWindowGrab( SDL_window, 1 );
in_nograb->modified = qfalse;
}
}
mouseActive = qtrue;
}
示例9: SVT3_BotInitBotLib
void SVT3_BotInitBotLib() {
if ( debugpolygons ) {
Mem_Free( debugpolygons );
}
bot_maxdebugpolys = GGameType & GAME_Quake3 ? Cvar_VariableIntegerValue( "bot_maxdebugpolys" ) : 128;
debugpolygons = ( bot_debugpoly_t* )Mem_Alloc( sizeof ( bot_debugpoly_t ) * bot_maxdebugpolys );
}
示例10: CL_SystemInfoChanged
/*
==================
CL_SystemInfoChanged
The systeminfo configstring has been changed, so parse
new information out of it. This will happen at every
gamestate, and possibly during gameplay.
==================
*/
void CL_SystemInfoChanged( void ) {
char *systemInfo;
const char *s;
char key[MAX_INFO_KEY];
char value[MAX_INFO_VALUE];
systemInfo = cl.gameState.stringData + cl.gameState.stringOffsets[ CS_SYSTEMINFO ];
cl.serverId = atoi( Info_ValueForKey( systemInfo, "sv_serverid" ) );
s = Info_ValueForKey( systemInfo, "helpUsObi" );
if ( atoi(s) == 0 ) {
Cvar_SetCheatState();
}
// scan through all the variables in the systeminfo and locally set cvars to match
s = systemInfo;
while ( s ) {
Info_NextPair( &s, key, value );
if ( !key[0] ) {
break;
}
Cvar_Set( key, value );
}
extern cvar_t *s_language;
if ( ( Q_stricmp( "DEUTSCH", s_language->string ) == 0 )//voice language is German
|| (sp_language->integer == SP_LANGUAGE_GERMAN )//text language is German
|| Cvar_VariableIntegerValue("ui_iscensored") == 1 )
{
Cvar_Set( "g_dismemberment", "0");
}
}
示例11: IN_DeactivateMouse
/*
===============
IN_DeactivateMouse
===============
*/
static void IN_DeactivateMouse( void )
{
if( !SDL_WasInit( SDL_INIT_VIDEO ) )
return;
// Always show the cursor when the mouse is disabled,
// but not when fullscreen
if( !Cvar_VariableIntegerValue("r_fullscreen") )
SDL_ShowCursor( 1 );
if( !mouseAvailable )
return;
if( mouseActive )
{
IN_GobbleMotionEvents( );
SDL_SetWindowGrab( SDL_window, SDL_FALSE );
SDL_SetRelativeMouseMode( SDL_FALSE );
// Don't warp the mouse unless the cursor is within the window
if( SDL_GetWindowFlags( SDL_window ) & SDL_WINDOW_MOUSE_FOCUS )
SDL_WarpMouseInWindow( SDL_window, cls.glconfig.vidWidth / 2, cls.glconfig.vidHeight / 2 );
mouseActive = qfalse;
}
}
示例12: R_CullPointAndRadius
/*
** R_CullPointAndRadius
*/
int R_CullPointAndRadius( const vec3_t pt, float radius )
{
int i;
float dist;
cplane_t *frust;
qboolean mightBeClipped = qfalse;
if ( r_nocull->integer==1 ) {
return CULL_CLIP;
}
// check against frustum planes
#ifndef __NO_JK2
if( Cvar_VariableIntegerValue("com_jk2") )
{
// They used 4 frustrum planes in JK2, and 5 in JKA --eez
for (i = 0 ; i < 4 ; i++)
{
frust = &tr.viewParms.frustum[i];
dist = DotProduct( pt, frust->normal) - frust->dist;
if ( dist < -radius )
{
return CULL_OUT;
}
else if ( dist <= radius )
{
mightBeClipped = qtrue;
}
}
}
else
{
#endif
for (i = 0 ; i < 5 ; i++)
{
frust = &tr.viewParms.frustum[i];
dist = DotProduct( pt, frust->normal) - frust->dist;
if ( dist < -radius )
{
return CULL_OUT;
}
else if ( dist <= radius )
{
mightBeClipped = qtrue;
}
}
#ifndef __NO_JK2
}
#endif
if ( mightBeClipped )
{
return CULL_CLIP;
}
return CULL_IN; // completely inside frustum
}
示例13: Sys_DLLNeedsUnpacking
bool Sys_DLLNeedsUnpacking()
{
#if defined(_JK2EXE)
return false;
#else
return Cvar_VariableIntegerValue("sv_pure") != 0;
#endif
}
示例14: G_ItemDisabled
/*
============
G_ItemDisabled
============
*/
int G_ItemDisabled( gitem_t *item )
{
char name[128];
Com_sprintf(name, sizeof(name), "disable_%s", item->classname);
return Cvar_VariableIntegerValue( name );
}
示例15: GLimp_StartDriverAndSetMode
/*
===============
GLimp_StartDriverAndSetMode
===============
*/
static qboolean GLimp_StartDriverAndSetMode(glconfig_t *glConfig, const windowDesc_t *windowDesc, int mode, qboolean fullscreen, qboolean noborder)
{
rserr_t err;
if (!SDL_WasInit(SDL_INIT_VIDEO))
{
const char *driverName;
if (SDL_Init(SDL_INIT_VIDEO) == -1)
{
Com_Printf( "SDL_Init( SDL_INIT_VIDEO ) FAILED (%s)\n", SDL_GetError());
return qfalse;
}
driverName = SDL_GetCurrentVideoDriver();
if (!driverName)
{
Com_Error( ERR_FATAL, "No video driver initialized" );
return qfalse;
}
Com_Printf( "SDL using driver \"%s\"\n", driverName );
Cvar_Set( "r_sdlDriver", driverName );
}
if (SDL_GetNumVideoDisplays() <= 0)
{
Com_Error( ERR_FATAL, "SDL_GetNumVideoDisplays() FAILED (%s)", SDL_GetError() );
}
if (fullscreen && Cvar_VariableIntegerValue( "in_nograb" ) )
{
Com_Printf( "Fullscreen not allowed with in_nograb 1\n");
Cvar_Set( "r_fullscreen", "0" );
r_fullscreen->modified = qfalse;
fullscreen = qfalse;
}
err = GLimp_SetMode(glConfig, windowDesc, CLIENT_WINDOW_TITLE, mode, fullscreen, noborder);
switch ( err )
{
case RSERR_INVALID_FULLSCREEN:
Com_Printf( "...WARNING: fullscreen unavailable in this mode\n" );
return qfalse;
case RSERR_INVALID_MODE:
Com_Printf( "...WARNING: could not set the given mode (%d)\n", mode );
return qfalse;
case RSERR_UNKNOWN:
Com_Printf( "...ERROR: no display modes could be found.\n" );
return qfalse;
default:
break;
}
return qtrue;
}