本文整理汇总了C++中UTIL_MakeAimVectors函数的典型用法代码示例。如果您正苦于以下问题:C++ UTIL_MakeAimVectors函数的具体用法?C++ UTIL_MakeAimVectors怎么用?C++ UTIL_MakeAimVectors使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了UTIL_MakeAimVectors函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DeployThink
void COsprey :: DeployThink( void )
{
UTIL_MakeAimVectors( GetAbsAngles() );
Vector vecForward = gpGlobals->v_forward;
Vector vecRight = gpGlobals->v_right;
Vector vecUp = gpGlobals->v_up;
Vector vecSrc;
TraceResult tr;
UTIL_TraceLine( GetAbsOrigin(), GetAbsOrigin() + Vector( 0, 0, -4096.0), ignore_monsters, ENT(pev), &tr);
CSoundEnt::InsertSound ( bits_SOUND_DANGER, tr.vecEndPos, 400, 0.3 );
vecSrc = GetAbsOrigin() + vecForward * 32 + vecRight * 100 + vecUp * -96;
m_hRepel[0] = MakeGrunt( vecSrc );
vecSrc = GetAbsOrigin() + vecForward * -64 + vecRight * 100 + vecUp * -96;
m_hRepel[1] = MakeGrunt( vecSrc );
vecSrc = GetAbsOrigin() + vecForward * 32 + vecRight * -100 + vecUp * -96;
m_hRepel[2] = MakeGrunt( vecSrc );
vecSrc = GetAbsOrigin() + vecForward * -64 + vecRight * -100 + vecUp * -96;
m_hRepel[3] = MakeGrunt( vecSrc );
SetThink( HoverThink );
pev->nextthink = gpGlobals->time + 0.1;
}
示例2: LookupSequence
int CController::LookupFloat( )
{
if (m_velocity.Length( ) < 32.0)
{
return LookupSequence( "up" );
}
UTIL_MakeAimVectors( pev->angles );
float x = DotProduct( gpGlobals->v_forward, m_velocity );
float y = DotProduct( gpGlobals->v_right, m_velocity );
float z = DotProduct( gpGlobals->v_up, m_velocity );
if (fabs(x) > fabs(y) && fabs(x) > fabs(z))
{
if (x > 0)
return LookupSequence( "forward");
else
return LookupSequence( "backward");
}
else if (fabs(y) > fabs(z))
{
if (y > 0)
return LookupSequence( "right");
else
return LookupSequence( "left");
}
else
{
if (z > 0)
return LookupSequence( "up");
else
return LookupSequence( "down");
}
}
示例3: UTIL_MakeAimVectors
void COsprey::UpdateGoal( )
{
if (m_pGoalEnt)
{
m_pos1 = m_pos2;
m_ang1 = m_ang2;
m_vel1 = m_vel2;
m_pos2 = m_pGoalEnt->GetAbsOrigin();
m_ang2 = m_pGoalEnt->GetAbsAngles();
UTIL_MakeAimVectors( Vector( 0, m_ang2.y, 0 ) );
m_vel2 = gpGlobals->v_forward * m_pGoalEnt->pev->speed;
m_startTime = m_startTime + m_dTime;
m_dTime = 2.0 * (m_pos1 - m_pos2).Length() / (m_vel1.Length() + m_pGoalEnt->pev->speed);
if (m_ang1.y - m_ang2.y < -180)
{
m_ang1.y += 360;
}
else if (m_ang1.y - m_ang2.y > 180)
{
m_ang1.y -= 360;
}
if (m_pGoalEnt->pev->speed < 400)
m_flIdealtilt = 0;
else
m_flIdealtilt = -90;
}
else
{
ALERT( at_console, "osprey missing target");
}
}
示例4: SENTENCEG_PlayRndSz
//=========================================================
// IdleSound
//=========================================================
void CISlave::IdleSound(void)
{
if(RANDOM_LONG(0, 2) == 0)
{
SENTENCEG_PlayRndSz(ENT(pev), "SLV_IDLE", 0.85, ATTN_NORM, 0, m_voicePitch);
}
#if 0
int side = RANDOM_LONG( 0, 1 ) * 2 - 1;
ClearBeams( );
ArmBeam( side );
UTIL_MakeAimVectors( pev->angles );
Vector vecSrc = pev->origin + gpGlobals->v_right * 2 * side;
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, vecSrc );
WRITE_BYTE(TE_DLIGHT);
WRITE_COORD(vecSrc.x); // X
WRITE_COORD(vecSrc.y); // Y
WRITE_COORD(vecSrc.z); // Z
WRITE_BYTE( 8 ); // radius * 0.1
WRITE_BYTE( 255 ); // r
WRITE_BYTE( 180 ); // g
WRITE_BYTE( 96 ); // b
WRITE_BYTE( 10 ); // time * 10
WRITE_BYTE( 0 ); // decay * 0.1
MESSAGE_END( );
EMIT_SOUND_DYN( ENT(pev), CHAN_WEAPON, "debris/zap1.wav", 1, ATTN_NORM, 0, 100 );
#endif
}
示例5: DeployThink
void COsprey :: DeployThink( void )
{
UTIL_MakeAimVectors( pev->angles );
Vector vecForward = gpGlobals->v_forward;
Vector vecRight = gpGlobals->v_right;
Vector vecUp = gpGlobals->v_up;
Vector vecSrc;
TraceResult tr;
UTIL_TraceLine( pev->origin, pev->origin + Vector( 0, 0, -4096.0), ignore_monsters, ENT(pev), &tr);
CSoundEnt::InsertSound ( bits_SOUND_DANGER, tr.vecEndPos, 400, 0.3 );
vecSrc = pev->origin + vecForward * 32 + vecRight * 100 + vecUp * -96;
m_hRepel[0] = MakeGrunt( vecSrc );
vecSrc = pev->origin + vecForward * -64 + vecRight * 100 + vecUp * -96;
m_hRepel[1] = MakeGrunt( vecSrc );
vecSrc = pev->origin + vecForward * 32 + vecRight * -100 + vecUp * -96;
m_hRepel[2] = MakeGrunt( vecSrc );
vecSrc = pev->origin + vecForward * -64 + vecRight * -100 + vecUp * -96;
m_hRepel[3] = MakeGrunt( vecSrc );
SetThink(&COsprey :: HoverThink );
SetNextThink( 0.1 );
}
示例6: HandleAnimEvent
//=========================================================
// HandleAnimEvent - catches the monster-specific messages
// that occur when tagged animation frames are played.
//
// Returns number of events handled, 0 if none.
//=========================================================
void CHAssassin :: HandleAnimEvent( MonsterEvent_t *pEvent )
{
switch( pEvent->event )
{
case ASSASSIN_AE_SHOOT1:
Shoot( );
break;
case ASSASSIN_AE_TOSS1:
{
UTIL_MakeVectors( pev->angles );
CGrenade::ShootTimed( pev, pev->origin + gpGlobals->v_forward * 34 + Vector (0, 0, 32), m_vecTossVelocity, 2.0 );
m_flNextGrenadeCheck = gpGlobals->time + 6;// wait six seconds before even looking again to see if a grenade can be thrown.
m_fThrowGrenade = FALSE;
// !!!LATER - when in a group, only try to throw grenade if ordered.
}
break;
case ASSASSIN_AE_JUMP:
{
// ALERT( at_console, "jumping");
UTIL_MakeAimVectors( pev->angles );
pev->movetype = MOVETYPE_TOSS;
pev->flags &= ~FL_ONGROUND;
pev->velocity = m_vecJumpVelocity;
m_flNextJump = gpGlobals->time + 3.0;
}
return;
default:
CBaseMonster::HandleAnimEvent( pEvent );
break;
}
}
示例7: UTIL_MakeAimVectors
void CEnvLight::__MAKE_VHOOK(Spawn)()
{
#ifdef HOOK_GAMEDLL
// NOTE: fix negative the values for function sprintf from STD C++:
// expected - sv_skyvec_y "0.000000"
// with using sprintf from STD C++, got - sv_skyvec_y "-0.000000"
// If we not doing it then the test will be failed!
#define SPRINTF_OLD_STD_FIX + 0
#else
#define SPRINTF_OLD_STD_FIX
#endif
char szVector[64];
UTIL_MakeAimVectors(pev->angles);
Q_sprintf(szVector, "%f", gpGlobals->v_forward.x SPRINTF_OLD_STD_FIX);
CVAR_SET_STRING("sv_skyvec_x", szVector);
Q_sprintf(szVector, "%f", gpGlobals->v_forward.y SPRINTF_OLD_STD_FIX);
CVAR_SET_STRING("sv_skyvec_y", szVector);
Q_sprintf(szVector, "%f", gpGlobals->v_forward.z SPRINTF_OLD_STD_FIX);
CVAR_SET_STRING("sv_skyvec_z", szVector);
CLight::Spawn();
}
示例8: CheckTraceHullAttack
//=========================================================
// CheckTraceHullAttack - expects a length to trace, amount
// of damage to do, and damage type. Returns a pointer to
// the damaged entity in case the monster wishes to do
// other stuff to the victim (punchangle, etc)
//
// Used for many contact-range melee attacks. Bites, claws, etc.
//=========================================================
CBaseEntity* CBaseMonster :: CheckTraceHullAttack( float flDist, int iDamage, int iDmgType )
{
TraceResult tr;
if (IsPlayer())
UTIL_MakeVectors( pev->angles );
else
UTIL_MakeAimVectors( pev->angles );
Vector vecStart = pev->origin;
vecStart.z += pev->size.z * 0.5;
Vector vecEnd = vecStart + (gpGlobals->v_forward * flDist );
UTIL_TraceHull( vecStart, vecEnd, dont_ignore_monsters, head_hull, ENT(pev), &tr );
if ( tr.pHit )
{
CBaseEntity *pEntity = CBaseEntity::Instance( tr.pHit );
if ( iDamage > 0 )
{
pEntity->TakeDamage( pev, pev, iDamage, iDmgType );
}
return pEntity;
}
return NULL;
}
示例9: UTIL_MakeAimVectors
void CFuncTankGun::Fire(const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker)
{
if (m_fireLast != 0)
{
UTIL_MakeAimVectors(pev->angles);
int bulletCount = (int)((gpGlobals->time - m_fireLast) * m_fireRate);
if (bulletCount > 0)
{
for (int i = 0; i < bulletCount; i++)
{
switch (m_bulletType)
{
case TANK_BULLET_9MM: FireBullets(1, barrelEnd, forward, gTankSpread[m_spread], 4096, BULLET_MONSTER_9MM, 1, m_iBulletDamage, pevAttacker); break;
case TANK_BULLET_MP5: FireBullets(1, barrelEnd, forward, gTankSpread[m_spread], 4096, BULLET_MONSTER_MP5, 1, m_iBulletDamage, pevAttacker); break;
case TANK_BULLET_12MM: FireBullets(1, barrelEnd, forward, gTankSpread[m_spread], 4096, BULLET_MONSTER_12MM, 1, m_iBulletDamage, pevAttacker); break;
default:
case TANK_BULLET_NONE: break;
}
}
CFuncTank::Fire(barrelEnd, forward, pevAttacker);
}
}
else
CFuncTank::Fire(barrelEnd, forward, pevAttacker);
}
示例10: UTIL_MakeAimVectors
/* <8df51> ../cstrike/dlls/func_tank.cpp:854 */
void CFuncTankLaser::__MAKE_VHOOK(Fire)(const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker)
{
int i;
TraceResult tr;
if (m_fireLast != 0 && GetLaser())
{
// TankTrace needs gpGlobals->v_up, etc.
UTIL_MakeAimVectors(pev->angles);
int bulletCount = (int)((gpGlobals->time - m_fireLast) * m_fireRate);
if (bulletCount)
{
for (i = 0; i < bulletCount; i++)
{
m_pLaser->pev->origin = barrelEnd;
TankTrace(barrelEnd, forward, gTankSpread[m_spread], tr);
m_laserTime = gpGlobals->time;
m_pLaser->TurnOn();
m_pLaser->pev->dmgtime = gpGlobals->time - 1.0;
m_pLaser->FireAtPoint(tr);
m_pLaser->pev->nextthink = 0;
}
CFuncTank::Fire(barrelEnd, forward, pev);
}
}
else
{
CFuncTank::Fire(barrelEnd, forward, pev);
}
}
示例11: Spawn
void CEnvLight :: Spawn( void )
{
char szVector[64];
UTIL_MakeAimVectors( pev->angles );
sprintf( szVector, "%f", gpGlobals->v_forward.x );
CVAR_SET_STRING( "sv_skyvec_x", szVector );
sprintf( szVector, "%f", gpGlobals->v_forward.y );
CVAR_SET_STRING( "sv_skyvec_y", szVector );
sprintf( szVector, "%f", gpGlobals->v_forward.z );
CVAR_SET_STRING( "sv_skyvec_z", szVector );
CLight::Spawn( );
}
示例12: HandleAnimEvent
//=========================================================
// HandleAnimEvent - catches the monster-specific messages
// that occur when tagged animation frames are played.
//=========================================================
void CIchthyosaur :: HandleAnimEvent( MonsterEvent_t *pEvent )
{
int bDidAttack = FALSE;
switch( pEvent->event )
{
case ICHTHYOSAUR_AE_SHAKE_RIGHT:
case ICHTHYOSAUR_AE_SHAKE_LEFT:
{
if (m_hEnemy != NULL && FVisible( m_hEnemy ))
{
CBaseEntity *pHurt = m_hEnemy;
if (m_flEnemyTouched < gpGlobals->time - 0.2 && (m_hEnemy->BodyTarget( pev->origin ) - pev->origin).Length() > (32+16+32))
break;
Vector vecShootDir = ShootAtEnemy( pev->origin );
UTIL_MakeAimVectors ( pev->angles );
if (DotProduct( vecShootDir, gpGlobals->v_forward ) > 0.707)
{
m_bOnAttack = TRUE;
pHurt->pev->punchangle.z = -18;
pHurt->pev->punchangle.x = 5;
pHurt->pev->velocity = pHurt->pev->velocity - gpGlobals->v_right * 300;
if (pHurt->IsPlayer())
{
pHurt->pev->angles.x += RANDOM_FLOAT( -35, 35 );
pHurt->pev->angles.y += RANDOM_FLOAT( -90, 90 );
pHurt->pev->angles.z = 0;
pHurt->pev->fixangle = TRUE;
}
pHurt->TakeDamage( pev, pev, gSkillData.ichthyosaurDmgShake, DMG_SLASH );
}
}
BiteSound();
bDidAttack = TRUE;
}
break;
default:
CFlyingMonster::HandleAnimEvent( pEvent );
break;
}
if (bDidAttack)
{
Vector vecSrc = pev->origin + gpGlobals->v_forward * 32;
UTIL_Bubbles( vecSrc - Vector( 8, 8, 8 ), vecSrc + Vector( 8, 8, 8 ), 16 );
}
}
示例13: Spawn
void CTripmineGrenade :: Spawn( void )
{
Precache( );
// motor
pev->movetype = MOVETYPE_FLY;
pev->solid = SOLID_NOT;
SET_MODEL(ENT(pev), "models/v_tripmine.mdl");
pev->frame = 0;
pev->body = 3;
pev->sequence = TRIPMINE_WORLD;
ResetSequenceInfo( );
pev->framerate = 0;
UTIL_SetSize(pev, Vector( -8, -8, -8), Vector(8, 8, 8));
UTIL_SetOrigin( pev, pev->origin );
if (pev->spawnflags & 1)
{
// power up quickly
m_flPowerUp = gpGlobals->time + 1.0;
}
else
{
// power up in 2.5 seconds
m_flPowerUp = gpGlobals->time + 2.5;
}
SetThink( PowerupThink );
pev->nextthink = gpGlobals->time + 0.2;
pev->takedamage = DAMAGE_YES;
pev->dmg = gSkillData.plrDmgTripmine;
pev->health = 1; // don't let die normally
if (pev->owner != NULL)
{
// play deploy sound
EMIT_SOUND( ENT(pev), CHAN_VOICE, "weapons/mine_deploy.wav", 1.0, ATTN_NORM );
EMIT_SOUND( ENT(pev), CHAN_BODY, "weapons/mine_charge.wav", 0.2, ATTN_NORM ); // chargeup
m_pRealOwner = pev->owner;// see CTripmineGrenade for why.
}
UTIL_MakeAimVectors( pev->angles );
m_vecDir = gpGlobals->v_forward;
m_vecEnd = pev->origin + m_vecDir * 2048;
}
示例14: UTIL_MakeAimVectors
void CISlave::ArmBeam(int side)
{
TraceResult tr;
float flDist = 1.0;
if(m_iBeams >= ISLAVE_MAX_BEAMS)
return;
UTIL_MakeAimVectors(pev->angles);
Vector vecSrc = pev->origin + gpGlobals->v_up * 36 + gpGlobals->v_right * side * 16 + gpGlobals->v_forward * 32;
for(int i = 0; i < 3; i++)
{
Vector vecAim = gpGlobals->v_right * side * RANDOM_FLOAT(0, 1) + gpGlobals->v_up * RANDOM_FLOAT(-1, 1);
TraceResult tr1;
UTIL_TraceLine(vecSrc, vecSrc + vecAim * 512, dont_ignore_monsters, ENT(pev), &tr1);
if(flDist > tr1.flFraction)
{
tr = tr1;
flDist = tr.flFraction;
}
}
// Couldn't find anything close enough
if(flDist == 1.0)
return;
DecalGunshot(&tr, BULLET_PLAYER_CROWBAR);
m_pBeam[m_iBeams] = CBeam::BeamCreate("sprites/lgtning.spr", 30);
if(!m_pBeam[m_iBeams])
return;
m_pBeam[m_iBeams]->PointEntInit(tr.vecEndPos, entindex());
m_pBeam[m_iBeams]->SetEndAttachment(side < 0 ? 2 : 1);
// m_pBeam[m_iBeams]->SetColor( 180, 255, 96 );
m_pBeam[m_iBeams]->SetColor(96, 128, 16);
m_pBeam[m_iBeams]->SetBrightness(64);
m_pBeam[m_iBeams]->SetNoise(80);
m_iBeams++;
}
示例15: UTIL_MakeAimVectors
void COsprey::UpdateGoal( )
{
if (m_pGoalEnt)
{
m_pos1 = m_pos2;
m_ang1 = m_ang2;
m_vel1 = m_vel2;
m_pos2 = m_pGoalEnt->pev->origin;
m_ang2 = m_pGoalEnt->pev->angles;
UTIL_MakeAimVectors( Vector( 0, m_ang2.y, 0 ) );
//LRC - ugh. we shouldn't require our path corners to specify a speed!
if (m_pGoalEnt->pev->speed)
pev->speed = m_pGoalEnt->pev->speed;
m_vel2 = gpGlobals->v_forward * pev->speed; //LRC
m_startTime = m_startTime + m_dTime;
m_dTime = 2.0 * (m_pos1 - m_pos2).Length() / (m_vel1.Length() + pev->speed);
//ALERT(at_console, "osprey m_dTime = %f / %f + %f\n", (m_pos1 - m_pos2).Length(), m_vel1.Length(), m_pGoalEnt->pev->speed);
if (m_ang1.y - m_ang2.y < -180)
{
m_ang1.y += 360;
}
else if (m_ang1.y - m_ang2.y > 180)
{
m_ang1.y -= 360;
}
if (pev->speed < 400)
m_flIdealtilt = 0;
else
m_flIdealtilt = -90;
}
else
{
ALERT( at_debug, "osprey missing target");
}
}