WM.CPP 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. /*
  2. ** Command & Conquer Red Alert(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 : VQAVIEW *
  23. * *
  24. * File Name : WM.CPP *
  25. * *
  26. * Programmer : Mike Grayford *
  27. * *
  28. * Start Date : November 20, 1995 *
  29. * *
  30. * Last Update : Nov 20, 1995 [MG] *
  31. * *
  32. *-------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. //==========================================================================
  36. // INCLUDES
  37. //==========================================================================
  38. #include <windows.h>
  39. #include <westwood.h>
  40. #include <wm.h>
  41. #include <gbuffer.h>
  42. #include <main.h>
  43. #include <mainwind.h>
  44. #include <menus.rh>
  45. #include <movies.h>
  46. #include <vq.h>
  47. //==========================================================================
  48. // PUBLIC FUNCTIONS
  49. //==========================================================================
  50. void Menu_Exit_Game( void );
  51. /***************************************************************************
  52. * WM_COMMAND_FUNC -- Handles all main window commands *
  53. * *
  54. * INPUT: standard windows dialog command parameters *
  55. * *
  56. * OUTPUT: IDOK or IDCANCEL *
  57. * *
  58. * WARNINGS: none *
  59. * *
  60. * HISTORY: *
  61. * 11/20/95 MG : Created *
  62. *=========================================================================*/
  63. long WM_Command_Func(
  64. WindowHandle window_handle,
  65. unsigned int message,
  66. WPARAM w_param,
  67. LPARAM l_param )
  68. {
  69. switch( w_param ) {
  70. case MENU_EXIT:
  71. Menu_Exit_Game();
  72. break;
  73. case MENU_OPEN:
  74. Choose_Movie( Main_Window.Get_Window_Handle() );
  75. break;
  76. case MENU_SET_MOVIE_FRAME_RATE:
  77. Set_Movie_Frame_Rate();
  78. break;
  79. default:
  80. break;
  81. }
  82. return( 0 );
  83. }
  84. /***************************************************************************
  85. * WM_SYS_COMMAND_FUNC -- Handles all system menu commands *
  86. * *
  87. * INPUT: standard windows dialog command parameters *
  88. * *
  89. * OUTPUT: IDOK or IDCANCEL *
  90. * *
  91. * WARNINGS: none *
  92. * *
  93. * HISTORY: see PVCS log *
  94. *=========================================================================*/
  95. #pragma argsused
  96. long WM_Sys_Command_Func(
  97. WindowHandle window_handle,
  98. unsigned int message,
  99. WPARAM w_param,
  100. LPARAM l_param )
  101. {
  102. switch( w_param & 0xfff0 ) {
  103. case SC_CLOSE:
  104. break;
  105. case SC_MINIMIZE:
  106. break;
  107. case SC_MAXIMIZE:
  108. case SC_RESTORE:
  109. break;
  110. case SC_KEYMENU:
  111. case SC_MOUSEMENU:
  112. break;
  113. default:
  114. break;
  115. }
  116. return( DefWindowProc( window_handle, message, w_param, l_param ) );
  117. }
  118. /***************************************************************************
  119. * WM_PAINT_FUNC -- Code that is executed when WM_PAINT is sent *
  120. * *
  121. * INPUT: standard windows dialog command parameter passing *
  122. * *
  123. * OUTPUT: unused *
  124. * *
  125. * WARNINGS: none *
  126. * *
  127. * HISTORY: see PVCS log *
  128. *=========================================================================*/
  129. #pragma argsused
  130. long WM_Paint_Func(
  131. WindowHandle window_handle,
  132. unsigned int message,
  133. unsigned int w_param,
  134. long l_param )
  135. {
  136. return( 0 );
  137. }
  138. /***************************************************************************
  139. * WM_DESTROY_FUNC -- Handles when a WM_DESTROY hits the main window *
  140. * *
  141. * INPUT: standard windows dialog command parameters *
  142. * *
  143. * OUTPUT: unused *
  144. * *
  145. * WARNINGS: none *
  146. * *
  147. * HISTORY: see PVCS log *
  148. *=========================================================================*/
  149. long WM_Destroy_Func(
  150. WindowHandle window_handle,
  151. unsigned int message,
  152. unsigned int w_param,
  153. long l_param )
  154. {
  155. if ( Screen_Buffer ) {
  156. delete( Screen_Buffer );
  157. }
  158. PostQuitMessage( w_param );
  159. return( 0L );
  160. }
  161. /***************************************************************************
  162. * WM_MOUSE_BUTTON_FUNC -- Handles when a MOUSE button command comes in *
  163. * *
  164. * INPUT: standard windows dialog command parameters *
  165. * *
  166. * OUTPUT: unused *
  167. * *
  168. * WARNINGS: none *
  169. * *
  170. * HISTORY: see PVCS log *
  171. *=========================================================================*/
  172. long WM_Mouse_Button_Func(
  173. WindowHandle window_handle,
  174. unsigned int message,
  175. unsigned int w_param,
  176. long l_param )
  177. {
  178. int x_pix;
  179. int y_pix;
  180. x_pix = LOWORD( l_param );
  181. y_pix = HIWORD( l_param );
  182. switch ( message ) {
  183. case WM_LBUTTONDOWN:
  184. case WM_MBUTTONDOWN:
  185. case WM_RBUTTONDOWN:
  186. break;
  187. default:
  188. break;
  189. }
  190. return( 0 );
  191. }
  192. /***************************************************************************
  193. * WM_ACTIVATEAPP_FUNC -- Handles WM_ACTIVATEAPP *
  194. * *
  195. * INPUT: standard windows dialog command parameters *
  196. * *
  197. * OUTPUT: unused *
  198. * *
  199. * WARNINGS: none *
  200. * *
  201. * HISTORY: see PVCS log *
  202. *=========================================================================*/
  203. long WM_ActivateApp_Func(
  204. WindowHandle window_handle,
  205. unsigned int message,
  206. unsigned int w_param,
  207. long l_param )
  208. {
  209. return( 0 );
  210. }
  211. void Menu_Exit_Game( void )
  212. {
  213. PostMessage( Main_Window.Get_Window_Handle(), WM_CLOSE, 0, 0L );
  214. }