surfaceeffects.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. /*
  2. ** Command & Conquer Renegade(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /***********************************************************************************************
  19. *** Confidential - Westwood Studios ***
  20. ***********************************************************************************************
  21. * *
  22. * Project Name : Commando *
  23. * *
  24. * $Archive:: /Commando/Code/Combat/surfaceeffects.h $*
  25. * *
  26. * $Author:: Byon_g $*
  27. * *
  28. * $Modtime:: 11/12/01 11:15a $*
  29. * *
  30. * $Revision:: 29 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #if defined(_MSC_VER)
  36. #pragma once
  37. #endif
  38. #ifndef SURFACEEFFECTS_H
  39. #define SURFACEEFFECTS_H
  40. #ifndef ALWAYS_H
  41. #include "always.h"
  42. #endif
  43. class Matrix3D;
  44. class PhysClass;
  45. class PhysicalGameObj;
  46. class PersistantSurfaceSoundClass;
  47. class PersistantSurfaceEmitterClass;
  48. class PhysicalGameObj;
  49. /*
  50. **
  51. */
  52. class SurfaceEffectsManager {
  53. public:
  54. /*
  55. **
  56. */
  57. typedef enum {
  58. MODE_OFF = 0,
  59. MODE_NO_EMITTERS,
  60. MODE_FULL
  61. } MODE;
  62. static void Init( void );
  63. static void Shutdown( void );
  64. static void Enable_Effects( bool enable ) { Mode = MODE_FULL; }
  65. static bool Are_Effects_Enabled( void ) { return (Mode != MODE_OFF); }
  66. static void Set_Mode( MODE mode ) { Mode = mode; }
  67. static MODE Get_Mode( void ) { return Mode; }
  68. /*
  69. **
  70. */
  71. enum { // ONLY ADD TO THE END.....
  72. HITTER_TYPE_NONE, // used to shut off persistant effects
  73. HITTER_TYPE_GENERIC_OBJECT, // generic dynamic object
  74. HITTER_TYPE_FOOTSTEP_RUN,
  75. HITTER_TYPE_FOOTSTEP_WALK,
  76. HITTER_TYPE_FOOTSTEP_CROUCHED,
  77. HITTER_TYPE_FOOTSTEP_JUMP,
  78. HITTER_TYPE_FOOTSTEP_LAND,
  79. HITTER_TYPE_BULLET,
  80. HITTER_TYPE_BULLET_FIRE,
  81. HITTER_TYPE_BULLET_GRENADE,
  82. HITTER_TYPE_BULLET_CHEM,
  83. HITTER_TYPE_BULLET_ELECTRIC,
  84. HITTER_TYPE_BULLET_LASER,
  85. HITTER_TYPE_BULLET_SQUISH,
  86. HITTER_TYPE_BULLET_TIB_SPRAY,
  87. HITTER_TYPE_BULLET_TIB_BULLET,
  88. HITTER_TYPE_BULLET_SHOTGUN,
  89. HITTER_TYPE_BULLET_SILENCED,
  90. HITTER_TYPE_BULLET_SNIPER,
  91. HITTER_TYPE_BULLET_WATER,
  92. HITTER_TYPE_EJECT_CASING, // casings ejected from weapons (all are assumed to make the same sounds)
  93. HITTER_TYPE_SHELL_SHOTGUN,
  94. HITTER_TYPE_TIRE_ROLLING, // wheels on humvees, etc...
  95. HITTER_TYPE_TIRE_SLIDING,
  96. HITTER_TYPE_TRACK_ROLLING, // tank tracks...
  97. HITTER_TYPE_TRACK_SLIDING,
  98. HITTER_TYPE_FOOTSTEP_LADDER,
  99. // Note: If you change this enum, update the names in surfaceeffect.cpp
  100. NUM_HITTER_TYPES,
  101. };
  102. static int Num_Hitter_Types( void ) { return NUM_HITTER_TYPES; }
  103. static const char * Hitter_Type_Name( int hitter );
  104. // The transform for Apply_Effect is in camera convention, +Z is the normal of the surface
  105. static void Apply_Effect( int surface_type,
  106. int hitter_type,
  107. const Matrix3D & tm,
  108. PhysClass * hit_obj = NULL,
  109. PhysicalGameObj * creator = NULL,
  110. bool allow_decals = true,
  111. bool allow_emitters = true);
  112. // Persist Effects
  113. static PersistantSurfaceSoundClass * Create_Persistant_Sound( void );
  114. static void Destroy_Persistant_Sound( PersistantSurfaceSoundClass * effect );
  115. static void Update_Persistant_Sound( PersistantSurfaceSoundClass * effect,
  116. int surface_type, int hitter_type, const Matrix3D & tm );
  117. static PersistantSurfaceEmitterClass * Create_Persistant_Emitter( void );
  118. static void Destroy_Persistant_Emitter( PersistantSurfaceEmitterClass * effect );
  119. static void Update_Persistant_Emitter( PersistantSurfaceEmitterClass * effect,
  120. int surface_type, int hitter_type, const Matrix3D & tm );
  121. static void Apply_Damage( int surface_type, PhysicalGameObj * obj );
  122. static bool Does_Surface_Stop_Bullets( int surface_type );
  123. static void Toggle_Debug( void );
  124. static bool Is_Surface_Permeable( int surface );
  125. /*
  126. ** OverrideSurfaceType:
  127. ** If you set an "override surface type" then *all* surfaces will be
  128. ** treated as if they are that type.
  129. */
  130. static void Set_Override_Surface_Type(int type);
  131. static int Get_Override_Surface_Type(void) { return OverrideSurfaceType; }
  132. private:
  133. static MODE Mode; // Do we need to save this???
  134. static int OverrideSurfaceType;
  135. };
  136. #endif // SURFACEEFFECTS_H