//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CFlare::Start( float lifeTime ) { StartBurnSound(); if ( m_pBurnSound != NULL ) { CSoundEnvelopeController::GetController().Play( m_pBurnSound, 0.0f, 60 ); CSoundEnvelopeController::GetController().SoundChangeVolume( m_pBurnSound, 0.8f, 2.0f ); CSoundEnvelopeController::GetController().SoundChangePitch( m_pBurnSound, 100, 2.0f ); } if ( lifeTime > 0 ) { m_flTimeBurnOut = gpGlobals->curtime + lifeTime; } else { m_flTimeBurnOut = -1.0f; } RemoveEffects( EF_NODRAW ); SetThink( &CFlare::FlareThink ); SetNextThink( gpGlobals->curtime + 0.1f ); }
//----------------------------------------------------------------------------- // Purpose: Drop/throw the weapon with the given velocity. //----------------------------------------------------------------------------- void CASW_Weapon::Drop( const Vector &vecVelocity ) { StopAnimation(); StopFollowingEntity( ); SetMoveType( MOVETYPE_FLYGRAVITY ); // clear follow stuff, setup for collision SetGravity(1.0); m_iState = WEAPON_NOT_CARRIED; RemoveEffects( EF_NODRAW ); FallInit(); SetGroundEntity( NULL ); SetTouch(NULL); IPhysicsObject *pObj = VPhysicsGetObject(); if ( pObj != NULL ) { AngularImpulse angImp( 200, 200, 200 ); pObj->AddVelocity( &vecVelocity, &angImp ); } else { SetAbsVelocity( vecVelocity ); } SetNextThink( gpGlobals->curtime + 1.0f ); SetOwnerEntity( NULL ); SetOwner( NULL ); SetModel( GetWorldModel() ); }
//==================================================================================== // WEAPON SPAWNING //==================================================================================== //----------------------------------------------------------------------------- // Purpose: Make a weapon visible and tangible //-----------------------------------------------------------------------------// void CBaseCombatWeapon::Materialize( void ) { if ( IsEffectActive( EF_NODRAW ) ) { // changing from invisible state to visible. #ifdef HL2MP EmitSound( "AlyxEmp.Charge" ); #else EmitSound( "BaseCombatWeapon.WeaponMaterialize" ); #endif RemoveEffects( EF_NODRAW ); DoMuzzleFlash(); } #ifdef HL2MP if ( HasSpawnFlags( SF_NORESPAWN ) == false ) { VPhysicsInitNormal( SOLID_BBOX, GetSolidFlags() | FSOLID_TRIGGER, false ); SetMoveType( MOVETYPE_VPHYSICS ); HL2MPRules()->AddLevelDesignerPlacedObject( this ); } #else SetSolid( SOLID_BBOX ); AddSolidFlags( FSOLID_TRIGGER ); #endif SetPickupTouch(); SetThink (NULL); }
// todo: turn off collision when asleep? void CASW_Simple_Alien::SetSleeping(bool bAsleep) { if (bAsleep == m_bSleeping) return; m_bSleeping = bAsleep; if (bAsleep) { // go asleep AddEffects( EF_NODRAW ); SetThink( &CASW_Simple_Alien::SleepThink ); SetNextThink( gpGlobals->curtime + 0.1f ); } else { // wake up RemoveEffects( EF_NODRAW ); SetThink( &CASW_Simple_Alien::AlienThink ); SetNextThink( gpGlobals->curtime + 0.1f ); // set our enemy to the nearest marine FindNewEnemy(); // if we couldn't see any marines, wake up, but just idle if (!GetEnemy()) { SetState(ASW_SIMPLE_ALIEN_IDLING); } else { AlertSound(); } } }
void CASW_Queen_Divers::SetVisible(bool bVisible) { if (bVisible) RemoveEffects( EF_NODRAW ); else AddEffects( EF_NODRAW ); }
void EffectManager::Draw() { sf::Time frameTime = frameClock.restart(); int size = effects.size(); for (int i = 0; i < size; i++) { effects[i]->DrawEffect(frameTime); } RemoveEffects(); }
//----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void CHL2MP_Player::FlashlightTurnOff( void ) { RemoveEffects( EF_DIMLIGHT ); if( IsAlive() ) { EmitSound( "HL2Player.FlashlightOff" ); } }
void CFuncWallToggle::TurnOn( void ) { IPhysicsObject *pPhys = VPhysicsGetObject(); if ( pPhys ) { pPhys->EnableCollisions( true ); } RemoveSolidFlags( FSOLID_NOT_SOLID ); RemoveEffects( EF_NODRAW ); }
void CHL2MP_Player::Event_Killed( const CTakeDamageInfo &info ) { //update damage info with our accumulated physics force CTakeDamageInfo subinfo = info; subinfo.SetDamageForce( m_vecTotalBulletForce ); #ifdef GE_DLL // Since we fixed force application, give the ragdoll an extra oomph to emphasize his death m_vecTotalBulletForce.x *= 2.5f; m_vecTotalBulletForce.y *= 2.5f; m_vecTotalBulletForce.z *= 2.0f; #endif // Note: since we're dead, it won't draw us on the client, but we don't set EF_NODRAW // because we still want to transmit to the clients in our PVS. CreateRagdollEntity(); #ifndef GE_DLL DetonateTripmines(); #endif BaseClass::Event_Killed( subinfo ); if ( info.GetDamageType() & DMG_DISSOLVE ) { if ( m_hRagdoll ) { m_hRagdoll->GetBaseAnimating()->Dissolve( NULL, gpGlobals->curtime, false, ENTITY_DISSOLVE_NORMAL ); } } #ifndef GE_DLL CBaseEntity *pAttacker = info.GetAttacker(); if ( pAttacker ) { int iScoreToAdd = 1; if ( pAttacker == this ) { iScoreToAdd = -1; } GetGlobalTeam( pAttacker->GetTeamNumber() )->AddMatchScore( iScoreToAdd ); } #endif FlashlightTurnOff(); m_lifeState = LIFE_DEAD; RemoveEffects( EF_NODRAW ); // still draw player body StopZooming(); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CTFPowerup::Materialize( void ) { if ( !m_bDisabled && IsEffectActive( EF_NODRAW ) ) { // changing from invisible state to visible. EmitSound( "Item.Materialize" ); RemoveEffects( EF_NODRAW ); } m_bRespawning = false; SetTouch( &CItem::ItemTouch ); }
//----------------------------------------------------------------------------- // Purpose: Shows the brush. //----------------------------------------------------------------------------- void CFuncBrush::TurnOn( void ) { if ( IsOn() ) return; if ( m_iSolidity != BRUSHSOLID_NEVER ) { RemoveSolidFlags( FSOLID_NOT_SOLID ); } RemoveEffects( EF_NODRAW ); }
void CWateryDeathLeech::LeechThink( void ) { if ( IsMarkedForDeletion() ) return; StudioFrameAdvance(); SetNextThink( gpGlobals->curtime + 0.1 ); if ( m_iFadeState != 0 ) { float dt = gpGlobals->frametime; if ( dt > 0.1f ) { dt = 0.1f; } m_nRenderMode = kRenderTransTexture; int speed = max(1,256*dt); // fade out over 1 second if ( m_iFadeState == -1 ) SetRenderColorA( UTIL_Approach( 0, m_clrRender->a, speed ) ); else SetRenderColorA( UTIL_Approach( 255, m_clrRender->a, speed ) ); if ( m_clrRender->a == 0 ) { UTIL_Remove(this); } else if ( m_clrRender->a == 255 ) { m_iFadeState = 0; } else { SetNextThink( gpGlobals->curtime ); } } if ( GetOwnerEntity() ) { if ( GetOwnerEntity()->GetWaterLevel() < 3 ) { AddEffects( EF_NODRAW ); } else { RemoveEffects( EF_NODRAW ); } SetAbsOrigin( GetOwnerEntity()->GetAbsOrigin() + GetOwnerEntity()->GetViewOffset() ); } }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CTeamControlPoint::SetActive( bool active ) { m_bActive = active; if( active ) { RemoveEffects( EF_NODRAW ); } else { AddEffects( EF_NODRAW ); } }
//----------------------------------------------------------------------------- // Purpose: // Input : state - //----------------------------------------------------------------------------- void C_ASW_AOEGrenade_Projectile::NotifyShouldTransmit( ShouldTransmitState_t state ) { if ( state == SHOULDTRANSMIT_END ) { AddEffects( EF_NODRAW ); } else if ( state == SHOULDTRANSMIT_START ) { RemoveEffects( EF_NODRAW ); } BaseClass::NotifyShouldTransmit( state ); }
//========================================================= // Materialize - make a CWeaponDODBase visible and tangible //========================================================= void CWeaponDODBase::Materialize() { if ( IsEffectActive( EF_NODRAW ) ) { RemoveEffects( EF_NODRAW ); DoMuzzleFlash(); } AddSolidFlags( FSOLID_TRIGGER ); SetThink (&CWeaponDODBase::SUB_Remove); SetNextThink( gpGlobals->curtime + 1 ); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CPointCommentaryNode::SetDisabled( bool bDisabled ) { m_bDisabled = bDisabled; if ( m_bDisabled ) { AddEffects( EF_NODRAW ); } else { RemoveEffects( EF_NODRAW ); } }
//----------------------------------------------------------------------------- // Purpose: Sets HL2 specific defaults. //----------------------------------------------------------------------------- void CHL2MP_Player::Spawn(void) { m_flNextModelChangeTime = 0.0f; m_flNextTeamChangeTime = 0.0f; PickDefaultSpawnTeam(); BaseClass::Spawn(); if ( !IsObserver() ) { pl.deadflag = false; RemoveSolidFlags( FSOLID_NOT_SOLID ); RemoveEffects( EF_NODRAW ); GiveDefaultItems(); } SetNumAnimOverlays( 3 ); ResetAnimation(); m_nRenderFX = kRenderNormal; m_Local.m_iHideHUD = 0; AddFlag(FL_ONGROUND); // set the player on the ground at the start of the round. m_impactEnergyScale = HL2MPPLAYER_PHYSDAMAGE_SCALE; if ( HL2MPRules()->IsIntermission() ) { AddFlag( FL_FROZEN ); } else { RemoveFlag( FL_FROZEN ); } m_iSpawnInterpCounter = (m_iSpawnInterpCounter + 1) % 8; m_Local.m_bDucked = false; SetPlayerUnderwater(false); m_bReady = false; m_flNextKickAttack = gpGlobals->curtime; CBaseViewModel *Leg = GetViewModel(1); Leg->SetWeaponModel("models/weapons/v_kick.mdl", NULL); }
void CGEPropDynamic::Materialize(void) { //A more lightweight and optional func_rebreakable materalize function CreateVPhysics(); if (m_bRobustSpawn) { // iterate on all entities in the vicinity. CBaseEntity *pEntity; Vector max = CollisionProp()->OBBMaxs(); for (CEntitySphereQuery sphere(GetAbsOrigin(), max.NormalizeInPlace()); (pEntity = sphere.GetCurrentEntity()) != NULL; sphere.NextEntity()) { if (pEntity == this || pEntity->GetSolid() == SOLID_NONE || pEntity->GetSolid() == SOLID_BSP || pEntity->GetSolidFlags() & FSOLID_NOT_SOLID || pEntity->GetMoveType() & MOVETYPE_NONE) continue; // Ignore props that can't move if (pEntity->VPhysicsGetObject() && !pEntity->VPhysicsGetObject()->IsMoveable()) continue; // Prevent respawn if we are blocked by anything and try again in 1 second if (Intersects(pEntity)) { SetSolid(SOLID_NONE); AddSolidFlags(FSOLID_NOT_SOLID); VPhysicsDestroyObject(); SetNextThink(gpGlobals->curtime + 1.0f); return; } } } m_iHealth = m_iHealthOverride; if (m_iHealth > 0) m_takedamage = DAMAGE_YES; RemoveEffects(EF_NODRAW); RemoveSolidFlags(FSOLID_NOT_SOLID); m_bUsingBrokenSkin = false; if (m_bUseRandomSkins) PickNewSkin(); else m_nSkin = m_iStartingSkin; SetRenderColor(m_col32basecolor.r, m_col32basecolor.g, m_col32basecolor.b); m_Respawn.FireOutput(this, this); }
//------------------------------------------------------------------------------ // Purpose : // Input : // Output : //------------------------------------------------------------------------------ void CGrenadePathfollower::Launch( float flLaunchSpeed, string_t sPathCornerName) { m_pPathTarget = gEntList.FindEntityByName( NULL, sPathCornerName ); if (m_pPathTarget) { m_flFlySpeed = flLaunchSpeed; Vector vTargetDir = (m_pPathTarget->GetAbsOrigin() - GetAbsOrigin()); VectorNormalize(vTargetDir); SetAbsVelocity( m_flFlySpeed * vTargetDir ); QAngle angles; VectorAngles( GetAbsVelocity(), angles ); SetLocalAngles( angles ); } else { Warning( "ERROR: Grenade_Pathfollower (%s) with no pathcorner!\n",GetDebugName()); return; } // Make this thing come to life RemoveSolidFlags( FSOLID_NOT_SOLID ); SetMoveType( MOVETYPE_FLYGRAVITY ); RemoveEffects( EF_NODRAW ); SetUse( &CGrenadePathfollower::DetonateUse ); SetTouch( &CGrenadePathfollower::GrenadeTouch ); SetThink( &CGrenadePathfollower::AimThink ); SetNextThink( gpGlobals->curtime + 0.1f ); // Make the trail m_hRocketTrail = RocketTrail::CreateRocketTrail(); if ( m_hRocketTrail ) { m_hRocketTrail->m_Opacity = 0.2f; m_hRocketTrail->m_SpawnRate = 100; m_hRocketTrail->m_ParticleLifetime = 0.5f; m_hRocketTrail->m_StartColor.Init( 0.65f, 0.65f , 0.65f ); m_hRocketTrail->m_EndColor.Init( 0.0, 0.0, 0.0 ); m_hRocketTrail->m_StartSize = 8; m_hRocketTrail->m_EndSize = 16; m_hRocketTrail->m_SpawnRadius = 4; m_hRocketTrail->m_MinSpeed = 2; m_hRocketTrail->m_MaxSpeed = 16; m_hRocketTrail->SetLifetime( 999 ); m_hRocketTrail->FollowEntity( this, "0" ); } }
//----------------------------------------------------------------------------- // Purpose: Sets HL2 specific defaults. //----------------------------------------------------------------------------- void CHL2MP_Player::Spawn(void) { m_flNextModelChangeTime = 0.0f; m_flNextTeamChangeTime = 0.0f; PickDefaultSpawnTeam(); BaseClass::Spawn(); if ( !IsObserver() ) { pl.deadflag = false; RemoveSolidFlags( FSOLID_NOT_SOLID ); RemoveEffects( EF_NODRAW ); GiveDefaultItems(); } m_nRenderFX = kRenderNormal; m_Local.m_iHideHUD = 0; AddFlag(FL_ONGROUND); // set the player on the ground at the start of the round. m_impactEnergyScale = HL2MPPLAYER_PHYSDAMAGE_SCALE; if ( HL2MPRules()->IsIntermission() ) { AddFlag( FL_FROZEN ); } else { RemoveFlag( FL_FROZEN ); } m_iSpawnInterpCounter = (m_iSpawnInterpCounter + 1) % 8; m_Local.m_bDucked = false; SetPlayerUnderwater(false); m_bReady = false; //Tony; do the spawn animevent DoAnimationEvent( PLAYERANIMEVENT_SPAWN ); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CSprite::TurnOn( void ) { RemoveEffects( EF_NODRAW ); if ( (m_flSpriteFramerate && m_flMaxFrame > 1.0) #if !defined( CLIENT_DLL ) || (m_spawnflags & SF_SPRITE_ONCE) #endif ) { SetThink( &CSprite::AnimateThink ); SetNextThink( gpGlobals->curtime ); m_flLastTime = gpGlobals->curtime; } m_flFrame = 0; }
void CItem::Materialize( void ) { CreateItemVPhysicsObject(); if ( IsEffectActive( EF_NODRAW ) ) { // changing from invisible state to visible. EmitSound( "Item.Materialize" ); RemoveEffects( EF_NODRAW ); DoMuzzleFlash(); } SetTouch( &CItem::ItemTouch ); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CEnvLaser::TurnOn( void ) { RemoveEffects( EF_NODRAW ); if ( m_pSprite ) m_pSprite->TurnOn(); m_flFireTime = gpGlobals->curtime; SetThink( &CEnvLaser::StrikeThink ); // // Call StrikeThink here to update the end position, otherwise we will see // the beam in the wrong place for one frame since we cleared the nodraw flag. // StrikeThink(); }
void CGrenade_Brickbat::Spawn( void ) { RemoveEffects( EF_NOINTERP ); SetCollisionGroup( COLLISION_GROUP_PROJECTILE ); SetTouch( BrickbatTouch ); SetThink( BrickbatThink ); SetNextThink( gpGlobals->curtime + 0.1f ); m_takedamage = DAMAGE_YES; m_iHealth = 1; SetGravity( 1.0 ); SetSequence( 1 ); CreateVPhysics(); }
void CHL2MP_Player::Event_Killed( const CTakeDamageInfo &info ) { //update damage info with our accumulated physics force CTakeDamageInfo subinfo = info; subinfo.SetDamageForce( m_vecTotalBulletForce ); // Note: since we're dead, it won't draw us on the client, but we don't set EF_NODRAW // because we still want to transmit to the clients in our PVS. CreateRagdollEntity(); //DHL - Skillet - SLAMs are removed, plus the sound is cheesy at death //DetonateTripmines(); BaseClass::Event_Killed( subinfo ); if ( info.GetDamageType() & DMG_DISSOLVE ) { if ( m_hRagdoll ) { m_hRagdoll->GetBaseAnimating()->Dissolve( NULL, gpGlobals->curtime, false, ENTITY_DISSOLVE_NORMAL ); } } CBaseEntity *pAttacker = info.GetAttacker(); if ( pAttacker ) { int iScoreToAdd = 1; if ( pAttacker == this ) { iScoreToAdd = -1; } if ( !DHLRules()->IsGameWaiting() ) //DHL { GetGlobalTeam( pAttacker->GetTeamNumber() )->AddScore( iScoreToAdd ); } } FlashlightTurnOff(); m_lifeState = LIFE_DEAD; RemoveEffects( EF_NODRAW ); // still draw player body StopZooming(); }
//----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void CHL2MP_Player::FlashlightTurnOff( void ) { #ifdef GE_DLL // Only play the flashlight sound if the light was actually on before hand if ( IsEffectActive( EF_DIMLIGHT ) && IsAlive() ) EmitSound( "HL2Player.FlashlightOff" ); #endif RemoveEffects( EF_DIMLIGHT ); #ifndef GE_DLL if( IsAlive() ) { EmitSound( "HL2Player.FlashlightOff" ); } #endif }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CTFPowerup::SetDisabled( bool bDisabled ) { m_bDisabled = bDisabled; if ( bDisabled ) { AddEffects( EF_NODRAW ); } else { // only turn it back on if we're not in the middle of respawning if ( !m_bRespawning ) { RemoveEffects( EF_NODRAW ); } } }
//----------------------------------------------------------------------------- // Purpose: Sets up the entity's initial state //----------------------------------------------------------------------------- void GhostEntity::Spawn( void ) { Precache(); if (GhostEngine::getEngine()->shouldDrawTrails()) { if (ghostData.trailLength > 0) { CreateTrail(); } } RemoveEffects(EF_NODRAW); SetModel(MODEL); SetSolid( SOLID_NONE ); SetRenderMode(kRenderTransColor); SetRenderColor(ghostData.ghostRed, ghostData.ghostGreen, ghostData.ghostBlue); SetRenderColorA(75); SetMoveType( MOVETYPE_NOCLIP ); isActive = true; }
void CGrenade_Molotov::Spawn( void ) { SetMoveType( MOVETYPE_FLYGRAVITY, MOVECOLLIDE_FLY_BOUNCE ); SetSolid( SOLID_BBOX ); SetCollisionGroup( COLLISION_GROUP_PROJECTILE ); RemoveEffects( EF_NOINTERP ); SetModel( "models/weapons/w_molotov.mdl"); UTIL_SetSize(this, Vector( -6, -6, -2), Vector(6, 6, 2)); SetTouch( MolotovTouch ); SetThink( MolotovThink ); SetNextThink( gpGlobals->curtime + 0.1f ); m_flDamage = sk_plr_dmg_molotov.GetFloat(); m_DmgRadius = sk_molotov_radius.GetFloat(); m_takedamage = DAMAGE_YES; m_iHealth = 1; SetGravity( 1.0 ); SetFriction( 0.8 ); // Give a little bounce so can flatten SetSequence( 1 ); m_pFireTrail = SmokeTrail::CreateSmokeTrail(); if( m_pFireTrail ) { m_pFireTrail->m_SpawnRate = 48; m_pFireTrail->m_ParticleLifetime = 1.0f; m_pFireTrail->m_StartColor.Init( 0.2f, 0.2f, 0.2f ); m_pFireTrail->m_EndColor.Init( 0.0, 0.0, 0.0 ); m_pFireTrail->m_StartSize = 8; m_pFireTrail->m_EndSize = 32; m_pFireTrail->m_SpawnRadius = 4; m_pFireTrail->m_MinSpeed = 8; m_pFireTrail->m_MaxSpeed = 16; m_pFireTrail->m_Opacity = 0.25f; m_pFireTrail->SetLifetime( 20.0f ); m_pFireTrail->FollowEntity( this, "0" ); } }
//==================================================================================== // WEAPON SPAWNING //==================================================================================== //----------------------------------------------------------------------------- // Purpose: Make a weapon visible and tangible //-----------------------------------------------------------------------------// void CBaseCombatWeapon::Materialize( void ) { if ( IsEffectActive( EF_NODRAW ) ) { // changing from invisible state to visible. EmitSound( "BaseCombatWeapon.WeaponMaterialize" ); RemoveEffects( EF_NODRAW ); DoMuzzleFlash(); } SetSolid( SOLID_BBOX ); AddSolidFlags( FSOLID_TRIGGER ); SetPickupTouch(); SetThink (NULL); }