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