Mercurial > mm7
comparison Game/MainMenu.cpp @ 2544:c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
author | a.parshin |
---|---|
date | Mon, 11 May 2015 09:51:04 +0200 |
parents | a902abdfc7f2 |
children | fed97f15d1e1 |
comparison
equal
deleted
inserted
replaced
2543:b6140dfeac27 | 2544:c674d547cc7c |
---|---|
14 #include "GUI/UI/UIPartyCreation.h" | 14 #include "GUI/UI/UIPartyCreation.h" |
15 | 15 |
16 #include "Media/Audio/AudioPlayer.h" | 16 #include "Media/Audio/AudioPlayer.h" |
17 | 17 |
18 #include "Game/MainMenu.h" | 18 #include "Game/MainMenu.h" |
19 | |
20 | |
21 GUIButton *pMainMenu_BtnExit = nullptr; | |
22 GUIButton *pMainMenu_BtnCredits = nullptr; | |
23 GUIButton *pMainMenu_BtnLoad = nullptr; | |
24 GUIButton *pMainMenu_BtnNew = nullptr; | |
25 | |
26 RGBTexture main_menu_background; | |
27 | |
19 | 28 |
20 | 29 |
21 //----- (00435748) -------------------------------------------------------- | 30 //----- (00435748) -------------------------------------------------------- |
22 void MainMenu_EventLoop() | 31 void MainMenu_EventLoop() |
23 { | 32 { |
49 //auto player = &pParty->pPlayers[pParam]; | 58 //auto player = &pParty->pPlayers[pParam]; |
50 | 59 |
51 switch (pUIMessageType) // For buttons of window MainMenu | 60 switch (pUIMessageType) // For buttons of window MainMenu |
52 { | 61 { |
53 case UIMSG_MainMenu_ShowPartyCreationWnd: | 62 case UIMSG_MainMenu_ShowPartyCreationWnd: |
54 GUIWindow::Create(495, 172, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnNew, 0); | 63 new OnButtonClick2(495, 172, 0, 0, (int)pMainMenu_BtnNew, 0); |
55 SetCurrentMenuID(MENU_NEWGAME); | 64 SetCurrentMenuID(MENU_NEWGAME); |
56 break; | 65 break; |
57 case UIMSG_MainMenu_ShowLoadWindow: | 66 case UIMSG_MainMenu_ShowLoadWindow: |
58 GUIWindow::Create(495, 227, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnLoad, 0); | 67 new OnButtonClick2(495, 227, 0, 0, (int)pMainMenu_BtnLoad, 0); |
59 SetCurrentMenuID(MENU_SAVELOAD); | 68 SetCurrentMenuID(MENU_SAVELOAD); |
60 break; | 69 break; |
61 case UIMSG_ShowCredits: | 70 case UIMSG_ShowCredits: |
62 GUIWindow::Create(495, 282, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnCredits, 0); | 71 new OnButtonClick2(495, 282, 0, 0, (int)pMainMenu_BtnCredits, 0); |
63 SetCurrentMenuID(MENU_CREDITS); | 72 SetCurrentMenuID(MENU_CREDITS); |
64 break; | 73 break; |
65 case UIMSG_ExitToWindows: | 74 case UIMSG_ExitToWindows: |
66 GUIWindow::Create(495, 337, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnExit, 0); | 75 new OnButtonClick2(495, 337, 0, 0, (int)pMainMenu_BtnExit, 0); |
67 SetCurrentMenuID(MENU_EXIT_GAME); | 76 SetCurrentMenuID(MENU_EXIT_GAME); |
68 break; | 77 break; |
69 case UIMSG_PlayerCreation_SelectAttribute: | 78 case UIMSG_PlayerCreation_SelectAttribute: |
70 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) | 79 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) |
71 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam; | 80 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam; |
79 if (pParty->pPlayers[pParam].uVoiceID == 0) | 88 if (pParty->pPlayers[pParam].uVoiceID == 0) |
80 pParty->pPlayers[pParam].uVoiceID = 19; | 89 pParty->pPlayers[pParam].uVoiceID = 19; |
81 else --pParty->pPlayers[pParam].uVoiceID; | 90 else --pParty->pPlayers[pParam].uVoiceID; |
82 } while (pParty->pPlayers[pParam].GetSexByVoice() != pSex); | 91 } while (pParty->pPlayers[pParam].GetSexByVoice() != pSex); |
83 pButton = pCreationUI_BtnPressLeft2[pParam]; | 92 pButton = pCreationUI_BtnPressLeft2[pParam]; |
84 GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_PressedButton, (int)pButton, (char *)1); | 93 new OnButtonClick(pButton->uX, pButton->uY, 0, 0, (int)pButton, (char *)1); |
85 pAudioPlayer->PlaySound(SOUND_SelectingANewCharacter, 0, 0, -1, 0, 0, 0, 0); | 94 pAudioPlayer->PlaySound(SOUND_SelectingANewCharacter, 0, 0, -1, 0, 0, 0, 0); |
86 pParty->pPlayers[pParam].PlaySound(SPEECH_PickMe, 0); | 95 pParty->pPlayers[pParam].PlaySound(SPEECH_PickMe, 0); |
87 break; | 96 break; |
88 case UIMSG_PlayerCreation_VoiceNext: | 97 case UIMSG_PlayerCreation_VoiceNext: |
89 pSex = pParty->pPlayers[pParam].GetSexByVoice(); | 98 pSex = pParty->pPlayers[pParam].GetSexByVoice(); |
90 do | 99 do |
91 { | 100 { |
92 pParty->pPlayers[pParam].uVoiceID = (pParty->pPlayers[pParam].uVoiceID + 1) % 20; | 101 pParty->pPlayers[pParam].uVoiceID = (pParty->pPlayers[pParam].uVoiceID + 1) % 20; |
93 } while (pParty->pPlayers[pParam].GetSexByVoice() != pSex); | 102 } while (pParty->pPlayers[pParam].GetSexByVoice() != pSex); |
94 pButton = pCreationUI_BtnPressRight2[pParam]; | 103 pButton = pCreationUI_BtnPressRight2[pParam]; |
95 GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_PressedButton, (int)pButton, (char *)1); | 104 new OnButtonClick(pButton->uX, pButton->uY, 0, 0, (int)pButton, (char *)1); |
96 pAudioPlayer->PlaySound(SOUND_SelectingANewCharacter, 0, 0, -1, 0, 0, 0, 0); | 105 pAudioPlayer->PlaySound(SOUND_SelectingANewCharacter, 0, 0, -1, 0, 0, 0, 0); |
97 pParty->pPlayers[pParam].PlaySound(SPEECH_PickMe, 0); | 106 pParty->pPlayers[pParam].PlaySound(SPEECH_PickMe, 0); |
98 break; | 107 break; |
99 case UIMSG_PlayerCreation_FacePrev: | 108 case UIMSG_PlayerCreation_FacePrev: |
100 //pPlayer = &pParty->pPlayers[pParam]; | 109 //pPlayer = &pParty->pPlayers[pParam]; |
108 pParty->pPlayers[pParam].RandomizeName(); | 117 pParty->pPlayers[pParam].RandomizeName(); |
109 v25 = pParam; | 118 v25 = pParam; |
110 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) | 119 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) |
111 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam; | 120 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam; |
112 uPlayerCreationUI_SelectedCharacter = v25; | 121 uPlayerCreationUI_SelectedCharacter = v25; |
113 GUIWindow::Create(pCreationUI_BtnPressLeft[v25]->uX, pCreationUI_BtnPressLeft[v25]->uY, 0, 0, WINDOW_PressedButton, (int)pCreationUI_BtnPressLeft[v25], (char *)1); | 122 new OnButtonClick(pCreationUI_BtnPressLeft[v25]->uX, pCreationUI_BtnPressLeft[v25]->uY, 0, 0, (int)pCreationUI_BtnPressLeft[v25], (char *)1); |
114 pAudioPlayer->PlaySound(SOUND_SelectingANewCharacter, 0, 0, -1, 0, 0, 0.0, 0); | 123 pAudioPlayer->PlaySound(SOUND_SelectingANewCharacter, 0, 0, -1, 0, 0, 0.0, 0); |
115 pParty->pPlayers[pParam].PlaySound(SPEECH_PickMe, 0); | 124 pParty->pPlayers[pParam].PlaySound(SPEECH_PickMe, 0); |
116 break; | 125 break; |
117 case UIMSG_PlayerCreation_FaceNext: | 126 case UIMSG_PlayerCreation_FaceNext: |
118 //pPlayer = &pParty->pPlayers[pParam]; | 127 //pPlayer = &pParty->pPlayers[pParam]; |
124 pParty->pPlayers[pParam].RandomizeName(); | 133 pParty->pPlayers[pParam].RandomizeName(); |
125 v21 = pParam; | 134 v21 = pParam; |
126 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) | 135 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) |
127 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam; | 136 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam; |
128 uPlayerCreationUI_SelectedCharacter = v21; | 137 uPlayerCreationUI_SelectedCharacter = v21; |
129 GUIWindow::Create(pCreationUI_BtnPressRight[v21]->uX, pCreationUI_BtnPressRight[v21]->uY, 0, 0, WINDOW_PressedButton, (int)pCreationUI_BtnPressRight[v21], (char *)1); | 138 new OnButtonClick(pCreationUI_BtnPressRight[v21]->uX, pCreationUI_BtnPressRight[v21]->uY, 0, 0, (int)pCreationUI_BtnPressRight[v21], (char *)1); |
130 pAudioPlayer->PlaySound(SOUND_SelectingANewCharacter, 0, 0, -1, 0, 0, 0, 0); | 139 pAudioPlayer->PlaySound(SOUND_SelectingANewCharacter, 0, 0, -1, 0, 0, 0, 0); |
131 pParty->pPlayers[pParam].PlaySound(SPEECH_PickMe, 0); | 140 pParty->pPlayers[pParam].PlaySound(SPEECH_PickMe, 0); |
132 break; | 141 break; |
133 case UIMSG_PlayerCreationClickPlus: | 142 case UIMSG_PlayerCreationClickPlus: |
134 GUIWindow::Create(613, 393, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnPlus, (char *)1); | 143 new OnButtonClick2(613, 393, 0, 0, (int)pPlayerCreationUI_BtnPlus, (char *)1); |
135 pPlayer[uPlayerCreationUI_SelectedCharacter].IncreaseAttribute((pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7); | 144 pPlayer[uPlayerCreationUI_SelectedCharacter].IncreaseAttribute((pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7); |
136 pAudioPlayer->PlaySound(SOUND_ClickMinus, 0, 0, -1, 0, 0, 0, 0); | 145 pAudioPlayer->PlaySound(SOUND_ClickMinus, 0, 0, -1, 0, 0, 0, 0); |
137 break; | 146 break; |
138 case UIMSG_PlayerCreationClickMinus: | 147 case UIMSG_PlayerCreationClickMinus: |
139 GUIWindow::Create(523, 393, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnMinus, (char *)1); | 148 new OnButtonClick2(523, 393, 0, 0, (int)pPlayerCreationUI_BtnMinus, (char *)1); |
140 pPlayer[uPlayerCreationUI_SelectedCharacter].DecreaseAttribute((pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7); | 149 pPlayer[uPlayerCreationUI_SelectedCharacter].DecreaseAttribute((pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7); |
141 pAudioPlayer->PlaySound(SOUND_ClickPlus, 0, 0, -1, 0, 0, 0, 0); | 150 pAudioPlayer->PlaySound(SOUND_ClickPlus, 0, 0, -1, 0, 0, 0, 0); |
142 break; | 151 break; |
143 case UIMSG_PlayerCreationSelectActiveSkill: | 152 case UIMSG_PlayerCreationSelectActiveSkill: |
144 if (pPlayer[uPlayerCreationUI_SelectedCharacter].GetSkillIdxByOrder(3) == 37) | 153 if (pPlayer[uPlayerCreationUI_SelectedCharacter].GetSkillIdxByOrder(3) == 37) |
148 case UIMSG_PlayerCreationSelectClass: | 157 case UIMSG_PlayerCreationSelectClass: |
149 pPlayer[uPlayerCreationUI_SelectedCharacter].Reset((PLAYER_CLASS_TYPE)pParam); | 158 pPlayer[uPlayerCreationUI_SelectedCharacter].Reset((PLAYER_CLASS_TYPE)pParam); |
150 pAudioPlayer->PlaySound(SOUND_SelectingANewCharacter, 0, 0, -1, 0, 0, 0, 0); | 159 pAudioPlayer->PlaySound(SOUND_SelectingANewCharacter, 0, 0, -1, 0, 0, 0, 0); |
151 break; | 160 break; |
152 case UIMSG_PlayerCreationClickOK: | 161 case UIMSG_PlayerCreationClickOK: |
153 GUIWindow::Create(580, 431, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnOK, 0); | 162 new OnButtonClick2(580, 431, 0, 0, (int)pPlayerCreationUI_BtnOK, 0); |
154 if (PlayerCreation_GetUnspentAttributePointCount() || !PlayerCreation_Choose4Skills()) | 163 if (PlayerCreation_GetUnspentAttributePointCount() || !PlayerCreation_Choose4Skills()) |
155 GameUI_Footer_TimeLeft = GetTickCount() + 4000; | 164 GameUI_Footer_TimeLeft = GetTickCount() + 4000; |
156 else | 165 else |
157 uGameState = GAME_STATE_STARTING_NEW_GAME; | 166 uGameState = GAME_STATE_STARTING_NEW_GAME; |
158 break; | 167 break; |
159 case UIMSG_PlayerCreationClickReset: | 168 case UIMSG_PlayerCreationClickReset: |
160 GUIWindow::Create(527, 431, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnReset, 0); | 169 new OnButtonClick2(527, 431, 0, 0, (int)pPlayerCreationUI_BtnReset, 0); |
161 pParty->Reset(); | 170 pParty->Reset(); |
162 break; | 171 break; |
163 case UIMSG_PlayerCreationRemoveUpSkill: | 172 case UIMSG_PlayerCreationRemoveUpSkill: |
164 v4 = pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem; | 173 v4 = pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem; |
165 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = v4 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam; | 174 pGUIWindow_CurrentMenu->pCurrentPosActiveItem = v4 % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam; |
216 strcpy(pKeyActionMap->pPressedKeysBuffer, pSavegameHeader[uLoadGameUI_SelectedSlot].pName); | 225 strcpy(pKeyActionMap->pPressedKeysBuffer, pSavegameHeader[uLoadGameUI_SelectedSlot].pName); |
217 pKeyActionMap->uNumKeysPressed = strlen(pKeyActionMap->pPressedKeysBuffer); | 226 pKeyActionMap->uNumKeysPressed = strlen(pKeyActionMap->pPressedKeysBuffer); |
218 } | 227 } |
219 break; | 228 break; |
220 case UIMSG_SaveLoadBtn: | 229 case UIMSG_SaveLoadBtn: |
221 GUIWindow::Create(pGUIWindow_CurrentMenu->uFrameX + 241, pGUIWindow_CurrentMenu->uFrameY + 302, 61, 28, WINDOW_SaveLoadBtn, (int)pBtnLoadSlot, 0); | 230 new OnSaveLoad(pGUIWindow_CurrentMenu->uFrameX + 241, pGUIWindow_CurrentMenu->uFrameY + 302, 61, 28, (int)pBtnLoadSlot, 0); |
222 break; | 231 break; |
223 case UIMSG_DownArrow: | 232 case UIMSG_DownArrow: |
224 ++pSaveListPosition; | 233 ++pSaveListPosition; |
225 if (pSaveListPosition >= pParam) | 234 if (pSaveListPosition >= pParam) |
226 pSaveListPosition = pParam - 1; | 235 pSaveListPosition = pParam - 1; |
227 if (pSaveListPosition < 1) | 236 if (pSaveListPosition < 1) |
228 pSaveListPosition = 0; | 237 pSaveListPosition = 0; |
229 pWindow = pGUIWindow_CurrentMenu; | 238 pWindow = pGUIWindow_CurrentMenu; |
230 GUIWindow::Create(pWindow->uFrameX + 215, pGUIWindow_CurrentMenu->uFrameY + 323, 0, 0, WINDOW_PressedButton2, (int)pBtnDownArrow, 0); | 239 new OnButtonClick2(pWindow->uFrameX + 215, pGUIWindow_CurrentMenu->uFrameY + 323, 0, 0, (int)pBtnDownArrow, 0); |
231 break; | 240 break; |
232 case UIMSG_Cancel: | 241 case UIMSG_Cancel: |
233 GUIWindow::Create(pGUIWindow_CurrentMenu->uFrameX + 350, pGUIWindow_CurrentMenu->uFrameY + 302, 61, 28, WINDOW_LoadGame_CancelBtn, (int)pBtnCancel, 0); | 242 new OnCancel3(pGUIWindow_CurrentMenu->uFrameX + 350, pGUIWindow_CurrentMenu->uFrameY + 302, 61, 28, (int)pBtnCancel, 0); |
234 break; | 243 break; |
235 case UIMSG_ArrowUp: | 244 case UIMSG_ArrowUp: |
236 --pSaveListPosition; | 245 --pSaveListPosition; |
237 if (pSaveListPosition < 0) | 246 if (pSaveListPosition < 0) |
238 pSaveListPosition = 0; | 247 pSaveListPosition = 0; |
239 pWindow = pGUIWindow_CurrentMenu; | 248 pWindow = pGUIWindow_CurrentMenu; |
240 GUIWindow::Create(pWindow->uFrameX + 215, pGUIWindow_CurrentMenu->uFrameY + 197, 0, 0, WINDOW_PressedButton2, (int)pBtnArrowUp, 0); | 249 new OnButtonClick2(pWindow->uFrameX + 215, pGUIWindow_CurrentMenu->uFrameY + 197, 0, 0, (int)pBtnArrowUp, 0); |
241 break; | 250 break; |
242 case UIMSG_AD: | 251 case UIMSG_AD: |
243 GUIWindow::Create(pMainMenu_BtnNew->uX, pMainMenu_BtnNew->uY, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnNew, 0); | 252 new OnButtonClick2(pMainMenu_BtnNew->uX, pMainMenu_BtnNew->uY, 0, 0, (int)pMainMenu_BtnNew, 0); |
244 SetCurrentMenuID(MENU_LoadingProcInMainMenu); | 253 SetCurrentMenuID(MENU_LoadingProcInMainMenu); |
245 break; | 254 break; |
246 case UIMSG_AE: | 255 case UIMSG_AE: |
247 GUIWindow::Create(pMainMenu_BtnExit->uX, pMainMenu_BtnExit->uY, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnExit, 0); | 256 new OnButtonClick2(pMainMenu_BtnExit->uX, pMainMenu_BtnExit->uY, 0, 0, (int)pMainMenu_BtnExit, 0); |
248 SetCurrentMenuID(MENU_DebugBLVLevel); | 257 SetCurrentMenuID(MENU_DebugBLVLevel); |
249 break; | 258 break; |
250 case UIMSG_Escape: | 259 case UIMSG_Escape: |
251 if (pModalWindow) | 260 if (pModalWindow) |
252 { | 261 { |
296 } | 305 } |
297 if (current_screen_type == SCREEN_LOADGAME) | 306 if (current_screen_type == SCREEN_LOADGAME) |
298 { | 307 { |
299 pIcons_LOD->RemoveTexturesPackFromTextureList(); | 308 pIcons_LOD->RemoveTexturesPackFromTextureList(); |
300 //crt_deconstruct_ptr_6A0118(); | 309 //crt_deconstruct_ptr_6A0118(); |
301 pTexture_PCX.Release(); | 310 main_menu_background.Release(); |
302 pTexture_PCX.Load("title.pcx", 0); | 311 main_menu_background.Load("title.pcx", 0); |
303 SetCurrentMenuID(MENU_MAIN); | 312 SetCurrentMenuID(MENU_MAIN); |
304 v15 = 1; | 313 v15 = 1; |
305 pGUIWindow_CurrentMenu->Release(); | 314 pGUIWindow_CurrentMenu->Release(); |
306 pGUIWindow2->Release(); | 315 pGUIWindow2->Release(); |
307 pGUIWindow2 = 0; | 316 pGUIWindow2 = 0; |
353 pAudioPlayer->StopChannels(-1, -1); | 362 pAudioPlayer->StopChannels(-1, -1); |
354 pMouse->RemoveHoldingItem(); | 363 pMouse->RemoveHoldingItem(); |
355 | 364 |
356 pIcons_LOD->_inlined_sub2(); | 365 pIcons_LOD->_inlined_sub2(); |
357 | 366 |
358 pWindow_MainMenu = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_MainMenu, 0, 0); | 367 pWindow_MainMenu = new GUIWindow(0, 0, window->GetWidth(), window->GetHeight(), 0, 0); |
359 Texture* pNew = pIcons_LOD->LoadTexturePtr("title_new", TEXTURE_16BIT_PALETTE); | 368 Texture* pNew = pIcons_LOD->LoadTexturePtr("title_new", TEXTURE_16BIT_PALETTE); |
360 Texture* pLoad = pIcons_LOD->LoadTexturePtr("title_load", TEXTURE_16BIT_PALETTE); | 369 Texture* pLoad = pIcons_LOD->LoadTexturePtr("title_load", TEXTURE_16BIT_PALETTE); |
361 Texture* pCredits = pIcons_LOD->LoadTexturePtr("title_cred", TEXTURE_16BIT_PALETTE); | 370 Texture* pCredits = pIcons_LOD->LoadTexturePtr("title_cred", TEXTURE_16BIT_PALETTE); |
362 Texture* pExit = pIcons_LOD->LoadTexturePtr("title_exit", TEXTURE_16BIT_PALETTE); | 371 Texture* pExit = pIcons_LOD->LoadTexturePtr("title_exit", TEXTURE_16BIT_PALETTE); |
363 | 372 |
364 pMainMenu_BtnNew = pWindow_MainMenu->CreateButton(495, 172, pNew->uTextureWidth, pNew->uTextureHeight, 1, 0, UIMSG_MainMenu_ShowPartyCreationWnd, 0, 'N', "", pNew, 0); | 373 pMainMenu_BtnNew = pWindow_MainMenu->CreateButton(495, 172, pNew->uTextureWidth, pNew->uTextureHeight, 1, 0, UIMSG_MainMenu_ShowPartyCreationWnd, 0, 'N', "", pNew, 0); |
365 pMainMenu_BtnLoad = pWindow_MainMenu->CreateButton(495, 227, pLoad->uTextureWidth, pLoad->uTextureHeight, 1, 0, UIMSG_MainMenu_ShowLoadWindow, 1, 'L', "", pLoad, 0); | 374 pMainMenu_BtnLoad = pWindow_MainMenu->CreateButton(495, 227, pLoad->uTextureWidth, pLoad->uTextureHeight, 1, 0, UIMSG_MainMenu_ShowLoadWindow, 1, 'L', "", pLoad, 0); |
366 pMainMenu_BtnCredits = pWindow_MainMenu->CreateButton(495, 282, pCredits->uTextureWidth, pCredits->uTextureHeight, 1, 0, UIMSG_ShowCredits, 2, 'C', "", pCredits, 0); | 375 pMainMenu_BtnCredits = pWindow_MainMenu->CreateButton(495, 282, pCredits->uTextureWidth, pCredits->uTextureHeight, 1, 0, UIMSG_ShowCredits, 2, 'C', "", pCredits, 0); |
367 pMainMenu_BtnExit = pWindow_MainMenu->CreateButton(495, 337, pExit->uTextureWidth, pExit->uTextureHeight, 1, 0, UIMSG_ExitToWindows, 3, 0, "", pExit, 0); | 376 pMainMenu_BtnExit = pWindow_MainMenu->CreateButton(495, 337, pExit->uTextureWidth, pExit->uTextureHeight, 1, 0, UIMSG_ExitToWindows, 3, 0, "", pExit, 0); |
368 | 377 |
369 pTexture_PCX.Release(); | 378 main_menu_background.Release(); |
370 pTexture_PCX.Load("title.pcx", 0); | 379 main_menu_background.Load("title.pcx", 0); |
371 SetCurrentMenuID(MENU_MAIN); | 380 SetCurrentMenuID(MENU_MAIN); |
372 SetForegroundWindow(window->GetApiHandle()); | 381 SetForegroundWindow(window->GetApiHandle()); |
373 SendMessageW(window->GetApiHandle(), WM_ACTIVATEAPP, 1, 0); | 382 SendMessageW(window->GetApiHandle(), WM_ACTIVATEAPP, 1, 0); |
374 while (GetCurrentMenuID() == MENU_MAIN || GetCurrentMenuID() == MENU_SAVELOAD) | 383 while (GetCurrentMenuID() == MENU_MAIN || GetCurrentMenuID() == MENU_SAVELOAD) |
375 { | 384 { |
378 pWindow = pWindow_MainMenu; | 387 pWindow = pWindow_MainMenu; |
379 if (GetCurrentMenuID() == MENU_SAVELOAD) | 388 if (GetCurrentMenuID() == MENU_SAVELOAD) |
380 { | 389 { |
381 if (current_screen_type != SCREEN_LOADGAME) | 390 if (current_screen_type != SCREEN_LOADGAME) |
382 { | 391 { |
383 pTexture_PCX.Release(); | 392 main_menu_background.Release(); |
384 pTexture_PCX.Load("lsave640.pcx", 0); | 393 main_menu_background.Load("lsave640.pcx", 0); |
385 pGUIWindow2 = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_MainMenu, 0, 0); | 394 pGUIWindow2 = new GUIWindow(0, 0, window->GetWidth(), window->GetHeight(), 0, 0); |
386 current_screen_type = SCREEN_LOADGAME; | 395 current_screen_type = SCREEN_LOADGAME; |
387 LoadUI_Load(0); | 396 LoadUI_Load(0); |
388 } | 397 } |
389 pWindow = pGUIWindow_CurrentMenu; | 398 pWindow = pGUIWindow_CurrentMenu; |
390 } | 399 } |
402 WaitMessage(); | 411 WaitMessage(); |
403 continue; | 412 continue; |
404 } | 413 } |
405 | 414 |
406 pRenderer->BeginScene(); | 415 pRenderer->BeginScene(); |
407 pRenderer->DrawTextureNew(0, 0, &pTexture_PCX); | 416 pRenderer->DrawTextureNew(0, 0, &main_menu_background); |
408 | 417 |
409 MainMenu_EventLoop(); | 418 MainMenu_EventLoop(); |
410 GUI_UpdateWindows(); | 419 GUI_UpdateWindows(); |
411 | 420 |
412 if (GetCurrentMenuID() != MENU_MAIN) | 421 if (GetCurrentMenuID() != MENU_MAIN) |
462 MainMenu_EventLoop(); | 471 MainMenu_EventLoop(); |
463 pRenderer->BeginScene(); | 472 pRenderer->BeginScene(); |
464 GUI_UpdateWindows(); | 473 GUI_UpdateWindows(); |
465 pRenderer->EndScene(); | 474 pRenderer->EndScene(); |
466 pRenderer->Present(); | 475 pRenderer->Present(); |
467 pTexture_PCX.Release(); | 476 main_menu_background.Release(); |
468 if (pGUIWindow2) | 477 if (pGUIWindow2) |
469 { | 478 { |
470 pGUIWindow2->Release(); | 479 pGUIWindow2->Release(); |
471 pGUIWindow2 = 0; | 480 pGUIWindow2 = 0; |
472 } | 481 } |