Team Fortress 2 Source Code as on 22/4/2020
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.

102 lines
3.1 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef FUNC_BREAKABLESURF_H
  8. #define FUNC_BREAKABLESURF_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #define MAX_NUM_PANELS 16 //Must match client
  13. #include "func_break.h"
  14. //#############################################################################
  15. // > CWindowPane
  16. //
  17. // A piece that falls out of the window
  18. //#############################################################################
  19. class CWindowPane : public CBaseAnimating
  20. {
  21. public:
  22. DECLARE_CLASS( CWindowPane, CBaseAnimating );
  23. static CWindowPane* CreateWindowPane( const Vector &vecOrigin, const QAngle &vecAngles );
  24. void Spawn( void );
  25. void Precache( void );
  26. void PaneTouch( CBaseEntity *pOther );
  27. void Die( void );
  28. DECLARE_DATADESC();
  29. };
  30. //#############################################################################
  31. // > CBreakableSurface
  32. //
  33. // A breakable surface
  34. //#############################################################################
  35. class CBreakableSurface : public CBreakable
  36. {
  37. DECLARE_CLASS( CBreakableSurface, CBreakable );
  38. DECLARE_DATADESC();
  39. DECLARE_SERVERCLASS();
  40. public:
  41. CNetworkVar( int, m_nNumWide );
  42. CNetworkVar( int, m_nNumHigh );
  43. CNetworkVar( float, m_flPanelWidth );
  44. CNetworkVar( float, m_flPanelHeight );
  45. CNetworkVector( m_vNormal );
  46. CNetworkVector( m_vCorner );
  47. CNetworkVar( bool, m_bIsBroken );
  48. CNetworkVar( ShatterSurface_t, m_nSurfaceType );
  49. int m_nNumBrokenPanes;
  50. float m_flSupport[MAX_NUM_PANELS][MAX_NUM_PANELS]; //UNDONE: allocate dynamically?
  51. int m_nFragility;
  52. Vector m_vLLVertex;
  53. Vector m_vULVertex;
  54. Vector m_vLRVertex;
  55. Vector m_vURVertex;
  56. int m_nQuadError;
  57. void SurfaceTouch( CBaseEntity *pOther );
  58. void PanePos(const Vector &vPos, float *flWidth, float *flHeight);
  59. bool IsBroken(int nWidth, int nHeight);
  60. void SetSupport(int w, int h, float support);
  61. float GetSupport(int nWidth, int nHeight);
  62. float RecalcSupport(int nWidth, int nHeight);
  63. void BreakPane(int nWidth, int nHeight);
  64. void DropPane(int nWidth, int nHeight);
  65. bool ShatterPane(int nWidth, int nHeight, const Vector &force, const Vector &vForcePos);
  66. void BreakAllPanes(void);
  67. void CreateShards(const Vector &vBreakPos, const QAngle &vAngles,
  68. const Vector &vForce, const Vector &vForcePos,
  69. float flWidth, float flHeight,
  70. int nShardSize);
  71. void Spawn(void);
  72. void Precache(void);
  73. void Die( CBaseEntity *pBreaker, const Vector &vAttackDir );
  74. void BreakThink(void);
  75. void Event_Killed( CBaseEntity *pInflictor, CBaseEntity *pAttacker, float flDamage, int bitsDamageType );
  76. void TraceAttack( const CTakeDamageInfo &info, const Vector &vecDir, trace_t *ptr, CDmgAccumulator *pAccumulator );
  77. int OnTakeDamage( const CTakeDamageInfo &info );
  78. void InputShatter( inputdata_t &inputdata );
  79. void VPhysicsCollision( int index, gamevcollisionevent_t *pEvent );
  80. private:
  81. // One bit per pane
  82. CNetworkArray( bool, m_RawPanelBitVec, MAX_NUM_PANELS * MAX_NUM_PANELS );
  83. };
  84. #endif // FUNC_BREAKABLESURF_H