本文整理汇总了C++中IPhysicsObject::GetGameFlags方法的典型用法代码示例。如果您正苦于以下问题:C++ IPhysicsObject::GetGameFlags方法的具体用法?C++ IPhysicsObject::GetGameFlags怎么用?C++ IPhysicsObject::GetGameFlags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPhysicsObject
的用法示例。
在下文中一共展示了IPhysicsObject::GetGameFlags方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PrescheduleThink
void CNPC_Dog::PrescheduleThink( void )
{
BaseClass::PrescheduleThink();
if ( m_hPhysicsEnt )
{
IPhysicsObject *pPhysObj = m_hPhysicsEnt->VPhysicsGetObject();
if ( pPhysObj && pPhysObj->GetGameFlags() & FVPHYSICS_PLAYER_HELD )
{
m_hPhysicsEnt->SetOwnerEntity( NULL );
}
}
if ( m_flTimeToCatch < gpGlobals->curtime )
m_flTimeToCatch = 0.0f;
if ( GetIdealActivity() == ACT_IDLE )
{
if ( m_hPhysicsEnt && m_bHasObject == true )
{
SetIdealActivity( (Activity)ACT_DOG_WAITING );
}
}
}
示例2: InactiveThink
void CNPC_Portal_FloorTurret::InactiveThink( void )
{
LaserOff();
RopesOff();
// Update our PVS state
CheckPVSCondition();
SetNextThink( gpGlobals->curtime + 1.0f );
// Wake up if we're not on our side
if ( !OnSide() && VPhysicsGetObject()->GetContactPoint( NULL, NULL ) && m_bEnabled )
{
// Never return to life!
SetCollisionGroup( COLLISION_GROUP_NONE );
//ReturnToLife();
}
else
{
IPhysicsObject *pTurretPhys = VPhysicsGetObject();
if ( !(pTurretPhys->GetGameFlags() & FVPHYSICS_PLAYER_HELD) && pTurretPhys->IsAsleep() )
SetCollisionGroup( COLLISION_GROUP_DEBRIS_TRIGGER );
else
SetCollisionGroup( COLLISION_GROUP_NONE );
}
}
示例3: CheckTouching
bool CPhysicsNPCSolver::CheckTouching()
{
CAI_BaseNPC *pNPC = m_hNPC.Get();
if ( !pNPC )
return false;
CBaseEntity *pPhysicsEnt = m_hEntity.Get();
if ( !pPhysicsEnt )
return false;
IPhysicsObject *pPhysics = pPhysicsEnt->VPhysicsGetObject();
IPhysicsObject *pNPCPhysics = pNPC->VPhysicsGetObject();
if ( !pNPCPhysics || !pPhysics )
return false;
IPhysicsFrictionSnapshot *pSnapshot = pPhysics->CreateFrictionSnapshot();
bool found = false;
bool penetrate = false;
while ( pSnapshot->IsValid() )
{
IPhysicsObject *pOther = pSnapshot->GetObject(1);
if ( pOther == pNPCPhysics )
{
found = true;
if ( IsContactOnNPCHead(pSnapshot, pPhysics, pNPC ) )
{
penetrate = true;
pSnapshot->MarkContactForDelete();
}
break;
}
pSnapshot->NextFrictionData();
}
pSnapshot->DeleteAllMarkedContacts( true );
pPhysics->DestroyFrictionSnapshot( pSnapshot );
// if the object is penetrating something, check to see if it's intersecting this NPC
// if so, go ahead and switch over to penetration solver mode
if ( !penetrate && (pPhysics->GetGameFlags() & FVPHYSICS_PENETRATING) )
{
penetrate = IsIntersecting();
}
if ( penetrate )
{
pPhysicsEnt->ClearNavIgnore();
BecomePenetrationSolver();
}
return found;
}
示例4: IsValidEnemy
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
bool CNPC_Stalker::IsValidEnemy( CBaseEntity *pEnemy )
{
Class_T enemyClass = pEnemy->Classify();
if( enemyClass == CLASS_PLAYER || enemyClass == CLASS_PLAYER_ALLY || enemyClass == CLASS_PLAYER_ALLY_VITAL )
{
// Don't get angry at these folks unless provoked.
if( m_iPlayerAggression < STALKER_PLAYER_AGGRESSION )
{
return false;
}
}
if( enemyClass == CLASS_BULLSEYE && pEnemy->GetParent() )
{
// This bullseye is in heirarchy with something. If that
// something is held by the physcannon, this bullseye is
// NOT a valid enemy.
IPhysicsObject *pPhys = pEnemy->GetParent()->VPhysicsGetObject();
if( pPhys && (pPhys->GetGameFlags() & FVPHYSICS_PLAYER_HELD) )
{
return false;
}
}
if( GetEnemy() && HasCondition(COND_SEE_ENEMY) )
{
// Short attention span. If I have an enemy, stick with it.
if( GetEnemy() != pEnemy )
{
return false;
}
}
if( IsStrategySlotRangeOccupied( SQUAD_SLOT_ATTACK1, SQUAD_SLOT_ATTACK2 ) && !HasStrategySlotRange( SQUAD_SLOT_ATTACK1, SQUAD_SLOT_ATTACK2 ) )
{
return false;
}
if( !FVisible(pEnemy) )
{
// Don't take an enemy you can't see. Since stalkers move way too slowly to
// establish line of fire, usually an enemy acquired by means other than
// the Stalker's own eyesight will always get away while the stalker plods
// slowly to their last known position. So don't take enemies you can't see.
return false;
}
return BaseClass::IsValidEnemy(pEnemy);
}
示例5: Pickup_ForcePlayerToDropThisObject
// player pickup utility routine
void Pickup_ForcePlayerToDropThisObject( CBaseEntity *pTarget )
{
if ( pTarget == NULL )
return;
IPhysicsObject *pPhysics = pTarget->VPhysicsGetObject();
if ( pPhysics == NULL )
return;
if ( pPhysics->GetGameFlags() & FVPHYSICS_PLAYER_HELD )
{
CBasePlayer *pPlayer = UTIL_GetLocalPlayer();
pPlayer->ForceDropOfCarriedPhysObjects( pTarget );
}
}
示例6: HeldThink
//-----------------------------------------------------------------------------
// Purpose: The turret has been tipped over and will thrash for awhile
//-----------------------------------------------------------------------------
void CNPC_Portal_FloorTurret::HeldThink( void )
{
PreThink( (turretState_e)PORTAL_TURRET_PICKUP );
SetNextThink( gpGlobals->curtime + 0.05f );
SetEnemy( NULL );
StudioFrameAdvance();
IPhysicsObject *pTurretPhys = VPhysicsGetObject();
// If we're not held anymore, stop thrashing
if ( !(pTurretPhys->GetGameFlags() & FVPHYSICS_PLAYER_HELD) )
{
m_fNextTalk = gpGlobals->curtime + 1.25f;
if ( m_lifeState == LIFE_ALIVE )
SetThink( &CNPC_FloorTurret::ActiveThink );
else
SetThink( &CNPC_FloorTurret::InactiveThink );
}
LaserOn();
RopesOn();
//See if we should continue to thrash
if ( !IsDissolving() )
{
if ( m_flShotTime < gpGlobals->curtime )
{
SetActivity( (Activity) ACT_FLOOR_TURRET_OPEN_IDLE );
DryFire();
m_flShotTime = gpGlobals->curtime + RandomFloat( 0.25f, 0.75f );
m_vecGoalAngles.x = GetAbsAngles().x + RandomFloat( -15, 15 );
m_vecGoalAngles.y = GetAbsAngles().y + RandomFloat( -40, 40 );
}
UpdateFacing();
}
}
示例7: CalculateObjectStress
float CalculateObjectStress( IPhysicsObject *pObject, CBaseEntity *pInputOwnerEntity, vphysics_objectstress_t *pOutput )
{
CUtlVector< CBaseEntity * > pObjectList;
CUtlVector< Vector > objectForce;
bool hasLargeObject = false;
// add a slot for static objects
pObjectList.AddToTail( NULL );
objectForce.AddToTail( vec3_origin );
// add a slot for friendly objects
pObjectList.AddToTail( NULL );
objectForce.AddToTail( vec3_origin );
CBaseCombatCharacter *pBCC = pInputOwnerEntity->MyCombatCharacterPointer();
IPhysicsFrictionSnapshot *pSnapshot = pObject->CreateFrictionSnapshot();
float objMass = pObject->GetMass();
while ( pSnapshot->IsValid() )
{
float force = pSnapshot->GetNormalForce();
if ( force > 0.0f )
{
IPhysicsObject *pOther = pSnapshot->GetObject(1);
CBaseEntity *pOtherEntity = static_cast<CBaseEntity *>(pOther->GetGameData());
if ( !pOtherEntity )
{
// object was just deleted, but we still have a contact point this frame...
// just assume it came from the world.
pOtherEntity = GetWorldEntity();
}
CBaseEntity *pOtherOwner = pOtherEntity;
if ( pOtherEntity->GetOwnerEntity() )
{
pOtherOwner = pOtherEntity->GetOwnerEntity();
}
int outIndex = 0;
if ( !pOther->IsMoveable() )
{
outIndex = 0;
}
// NavIgnored objects are often being pushed by a friendly
else if ( pBCC && (pBCC->IRelationType( pOtherOwner ) == D_LI || pOtherEntity->IsNavIgnored()) )
{
outIndex = 1;
}
// player held objects do no stress
else if ( pOther->GetGameFlags() & FVPHYSICS_PLAYER_HELD )
{
outIndex = 1;
}
else
{
if ( pOther->GetMass() >= VPHYSICS_LARGE_OBJECT_MASS )
{
if ( pInputOwnerEntity->GetGroundEntity() != pOtherEntity)
{
hasLargeObject = true;
}
}
// moveable, non-friendly
// aggregate contacts over each object to avoid greater stress in multiple contact cases
// NOTE: Contacts should be in order, so this shouldn't ever search, but just in case
outIndex = pObjectList.Count();
for ( int i = pObjectList.Count()-1; i >= 2; --i )
{
if ( pObjectList[i] == pOtherOwner )
{
outIndex = i;
break;
}
}
if ( outIndex == pObjectList.Count() )
{
pObjectList.AddToTail( pOtherOwner );
objectForce.AddToTail( vec3_origin );
}
}
if ( outIndex != 0 && pInputOwnerEntity->GetMoveType() != MOVETYPE_VPHYSICS && !IsPhysicallyControlled(pOtherEntity, pOther) )
{
// UNDONE: Test this! This is to remove any shadow/shadow stress. The game should handle this with blocked/damage
force = 0.0f;
}
Vector normal;
pSnapshot->GetSurfaceNormal( normal );
objectForce[outIndex] += normal * force;
}
pSnapshot->NextFrictionData();
}
pObject->DestroyFrictionSnapshot( pSnapshot );
pSnapshot = NULL;
// clear out all friendly force
objectForce[1].Init();
float sum = 0;
Vector negativeForce = vec3_origin;
//.........这里部分代码省略.........
示例8: PullObject
void CNPC_Dog::PullObject( bool bMantain )
{
if ( m_hPhysicsEnt == NULL )
{
TaskFail( "Ack! No Phys Object!");
return;
}
IPhysicsObject *pPhysObj = m_hPhysicsEnt->VPhysicsGetObject();
if ( pPhysObj == NULL )
{
TaskFail( "Pulling object with no Phys Object?!" );
return;
}
if( pPhysObj->GetGameFlags() & FVPHYSICS_PLAYER_HELD )
{
m_bHasObject = false;
ClearBeams();
TaskFail("Player Grabbed Ball");
return;
}
CreateBeams();
Vector vGunPos;
GetAttachment( m_iPhysGunAttachment, vGunPos );
float flDistance = ( vGunPos - m_hPhysicsEnt->WorldSpaceCenter() ).Length();
if ( bMantain == false )
{
if ( flDistance <= DOG_CATCH_DISTANCE )
{
m_hPhysicsEnt->SetOwnerEntity( this );
GetNavigator()->StopMoving();
//Fire Output!
m_OnPickup.FireOutput( this, this );
m_bHasObject = true;
ClearBeams();
TaskComplete();
return;
}
}
Vector vDir = ( vGunPos - m_hPhysicsEnt->WorldSpaceCenter() );
Vector vCurrentVel;
float flCurrentVel;
AngularImpulse vCurrentAI;
pPhysObj->GetVelocity( &vCurrentVel, &vCurrentAI );
flCurrentVel = vCurrentVel.Length();
VectorNormalize( vCurrentVel );
VectorNormalize( vDir );
float flVelMod = DOG_PULL_VELOCITY_MOD;
if ( bMantain == true )
flVelMod *= 2;
vCurrentVel = vCurrentVel * flCurrentVel * flVelMod;
vCurrentAI = vCurrentAI * DOG_PULL_ANGULARIMP_MOD;
pPhysObj->SetVelocity( &vCurrentVel, &vCurrentAI );
vDir = vDir * flDistance * (DOG_PULL_TO_GUN_VEL_MOD * 2);
Vector vAngle( 0, 0, 0 );
pPhysObj->AddVelocity( &vDir, &vAngle );
}
示例9: RunTask
//.........这里部分代码省略.........
if ( m_hPhysicsEnt )
{
m_hPhysicsEnt->SetOwnerEntity( NULL );
}
TaskComplete();
}
break;
case TASK_DOG_WAIT_FOR_TARGET_TO_FACE:
{
if ( CanTargetSeeMe() )
TaskComplete();
}
break;
case TASK_WAIT_FOR_MOVEMENT:
{
if ( GetState() == NPC_STATE_SCRIPT || IsInAScript() )
{
BaseClass::RunTask( pTask );
return;
}
if ( m_hPhysicsEnt != NULL )
{
IPhysicsObject *pPhysObj = m_hPhysicsEnt->VPhysicsGetObject();
if ( !pPhysObj )
{
Warning( "npc_dog TASK_WAIT_FOR_MOVEMENT with NULL m_hPhysicsEnt->VPhysicsGetObject\n" );
}
if ( pPhysObj && pPhysObj->GetGameFlags() & FVPHYSICS_PLAYER_HELD )
TaskFail( "Player picked it up!" );
//If the object is moving then my old goal might not be valid
//cancel the schedule and make it restart again in a bit.
if ( pPhysObj && pPhysObj->IsAsleep() == false && GetNavigator()->IsGoalActive() == false )
{
Vector vecGoalPos;
Vector vecDir;
vecDir = GetLocalOrigin() - m_hPhysicsEnt->WorldSpaceCenter();
VectorNormalize(vecDir);
vecDir.z = 0;
vecGoalPos = m_hPhysicsEnt->WorldSpaceCenter() + (vecDir * DOG_PHYSOBJ_MOVE_TO_DIST );
GetNavigator()->ClearGoal();
float flDistance = (vecGoalPos - GetLocalOrigin()).Length();
//If I'm near my goal, then just walk to it.
Activity aActivity = ACT_RUN;
if ( ( vecGoalPos - GetLocalOrigin() ).Length() <= 128 )
aActivity = ACT_WALK;
GetNavigator()->SetGoal( AI_NavGoal_t( vecGoalPos, aActivity ), AIN_NO_PATH_TASK_FAIL );
if ( flDistance <= DOG_PHYSOBJ_MOVE_TO_DIST )
{
TaskComplete();
GetNavigator()->StopMoving();
}
示例10: FindPhysicsObject
bool CNPC_Dog::FindPhysicsObject( const char *pPickupName, CBaseEntity *pIgnore )
{
CBaseEntity *pEnt = NULL;
CBaseEntity *pNearest = NULL;
float flDist;
IPhysicsObject *pPhysObj = NULL;
float flNearestDist = 99999;
if ( pPickupName != NULL && strlen( pPickupName ) > 0 )
{
pEnt = gEntList.FindEntityByName( NULL, pPickupName );
if ( m_hUnreachableObjects.Find( pEnt ) == -1 )
{
m_bHasObject = false;
m_hPhysicsEnt = pEnt;
return true;
}
}
while ( ( pEnt = gEntList.FindEntityByClassname( pEnt, "prop_physics" ) ) != NULL )
{
//We don't want this one.
if ( pEnt == pIgnore )
continue;
if ( m_hUnreachableObjects.Find( pEnt ) != -1 )
continue;
pPhysObj = pEnt->VPhysicsGetObject();
if( pPhysObj == NULL )
continue;
if ( pPhysObj->GetMass() > DOG_MAX_THROW_MASS )
continue;
Vector center = pEnt->WorldSpaceCenter();
flDist = UTIL_DistApprox2D( GetAbsOrigin(), center );
vcollide_t *pCollide = modelinfo->GetVCollide( pEnt->GetModelIndex() );
if ( pCollide == NULL )
continue;
if ( pPhysObj->GetGameFlags() & FVPHYSICS_PLAYER_HELD )
continue;
if ( pPhysObj->IsMoveable() == false )
continue;
if ( pEnt->GetCollisionGroup() == COLLISION_GROUP_DEBRIS ||
pEnt->GetCollisionGroup() == COLLISION_GROUP_INTERACTIVE_DEBRIS )
continue;
if ( center.z > EyePosition().z )
continue;
if ( flDist >= flNearestDist )
continue;
if ( FVisible( pEnt ) == false )
continue;
pNearest = pEnt;
flNearestDist = flDist;
}
m_bHasObject = false;
m_hPhysicsEnt = pNearest;
if ( dog_debug.GetBool() == true )
{
if ( pNearest )
NDebugOverlay::Box( pNearest->WorldSpaceCenter(), pNearest->CollisionProp()->OBBMins(), pNearest->CollisionProp()->OBBMaxs(), 255, 0, 255, true, 3 );
}
if( m_hPhysicsEnt == NULL )
{
return false;
}
else
{
return true;
}
}
示例11: GrubTouch
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CAntlionGrub::GrubTouch( CBaseEntity *pOther )
{
// We can be squished by the player, Vort, or flying heavy things.
IPhysicsObject *pPhysOther = pOther->VPhysicsGetObject(); // bool bThrown = ( pTarget->VPhysicsGetObject()->GetGameFlags() & FVPHYSICS_WAS_THROWN ) != 0;
if ( pOther->IsPlayer() || FClassnameIs(pOther,"npc_vortigaunt") || ( pPhysOther && (pPhysOther->GetGameFlags() & FVPHYSICS_WAS_THROWN )) )
{
m_OnAgitated.FireOutput( pOther, pOther );
Squash( pOther, true, true );
}
}
示例12: StartTouch
void CNPC_Portal_FloorTurret::StartTouch( CBaseEntity *pOther )
{
BaseClass::StartTouch( pOther );
IPhysicsObject *pOtherPhys = pOther->VPhysicsGetObject();
if ( !pOtherPhys )
return;
if ( !m_pMotionController )
return;
if ( m_pMotionController->Enabled() )
{
m_pMotionController->Suspend( 2.0f );
IPhysicsObject *pTurretPhys = VPhysicsGetObject();
if ( !pOther->IsPlayer() && pOther->GetMoveType() == MOVETYPE_VPHYSICS && !(pTurretPhys && ((pTurretPhys->GetGameFlags() & FVPHYSICS_PLAYER_HELD) != 0)) )
{
// Get a lateral impulse
Vector vVelocityImpulse = GetAbsOrigin() - pOther->GetAbsOrigin();
vVelocityImpulse.z = 0.0f;
if ( vVelocityImpulse.IsZero() )
{
vVelocityImpulse.x = 1.0f;
vVelocityImpulse.y = 1.0f;
}
VectorNormalize( vVelocityImpulse );
// If impulse is too much along the forward or back axis, skew it
Vector vTurretForward, vTurretRight;
GetVectors( &vTurretForward, &vTurretRight, NULL );
float fForwardDotImpulse = vTurretForward.Dot( vVelocityImpulse );
if ( fForwardDotImpulse > 0.7f || fForwardDotImpulse < -0.7f )
{
vVelocityImpulse += vTurretRight;
VectorNormalize( vVelocityImpulse );
}
Vector vAngleImpulse( ( vTurretRight.Dot( vVelocityImpulse ) < 0.0f ) ? ( -1.6f ) : ( 1.6f ), RandomFloat( -0.5f, 0.5f ), RandomFloat( -0.5f, 0.5f ) );
vVelocityImpulse *= TURRET_FLOOR_PHYSICAL_FORCE_MULTIPLIER;
vAngleImpulse *= TURRET_FLOOR_PHYSICAL_FORCE_MULTIPLIER;
pTurretPhys->AddVelocity( &vVelocityImpulse, &vAngleImpulse );
// Check if another turret is hitting us
CNPC_Portal_FloorTurret *pPortalFloor = dynamic_cast<CNPC_Portal_FloorTurret*>( pOther );
if ( pPortalFloor && pPortalFloor->m_lifeState == LIFE_ALIVE )
{
Vector vTurretVelocity, vOtherVelocity;
pTurretPhys->GetVelocity( &vTurretVelocity, NULL );
pOtherPhys->GetVelocity( &vOtherVelocity, NULL );
// If it's moving faster
if ( vOtherVelocity.LengthSqr() > vTurretVelocity.LengthSqr() )
{
// Make the turret falling onto this one talk
pPortalFloor->EmitSound( GetTurretTalkName( PORTAL_TURRET_COLLIDE ) );
pPortalFloor->m_fNextTalk = gpGlobals->curtime + 1.2f;
pPortalFloor->m_bDelayTippedTalk = true;
// Delay out potential tipped talking so we can here the other turret talk
m_fNextTalk = gpGlobals->curtime + 0.6f;
m_bDelayTippedTalk = true;
}
}
if ( pPortalFloor && m_bEnabled && m_bLaserOn && !m_bOutOfAmmo )
{
// Award friendly fire achievement if we're a live turret being knocked over by another turret.
IGameEvent *event = gameeventmanager->CreateEvent( "turret_hit_turret" );
if ( event )
{
gameeventmanager->FireEvent( event );
}
}
}
}
}
示例13: CheckWaterJump
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CTFGameMovement::CheckWaterJump( void )
{
Vector flatforward;
Vector flatvelocity;
float curspeed;
// Jump button down?
bool bJump = ( ( mv->m_nButtons & IN_JUMP ) != 0 );
Vector forward, right;
AngleVectors( mv->m_vecViewAngles, &forward, &right, NULL ); // Determine movement angles
// Already water jumping.
if (player->m_flWaterJumpTime)
return;
// Don't hop out if we just jumped in
if (mv->m_vecVelocity[2] < -180)
return; // only hop out if we are moving up
// See if we are backing up
flatvelocity[0] = mv->m_vecVelocity[0];
flatvelocity[1] = mv->m_vecVelocity[1];
flatvelocity[2] = 0;
// Must be moving
curspeed = VectorNormalize( flatvelocity );
#if 1
// Copy movement amounts
float fmove = mv->m_flForwardMove;
float smove = mv->m_flSideMove;
for ( int iAxis = 0; iAxis < 2; ++iAxis )
{
flatforward[iAxis] = forward[iAxis] * fmove + right[iAxis] * smove;
}
#else
// see if near an edge
flatforward[0] = forward[0];
flatforward[1] = forward[1];
#endif
flatforward[2] = 0;
VectorNormalize( flatforward );
// Are we backing into water from steps or something? If so, don't pop forward
if ( curspeed != 0.0 && ( DotProduct( flatvelocity, flatforward ) < 0.0 ) && !bJump )
return;
Vector vecStart;
// Start line trace at waist height (using the center of the player for this here)
vecStart= mv->GetAbsOrigin() + (GetPlayerMins() + GetPlayerMaxs() ) * 0.5;
Vector vecEnd;
VectorMA( vecStart, TF_WATERJUMP_FORWARD/*tf_waterjump_forward.GetFloat()*/, flatforward, vecEnd );
trace_t tr;
TracePlayerBBox( vecStart, vecEnd, PlayerSolidMask(), COLLISION_GROUP_PLAYER_MOVEMENT, tr );
if ( tr.fraction < 1.0 ) // solid at waist
{
IPhysicsObject *pPhysObj = tr.m_pEnt->VPhysicsGetObject();
if ( pPhysObj )
{
if ( pPhysObj->GetGameFlags() & FVPHYSICS_PLAYER_HELD )
return;
}
vecStart.z = mv->GetAbsOrigin().z + player->GetViewOffset().z + WATERJUMP_HEIGHT;
VectorMA( vecStart, TF_WATERJUMP_FORWARD/*tf_waterjump_forward.GetFloat()*/, flatforward, vecEnd );
VectorMA( vec3_origin, -50.0f, tr.plane.normal, player->m_vecWaterJumpVel );
TracePlayerBBox( vecStart, vecEnd, PlayerSolidMask(), COLLISION_GROUP_PLAYER_MOVEMENT, tr );
if ( tr.fraction == 1.0 ) // open at eye level
{
// Now trace down to see if we would actually land on a standable surface.
VectorCopy( vecEnd, vecStart );
vecEnd.z -= 1024.0f;
TracePlayerBBox( vecStart, vecEnd, PlayerSolidMask(), COLLISION_GROUP_PLAYER_MOVEMENT, tr );
if ( ( tr.fraction < 1.0f ) && ( tr.plane.normal.z >= 0.7 ) )
{
mv->m_vecVelocity[2] = TF_WATERJUMP_UP/*tf_waterjump_up.GetFloat()*/; // Push up
mv->m_nOldButtons |= IN_JUMP; // Don't jump again until released
player->AddFlag( FL_WATERJUMP );
player->m_flWaterJumpTime = 2000.0f; // Do this for 2 seconds
}
}
}
}