ConsoleMode.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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/ConsoleMode.h $*
  25. * *
  26. * $Author:: Steve_t $*
  27. * *
  28. * $Modtime:: 8/14/02 12:00p $*
  29. * *
  30. * $Revision:: 10 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #include <win.h>
  36. class WideStringClass;
  37. class StringClass;
  38. class Vector3;
  39. /*
  40. ** This is a console interface for the game so you can do stuff even if you can't display the main game window.
  41. **
  42. **
  43. */
  44. class ConsoleModeClass
  45. {
  46. public:
  47. /*
  48. ** Constructor, destructor.
  49. */
  50. ConsoleModeClass(void);
  51. ~ConsoleModeClass(void);
  52. /*
  53. ** Init.
  54. */
  55. void Init(void);
  56. void Set_Title(char *name, char *settings);
  57. /*
  58. ** Input processing.
  59. */
  60. void Think();
  61. void Wait_For_Keypress(void);
  62. /*
  63. ** Console output.
  64. */
  65. void Print(char const * string, ...);
  66. void Print_Maybe(char const * string, ...);
  67. static void Static_Print_Maybe(char const * string, ...);
  68. Add_Message(WideStringClass *formatted_text, Vector3 *text_color, bool forced = false);
  69. /*
  70. ** Profiling support.
  71. */
  72. void Update_Profile(StringClass profile_string);
  73. void Set_Profile_Mode(bool set) {ProfileMode = set; LastProfileCRC = 0; LastProfilePrint = 0;}
  74. void Handle_Profile_Key(int key);
  75. /*
  76. ** Master/Slave console window settings/support.
  77. */
  78. void Set_Exclusive(bool set) {IsExclusive = set;}
  79. bool Is_Exclusive(void) {return(IsExclusive);}
  80. HWND Get_Slave_Window_By_Title(char *name, char *settings);
  81. StringClass Compose_Window_Title(char *name, char *settings, bool slave);
  82. void cprintf(char const * string, ...);
  83. /*
  84. ** File logging.
  85. */
  86. void Log_To_Disk(const char *string);
  87. const char *Get_Log_File_Name(void);
  88. private:
  89. /*
  90. ** Private functions.
  91. */
  92. void Apply_Attributes(void);
  93. /*
  94. ** Input and output handles.
  95. */
  96. HANDLE ConsoleInputHandle;
  97. HANDLE ConsoleOutputHandle;
  98. /*
  99. ** Window handle.
  100. */
  101. HWND ConsoleWindow;
  102. /*
  103. ** Input parsing variables.
  104. */
  105. unsigned long LastKeypressTime;
  106. int Pos;
  107. /*
  108. ** Console title bar contents.
  109. */
  110. char Title[256];
  111. /*
  112. ** Is console mode the only mode?
  113. */
  114. bool IsExclusive;
  115. /*
  116. ** Is the console in profile mode?
  117. */
  118. bool ProfileMode;
  119. /*
  120. ** Last profile text CRC.
  121. */
  122. unsigned long LastProfileCRC;
  123. /*
  124. ** Last time we printed the profile.
  125. */
  126. unsigned long LastProfilePrint;
  127. };
  128. /*
  129. ** Single instance of console.
  130. */
  131. extern ConsoleModeClass ConsoleBox;