本文整理汇总了C++中CVAR_GET_FLOAT函数的典型用法代码示例。如果您正苦于以下问题:C++ CVAR_GET_FLOAT函数的具体用法?C++ CVAR_GET_FLOAT怎么用?C++ CVAR_GET_FLOAT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CVAR_GET_FLOAT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Draw
int CHudStatusBar :: Draw( float fTime )
{
this->ReparseStringIfNeeded();
// Draw the status bar lines
for ( int i = 0; i < MAX_STATUSBAR_LINES; i++ )
{
int TextHeight, TextWidth;
GetConsoleStringSize( m_szStatusBar[i], &TextWidth, &TextHeight );
int Y_START;
if ( ScreenHeight() >= 480 )
Y_START = ScreenHeight() - 55;
else
Y_START = ScreenHeight() - 45;
int x = 5;
int y = Y_START - ( TextHeight * i ); // draw along bottom of screen
// let user set status ID bar centering
if ( (i == STATUSBAR_ID_LINE) && CVAR_GET_FLOAT("hud_centerid") )
{
x = max( 0, max(2, (ScreenWidth() - TextWidth)) / 2 );
y = (ScreenHeight() / 2) + (TextHeight*CVAR_GET_FLOAT("hud_centerid"));
}
if ( m_pflNameColors[i] )
DrawSetTextColor( m_pflNameColors[i][0], m_pflNameColors[i][1], m_pflNameColors[i][2] );
DrawConsoleString( x, y, m_szStatusBar[i] );
}
return 1;
}
示例2: UI_CreateGame_Begin
/*
=================
UI_CreateGame_Begin
=================
*/
static void UI_CreateGame_Begin( void )
{
if( !MAP_IS_VALID( uiCreateGame.mapName[uiCreateGame.mapsList.curItem] ))
return; // bad map
if( CVAR_GET_FLOAT( "host_serverstate" ) && CVAR_GET_FLOAT( "maxplayers" ) == 1 )
HOST_ENDGAME( "end of the game" );
CVAR_SET_FLOAT( "deathmatch", 1.0f ); // FIXME
CVAR_SET_FLOAT( "maxplayers", atoi( uiCreateGame.maxClients.buffer ));
CVAR_SET_STRING( "hostname", uiCreateGame.hostName.buffer );
CVAR_SET_STRING( "defaultmap", uiCreateGame.mapName[uiCreateGame.mapsList.curItem] );
// all done, start server
if( uiCreateGame.dedicatedServer.enabled )
{
HOST_WRITECONFIG ( CVAR_GET_STRING( "servercfgfile" ));
char cmd[128];
sprintf( cmd, "#%s", gMenu.m_gameinfo.gamefolder );
// NOTE: dedicated server will be executed "defaultmap"
// from engine after restarting
HOST_CHANGEGAME( cmd, "Starting dedicated server...\n" );
}
else
{
HOST_WRITECONFIG ( CVAR_GET_STRING( "lservercfgfile" ));
char cmd[128];
sprintf( cmd, "exec %s\nmap %s\n", CVAR_GET_STRING( "lservercfgfile" ), CVAR_GET_STRING( "defaultmap" ));
CLIENT_COMMAND( FALSE, cmd );
}
}
示例3: UI_PlayerSetup_GetConfig
/*
=================
UI_PlayerSetup_GetConfig
=================
*/
static void UI_PlayerSetup_GetConfig( void )
{
int i;
strncpy( uiPlayerSetup.name.buffer, CVAR_GET_STRING( "name" ), sizeof( uiPlayerSetup.name.buffer ));
// find models
UI_PlayerSetup_FindModels();
// select current model
for( i = 0; i < uiPlayerSetup.num_models; i++ )
{
if( !stricmp( uiPlayerSetup.models[i], CVAR_GET_STRING( "model" )))
{
uiPlayerSetup.model.curValue = (float)i;
break;
}
}
if( gMenu.m_gameinfo.flags & GFL_NOMODELS )
uiPlayerSetup.model.curValue = 0.0f; // force to default
strcpy( uiPlayerSetup.currentModel, uiPlayerSetup.models[(int)uiPlayerSetup.model.curValue] );
uiPlayerSetup.model.maxValue = (float)(uiPlayerSetup.num_models - 1);
uiPlayerSetup.topColor.curValue = CVAR_GET_FLOAT( "topcolor" ) / 255;
uiPlayerSetup.bottomColor.curValue = CVAR_GET_FLOAT( "bottomcolor" ) / 255;
if( CVAR_GET_FLOAT( "cl_himodels" ))
uiPlayerSetup.hiModels.enabled = 1;
if( CVAR_GET_FLOAT( "ui_showmodels" ))
uiPlayerSetup.showModels.enabled = 1;
}
示例4: UI_PromptDialog
static void UI_PromptDialog( void )
{
if( !CVAR_GET_FLOAT( "host_serverstate" ) || CVAR_GET_FLOAT( "sv_background" ))
{
UI_CreateGame_Begin();
return;
}
// toggle main menu between active\inactive
// show\hide quit dialog
uiCreateGame.advOptions.generic.flags ^= QMF_INACTIVE;
uiCreateGame.done.generic.flags ^= QMF_INACTIVE;
uiCreateGame.cancel.generic.flags ^= QMF_INACTIVE;
uiCreateGame.maxClients.generic.flags ^= QMF_INACTIVE;
uiCreateGame.hostName.generic.flags ^= QMF_INACTIVE;
uiCreateGame.password.generic.flags ^= QMF_INACTIVE;
uiCreateGame.dedicatedServer.generic.flags ^= QMF_INACTIVE;
uiCreateGame.hltv.generic.flags ^= QMF_INACTIVE;
uiCreateGame.mapsList.generic.flags ^= QMF_INACTIVE;
uiCreateGame.msgBox.generic.flags ^= QMF_HIDDEN;
uiCreateGame.dlgMessage1.generic.flags ^= QMF_HIDDEN;
uiCreateGame.dlgMessage2.generic.flags ^= QMF_HIDDEN;
uiCreateGame.no.generic.flags ^= QMF_HIDDEN;
uiCreateGame.yes.generic.flags ^= QMF_HIDDEN;
}
示例5: BEGIN_READ
int CHud::MsgFunc_SetFOV(const char *pszName, int iSize, void *pbuf)
{
BEGIN_READ( pbuf, iSize );
int newfov = READ_BYTE();
int def_fov = CVAR_GET_FLOAT( "default_fov" );
if ( newfov == 0 )
{
m_iFOV = def_fov;
}
else
{
m_iFOV = newfov;
}
// the clients fov is actually set in the client data update section of the hud
// Set a new sensitivity
if ( m_iFOV == def_fov )
{
// reset to saved sensitivity
m_flMouseSensitivity = 0;
}
else
{
// set a new sensitivity that is proportional to the change from the FOV default
m_flMouseSensitivity = sensitivity->value * ((float)newfov / (float)def_fov) * CVAR_GET_FLOAT("zoom_sensitivity_ratio");
}
return 1;
}
示例6: UI_GamePad_GetConfig
/*
=================
UI_GamePad_GetConfig
=================
*/
static void UI_GamePad_GetConfig( void )
{
float side, forward, pitch, yaw;
char binding[7] = { 0 };
static char lt_threshold_text[8], rt_threshold_text[8];
strncpy( binding, CVAR_GET_STRING( "joy_axis_binding"), sizeof( binding ));
side = CVAR_GET_FLOAT( "joy_side" );
forward = CVAR_GET_FLOAT( "joy_forward" );
pitch = CVAR_GET_FLOAT( "joy_pitch" );
yaw = CVAR_GET_FLOAT( "joy_yaw" );
uiGamePad.side.curValue = fabs( side );
uiGamePad.forward.curValue = fabs( forward );
uiGamePad.pitch.curValue = fabs( pitch );
uiGamePad.yaw.curValue = fabs( yaw );
uiGamePad.invSide.enabled = side < 0.0f ? true: false;
uiGamePad.invFwd.enabled = forward < 0.0f ? true: false;
uiGamePad.invPitch.enabled = pitch < 0.0f ? true: false;
uiGamePad.invYaw.enabled = yaw < 0.0f ? true: false;
// I made a monster...
for( int i = 0; i < sizeof( binding ) - 1; i++ )
{
switch( binding[i] )
{
case 's':
uiGamePad.axisBind[i].generic.name = axisNames[JOY_AXIS_SIDE];
uiGamePad.axisBind[i].curValue = JOY_AXIS_SIDE;
break;
case 'f':
uiGamePad.axisBind[i].generic.name = axisNames[JOY_AXIS_FWD];
uiGamePad.axisBind[i].curValue = JOY_AXIS_FWD;
break;
case 'p':
uiGamePad.axisBind[i].generic.name = axisNames[JOY_AXIS_PITCH];
uiGamePad.axisBind[i].curValue = JOY_AXIS_PITCH;
break;
case 'y':
uiGamePad.axisBind[i].generic.name = axisNames[JOY_AXIS_YAW];
uiGamePad.axisBind[i].curValue = JOY_AXIS_YAW;
break;
case 'r':
uiGamePad.axisBind[i].generic.name = axisNames[JOY_AXIS_RT];
uiGamePad.axisBind[i].curValue = JOY_AXIS_RT;
break;
case 'l':
uiGamePad.axisBind[i].generic.name = axisNames[JOY_AXIS_LT];
uiGamePad.axisBind[i].curValue = JOY_AXIS_LT;
break;
default:
uiGamePad.axisBind[i].generic.name = axisNames[JOY_AXIS_NULL];
uiGamePad.axisBind[i].curValue = JOY_AXIS_NULL;
}
}
}
示例7: VARS
void CBlackHole::RadiusDamage( )
{
CBaseEntity *pEntity = NULL;
TraceResult tr;
float flAdjustedDamage;
Vector vecSpot;
entvars_t *pevOwner = VARS( pev->owner );
Vector vecSrc = pev->origin + Vector(0,0,1);
if ( !pevOwner )
pevOwner = pev;
CBaseEntity *pPlayer = CBaseEntity::Instance (pevOwner);
// iterate on all entities in the vicinity.
while ((pEntity = UTIL_FindEntityInSphere( pEntity, vecSrc, (dmg_chrono_radius.value * (mp_wpn_power.value/100)) )) != NULL)
{
if ( pEntity->pev->movetype != MOVETYPE_PUSH && pEntity->pev->movetype != MOVETYPE_NONE && pEntity->pev->movetype != MOVETYPE_FOLLOW && pEntity->pev->movetype != MOVETYPE_NOCLIP )
{
if (pEntity == this) continue;
if (CVAR_GET_FLOAT("mp_noselfdamage")==1 && pEntity->pev == pevOwner )
continue;
if (CVAR_GET_FLOAT("mp_noteamdamage")==1 && g_pGameRules->PlayerRelationship(pPlayer, pEntity) == GR_TEAMMATE && pEntity->pev != pevOwner)
continue;
vecSpot = pEntity->BodyTarget( vecSrc );
UTIL_TraceLine ( vecSrc, vecSpot, ignore_monsters, ENT(pev), &tr );
if ( tr.flFraction == 1.0 || tr.pHit == pEntity->edict() )
{
flAdjustedDamage = ( vecSrc - tr.vecEndPos ).Length();
if ( flAdjustedDamage < 1 )
flAdjustedDamage = 1;
Vector m_vel = ( vecSrc - tr.vecEndPos ).Normalize() * ((500 * (dmg_chrono_radius.value * (mp_wpn_power.value/100)) / flAdjustedDamage) + 150);
if (m_vel.Length() > 1000) m_vel = m_vel.Normalize() * 1000;
pEntity->pev->velocity = m_vel;
if (flAdjustedDamage < 200)
{
if (!(pEntity->Classify() == CLASS_MACHINE || pEntity->IsBot() || pEntity->IsPlayer() || FClassnameIs(pEntity->pev, "laser_dot") || FClassnameIs(pEntity->pev, "laser_spot")))
{
pEntity->Killed ( pevOwner, 0 );
return;
}
}
}
}
}
}
示例8: StartFrame
//
// GLOBALS ASSUMED SET: g_ulFrameCount
//
void StartFrame( void )
{
if ( g_pGameRules )
g_pGameRules->Think();
if ( g_fGameOver )
return;
gpGlobals->teamplay = CVAR_GET_FLOAT("teamplay");
g_iSkillLevel = CVAR_GET_FLOAT("skill");
g_ulFrameCount++;
}
示例9: UI_VidOptions_GetConfig
/*
=================
UI_VidOptions_GetConfig
=================
*/
static void UI_VidOptions_GetConfig( void )
{
uiVidOptions.screenSize.curValue = (CVAR_GET_FLOAT( "viewsize" ) - 20.0f ) / 100.0f;
uiVidOptions.gammaIntensity.curValue = (CVAR_GET_FLOAT( "vid_gamma" ) - 0.5f) / 1.8f;
uiVidOptions.glareReduction.curValue = (CVAR_GET_FLOAT( "r_flaresize" ) - 100.0f ) / 200.0f;
if( CVAR_GET_FLOAT( "r_fastsky" ))
uiVidOptions.fastSky.enabled = 1;
uiVidOptions.outlineWidth = 2;
UI_ScaleCoords( NULL, NULL, &uiVidOptions.outlineWidth, NULL );
}
示例10: UI_NewGame_StartGame
/*
=================
UI_NewGame_StartGame
=================
*/
static void UI_NewGame_StartGame( float skill )
{
if( CVAR_GET_FLOAT( "host_serverstate" ) && CVAR_GET_FLOAT( "maxplayers" ) > 1 )
HOST_ENDGAME( "end of the game" );
CVAR_SET_FLOAT( "skill", skill );
CVAR_SET_FLOAT( "deathmatch", 0.0f );
CVAR_SET_FLOAT( "teamplay", 0.0f );
CVAR_SET_FLOAT( "pausable", 1.0f ); // singleplayer is always allowing pause
CVAR_SET_FLOAT( "maxplayers", 1.0f );
CVAR_SET_FLOAT( "coop", 0.0f );
CLIENT_COMMAND( FALSE, "newgame\n" );
}
示例11: GibMonster
//=========================================================
// GibMonster - create some gore and get rid of a monster's
// model.
//=========================================================
void CBaseMonster :: GibMonster( void )
{
TraceResult tr;
BOOL gibbed = FALSE;
int iszCustomGibs;
EMIT_SOUND(ENT(pev), CHAN_WEAPON, "common/bodysplat.wav", 1, ATTN_NORM);
if ( iszCustomGibs = HasCustomGibs() ) //LRC - monster_generic can have a custom gibset
{
if ( CVAR_GET_FLOAT("violence_hgibs") != 0 )
{
CGib::SpawnHeadGib( pev, STRING(iszCustomGibs) );
CGib::SpawnRandomGibs( pev, 4, 1, STRING(iszCustomGibs) );
}
gibbed = TRUE;
}
// only humans throw skulls !!!UNDONE - eventually monsters will have their own sets of gibs
else if ( HasHumanGibs() )
{
if ( CVAR_GET_FLOAT("violence_hgibs") != 0 )// Only the player will ever fail this test
{
CGib::SpawnHeadGib( pev );
CGib::SpawnRandomGibs( pev, 4, 1 ); // throw some human gibs.
}
gibbed = TRUE;
}
else if ( HasAlienGibs() )
{
if ( CVAR_GET_FLOAT("violence_agibs") != 0 )// Should never fail this test, but someone might call it directly
{
CGib::SpawnRandomGibs( pev, 4, 0 ); // Throw alien gibs
}
gibbed = TRUE;
}
if ( !IsPlayer() )
{
if ( gibbed )
{
// don't remove players!
SetThink(&CBaseMonster :: SUB_Remove );
SetNextThink( 0 );
}
else
{
FadeMonster();
}
}
}
示例12: UI_GameOptions_GetConfig
/*
=================
UI_GameOptions_GetConfig
=================
*/
static void UI_GameOptions_GetConfig( void )
{
uiGameInitial.maxFPS = uiGameOptions.maxFPS.curValue = CVAR_GET_FLOAT( "fps_max" );
if( CVAR_GET_FLOAT( "hand" ))
uiGameInitial.hand = uiGameOptions.hand.enabled = 1;
if( CVAR_GET_FLOAT( "cl_run" ))
uiGameInitial.alwaysRun = uiGameOptions.alwaysRun.enabled = 1;
if( CVAR_GET_FLOAT( "sv_allow_download" ))
uiGameInitial.allowDownload = uiGameOptions.allowDownload.enabled = 1;
UI_GameOptions_UpdateConfig ();
}
示例13: UI_Main_NewGame
/*
=================
UI_Main_NewGame
=================
*/
static void UI_Main_NewGame( void )
{
if( CVAR_GET_FLOAT( "host_serverstate" ) && CVAR_GET_FLOAT( "maxplayers" ) > 1 )
HOST_ENDGAME( "end of the game" );
CVAR_SET_FLOAT( "skill", 1.0f );
CVAR_SET_FLOAT( "deathmatch", 0.0f );
CVAR_SET_FLOAT( "teamplay", 0.0f );
CVAR_SET_FLOAT( "pausable", 1.0f ); // singleplayer is always allowing pause
CVAR_SET_FLOAT( "coop", 0.0f );
BACKGROUND_TRACK( NULL, NULL );
CLIENT_COMMAND( FALSE, "newgame\n" );
}
示例14: CanHavePlayerItem
//=========================================================
// CanHaveWeapon - returns FALSE if the player is not allowed
// to pick up this weapon
//=========================================================
BOOL CHalfLifeMultiplay::CanHavePlayerItem( CBasePlayer *pPlayer, CBasePlayerItem *pItem )
{
if ( CVAR_GET_FLOAT("mp_weaponstay") > 0 )
{
if ( pItem->iFlags() & ITEM_FLAG_LIMITINWORLD )
return CGameRules::CanHavePlayerItem( pPlayer, pItem );
// check if the player already has this weapon
for ( int i = 0 ; i < MAX_ITEM_TYPES ; i++ )
{
CBasePlayerItem *it = pPlayer->m_rgpPlayerItems[i];
while ( it != NULL )
{
if ( it->m_iId == pItem->m_iId )
{
return FALSE;
}
it = it->m_pNext;
}
}
}
return CGameRules::CanHavePlayerItem( pPlayer, pItem );
}
示例15: Spawn
void CFuncMonsterClip::Spawn( void )
{
CFuncWall::Spawn();
if ( CVAR_GET_FLOAT("showtriggers") == 0 )
pev->effects = EF_NODRAW;
pev->flags |= FL_MONSTERCLIP;
}