cheatmgr.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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. *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
  20. ***********************************************************************************************
  21. * *
  22. * Project Name : combat *
  23. * *
  24. * $Archive:: /Commando/Code/Combat/cheatmgr.h $*
  25. * *
  26. * Author:: Patrick Smith *
  27. * *
  28. * $Modtime:: 12/06/01 11:35a $*
  29. * *
  30. * $Revision:: 5 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #if defined(_MSC_VER)
  36. #pragma once
  37. #endif
  38. #ifndef __CHEATMGR_H
  39. #define __CHEATMGR_H
  40. #include "gametype.h"
  41. //////////////////////////////////////////////////////////////////////
  42. //
  43. // CheatMgrClass
  44. //
  45. //////////////////////////////////////////////////////////////////////
  46. class CheatMgrClass
  47. {
  48. public:
  49. ///////////////////////////////////////////////////////////////////
  50. // Public flags
  51. ///////////////////////////////////////////////////////////////////
  52. enum
  53. {
  54. CHEAT_INVULNERABILITY = 1,
  55. CHEAT_INFINITE_AMMO = 2,
  56. CHEAT_ALL_WEAPONS = 4,
  57. ALL_CHEATS = 0x07,
  58. };
  59. ///////////////////////////////////////////////////////////////////
  60. // Public constructors/destructors
  61. ///////////////////////////////////////////////////////////////////
  62. CheatMgrClass (void);
  63. virtual ~CheatMgrClass (void);
  64. ///////////////////////////////////////////////////////////////////
  65. // Public methods
  66. ///////////////////////////////////////////////////////////////////
  67. //
  68. // Singleton access
  69. //
  70. static CheatMgrClass * Get_Instance (void) { return _TheInstance; }
  71. //
  72. // Cheat control
  73. //
  74. virtual void Enable_Cheat (int cheat, bool onoff) { if (onoff) Flags |= cheat; else Flags &= (~cheat); HistoryFlags |= Flags; }
  75. virtual bool Is_Cheat_Enabled (int /*cheat*/) const { return false; }
  76. virtual bool Is_Cheat_Set (int /*cheat*/) const { return false; }
  77. virtual bool Was_Cheat_Used (int /*cheat*/) const { return false; }
  78. virtual void Update_History (void) { HistoryFlags |= Flags; }
  79. virtual void Reset_History (void) { HistoryFlags = Flags; }
  80. virtual int Get_History (void) const { return HistoryFlags; }
  81. virtual void Set_History (int flags) { HistoryFlags = flags; }
  82. //
  83. // Notifications
  84. //
  85. virtual void Apply_Cheats (void) {}
  86. protected:
  87. ///////////////////////////////////////////////////////////////////
  88. // Protected methods
  89. ///////////////////////////////////////////////////////////////////
  90. ///////////////////////////////////////////////////////////////////
  91. // Protected member data
  92. ///////////////////////////////////////////////////////////////////
  93. int Flags;
  94. int HistoryFlags;
  95. //
  96. // Static member data
  97. //
  98. static CheatMgrClass *_TheInstance;
  99. };
  100. #endif //__CHEATMGR_H