Mercurial > mm7
annotate OSWindow.cpp @ 2132:49de109bbab5
SavePCXScreenshot() continue
author | Ritor1 |
---|---|
date | Sun, 29 Dec 2013 01:26:15 +0600 |
parents | 9574c5bfb96f |
children | ca548138d6aa |
rev | line source |
---|---|
1804 | 1 #include "OSWindow.h" |
2 #include "mm7_data.h" | |
3 #include "Arcomage.h" | |
4 #include "AudioPlayer.h" | |
5 #include "VideoPlayer.h" | |
6 #include "Mouse.h" | |
2044 | 7 #include "Timer.h" |
1804 | 8 #include "GUIWindow.h" |
9 #include "Party.h" | |
10 #include "Game.h" | |
11 #include "IndoorCameraD3D.h" | |
12 #include "Keyboard.h" | |
13 #include "Render.h" | |
14 #include "Viewport.h" | |
15 #include "Vis.h" | |
16 #include "Texts.h" | |
17 #include "AIL.h" | |
18 #include "Bink_Smacker.h" | |
19 #include "ErrorHandling.h" | |
2052 | 20 #include "Log.h" |
1804 | 21 |
22 | |
23 bool OSWindow::OnMouseLeftClick(int x, int y) | |
24 { | |
1815 | 25 if (UIControl::OnMouseLeftClick(x, y)) |
26 return true; | |
27 | |
1804 | 28 if (pVideoPlayer->pVideoFrame.pPixels) |
29 pVideoPlayer->bStopBeforeSchedule = true; | |
30 | |
31 pMouse->SetMouseClick(x, y); | |
32 | |
33 if (GetCurrentMenuID() == MENU_CREATEPARTY) | |
34 UI_OnKeyDown(VK_SELECT); | |
35 | |
36 if (pGame) | |
37 pGame->PickMouse(512.0, x, y, false, &vis_sprite_filter_3, &vis_door_filter); | |
38 | |
39 UI_OnMouseLeftClick(0); | |
40 return true; | |
41 } | |
42 | |
43 bool OSWindow::OnMouseRightClick(int x, int y) | |
44 { | |
1815 | 45 if (UIControl::OnMouseRightClick(x, y)) |
46 return true; | |
47 | |
1804 | 48 if (pVideoPlayer->pVideoFrame.pPixels) |
49 pVideoPlayer->bStopBeforeSchedule = true; | |
50 | |
51 pMouse->SetMouseClick(x, y); | |
52 | |
53 if (pGame) | |
54 pGame->PickMouse(pGame->pIndoorCameraD3D->GetPickDepth(), x, y, 0, &vis_sprite_filter_2, &vis_door_filter); | |
55 | |
56 UI_OnMouseRightClick(0); | |
57 return true; | |
58 } | |
59 | |
60 | |
1830 | 61 bool _507B98_ctrl_pressed = false; |
1804 | 62 bool OSWindow::WinApiMessageProc(UINT msg, WPARAM wparam, LPARAM lparam, LRESULT *result) |
63 { | |
64 switch (msg) | |
65 { | |
66 case WM_KEYUP: | |
67 { | |
1830 | 68 if (wparam == VK_CONTROL) |
69 _507B98_ctrl_pressed = false; | |
2132 | 70 if (wparam == VK_SNAPSHOT) |
71 pRenderer->SavePCXScreenshot(); | |
1830 | 72 |
1804 | 73 OnKey(wparam); |
74 return *result = 0, true; | |
75 } | |
76 | |
77 case WM_SIZING: return *result = 1, true; | |
78 case WM_WINDOWPOSCHANGED: | |
79 if (pVideoPlayer && pVideoPlayer->AnyMovieLoaded() && pVideoPlayer->pBinkBuffer) | |
80 BinkBufferSetOffset(pVideoPlayer->pBinkBuffer, 0, 0); | |
81 return false; | |
82 | |
83 case WM_CHAR: | |
84 if (!pKeyActionMap->_459F10(wparam) && !viewparams->field_4C) | |
85 GUI_HandleHotkey(wparam); | |
86 return false; | |
87 | |
88 case WM_DESTROY: | |
89 ExitProcess(GetLastError()); | |
90 // SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS); | |
91 // PostQuitMessage(0); | |
92 // return 0; | |
93 | |
94 //case WM_DEVICECHANGE: | |
95 //{ | |
96 // if (wParam == 0x8000) // CD or some device has been inserted - notify InsertCD dialog | |
97 // PostMessageW(hInsertCDWindow, WM_USER + 1, 0, 0); | |
98 // return 0; | |
99 //} | |
100 | |
101 case WM_COMMAND: | |
102 if (OnOSMenu(wparam)) | |
103 return *result = 0, true; | |
104 return false; | |
105 | |
106 case WM_LBUTTONDOWN: | |
107 { | |
108 if (pArcomageGame->bGameInProgress) | |
109 { | |
110 pArcomageGame->stru1.field_0 = 7; | |
111 ArcomageGame::OnMouseClick(0, true); | |
112 return false; | |
113 } | |
114 | |
115 OnMouseLeftClick(LOWORD(lparam), HIWORD(lparam)); | |
116 } | |
117 return false; | |
118 | |
119 | |
120 case WM_RBUTTONDOWN: | |
121 { | |
122 if (pArcomageGame->bGameInProgress) | |
123 { | |
124 pArcomageGame->stru1.field_0 = 8; | |
125 ArcomageGame::OnMouseClick(1, true); | |
126 return false; | |
127 } | |
128 | |
129 OnMouseRightClick(LOWORD(lparam), HIWORD(lparam)); | |
130 } | |
131 return false; | |
132 | |
133 | |
134 case WM_LBUTTONUP: | |
135 if ( !pArcomageGame->bGameInProgress ) | |
136 { | |
137 back_to_game(); | |
138 return false; | |
139 } | |
140 pArcomageGame->stru1.field_0 = 3; | |
141 ArcomageGame::OnMouseClick(0, 0); | |
142 return false; | |
143 | |
144 case WM_RBUTTONUP: | |
145 if ( !pArcomageGame->bGameInProgress ) | |
146 { | |
147 back_to_game(); | |
148 return false; | |
149 } | |
150 pArcomageGame->stru1.field_0 = 4; | |
151 ArcomageGame::OnMouseClick(1, false); | |
152 return false; | |
153 | |
154 case WM_LBUTTONDBLCLK: | |
155 { | |
156 if ( pArcomageGame->bGameInProgress ) | |
157 { | |
158 pArcomageGame->stru1.field_0 = 7; | |
159 return false; | |
160 } | |
161 | |
162 OnMouseLeftClick(LOWORD(lparam), HIWORD(lparam)); | |
163 } | |
164 return false; | |
165 | |
166 case WM_RBUTTONDBLCLK: | |
167 { | |
168 if (pArcomageGame->bGameInProgress) | |
169 { | |
170 pArcomageGame->stru1.field_0 = 8; | |
171 return false; | |
172 } | |
173 | |
174 OnMouseRightClick(LOWORD(lparam), HIWORD(lparam)); | |
175 } | |
176 return false; | |
177 | |
178 /*case WM_MBUTTONDOWN: | |
179 if (pRenderer->pRenderD3D && pGame) | |
180 { | |
181 pGame->PickMouse(pGame->pIndoorCameraD3D->GetPickDepth(), LOWORD(lParam), HIWORD(lParam), 1, &vis_sprite_filter_3, &vis_face_filter); | |
182 } | |
183 return false;*/ | |
184 | |
185 case WM_MOUSEMOVE: | |
186 if ( pArcomageGame->bGameInProgress ) | |
187 { | |
188 ArcomageGame::OnMouseMove(LOWORD(lparam), HIWORD(lparam)); | |
189 ArcomageGame::OnMouseClick(0, wparam == MK_LBUTTON); | |
190 ArcomageGame::OnMouseClick(1, wparam == MK_RBUTTON); | |
191 } | |
192 else if (pMouse) | |
193 pMouse->SetMouseClick(LOWORD(lparam), HIWORD(lparam)); | |
194 return false; | |
195 | |
196 case WM_SYSCOMMAND: | |
197 if ( wparam == SC_SCREENSAVE || wparam == SC_MONITORPOWER ) | |
198 return *result = 0, true; | |
199 return false; | |
200 | |
201 case WM_KEYDOWN: | |
202 if ( uGameMenuUI_CurentlySelectedKeyIdx != -1 ) | |
203 { | |
204 pKeyActionMap->_459F10(wparam); | |
205 return false; | |
206 } | |
207 if ( !pArcomageGame->bGameInProgress ) | |
208 { | |
209 if ( pVideoPlayer->pVideoFrame.pPixels ) | |
210 pVideoPlayer->bStopBeforeSchedule = 1; | |
211 if ( wparam == VK_RETURN ) | |
212 { | |
213 if ( !viewparams->field_4C ) | |
214 UI_OnKeyDown(wparam); | |
215 return 0; | |
216 } | |
1830 | 217 if (wparam == VK_CONTROL) |
218 { | |
219 _507B98_ctrl_pressed = true; | |
220 return false; | |
221 } | |
1804 | 222 if ( wparam == VK_ESCAPE ) |
223 { | |
224 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, window_SpeakInHouse != 0, 0); | |
225 return 0; | |
226 } | |
227 if ( wparam <= VK_HOME ) | |
228 return 0; | |
229 if ( wparam > VK_DOWN ) | |
230 { | |
231 if ( wparam != VK_F4 || pVideoPlayer->AnyMovieLoaded() ) | |
232 return 0; | |
233 | |
234 // F4 - toggle fullscreen | |
235 SendMessageW(api_handle, WM_COMMAND, 104, 0); | |
236 return 0; | |
237 } | |
238 if ( wparam >= VK_LEFT && wparam <= VK_DOWN ) | |
239 { | |
240 if ( pCurrentScreen != SCREEN_GAME && pCurrentScreen != SCREEN_MODAL_WINDOW ) | |
241 { | |
242 if ( !viewparams->field_4C ) | |
243 UI_OnKeyDown(wparam); | |
244 return 0; | |
245 } | |
246 } | |
247 if ( pCurrentScreen != SCREEN_GAME && pCurrentScreen != SCREEN_MODAL_WINDOW ) | |
248 return 0; | |
249 } | |
250 | |
251 pArcomageGame->stru1.field_0 = 1; | |
252 | |
253 set_stru1_field_8_InArcomage(MapVirtualKey(wparam, MAPVK_VK_TO_CHAR)); | |
254 if ( wparam == 27 ) | |
255 { | |
256 pArcomageGame->GameOver = 1; | |
257 pArcomageGame->field_F4 = 1; | |
258 pArcomageGame->uGameResult = 2; | |
259 pArcomageGame->field_B0 = -2; | |
260 return false; | |
261 } | |
262 if ( wparam != 114 ) | |
263 { | |
264 if ( wparam == 115 && !pVideoPlayer->AnyMovieLoaded() ) | |
265 SendMessage(api_handle, WM_COMMAND, 104, 0); | |
266 return false; | |
267 } | |
268 SendMessageW(api_handle, WM_COMMAND, 103, 0); | |
269 return *result = 0, true; | |
270 | |
271 case WM_ACTIVATEAPP: | |
272 if ( wparam && (GetForegroundWindow() == api_handle || GetForegroundWindow() == hInsertCDWindow) ) | |
273 { | |
2061 | 274 if (dword_6BE364_game_settings_1 & GAME_SETTINGS_APP_INACTIVE) |
1804 | 275 { |
276 dword_4E98BC_bApplicationActive = 1; | |
2069 | 277 /*if ( pRenderer->bWindowMode ) |
1804 | 278 { |
279 HDC hDC = GetDC(api_handle); | |
280 int bitsPerPixel = GetDeviceCaps(hDC, BITSPIXEL); | |
281 int planes = GetDeviceCaps(hDC, PLANES); | |
282 ReleaseDC(api_handle, hDC); | |
283 if (bitsPerPixel != 16 || planes != 1) | |
2069 | 284 Error(L"%S", pGlobalTXT_LocalizationStrings[62]); |
285 }*/ | |
2061 | 286 dword_6BE364_game_settings_1 &= ~GAME_SETTINGS_APP_INACTIVE; |
1804 | 287 |
288 if ( pArcomageGame->bGameInProgress ) | |
289 { | |
290 pArcomageGame->field_F9 = 1; | |
291 } | |
292 else | |
293 { | |
2061 | 294 if (dword_6BE364_game_settings_1 & GAME_SETTINGS_0200_EVENT_TIMER) |
295 dword_6BE364_game_settings_1 &= ~GAME_SETTINGS_0200_EVENT_TIMER; | |
1804 | 296 else |
297 pEventTimer->Resume(); | |
2061 | 298 if (dword_6BE364_game_settings_1 & GAME_SETTINGS_0400_MISC_TIMER) |
299 dword_6BE364_game_settings_1 &= ~GAME_SETTINGS_0400_MISC_TIMER; | |
1804 | 300 else |
301 pMiscTimer->Resume(); | |
302 | |
303 viewparams->bRedrawGameUI = true; | |
304 if ( pVideoPlayer->pSmackerMovie ) | |
305 { | |
306 pRenderer->RestoreFrontBuffer(); | |
307 pRenderer->_4A184C(); | |
308 pVideoPlayer->_4BF5B2(); | |
309 } | |
310 } | |
311 if ( pAudioPlayer->hAILRedbook && !bGameoverLoop && !pVideoPlayer->pSmackerMovie ) | |
312 AIL_redbook_resume(pAudioPlayer->hAILRedbook); | |
313 } | |
314 } | |
315 else | |
316 { | |
2061 | 317 if (!(dword_6BE364_game_settings_1 & GAME_SETTINGS_APP_INACTIVE)) |
1804 | 318 { |
319 dword_4E98BC_bApplicationActive = 0; | |
320 if ( (pVideoPlayer->pSmackerMovie || pVideoPlayer->pBinkMovie) && pVideoPlayer->bPlayingMovie ) | |
321 pVideoPlayer->bStopBeforeSchedule = 1; | |
322 | |
323 if (/*pRenderer->bUserDirect3D && */pRenderer->uAcquiredDirect3DDevice == 1) | |
324 SetWindowPos(api_handle, (HWND)0xFFFFFFFE, 0, 0, 0, 0, 0x18u); | |
325 ClipCursor(0); | |
2061 | 326 dword_6BE364_game_settings_1 |= GAME_SETTINGS_APP_INACTIVE; |
1804 | 327 if ( pEventTimer->bPaused ) |
2061 | 328 dword_6BE364_game_settings_1 |= GAME_SETTINGS_0200_EVENT_TIMER; |
1804 | 329 else |
330 pEventTimer->Pause(); | |
331 if ( pMiscTimer->bPaused ) | |
2061 | 332 dword_6BE364_game_settings_1 |= GAME_SETTINGS_0400_MISC_TIMER; |
1804 | 333 else |
334 pMiscTimer->Pause(); | |
335 | |
2104 | 336 pAudioPlayer->StopChannels(-1, -1);//ïðèîñòàíîâêà âîñïðîèçâåäåíèÿ çâóêîâ ïðè íåàêòèâíîì îêíå èãðû |
1804 | 337 if ( pAudioPlayer->hAILRedbook ) |
338 AIL_redbook_pause(pAudioPlayer->hAILRedbook); | |
339 } | |
340 } | |
341 return *result = 0, true; | |
342 | |
343 case WM_SETFOCUS: | |
344 dword_4E98BC_bApplicationActive = 0; | |
345 if (pRenderer) | |
346 { | |
347 if (/*pRenderer->bUserDirect3D && */pRenderer->uAcquiredDirect3DDevice == 1) | |
348 SetWindowPos(api_handle, (HWND)0xFFFFFFFE, 0, 0, 0, 0, 0x18u); | |
349 } | |
350 ClipCursor(0); | |
351 return false; | |
352 | |
353 case WM_KILLFOCUS: | |
354 dword_4E98BC_bApplicationActive = 1; | |
355 return false; | |
356 | |
357 case WM_PAINT: | |
1805 | 358 if (pRenderer) |
359 { | |
360 if ( !GetUpdateRect(api_handle, 0, 0) || !dword_4E98BC_bApplicationActive && !pRenderer->bWindowMode ) | |
361 return *result = 0, true; | |
362 } | |
1806 | 363 if (!api_handle || !pRenderer) |
1805 | 364 return false; |
1804 | 365 PAINTSTRUCT Paint; |
366 BeginPaint(api_handle, &Paint); | |
367 if ( pArcomageGame->bGameInProgress ) | |
368 { | |
369 pArcomageGame->field_F9 = 1; | |
370 } | |
371 else | |
372 { | |
373 if (/*!pRenderer->pRenderD3D && !pRenderer->UsingDirect3D() ||*/ !AreRenderSurfacesOk()) | |
374 { | |
375 EndPaint(api_handle, &Paint); | |
376 return *result = 0, true; | |
377 } | |
378 } | |
379 pRenderer->Present(); | |
380 EndPaint(api_handle, &Paint); | |
381 return *result = 0, true; | |
382 | |
383 } | |
384 return false; | |
385 } | |
386 | |
387 | |
388 | |
389 bool OSWindow::Initialize(const wchar_t *title, int window_width, int window_height) | |
390 { | |
391 WNDCLASSEXW wcxw; | |
392 wcxw.cbClsExtra = 0; | |
393 wcxw.cbSize = sizeof(wcxw); | |
394 wcxw.cbWndExtra = 0; | |
395 wcxw.hbrBackground = (HBRUSH)(COLOR_BACKGROUND + 1); | |
396 wcxw.hCursor = nullptr; | |
397 wcxw.hIcon = wcxw.hIconSm = nullptr; | |
398 wcxw.hInstance = GetModuleHandleW(nullptr); | |
399 wcxw.lpfnWndProc = WinApiMsgRouter; | |
400 wcxw.lpszClassName = L"M&MTrilogy"; | |
401 wcxw.lpszMenuName = nullptr; | |
402 wcxw.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW; | |
403 if (!RegisterClassExW(&wcxw)) | |
404 return false; | |
405 | |
2061 | 406 api_handle = CreateWindowExW(0, wcxw.lpszClassName, title, 0, |
2069 | 407 ReadWindowsRegistryInt("window X", (GetSystemMetrics(SM_CXSCREEN) - window_width) / 2), |
408 ReadWindowsRegistryInt("window Y", (GetSystemMetrics(SM_CYSCREEN) - window_height) / 2), | |
409 window_width, window_height, nullptr, | |
1804 | 410 nullptr, wcxw.hInstance, this); |
411 if (!api_handle) | |
412 { | |
413 UnregisterClassW(wcxw.lpszClassName, wcxw.hInstance); | |
414 return false; | |
415 } | |
416 | |
417 SetWindowedMode(window_width, window_height); | |
418 Show(); | |
419 | |
420 SetActiveWindow(api_handle); | |
421 | |
422 MSG msg; | |
423 while (PeekMessageW(&msg, api_handle, 0, 0, PM_REMOVE)) | |
424 { | |
425 TranslateMessage(&msg); | |
426 DispatchMessageW(&msg); | |
427 } | |
428 | |
429 return true; | |
430 } | |
431 | |
432 | |
433 | |
434 | |
435 OSWindow *OSWindow::Create(const wchar_t *title, int window_width, int window_height) | |
436 { | |
2061 | 437 auto window = new OSWindow; |
1804 | 438 if (window) |
439 if (!window->Initialize(title, window_width, window_height)) | |
440 { | |
441 delete window; | |
442 window = nullptr; | |
443 } | |
444 | |
445 return window; | |
446 } | |
447 | |
448 | |
449 | |
450 LRESULT __stdcall OSWindow::WinApiMsgRouter(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) | |
451 { | |
452 if (msg == WM_NCCREATE) | |
453 { | |
1980 | 454 CREATESTRUCTA* cs = (CREATESTRUCTA *)(lparam); |
455 OSWindow* window = (OSWindow *)cs->lpCreateParams; | |
1804 | 456 |
457 SetWindowLongPtrW(hwnd, GWLP_USERDATA, (LONG_PTR)window); | |
458 return DefWindowProcW(hwnd, msg, wparam, lparam); | |
459 } | |
460 | |
1980 | 461 OSWindow* window = (OSWindow *)GetWindowLongPtrW(hwnd, GWLP_USERDATA); |
1804 | 462 if (window && window->api_handle == hwnd) |
463 { | |
464 LPARAM result; | |
465 if (window->WinApiMessageProc(msg, wparam, lparam, &result)) | |
466 return result; | |
467 } | |
468 return DefWindowProcW(hwnd, msg, (WPARAM)wparam, (LPARAM)lparam); | |
469 } | |
470 | |
471 | |
472 void OSWindow::Show() | |
473 { | |
474 ShowWindow(api_handle, SW_SHOWNORMAL); | |
475 UpdateWindow(api_handle); | |
476 } | |
477 | |
478 | |
479 void OSWindow::SetCursor(const char *cursor_name) | |
480 { | |
481 POINT cursor_pos; | |
482 GetCursorPos(&cursor_pos); | |
483 | |
484 if (!strcmp(cursor_name, "MICON1") ) | |
485 SetClassLongPtrW(api_handle, GCLP_HCURSOR, (LONG)LoadCursorW(GetModuleHandleW(nullptr), IDC_ARROW)); | |
486 else if (!strcmp(cursor_name, "MICON2") ) | |
487 SetClassLongPtrW(api_handle, GCLP_HCURSOR, (LONG)LoadCursorW(GetModuleHandleW(nullptr), L"Target")); | |
488 else if (!strcmp(cursor_name, "MICON3") ) | |
489 SetClassLongPtrW(api_handle, GCLP_HCURSOR, (LONG)LoadCursorW(GetModuleHandleW(nullptr), IDC_WAIT)); | |
490 | |
491 //ClientToScreen(api_handle, &cursor_pos); | |
492 SetCursorPos(cursor_pos.x, cursor_pos.y); | |
493 } | |
494 | |
495 void OSWindow::SetFullscreenMode() | |
496 { | |
497 SetMenu(api_handle, nullptr); | |
498 SetWindowLongW(api_handle, GWL_EXSTYLE, WS_EX_TOPMOST); | |
499 SetWindowLongW(api_handle, GWL_STYLE, WS_VISIBLE | WS_POPUP); | |
500 | |
501 SetWindowPos(api_handle, HWND_TOP, 0, 0, -1, -1, SWP_NOSIZE | SWP_SHOWWINDOW); | |
502 } | |
503 | |
504 void OSWindow::SetWindowedMode(int new_window_width, int new_window_height) | |
505 { | |
2069 | 506 RECT rcWindowPos; |
507 GetWindowRect(api_handle, &rcWindowPos); | |
508 | |
1804 | 509 SetWindowLongW(api_handle, GWL_EXSTYLE, 0); |
510 SetWindowLongW(api_handle, GWL_STYLE, WS_VISIBLE | WS_OVERLAPPEDWINDOW); | |
1995 | 511 SetWindowPos(api_handle, HWND_TOP, 0, 0, -1, -1, 0); |
512 | |
1804 | 513 RECT rcWindow; |
514 GetWindowRect(api_handle, &rcWindow); | |
515 | |
516 RECT rcClient; | |
517 GetClientRect(api_handle, &rcClient); | |
518 | |
519 int window_borders_width = (rcWindow.right - rcWindow.left) - (rcClient.right - rcClient.left), | |
520 window_borders_height = (rcWindow.bottom - rcWindow.top) - (rcClient.bottom - rcClient.top); | |
521 int window_total_width = new_window_width + window_borders_width, | |
522 window_total_height = new_window_height + window_borders_height; | |
523 | |
524 #ifdef _DEBUG | |
525 if (!GetMenu(api_handle)) | |
526 window_total_height += GetSystemMetrics(SM_CYMENU); | |
527 #endif | |
2069 | 528 MoveWindow(api_handle, rcWindowPos.left, |
529 rcWindowPos.top, | |
1804 | 530 window_total_width, |
531 window_total_height, 0); | |
532 #ifdef _DEBUG | |
533 static HMENU debug_menu = CreateDebugMenuPanel(); | |
534 SetMenu(api_handle, debug_menu); | |
2069 | 535 |
536 GetWindowRect(api_handle, &rcWindow); | |
537 GetClientRect(api_handle, &rcClient); | |
1804 | 538 #endif |
539 } | |
540 | |
541 | |
542 | |
543 | |
544 HMENU OSWindow::CreateDebugMenuPanel() | |
545 { | |
546 HMENU menu = CreateMenu(); | |
547 { | |
548 HMENU file = CreatePopupMenu(); | |
549 AppendMenuW(menu, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)file, L"&File"); | |
550 { | |
551 AppendMenuW(file, MF_ENABLED | MF_STRING, 40001, L"Exit"); | |
552 } | |
553 | |
554 HMENU debug = CreatePopupMenu(); | |
555 AppendMenuW(menu, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)debug, L"&Debug"); | |
556 { | |
557 HMENU debug_party = CreatePopupMenu(); | |
558 AppendMenuW(debug, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)debug_party, L"&Party"); | |
559 { | |
560 AppendMenuW(debug_party, MF_ENABLED | MF_STRING, 40007, L"Give Gold (10 000)"); | |
561 AppendMenuW(debug_party, MF_ENABLED | MF_STRING, 40008, L"Give Exp (20 000)"); | |
562 AppendMenuW(debug_party, MF_ENABLED | MF_STRING, 40059, L"Give Skills (50 each)"); | |
563 AppendMenuW(debug_party, MF_ENABLED | MF_STRING, 40013, L"Remove Gold"); | |
564 | |
565 HMENU debug_party_setconditions = CreatePopupMenu(); | |
566 AppendMenuW(debug_party, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)debug_party_setconditions, L"Set Condition"); | |
567 { | |
568 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40044, L"Afraid"); | |
569 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40043, L"Asleep"); | |
570 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40037, L"Curse"); | |
571 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40036, L"Disease1"); | |
572 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40035, L"Disease2"); | |
573 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40034, L"Disease3"); | |
574 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40041, L"Dead"); | |
575 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40039, L"Drunk"); | |
576 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40042, L"Eradicated"); | |
577 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40038, L"Insane"); | |
578 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40045, L"Paralyzed"); | |
579 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40033, L"Poison1"); | |
580 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40032, L"Poison2"); | |
581 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40031, L"Poison3"); | |
582 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40029, L"&Stone"); | |
583 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40040, L"Unconscious"); | |
584 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40030, L"Weak"); | |
585 AppendMenuW(debug_party_setconditions, MF_ENABLED | MF_STRING, 40073, L"Zombie"); | |
586 } | |
587 | |
588 AppendMenuW(debug_party, MF_ENABLED | MF_STRING, 40006, L"Set Food (20)"); | |
589 | |
590 HMENU debug_party_alignment = CreatePopupMenu(); | |
591 AppendMenuW(debug_party, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)debug_party_alignment, L"Alignment"); | |
592 { | |
593 AppendMenuW(debug_party_alignment, MF_ENABLED | MF_STRING, 40062, L"Good"); | |
594 AppendMenuW(debug_party_alignment, MF_ENABLED | MF_STRING | MF_CHECKED, 40063, L"Neutral"); | |
595 AppendMenuW(debug_party_alignment, MF_ENABLED | MF_STRING, 40064, L"Evil"); | |
596 } | |
597 } | |
598 | |
599 HMENU debug_time = CreatePopupMenu(); | |
600 AppendMenuW(debug, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)debug_time, L"&Time"); | |
601 { | |
602 AppendMenuW(debug_time, MF_ENABLED | MF_STRING, 40009, L"Add 1 Day"); | |
603 AppendMenuW(debug_time, MF_ENABLED | MF_STRING, 40010, L"Add 1 Week"); | |
604 AppendMenuW(debug_time, MF_ENABLED | MF_STRING, 40011, L"Add 1 Month"); | |
605 AppendMenuW(debug_time, MF_ENABLED | MF_STRING, 40012, L"Add 1 Year"); | |
606 } | |
607 | |
608 HMENU debug_items = CreatePopupMenu(); | |
609 AppendMenuW(debug, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)debug_items, L"&Items"); | |
610 { | |
611 AppendMenuW(debug_items, MF_ENABLED | MF_STRING, 40015, L"Generate level &1 item"); | |
612 AppendMenuW(debug_items, MF_ENABLED | MF_STRING, 40016, L"Generate level &2 item"); | |
613 AppendMenuW(debug_items, MF_ENABLED | MF_STRING, 40017, L"Generate level &3 item"); | |
614 AppendMenuW(debug_items, MF_ENABLED | MF_STRING, 40018, L"Generate level &4 item"); | |
615 AppendMenuW(debug_items, MF_ENABLED | MF_STRING, 40019, L"Generate level &5 item"); | |
616 AppendMenuW(debug_items, MF_ENABLED | MF_STRING, 40020, L"Generate level &6 item"); | |
617 AppendMenuW(debug_items, MF_ENABLED | MF_STRING, 40061, L"Generate special item"); | |
618 } | |
619 | |
620 HMENU debug_graphics = CreatePopupMenu(); | |
621 AppendMenuW(debug, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)debug_graphics, L"&Graphics"); | |
622 { | |
623 AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40023, L"Lighting Mode"); | |
624 AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40024, L"Lighting Geometry"); | |
625 AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING | MF_GRAYED, 40104, L"Lights Off"); | |
626 AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40105, L"Colored Lights"); | |
627 AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40025, L"Debug Lights"); | |
628 AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40101, L"Debug Decals"); | |
629 AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40027, L"HWID Portals"); | |
630 AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40047, L"SWID Portals"); | |
631 AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40051, L"OD Frustum"); | |
632 AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40054, L"SWOD Constant Redraw"); | |
633 AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40055, L"SWOD Lit Rasterizer"); | |
634 AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40056, L"Party Light off"); | |
635 AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40060, L"SWOD Nice Lighting off"); | |
636 AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40067, L"HWOD Additive Fog Lights"); | |
637 AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40072, L"HWID Nice Lighting"); | |
638 AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40048, L"Wireframe"); | |
639 AppendMenuW(debug_graphics, MF_ENABLED | MF_STRING, 40049, L"Fog"); | |
640 } | |
641 | |
642 HMENU debug_misc = CreatePopupMenu(); | |
643 AppendMenuW(debug, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)debug_misc, L"&Misc"); | |
644 { | |
645 AppendMenuW(debug_misc, MF_ENABLED | MF_STRING, 40066, L"Object Viewcone Culling"); | |
646 AppendMenuW(debug_misc, MF_ENABLED | MF_STRING, 40068, L"Red Tint"); | |
647 AppendMenuW(debug_misc, MF_ENABLED | MF_STRING, 40071, L"Display Secrets"); | |
648 AppendMenuW(debug_misc, MF_ENABLED | MF_STRING, 40102, L"Massive Bloodsplat"); | |
649 AppendMenuW(debug_misc, MF_ENABLED | MF_STRING, 40103, L"Underwater Gravity"); | |
650 } | |
651 | |
652 HMENU debug_eax = CreatePopupMenu(); | |
653 AppendMenuW(debug, MF_ENABLED | MF_STRING | MF_POPUP, (UINT_PTR)debug_eax, L"EAX Environs"); | |
654 { | |
655 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40074, L"NONE"); | |
656 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40075, L"GENERIC"); | |
657 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40076, L"PADDEDCELL"); | |
658 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40077, L"ROOM"); | |
659 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40078, L"BATHROOM"); | |
660 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40079, L"LIVINGROOM"); | |
661 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40080, L"STONEROOM"); | |
662 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40081, L"AUDITORIUM"); | |
663 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40082, L"CONCERTHALL"); | |
664 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40083, L"CAVE"); | |
665 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40084, L"ARENA"); | |
666 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40085, L"HANGAR"); | |
667 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40086, L"CARPETEDHALLWAY"); | |
668 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40087, L"HALLWAY"); | |
669 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40088, L"STONECORRIDOR"); | |
670 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40089, L"ALLEY"); | |
671 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40090, L"FOREST"); | |
672 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40091, L"CITY"); | |
673 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40092, L"MOUNTAINS"); | |
674 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40093, L"QUARRY"); | |
675 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40094, L"PLAIN"); | |
676 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40095, L"PARKINGLOT"); | |
677 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40096, L"SEWERPIPE"); | |
678 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40097, L"UNDERWATER"); | |
679 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40098, L"DRUGGED"); | |
680 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40099, L"DIZZY"); | |
681 AppendMenuW(debug_eax, MF_ENABLED | MF_STRING, 40100, L"PSICHOTIC"); | |
682 } | |
683 } | |
684 } | |
685 return menu; | |
686 } | |
687 | |
688 | |
689 | |
690 | |
691 bool OSWindow::OnOSMenu(int item_id) | |
692 { | |
693 switch (item_id) | |
694 { | |
695 default: return false; | |
696 | |
697 | |
2132 | 698 //case 103: pRenderer->SavePCXScreenshot(); break; |
1804 | 699 case 101: // Quit game |
2132 | 700 case 40001: // Menu "File"-> "Exit" |
701 pGame->Deinitialize(); | |
1804 | 702 SendMessageW(api_handle, WM_DESTROY, 0, 0); |
703 break; | |
704 | |
2132 | 705 case 104: //F4 button |
1804 | 706 pRenderer->ChangeBetweenWinFullscreenModes(); |
707 if (pArcomageGame->bGameInProgress) | |
708 pArcomageGame->field_F6 = 1; | |
709 break; | |
710 | |
711 //SubMenu "Party" | |
712 case 40006: pParty->SetFood(pParty->uNumFoodRations + 20); break; | |
713 case 40007: pParty->SetGold(pParty->uNumGold + 10000); break; | |
1827
0c75c3e7e436
cleaned up part of party.cpp, renamed byte_AE3368 to playerAlreadyPicked + 3 vars after it, moved them to party.cpp, some player.cpp bugfixes
Grumpy7
parents:
1815
diff
changeset
|
714 case 40008: pParty->GivePartyExp(20000); break; |
1804 | 715 case 40013: pParty->SetGold(0); break; |
716 | |
717 case 40059: | |
718 for (uint i = 0; i < 4; ++i) | |
719 pParty->pPlayers[i].uSkillPoints = 50; | |
720 break; | |
721 | |
722 case 40029: pPlayers[uActiveCharacter]->SetPertified(true); break; | |
723 case 40030: pPlayers[uActiveCharacter]->SetWeak(true); break; | |
724 case 40031: pPlayers[uActiveCharacter]->SetPoison3(true); break; | |
725 case 40032: pPlayers[uActiveCharacter]->SetPoison2(true); break; | |
726 case 40033: pPlayers[uActiveCharacter]->SetPoison1(true); break; | |
727 case 40034: pPlayers[uActiveCharacter]->SetDisease3(true); break; | |
728 case 40035: pPlayers[uActiveCharacter]->SetDisease2(true); break; | |
729 case 40036: pPlayers[uActiveCharacter]->SetDisease1(true); break; | |
730 case 40037: pPlayers[uActiveCharacter]->SetCursed(true); break; | |
731 case 40038: pPlayers[uActiveCharacter]->SetInsane(true); break; | |
732 case 40039: pPlayers[uActiveCharacter]->SetDrunk(true); break; | |
733 case 40040: pPlayers[uActiveCharacter]->SetUnconcious(true); break; | |
734 case 40041: pPlayers[uActiveCharacter]->SetDead(true); break; | |
735 case 40042: pPlayers[uActiveCharacter]->SetEradicated(true); break; | |
736 case 40043: pPlayers[uActiveCharacter]->SetAsleep(true); break; | |
737 case 40044: pPlayers[uActiveCharacter]->SetAfraid(true); break; | |
738 case 40045: pPlayers[uActiveCharacter]->SetParalyzed(true); break; | |
739 case 40073: pPlayers[uActiveCharacter]->SetZombie(true); break; | |
740 | |
741 case 40062: | |
742 pParty->alignment = PartyAlignment_Good; | |
743 SetUserInterface(pParty->alignment, true); | |
744 break; | |
745 case 40063: | |
746 pParty->alignment = PartyAlignment_Neutral; | |
747 SetUserInterface(pParty->alignment, true); | |
748 break; | |
749 case 40064: | |
750 pParty->alignment = PartyAlignment_Evil; | |
751 SetUserInterface(pParty->alignment, true); | |
752 break; | |
753 | |
754 | |
755 | |
756 //SubMenu "Time" | |
757 case 40009: pParty->uTimePlayed += Timer::Day; break; | |
758 case 40010: pParty->uTimePlayed += Timer::Week; break; | |
759 case 40011: pParty->uTimePlayed += Timer::Month; break; | |
760 case 40012: pParty->uTimePlayed += Timer::Year; break; | |
761 | |
762 //SubMenu "Items" | |
763 case 40015: // uItemID_Rep_St == 1 | |
764 case 40016: // uItemID_Rep_St == 2 | |
765 case 40017: // uItemID_Rep_St == 3 | |
766 case 40018: // uItemID_Rep_St == 4 | |
767 case 40019: // uItemID_Rep_St == 5 | |
768 case 40020: // uItemID_Rep_St == 6 | |
769 { | |
770 int pItemID = rand() % 500; | |
771 for (uint i = 0; i < 500; ++i) | |
772 { | |
773 if (pItemID + i > 499) | |
774 pItemID = 0; | |
775 if (pItemsTable->pItems[pItemID + i].uItemID_Rep_St == (item_id - 40015 + 1)) | |
776 { | |
777 pPlayers[uActiveCharacter]->AddItem(-1, pItemID + i); | |
778 break; | |
779 } | |
780 } | |
781 } | |
782 break; | |
783 | |
784 case 40061: | |
785 { | |
786 int pItemID = rand() % 500; | |
787 for (uint i = 0; i < 500; ++i) | |
788 { | |
789 if (pItemID + i > 499) | |
790 pItemID = 0; | |
791 if (pItemsTable->pItems[pItemID + i].uItemID_Rep_St > 6) | |
792 { | |
793 pPlayers[uActiveCharacter]->AddItem(-1, pItemID + i); | |
794 break; | |
795 } | |
796 } | |
797 } | |
798 break; | |
799 } | |
800 | |
801 return true; | |
1924
8cd321994943
MSVS 2012 project file & some compilation warning fixes
Nomad
parents:
1830
diff
changeset
|
802 } |