Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

126 lines
3.7 KiB

  1. //========= Copyright � 1996-2012, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Client side interactive, shootable chicken
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #include "cbase.h"
  8. #include "c_chicken.h"
  9. #include "c_breakableprop.h"
  10. #include "c_cs_player.h"
  11. // NOTE: This has to be the last file included!
  12. #include "tier0/memdbgon.h"
  13. #undef CChicken
  14. IMPLEMENT_CLIENTCLASS_DT( C_CChicken, DT_CChicken, CChicken )
  15. RecvPropInt( RECVINFO( m_jumpedThisFrame ), 0, C_CChicken::RecvProxy_Jumped ),
  16. RecvPropEHandle( RECVINFO( m_leader ) ),
  17. END_RECV_TABLE()
  18. //-----------------------------------------------------------------------------------------------
  19. C_CChicken::C_CChicken()
  20. {
  21. }
  22. //-----------------------------------------------------------------------------------------------
  23. C_CChicken::~C_CChicken()
  24. {
  25. SetClientSideHolidayHatAddon( false );
  26. }
  27. //-----------------------------------------------------------------------------------------------
  28. void C_CChicken::Spawn( void )
  29. {
  30. BaseClass::Spawn();
  31. SetClientSideHolidayHatAddon( false );
  32. SetNextClientThink( CLIENT_THINK_ALWAYS );
  33. }
  34. //-----------------------------------------------------------------------------
  35. //-----------------------------------------------------------------------------
  36. void C_CChicken::RecvProxy_Jumped( const CRecvProxyData *pData, void *pStruct, void *pOut )
  37. {
  38. // C_CHostage *pHostage = ( C_CHostage * ) pStruct;
  39. //
  40. // bool jumped = pData->m_Value.m_Int != 0;
  41. //
  42. // if ( jumped )
  43. // {
  44. // // hostage jumped
  45. // pHostage->m_PlayerAnimState->DoAnimationEvent( PLAYERANIMEVENT_JUMP );
  46. // pHostage->SetNextClientThink( gpGlobals->curtime );
  47. // }
  48. //
  49. // pHostage->m_jumpedThisFrame = jumped;
  50. }
  51. //-----------------------------------------------------------------------------------------------
  52. void C_CChicken::ClientThink()
  53. {
  54. BaseClass::ClientThink();
  55. Activity currentActivity = GetSequenceActivity( GetSequence() );
  56. if ( m_lastActivity != currentActivity )
  57. {
  58. if ( currentActivity == ACT_CLIMB_UP )
  59. SetCycle( 0 );
  60. m_lastActivity = currentActivity;
  61. }
  62. bool bEnableHolidayHat = false;
  63. #if CSGO_CLIENT_CHICKEN_ANTLERS_IN_FREEZE_CAM
  64. //
  65. // This code was enabling chicken antlers in freezecam
  66. //
  67. // Client-side only addons are required for the duration of the freeze shot
  68. {
  69. static ConVarRef ref_cl_disablefreezecam( "cl_disablefreezecam" );
  70. static ConVarRef ref_sv_disablefreezecam( "sv_disablefreezecam" );
  71. extern bool IsTakingAFreezecamScreenshot( void );
  72. if ( IsTakingAFreezecamScreenshot() && !ref_cl_disablefreezecam.GetBool() && !ref_sv_disablefreezecam.GetBool() )
  73. {
  74. C_CSPlayer *pLocalPlayer = C_CSPlayer::GetLocalCSPlayer();
  75. if ( pLocalPlayer && pLocalPlayer->GetObserverTarget() && ( pLocalPlayer->GetObserverTarget() != pLocalPlayer ) )
  76. {
  77. bEnableHolidayHat = true;
  78. }
  79. }
  80. }
  81. #endif
  82. SetClientSideHolidayHatAddon( bEnableHolidayHat );
  83. }
  84. //-----------------------------------------------------------------------------
  85. void C_CChicken::SetClientSideHolidayHatAddon( bool bEnable )
  86. {
  87. /*
  88. if ( bEnable && !m_hHolidayHatAddon.Get() )
  89. {
  90. // Create the hat
  91. C_BreakableProp *pEnt = new C_BreakableProp;
  92. pEnt->InitializeAsClientEntity( "models/antlers/antlers.mdl", false );
  93. pEnt->FollowEntity( this );
  94. pEnt->SetLocalOrigin( Vector( 0, 0, 0 ) );
  95. pEnt->SetLocalAngles( QAngle( 0, 0, 0 ) );
  96. pEnt->SetUseParentLightingOrigin( true );// This will make it so the weapons get lit with the same ambient cube that the player gets lit with.
  97. m_hHolidayHatAddon.Set( pEnt );
  98. }
  99. if ( !bEnable && m_hHolidayHatAddon.Get() )
  100. {
  101. // Remove the hat
  102. m_hHolidayHatAddon->Release();
  103. m_hHolidayHatAddon.Term();
  104. }
  105. */
  106. }