Mercurial > mm7
annotate Game/MainMenu.cpp @ 2551:4008b2f34be0
MainMenu rendering moved from event loop to respective window class
author | a.parshin |
---|---|
date | Tue, 12 May 2015 12:03:30 +0200 |
parents | fed97f15d1e1 |
children | ac16f4a3a91e |
rev | line source |
---|---|
2541 | 1 #include "Engine/Engine.h" |
2 #include "Engine/Timer.h" | |
3 #include "Engine/Party.h" | |
4 #include "Engine/LOD.h" | |
5 #include "Engine/SaveLoad.h" | |
6 #include "Engine/Graphics/IRender.h" | |
7 #include "Engine/Graphics/Viewport.h" | |
8 | |
9 #include "IO/Mouse.h" | |
10 #include "IO/Keyboard.h" | |
11 | |
2551
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2547
diff
changeset
|
12 #include "GUI/UI/UIMainMenu.h" |
2541 | 13 #include "GUI/UI/UIPartyCreation.h" |
2547 | 14 #include "GUI/UI/UISaveLoad.h" |
2551
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2547
diff
changeset
|
15 #include "GUI/GUIButton.h" |
2541 | 16 |
17 #include "Media/Audio/AudioPlayer.h" | |
18 | |
19 #include "Game/MainMenu.h" | |
20 | |
21 | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2541
diff
changeset
|
22 RGBTexture main_menu_background; |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2541
diff
changeset
|
23 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2541
diff
changeset
|
24 |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2541
diff
changeset
|
25 |
2541 | 26 //----- (00435748) -------------------------------------------------------- |
27 void MainMenu_EventLoop() | |
28 { | |
29 Player *pPlayer; // ebx@2 | |
30 void *v3; // edi@21 | |
31 signed int v4; // eax@29 | |
32 // int v5; // ecx@29 | |
33 // PLAYER_SKILL_TYPE v6; // edi@37 | |
34 GUIWindow *pWindow; // eax@56 | |
35 GUIButton *pButton; // eax@59 | |
36 int v15; // edi@70 | |
37 char v20; // dl@116 | |
38 unsigned int v21; // eax@116 | |
39 unsigned int v25; // eax@120 | |
40 unsigned int v26; // ecx@127 | |
41 // SoundID pSoundID; // [sp-2Ch] [bp-3Ch]@36 | |
42 // signed int v41; // [sp-10h] [bp-20h]@29 | |
43 int pParam; // [sp+4h] [bp-Ch]@3 | |
44 UIMessageType pUIMessageType; // [sp+8h] [bp-8h]@3 | |
45 int pSex; // [sp+Ch] [bp-4h]@3 | |
46 | |
47 if (pMessageQueue_50CBD0->uNumMessages) | |
48 { | |
49 pPlayer = pParty->pPlayers.data(); | |
50 do | |
51 { | |
52 int param2; | |
53 pMessageQueue_50CBD0->PopMessage(&pUIMessageType, &pParam, ¶m2); | |
54 //auto player = &pParty->pPlayers[pParam]; | |
55 | |
56 switch (pUIMessageType) // For buttons of window MainMenu | |
57 { | |
58 case UIMSG_MainMenu_ShowPartyCreationWnd: | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2541
diff
changeset
|
59 new OnButtonClick2(495, 172, 0, 0, (int)pMainMenu_BtnNew, 0); |
2541 | 60 SetCurrentMenuID(MENU_NEWGAME); |
61 break; | |
62 case UIMSG_MainMenu_ShowLoadWindow: | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2541
diff
changeset
|
63 new OnButtonClick2(495, 227, 0, 0, (int)pMainMenu_BtnLoad, 0); |
2541 | 64 SetCurrentMenuID(MENU_SAVELOAD); |
65 break; | |
66 case UIMSG_ShowCredits: | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2541
diff
changeset
|
67 new OnButtonClick2(495, 282, 0, 0, (int)pMainMenu_BtnCredits, 0); |
2541 | 68 SetCurrentMenuID(MENU_CREDITS); |
69 break; | |
70 case UIMSG_ExitToWindows: | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2541
diff
changeset
|
71 new OnButtonClick2(495, 337, 0, 0, (int)pMainMenu_BtnExit, 0); |
2541 | 72 SetCurrentMenuID(MENU_EXIT_GAME); |
73 break; | |
74 case UIMSG_PlayerCreation_SelectAttribute: | |
75 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) | |
76 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam; | |
77 uPlayerCreationUI_SelectedCharacter = pParam; | |
78 pAudioPlayer->PlaySound(SOUND_SelectingANewCharacter, 0, 0, -1, 0, 0, 0, 0); | |
79 break; | |
80 case UIMSG_PlayerCreation_VoicePrev: | |
81 pSex = pParty->pPlayers[pParam].GetSexByVoice(); | |
82 do | |
83 { | |
84 if (pParty->pPlayers[pParam].uVoiceID == 0) | |
85 pParty->pPlayers[pParam].uVoiceID = 19; | |
86 else --pParty->pPlayers[pParam].uVoiceID; | |
87 } while (pParty->pPlayers[pParam].GetSexByVoice() != pSex); | |
88 pButton = pCreationUI_BtnPressLeft2[pParam]; | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2541
diff
changeset
|
89 new OnButtonClick(pButton->uX, pButton->uY, 0, 0, (int)pButton, (char *)1); |
2541 | 90 pAudioPlayer->PlaySound(SOUND_SelectingANewCharacter, 0, 0, -1, 0, 0, 0, 0); |
91 pParty->pPlayers[pParam].PlaySound(SPEECH_PickMe, 0); | |
92 break; | |
93 case UIMSG_PlayerCreation_VoiceNext: | |
94 pSex = pParty->pPlayers[pParam].GetSexByVoice(); | |
95 do | |
96 { | |
97 pParty->pPlayers[pParam].uVoiceID = (pParty->pPlayers[pParam].uVoiceID + 1) % 20; | |
98 } while (pParty->pPlayers[pParam].GetSexByVoice() != pSex); | |
99 pButton = pCreationUI_BtnPressRight2[pParam]; | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2541
diff
changeset
|
100 new OnButtonClick(pButton->uX, pButton->uY, 0, 0, (int)pButton, (char *)1); |
2541 | 101 pAudioPlayer->PlaySound(SOUND_SelectingANewCharacter, 0, 0, -1, 0, 0, 0, 0); |
102 pParty->pPlayers[pParam].PlaySound(SPEECH_PickMe, 0); | |
103 break; | |
104 case UIMSG_PlayerCreation_FacePrev: | |
105 //pPlayer = &pParty->pPlayers[pParam]; | |
106 if (!pParty->pPlayers[pParam].uCurrentFace) | |
107 pParty->pPlayers[pParam].uCurrentFace = 19; | |
108 else | |
109 pParty->pPlayers[pParam].uCurrentFace -= 1; | |
110 pParty->pPlayers[pParam].uVoiceID = pParty->pPlayers[pParam].uCurrentFace; | |
111 pParty->pPlayers[pParam].SetInitialStats(); | |
112 pParty->pPlayers[pParam].SetSexByVoice(); | |
113 pParty->pPlayers[pParam].RandomizeName(); | |
114 v25 = pParam; | |
115 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) | |
116 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam; | |
117 uPlayerCreationUI_SelectedCharacter = v25; | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2541
diff
changeset
|
118 new OnButtonClick(pCreationUI_BtnPressLeft[v25]->uX, pCreationUI_BtnPressLeft[v25]->uY, 0, 0, (int)pCreationUI_BtnPressLeft[v25], (char *)1); |
2541 | 119 pAudioPlayer->PlaySound(SOUND_SelectingANewCharacter, 0, 0, -1, 0, 0, 0.0, 0); |
120 pParty->pPlayers[pParam].PlaySound(SPEECH_PickMe, 0); | |
121 break; | |
122 case UIMSG_PlayerCreation_FaceNext: | |
123 //pPlayer = &pParty->pPlayers[pParam]; | |
124 v20 = (char)((int)pParty->pPlayers[pParam].uCurrentFace + 1) % 20; | |
125 pParty->pPlayers[pParam].uCurrentFace = v20; | |
126 pParty->pPlayers[pParam].uVoiceID = v20; | |
127 pParty->pPlayers[pParam].SetInitialStats(); | |
128 pParty->pPlayers[pParam].SetSexByVoice(); | |
129 pParty->pPlayers[pParam].RandomizeName(); | |
130 v21 = pParam; | |
131 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) | |
132 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam; | |
133 uPlayerCreationUI_SelectedCharacter = v21; | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2541
diff
changeset
|
134 new OnButtonClick(pCreationUI_BtnPressRight[v21]->uX, pCreationUI_BtnPressRight[v21]->uY, 0, 0, (int)pCreationUI_BtnPressRight[v21], (char *)1); |
2541 | 135 pAudioPlayer->PlaySound(SOUND_SelectingANewCharacter, 0, 0, -1, 0, 0, 0, 0); |
136 pParty->pPlayers[pParam].PlaySound(SPEECH_PickMe, 0); | |
137 break; | |
138 case UIMSG_PlayerCreationClickPlus: | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2541
diff
changeset
|
139 new OnButtonClick2(613, 393, 0, 0, (int)pPlayerCreationUI_BtnPlus, (char *)1); |
2541 | 140 pPlayer[uPlayerCreationUI_SelectedCharacter].IncreaseAttribute((pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7); |
141 pAudioPlayer->PlaySound(SOUND_ClickMinus, 0, 0, -1, 0, 0, 0, 0); | |
142 break; | |
143 case UIMSG_PlayerCreationClickMinus: | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2541
diff
changeset
|
144 new OnButtonClick2(523, 393, 0, 0, (int)pPlayerCreationUI_BtnMinus, (char *)1); |
2541 | 145 pPlayer[uPlayerCreationUI_SelectedCharacter].DecreaseAttribute((pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7); |
146 pAudioPlayer->PlaySound(SOUND_ClickPlus, 0, 0, -1, 0, 0, 0, 0); | |
147 break; | |
148 case UIMSG_PlayerCreationSelectActiveSkill: | |
149 if (pPlayer[uPlayerCreationUI_SelectedCharacter].GetSkillIdxByOrder(3) == 37) | |
150 pParty->pPlayers[uPlayerCreationUI_SelectedCharacter].pActiveSkills[pPlayer[uPlayerCreationUI_SelectedCharacter].GetSkillIdxByOrder(pParam + 4)] = 1; | |
151 pAudioPlayer->PlaySound(SOUND_ClickSkill, 0, 0, -1, 0, 0, 0, 0); | |
152 break; | |
153 case UIMSG_PlayerCreationSelectClass: | |
154 pPlayer[uPlayerCreationUI_SelectedCharacter].Reset((PLAYER_CLASS_TYPE)pParam); | |
155 pAudioPlayer->PlaySound(SOUND_SelectingANewCharacter, 0, 0, -1, 0, 0, 0, 0); | |
156 break; | |
157 case UIMSG_PlayerCreationClickOK: | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2541
diff
changeset
|
158 new OnButtonClick2(580, 431, 0, 0, (int)pPlayerCreationUI_BtnOK, 0); |
2541 | 159 if (PlayerCreation_GetUnspentAttributePointCount() || !PlayerCreation_Choose4Skills()) |
160 GameUI_Footer_TimeLeft = GetTickCount() + 4000; | |
161 else | |
162 uGameState = GAME_STATE_STARTING_NEW_GAME; | |
163 break; | |
164 case UIMSG_PlayerCreationClickReset: | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2541
diff
changeset
|
165 new OnButtonClick2(527, 431, 0, 0, (int)pPlayerCreationUI_BtnReset, 0); |
2541 | 166 pParty->Reset(); |
167 break; | |
168 case UIMSG_PlayerCreationRemoveUpSkill: | |
169 v4 = pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem; | |
170 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = v4 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam; | |
171 if (pPlayer[pParam].GetSkillIdxByOrder(2) != 37)//37 - None(Íåò) | |
172 pParty->pPlayers[pParam].pActiveSkills[pPlayer[pParam].GetSkillIdxByOrder(2)] = 0; | |
173 break; | |
174 case UIMSG_PlayerCreationRemoveDownSkill: | |
175 v4 = pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem; | |
176 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = v4 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam; | |
177 if (pPlayer[pParam].GetSkillIdxByOrder(3) != 37)//37 - None(Íåò) | |
178 pParty->pPlayers[pParam].pActiveSkills[pPlayer[pParam].GetSkillIdxByOrder(3)] = 0; | |
179 break; | |
180 case UIMSG_PlayerCreationChangeName: | |
181 pAudioPlayer->PlaySound(SOUND_ClickSkill, 0, 0, -1, 0, 0, 0, 0); | |
182 v3 = (void *)pParam; | |
183 uPlayerCreationUI_SelectedCharacter = pParam; | |
184 pKeyActionMap->EnterText(0, 15, pGUIWindow_CurrentMenu); | |
185 pGUIWindow_CurrentMenu->ptr_1C = v3; | |
186 break; | |
187 case UIMSG_ChangeGameState: | |
188 uGameState = GAME_FINISHED; | |
189 break; | |
190 case UIMSG_ChangeCursor: | |
191 pMouse->SetCursorBitmap("MICON2"); | |
192 break; | |
193 case UIMSG_3A: | |
194 SetCurrentMenuID(MENU_DebugBLVLevel); | |
195 break; | |
196 case UIMSG_LoadGame: | |
197 if (!pSavegameUsedSlots[uLoadGameUI_SelectedSlot]) | |
198 break; | |
199 SetCurrentMenuID(MENU_LoadingProcInMainMenu); | |
200 break; | |
201 case UIMSG_SelectLoadSlot: | |
202 //main menu save/load wnd clicking on savegame lines | |
203 if (pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) | |
204 pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_NONE); | |
205 if (current_screen_type != SCREEN_SAVEGAME || uLoadGameUI_SelectedSlot != pParam + pSaveListPosition) | |
206 { | |
207 //load clicked line | |
208 v26 = pParam + pSaveListPosition; | |
209 if (dword_6BE138 == pParam + pSaveListPosition) | |
210 { | |
211 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_SaveLoadBtn, 0, 0); | |
212 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_LoadGame, 0, 0); | |
213 } | |
214 uLoadGameUI_SelectedSlot = v26; | |
215 dword_6BE138 = v26; | |
216 } | |
217 else | |
218 { | |
219 //typing in the line | |
220 pKeyActionMap->EnterText(0, 19, pGUIWindow_CurrentMenu); | |
221 strcpy(pKeyActionMap->pPressedKeysBuffer, pSavegameHeader[uLoadGameUI_SelectedSlot].pName); | |
222 pKeyActionMap->uNumKeysPressed = strlen(pKeyActionMap->pPressedKeysBuffer); | |
223 } | |
224 break; | |
225 case UIMSG_SaveLoadBtn: | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2541
diff
changeset
|
226 new OnSaveLoad(pGUIWindow_CurrentMenu->uFrameX + 241, pGUIWindow_CurrentMenu->uFrameY + 302, 61, 28, (int)pBtnLoadSlot, 0); |
2541 | 227 break; |
228 case UIMSG_DownArrow: | |
229 ++pSaveListPosition; | |
230 if (pSaveListPosition >= pParam) | |
231 pSaveListPosition = pParam - 1; | |
232 if (pSaveListPosition < 1) | |
233 pSaveListPosition = 0; | |
234 pWindow = pGUIWindow_CurrentMenu; | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2541
diff
changeset
|
235 new OnButtonClick2(pWindow->uFrameX + 215, pGUIWindow_CurrentMenu->uFrameY + 323, 0, 0, (int)pBtnDownArrow, 0); |
2541 | 236 break; |
237 case UIMSG_Cancel: | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2541
diff
changeset
|
238 new OnCancel3(pGUIWindow_CurrentMenu->uFrameX + 350, pGUIWindow_CurrentMenu->uFrameY + 302, 61, 28, (int)pBtnCancel, 0); |
2541 | 239 break; |
240 case UIMSG_ArrowUp: | |
241 --pSaveListPosition; | |
242 if (pSaveListPosition < 0) | |
243 pSaveListPosition = 0; | |
244 pWindow = pGUIWindow_CurrentMenu; | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2541
diff
changeset
|
245 new OnButtonClick2(pWindow->uFrameX + 215, pGUIWindow_CurrentMenu->uFrameY + 197, 0, 0, (int)pBtnArrowUp, 0); |
2541 | 246 break; |
247 case UIMSG_AD: | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2541
diff
changeset
|
248 new OnButtonClick2(pMainMenu_BtnNew->uX, pMainMenu_BtnNew->uY, 0, 0, (int)pMainMenu_BtnNew, 0); |
2541 | 249 SetCurrentMenuID(MENU_LoadingProcInMainMenu); |
250 break; | |
251 case UIMSG_AE: | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2541
diff
changeset
|
252 new OnButtonClick2(pMainMenu_BtnExit->uX, pMainMenu_BtnExit->uY, 0, 0, (int)pMainMenu_BtnExit, 0); |
2541 | 253 SetCurrentMenuID(MENU_DebugBLVLevel); |
254 break; | |
255 case UIMSG_Escape: | |
256 if (pModalWindow) | |
257 { | |
2547 | 258 pModalWindow->Release(); |
259 pModalWindow = nullptr; | |
2541 | 260 break; |
261 } | |
262 if (!(dword_6BE364_game_settings_1 & GAME_SETTINGS_4000)) | |
263 break; | |
264 v15 = 1; | |
265 pMediaPlayer->bStopBeforeSchedule = 1; | |
266 viewparams->bRedrawGameUI = 1; | |
267 viewparams->field_48 = 1; | |
268 if (GetCurrentMenuID() == MENU_MAIN || GetCurrentMenuID() == MENU_MMT_MAIN_MENU | |
269 || GetCurrentMenuID() == MENU_CREATEPARTY || GetCurrentMenuID() == MENU_NAMEPANELESC) | |
270 { | |
271 //if ( current_screen_type == SCREEN_VIDEO ) | |
272 //pVideoPlayer->FastForwardToFrame(pVideoPlayer->pResetflag); | |
273 if (GetCurrentMenuID() == MENU_NAMEPANELESC) //èç ïàíåëè èçìåíåíèÿ èìåíè | |
274 { | |
275 SetCurrentMenuID(MENU_CREATEPARTY);//â îêíî ñîçäàíèÿ ãðóïïû | |
276 break; | |
277 } | |
278 if (GetCurrentMenuID() == MENU_CREDITSPROC) //èç îêíà Ñîçäàòåëè | |
279 { | |
280 SetCurrentMenuID(MENU_CREDITSCLOSE);//â çàêðûòèå Ñîçäàòåëè | |
281 break; | |
282 } | |
283 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_ChangeGameState, 0, 0); | |
284 break; | |
285 } | |
286 if (GetCurrentMenuID() == MENU_CREDITSPROC && !current_screen_type) | |
287 { | |
288 //if ( current_screen_type == SCREEN_VIDEO ) | |
289 //pVideoPlayer->FastForwardToFrame(pVideoPlayer->pResetflag); | |
290 if (GetCurrentMenuID() == MENU_NAMEPANELESC) | |
291 { | |
292 SetCurrentMenuID(MENU_CREATEPARTY); | |
293 break; | |
294 } | |
295 if (GetCurrentMenuID() == MENU_CREDITSPROC) | |
296 { | |
297 SetCurrentMenuID(MENU_CREDITSCLOSE); | |
298 break; | |
299 } | |
300 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_ChangeGameState, 0, 0); | |
301 break; | |
302 } | |
303 if (current_screen_type == SCREEN_LOADGAME) | |
304 { | |
305 pIcons_LOD->RemoveTexturesPackFromTextureList(); | |
306 //crt_deconstruct_ptr_6A0118(); | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2541
diff
changeset
|
307 main_menu_background.Release(); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2541
diff
changeset
|
308 main_menu_background.Load("title.pcx", 0); |
2541 | 309 SetCurrentMenuID(MENU_MAIN); |
310 v15 = 1; | |
311 pGUIWindow_CurrentMenu->Release(); | |
312 pGUIWindow2->Release(); | |
313 pGUIWindow2 = 0; | |
314 pEventTimer->Resume(); | |
315 current_screen_type = SCREEN_GAME; | |
316 viewparams->bRedrawGameUI = v15; | |
317 break; | |
318 } | |
319 if (current_screen_type == SCREEN_VIDEO) | |
320 { | |
321 //pVideoPlayer->Unload(); | |
322 } | |
323 else | |
324 { | |
325 if (current_screen_type != SCREEN_1B) | |
326 { | |
327 pGUIWindow_CurrentMenu->Release(); | |
328 pGUIWindow2->Release(); | |
329 pGUIWindow2 = 0; | |
330 pEventTimer->Resume(); | |
331 current_screen_type = SCREEN_GAME; | |
332 viewparams->bRedrawGameUI = v15; | |
333 break; | |
334 } | |
335 //VideoPlayer::dtor(); | |
336 } | |
337 break; | |
338 default: | |
339 break; | |
340 } | |
341 } while (pMessageQueue_50CBD0->uNumMessages); | |
342 } | |
343 } | |
344 | |
345 | |
346 //----- (004627B7) -------------------------------------------------------- | |
347 void MainMenu_Loop() | |
348 { | |
349 GUIButton *pButton; // eax@27 | |
350 unsigned int pControlParam; // ecx@35 | |
351 unsigned int pY; // [sp-18h] [bp-54h]@39 | |
352 Texture *pTexture; // [sp-14h] [bp-50h]@39 | |
353 GUIWindow *pWindow; // [sp+4h] [bp-38h]@11 | |
354 MSG msg; | |
355 | |
356 current_screen_type = SCREEN_GAME; | |
357 | |
358 pGUIWindow2 = 0; | |
359 pAudioPlayer->StopChannels(-1, -1); | |
360 pMouse->RemoveHoldingItem(); | |
361 | |
362 pIcons_LOD->_inlined_sub2(); | |
363 | |
2551
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2547
diff
changeset
|
364 pWindow_MainMenu = new GUIWindow_MainMenu(); |
2541 | 365 |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2541
diff
changeset
|
366 main_menu_background.Release(); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2541
diff
changeset
|
367 main_menu_background.Load("title.pcx", 0); |
2541 | 368 SetCurrentMenuID(MENU_MAIN); |
369 SetForegroundWindow(window->GetApiHandle()); | |
370 SendMessageW(window->GetApiHandle(), WM_ACTIVATEAPP, 1, 0); | |
371 while (GetCurrentMenuID() == MENU_MAIN || GetCurrentMenuID() == MENU_SAVELOAD) | |
372 { | |
373 POINT pt; | |
374 pMouse->GetCursorPos(&pt); | |
375 pWindow = pWindow_MainMenu; | |
376 if (GetCurrentMenuID() == MENU_SAVELOAD) | |
377 { | |
378 if (current_screen_type != SCREEN_LOADGAME) | |
379 { | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2541
diff
changeset
|
380 main_menu_background.Release(); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2541
diff
changeset
|
381 main_menu_background.Load("lsave640.pcx", 0); |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2541
diff
changeset
|
382 pGUIWindow2 = new GUIWindow(0, 0, window->GetWidth(), window->GetHeight(), 0, 0); |
2547 | 383 |
384 //LoadUI_Load(0); | |
385 pGUIWindow_CurrentMenu = new GUIWindow_Load(false); | |
2541 | 386 } |
387 pWindow = pGUIWindow_CurrentMenu; | |
388 } | |
389 | |
390 while (PeekMessageW(&msg, 0, 0, 0, PM_REMOVE)) | |
391 { | |
392 if (msg.message == WM_QUIT) | |
393 Engine_DeinitializeAndTerminate(0); | |
394 TranslateMessage(&msg); | |
395 DispatchMessageW(&msg); | |
396 } | |
397 | |
398 if (dword_6BE364_game_settings_1 & GAME_SETTINGS_APP_INACTIVE) | |
399 { | |
400 WaitMessage(); | |
401 continue; | |
402 } | |
403 | |
404 pRenderer->BeginScene(); | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2541
diff
changeset
|
405 pRenderer->DrawTextureNew(0, 0, &main_menu_background); |
2541 | 406 |
407 MainMenu_EventLoop(); | |
408 GUI_UpdateWindows(); | |
409 | |
410 pRenderer->EndScene(); | |
411 pRenderer->Present(); | |
412 } | |
2551
4008b2f34be0
MainMenu rendering moved from event loop to respective window class
a.parshin
parents:
2547
diff
changeset
|
413 |
2541 | 414 MainMenu_EventLoop(); |
415 pRenderer->BeginScene(); | |
416 GUI_UpdateWindows(); | |
417 pRenderer->EndScene(); | |
418 pRenderer->Present(); | |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2541
diff
changeset
|
419 main_menu_background.Release(); |
2541 | 420 if (pGUIWindow2) |
421 { | |
422 pGUIWindow2->Release(); | |
423 pGUIWindow2 = 0; | |
424 } | |
425 pWindow_MainMenu->Release(); | |
426 pIcons_LOD->RemoveTexturesPackFromTextureList(); | |
427 } |