//----------------------------------------------------------------------------- // Purpose: Input that sets the sequence of the cycler //----------------------------------------------------------------------------- void CCycler::InputSetSequence( inputdata_t &inputdata ) { if (m_animate) { // Legacy support: Try it as a number, and support '0' const char *sChar = inputdata.value.String(); int iSeqNum = atoi( sChar ); if ( !iSeqNum && sChar[0] != '0' ) { // Treat it as a sequence name ResetSequence( LookupSequence( sChar ) ); } else { ResetSequence( iSeqNum ); } if (GetPlaybackRate() == 0.0) { ResetSequence( 0 ); } m_flCycle = 0; } }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CPropVehicleDriveable::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { CBasePlayer *pPlayer = ToBasePlayer( pActivator ); if ( !pPlayer ) return; ResetUseKey( pPlayer ); // Find out which hitbox the player's eyepoint is within int iEntryAnim = m_pServerVehicle->GetEntryAnimForPoint( pPlayer->EyePosition() ); // Are we in an entrypoint zone? if ( iEntryAnim != ACTIVITY_NOT_AVAILABLE ) { // Check to see if this vehicle can be controlled or if it's locked if ( CanControlVehicle() && CanEnterVehicle(pPlayer) ) { pPlayer->GetInVehicle( GetServerVehicle(), VEHICLE_DRIVER); // Setup the "enter" vehicle sequence and skip the animation if it isn't present. m_flCycle = 0; m_flAnimTime = gpGlobals->curtime; ResetSequence( iEntryAnim ); ResetClientsideFrame(); m_bEnterAnimOn = true; } } }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CNewWallHealth::Spawn(void) { Precache( ); SetMoveType( MOVETYPE_NONE ); SetSolid( SOLID_VPHYSICS ); CreateVPhysics(); SetModel( HEALTH_CHARGER_MODEL_NAME ); AddEffects( EF_NOSHADOW ); ResetSequence( LookupSequence( "idle" ) ); m_iJuice = sk_healthcharger.GetInt(); m_nState = 0; m_iReactivate = 0; m_iCaps = FCAP_CONTINUOUS_USE; CreateVPhysics(); m_flJuice = m_iJuice; SetCycle( 1.0f - ( m_flJuice / sk_healthcharger.GetFloat() ) ); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CPointCommentaryNode::Spawn( void ) { // No model specified? char *szModel = (char *)STRING( GetModelName() ); if (!szModel || !*szModel) { szModel = "models/extras/info_speech.mdl"; SetModelName( AllocPooledString(szModel) ); } Precache(); SetModel( szModel ); UTIL_SetSize( this, -Vector(16,16,16), Vector(16,16,16) ); SetSolid( SOLID_BBOX ); AddSolidFlags( FSOLID_CUSTOMRAYTEST | FSOLID_CUSTOMBOXTEST ); AddEffects( EF_NOSHADOW ); // Setup for animation ResetSequence( LookupSequence("idle") ); SetThink( &CPointCommentaryNode::SpinThink ); SetNextThink( gpGlobals->curtime + 0.1f ); m_iNodeNumber = 0; m_iNodeNumberMax = 0; SetDisabled( m_bDisabled ); }
void C_DHL_Player::ClientDeath( void ) { //This function should only be called for the local player, but just in case... if ( !IsLocalPlayer() ) return; //Fix ragdolls getting borked because of the stunt sequence if ( m_bProne ) { MDLCACHE_CRITICAL_SECTION(); ResetSequence( SelectWeightedSequence( ACT_DHL_PRONE_GENERIC ) ); } //Gotta go to first person for the ragdoll death cam if ( input->CAM_IsThirdPerson() ) { engine->ClientCmd( "firstperson \n"); m_bWantsThirdPerson = true; } if ( GetNightvisionEnabled() ) { EnableNightvision( false ); m_bWantsNV = true; } vieweffects->ClearAllFades(); //No screenfades after death }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CPropAPC::Think( void ) { BaseClass::Think(); SetNextThink( gpGlobals->curtime ); if ( !m_bInitialHandbrake ) // after initial timer expires, set the handbrake { m_bInitialHandbrake = true; m_VehiclePhysics.SetHandbrake( true ); m_VehiclePhysics.Think(); } StudioFrameAdvance(); if ( IsSequenceFinished() ) { int iSequence = SelectWeightedSequence( ACT_IDLE ); if ( iSequence > ACTIVITY_NOT_AVAILABLE ) { SetCycle( 0 ); m_flAnimTime = gpGlobals->curtime; ResetSequence( iSequence ); ResetClientsideFrame(); } } if (m_debugOverlays & OVERLAY_NPC_KILL_BIT) { CTakeDamageInfo info( this, this, m_iHealth, DMG_BLAST ); info.SetDamagePosition( WorldSpaceCenter() ); info.SetDamageForce( Vector( 0, 0, 1 ) ); TakeDamage( info ); } }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void Dota_Resupply::Spawn( void ) { Precache(); BaseClass::Spawn(); SetModel( STRING( GetModelName() ) ); SetMoveType( MOVETYPE_NONE ); SetSolid( SOLID_VPHYSICS ); CreateVPhysics(); ResetSequence( LookupSequence( "Idle" ) ); SetBodygroup( 1, true ); m_flCloseTime = gpGlobals->curtime; m_flAnimTime = gpGlobals->curtime; m_flPlaybackRate = 0.0; SetCycle( 0 ); m_takedamage = DAMAGE_EVENTS_ONLY; // Issue #28: JMS - 2013-10-12 - ammobox needs to fire a new modevent letting all clients know that one is spawned IGameEvent *pEvent = gameeventmanager->CreateEvent( "ammobox_spawn" ); if ( pEvent ) { pEvent->SetInt( "entindex", entindex() ); gameeventmanager->FireEvent( pEvent ); } }
//----------------------------------------------------------------------------- // Purpose: Start playing personality VO list //----------------------------------------------------------------------------- void CPropGladosCore::TalkingThink( void ) { if ( m_speechEvents.Count() <= 0 || !m_speechEvents.IsValidIndex( m_iSpeechIter ) ) { SetThink ( NULL ); SetNextThink( gpGlobals->curtime ); return; } // Loop the 'look around' animation after the first line. int iCurSequence = GetSequence(); int iLookSequence = LookupSequence( STRING(m_iszLookAnimationName) ); if ( iCurSequence != iLookSequence && m_iSpeechIter > 0 ) { ResetSequence( iLookSequence ); } int iPrevIter = m_iSpeechIter-1; if ( iPrevIter < 0 ) iPrevIter = 0; StopSound( m_speechEvents[iPrevIter].ToCStr() ); float flCurDuration = GetSoundDuration( m_speechEvents[m_iSpeechIter].ToCStr(), GLADOS_CORE_MODEL_NAME ); EmitSound( m_speechEvents[m_iSpeechIter].ToCStr() ); SetNextThink( gpGlobals->curtime + m_flBetweenVOPadding + flCurDuration ); // wrap if we hit the end of the list m_iSpeechIter = (m_iSpeechIter+1)%m_speechEvents.Count(); }
void CNewRecharge::Spawn() { Precache( ); SetMoveType( MOVETYPE_NONE ); SetSolid( SOLID_VPHYSICS ); CreateVPhysics(); SetModel( HEALTH_CHARGER_MODEL_NAME ); AddEffects( EF_NOSHADOW ); ResetSequence( LookupSequence( "idle" ) ); SetInitialCharge(); UpdateJuice( MaxJuice() ); m_nState = 0; m_iCaps = FCAP_CONTINUOUS_USE; CreateVPhysics(); m_flJuice = m_iJuice; m_iReactivate = 0; SetCycle( 1.0f - ( m_flJuice / MaxJuice() ) ); }
void Action_ResetTrDos(void) { isPaused = false; ResetSequence(); dev_mman.OnOutputByte(0x7FFD, 0x10); dev_trdos.Enable(); }
void CNPC_RocketTurret::FireRocket ( void ) { UTIL_Remove( m_hCurRocket ); CRocket_Turret_Projectile *pRocket = (CRocket_Turret_Projectile *) CBaseEntity::Create( "rocket_turret_projectile", EyePosition(), m_vecCurrentAngles, this ); if ( !pRocket ) return; m_hCurRocket = pRocket; Vector vForward; AngleVectors( m_vecCurrentAngles, &vForward, NULL, NULL ); m_flTimeLastFired = gpGlobals->curtime; EmitSound ( ROCKET_PROJECTILE_FIRE_SOUND ); ResetSequence(LookupSequence("fire")); pRocket->SetThink( NULL ); pRocket->SetMoveType( MOVETYPE_FLY ); pRocket->CreateSmokeTrail(); pRocket->SetModel( ROCKET_TURRET_PROJECTILE_NAME ); UTIL_SetSize( pRocket, vec3_origin, vec3_origin ); pRocket->SetAbsVelocity( vForward * 550 ); pRocket->SetLauncher ( this ); }
//----------------------------------------------------------------------------- // Purpose: Charge up, prepare to fire and give player time to dodge //----------------------------------------------------------------------------- void CNPC_RocketTurret::LockingThink( void ) { //Allow descended classes a chance to do something before the think function if ( PreThink() ) return; //Turn to face UpdateFacing(); SetNextThink( gpGlobals->curtime + ROCKET_TURRET_THINK_RATE ); if ( m_flTimeLocking == 0.0f ) { // Play lockon sound EmitSound ( ROCKET_TURRET_SOUND_LOCKING ); EmitSound ( ROCKET_TURRET_SOUND_LOCKING, gpGlobals->curtime + ROCKET_TURRET_QUARTER_LOCKON_TIME ); EmitSound ( ROCKET_TURRET_SOUND_LOCKED, gpGlobals->curtime + ROCKET_TURRET_HALF_LOCKON_TIME ); ResetSequence(LookupSequence("load")); // Change lockon sprite UpdateSkin( ROCKET_SKIN_LOCKING ); } m_flTimeLocking += ROCKET_TURRET_THINK_RATE; if ( m_flTimeLocking > ROCKET_TURRET_LOCKON_TIME ) { // Set Locked sprite to 'rocket out' color UpdateSkin( ROCKET_SKIN_LOCKED ); FireRocket(); SetThink ( &CNPC_RocketTurret::FiringThink ); m_flTimeLocking = 0.0f; } }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CPropVehicleViewController::InputForcePlayerIn( inputdata_t &inputdata ) { CBasePlayer *pPlayer = UTIL_PlayerByIndex(1); if ( !pPlayer ) return; ResetUseKey( pPlayer ); // Get the entry animation from the input int iEntryAnim = ACTIVITY_NOT_AVAILABLE; if ( inputdata.value.StringID() != NULL_STRING ) { iEntryAnim = LookupSequence( inputdata.value.String() ); if ( iEntryAnim == ACTIVITY_NOT_AVAILABLE ) { Warning("vehicle_viewcontroller %s could not find specified entry animation %s\n", STRING(GetEntityName()), inputdata.value.String() ); return; } } // Make sure we successfully got in the vehicle if ( pPlayer->GetInVehicle( GetServerVehicle(), VEHICLE_ROLE_DRIVER ) == false ) { // The player was unable to enter the vehicle and the output has failed Assert( 0 ); return; } // Setup the "enter" vehicle sequence SetCycle( 0 ); m_flAnimTime = gpGlobals->curtime; ResetSequence( iEntryAnim ); ResetClientsideFrame(); m_bEnterAnimOn = true; }
void CRagdollProp::InitRagdollAnimation() { m_flAnimTime = gpGlobals->curtime; m_flPlaybackRate = 0.0; m_flCycle = 0; // put into ACT_DIERAGDOLL if it exists, otherwise use sequence 0 int nSequence = SelectWeightedSequence( ACT_DIERAGDOLL ); if ( nSequence < 0 ) { ResetSequence( 0 ); } else { ResetSequence( nSequence ); } }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CTFProjectile_SentryRocket::Spawn() { BaseClass::Spawn(); SetModel( SENTRY_ROCKET_MODEL ); ResetSequence( LookupSequence("idle") ); }
void CASW_Boomer_Blob::CheckNearbyTargets( ) { // see if an alien is nearby if ( gpGlobals->curtime >= m_fEarliestAOEDetonationTime ) { if ( !m_bModelOpening && gpGlobals->curtime >= (m_fDetonateTime - ASW_BOOMER_WARN_DELAY) ) { // we are one second from detonating, commit to detonating and start the opening sequence // regardless of anyone nearby m_bModelOpening = true; ResetSequence( LookupSequence( "MortarBugProjectile_Opening" ) ); CEffectData data; data.m_vOrigin = GetAbsOrigin(); CPASFilter filter( data.m_vOrigin ); filter.SetIgnorePredictionCull(true); DispatchParticleEffect( "boomer_grenade_open", PATTACH_ABSORIGIN_FOLLOW, this, -1, false, -1, &filter ); } // if we exceeded the detonation time, just detonate if ( gpGlobals->curtime >= m_fDetonateTime ) { Detonate(); return; } // if the model is opening, do the animation advance if ( m_bModelOpening ) { StudioFrameAdvance(); SetNextThink( gpGlobals->curtime ); return; } float flRadius = asw_boomer_blob_radius_check_scale.GetFloat() * m_DmgRadius; Vector vecSrc = GetAbsOrigin(); CBaseEntity *pEntity = NULL; for ( CEntitySphereQuery sphere( vecSrc, flRadius ); ( pEntity = sphere.GetCurrentEntity() ) != NULL; sphere.NextEntity() ) { if ( !pEntity || !pEntity->IsPlayer() ) continue; // give them a 2 second warning before detonation m_fDetonateTime = MIN( m_fDetonateTime, m_fDetonateTime + ASW_BOOMER_WARN_DELAY ); } } if ( m_fDetonateTime <= gpGlobals->curtime + asw_boomer_blob_radius_check_interval.GetFloat() ) { SetThink( &CASW_Boomer_Blob::Detonate ); SetNextThink( m_fDetonateTime ); } else { SetThink( &CASW_Boomer_Blob::CheckNearbyTargets ); SetNextThink( gpGlobals->curtime + asw_boomer_blob_radius_check_interval.GetFloat() ); } }
//----------------------------------------------------------------------------- // Purpose: Input that lowers the cycler's shield //----------------------------------------------------------------------------- void CCycler_TF2Commando::InputLowerShield( inputdata_t &inputdata ) { if (m_animate) { m_bShieldActive = false; ResetSequence( LookupSequence( "ShieldDown" ) ); m_flShieldLowerTime = gpGlobals->curtime; } }
void CNewRecharge::InputSetCharge( inputdata_t &inputdata ) { ResetSequence( LookupSequence( "idle" ) ); int iJuice = inputdata.value.Int(); m_flJuice = m_iMaxJuice = m_iJuice = iJuice; StudioFrameAdvance(); }
void CASW_Queen_Divers::SetBurrowing(bool bBurrowing) { if (bBurrowing) { SetSolid(SOLID_BBOX); SetVisible(true); int iBurrowSeq = LookupSequence("divers_in"); if (GetSequence() != iBurrowSeq) ResetSequence(iBurrowSeq); } else { SetSolid(SOLID_NONE); int iUnburrowSeq = LookupSequence("divers_out"); if (GetSequence() != iUnburrowSeq) ResetSequence(iUnburrowSeq); } }
//----------------------------------------------------------------------------- // Purpose: Input that raises the cycler's shield //----------------------------------------------------------------------------- void CCycler_TF2Commando::InputRaiseShield( inputdata_t &inputdata ) { if (m_animate) { m_bShieldActive = true; ResetSequence( LookupSequence( "ShieldUp" ) ); m_flShieldRaiseTime = gpGlobals->curtime; } }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CASW_PropJeep::InputStartRemoveTauCannon( inputdata_t &inputdata ) { // Start the gun removal animation m_flAnimTime = gpGlobals->curtime; m_flPlaybackRate = 0.0; SetCycle( 0 ); ResetSequence( LookupSequence( "tau_levitate" ) ); m_bGunHasBeenCutOff = true; }
void CActAnimating :: SetActivity( Activity act ) { int sequence = SelectWeightedSequence( act ); if ( sequence != ACTIVITY_NOT_AVAILABLE ) { ResetSequence( sequence ); m_Activity = act; m_flCycle = 0; } }
void CASW_Boomer_Blob::Spawn( void ) { //d:\dev\main\game\infested\models\swarm\mortarbugprojectile\mortarbugprojectile.mdl Precache(); SetModel( ASW_BOOMER_BLOB_MODEL ); SetMoveType( MOVETYPE_FLYGRAVITY, MOVECOLLIDE_FLY_BOUNCE ); m_flDamage = 80; m_DmgRadius = 165.0f; // NOTE: this gets overriden m_takedamage = DAMAGE_NO; m_iHealth = 1; m_bModelOpening = false; SetSize( -Vector(4,4,4), Vector(4,4,4) ); SetSolid( SOLID_BBOX ); SetGravity( asw_boomer_blob_gravity.GetFloat() ); SetFriction( asw_boomer_blob_friction.GetFloat() ); SetElasticity( asw_vindicator_grenade_elasticity.GetFloat() ); SetCollisionGroup( ASW_COLLISION_GROUP_PASSABLE ); SetTouch( &CASW_Boomer_Blob::Touch ); //CreateEffects(); m_hFirer = NULL; // Tumble in air QAngle vecAngVelocity( random->RandomFloat ( -100, -500 ), 0, 0 ); SetLocalAngularVelocity( vecAngVelocity ); m_fEarliestAOEDetonationTime = GetEarliestAOEDetonationTime(); m_fEarliestTouchDetonationTime = GetEarliestTouchDetonationTime(); m_iClusters = 0; m_bMaster = true; ResetSequence( LookupSequence( "MortarBugProjectile_Closed" ) ); //EmitSound( "ASWGrenade.Alarm" ); SetFuseLength( asw_boomer_blob_fuse.GetFloat() + RandomFloat( -0.25, 0.66f ) ); if ( m_fDetonateTime <= gpGlobals->curtime + asw_boomer_blob_radius_check_interval.GetFloat() ) { SetThink( &CASW_Boomer_Blob::Detonate ); SetNextThink( m_fDetonateTime ); } else { SetThink( &CASW_Boomer_Blob::CheckNearbyTargets ); SetNextThink( gpGlobals->curtime + asw_boomer_blob_radius_check_interval.GetFloat() ); } }
//----------------------------------------------------------------------------- // Purpose: Enable the turret and deploy //----------------------------------------------------------------------------- void CNPC_RocketTurret::Enable( void ) { if ( m_bEnabled ) return; m_bEnabled = true; ResetSequence( LookupSequence("open") ); SetThink( &CNPC_RocketTurret::OpeningThink ); SetNextThink( gpGlobals->curtime + 0.05 ); }
void LCDDisplay::Init() { _expander.Init(); _expander.SetPortBInputPins(0x00); _expander.SetPortAInputPins(BUTTONS); _expander.SetPortAPullUp(BUTTONS); _expander.SetPortAInvert(BUTTONS); ResetSequence(); }
//----------------------------------------------------------------------------- // Purpose: Thin wrapper over CBaseAnimating::SetSequence to do bookkeeping. // Input : sequence - //----------------------------------------------------------------------------- void CBaseObject::SetObjectSequence( int sequence ) { ResetSequence( sequence ); SetCycle( 0 ); #if !defined( CLIENT_DLL ) if ( IsUsingClientSideAnimation() ) { ResetClientsideFrame(); } #endif }
void CASW_Parasite::InfestColonist(CASW_Colonist* pColonist) { if (m_bDefanged || !pColonist) // no infesting if we've been defanged return; if (!IsOnFire()) // don't actually infest if we're on fire, since we'll die very shortly pColonist->BecomeInfested(this); // attach int attachment = pColonist->LookupAttachment( "chest" ); if ( attachment ) { //SetAbsAngles( GetOwnerEntity()->GetAbsAngles() ); SetSolid( SOLID_NONE ); SetMoveType( MOVETYPE_NONE ); QAngle current(0,0,0); Vector diff = pColonist->GetAbsOrigin() - GetAbsOrigin(); float angle = UTIL_VecToYaw(diff); angle -= pColonist->GetAbsAngles()[YAW]; // get the diff between our angle from the marine and the marine's facing; current = GetAbsAngles(); SetParent( pColonist, attachment ); Vector vecPosition; float fRaise = random->RandomFloat(0,20); SetLocalOrigin( Vector( -fRaise * 0.2f, 0, fRaise ) ); SetLocalAngles( QAngle( 0, angle + asw_infest_angle.GetFloat(), 0 ) ); // play our infesting anim if ( asw_parasite_inside.GetBool() ) { SetActivity(ACT_RANGE_ATTACK2); } else { int iInfestAttack = LookupSequence("Infest_attack"); if (GetSequence() != iInfestAttack) { ResetSequence(iInfestAttack); } } // don't do anymore thinking - need to think still to animate? AddFlag( FL_NOTARGET ); SetThink( &CASW_Parasite::InfestThink ); SetTouch( NULL ); m_bInfesting = true; } else { FinishedInfesting(); } }
void CASW_Parasite::UpdateSleepState(bool bInPVS) { if (m_bDoEggIdle) { int iEggIdle = LookupSequence("Egg_Idle"); if (GetSequence() != iEggIdle) { ResetSequence(iEggIdle); } } BaseClass::UpdateSleepState(bInPVS); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void Dota_Resupply::CrateThink( void ) { StudioFrameAdvance(); DispatchAnimEvents( this ); SetNextThink( gpGlobals->curtime + 0.1f ); // Start closing if we're not already if ( GetSequence() != LookupSequence( "Close" ) ) { // Not ready to close? if ( m_flCloseTime <= gpGlobals->curtime ) { //m_hActivator = NULL; ResetSequence( LookupSequence( "Close" ) ); } } else { // See if we're fully closed if ( IsSequenceFinished() ) { // Stop thinking SetThink( NULL ); CPASAttenuationFilter sndFilter( this, "AmmoCrate.Close" ); EmitSound( sndFilter, entindex(), "AmmoCrate.Close" ); // FIXME: We're resetting the sequence here // but setting Think to NULL will cause this to never have // StudioFrameAdvance called. What are the consequences of that? ResetSequence( LookupSequence( "Idle" ) ); SetBodygroup( 1, true ); m_hActivator->SetCanShop( false ); m_hActivator = NULL; } } }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CNewWallHealth::Recharge(void) { EmitSound( "WallHealth.Recharge" ); m_flJuice = m_iJuice = sk_healthcharger.GetInt(); m_nState = 0; ResetSequence( LookupSequence( "idle" ) ); StudioFrameAdvance(); m_iReactivate = 0; SetThink( NULL ); }