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.

46 lines
1.2 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef C_TE_EFFECT_DISPATCH_H
  8. #define C_TE_EFFECT_DISPATCH_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "effect_dispatch_data.h"
  13. typedef void (*ClientEffectCallback)( const CEffectData &data );
  14. class CClientEffectRegistration
  15. {
  16. public:
  17. CClientEffectRegistration( const char *pEffectName, ClientEffectCallback fn );
  18. public:
  19. const char *m_pEffectName;
  20. ClientEffectCallback m_pFunction;
  21. CClientEffectRegistration *m_pNext;
  22. static CClientEffectRegistration *s_pHead;
  23. };
  24. //
  25. // Use this macro to register a client effect callback.
  26. // If you do DECLARE_CLIENT_EFFECT( "MyEffectName", MyCallback ), then MyCallback will be
  27. // called when the server does DispatchEffect( "MyEffect", data )
  28. //
  29. #define DECLARE_CLIENT_EFFECT( effectName, callbackFunction ) \
  30. static CClientEffectRegistration ClientEffectReg_##callbackFunction( effectName, callbackFunction );
  31. void DispatchEffectToCallback( const char *pEffectName, const CEffectData &m_EffectData );
  32. void DispatchEffect( const char *pName, const CEffectData &data );
  33. #endif // C_TE_EFFECT_DISPATCH_H