本文整理汇总了C++中GetFlags函数的典型用法代码示例。如果您正苦于以下问题:C++ GetFlags函数的具体用法?C++ GetFlags怎么用?C++ GetFlags使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetFlags函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: i
// Count valid remaining entries and the number of blocks in them.
void BackupStoreCheck::CountDirectoryEntries(BackupStoreDirectory& dir)
{
BackupStoreDirectory::Iterator i(dir);
BackupStoreDirectory::Entry *en = 0;
while((en = i.Next()) != 0)
{
int32_t iIndex;
IDBlock *piBlock = LookupID(en->GetObjectID(), iIndex);
bool badEntry = false;
bool wasAlreadyContained = false;
ASSERT(piBlock != 0 ||
mDirsWhichContainLostDirs.find(en->GetObjectID())
!= mDirsWhichContainLostDirs.end());
if (piBlock)
{
// Normally it would exist and this
// check would not be necessary, but
// we might have missing directories
// that we will recreate later.
// cf mDirsWhichContainLostDirs.
uint8_t iflags = GetFlags(piBlock, iIndex);
wasAlreadyContained = (iflags & Flags_IsContained);
SetFlags(piBlock, iIndex, iflags | Flags_IsContained);
}
if(wasAlreadyContained)
{
// don't double-count objects that are
// contained by another directory as well.
}
else if(en->IsDir())
{
mNumDirectories++;
}
else if(!en->IsFile())
{
BOX_TRACE("Not counting object " <<
BOX_FORMAT_OBJECTID(en->GetObjectID()) <<
" with flags " << en->GetFlags());
}
else // it's a file
{
// Add to sizes?
// If piBlock was zero, then wasAlreadyContained
// might be uninitialized; but we only process
// files here, and if a file's piBlock was zero
// then badEntry would be set above, so we
// wouldn't be here.
ASSERT(!badEntry)
// It can be both old and deleted.
// If neither, then it's current.
if(en->IsDeleted())
{
mNumDeletedFiles++;
mBlocksInDeletedFiles += en->GetSizeInBlocks();
}
if(en->IsOld())
{
mNumOldFiles++;
mBlocksInOldFiles += en->GetSizeInBlocks();
}
if(!en->IsDeleted() && !en->IsOld())
{
mNumCurrentFiles++;
mBlocksInCurrentFiles += en->GetSizeInBlocks();
}
}
mapNewRefs->AddReference(en->GetObjectID());
}
}
开发者ID:jamesog,项目名称:boxbackup,代码行数:77,代码来源:BackupStoreCheck.cpp
示例2: GetBestSize
bool wxRibbonPanel::ShowExpanded()
{
if(!IsMinimised())
{
return false;
}
if(m_expanded_dummy != NULL || m_expanded_panel != NULL)
{
return false;
}
wxSize size = GetBestSize();
// Special case for flexible panel layout, where GetBestSize doesn't work
if (GetFlags() & wxRIBBON_PANEL_FLEXIBLE)
{
size = GetBestSizeForParentSize(wxSize(400, 1000));
}
wxPoint pos = GetExpandedPosition(wxRect(GetScreenPosition(), GetSize()),
size, m_preferred_expand_direction).GetTopLeft();
// Need a top-level frame to contain the expanded panel
wxFrame *container = new wxFrame(NULL, wxID_ANY, GetLabel(),
pos, size, wxFRAME_NO_TASKBAR | wxBORDER_NONE);
m_expanded_panel = new wxRibbonPanel(container, wxID_ANY,
GetLabel(), m_minimised_icon, wxPoint(0, 0), size, (m_flags /* & ~wxRIBBON_PANEL_FLEXIBLE */));
m_expanded_panel->SetArtProvider(m_art);
m_expanded_panel->m_expanded_dummy = this;
// Move all children to the new panel.
// Conceptually it might be simpler to reparent this entire panel to the
// container and create a new panel to sit in its place while expanded.
// This approach has a problem though - when the panel is reinserted into
// its original parent, it'll be at a different position in the child list
// and thus assume a new position.
// NB: Children iterators not used as behaviour is not well defined
// when iterating over a container which is being emptied
#if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */
# pragma ivdep
# pragma swp
# pragma unroll
# pragma prefetch
# if 0
# pragma simd noassert
# endif
#endif /* VDM auto patch */
while(!GetChildren().IsEmpty())
{
wxWindow *child = GetChildren().GetFirst()->GetData();
child->Reparent(m_expanded_panel);
child->Show();
}
// Move sizer to new panel
if(GetSizer())
{
wxSizer* sizer = GetSizer();
SetSizer(NULL, false);
m_expanded_panel->SetSizer(sizer);
}
m_expanded_panel->Realize();
Refresh();
container->SetMinClientSize(size);
container->Show();
m_expanded_panel->SetFocus();
return true;
}
开发者ID:vdm113,项目名称:wxWidgets-ICC-patch,代码行数:72,代码来源:panel.cpp
示例3: switch
//-----------------------------------------------------------------------------
// Purpose:
// Input : pTask -
//-----------------------------------------------------------------------------
void CNPC_Crow::RunTask( const Task_t *pTask )
{
switch ( pTask->iTask )
{
case TASK_CROW_TAKEOFF:
{
if ( GetNavigator()->IsGoalActive() )
{
GetMotor()->SetIdealYawToTargetAndUpdate( GetAbsOrigin() + GetNavigator()->GetCurWaypointPos(), AI_KEEP_YAW_SPEED );
}
else
TaskFail( FAIL_NO_ROUTE );
if ( IsActivityFinished() )
{
TaskComplete();
SetIdealActivity( ACT_FLY );
m_bSoar = false;
m_flSoarTime = gpGlobals->curtime + random->RandomFloat( 2, 5 );
}
break;
}
case TASK_CROW_HOP:
{
if ( IsActivityFinished() )
{
TaskComplete();
SetIdealActivity( ACT_IDLE );
}
if ( ( GetAbsOrigin().z < m_flHopStartZ ) && ( !( GetFlags() & FL_ONGROUND ) ) )
{
//
// We've hopped off of something! See if we're going to fall very far.
//
trace_t tr;
AI_TraceLine( GetAbsOrigin(), GetAbsOrigin() + Vector( 0, 0, -32 ), MASK_SOLID, this, HL2COLLISION_GROUP_CROW, &tr );
if ( tr.fraction == 1.0f )
{
//
// We're falling! Better fly away. SelectSchedule will check ONGROUND and do the right thing.
//
TaskComplete();
}
else
{
//
// We'll be okay. Don't check again unless what we're hopping onto moves
// out from under us.
//
m_flHopStartZ = GetAbsOrigin().z - ( 32 * tr.fraction );
}
}
break;
}
//
// Face the direction we are flying.
//
case TASK_CROW_FLY:
{
GetMotor()->SetIdealYawToTargetAndUpdate( GetAbsOrigin() + GetAbsVelocity(), AI_KEEP_YAW_SPEED );
break;
}
case TASK_CROW_FALL_TO_GROUND:
{
if ( GetFlags() & FL_ONGROUND )
{
SetFlyingState( FlyState_Walking );
TaskComplete();
}
break;
}
case TASK_CROW_WAIT_FOR_BARNACLE_KILL:
{
if ( m_flNextFlinchTime < gpGlobals->curtime )
{
m_flNextFlinchTime = gpGlobals->curtime + random->RandomFloat( 0.5f, 2.0f );
// dvs: TODO: squirm
// dvs: TODO: spawn feathers
EmitSound( "NPC_Crow.Squawk" );
}
break;
}
default:
{
CAI_BaseNPC::RunTask( pTask );
}
//.........这里部分代码省略.........
开发者ID:Bubbasacs,项目名称:FinalProj,代码行数:101,代码来源:npc_crow.cpp
示例4: EqPartial
// Partial equality test. Only returns false if an attribute doesn't match.
bool wxTextAttr::EqPartial(const wxTextAttr& attr, bool weakTest) const
{
int flags = attr.GetFlags();
if (!weakTest &&
((!HasTextColour() && attr.HasTextColour()) ||
(!HasBackgroundColour() && attr.HasBackgroundColour()) ||
(!HasFontFaceName() && attr.HasFontFaceName()) ||
(!HasFontSize() && attr.HasFontSize()) ||
(!HasFontWeight() && attr.HasFontWeight()) ||
(!HasFontItalic() && attr.HasFontItalic()) ||
(!HasFontUnderlined() && attr.HasFontUnderlined()) ||
(!HasFontStrikethrough() && attr.HasFontStrikethrough()) ||
(!HasFontEncoding() && attr.HasFontEncoding()) ||
(!HasFontFamily() && attr.HasFontFamily()) ||
(!HasURL() && attr.HasURL()) ||
(!HasAlignment() && attr.HasAlignment()) ||
(!HasLeftIndent() && attr.HasLeftIndent()) ||
(!HasParagraphSpacingAfter() && attr.HasParagraphSpacingAfter()) ||
(!HasParagraphSpacingBefore() && attr.HasParagraphSpacingBefore()) ||
(!HasLineSpacing() && attr.HasLineSpacing()) ||
(!HasCharacterStyleName() && attr.HasCharacterStyleName()) ||
(!HasParagraphStyleName() && attr.HasParagraphStyleName()) ||
(!HasListStyleName() && attr.HasListStyleName()) ||
(!HasBulletStyle() && attr.HasBulletStyle()) ||
(!HasBulletNumber() && attr.HasBulletNumber()) ||
(!HasBulletText() && attr.HasBulletText()) ||
(!HasBulletName() && attr.HasBulletName()) ||
(!HasTabs() && attr.HasTabs()) ||
(!HasTextEffects() && attr.HasTextEffects()) ||
(!HasOutlineLevel() && attr.HasOutlineLevel())))
{
return false;
}
if (HasTextColour() && attr.HasTextColour() && GetTextColour() != attr.GetTextColour())
return false;
if (HasBackgroundColour() && attr.HasBackgroundColour() && GetBackgroundColour() != attr.GetBackgroundColour())
return false;
if (HasFontFaceName() && attr.HasFontFaceName() && GetFontFaceName() != attr.GetFontFaceName())
return false;
// This checks whether the two objects have the same font size dimension (px versus pt)
if (HasFontSize() && attr.HasFontSize() && (flags & wxTEXT_ATTR_FONT) != (GetFlags() & wxTEXT_ATTR_FONT))
return false;
if (HasFontPointSize() && attr.HasFontPointSize() && GetFontSize() != attr.GetFontSize())
return false;
if (HasFontPixelSize() && attr.HasFontPixelSize() && GetFontSize() != attr.GetFontSize())
return false;
if (HasFontWeight() && attr.HasFontWeight() && GetFontWeight() != attr.GetFontWeight())
return false;
if (HasFontItalic() && attr.HasFontItalic() && GetFontStyle() != attr.GetFontStyle())
return false;
if (HasFontUnderlined() && attr.HasFontUnderlined() && GetFontUnderlined() != attr.GetFontUnderlined())
return false;
if (HasFontStrikethrough() && attr.HasFontStrikethrough() && GetFontStrikethrough() != attr.GetFontStrikethrough())
return false;
if (HasFontEncoding() && attr.HasFontEncoding() && GetFontEncoding() != attr.GetFontEncoding())
return false;
if (HasFontFamily() && attr.HasFontFamily() && GetFontFamily() != attr.GetFontFamily())
return false;
if (HasURL() && attr.HasURL() && GetURL() != attr.GetURL())
return false;
if (HasAlignment() && attr.HasAlignment() && GetAlignment() != attr.GetAlignment())
return false;
if (HasLeftIndent() && attr.HasLeftIndent() &&
((GetLeftIndent() != attr.GetLeftIndent()) || (GetLeftSubIndent() != attr.GetLeftSubIndent())))
return false;
if (HasRightIndent() && attr.HasRightIndent() && (GetRightIndent() != attr.GetRightIndent()))
return false;
if (HasParagraphSpacingAfter() && attr.HasParagraphSpacingAfter() &&
(GetParagraphSpacingAfter() != attr.GetParagraphSpacingAfter()))
return false;
if (HasParagraphSpacingBefore() && attr.HasParagraphSpacingBefore() &&
(GetParagraphSpacingBefore() != attr.GetParagraphSpacingBefore()))
return false;
if (HasLineSpacing() && attr.HasLineSpacing() && (GetLineSpacing() != attr.GetLineSpacing()))
return false;
if (HasCharacterStyleName() && attr.HasCharacterStyleName() && (GetCharacterStyleName() != attr.GetCharacterStyleName()))
return false;
//.........这里部分代码省略.........
开发者ID:AaronDP,项目名称:wxWidgets,代码行数:101,代码来源:textcmn.cpp
示例5: defined
//.........这里部分代码省略.........
//Msg( "PushScale = %f\n", flPushStrength );
// Check to see if we have enough push strength to make a difference.
if ( flPushStrength < 0.01f )
return;
Vector vecPush;
if ( GetAbsVelocity().Length2DSqr() > 0.1f )
{
Vector vecVelocity = GetAbsVelocity();
vecVelocity.z = 0.0f;
CrossProduct( vecUp, vecVelocity, vecPush );
VectorNormalize( vecPush );
}
else
{
// We are not moving, but we're still intersecting.
QAngle angView = pCmd->viewangles;
angView.x = 0.0f;
AngleVectors( angView, NULL, &vecPush, NULL );
}
// Move away from the other player/object.
Vector vecSeparationVelocity;
if ( vecDelta.Dot( vecPush ) < 0 )
{
vecSeparationVelocity = vecPush * flPushStrength;
}
else
{
vecSeparationVelocity = vecPush * -flPushStrength;
}
// Don't allow the MAX push speed to be greater than the MAX player speed.
float flMaxPlayerSpeed = MaxSpeed();
float flCropFraction = 1.33333333f;
if ( ( GetFlags() & FL_DUCKING ) && ( GetGroundEntity() != NULL ) )
{
flMaxPlayerSpeed *= flCropFraction;
}
float flMaxPlayerSpeedSqr = flMaxPlayerSpeed * flMaxPlayerSpeed;
if ( vecSeparationVelocity.LengthSqr() > flMaxPlayerSpeedSqr )
{
vecSeparationVelocity.NormalizeInPlace();
VectorScale( vecSeparationVelocity, flMaxPlayerSpeed, vecSeparationVelocity );
}
QAngle vAngles = pCmd->viewangles;
vAngles.x = 0;
Vector currentdir;
Vector rightdir;
AngleVectors( vAngles, ¤tdir, &rightdir, NULL );
Vector vDirection = vecSeparationVelocity;
VectorNormalize( vDirection );
float fwd = currentdir.Dot( vDirection );
float rt = rightdir.Dot( vDirection );
float forward = fwd * flPushStrength;
float side = rt * flPushStrength;
//Msg( "fwd: %f - rt: %f - forward: %f - side: %f\n", fwd, rt, forward, side );
pCmd->forwardmove += forward;
pCmd->sidemove += side;
// Clamp the move to within legal limits, preserving direction. This is a little
// complicated because we have different limits for forward, back, and side
//Msg( "PRECLAMP: forwardmove=%f, sidemove=%f\n", pCmd->forwardmove, pCmd->sidemove );
float flForwardScale = 1.0f;
if ( pCmd->forwardmove > fabs( cl_forwardspeed.GetFloat() ) )
{
flForwardScale = fabs( cl_forwardspeed.GetFloat() ) / pCmd->forwardmove;
}
else if ( pCmd->forwardmove < -fabs( cl_backspeed.GetFloat() ) )
{
flForwardScale = fabs( cl_backspeed.GetFloat() ) / fabs( pCmd->forwardmove );
}
float flSideScale = 1.0f;
if ( fabs( pCmd->sidemove ) > fabs( cl_sidespeed.GetFloat() ) )
{
flSideScale = fabs( cl_sidespeed.GetFloat() ) / fabs( pCmd->sidemove );
}
float flScale = MIN( flForwardScale, flSideScale );
pCmd->forwardmove *= flScale;
pCmd->sidemove *= flScale;
//Msg( "Pforwardmove=%f, sidemove=%f\n", pCmd->forwardmove, pCmd->sidemove );
#endif
}
开发者ID:Au-heppa,项目名称:swarm-sdk,代码行数:101,代码来源:c_sdk_player.cpp
示例6: GetFlags
void wxSettableHeaderColumn::ClearFlag(int flag)
{
int flags = GetFlags();
if ( flags & flag )
SetFlags(flags & ~flag);
}
开发者ID:chromylei,项目名称:third_party,代码行数:6,代码来源:headercolcmn.cpp
示例7: GetFlags
wxString wxAcceleratorEntry::AsPossiblyLocalizedString(bool localized) const
{
wxString text;
int flags = GetFlags();
if ( flags & wxACCEL_ALT )
text += PossiblyLocalize(wxTRANSLATE("Alt+"), localized);
if ( flags & wxACCEL_CTRL )
text += PossiblyLocalize(wxTRANSLATE("Ctrl+"), localized);
if ( flags & wxACCEL_SHIFT )
text += PossiblyLocalize(wxTRANSLATE("Shift+"), localized);
#if defined(__WXMAC__) || defined(__WXCOCOA__)
if ( flags & wxACCEL_RAW_CTRL )
text += PossiblyLocalize(wxTRANSLATE("RawCtrl+"), localized);
#endif
const int code = GetKeyCode();
if ( code >= WXK_F1 && code <= WXK_F12 )
text << PossiblyLocalize(wxTRANSLATE("F"), localized)
<< code - WXK_F1 + 1;
else if ( code >= WXK_NUMPAD0 && code <= WXK_NUMPAD9 )
text << PossiblyLocalize(wxTRANSLATE("KP_"), localized)
<< code - WXK_NUMPAD0;
else if ( code >= WXK_SPECIAL1 && code <= WXK_SPECIAL20 )
text << PossiblyLocalize(wxTRANSLATE("SPECIAL"), localized)
<< code - WXK_SPECIAL1 + 1;
else // check the named keys
{
size_t n;
for ( n = 0; n < WXSIZEOF(wxKeyNames); n++ )
{
const wxKeyName& kn = wxKeyNames[n];
if ( code == kn.code )
{
text << PossiblyLocalize(kn.name, localized);
break;
}
}
if ( n == WXSIZEOF(wxKeyNames) )
{
// must be a simple key
if (
#if !wxUSE_UNICODE
// we can't call wxIsalnum() for non-ASCII characters in ASCII
// build as they're only defined for the ASCII range (or EOF)
wxIsascii(code) &&
#endif // ANSI
wxIsprint(code) )
{
text << (wxChar)code;
}
else
{
wxFAIL_MSG( wxT("unknown keyboard accelerator code") );
}
}
}
return text;
}
开发者ID:0ryuO,项目名称:dolphin-avsync,代码行数:62,代码来源:accelcmn.cpp
示例8: ExecuteCreateDestructibleMesh
void FAssetTypeActions_StaticMesh::ExecuteCreateDestructibleMesh(TArray<TWeakObjectPtr<UStaticMesh>> Objects)
{
TArray< UObject* > Assets;
for (auto ObjIt = Objects.CreateConstIterator(); ObjIt; ++ObjIt)
{
auto Object = (*ObjIt).Get();
if ( Object )
{
FText ErrorMsg;
FDestructibleMeshEditorModule& DestructibleMeshEditorModule = FModuleManager::LoadModuleChecked<FDestructibleMeshEditorModule>( "DestructibleMeshEditor" );
UDestructibleMesh* DestructibleMesh = DestructibleMeshEditorModule.CreateDestructibleMeshFromStaticMesh(Object->GetOuter(), Object, NAME_None, Object->GetFlags(), ErrorMsg);
if ( DestructibleMesh )
{
FAssetEditorManager::Get().OpenEditorForAsset(DestructibleMesh);
Assets.Add(DestructibleMesh);
}
else if ( !ErrorMsg.IsEmpty() )
{
FNotificationInfo ErrorNotification( ErrorMsg );
FSlateNotificationManager::Get().AddNotification(ErrorNotification);
}
}
}
if ( Assets.Num() > 0 )
{
FAssetTools::Get().SyncBrowserToAssets(Assets);
}
}
开发者ID:PickUpSU,项目名称:UnrealEngine4,代码行数:28,代码来源:AssetTypeActions_StaticMesh.cpp
示例9: GetFlags
FX_BOOL CPDFSDK_Annot::IsVisible() const
{
int nFlags = GetFlags();
return !((nFlags & ANNOTFLAG_INVISIBLE) || (nFlags & ANNOTFLAG_HIDDEN) || (nFlags & ANNOTFLAG_NOVIEW));
}
开发者ID:witwall,项目名称:pdfium,代码行数:5,代码来源:fsdk_baseannot.cpp
示例10: ObserverUse
//-----------------------------------------------------------------------------
// Purpose: Handles USE keypress
//-----------------------------------------------------------------------------
void CBasePlayer::PlayerUse ( void )
{
#ifdef GAME_DLL
// Was use pressed or released?
if ( ! ((m_nButtons | m_afButtonPressed | m_afButtonReleased) & IN_USE) )
return;
if ( IsObserver() )
{
// do special use operation in oberserver mode
if ( m_afButtonPressed & IN_USE )
ObserverUse( true );
else if ( m_afButtonReleased & IN_USE )
ObserverUse( false );
return;
}
#if !defined(_XBOX)
// push objects in turbo physics mode
if ( (m_nButtons & IN_USE) && sv_turbophysics.GetBool() )
{
Vector forward, up;
EyeVectors( &forward, NULL, &up );
trace_t tr;
// Search for objects in a sphere (tests for entities that are not solid, yet still useable)
Vector searchCenter = EyePosition();
CUsePushFilter filter;
UTIL_TraceLine( searchCenter, searchCenter + forward * 96.0f, MASK_SOLID, &filter, &tr );
// try the hit entity if there is one, or the ground entity if there isn't.
CBaseEntity *entity = tr.m_pEnt;
if ( entity )
{
IPhysicsObject *pObj = entity->VPhysicsGetObject();
if ( pObj )
{
Vector vPushAway = (entity->WorldSpaceCenter() - WorldSpaceCenter());
vPushAway.z = 0;
float flDist = VectorNormalize( vPushAway );
flDist = max( flDist, 1 );
float flForce = sv_pushaway_force.GetFloat() / flDist;
flForce = min( flForce, sv_pushaway_max_force.GetFloat() );
pObj->ApplyForceOffset( vPushAway * flForce, WorldSpaceCenter() );
}
}
}
#endif
if ( m_afButtonPressed & IN_USE )
{
// Controlling some latched entity?
if ( ClearUseEntity() )
{
return;
}
else
{
if ( m_afPhysicsFlags & PFLAG_DIROVERRIDE )
{
m_afPhysicsFlags &= ~PFLAG_DIROVERRIDE;
m_iTrain = TRAIN_NEW|TRAIN_OFF;
return;
}
else
{ // Start controlling the train!
CBaseEntity *pTrain = GetGroundEntity();
if ( pTrain && !(m_nButtons & IN_JUMP) && (GetFlags() & FL_ONGROUND) && (pTrain->ObjectCaps() & FCAP_DIRECTIONAL_USE) && pTrain->OnControls(this) )
{
m_afPhysicsFlags |= PFLAG_DIROVERRIDE;
m_iTrain = TrainSpeed(pTrain->m_flSpeed, ((CFuncTrackTrain*)pTrain)->GetMaxSpeed());
m_iTrain |= TRAIN_NEW;
EmitSound( "Player.UseTrain" );
return;
}
}
}
}
CBaseEntity *pUseEntity = FindUseEntity();
// Found an object
if ( pUseEntity )
{
//!!!UNDONE: traceline here to prevent +USEing buttons through walls
int caps = pUseEntity->ObjectCaps();
variant_t emptyVariant;
//.........这里部分代码省略.........
开发者ID:kbeirne,项目名称:SourceEngineBlink,代码行数:101,代码来源:baseplayer_shared.cpp
示例11: VectorLength
void CBasePlayer::UpdateStepSound( surfacedata_t *psurface, const Vector &vecOrigin, const Vector &vecVelocity )
{
bool bWalking;
float fvol;
Vector knee;
Vector feet;
float height;
float speed;
float velrun;
float velwalk;
int fLadder;
if ( m_flStepSoundTime > 0 )
{
m_flStepSoundTime -= 1000.0f * gpGlobals->frametime;
if ( m_flStepSoundTime < 0 )
{
m_flStepSoundTime = 0;
}
}
if ( m_flStepSoundTime > 0 )
return;
if ( GetFlags() & (FL_FROZEN|FL_ATCONTROLS))
return;
if ( GetMoveType() == MOVETYPE_NOCLIP || GetMoveType() == MOVETYPE_OBSERVER )
return;
if ( !sv_footsteps.GetFloat() )
return;
speed = VectorLength( vecVelocity );
float groundspeed = Vector2DLength( vecVelocity.AsVector2D() );
// determine if we are on a ladder
fLadder = ( GetMoveType() == MOVETYPE_LADDER );
GetStepSoundVelocities( &velwalk, &velrun );
bool onground = ( GetFlags() & FL_ONGROUND );
bool movingalongground = ( groundspeed > 0.0001f );
bool moving_fast_enough = ( speed >= velwalk );
#ifdef PORTAL
// In Portal we MUST play footstep sounds even when the player is moving very slowly
// This is used to count the number of footsteps they take in the challenge mode
// -Jeep
moving_fast_enough = true;
#endif
// To hear step sounds you must be either on a ladder or moving along the ground AND
// You must be moving fast enough
if ( !moving_fast_enough || !(fLadder || ( onground && movingalongground )) )
return;
// MoveHelper()->PlayerSetAnimation( PLAYER_WALK );
bWalking = speed < velrun;
VectorCopy( vecOrigin, knee );
VectorCopy( vecOrigin, feet );
height = GetPlayerMaxs()[ 2 ] - GetPlayerMins()[ 2 ];
knee[2] = vecOrigin[2] + 0.2 * height;
// find out what we're stepping in or on...
if ( fLadder )
{
psurface = GetLadderSurface(vecOrigin);
fvol = 0.5;
SetStepSoundTime( STEPSOUNDTIME_ON_LADDER, bWalking );
}
else if ( GetWaterLevel() == WL_Waist )
{
static int iSkipStep = 0;
if ( iSkipStep == 0 )
{
iSkipStep++;
return;
}
if ( iSkipStep++ == 3 )
{
iSkipStep = 0;
}
psurface = physprops->GetSurfaceData( physprops->GetSurfaceIndex( "wade" ) );
fvol = 0.65;
SetStepSoundTime( STEPSOUNDTIME_WATER_KNEE, bWalking );
}
else if ( GetWaterLevel() == WL_Feet )
{
psurface = physprops->GetSurfaceData( physprops->GetSurfaceIndex( "water" ) );
fvol = bWalking ? 0.2 : 0.5;
//.........这里部分代码省略.........
开发者ID:kbeirne,项目名称:SourceEngineBlink,代码行数:101,代码来源:baseplayer_shared.cpp
示例12: MakePlayerAlreadyMember
void Channel::Join(uint64 p, const char *pass)
{
WorldPacket data;
if (IsOn(p))
{
if (!IsConstant()) // non send error message for built-in channels
{
MakePlayerAlreadyMember(&data, p);
SendToOne(&data, p);
}
return;
}
Player *plr = sObjectMgr.GetPlayer(p);
if ((!plr || !plr->isGameMaster()) && !IsConstant() && m_name != "world" && m_name != "engworld" && m_name != "handel")
{
uint32 limitCount = sWorld.getConfig(CONFIG_PRIVATE_CHANNEL_LIMIT);
if (limitCount && players.size() > limitCount)
{
MakeInvalidName(&data);
SendToOne(&data, p);
return;
}
}
if (!m_ownerGUID && (!plr || !plr->CanSpeak())) // muted players can't create new channels
{
MakeBanned(&data);//no idea what to send
SendToOne(&data, p);
return;
}
if (IsBanned(p) && (!plr || !plr->isGameMaster()))
{
MakeBanned(&data);
SendToOne(&data, p);
return;
}
if (m_password.length() > 0 && strcmp(pass, m_password.c_str()) && (!plr || !plr->isGameMaster()))
{
MakeWrongPassword(&data);
SendToOne(&data, p);
return;
}
if (plr)
{
if (IsLFG() &&
sWorld.getConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && !plr->GetSession()->HasPermissions(PERM_GMT) &&
plr->m_lookingForGroup.Empty())
{
MakeNotInLfg(&data);
SendToOne(&data, p);
return;
}
if (plr->GetGuildId() && (GetFlags() == 0x38))
return;
plr->JoinedChannel(this);
}
if (m_announce && (!plr || !plr->GetSession()->HasPermissions(PERM_GMT) || !sWorld.getConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL)))
{
//MakeJoined(&data, p);
//SendToAll(&data);
}
data.clear();
PlayerInfo pinfo;
pinfo.player = p;
pinfo.flags = 0;
players[p] = pinfo;
MakeYouJoined(&data);
SendToOne(&data, p);
JoinNotify(p);
// if no owner first logged will become
if (!IsConstant() && !m_ownerGUID)
{
SetOwner(p, (players.size() > 1 ? true : false));
players[p].SetModerator(true);
}
}
开发者ID:Blumfield,项目名称:ptc2,代码行数:90,代码来源:Channel.cpp
示例13: LookupID
bool BackupStoreCheck::CheckDirectoryEntry(BackupStoreDirectory::Entry& rEntry,
int64_t DirectoryID, bool& rIsModified)
{
int32_t IndexInDirBlock;
IDBlock *piBlock = LookupID(rEntry.GetObjectID(), IndexInDirBlock);
ASSERT(piBlock != 0);
uint8_t iflags = GetFlags(piBlock, IndexInDirBlock);
// Is the type the same?
if(((iflags & Flags_IsDir) == Flags_IsDir) != rEntry.IsDir())
{
// Entry is of wrong type
BOX_ERROR("Directory ID " <<
BOX_FORMAT_OBJECTID(DirectoryID) <<
" references object " <<
BOX_FORMAT_OBJECTID(rEntry.GetObjectID()) <<
" which has a different type than expected.");
++mNumberErrorsFound;
return false; // remove this entry
}
// Check that the entry is not already contained.
if(iflags & Flags_IsContained)
{
BOX_ERROR("Directory ID " <<
BOX_FORMAT_OBJECTID(DirectoryID) <<
" references object " <<
BOX_FORMAT_OBJECTID(rEntry.GetObjectID()) <<
" which is already contained.");
++mNumberErrorsFound;
return false; // remove this entry
}
// Not already contained by another directory.
// Don't set the flag until later, after we finish repairing
// the directory and removing all bad entries.
// Check that the container ID of the object is correct
if(piBlock->mContainer[IndexInDirBlock] != DirectoryID)
{
// Needs fixing...
if(iflags & Flags_IsDir)
{
// Add to will fix later list
BOX_ERROR("Directory ID " <<
BOX_FORMAT_OBJECTID(rEntry.GetObjectID())
<< " has wrong container ID.");
mDirsWithWrongContainerID.push_back(rEntry.GetObjectID());
++mNumberErrorsFound;
}
else
{
// This is OK for files, they might move
BOX_INFO("File ID " <<
BOX_FORMAT_OBJECTID(rEntry.GetObjectID())
<< " has different container ID, "
"probably moved");
}
// Fix entry for now
piBlock->mContainer[IndexInDirBlock] = DirectoryID;
}
// Check the object size
if(rEntry.GetSizeInBlocks() != piBlock->mObjectSizeInBlocks[IndexInDirBlock])
{
// Wrong size, correct it.
BOX_ERROR("Directory " << BOX_FORMAT_OBJECTID(DirectoryID) <<
" entry for " << BOX_FORMAT_OBJECTID(rEntry.GetObjectID()) <<
" has wrong size " << rEntry.GetSizeInBlocks() <<
", should be " << piBlock->mObjectSizeInBlocks[IndexInDirBlock]);
rEntry.SetSizeInBlocks(piBlock->mObjectSizeInBlocks[IndexInDirBlock]);
// Mark as changed
rIsModified = true;
++mNumberErrorsFound;
}
return true; // don't delete this entry
}
开发者ID:jamesog,项目名称:boxbackup,代码行数:82,代码来源:BackupStoreCheck.cpp
示例14: WrapObject
JSBool
WrapObject(JSContext *cx, JSObject *parent, jsval *vp, XPCWrappedNative* wn)
{
NS_ASSERTION(XPCPerThreadData::IsMainThread(cx),
"Can't do this off the main thread!");
// Our argument should be a wrapped native object, but the caller may have
// passed it in as an optimization.
JSObject *wrappedObj;
if (JSVAL_IS_PRIMITIVE(*vp) ||
!(wrappedObj = JSVAL_TO_OBJECT(*vp)) ||
wrappedObj->getClass() == &XOWClass) {
return JS_TRUE;
}
if (!wn &&
!(wn = XPCWrappedNative::GetAndMorphWrappedNativeOfJSObject(cx, wrappedObj))) {
return JS_TRUE;
}
CheckWindow(wn);
// The parent must be the inner global object for its scope.
parent = JS_GetGlobalForObject(cx, parent);
OBJ_TO_INNER_OBJECT(cx, parent);
if (!parent) {
return JS_FALSE;
}
XPCWrappedNativeWithXOW *wnxow = nsnull;
if (wn->NeedsXOW()) {
JSObject *innerWrappedObj = wrappedObj;
OBJ_TO_INNER_OBJECT(cx, innerWrappedObj);
if (!innerWrappedObj) {
return JS_FALSE;
}
if (innerWrappedObj == parent) {
wnxow = static_cast<XPCWrappedNativeWithXOW *>(wn);
JSObject *xow = wnxow->GetXOW();
if (xow) {
*vp = OBJECT_TO_JSVAL(xow);
return JS_TRUE;
}
}
}
XPCWrappedNative *parentwn =
XPCWrappedNative::GetWrappedNativeOfJSObject(cx, parent);
XPCWrappedNativeScope *parentScope;
if (NS_LIKELY(parentwn)) {
parentScope = parentwn->GetScope();
} else {
parentScope = XPCWrappedNativeScope::FindInJSObjectScope(cx, parent);
}
JSObject *outerObj = nsnull;
WrappedNative2WrapperMap *map = parentScope->GetWrapperMap();
outerObj = map->Find(wrappedObj);
if (outerObj) {
NS_ASSERTION(outerObj->getClass() == &XOWClass,
"What crazy object are we getting here?");
*vp = OBJECT_TO_JSVAL(outerObj);
if (wnxow) {
// NB: wnxow->GetXOW() must have returned false.
SetFlags(cx, outerObj, AddFlags(GetFlags(cx, outerObj), FLAG_IS_CACHED));
wnxow->SetXOW(outerObj);
}
return JS_TRUE;
}
outerObj = JS_NewObjectWithGivenProto(cx, js::Jsvalify(&XOWClass), nsnull,
parent);
if (!outerObj) {
return JS_FALSE;
}
jsval flags = INT_TO_JSVAL(wnxow ? FLAG_IS_CACHED : 0);
if (!JS_SetReservedSlot(cx, outerObj, sWrappedObjSlot, *vp) ||
!JS_SetReservedSlot(cx, outerObj, sFlagsSlot, flags) ||
!JS_SetReservedSlot(cx, outerObj, XPC_XOW_ScopeSlot,
PRIVATE_TO_JSVAL(parentScope))) {
return JS_FALSE;
}
*vp = OBJECT_TO_JSVAL(outerObj);
map->Add(wn->GetScope()->GetWrapperMap(), wrappedObj, outerObj);
if(wnxow) {
wnxow->SetXOW(outerObj);
}
return JS_TRUE;
}
开发者ID:lofter2011,项目名称:Icefox,代码行数:97,代码来源:XPCCrossOriginWrapper.cpp
示例15: ClearMultiDamage
void CBaseGrenade::BounceTouch( CBaseEntity *pOther )
{
if ( pOther->IsSolidFlagSet(FSOLID_TRIGGER | FSOLID_VOLUME_CONTENTS) )
return;
// don't hit the guy that launched this grenade
if ( pOther == GetThrower() )
return;
// only do damage if we're moving fairly fast
if ( (pOther->m_takedamage != DAMAGE_NO) && (m_flNextAttack < gpGlobals->curtime && GetAbsVelocity().Length() > 100))
{
if (m_hThrower)
{
#if !defined( CLIENT_DLL )
trace_t tr;
tr = CBaseEntity::GetTouchTrace( );
ClearMultiDamage( );
Vector forward;
AngleVectors( GetLocalAngles(), &forward, NULL, NULL );
CTakeDamageInfo info( this, m_hThrower, 1, DMG_CLUB );
CalculateMeleeDamageForce( &info, GetAbsVelocity(), GetAbsOrigin() );
pOther->DispatchTraceAttack( info, forward, &tr );
ApplyMultiDamage();
#endif
}
m_flNextAttack = gpGlobals->curtime + 1.0; // debounce
}
Vector vecTestVelocity;
// m_vecAngVelocity = Vector (300, 300, 300);
// this is my heuristic for modulating the grenade velocity because grenades dropped purely vertical
// or thrown very far tend to slow down too quickly for me to always catch just by testing velocity.
// trimming the Z velocity a bit seems to help quite a bit.
vecTestVelocity = GetAbsVelocity();
vecTestVelocity.z *= 0.45;
if ( !m_bHasWarnedAI && vecTestVelocity.Length() <= 60 )
{
// grenade is moving really slow. It's probably very close to where it will ultimately stop moving.
// emit the danger sound.
// register a radius louder than the explosion, so we make sure everyone gets out of the way
#if !defined( CLIENT_DLL )
CSoundEnt::InsertSound ( SOUND_DANGER, GetAbsOrigin(), m_flDamage / 0.4, 0.3, this );
#endif
m_bHasWarnedAI = true;
}
if (GetFlags() & FL_ONGROUND)
{
// add a bit of static friction
// SetAbsVelocity( GetAbsVelocity() * 0.8 );
// SetSequence( random->RandomInt( 1, 1 ) ); // FIXME: missing tumble animations
}
else
{
// play bounce sound
BounceSound();
}
m_flPlaybackRate = GetAbsVelocity().Length() / 200.0;
if (GetPlaybackRate() > 1.0)
m_flPlaybackRate = 1;
else if (GetPlaybackRate() < 0.5)
m_flPlaybackRate = 0;
}
开发者ID:BenLubar,项目名称:SwarmDirector2,代码行数:69,代码来源:basegrenade_shared.cpp
示例16: GetFlags
CPDF_PageObject* CPDF_Annot::GetBorder(FX_BOOL bPrint, const CPDF_RenderOptions* pOptions)
{
if (GetSubType() == "Popup") {
return NULL;
}
FX_DWORD annot_flags = GetFlags();
if (annot_flags & ANNOTFLAG_HIDDEN) {
return NULL;
}
FX_BOOL bPrinting = bPrint || (pOptions && (pOptions->m_Flags & RENDER_PRINTPREVIEW));
if (bPrinting && (annot_flags & ANNOTFLAG_PRINT) == 0) {
return NULL;
}
if (!bPrinting && (annot_flags & ANNOTFLAG_NOVIEW)) {
return NULL;
}
CPDF_Dictionary* pBS = m_pAnnotDict->GetDict("BS");
char style_char;
FX_FLOAT width;
CPDF_Array* pDashArray = NULL;
if (pBS == NULL) {
CPDF_Array* pBorderArray = m_pAnnotDict->GetArray("Border");
style_char = 'S';
if (pBorderArray) {
width = pBorderArray->GetNumber(2);
if (pBorderArray->GetCount() == 4) {
pDashArray = pBorderArray->GetArray(3);
if (pDashArray == NULL) {
return NULL;
}
style_char = 'D';
}
} else {
width = 1;
}
} else {
CFX_ByteString style = pBS->GetString("S");
pDashArray = pBS->GetArray("D");
style_char = style[1];
width = pBS->GetNumber("W");
}
if (width <= 0) {
return NULL;
}
CPDF_Array* pColor = m_pAnnotDict->GetArray("C");
FX_DWORD argb = 0xff000000;
if (pColor != NULL) {
int R = (FX_INT32)(pColor->GetNumber(0) * 255);
int G = (FX_INT32)(pColor->GetNumber(1) * 255);
int B = (FX_INT32)(pColor->GetNumber(2) * 255);
argb = ArgbEncode(0xff, R, G, B);
}
nonstd::unique_ptr<CPDF_PathObject> pPathObject(new CPDF_PathObject());
CPDF_GraphStateData *pGraphState = pPathObject->m_GraphState.GetModify();
if (!pGraphState) {
return NULL;
}
pGraphState->m_LineWidth = width;
CPDF_ColorStateData *pColorData = pPathObject->m_ColorState.GetModify();
if (!pColorData) {
return NULL;
}
pColorData->m_StrokeRGB = argb;
pPathObject->m_bStroke = TRUE;
pPathObject->m_FillType = 0;
if (style_char == 'D') {
if (pDashArray) {
FX_DWORD dash_count = pDashArray->GetCount();
if (dash_count % 2) {
dash_count ++;
}
pGraphState->m_DashArray = FX_Alloc(FX_FLOAT, dash_count);
if (pGraphState->m_DashArray == NULL) {
return NULL;
}
pGraphState->m_DashCount = dash_count;
FX_DWORD i;
for (i = 0; i < pDashArray->GetCount(); i ++) {
pGraphState->m_DashArray[i] = pDashArray->GetNumber(i);
}
if (i < dash_count) {
pGraphState->m_DashArray[i] = pGraphState->m_DashArray[i - 1];
}
} else {
pGraphState->m_DashArray = FX_Alloc(FX_FLOAT, 2);
if (pGraphState->m_DashArray == NULL) {
return NULL;
}
pGraphState->m_DashCount = 2;
pGraphState->m_DashArray[0] = pGraphState->m_DashArray[1] = 3 * 1.0f;
}
}
CFX_FloatRect rect;
GetRect(rect);
width /= 2;
CPDF_PathData *pPathData = pPathObject->m_Path.GetModify();
if (pPathData) {
pPathData->AppendRect(rect.left + width, rect.bottom + width, rect.right - width, rect.top - width);
}
pPathObject->CalcBoundingBox();
//.........这里部分代码省略.........
开发者ID:Gardenya,项目名称:pdfium,代码行数:101,代码来源:doc_annot.cpp
示例17: Msg
//-----------------------------------------------------------------------------
// Purpose: called when an event that counts toward an achievement occurs
//-----------------------------------------------------------------------------
void CBaseAchievement::IncrementCount( int iOptIncrement )
{
if ( !IsAchieved() && LocalPlayerCanEarn() )
{
if ( !AlwaysEnabled() && !m_pAchievementMgr->CheckAchievementsEnabled() )
{
Msg( "Achievements disabled, ignoring achievement progress for %s\n", GetName() );
return;
}
// on client, where the count is kept, increment count
if ( iOptIncrement > 0 )
{
// user specified that we want to increase by more than one.
m_iCount += iOptIncrement;
if ( m_iCount > m_iGoal )
{
m_iCount = m_iGoal;
}
}
else
{
m_iCount++;
}
// if this achievement gets saved w/global state, flag our global state as dirty
if ( GetFlags() & ACH_SAVE_GLOBAL )
{
m_pAchievementMgr->SetDirty( true );
}
if ( cc_achievement_debug.GetInt() )
{
Msg( "Achievement count increased for %s: %d/%d\n", GetName(), m_iCount, m_iGoal );
}
#ifndef NO_STEAM
// if this achievement's progress should be stored in Steam, set the steam stat for it
if ( StoreProgressInSteam() && steamapicontext->SteamUserStats() )
{
// Set the Steam stat with the same name as the achievement. Only cached locally until we upload it.
char pszProgressName[1024];
Q_snprintf( pszProgressName, 1024, "%s_STAT", GetStat() );
bool bRet = steamapicontext->SteamUserStats()->SetStat( pszProgressName, m_iCount );
if ( !bRet )
{
DevMsg( "ISteamUserStats::GetStat failed to set progress value in Steam for achievement %s\n", pszProgressName );
}
m_pAchievementMgr->SetDirty( true );
}
#endif
// if we've hit goal, award the achievement
if ( m_iGoal > 0 )
{
if ( m_iCount >= m_iGoal )
{
AwardAchievement();
}
else
{
HandleProgressUpdate();
}
}
}
}
开发者ID:Au-heppa,项目名称:source-sdk-2013,代码行数:70,代码来源:baseachievement.cpp
|
请发表评论