annotate Game/MainMenuLoad.cpp @ 2568:f2f2595fe308

rename Decals[], DecalCount
author Ritor1
date Thu, 21 May 2015 18:32:45 +0600
parents 48708da03b7f
children d87bfbd3bb3b
rev   line source
2552
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
1 #include "Engine/Engine.h"
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
2 #include "Engine/SaveLoad.h"
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
3 #include "Engine/LOD.h"
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
4 #include "Engine/Timer.h"
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
5 #include "Engine/Graphics/IRender.h"
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
6 #include "Engine/Graphics/Viewport.h"
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
7
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
8 #include "IO/Keyboard.h"
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
9
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
10 #include "GUI/UI/UISaveLoad.h"
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
11
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
12 #include "Game/MainMenu.h"
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
13 #include "Game/MainMenuLoad.h"
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
14
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
15 void MainMenuLoad_EventLoop()
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
16 {
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
17 while (pMessageQueue_50CBD0->uNumMessages)
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
18 {
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
19 UIMessageType msg;
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
20 int param, param2;
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
21 pMessageQueue_50CBD0->PopMessage(&msg, &param, &param2);
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
22
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
23 switch (msg)
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
24 {
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
25 case UIMSG_LoadGame:
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
26 {
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
27 if (!pSavegameUsedSlots[uLoadGameUI_SelectedSlot])
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
28 break;
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
29 SetCurrentMenuID(MENU_LoadingProcInMainMenu);
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
30 }
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
31 break;
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
32
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
33 case UIMSG_SelectLoadSlot:
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
34 {
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
35 //main menu save/load wnd clicking on savegame lines
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
36 if (pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS)
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
37 pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_NONE);
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
38 if (current_screen_type != SCREEN_SAVEGAME || uLoadGameUI_SelectedSlot != param + pSaveListPosition)
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
39 {
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
40 //load clicked line
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
41 int v26 = param + pSaveListPosition;
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
42 if (dword_6BE138 == v26)
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
43 {
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
44 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_SaveLoadBtn, 0, 0);
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
45 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_LoadGame, 0, 0);
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
46 }
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
47 uLoadGameUI_SelectedSlot = v26;
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
48 dword_6BE138 = v26;
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
49 }
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
50 else
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
51 {
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
52 //typing in the line
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
53 pKeyActionMap->EnterText(0, 19, pGUIWindow_CurrentMenu);
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
54 strcpy(pKeyActionMap->pPressedKeysBuffer, pSavegameHeader[uLoadGameUI_SelectedSlot].pName);
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
55 pKeyActionMap->uNumKeysPressed = strlen(pKeyActionMap->pPressedKeysBuffer);
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
56 }
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
57 }
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
58 break;
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
59
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
60 case UIMSG_SaveLoadBtn:
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
61 new OnSaveLoad(pGUIWindow_CurrentMenu->uFrameX + 241, pGUIWindow_CurrentMenu->uFrameY + 302, 61, 28, (int)pBtnLoadSlot, 0);
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
62 break;
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
63
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
64
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
65 case UIMSG_DownArrow:
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
66 {
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
67 ++pSaveListPosition;
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
68 if (pSaveListPosition >= param)
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
69 pSaveListPosition = param - 1;
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
70 if (pSaveListPosition < 1)
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
71 pSaveListPosition = 0;
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
72 new OnButtonClick2(pGUIWindow_CurrentMenu->uFrameX + 215, pGUIWindow_CurrentMenu->uFrameY + 323, 0, 0, (int)pBtnDownArrow, 0);
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
73 }
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
74 break;
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
75
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
76
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
77 case UIMSG_ArrowUp:
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
78 {
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
79 --pSaveListPosition;
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
80 if (pSaveListPosition < 0)
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
81 pSaveListPosition = 0;
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
82 new OnButtonClick2(pGUIWindow_CurrentMenu->uFrameX + 215, pGUIWindow_CurrentMenu->uFrameY + 197, 0, 0, (int)pBtnArrowUp, 0);
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
83 }
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
84 break;
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
85
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
86 case UIMSG_Cancel:
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
87 new OnCancel3(pGUIWindow_CurrentMenu->uFrameX + 350, pGUIWindow_CurrentMenu->uFrameY + 302, 61, 28, (int)pBtnCancel, 0);
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
88 break;
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
89
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
90
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
91 case UIMSG_Escape:
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
92 {
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
93 viewparams->field_48 = 1;
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
94 //if (current_screen_type == SCREEN_LOADGAME)
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
95 {
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
96 pIcons_LOD->RemoveTexturesPackFromTextureList();
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
97 //crt_deconstruct_ptr_6A0118();
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
98 main_menu_background.Release();
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
99 main_menu_background.Load("title.pcx", 0);
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
100 SetCurrentMenuID(MENU_MAIN);
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
101 current_screen_type = SCREEN_GAME;
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
102 pEventTimer->Resume();
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
103 viewparams->bRedrawGameUI = true;
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
104 break;
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
105 }
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
106 }
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
107 break;
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
108 }
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
109 }
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
110 }
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
111
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
112 void MainMenuLoad_Loop()
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
113 {
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
114 current_screen_type = SCREEN_LOADGAME;
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
115
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
116 main_menu_background.Release();
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
117 main_menu_background.Load("lsave640.pcx", 0);
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
118
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
119 //LoadUI_Load(0);
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
120 pGUIWindow_CurrentMenu = new GUIWindow_Load(false);
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
121
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
122
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
123 while (GetCurrentMenuID() == MENU_SAVELOAD && current_screen_type == SCREEN_LOADGAME)
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
124 {
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
125 MSG msg;
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
126 while (PeekMessageW(&msg, 0, 0, 0, PM_REMOVE))
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
127 {
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
128 if (msg.message == WM_QUIT)
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
129 Engine_DeinitializeAndTerminate(0);
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
130 TranslateMessage(&msg);
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
131 DispatchMessageW(&msg);
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
132 }
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
133 if (dword_6BE364_game_settings_1 & GAME_SETTINGS_APP_INACTIVE)
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
134 {
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
135 WaitMessage();
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
136 continue;
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
137 }
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
138
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
139 pRenderer->BeginScene();
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
140 pRenderer->DrawTextureNew(0, 0, &main_menu_background);
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
141
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
142 MainMenuLoad_EventLoop();
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
143 GUI_UpdateWindows();
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
144
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
145 pRenderer->EndScene();
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
146 pRenderer->Present();
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
147 }
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
148
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
149 pGUIWindow_CurrentMenu->Release();
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
150 pGUIWindow_CurrentMenu = nullptr;
ac16f4a3a91e Load from MainMenu logic separated from MainMenu window
a.parshin
parents:
diff changeset
151 }