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.

91 lines
2.7 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Network data for screen shake and screen fade.
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef SHAKE_H
  8. #define SHAKE_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. //
  13. // Commands for the screen shake effect.
  14. enum ShakeCommand_t
  15. {
  16. SHAKE_START = 0, // Starts the screen shake for all players within the radius.
  17. SHAKE_STOP, // Stops the screen shake for all players within the radius.
  18. SHAKE_AMPLITUDE, // Modifies the amplitude of an active screen shake for all players within the radius.
  19. SHAKE_FREQUENCY, // Modifies the frequency of an active screen shake for all players within the radius.
  20. SHAKE_START_RUMBLEONLY, // Starts a shake effect that only rumbles the controller, no screen effect.
  21. SHAKE_START_NORUMBLE, // Starts a shake that does NOT rumble the controller.
  22. };
  23. // This structure must have a working copy/assignment constructor.
  24. // At the time of this writing, the implicit one works properly.
  25. struct ScreenShake_t
  26. {
  27. ShakeCommand_t command;
  28. float amplitude;
  29. float frequency;
  30. float duration;
  31. Vector direction;
  32. inline ScreenShake_t() : direction(0,0,0) {};
  33. inline ScreenShake_t( ShakeCommand_t _command, float _amplitude, float _frequency,
  34. float _duration, const Vector &_direction );
  35. };
  36. //
  37. // Screen shake message.
  38. //
  39. extern int gmsgShake;
  40. //
  41. // Commands for the screen tilt effect.
  42. //
  43. struct ScreenTilt_t
  44. {
  45. int command;
  46. bool easeInOut;
  47. QAngle angle;
  48. float duration;
  49. float time;
  50. };
  51. // Fade in/out
  52. extern int gmsgFade;
  53. #define FFADE_IN 0x0001 // Just here so we don't pass 0 into the function
  54. #define FFADE_OUT 0x0002 // Fade out (not in)
  55. #define FFADE_MODULATE 0x0004 // Modulate (don't blend)
  56. #define FFADE_STAYOUT 0x0008 // ignores the duration, stays faded out until new ScreenFade message received
  57. #define FFADE_PURGE 0x0010 // Purges all other fades, replacing them with this one
  58. #define SCREENFADE_FRACBITS 9 // which leaves 16-this for the integer part
  59. // This structure is sent over the net to describe a screen fade event
  60. struct ScreenFade_t
  61. {
  62. unsigned short duration; // FIXED 16 bit, with SCREENFADE_FRACBITS fractional, seconds duration
  63. unsigned short holdTime; // FIXED 16 bit, with SCREENFADE_FRACBITS fractional, seconds duration until reset (fade & hold)
  64. short fadeFlags; // flags
  65. byte r, g, b, a; // fade to color ( max alpha )
  66. };
  67. // inline funcs:
  68. inline ScreenShake_t::ScreenShake_t( ShakeCommand_t _command, float _amplitude, float _frequency,
  69. float _duration, const Vector &_direction ) :
  70. command(_command), amplitude(_amplitude), frequency(_frequency),
  71. duration(_duration), direction(_direction)
  72. {}
  73. #endif // SHAKE_H