本文整理汇总了C++中CSprite::SetTransparency方法的典型用法代码示例。如果您正苦于以下问题:C++ CSprite::SetTransparency方法的具体用法?C++ CSprite::SetTransparency怎么用?C++ CSprite::SetTransparency使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSprite
的用法示例。
在下文中一共展示了CSprite::SetTransparency方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: __MAKE_VHOOK
/* <8d4ad> ../cstrike/dlls/func_tank.cpp:656 */
void CFuncTank::__MAKE_VHOOK(Fire)(const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker)
{
if (m_fireLast != 0)
{
if (m_iszSpriteSmoke)
{
CSprite *pSprite = CSprite::SpriteCreate(STRING(m_iszSpriteSmoke), barrelEnd, TRUE);
pSprite->AnimateAndDie(RANDOM_FLOAT(15, 20));
pSprite->SetTransparency(kRenderTransAlpha, pev->rendercolor.x, pev->rendercolor.y, pev->rendercolor.z, 255, kRenderFxNone);
pSprite->pev->velocity.z = RANDOM_FLOAT(40, 80);
pSprite->SetScale(m_spriteScale);
}
if (m_iszSpriteFlash)
{
CSprite *pSprite = CSprite::SpriteCreate(STRING(m_iszSpriteFlash), barrelEnd, TRUE);
pSprite->AnimateAndDie(60);
pSprite->SetTransparency(kRenderTransAdd, 255, 255, 255, 255, kRenderFxNoDissipation);
pSprite->SetScale(m_spriteScale);
// Hack Hack, make it stick around for at least 100 ms.
pSprite->pev->nextthink += 0.1;
}
SUB_UseTargets(this, USE_TOGGLE, 0);
}
m_fireLast = gpGlobals->time;
}
示例2: UpdateLight
//---------------------------------------------------------
//---------------------------------------------------------
void CBounceBomb::UpdateLight( bool bTurnOn, unsigned int r, unsigned int g, unsigned int b, unsigned int a )
{
if( bTurnOn )
{
Assert( a > 0 );
// Throw the old sprite away
if( m_hSprite )
{
UTIL_Remove( m_hSprite );
m_hSprite.Set( NULL );
}
if( !m_hSprite.Get() )
{
Vector up;
GetVectors( NULL, NULL, &up );
// Light isn't on.
m_hSprite = CSprite::SpriteCreate( "sprites/glow01.vmt", GetAbsOrigin() + up * 10.0f, false );
CSprite *pSprite = (CSprite *)m_hSprite.Get();
if( m_hSprite )
{
pSprite->SetParent( this );
pSprite->SetTransparency( kRenderTransAdd, r, g, b, a, kRenderFxNone );
pSprite->SetScale( 0.35, 0.0 );
}
}
else
{
// Update color
CSprite *pSprite = (CSprite *)m_hSprite.Get();
pSprite->SetTransparency( kRenderTransAdd, r, g, b, a, kRenderFxNone );
}
}
if( !bTurnOn )
{
if( m_hSprite )
{
UTIL_Remove( m_hSprite );
m_hSprite.Set( NULL );
}
}
if ( !m_hSprite )
{
m_LastSpriteColor.SetRawColor( 0 );
}
else
{
m_LastSpriteColor.SetColor( r, g, b, a );
}
}
示例3: Spawn
void CNPC_ControllerHeadBall::Spawn( void )
{
Precache( );
// motor
SetMoveType( MOVETYPE_FLY );
SetSolid( SOLID_BBOX );
SetSize( vec3_origin, vec3_origin );
m_pSprite = CSprite::SpriteCreate( "sprites/xspark4.vmt", GetAbsOrigin(), FALSE );
m_pSprite->SetTransparency( kRenderTransAdd, 255, 255, 255, 255, kRenderFxNoDissipation );
m_pSprite->SetAttachment( this, 0 );
m_pSprite->SetScale( 2.0 );
UTIL_SetSize( this, Vector( 0, 0, 0), Vector(0, 0, 0) );
UTIL_SetOrigin( this, GetAbsOrigin() );
SetThink( &CNPC_ControllerHeadBall::HuntThink );
SetTouch( &CNPC_ControllerHeadBall::BounceTouch );
// m_vecIdeal = vec3_origin; //(0,0,0)
SetNextThink( gpGlobals->curtime + 0.1 );
m_hOwner = GetOwnerEntity();
m_flSpawnTime = gpGlobals->curtime;
}
示例4: DoLoadEffect
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CWeaponCrossbow::DoLoadEffect( void )
{
SetSkin( BOLT_SKIN_GLOW );
CBasePlayer *pOwner = ToBasePlayer( GetOwner() );
if ( pOwner == NULL )
return;
CBaseViewModel *pViewModel = pOwner->GetViewModel();
if ( pViewModel == NULL )
return;
CEffectData data;
data.m_nEntIndex = pViewModel->entindex();
data.m_nAttachmentIndex = 1;
DispatchEffect( "CrossbowLoad", data );
CSprite *pBlast = CSprite::SpriteCreate( CROSSBOW_GLOW_SPRITE2, GetAbsOrigin(), false );
if ( pBlast )
{
pBlast->SetAttachment( pOwner->GetViewModel(), 1 );
pBlast->SetTransparency( kRenderTransAdd, 255, 255, 255, 255, kRenderFxNone );
pBlast->SetBrightness( 128 );
pBlast->SetScale( 0.2f );
pBlast->FadeOutFromSpawn();
}
}
示例5: Spawn
//=========================================================
// Spawn
//=========================================================
void CGargantua :: Spawn()
{
Precache( );
if (pev->model)
SET_MODEL(ENT(pev), STRING(pev->model)); //LRC
else
SET_MODEL(ENT(pev), "models/garg.mdl");
UTIL_SetSize( pev, Vector( -32, -32, 0 ), Vector( 32, 32, 64 ) );
pev->solid = SOLID_SLIDEBOX;
pev->movetype = MOVETYPE_STEP;
m_bloodColor = BLOOD_COLOR_GREEN;
if (!pev->health) pev->health = gSkillData.gargantuaHealth;
//pev->view_ofs = Vector ( 0, 0, 96 );// taken from mdl file
m_flFieldOfView = -0.2;// width of forward view cone ( as a dotproduct result )
m_MonsterState = MONSTERSTATE_NONE;
MonsterInit();
m_pEyeGlow = CSprite::SpriteCreate( GARG_EYE_SPRITE_NAME, GetAbsOrigin(), FALSE );
m_pEyeGlow->SetTransparency( kRenderGlow, 255, 255, 255, 0, kRenderFxNoDissipation );
m_pEyeGlow->SetAttachment( edict(), 1 );
EyeOff();
m_seeTime = gpGlobals->time + 5;
m_flameTime = gpGlobals->time + 2;
}
示例6: Shoot
void CSquidSpit::Shoot( CBaseEntity *pOwner, Vector vecStart, Vector vecVelocity )
{
CSquidSpit *pSpit = CREATE_ENTITY( CSquidSpit, "squidspit" );
pSpit->Spawn();
UTIL_SetOrigin( pSpit, vecStart );
pSpit->SetAbsVelocity( vecVelocity );
pSpit->SetOwnerEntity( pOwner );
CSprite *pSprite = (CSprite*)pSpit->GetSprite();
if ( pSprite )
{
pSprite->SetAttachment( pSpit, 0 );
pSprite->SetOwnerEntity( pSpit );
pSprite->SetScale( 0.5 );
pSprite->SetTransparency( pSpit->m_nRenderMode, pSpit->m_clrRender->r, pSpit->m_clrRender->g, pSpit->m_clrRender->b, pSpit->m_clrRender->a, pSpit->m_nRenderFX );
}
CPVSFilter filter( vecStart );
VectorNormalize( vecVelocity );
te->SpriteSpray( filter, 0.0, &vecStart , &vecVelocity, pSpit->m_nSquidSpitSprite, 210, 25, 15 );
}
示例7: Think
void CStomp::Think( void )
{
trace_t tr;
SetNextThink( gpGlobals->curtime + 0.1 );
// Do damage for this frame
Vector vecStart = GetAbsOrigin();
vecStart.z += 30;
Vector vecEnd = vecStart + (m_vecMoveDir * m_flSpeed * gpGlobals->frametime);
UTIL_TraceHull( vecStart, vecEnd, Vector(-32, -32, -32), Vector(32, 32, 32), MASK_SOLID, m_pOwner, COLLISION_GROUP_NONE, &tr );
// NDebugOverlay::Line( vecStart, vecEnd, 0, 255, 0, false, 10.0f );
if ( tr.m_pEnt )
{
CBaseEntity *pEntity = tr.m_pEnt;
CTakeDamageInfo info( this, this, 50, DMG_SONIC );
CalculateMeleeDamageForce( &info, m_vecMoveDir, tr.endpos );
pEntity->TakeDamage( info );
}
// Accelerate the effect
m_flSpeed += (gpGlobals->frametime) * m_uiFramerate;
m_uiFramerate += (gpGlobals->frametime) * 2000;
// Move and spawn trails
while ( gpGlobals->curtime - m_flDmgTime > STOMP_INTERVAL )
{
SetAbsOrigin( GetAbsOrigin() + m_vecMoveDir * m_flSpeed * STOMP_INTERVAL );
for ( int i = 0; i < 2; i++ )
{
CSprite *pSprite = CSprite::SpriteCreate( GARG_STOMP_SPRITE_NAME, GetAbsOrigin(), TRUE );
if ( pSprite )
{
UTIL_TraceLine( GetAbsOrigin(), GetAbsOrigin() - Vector(0,0,500), MASK_SOLID, this, COLLISION_GROUP_NONE, &tr );
pSprite->SetAbsOrigin( tr.endpos );
// pSprite->pev->velocity = Vector(RandomFloat(-200,200),RandomFloat(-200,200),175);
pSprite->SetNextThink( gpGlobals->curtime + 0.3 );
pSprite->SetThink( &CSprite::SUB_Remove );
pSprite->SetTransparency( kRenderTransAdd, 255, 255, 255, 255, kRenderFxFadeFast );
}
g_pEffects->EnergySplash( tr.endpos, tr.plane.normal );
}
m_flDmgTime += STOMP_INTERVAL;
// Scale has the "life" of this effect
m_flScale -= STOMP_INTERVAL * m_flSpeed;
if ( m_flScale <= 0 )
{
// Life has run out
UTIL_Remove(this);
// STOP_SOUND( edict(), CHAN_BODY, GARG_STOMP_BUZZ_SOUND );
CPASAttenuationFilter filter( this );
StopSound( entindex(), CHAN_STATIC, GARG_STOMP_BUZZ_SOUND );
}
}
}
示例8: Think
void CStomp::Think( void )
{
TraceResult tr;
pev->nextthink = gpGlobals->time + 0.1;
// Do damage for this frame
Vector vecStart = GetAbsOrigin();
vecStart.z += 30;
Vector vecEnd = vecStart + (pev->movedir * pev->speed * STOMP_FRAMETIME);
UTIL_TraceHull( vecStart, vecEnd, dont_ignore_monsters, head_hull, ENT(pev), &tr );
if ( tr.pHit && tr.pHit != pev->owner )
{
CBaseEntity *pEntity = CBaseEntity::Instance( tr.pHit );
entvars_t *pevOwner = pev;
if ( pev->owner )
pevOwner = VARS(pev->owner);
if ( pEntity )
pEntity->TakeDamage( pev, pevOwner, gSkillData.gargantuaDmgStomp, DMG_SONIC );
}
// Accelerate the effect
pev->speed = pev->speed + (STOMP_FRAMETIME) * pev->framerate;
pev->framerate = pev->framerate + (STOMP_FRAMETIME) * 1500;
// Move and spawn trails
while ( gpGlobals->time - pev->dmgtime > STOMP_INTERVAL )
{
SetAbsOrigin( GetAbsOrigin() + pev->movedir * pev->speed * STOMP_INTERVAL );
for ( int i = 0; i < 2; i++ )
{
CSprite *pSprite = CSprite::SpriteCreate( GARG_STOMP_SPRITE_NAME, GetAbsOrigin(), TRUE );
if ( pSprite )
{
UTIL_TraceLine( GetAbsOrigin(), GetAbsOrigin() - Vector( 0, 0, 500 ), ignore_monsters, edict(), &tr );
pSprite->SetAbsOrigin( tr.vecEndPos );
pSprite->SetAbsVelocity( Vector(RANDOM_FLOAT(-200,200),RANDOM_FLOAT(-200,200),175));
// pSprite->AnimateAndDie( RANDOM_FLOAT( 8.0, 12.0 ) );
pSprite->pev->nextthink = gpGlobals->time + 0.3;
pSprite->SetThink( SUB_Remove );
pSprite->SetTransparency( kRenderTransAdd, 255, 255, 255, 255, kRenderFxFadeFast );
}
}
pev->dmgtime += STOMP_INTERVAL;
// Scale has the "life" of this effect
pev->scale -= STOMP_INTERVAL * pev->speed;
if ( pev->scale <= 0 )
{
// Life has run out
UTIL_Remove(this);
STOP_SOUND( edict(), CHAN_BODY, GARG_STOMP_BUZZ_SOUND );
}
}
}
示例9: DeadThink
void CTank :: DeadThink ( void )
{
pev->nextthink = gpGlobals->time + 0.1;
pev->sequence = 0;
// camera tournante
pev->v_angle.y += 3;
//rectification de la position de la camera
vecCamAim = UpdateCam();
if ( m_pCam->pev->origin != vecCamAim )
m_pCam->pev->velocity = ( vecCamAim - m_pCam->pev->origin ) * 10;
UpdateCamAngle ( vecCamAim, NEXTTHINK_TIME );
// sprites de feu
for ( int i=0; i<4; i++ )
{
CSprite *pSpr = CSprite::SpriteCreate ( SPRITE_FEU, Vector(pev->origin.x,pev->origin.y,pev->origin.z + 100), TRUE );
pSpr->SetScale ( SPRITE_FEU_SCALE );
pSpr->AnimateAndDie ( RANDOM_FLOAT(20,25) );
pSpr->SetTransparency ( kRenderTransAdd, 255, 255, 255, 120, kRenderFxNone );
pSpr->pev->velocity = Vector ( RANDOM_FLOAT(-50,50),RANDOM_FLOAT(-50,50),140/*RANDOM_FLOAT(130,150)*/ );
}
for ( i=0; i<1; i++ )
{
CSprite *pSpr = CSprite::SpriteCreate ( SPRITE_SMOKEBALL, Vector(pev->origin.x,pev->origin.y,pev->origin.z + 100), TRUE );
pSpr->SetScale ( SPRITE_SMOKEBALL_SCALE );
pSpr->AnimateAndDie ( RANDOM_FLOAT(3,4) );
pSpr->SetTransparency ( kRenderTransAlpha, 255, 255, 255, 200, kRenderFxNone );
pSpr->pev->velocity = Vector ( RANDOM_FLOAT(-50,50),RANDOM_FLOAT(-50,50),RANDOM_FLOAT(130,150) );
}
}
示例10: Spawn
//-----------------------------------------------------------------------------
// Purpose: Spawn the entity
//-----------------------------------------------------------------------------
void CNPC_CeilingTurret::Spawn( void )
{
Precache();
SetModel( CEILING_TURRET_MODEL );
BaseClass::Spawn();
m_HackedGunPos = Vector( 0, 0, 12.75 );
SetViewOffset( EyeOffset( ACT_IDLE ) );
m_flFieldOfView = 0.0f;
m_takedamage = DAMAGE_YES;
m_iHealth = 1000;
m_bloodColor = BLOOD_COLOR_MECH;
SetSolid( SOLID_BBOX );
AddSolidFlags( FSOLID_NOT_STANDABLE );
SetHeight( CEILING_TURRET_RETRACT_HEIGHT );
AddFlag( FL_AIMTARGET );
AddEFlags( EFL_NO_DISSOLVE );
SetPoseParameter( m_poseAim_Yaw, 0 );
SetPoseParameter( m_poseAim_Pitch, 0 );
m_iAmmoType = GetAmmoDef()->Index( "AR2" );
//Create our eye sprite
m_pEyeGlow = CSprite::SpriteCreate( CEILING_TURRET_GLOW_SPRITE, GetLocalOrigin(), false );
m_pEyeGlow->SetTransparency( kRenderTransAdd, 255, 0, 0, 128, kRenderFxNoDissipation );
m_pEyeGlow->SetAttachment( this, 2 );
//Set our autostart state
m_bAutoStart = !!( m_spawnflags & SF_CEILING_TURRET_AUTOACTIVATE );
m_bEnabled = ( ( m_spawnflags & SF_CEILING_TURRET_STARTINACTIVE ) == false );
//Do we start active?
if ( m_bAutoStart && m_bEnabled )
{
SetThink( &CNPC_CeilingTurret::AutoSearchThink );
SetEyeState( TURRET_EYE_DORMANT );
}
else
{
SetEyeState( TURRET_EYE_DISABLED );
}
//Stagger our starting times
SetNextThink( gpGlobals->curtime + random->RandomFloat( 0.1f, 0.3f ) );
// Don't allow us to skip animation setup because our attachments are critical to us!
SetBoneCacheFlags( BCF_NO_ANIMATION_SKIP );
}
示例11: Fire
//-----------------------------------------------------------------------------
// Purpose: Fire targets and spawn sprites.
// Input : bulletCount -
// barrelEnd -
// forward -
// pAttacker -
//-----------------------------------------------------------------------------
void CFuncTank::Fire( int bulletCount, const Vector &barrelEnd, const Vector &forward, CBaseEntity *pAttacker )
{
if ( m_iszSpriteSmoke != NULL_STRING )
{
CSprite *pSprite = CSprite::SpriteCreate( STRING(m_iszSpriteSmoke), barrelEnd, TRUE );
pSprite->AnimateAndDie( random->RandomFloat( 15.0, 20.0 ) );
pSprite->SetTransparency( kRenderTransAlpha, m_clrRender->r, m_clrRender->g, m_clrRender->b, 255, kRenderFxNone );
Vector vecVelocity( 0, 0, random->RandomFloat(40, 80) );
pSprite->SetAbsVelocity( vecVelocity );
pSprite->SetScale( m_spriteScale );
}
if ( m_iszSpriteFlash != NULL_STRING )
{
CSprite *pSprite = CSprite::SpriteCreate( STRING(m_iszSpriteFlash), barrelEnd, TRUE );
pSprite->AnimateAndDie( 60 );
pSprite->SetTransparency( kRenderTransAdd, 255, 255, 255, 255, kRenderFxNoDissipation );
pSprite->SetScale( m_spriteScale );
}
m_OnFire.FireOutput(this, this);
}
示例12: Fire
// Fire targets and spawn sprites
void CFuncTank::Fire( const Vector &barrelEnd, const Vector &forward, entvars_t *pevAttacker )
{
if ( m_fireLast != 0 )
{
if ( m_iszSpriteSmoke )
{
CSprite *pSprite = CSprite::SpriteCreate( STRING(m_iszSpriteSmoke), barrelEnd, TRUE );
pSprite->AnimateAndDie( RANDOM_FLOAT( 15.0, 20.0 ) );
pSprite->SetTransparency( kRenderTransAlpha, static_cast<int>(pev->rendercolor.x), static_cast<int>(pev->rendercolor.y), static_cast<int>(pev->rendercolor.z), 255, kRenderFxNone );
pSprite->pev->velocity.z = RANDOM_FLOAT(40, 80);
pSprite->SetScale( m_spriteScale );
}
if ( m_iszSpriteFlash )
{
CSprite *pSprite = CSprite::SpriteCreate( STRING(m_iszSpriteFlash), barrelEnd, TRUE );
pSprite->AnimateAndDie( 60 );
pSprite->SetTransparency( kRenderTransAdd, 255, 255, 255, 255, kRenderFxNoDissipation );
pSprite->SetScale( m_spriteScale );
}
SUB_UseTargets( this, USE_TOGGLE, 0 );
}
m_fireLast = gpGlobals->time;
}
示例13: DoLoadEffect
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CWeaponCrossbow::DoLoadEffect()
{
SetSkin(BOLT_SKIN_GLOW);
CBasePlayer *pOwner = ToBasePlayer( GetOwner() );
if ( !pOwner )
return;
CEffectData data;
data.m_nAttachmentIndex = 1;
#ifdef GAME_DLL
data.m_nEntIndex = entindex();
CPASFilter filter(data.m_vOrigin);
filter.RemoveRecipient(pOwner);
te->DispatchEffect(filter, 0.0, data.m_vOrigin, "CrossbowLoad", data);
#else
CBaseViewModel *pViewModel = pOwner->GetViewModel();
if ( pViewModel != NULL )
{
if ( ::input->CAM_IsThirdPerson() )
data.m_hEntity = pViewModel->GetRefEHandle();
else
data.m_hEntity = GetRefEHandle();
DispatchEffect("CrossbowLoad", data);
}
#endif
//Tony; switched this up, always attach it to the weapon, not the view model!!
#ifndef CLIENT_DLL
CSprite *pBlast = CSprite::SpriteCreate( CROSSBOW_GLOW_SPRITE2, GetAbsOrigin(), false );
if ( pBlast )
{
pBlast->SetAttachment(this, 1);
pBlast->SetTransparency(kRenderTransAdd, 255, 255, 255, 255, kRenderFxNone );
pBlast->SetBrightness(128);
pBlast->SetScale(0.2f);
pBlast->FadeOutFromSpawn();
}
#endif
}
示例14: Spawn
void CXenPLight :: Spawn( void )
{
Precache();
SET_MODEL( ENT(pev), "models/light.mdl" );
pev->movetype = MOVETYPE_NONE;
pev->solid = SOLID_TRIGGER;
UTIL_SetSize( pev, Vector(-80,-80,0), Vector(80,80,32));
SetActivity( ACT_IDLE );
pev->nextthink = gpGlobals->time + 0.1;
pev->frame = RANDOM_FLOAT(0,255);
m_pGlow = CSprite::SpriteCreate( XEN_PLANT_GLOW_SPRITE, pev->origin + Vector((float)0, (float)0, (float)((pev->mins.z+pev->maxs.z)*0.5)), FALSE );
m_pGlow->SetTransparency( kRenderGlow, pev->rendercolor.x, pev->rendercolor.y, pev->rendercolor.z, pev->renderamt, pev->renderfx );
m_pGlow->SetAttachment( edict(), 1 );
}
示例15: DoLoadEffect
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CWeaponCrossbow::DoLoadEffect( void )
{
SetSkin( BOLT_SKIN_GLOW );
CBasePlayer *pOwner = ToBasePlayer( GetOwner() );
if ( pOwner == NULL )
return;
//Tony; change this up a bit; on the server, dispatch an effect but don't send it to the client who fires
//on the client, create an effect either in the view model, or on the world model if first person.
CEffectData data;
data.m_nAttachmentIndex = 1;
data.m_vOrigin = pOwner->GetAbsOrigin();
CPASFilter filter( data.m_vOrigin );
#ifdef GAME_DLL
filter.RemoveRecipient( pOwner );
data.m_nEntIndex = entindex();
#else
CBaseViewModel *pViewModel = pOwner->GetViewModel();
if ( ShouldDrawUsingViewModel() && pViewModel != NULL )
data.m_hEntity = pViewModel->GetRefEHandle();
else
data.m_hEntity = GetRefEHandle();
#endif
DispatchEffect( "CrossbowLoad", data, filter );
#ifndef CLIENT_DLL
CSprite *pBlast = CSprite::SpriteCreate( CROSSBOW_GLOW_SPRITE2, GetAbsOrigin(), false );
if ( pBlast )
{
pBlast->SetAttachment( this, 1 );
pBlast->SetTransparency( kRenderTransAdd, 255, 255, 255, 255, kRenderFxNone );
pBlast->SetBrightness( 128 );
pBlast->SetScale( 0.2f );
pBlast->FadeOutFromSpawn();
}
#endif
}