本文整理汇总了C++中UTIL_SetOrigin函数的典型用法代码示例。如果您正苦于以下问题:C++ UTIL_SetOrigin函数的具体用法?C++ UTIL_SetOrigin怎么用?C++ UTIL_SetOrigin使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了UTIL_SetOrigin函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetSolid
void CRagGib::Spawn( const char *szModel, const Vector &vecOrigin, const Vector &vecForce, float flFadeTime = 0.0 )
{
SetSolid( SOLID_BBOX );
AddSolidFlags( FSOLID_NOT_SOLID );
SetModel( szModel );
UTIL_SetSize(this, vec3_origin, vec3_origin);
UTIL_SetOrigin( this, vecOrigin );
if ( !BecomeRagdollOnClient( vecForce ) )
{
AddSolidFlags( FSOLID_NOT_STANDABLE );
RemoveSolidFlags( FSOLID_NOT_SOLID );
}
if( flFadeTime > 0.0 )
{
SUB_StartFadeOut( flFadeTime );
}
}
示例2: GetClassPtr
CDumbfire *CDumbfire::ShootDumbfire( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity )
{
CDumbfire *pDumbfire = GetClassPtr( (CDumbfire *)NULL );
pDumbfire->Spawn();
UTIL_SetOrigin( pDumbfire->pev, vecStart );
pDumbfire->pev->velocity = vecVelocity;
pDumbfire->pev->angles = UTIL_VecToAngles (pDumbfire->pev->velocity);
pDumbfire->pev->owner = ENT(pevOwner);
pDumbfire->SetThink ( Follow );
pDumbfire->pev->nextthink = 0.1;
pDumbfire->SetTouch( ExplodeTouch );
pDumbfire->pev->dmg = dmg_dumbfire_missile.value * (mp_wpn_power.value/100);
pDumbfire->pev->avelocity.z = -300;
FX_Trail(pDumbfire->pev->origin, pDumbfire->entindex(), PROJ_DUMBFIRE );
return pDumbfire;
}
示例3: UTIL_SetOrigin
void AvHBasePlayerWeapon::Spawn()
{
CBasePlayerWeapon::Spawn();
this->pev->solid = SOLID_BBOX;
this->pev->movetype = MOVETYPE_TOSS;
UTIL_SetOrigin(this->pev, this->pev->origin);
UTIL_SetSize(this->pev, kMarineItemMinSize, kMarineItemMaxSize);
this->pev->iuser3 = AVH_USER3_MARINEITEM;
#ifdef AVH_SERVER
if(!this->GetIsPersistent())
{
this->mLifetime = AvHSUGetWeaponStayTime();
}
#endif
}
示例4: SpawnFlock
//=========================================================
//=========================================================
void CFlockingFlyerFlock :: SpawnFlock( void )
{
float R = m_flFlockRadius;
int iCount;
Vector vecSpot;
CFlockingFlyer *pBoid, *pLeader;
pLeader = pBoid = NULL;
for ( iCount = 0 ; iCount < m_cFlockSize ; iCount++ )
{
pBoid = GetClassPtr( (CFlockingFlyer *)NULL );
if ( !pLeader )
{
// make this guy the leader.
pLeader = pBoid;
pLeader->m_pSquadLeader = pLeader;
pLeader->m_pSquadNext = NULL;
}
vecSpot.x = RANDOM_FLOAT( -R, R );
vecSpot.y = RANDOM_FLOAT( -R, R );
vecSpot.z = RANDOM_FLOAT( 0, 16 );
vecSpot = pev->origin + vecSpot;
UTIL_SetOrigin(pBoid->pev, vecSpot);
pBoid->pev->movetype = MOVETYPE_FLY;
pBoid->SpawnCommonCode();
pBoid->pev->flags &= ~FL_ONGROUND;
pBoid->pev->velocity = g_vecZero;
pBoid->pev->angles = pev->angles;
pBoid->pev->frame = 0;
pBoid->pev->nextthink = gpGlobals->time + 0.2;
pBoid->SetThink( &CFlockingFlyer :: IdleThink );
if ( pBoid != pLeader )
{
pLeader->SquadAdd( pBoid );
}
}
}
示例5: Spawn
void COsprey :: Spawn( void )
{
Precache( );
// motor
pev->movetype = MOVETYPE_FLY;
pev->solid = SOLID_BBOX;
if (pev->model)
SET_MODEL(ENT(pev), STRING(pev->model)); //LRC
else
SET_MODEL(ENT(pev), "models/osprey.mdl");
UTIL_SetSize(pev, Vector( -400, -400, -100), Vector(400, 400, 32));
UTIL_SetOrigin( this, pev->origin );
//ALERT(at_console, "Osprey origin %f %f %f\n", pev->origin.x, pev->origin.y, pev->origin.z);
pev->flags |= FL_MONSTER;
pev->takedamage = DAMAGE_YES;
m_flRightHealth = 200;
m_flLeftHealth = 200;
pev->health = 400;
pev->speed = 80; //LRC - default speed, in case path corners don't give a speed.
m_flFieldOfView = 0; // 180 degrees
pev->sequence = 0;
ResetSequenceInfo( );
pev->frame = RANDOM_LONG(0,0xFF);
InitBoneControllers();
SetThink(&COsprey :: FindAllThink );
SetUse(&COsprey :: CommandUse );
if (!(pev->spawnflags & SF_WAITFORTRIGGER))
{
SetNextThink( 1.0 );
}
m_pos2 = pev->origin;
m_ang2 = pev->angles;
m_vel2 = pev->velocity;
}
示例6: Spawn
void CMomentaryRotButton :: Spawn( void )
{
// g-cont. just to have two seperate entities
if( FClassnameIs( pev, "momentary_rot_door" ))
SetBits( pev->spawnflags, SF_MOMENTARY_ROT_DOOR );
Precache();
AxisDir( pev );
m_bUpdateTarget = true;
if( pev->speed == 0 )
pev->speed = 100;
m_startPosition = bound( 0.0f, m_startPosition, 1.0f );
if( m_flMoveDistance < 0 )
{
pev->movedir = pev->movedir * -1;
m_flMoveDistance = -m_flMoveDistance;
}
m_direction = -1;
m_start = GetLocalAngles() - pev->movedir * m_flMoveDistance * m_startPosition;
m_end = GetLocalAngles() + pev->movedir * m_flMoveDistance * (1.0f - m_startPosition);
pev->ideal_yaw = m_startPosition;
m_iState = STATE_OFF;
if( FBitSet( pev->spawnflags, SF_MOMENTARY_ROT_DOOR ))
pev->solid = SOLID_BSP;
else pev->solid = SOLID_NOT;
pev->movetype = MOVETYPE_PUSH;
SET_MODEL( edict(), GetModel() );
UTIL_SetOrigin( this, GetLocalOrigin( ));
m_lastUsed = 0;
m_pUserData = WorldPhysic->CreateKinematicBodyFromEntity( this );
SetUse( &CMomentaryRotButton::ButtonUse );
}
示例7: Spawn
//
// Tentacle Spawn
//
void CTentacle :: Spawn( )
{
Precache( );
pev->solid = SOLID_BBOX;
pev->movetype = MOVETYPE_FLY;
pev->effects = 0;
pev->health = 75;
pev->sequence = 0;
SET_MODEL(ENT(pev), "models/tentacle2.mdl");
UTIL_SetSize( pev, Vector( -32, -32, 0 ), Vector( 32, 32, 64 ) );
pev->takedamage = DAMAGE_AIM;
pev->flags |= FL_MONSTER;
m_bloodColor = BLOOD_COLOR_GREEN;
SetThink( &CTentacle::Start );
SetTouch( &CTentacle::HitTouch );
SetUse( &CTentacle::CommandUse );
pev->nextthink = gpGlobals->time + 0.2;
ResetSequenceInfo( );
m_iDir = 1;
pev->yaw_speed = 18;
m_flInitialYaw = pev->angles.y;
pev->ideal_yaw = m_flInitialYaw;
g_fFlySound = FALSE;
g_fSquirmSound = FALSE;
m_iHitDmg = 20;
if (m_flMaxYaw <= 0)
m_flMaxYaw = 65;
m_MonsterState = MONSTERSTATE_IDLE;
// SetThink( Test );
UTIL_SetOrigin( pev, pev->origin );
}
示例8: GetClassPtr
void AvHSpitGun::FireProjectiles(void)
{
#ifdef AVH_SERVER
// Spawn spit
AvHSpit* theSpit = GetClassPtr((AvHSpit*)NULL );
theSpit->Spawn();
UTIL_MakeVectors(this->m_pPlayer->pev->v_angle);
Vector vecAiming = gpGlobals->v_forward;
Vector vecSrc = this->m_pPlayer->GetGunPosition( ) + vecAiming;
UTIL_SetOrigin(theSpit->pev, vecSrc);
// This needs to be the same as in EV_SpitGun
Vector theBaseVelocity;
VectorScale(this->pev->velocity, kSpitParentVelocityScalar, theBaseVelocity);
Vector theStartVelocity;
VectorMA(theBaseVelocity, kSpitVelocity, vecAiming, theStartVelocity);
VectorCopy(theStartVelocity, theSpit->pev->velocity);
// Set owner
theSpit->pev->owner = ENT(this->m_pPlayer->pev);
// Set spit's team :)
theSpit->pev->team = this->m_pPlayer->pev->team;
// Set amount of damage it will do
float theFocusScalar = 1.0f;
if(AvHSHUGetIsWeaponFocusable(AvHWeaponID(this->m_iId)))
{
theFocusScalar = AvHPlayerUpgrade::GetFocusDamageUpgrade(this->m_pPlayer->pev->iuser4);
}
float theDamage = this->mDamage*AvHPlayerUpgrade::GetAlienRangedDamageUpgrade(this->m_pPlayer->pev->iuser4)*theFocusScalar;
theSpit->SetDamage(theDamage);
#endif
}
示例9: ShootTimed
CMGrenade * CMGrenade:: ShootTimed( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity, float time )
{
CMGrenade *pGrenade = CreateClassPtr( (CMGrenade *)NULL );
if (pGrenade == NULL) // no free monster edicts left?
return NULL;
pGrenade->Spawn();
UTIL_SetOrigin( pGrenade->pev, vecStart );
pGrenade->pev->velocity = vecVelocity;
pGrenade->pev->angles = UTIL_VecToAngles(pGrenade->pev->velocity);
pGrenade->pev->owner = ENT(pevOwner);
pGrenade->SetTouch( BounceTouch ); // Bounce if touched
// Take one second off of the desired detonation time and set the think to PreDetonate. PreDetonate
// will insert a DANGER sound into the world sound list and delay detonation for one second so that
// the grenade explodes after the exact amount of time specified in the call to ShootTimed().
pGrenade->pev->dmgtime = gpGlobals->time + time;
pGrenade->SetThink( TumbleThink );
pGrenade->pev->nextthink = gpGlobals->time + 0.1;
if (time < 0.1)
{
pGrenade->pev->nextthink = gpGlobals->time;
pGrenade->pev->velocity = Vector( 0, 0, 0 );
}
pGrenade->pev->sequence = RANDOM_LONG( 3, 6 );
pGrenade->pev->framerate = 1.0;
// Tumble through the air
// pGrenade->pev->avelocity.x = -400;
pGrenade->pev->gravity = 0.5;
pGrenade->pev->friction = 0.8;
SET_MODEL(ENT(pGrenade->pev), "models/w_grenade.mdl");
pGrenade->pev->dmg = 100;
return pGrenade;
}
示例10: switch
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CFire::SpawnEffect( fireType_e type, float scale )
{
CBaseFire *pEffect = NULL;
switch ( type )
{
default:
case FIRE_NATURAL:
{
CFireSmoke *fireSmoke = (CFireSmoke *) CreateEntityByName( "_firesmoke" );
fireSmoke->EnableSmoke( ( m_spawnflags & SF_FIRE_SMOKELESS )==false );
fireSmoke->EnableGlow( ( m_spawnflags & SF_FIRE_NO_GLOW )==false );
fireSmoke->EnableVisibleFromAbove( ( m_spawnflags & SF_FIRE_VISIBLE_FROM_ABOVE )!=false );
pEffect = fireSmoke;
m_nFireType = FIRE_NATURAL;
m_takedamage = DAMAGE_YES;
}
break;
case FIRE_PLASMA:
{
CPlasma *plasma = (CPlasma *) CreateEntityByName( "_plasma" );
plasma->EnableSmoke( true );
pEffect = plasma;
m_nFireType = FIRE_PLASMA;
m_takedamage = DAMAGE_YES;
// Start burn sound
EmitSound( "Fire.Plasma" );
}
break;
}
UTIL_SetOrigin( pEffect, GetAbsOrigin() );
pEffect->Spawn();
pEffect->SetParent( this );
pEffect->Scale( m_flFireSize, m_flFireSize, 0 );
//Start it going
pEffect->Enable( ( m_spawnflags & SF_FIRE_START_ON ) );
m_hEffect = pEffect;
}
示例11: GetClassPtr
CGrenade *CGrenade::ShootContact(entvars_t *pevOwner, Vector vecStart, Vector vecVelocity)
{
CGrenade *pGrenade = GetClassPtr((CGrenade *)NULL);
pGrenade->Spawn();
pGrenade->pev->gravity = 0.5;
UTIL_SetOrigin(pGrenade->pev, vecStart);
pGrenade->pev->velocity = vecVelocity;
pGrenade->pev->angles = UTIL_VecToAngles(pGrenade->pev->velocity);
pGrenade->pev->owner = ENT(pevOwner);
pGrenade->SetThink(&CGrenade::DangerSoundThink);
pGrenade->pev->nextthink = gpGlobals->time;
pGrenade->pev->avelocity.x = RANDOM_FLOAT(-100, -500);
pGrenade->SetTouch(&CGrenade::ExplodeTouch);
pGrenade->pev->dmg = gSkillData.plrDmgM203Grenade;
pGrenade->m_bJustBlew = true;
return pGrenade;
}
示例12: Spawn
void CAirtank :: Spawn( void )
{
Precache( );
// motor
pev->movetype = MOVETYPE_FLY;
pev->solid = SOLID_BBOX;
SET_MODEL(ENT(pev), "models/w_oxygen.mdl");
UTIL_SetSize(pev, Vector( -16, -16, 0), Vector(16, 16, 36));
UTIL_SetOrigin( pev, pev->origin );
SetTouch( TankTouch );
SetThink( TankThink );
pev->flags |= FL_MONSTER;
pev->takedamage = DAMAGE_YES;
pev->health = 20;
pev->dmg = 50;
m_state = 1;
}
示例13: MoveToRandomSpot
CBaseEntity* MoveToRandomSpot( CBaseEntity *pEnt )
{
if ( pEnt )
{
#ifdef HL2SB
CBasePlayer *pLocalPlayer = UTIL_GetNearestPlayer( pEnt->GetAbsOrigin() );
#else
CBasePlayer *pLocalPlayer = UTIL_GetLocalPlayer();
#endif
if ( pLocalPlayer )
{
Vector vForward;
pLocalPlayer->EyeVectors(&vForward );
UTIL_SetOrigin( pEnt, GetRandomSpot() );
}
}
return pEnt;
}
示例14: UTIL_EmitAmbientSound
void CCaptureObject::Captured(CBaseEntity *pPlayer)
{
g_pGameRules->AddScoreToTeam(pev->team, 10);
UTIL_EmitAmbientSound ( ENT(0), g_vecZero, "game/ctf_captured.wav", VOL_NORM, ATTN_NONE, 0, PITCH_NORM);
UTIL_ShowMessage("#FLAG_CAPTURED", pPlayer);
Reset(pPlayer);
pev->impulse = CO_STAY;
pev->origin = pev->startpos;
UTIL_SetOrigin(pev, pev->origin);
pev->angles = pev->v_angle;
if (pPlayer == NULL)
return;
if (!pPlayer->IsPlayer())
return;
CBasePlayer *plr = (CBasePlayer *)pPlayer;
plr->AddMoney (GIVE_CTF_WIN);
}
示例15: UTIL_SetOrigin
//-----------------------------------------------------------------------------
// Purpose: Create a missile
//-----------------------------------------------------------------------------
CGrenadeRocket *CGrenadeRocket::Create( const Vector &vecOrigin, const Vector &vecForward, edict_t *pentOwner = NULL, CBaseEntity *pRealOwner = NULL )
{
CGrenadeRocket *pRocket = (CGrenadeRocket *)CreateEntityByName("grenade_rocket" );
UTIL_SetOrigin( pRocket, vecOrigin );
QAngle angles;
VectorAngles( vecForward, angles );
pRocket->SetLocalAngles( angles );
pRocket->Spawn();
pRocket->SetOwnerEntity( Instance( pentOwner ) );
pRocket->m_pRealOwner = pRealOwner;
if (pentOwner)
{
CBaseEntity *pOwnerEnt = GetContainingEntity( pentOwner );
pRocket->ChangeTeam( pOwnerEnt->GetTeamNumber() );
}
return pRocket;
}