console.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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/Commando/console.h $*
  25. * *
  26. * $Author:: Jani_p $*
  27. * *
  28. * $Modtime:: 7/25/01 2:12p $*
  29. * *
  30. * $Revision:: 12 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #ifndef CONSOLE_H
  36. #define CONSOLE_H
  37. #ifndef ALWAYS_H
  38. #include "always.h"
  39. #endif
  40. #ifndef GAMEMODE_H
  41. #include "gamemode.h"
  42. #endif
  43. #ifndef BITTYPE_H
  44. #include "bittype.h"
  45. #endif
  46. class WWProfileIterator;
  47. #define Get_Console() ConsoleGameModeClass::Get_Instance()
  48. /*
  49. ** Game (Sub) Mode to display console & fps
  50. */
  51. class ConsoleGameModeClass : public GameModeClass {
  52. public:
  53. virtual const char *Name() { return "Console"; } // the name of this mode
  54. virtual void Init(); // called when the mode is activated
  55. virtual void Shutdown(); // called when the mode is deactivated
  56. virtual void Think(); // called each time through the main loop
  57. virtual void Render() {} // called each time through the main loop
  58. void Parse_Input( char * string );
  59. //void Toggle_FPS( void ) { FPSActive = !FPSActive; }
  60. bool Is_FPS_Active( void ) { return FPSActive; }
  61. void Set_FPS_Active( bool onoff ) { FPSActive = onoff; }
  62. void Toggle_Player_Position( void ) { ShowPlayerPosition = !ShowPlayerPosition; }
  63. void Set_Player_Position( Vector3 & pos, float facing ) { PlayerPosition = pos; PlayerFacing = facing; }
  64. void Profile_Command( const char * command );
  65. static ConsoleGameModeClass * Get_Instance() { return Instance; }
  66. static void Load_Registry_Keys(void);
  67. static void Save_Registry_Keys(void);
  68. private:
  69. void Clear_Suggestion(void);
  70. void Accept_Suggestion(char * cmd);
  71. void Update_Suggestion(char * cmd,bool go_to_next);
  72. enum {
  73. MAX_INPUT_LINE_LENGTH = 100,
  74. MAX_DRAWER_CHARS = 4000,
  75. };
  76. char InputLine[MAX_INPUT_LINE_LENGTH];
  77. char HelpLine[MAX_INPUT_LINE_LENGTH];
  78. char Suggestion[MAX_INPUT_LINE_LENGTH];
  79. bool InputActive;
  80. bool FPSActive;
  81. int FPSFrames;
  82. float FPSTime;
  83. float FPSLastTime;
  84. float FPS;
  85. bool ShowPlayerPosition;
  86. Vector3 PlayerPosition;
  87. float PlayerFacing;
  88. // Profile Display
  89. WWProfileIterator * ProfileIterator;
  90. void Update_Profile( void );
  91. void Begin_Profile_Log( void );
  92. void End_Profile_Log( void );
  93. void Process_Profile_Log( void );
  94. void Update_Memory_Log( void );
  95. bool PerformanceSamplingActive;
  96. DWORD ConsoleInputType;
  97. int PromptLength;
  98. static const float LeftMargin;
  99. static ConsoleGameModeClass * Instance;
  100. };
  101. #endif