本文整理汇总了C++中LinearMove函数的典型用法代码示例。如果您正苦于以下问题:C++ LinearMove函数的具体用法?C++ LinearMove怎么用?C++ LinearMove使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LinearMove函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: ASSERT
//
// Starts the door going to its "up" position (simply ToggleData->vecPosition2).
//
void CBaseDoor::DoorGoUp( void )
{
entvars_t *pevActivator;
// It could be going-down, if blocked.
ASSERT(m_toggle_state == TS_AT_BOTTOM || m_toggle_state == TS_GOING_DOWN);
// emit door moving and stop sounds on CHAN_STATIC so that the multicast doesn't
// filter them out and leave a client stuck with looping door sounds!
if ( !FBitSet( pev->spawnflags, SF_DOOR_SILENT ) )
EMIT_SOUND(ENT(pev), CHAN_STATIC, (char*)STRING(pev->noiseMoving), 1, ATTN_NORM);
// ALERT(at_debug, "%s go up (was %d)\n", STRING(pev->targetname), m_toggle_state);
m_toggle_state = TS_GOING_UP;
SetMoveDone(&CBaseDoor:: DoorHitTop );
// LRC- if synched, we fire as soon as we start to go up
if (m_iImmediateMode)
{
if (m_iOnOffMode)
SUB_UseTargets( m_hActivator, USE_ON, 0 );
else
SUB_UseTargets( m_hActivator, USE_TOGGLE, 0 );
}
if ( FClassnameIs(pev, "func_door_rotating")) // !!! BUGBUG Triggered doors don't work with this yet
{
float sign = 1.0;
if ( m_hActivator != NULL )
{
pevActivator = m_hActivator->pev;
if ( !FBitSet( pev->spawnflags, SF_DOOR_ONEWAY ) && pev->movedir.y ) // Y axis rotation, move away from the player
{
Vector vec = pevActivator->origin - pev->origin;
Vector angles = pevActivator->angles;
angles.x = 0;
angles.z = 0;
UTIL_MakeVectors (angles);
// Vector vnext = (pevToucher->origin + (pevToucher->velocity * 10)) - pev->origin;
UTIL_MakeVectors ( pevActivator->angles );
Vector vnext = (pevActivator->origin + (gpGlobals->v_forward * 10)) - pev->origin;
if ( (vec.x*vnext.y - vec.y*vnext.x) < 0 )
sign = -1.0;
}
}
AngularMove(m_vecAngle2*sign, pev->speed);
}
else
if(m_iSpeedMode==1){ //AJH modifed to allow two types of accelerating doors
LinearMove(m_vecPosition2, pev->speed);
}else{
LinearMove(m_vecPosition2, pev->speed, m_fAcceleration, m_fDeceleration); }
}
开发者ID:Hammermaps-DEV,项目名称:Spirit-of-Half-Life-1.8--VC2010,代码行数:60,代码来源:func_doors.cpp
示例2: StartMovingSound
//-----------------------------------------------------------------------------
// Purpose: Starts the door going to its "down" position (simply ToggleData->vecPosition1).
//-----------------------------------------------------------------------------
void CBaseDoor::DoorGoDown( void )
{
if ( !HasSpawnFlags( SF_DOOR_SILENT ) )
{
// If we're not moving already, start the moving noise
if ( m_toggle_state != TS_GOING_UP && m_toggle_state != TS_GOING_DOWN )
{
StartMovingSound();
}
}
#ifdef DOOR_ASSERT
ASSERT(m_toggle_state == TS_AT_TOP);
#endif // DOOR_ASSERT
m_toggle_state = TS_GOING_DOWN;
SetMoveDone( &CBaseDoor::DoorHitBottom );
if ( IsRotatingDoor() )//rotating door
AngularMove( m_vecAngle1, m_flSpeed);
else
LinearMove( m_vecPosition1, m_flSpeed);
//Fire our closed output
m_OnClose.FireOutput( this, this );
}
开发者ID:KyleGospo,项目名称:City-17-Episode-One-Source,代码行数:28,代码来源:doors.cpp
示例3: EMIT_SOUND
//
// Starts the button moving "in/up".
//
void CBaseButton::ButtonActivate()
{
EMIT_SOUND(ENT(pev), CHAN_VOICE, (char *)STRING(pev->noise), 1, ATTN_NORM);
if(!UTIL_IsMasterTriggered(m_sMaster, m_hActivator))
{
// button is locked, play locked sound
PlayLockSounds(pev, &m_ls, TRUE, TRUE);
return;
}
else
{
// button is unlocked, play unlocked sound
PlayLockSounds(pev, &m_ls, FALSE, TRUE);
}
ASSERT(m_toggle_state == TS_AT_BOTTOM);
m_toggle_state = TS_GOING_UP;
SetMoveDone(&CBaseButton::TriggerAndWait);
if(!m_fRotating)
LinearMove(m_vecPosition2, pev->speed);
else
AngularMove(m_vecAngle2, pev->speed);
}
开发者ID:Sh1ft0x0EF,项目名称:HLSDKRevamp,代码行数:28,代码来源:BaseButton.cpp
示例4: EMIT_SOUND
void CMomentaryDoor::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
if ( useType != USE_SET ) // Momentary buttons will pass down a float in here
return;
if ( value > 1.0 )
value = 1.0;
if ( value < 0.0 )
value = 0.0;
Vector move = m_vecPosition1 + (value * (m_vecPosition2 - m_vecPosition1));
Vector delta = move - pev->origin;
//float speed = delta.Length() * 10;
float speed = delta.Length() / 0.1; // move there in 0.1 sec
if ( speed == 0 )
return;
// This entity only thinks when it moves, so if it's thinking, it's in the process of moving
// play the sound when it starts moving (not yet thinking)
if ( pev->nextthink < pev->ltime || pev->nextthink == 0 )
EMIT_SOUND(ENT(pev), CHAN_STATIC, (char*)STRING(pev->noiseMoving), 1, ATTN_NORM);
// If we already moving to designated point, return
else if (move == m_vecFinalDest)
return;
SetMoveDone( &CMomentaryDoor::DoorMoveDone );
LinearMove( move, speed );
}
开发者ID:suXinjke,项目名称:HalfPayne,代码行数:29,代码来源:doors.cpp
示例5: ASSERT
//
// Starts the door going to its "up" position (simply ToggleData->vecPosition2).
//
void CBaseTrainDoor::DoorGoUp( void )
{
// It could be going-down, if blocked.
ASSERT( door_state == TD_CLOSED );
door_state = TD_SHIFT_UP;
UTIL_MakeVectors( m_vecOldAngles );
STOP_SOUND( edict(), CHAN_STATIC, STRING( pev->noise1 ));
EMIT_SOUND( edict(), CHAN_STATIC, STRING( pev->noise2 ), 1, ATTN_NORM );
// Subtract 2 from size because the engine expands bboxes by 1 in all directions making the size too big
Vector vecSize = pev->size - Vector( 2, 2, 2 );
float depth = (fabs( gpGlobals->v_right.x * vecSize.x ) + fabs( gpGlobals->v_right.y * vecSize.y ) + fabs( gpGlobals->v_right.z * vecSize.z ) - m_flLip);
if( pev->spawnflags & SF_TRAINDOOR_INVERSE )
depth = -depth;
VectorMatrix( pev->movedir, gpGlobals->v_right, gpGlobals->v_up );
m_vecPosition3 = m_vecPosition1 + gpGlobals->v_right * -depth;
SetMoveDone( &CBaseTrainDoor:: DoorSlideWait );
LinearMove( m_vecPosition3, pev->speed );
}
开发者ID:XashDev,项目名称:XashXT,代码行数:28,代码来源:doors.cpp
示例6: ButtonActivate
void CBaseButton :: ButtonActivate( void )
{
EMIT_SOUND( edict(), CHAN_VOICE, STRING( pev->noise ), 1, ATTN_NORM );
if( IsLockedByMaster( ))
{
// button is locked, play locked sound
PlayLockSounds( pev, &m_ls, TRUE, TRUE );
return;
}
else
{
// button is unlocked, play unlocked sound
PlayLockSounds( pev, &m_ls, FALSE, TRUE );
}
ASSERT( m_iState == STATE_OFF );
m_iState = STATE_TURN_ON;
if( pev->spawnflags & SF_BUTTON_DONTMOVE )
{
TriggerAndWait();
}
else
{
SetMoveDone( &CBaseButton::TriggerAndWait );
if( !m_fRotating )
LinearMove( m_vecPosition2, pev->speed );
else AngularMove( m_vecAngle2, pev->speed );
}
}
开发者ID:FWGS,项目名称:XashXT,代码行数:32,代码来源:buttons.cpp
示例7: EMIT_SOUND
/* <697ad> ../cstrike/dlls/doors.cpp:762 */
void CBaseDoor::DoorGoDown(void)
{
bool isReversing = (m_toggle_state == TS_GOING_UP);
if (!isReversing)
{
if (!(pev->spawnflags & SF_DOOR_SILENT))
{
if (m_toggle_state != TS_GOING_UP && m_toggle_state != TS_GOING_DOWN)
{
EMIT_SOUND(ENT(pev), CHAN_STATIC, (char *)STRING(pev->noiseMoving), VOL_NORM, ATTN_NORM);
}
TheBots->OnEvent(EVENT_DOOR, m_hActivator);
}
}
#ifdef DOOR_ASSERT
assert(m_toggle_state == TS_AT_TOP);
#endif // DOOR_ASSERT
m_toggle_state = TS_GOING_DOWN;
SetMoveDone(&CBaseDoor::DoorHitBottom);
//rotating door
if (FClassnameIs(pev, "func_door_rotating"))
{
AngularMove(m_vecAngle1, pev->speed);
}
else
LinearMove(m_vecPosition1, pev->speed);
}
开发者ID:Arkshine,项目名称:ReGameDLL_CS,代码行数:34,代码来源:doors.cpp
示例8: GetNextTarget
//
// Train next - path corner needs to change to next target
//
void CFuncTrain::Next( void )
{
CBaseEntity *pTarg;
// now find our next target
//TODO: this entity is supposed to work with path_corner only. Other entities will work, but will probably misbehave. - Solokiller
//Check for classname and ignore others?
pTarg = GetNextTarget();
if( !pTarg )
{
if( pev->noiseMovement )
STOP_SOUND( this, CHAN_STATIC, ( char* ) STRING( pev->noiseMovement ) );
// Play stop sound
if( pev->noiseStopMoving )
EMIT_SOUND( this, CHAN_VOICE, ( char* ) STRING( pev->noiseStopMoving ), m_volume, ATTN_NORM );
return;
}
// Save last target in case we need to find it again
pev->message = pev->target;
pev->target = pTarg->pev->target;
m_flWait = pTarg->GetDelay();
if( m_pevCurrentTarget && m_pevCurrentTarget->speed != 0 )
{// don't copy speed from target if it is 0 (uninitialized)
pev->speed = m_pevCurrentTarget->speed;
ALERT( at_aiconsole, "Train %s speed to %4.2f\n", GetTargetname(), pev->speed );
}
m_pevCurrentTarget = pTarg->pev;// keep track of this since path corners change our target for us.
pev->enemy = pTarg->edict();//hack
if( FBitSet( m_pevCurrentTarget->spawnflags, SF_CORNER_TELEPORT ) )
{
// Path corner has indicated a teleport to the next corner.
SetBits( pev->effects, EF_NOINTERP );
SetAbsOrigin( pTarg->GetAbsOrigin() - ( pev->mins + pev->maxs )* 0.5 );
Wait(); // Get on with doing the next path corner.
}
else
{
// Normal linear move.
// CHANGED this from CHAN_VOICE to CHAN_STATIC around OEM beta time because trains should
// use CHAN_STATIC for their movement sounds to prevent sound field problems.
// this is not a hack or temporary fix, this is how things should be. (sjb).
if( pev->noiseMovement )
{
STOP_SOUND( this, CHAN_STATIC, ( char* ) STRING( pev->noiseMovement ) );
EMIT_SOUND( this, CHAN_STATIC, ( char* ) STRING( pev->noiseMovement ), m_volume, ATTN_NORM );
}
ClearBits( pev->effects, EF_NOINTERP );
SetMoveDone( &CFuncTrain::Wait );
LinearMove( pTarg->GetAbsOrigin() - ( pev->mins + pev->maxs )* 0.5, pev->speed );
}
}
开发者ID:swmpdg,项目名称:HLEnhanced,代码行数:62,代码来源:CFuncTrain.cpp
示例9: DoorGoDown
//
// Starts the door going to its "down" position (simply ToggleData->vecPosition1).
//
void CBaseTrainDoor :: DoorGoDown( void )
{
ASSERT( door_state == TD_SLIDING_DOWN );
door_state = TD_SHIFT_DOWN;
SetMoveDone( &CBaseTrainDoor:: DoorHitBottom );
LinearMove( m_vecPosition1, pev->speed );
}
开发者ID:XashDev,项目名称:XashXT,代码行数:11,代码来源:doors.cpp
示例10: EMIT_SOUND
//
// Platform is at top, now starts moving down.
//
void CFuncPlat::GoDown( void )
{
if( pev->noiseMovement )
EMIT_SOUND( ENT( pev ), CHAN_STATIC, ( char* ) STRING( pev->noiseMovement ), m_volume, ATTN_NORM );
ASSERT( m_toggle_state == TS_AT_TOP || m_toggle_state == TS_GOING_UP );
m_toggle_state = TS_GOING_DOWN;
SetMoveDone( &CFuncPlat::CallHitBottom );
LinearMove( m_vecPosition2, pev->speed );
}
开发者ID:CryoKeen,项目名称:HLEnhanced,代码行数:13,代码来源:CFuncPlat.cpp
示例11: DoorSlideDown
void CBaseTrainDoor :: DoorSlideDown( void )
{
EMIT_SOUND( edict(), CHAN_STATIC, STRING( pev->noise1 ), 1, ATTN_NORM );
ASSERT( door_state == TD_OPENED );
door_state = TD_SLIDING_DOWN;
SetMoveDone( &CBaseTrainDoor:: DoorSlideWait );
LinearMove( m_vecPosition3, pev->speed );
}
开发者ID:XashDev,项目名称:XashXT,代码行数:10,代码来源:doors.cpp
示例12: EMIT_SOUND
//
// Starts the door going to its "down" position (simply ToggleData->vecPosition1).
//
void CBaseDoor::DoorGoDown( void )
{
if ( !FBitSet( pev->spawnflags, SF_DOOR_SILENT ) )
EMIT_SOUND(ENT(pev), CHAN_STATIC, (char*)STRING(pev->noiseMoving), 1, ATTN_NORM);
// ALERT(at_debug, "%s go down (was %d)\n", STRING(pev->targetname), m_toggle_state);
//FYI: not defined, so this doesn't happen. --LRC
#ifdef DOOR_ASSERT
ASSERT(m_toggle_state == TS_AT_TOP);
#endif // DOOR_ASSERT
m_toggle_state = TS_GOING_DOWN;
SetMoveDone(&CBaseDoor:: DoorHitBottom );
if ( FClassnameIs(pev, "func_door_rotating"))//rotating door
{
// LRC- if synched, we fire as soon as we start to go down
if (m_iImmediateMode)
{
if (m_iOnOffMode)
SUB_UseTargets( m_hActivator, USE_OFF, 0 );
else
SUB_UseTargets( m_hActivator, USE_TOGGLE, 0 );
}
AngularMove( m_vecAngle1, pev->speed);
}
else
{
// LRC- if synched, we fire as soon as we start to go down
if (m_iImmediateMode)
{
SUB_UseTargets( m_hActivator, USE_OFF, 0 );
}
if(m_iSpeedMode==1){ //AJH modifed to allow two types of accelerating doors
LinearMove(m_vecPosition1, pev->speed);
}else{
LinearMove(m_vecPosition1, pev->speed, m_fAcceleration, m_fDeceleration); }
}
}
开发者ID:Hammermaps-DEV,项目名称:Spirit-of-Half-Life-1.8--VC2010,代码行数:43,代码来源:func_doors.cpp
示例13: STOP_SOUND
void CMomentaryDoor::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
if ( useType != USE_SET ) // Momentary buttons will pass down a float in here
return;
if ( value > 1.0 )
value = 1.0;
if (IsLockedByMaster()) return;
Vector move = m_vecPosition1 + (value * (m_vecPosition2 - m_vecPosition1));
float speed = 0;
Vector delta;
/* if ((value == 1) || (value == 0))
{
STOP_SOUND(ENT(pev), CHAN_STATIC, (char*)STRING(pev->noiseMoving));//G-Cont. fix sound bug (original HL).
return;
}
*/
if (pev->speed)
{
//LRC- move at the given speed, if any.
speed = pev->speed;
}
else
{
// default: get there in 0.1 secs
delta = move - pev->origin;
speed = delta.Length() * 10;
}
//FIXME: allow for it being told to move at the same speed in the _opposite_ direction!
if ( speed != 0 )
{
// This entity only thinks when it moves
//LRC- nope, in a MoveWith world you can't rely on that. Check the state instead.
if ( m_iState == STATE_OFF )
{
//ALERT(at_console,"USE: start moving to %f %f %f.\n", move.x, move.y, move.z);
m_iState = STATE_ON;
EMIT_SOUND(ENT(pev), CHAN_STATIC, (char*)STRING(pev->noiseMoving), 1, ATTN_NORM);
}
m_fLastPos = value;
LinearMove( move, speed );
//LinearMove( m_vecPosition1, pev->speed, m_fAcceleration, m_fDeceleration);
SetMoveDone(&CMomentaryDoor:: MomentaryMoveDone );
}
}
开发者ID:Hammermaps-DEV,项目名称:Spirit-of-Half-Life-1.8--VC2010,代码行数:52,代码来源:func_doors.cpp
示例14: GetTouchTrace
//-----------------------------------------------------------------------------
// Purpose: Move away from an entity that touched us
// Input : *pOther - the entity we touched
//-----------------------------------------------------------------------------
void CMyBrushEntity::BrushTouch( CBaseEntity *pOther )
{
// Get the collision information
const trace_t &tr = GetTouchTrace();
// We want to move away from the impact point along our surface
Vector vecPushDir = tr.plane.normal;
vecPushDir.Negate();
vecPushDir.z = 0.0f;
// Move slowly in that direction
LinearMove( GetAbsOrigin() + ( vecPushDir * 64.0f ), 32.0f );
}
开发者ID:Adidasman1,项目名称:source-sdk-2013,代码行数:17,代码来源:sdk_brushentity.cpp
示例15: GetAbsOrigin
//-----------------------------------------------------------------------------
// Purpose:
// Input : &inputdata -
//-----------------------------------------------------------------------------
void CFuncMoveLinear::InputSetSpeed( inputdata_t &inputdata )
{
// Set the new speed
m_flSpeed = inputdata.value.Float();
// FIXME: This is a little questionable. Do we want to fix the speed, or let it continue on at the old speed?
float flDistToGoalSqr = ( m_vecFinalDest - GetAbsOrigin() ).LengthSqr();
if ( flDistToGoalSqr > Square( FLT_EPSILON ) )
{
// NOTE: We do NOT want to call sound functions here, just vanilla position changes
LinearMove( m_vecFinalDest, m_flSpeed );
}
}
开发者ID:0xFEEDC0DE64,项目名称:UltraGame,代码行数:17,代码来源:func_movelinear.cpp
示例16: ASSERT
//
// Starts the button moving "out/down".
//
void CBaseButton::ButtonReturn(void)
{
ASSERT(m_toggle_state == TS_AT_TOP);
m_toggle_state = TS_GOING_DOWN;
SetMoveDone(&CBaseButton::ButtonBackHome);
if(!m_fRotating)
LinearMove(m_vecPosition1, pev->speed);
else
AngularMove(m_vecAngle1, pev->speed);
pev->frame = 0; // use normal textures
}
开发者ID:Sh1ft0x0EF,项目名称:HLSDKRevamp,代码行数:16,代码来源:BaseButton.cpp
示例17: EMIT_SOUND
void CBaseDoor::DoorGoDown( void )
{
if( !FBitSet( pev->spawnflags, SF_DOOR_SILENT ))
EMIT_SOUND( edict(), CHAN_STATIC, STRING( pev->noise1 ), 1, ATTN_NORM );
ASSERT( m_iState == STATE_ON || m_iState == STATE_TURN_ON );
m_iState = STATE_TURN_OFF;
SetMoveDone( DoorHitBottom );
if( IsRotatingDoor( ))
AngularMove( m_vecAngle1, pev->speed );
else LinearMove( m_vecPosition1, pev->speed );
}
开发者ID:XashDev,项目名称:XashXT,代码行数:14,代码来源:doors.cpp
示例18: SetThink
void CGunTarget::Next( void )
{
SetThink( NULL );
m_hTargetEnt = GetNextTarget();
CBaseEntity *pTarget = m_hTargetEnt;
if( !pTarget )
{
Stop();
return;
}
SetMoveDone( &CGunTarget::Wait );
LinearMove( pTarget->pev->origin - ( pev->mins + pev->maxs ) * 0.5, pev->speed );
}
开发者ID:CryoKeen,项目名称:HLEnhanced,代码行数:15,代码来源:CGunTarget.cpp
示例19: SetThink
void CGunTarget::Next( void )
{
SetThink( NULL );
m_hTargetEnt = GetNextTarget();
CBaseEntity *pTarget = m_hTargetEnt;
if ( !pTarget )
{
Stop();
return;
}
SetMoveDone( &CGunTarget::Wait );
LinearMove( pTarget->GetLocalOrigin(), m_flSpeed );
}
开发者ID:Au-heppa,项目名称:swarm-sdk,代码行数:16,代码来源:guntarget.cpp
示例20: EMIT_SOUND
//
// Starts the door going to its "down" position (simply ToggleData->vecPosition1).
//
void CBaseDoor::DoorGoDown( void )
{
if ( !FBitSet( pev->spawnflags, SF_DOOR_SILENT ) )
EMIT_SOUND(ENT(pev), CHAN_STATIC, (char*)STRING(pev->noiseMoving), 1, ATTN_NORM);
#ifdef DOOR_ASSERT
ASSERT(m_toggle_state == TS_AT_TOP);
#endif // DOOR_ASSERT
m_toggle_state = TS_GOING_DOWN;
SetMoveDone( DoorHitBottom );
if ( FClassnameIs(pev, "func_door_rotating"))//rotating door
AngularMove( m_vecAngle1, pev->speed);
else
LinearMove( m_vecPosition1, pev->speed);
}
开发者ID:CecilHarvey,项目名称:RealBot,代码行数:19,代码来源:doors.cpp
注:本文中的LinearMove函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论