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