void CSDKPlayer::CheckGesture() { if (m_Shared.GetAction() != PLAYERANIMEVENT_NONE || m_Shared.GetGesture() != PLAYERANIMEVENT_NONE) return; if (m_nButtons & IN_GESTURE) { if (m_nButtons & IN_ATTACK) { DoAnimationEvent(PLAYERANIMEVENT_GESTURE_POINT); } else if (m_nButtons & IN_ATTACK2) { DoAnimationEvent(PLAYERANIMEVENT_GESTURE_WAVE); } } }
//----------------------------------------------------------------------------- // Purpose: Sets HL2 specific defaults. //----------------------------------------------------------------------------- void CHL2MP_Player::Spawn(void) { #ifdef GE_DLL m_bSpawnInterpCounter = !m_bSpawnInterpCounter; BaseClass::Spawn(); #else m_flNextModelChangeTime = 0.0f; m_flNextTeamChangeTime = 0.0f; PickDefaultSpawnTeam(); BaseClass::Spawn(); if ( !IsObserver() ) { pl.deadflag = false; RemoveSolidFlags( FSOLID_NOT_SOLID ); RemoveEffects( EF_NODRAW ); GiveDefaultItems(); } RemoveEffects( EF_NOINTERP ); 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_bSpawnInterpCounter = !m_bSpawnInterpCounter; m_Local.m_bDucked = false; SetPlayerUnderwater(false); m_bReady = false; #endif //Tony; do the spawn animevent DoAnimationEvent( PLAYERANIMEVENT_SPAWN ); SetContextThink( &CHL2MP_Player::HL2MPPushawayThink, gpGlobals->curtime + PUSHAWAY_THINK_INTERVAL, HL2MP_PUSHAWAY_THINK_CONTEXT ); }
void CCSPlayerAnimState::ComputeFireSequence( CStudioHdr *pStudioHdr ) { VPROF( "CCSPlayerAnimState::ComputeFireSequence" ); if ( m_delayedFire != PLAYERANIMEVENT_COUNT ) { DoAnimationEvent( m_delayedFire, 0 ); m_delayedFire = PLAYERANIMEVENT_COUNT; } UpdateLayerSequenceGeneric( pStudioHdr, FIRESEQUENCE_LAYER, m_bFiring, m_flFireCycle, m_iFireSequence, false ); }
//----------------------------------------------------------------------------- // Purpose: Sets HL2 specific defaults. //----------------------------------------------------------------------------- void CHL2MP_Player::Spawn(void) { m_flNextModelChangeTime = 0.0f; m_flNextTeamChangeTime = 0.0f; PickDefaultSpawnTeam(); BaseClass::Spawn(); pl.deadflag = false; m_lifeState = LIFE_ALIVE; RemoveSolidFlags( FSOLID_NOT_SOLID ); RemoveEffects( EF_NODRAW ); //BP On donne par défaut les armes correspondantes au mode de jeu //GiveDefaultItems(); GiveAllItems(); RemoveEffects( EF_NOINTERP ); 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_bSpawnInterpCounter = !m_bSpawnInterpCounter; m_Local.m_bDucked = false; SetPlayerUnderwater(false); m_bReady = false; m_hKiller.Set(NULL); //Tony; do the spawn animevent DoAnimationEvent( PLAYERANIMEVENT_SPAWN ); SetContextThink( &CHL2MP_Player::HL2MPPushawayThink, gpGlobals->curtime + PUSHAWAY_THINK_INTERVAL, HL2MP_PUSHAWAY_THINK_CONTEXT ); if ( GetTeamNumber() != TEAM_SPECTATOR ) StopObserverMode(); }
//----------------------------------------------------------------------------- // 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 ); }
void CHL1MP_Player::Event_Killed( const CTakeDamageInfo &info ) { DoAnimationEvent( PLAYERANIMEVENT_DIE ); // SetNumAnimOverlays( 0 ); // 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(); DetonateSatchelCharges(); BaseClass::Event_Killed( info ); m_lifeState = LIFE_DEAD; RemoveEffects( EF_NODRAW ); // still draw player body }
//========================================================= //========================================================= void CAP_PlayerInfected::PostThink() { BaseClass::PostThink(); // Mientras estemos vivos if ( IsAlive() ) { // Estamos atacando // TODO: Creo que esto no es lo mejor if ( IsButtonPressed(IN_ATTACK) && gpGlobals->curtime >= m_iNextAttack ) { DoAnimationEvent( PLAYERANIMEVENT_ATTACK_PRIMARY ); m_iNextAttack = ATTACK_INTERVAL; } // ¡No sabemos nadar! // TODO: Animación de "ahogo" if ( GetWaterLevel() >= WL_Waist ) { SetBloodColor( DONT_BLEED ); TakeDamage( CTakeDamageInfo(this, this, GetMaxHealth(), DMG_GENERIC) ); } } }
void CFadeButtonUI::DoEvent(TEventUI& event) { CButtonUI::DoEvent( event ); DoAnimationEvent(event); }
void CHL1MP_Player::SetAnimation( PLAYER_ANIM playerAnim ) { // BaseClass::SetAnimation( playerAnim ); if ( playerAnim == PLAYER_ATTACK1 ) { DoAnimationEvent( PLAYERANIMEVENT_FIRE_GUN ); } int animDesired; char szAnim[64]; float speed; speed = GetAbsVelocity().Length2D(); if (GetFlags() & (FL_FROZEN|FL_ATCONTROLS)) { speed = 0; playerAnim = PLAYER_IDLE; } if ( playerAnim == PLAYER_ATTACK1 ) { if ( speed > 0 ) { playerAnim = PLAYER_WALK; } else { playerAnim = PLAYER_IDLE; } } Activity idealActivity = ACT_WALK;// TEMP!!!!! // This could stand to be redone. Why is playerAnim abstracted from activity? (sjb) if (playerAnim == PLAYER_JUMP) { idealActivity = ACT_HOP; } else if (playerAnim == PLAYER_SUPERJUMP) { idealActivity = ACT_LEAP; } else if (playerAnim == PLAYER_DIE) { if ( m_lifeState == LIFE_ALIVE ) { idealActivity = ACT_DIERAGDOLL; } } else if (playerAnim == PLAYER_ATTACK1) { if ( GetActivity() == ACT_HOVER || GetActivity() == ACT_SWIM || GetActivity() == ACT_HOP || GetActivity() == ACT_LEAP || GetActivity() == ACT_DIESIMPLE ) { idealActivity = GetActivity(); } else { idealActivity = ACT_RANGE_ATTACK1; } } else if (playerAnim == PLAYER_IDLE || playerAnim == PLAYER_WALK) { if ( !( GetFlags() & FL_ONGROUND ) && (GetActivity() == ACT_HOP || GetActivity() == ACT_LEAP) ) // Still jumping { idealActivity = GetActivity(); } else if ( GetWaterLevel() > 1 ) { if ( speed == 0 ) idealActivity = ACT_HOVER; else idealActivity = ACT_SWIM; } else if ( speed > 0 ) { idealActivity = ACT_WALK; } else { idealActivity = ACT_IDLE; } } if (idealActivity == ACT_RANGE_ATTACK1) { if ( GetFlags() & FL_DUCKING ) // crouching { Q_strncpy( szAnim, "crouch_shoot_" ,sizeof(szAnim)); } else { Q_strncpy( szAnim, "ref_shoot_" ,sizeof(szAnim)); } Q_strncat( szAnim, m_szAnimExtension ,sizeof(szAnim), COPY_ALL_CHARACTERS ); animDesired = LookupSequence( szAnim ); if (animDesired == -1) animDesired = 0; if ( GetSequence() != animDesired || !SequenceLoops() ) { SetCycle( 0 ); } // Tracker 24588: In single player when firing own weapon this causes eye and punchangle to jitter //if (!SequenceLoops()) //{ // AddEffects( EF_NOINTERP ); //} SetActivity( idealActivity ); ResetSequence( animDesired ); } else if (idealActivity == ACT_IDLE) { if ( GetFlags() & FL_DUCKING ) { animDesired = LookupSequence( "crouch_idle" ); } else { animDesired = LookupSequence( "look_idle" ); } if (animDesired == -1) animDesired = 0; SetActivity( ACT_IDLE ); } else if ( idealActivity == ACT_WALK ) { if ( GetFlags() & FL_DUCKING ) { animDesired = SelectWeightedSequence( ACT_CROUCH ); SetActivity( ACT_CROUCH ); } else { animDesired = SelectWeightedSequence( ACT_RUN ); SetActivity( ACT_RUN ); } } else { if ( GetActivity() == idealActivity) return; SetActivity( idealActivity ); animDesired = SelectWeightedSequence( GetActivity() ); // Already using the desired animation? if (GetSequence() == animDesired) return; m_iRealSequence = animDesired; ResetSequence( animDesired ); SetCycle( 0 ); return; } // Already using the desired animation? if (GetSequence() == animDesired) return; m_iRealSequence = animDesired; //Msg( "Set animation to %d\n", animDesired ); // Reset to first frame of desired animation ResetSequence( animDesired ); SetCycle( 0 ); }