Mercurial > mm7
comparison GUI/GUIWindow.cpp @ 2544:c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
author | a.parshin |
---|---|
date | Mon, 11 May 2015 09:51:04 +0200 |
parents | b6140dfeac27 |
children | e06a3fe9ad6e |
comparison
equal
deleted
inserted
replaced
2543:b6140dfeac27 | 2544:c674d547cc7c |
---|---|
59 {0x00, 0x80, 0xFF}, | 59 {0x00, 0x80, 0xFF}, |
60 {0x00, 0x80, 0xFF}, | 60 {0x00, 0x80, 0xFF}, |
61 {0x96, 0xD4, 0xFF}}}; | 61 {0x96, 0xD4, 0xFF}}}; |
62 | 62 |
63 | 63 |
64 int pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[1]; // idb | 64 enum WindowType current_character_screen_window; |
65 struct GUIWindow *pWindow_MMT_MainMenu; | 65 struct GUIWindow *pWindow_MMT_MainMenu; |
66 struct GUIWindow *pWindow_MainMenu; | 66 struct GUIWindow *pWindow_MainMenu; |
67 std::array<struct GUIWindow, 20> pWindowList; | 67 std::array<struct GUIWindow *, 20> pWindowList; |
68 | 68 |
69 struct GUIMessageQueue *pMessageQueue_50CBD0 = new GUIMessageQueue; | 69 struct GUIMessageQueue *pMessageQueue_50CBD0 = new GUIMessageQueue; |
70 struct GUIMessageQueue *pMessageQueue_50C9E8 = new GUIMessageQueue; | 70 struct GUIMessageQueue *pMessageQueue_50C9E8 = new GUIMessageQueue; |
71 | 71 |
72 | 72 |
73 | 73 |
74 | 74 |
75 | |
76 | |
77 GUIWindow_Inventory_CastSpell::GUIWindow_Inventory_CastSpell(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int button, const char *hint) : | |
78 GUIWindow(x, y, width, height, button, hint) | |
79 { | |
80 pMouse->SetCursorBitmap("MICON2"); | |
81 pBtn_ExitCancel = CreateButton(392, 318, 75, 33, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[34],//Отмена | |
82 pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0); | |
83 ShowStatusBarString(pGlobalTXT_LocalizationStrings[39], 2); // Choose target / Выбрать цель | |
84 ++pIcons_LOD->uTexturePacksCount; | |
85 current_character_screen_window = WINDOW_CharacterWindow_Inventory; | |
86 current_screen_type = SCREEN_CASTING; | |
87 if (!pIcons_LOD->uNumPrevLoadedFiles) | |
88 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; | |
89 } | |
90 | |
91 GUIWindow_House::GUIWindow_House(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int button, const char *hint) : | |
92 GUIWindow(x, y, width, height, button, hint) | |
93 { | |
94 current_screen_type = SCREEN_HOUSE; | |
95 pBtn_ExitCancel = CreateButton(471, 445, 169, 35, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[80], // Quit building / Выйти из здания | |
96 pIcons_LOD->GetTexture(uExitCancelTextureId), 0); | |
97 for (int v26 = 0; v26 < uNumDialogueNPCPortraits; ++v26) | |
98 { | |
99 char *v29, *v30; | |
100 if (v26 + 1 == uNumDialogueNPCPortraits && uHouse_ExitPic) | |
101 { | |
102 v30 = pMapStats->pInfos[uHouse_ExitPic].pName; | |
103 v29 = (char*)pGlobalTXT_LocalizationStrings[LOCSTR_ENTER_S]; | |
104 } | |
105 else | |
106 { | |
107 if (v26 || !dword_591080) | |
108 v30 = HouseNPCData[v26 + 1 - ((dword_591080 != 0) ? 1 : 0)]->pName; | |
109 else | |
110 v30 = (char*)p2DEvents[button - 1].pProprieterName; | |
111 v29 = (char*)pGlobalTXT_LocalizationStrings[435]; | |
112 } | |
113 sprintfex(byte_591180[v26].data(), v29, v30); | |
114 HouseNPCPortraitsButtonsList[v26] = CreateButton(pNPCPortraits_x[uNumDialogueNPCPortraits - 1][v26], | |
115 pNPCPortraits_y[uNumDialogueNPCPortraits - 1][v26], | |
116 63, 73, 1, 0, UIMSG_ClickHouseNPCPortrait, v26, 0, byte_591180[v26].data(), 0, 0, 0); | |
117 } | |
118 if (uNumDialogueNPCPortraits == 1) | |
119 { | |
120 window_SpeakInHouse = this; | |
121 _4B4224_UpdateNPCTopics(0); | |
122 } | |
123 } | |
124 | |
125 GUIWindow_Dialogue::GUIWindow_Dialogue(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int button, const char *hint) : | |
126 GUIWindow(x, y, width, height, button, hint) | |
127 { | |
128 prev_screen_type = current_screen_type; | |
129 current_screen_type = SCREEN_NPC_DIALOGUE; | |
130 pBtn_ExitCancel = CreateButton(0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], //"Exit" | |
131 pIcons_LOD->GetTexture(uExitCancelTextureId), 0); | |
132 if (par1C != 1) | |
133 { | |
134 int num_menu_buttons = 0; | |
135 int v11 = LOBYTE(pFontArrus->uFontHeight) - 3; | |
136 NPCData *speakingNPC = GetNPCData(sDialogue_SpeakingActorNPC_ID); | |
137 if (GetGreetType(sDialogue_SpeakingActorNPC_ID) == 1)//QuestsNPC_greet | |
138 { | |
139 if (speakingNPC->joins) | |
140 { | |
141 CreateButton(480, 130, 140, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0xDu, 0, "", 0); | |
142 num_menu_buttons = 1; | |
143 } | |
144 if (speakingNPC->evt_A) | |
145 { | |
146 if (num_menu_buttons < 4) | |
147 { | |
148 int v14 = NPC_EventProcessor(speakingNPC->evt_A); | |
149 if (v14 == 1 || v14 == 2) | |
150 CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x13u, 0, "", 0); | |
151 } | |
152 } | |
153 if (speakingNPC->evt_B) | |
154 { | |
155 if (num_menu_buttons < 4) | |
156 { | |
157 int v16 = NPC_EventProcessor(speakingNPC->evt_B); | |
158 if (v16 == 1 || v16 == 2) | |
159 CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x14u, 0, "", 0); | |
160 } | |
161 } | |
162 if (speakingNPC->evt_C) | |
163 { | |
164 if (num_menu_buttons < 4) | |
165 { | |
166 int v18 = NPC_EventProcessor(speakingNPC->evt_C); | |
167 if (v18 == 1 || v18 == 2) | |
168 CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x15u, 0, "", 0); | |
169 } | |
170 } | |
171 if (speakingNPC->evt_D) | |
172 { | |
173 if (num_menu_buttons < 4) | |
174 { | |
175 int v20 = NPC_EventProcessor(speakingNPC->evt_D); | |
176 if (v20 == 1 || v20 == 2) | |
177 CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x16u, 0, "", 0); | |
178 } | |
179 } | |
180 if (speakingNPC->evt_E) | |
181 { | |
182 if (num_menu_buttons < 4) | |
183 { | |
184 int v22 = NPC_EventProcessor(speakingNPC->evt_E); | |
185 if (v22 == 1 || v22 == 2) | |
186 CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x17u, 0, "", 0); | |
187 } | |
188 } | |
189 if (speakingNPC->evt_F) | |
190 { | |
191 if (num_menu_buttons < 4) | |
192 { | |
193 int v24 = NPC_EventProcessor(speakingNPC->evt_F); | |
194 if (v24 == 1 || v24 == 2) | |
195 CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x18u, 0, "", 0); | |
196 } | |
197 } | |
198 } | |
199 else | |
200 { | |
201 if (speakingNPC->joins) | |
202 { | |
203 CreateButton(0x1E0u, 0x82u, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x4Du, 0, pGlobalTXT_LocalizationStrings[407], 0);//Подробнее | |
204 if (speakingNPC->Hired()) | |
205 { | |
206 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[408], speakingNPC->pName); //Отпустить | |
207 CreateButton(0x1E0u, v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x4Cu, 0, pTmpBuf.data(), 0); | |
208 } | |
209 else | |
210 CreateButton(0x1E0u, v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x4Cu, 0, pGlobalTXT_LocalizationStrings[406], 0);//Нанять | |
211 num_menu_buttons = 2; | |
212 } | |
213 } | |
214 _41D08F_set_keyboard_control_group(num_menu_buttons, 1, 0, 1); | |
215 } | |
216 } | |
217 | |
218 GUIWindow_Travel::GUIWindow_Travel(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int button, const char *hint) : | |
219 GUIWindow(x, y, width, height, button, hint) | |
220 { | |
221 prev_screen_type = current_screen_type; | |
222 current_screen_type = SCREEN_CHANGE_LOCATION; | |
223 pBtn_ExitCancel = CreateButton(566, 445, 75, 33, 1, 0, UIMSG_CHANGE_LOCATION_ClickCencelBtn, 0, 'N', pGlobalTXT_LocalizationStrings[156], pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);// Stay in this area / Остаться в этой области | |
224 pBtn_YES = CreateButton(486, 445, 75, 33, 1, 0, UIMSG_OnTravelByFoot, 0, 'Y', hint, pIcons_LOD->GetTexture(uTextureID_BUTTYES2), 0); | |
225 CreateButton(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 63, 73, 1, 0, UIMSG_OnTravelByFoot, 1, ' ', hint, 0, 0, 0); | |
226 CreateButton(8, 8, 460, 344, 1, 0, UIMSG_OnTravelByFoot, 1, 0, hint, 0); | |
227 } | |
228 | |
229 GUIWindow_Transition::GUIWindow_Transition(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int button, const char *hint) : | |
230 GUIWindow(x, y, width, height, button, hint) | |
231 { | |
232 prev_screen_type = current_screen_type; | |
233 current_screen_type = SCREEN_INPUT_BLV; | |
234 pBtn_ExitCancel = CreateButton(0x236u, 0x1BDu, 0x4Bu, 0x21u, 1, 0, UIMSG_TransitionWindowCloseBtn, 0, 'N', pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0); // Cancel / Отмена | |
235 pBtn_YES = CreateButton(0x1E6u, 0x1BDu, 0x4Bu, 0x21u, 1, 0, UIMSG_TransitionUI_Confirm, 0, 'Y', hint, pIcons_LOD->GetTexture(uTextureID_BUTTYES2), 0); | |
236 CreateButton(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 0x3Fu, 0x49u, 1, 0, UIMSG_TransitionUI_Confirm, 1, 0x20u, hint, 0); | |
237 CreateButton(8, 8, 0x1CCu, 0x158u, 1, 0, UIMSG_TransitionUI_Confirm, 1u, 0, hint, 0); | |
238 } | |
239 | |
240 GUIWindow_Spellbook::GUIWindow_Spellbook(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int button, const char *hint) : | |
241 GUIWindow(x, y, width, height, button, hint) | |
242 { | |
243 InitializeBookTextures(); | |
244 OpenSpellBook(); | |
245 } | |
246 | |
247 GUIWindow_GenericDialogue::GUIWindow_GenericDialogue(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int button, const char *hint) : | |
248 GUIWindow(x, y, width, height, button, hint) | |
249 { | |
250 prev_screen_type = current_screen_type; | |
251 pKeyActionMap->EnterText(0, 15, this); | |
252 current_screen_type = SCREEN_BRANCHLESS_NPC_DIALOG; | |
253 } | |
254 | |
255 OnCastTargetedSpell::OnCastTargetedSpell(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int button, const char *hint) : | |
256 GUIWindow(x, y, width, height, button, hint) | |
257 { | |
258 pEventTimer->Pause(); | |
259 pAudioPlayer->StopChannels(-1, -1); | |
260 pMouse->SetCursorBitmap("MICON2"); | |
261 ShowStatusBarString(pGlobalTXT_LocalizationStrings[39], 2u); // ChooseTarget / Выберите цель | |
262 } | |
75 | 263 |
76 | 264 |
77 // inlined | 265 // inlined |
78 //----- (mm6c::00420520) -------------------------------------------------- | 266 //----- (mm6c::00420520) -------------------------------------------------- |
79 void GUIMessageQueue::Flush() | 267 void GUIMessageQueue::Flush() |
102 --this->uNumMessages; | 290 --this->uNumMessages; |
103 } | 291 } |
104 } | 292 } |
105 | 293 |
106 //----- (0041B4E1) -------------------------------------------------------- | 294 //----- (0041B4E1) -------------------------------------------------------- |
107 int __fastcall GUI_ReplaceHotkey(unsigned __int8 uOldHotkey, unsigned __int8 uNewHotkey, char bFirstCall) | 295 void GUI_ReplaceHotkey(unsigned __int8 uOldHotkey, unsigned __int8 uNewHotkey, char bFirstCall) |
108 { | 296 { |
109 int result; // eax@1 | |
110 int i; // edx@2 | 297 int i; // edx@2 |
111 GUIButton *j; // ecx@3 | 298 GUIButton *j; // ecx@3 |
112 int k; // edx@7 | 299 int k; // edx@7 |
113 GUIButton *l; // ecx@8 | 300 GUIButton *l; // ecx@8 |
114 unsigned __int8 v9; // [sp+4h] [bp-8h]@1 | 301 unsigned __int8 v9; // [sp+4h] [bp-8h]@1 |
115 char old_hot_key; // [sp+8h] [bp-4h]@1 | 302 char old_hot_key; // [sp+8h] [bp-4h]@1 |
116 | 303 |
117 //v3 = uNewHotkey; | 304 //v3 = uNewHotkey; |
118 old_hot_key = toupper(uOldHotkey); | 305 old_hot_key = toupper(uOldHotkey); |
119 result = toupper(uNewHotkey); | 306 v9 = toupper(uNewHotkey); |
120 v9 = result; | |
121 if ( bFirstCall ) | 307 if ( bFirstCall ) |
122 { | 308 { |
123 for ( i = uNumVisibleWindows; i >= 0; --i ) | 309 for ( i = uNumVisibleWindows; i >= 0; --i ) |
124 { | 310 { |
125 result = 84 * pVisibleWindowsIdxs[i]; | 311 for ( j = pWindowList[pVisibleWindowsIdxs[i] - 1]->pControlsHead; j; j = j->pNext ) |
126 for ( j = pWindowList[pVisibleWindowsIdxs[i] - 1].pControlsHead; j; j = j->pNext ) | |
127 j->field_28 = 0; | 312 j->field_28 = 0; |
128 } | 313 } |
129 } | 314 } |
130 for ( k = uNumVisibleWindows; k >= 0; --k ) | 315 for ( k = uNumVisibleWindows; k >= 0; --k ) |
131 { | 316 { |
132 result = 84 * pVisibleWindowsIdxs[k]; | 317 for ( l = pWindowList[pVisibleWindowsIdxs[k] - 1]->pControlsHead; l; l = l->pNext ) |
133 for ( l = pWindowList[pVisibleWindowsIdxs[k] - 1].pControlsHead; l; l = l->pNext ) | |
134 { | 318 { |
135 LOBYTE(result) = old_hot_key; | |
136 if ( l->uHotkey == old_hot_key ) | 319 if ( l->uHotkey == old_hot_key ) |
137 { | 320 { |
138 if ( !l->field_28 ) | 321 if ( !l->field_28 ) |
139 { | 322 { |
140 LOBYTE(result) = v9; | |
141 l->field_28 = 1; | 323 l->field_28 = 1; |
142 l->uHotkey = v9; | 324 l->uHotkey = v9; |
143 } | 325 } |
144 } | 326 } |
145 } | 327 } |
146 } | 328 } |
147 return result; | |
148 } | 329 } |
149 | 330 |
150 //----- (0041B438) -------------------------------------------------------- | 331 //----- (0041B438) -------------------------------------------------------- |
151 GUIButton *__fastcall GUI_HandleHotkey(unsigned __int8 uHotkey) | 332 GUIButton *__fastcall GUI_HandleHotkey(unsigned __int8 uHotkey) |
152 { | 333 { |
155 GUIButton *result; // eax@2 | 336 GUIButton *result; // eax@2 |
156 | 337 |
157 Hot_key_num = toupper(uHotkey); | 338 Hot_key_num = toupper(uHotkey); |
158 for( int i = uNumVisibleWindows; i >= 0 && pVisibleWindowsIdxs[i] > 0; i-- ) | 339 for( int i = uNumVisibleWindows; i >= 0 && pVisibleWindowsIdxs[i] > 0; i-- ) |
159 { | 340 { |
160 current_window = &pWindowList[pVisibleWindowsIdxs[i] - 1]; | 341 current_window = pWindowList[pVisibleWindowsIdxs[i] - 1]; |
161 for ( result = current_window->pControlsHead; result; result = result->pNext ) | 342 for ( result = current_window->pControlsHead; result; result = result->pNext ) |
162 { | 343 { |
163 if ( result->uHotkey == Hot_key_num ) | 344 if ( result->uHotkey == Hot_key_num ) |
164 { | 345 { |
165 pMessageQueue_50CBD0->AddGUIMessage(result->msg, result->msg_param, 0); | 346 pMessageQueue_50CBD0->AddGUIMessage(result->msg, result->msg_param, 0); |
235 this->receives_keyboard_input = false; | 416 this->receives_keyboard_input = false; |
236 } | 417 } |
237 } | 418 } |
238 | 419 |
239 | 420 |
421 | |
422 void GUIWindow_Book::Release() | |
423 { | |
424 OnCloseBook(); | |
425 | |
426 GUIWindow::Release(); | |
427 } | |
428 | |
429 void GUIWindow_Travel::Release() | |
430 { | |
431 pTexture_outside->Release(); | |
432 pTexture_Dialogue_Background->Release(); | |
433 pIcons_LOD->SyncLoadedFilesCount(); | |
434 current_screen_type = prev_screen_type; | |
435 | |
436 GUIWindow::Release(); | |
437 } | |
438 | |
439 void GUIWindow_Transition::Release() | |
440 { | |
441 //pVideoPlayer->Unload(); | |
442 pTexture_outside->Release(); | |
443 pTexture_Dialogue_Background->Release(); | |
444 pIcons_LOD->SyncLoadedFilesCount(); | |
445 current_screen_type = prev_screen_type; | |
446 | |
447 GUIWindow::Release(); | |
448 } | |
449 | |
450 void GUIWindow_Dialogue::Release() | |
451 { | |
452 if (!dword_591084) | |
453 pDialogueNPCPortraits[0]->Release(); | |
454 uNumDialogueNPCPortraits = 0; | |
455 pTexture_Dialogue_Background->Release(); | |
456 | |
457 pIcons_LOD->SyncLoadedFilesCount(); | |
458 current_screen_type = prev_screen_type; | |
459 | |
460 GUIWindow::Release(); | |
461 } | |
462 | |
463 void GUIWindow_Spellbook::Release() | |
464 { | |
465 OnCloseSpellBookPage(); | |
466 OnCloseSpellBook(); | |
467 | |
468 GUIWindow::Release(); | |
469 } | |
470 | |
471 void GUIWindow_GenericDialogue::Release() | |
472 { | |
473 pIcons_LOD->SyncLoadedFilesCount(); | |
474 current_screen_type = prev_screen_type; | |
475 pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_CANCELLED); | |
476 | |
477 GUIWindow::Release(); | |
478 } | |
479 | |
480 void GUIWindow_House::Release() | |
481 { | |
482 for (int i = 0; i < uNumDialogueNPCPortraits; ++i) | |
483 pDialogueNPCPortraits[i]->Release(); | |
484 uNumDialogueNPCPortraits = 0; | |
485 pTexture_Dialogue_Background->Release(); | |
486 | |
487 pIcons_LOD->SyncLoadedFilesCount(); | |
488 pIcons_LOD->RemoveTexturesPackFromTextureList(); | |
489 dword_5C35D4 = 0; | |
490 if (bFlipOnExit) | |
491 { | |
492 pParty->sRotationY = (stru_5C6E00->uIntegerDoublePi - 1) & (stru_5C6E00->uIntegerPi + pParty->sRotationY); | |
493 pIndoorCameraD3D->sRotationY = pParty->sRotationY; | |
494 } | |
495 pParty->uFlags |= 2u; | |
496 | |
497 GUIWindow::Release(); | |
498 } | |
499 | |
240 //----- (0041C26A) -------------------------------------------------------- | 500 //----- (0041C26A) -------------------------------------------------------- |
241 void GUIWindow::Release() | 501 void GUIWindow::Release() |
242 { | 502 { |
243 //GUIWindow *v1; // esi@1 | 503 //GUIWindow *v1; // esi@1 |
244 int i; // edi@20 | 504 int i; // edi@20 |
249 int v12; // edx@29 | 509 int v12; // edx@29 |
250 | 510 |
251 //v1 = this; | 511 //v1 = this; |
252 if ( !this ) | 512 if ( !this ) |
253 return; | 513 return; |
254 | 514 |
255 switch( this->eWindowType ) | |
256 { | |
257 case WINDOW_GreetingNPC: | |
258 { | |
259 pIcons_LOD->SyncLoadedFilesCount(); | |
260 current_screen_type = prev_screen_type; | |
261 pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_CANCELLED); | |
262 break; | |
263 } | |
264 case WINDOW_HouseInterior: | |
265 { | |
266 for ( i = 0; i < uNumDialogueNPCPortraits; ++i ) | |
267 pDialogueNPCPortraits[i]->Release(); | |
268 uNumDialogueNPCPortraits = 0; | |
269 pTexture_Dialogue_Background->Release(); | |
270 | |
271 pIcons_LOD->SyncLoadedFilesCount(); | |
272 pIcons_LOD->RemoveTexturesPackFromTextureList(); | |
273 dword_5C35D4 = 0; | |
274 if ( bFlipOnExit ) | |
275 { | |
276 pParty->sRotationY = (stru_5C6E00->uIntegerDoublePi - 1) & (stru_5C6E00->uIntegerPi + pParty->sRotationY); | |
277 pIndoorCameraD3D->sRotationY = pParty->sRotationY; | |
278 } | |
279 pParty->uFlags |= 2u; | |
280 break; | |
281 } | |
282 case WINDOW_Transition: | |
283 { | |
284 //pVideoPlayer->Unload(); | |
285 pTexture_outside->Release(); | |
286 pTexture_Dialogue_Background->Release(); | |
287 pIcons_LOD->SyncLoadedFilesCount(); | |
288 current_screen_type = prev_screen_type; | |
289 break; | |
290 } | |
291 case WINDOW_SpellBook: | |
292 { | |
293 OnCloseSpellBookPage(); | |
294 OnCloseSpellBook(); | |
295 break; | |
296 } | |
297 case WINDOW_Book: | |
298 { | |
299 OnCloseBook(); | |
300 break; | |
301 } | |
302 case WINDOW_ChangeLocation: | |
303 { | |
304 pTexture_outside->Release(); | |
305 pTexture_Dialogue_Background->Release(); | |
306 pIcons_LOD->SyncLoadedFilesCount(); | |
307 current_screen_type = prev_screen_type; | |
308 break; | |
309 } | |
310 case WINDOW_Dialogue: | |
311 { | |
312 if ( !dword_591084 ) | |
313 pDialogueNPCPortraits[0]->Release(); | |
314 uNumDialogueNPCPortraits = 0; | |
315 pTexture_Dialogue_Background->Release(); | |
316 | |
317 pIcons_LOD->SyncLoadedFilesCount(); | |
318 current_screen_type = prev_screen_type; | |
319 break; | |
320 } | |
321 case WINDOW_null: | |
322 return; | |
323 default: | |
324 break; | |
325 } | |
326 //v8 = this->pControlsHead; | 515 //v8 = this->pControlsHead; |
327 if ( this->pControlsHead ) | 516 if ( this->pControlsHead ) |
328 { | 517 { |
329 do | 518 do |
330 { | 519 { |
340 this->eWindowType = WINDOW_null; | 529 this->eWindowType = WINDOW_null; |
341 while ( this->numVisibleWindows < uNumVisibleWindows ) | 530 while ( this->numVisibleWindows < uNumVisibleWindows ) |
342 { | 531 { |
343 v12 = pVisibleWindowsIdxs[this->numVisibleWindows + 1]; | 532 v12 = pVisibleWindowsIdxs[this->numVisibleWindows + 1]; |
344 pVisibleWindowsIdxs[this->numVisibleWindows] = v12; | 533 pVisibleWindowsIdxs[this->numVisibleWindows] = v12; |
345 --pWindowList[v12 - 1].numVisibleWindows; | 534 --pWindowList[v12 - 1]->numVisibleWindows; |
346 ++this->numVisibleWindows; | 535 ++this->numVisibleWindows; |
347 } | 536 } |
348 pVisibleWindowsIdxs[uNumVisibleWindows] = 0; | 537 pVisibleWindowsIdxs[uNumVisibleWindows] = 0; |
349 uNumVisibleWindows = uNumVisibleWindows - 1; | 538 uNumVisibleWindows = uNumVisibleWindows - 1; |
350 } | 539 } |
1378 { | 1567 { |
1379 if ( GetTickCount() % 1000 > 500 ) | 1568 if ( GetTickCount() % 1000 > 500 ) |
1380 DrawText(a2, uX, uY, 0, "_", 0, 0, 0); | 1569 DrawText(a2, uX, uY, 0, "_", 0, 0, 0); |
1381 } | 1570 } |
1382 | 1571 |
1572 | |
1573 GUIWindow::GUIWindow() : | |
1574 uNumControls(0), | |
1575 pControlsHead(nullptr), | |
1576 pControlsTail(nullptr), | |
1577 eWindowType(WINDOW_null) | |
1578 {} | |
1579 | |
1383 //----- (0041C432) -------------------------------------------------------- | 1580 //----- (0041C432) -------------------------------------------------------- |
1384 GUIWindow * GUIWindow::Create( unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, enum WindowType eWindowType, int pButton, const char* hint ) | 1581 GUIWindow::GUIWindow(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, int pButton, const char* hint) : |
1385 { | 1582 uNumControls(0), |
1386 unsigned int uNextFreeWindowID; // ebp@1 | 1583 pControlsHead(nullptr), |
1387 //int *v8; // eax@1 | 1584 pControlsTail(nullptr), |
1388 //GUIWindow *pWindow; // esi@4 | 1585 eWindowType(WINDOW_MainMenu) |
1389 //int v10; // eax@4 | 1586 { |
1390 unsigned int v11; // ebx@15 | 1587 unsigned int uNextFreeWindowID; // ebp@1 |
1391 NPCData *speakingNPC; // ebp@15 | 1588 //int *v8; // eax@1 |
1392 int v14; // eax@20 | 1589 //GUIWindow *pWindow; // esi@4 |
1393 int v16; // eax@25 | 1590 //int v10; // eax@4 |
1394 int v18; // eax@30 | 1591 unsigned int v11; // ebx@15 |
1395 int v20; // eax@35 | 1592 NPCData *speakingNPC; // ebp@15 |
1396 int v22; // eax@40 | 1593 int v14; // eax@20 |
1397 int v24; // eax@45 | 1594 int v16; // eax@25 |
1398 // int v25; // eax@65 | 1595 int v18; // eax@30 |
1399 unsigned int v26; // ebx@65 | 1596 int v20; // eax@35 |
1400 char *v27; // eax@71 | 1597 int v22; // eax@40 |
1401 const char *v29; // [sp-8h] [bp-18h]@68 | 1598 int v24; // eax@45 |
1402 char *v30; // [sp-4h] [bp-14h]@68 | 1599 // int v25; // eax@65 |
1403 // int uWidtha; // [sp+14h] [bp+4h]@66 | 1600 unsigned int v26; // ebx@65 |
1404 int num_menu_buttons; // [sp+20h] [bp+10h]@15 | 1601 char *v27; // eax@71 |
1405 | 1602 const char *v29; // [sp-8h] [bp-18h]@68 |
1406 for (uNextFreeWindowID = 0; uNextFreeWindowID < 20; ++uNextFreeWindowID) | 1603 char *v30; // [sp-4h] [bp-14h]@68 |
1407 { | 1604 // int uWidtha; // [sp+14h] [bp+4h]@66 |
1408 if (pWindowList[uNextFreeWindowID].eWindowType == WINDOW_null) | 1605 int num_menu_buttons; // [sp+20h] [bp+10h]@15 |
1409 break; | 1606 |
1410 } | 1607 for (uNextFreeWindowID = 0; uNextFreeWindowID < 20; ++uNextFreeWindowID) |
1411 | |
1412 GUIWindow* pWindow = &pWindowList[uNextFreeWindowID]; | |
1413 pWindow->uFrameWidth = uWidth; | |
1414 pWindow->uFrameHeight = uHeight; | |
1415 | |
1416 pWindow->uFrameX = uX; | |
1417 pWindow->uFrameY = uY; | |
1418 pWindow->uFrameZ = uX + uWidth - 1; | |
1419 pWindow->uFrameW = uY + uHeight - 1; | |
1420 | |
1421 pWindow->ptr_1C = (void *)pButton; | |
1422 pWindow->Hint = hint; | |
1423 | |
1424 pWindow->eWindowType = eWindowType; | |
1425 pWindow->receives_keyboard_input = false; | |
1426 ++uNumVisibleWindows; | |
1427 pWindow->numVisibleWindows = uNumVisibleWindows; | |
1428 pVisibleWindowsIdxs[uNumVisibleWindows] = uNextFreeWindowID + 1; | |
1429 if ( (signed int)eWindowType <= 20 ) | |
1430 { | |
1431 if (eWindowType != WINDOW_Chest) | |
1432 { | 1608 { |
1433 switch (eWindowType) | 1609 if (pWindowList[uNextFreeWindowID] == nullptr) |
1434 { | 1610 break; |
1435 case WINDOW_Book: { | |
1436 pWindow->InitializeBookView(); | |
1437 break; | |
1438 } | |
1439 case WINDOW_Dialogue: { | |
1440 prev_screen_type = current_screen_type; | |
1441 current_screen_type = SCREEN_NPC_DIALOGUE; | |
1442 pBtn_ExitCancel = pWindow->CreateButton(0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], //"Exit" | |
1443 pIcons_LOD->GetTexture(uExitCancelTextureId), 0); | |
1444 if ( pWindow->par1C != 1 ) | |
1445 { | |
1446 num_menu_buttons = 0; | |
1447 v11 = LOBYTE(pFontArrus->uFontHeight) - 3; | |
1448 speakingNPC = GetNPCData(sDialogue_SpeakingActorNPC_ID); | |
1449 if ( GetGreetType(sDialogue_SpeakingActorNPC_ID) == 1 )//QuestsNPC_greet | |
1450 { | |
1451 if ( speakingNPC->joins ) | |
1452 { | |
1453 pWindow->CreateButton(480, 130, 140, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0xDu, 0, "", 0); | |
1454 num_menu_buttons = 1; | |
1455 } | |
1456 if ( speakingNPC->evt_A ) | |
1457 { | |
1458 if ( num_menu_buttons < 4 ) | |
1459 { | |
1460 v14 = NPC_EventProcessor(speakingNPC->evt_A); | |
1461 if ( v14 == 1 || v14 == 2 ) | |
1462 pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x13u, 0, "", 0); | |
1463 } | |
1464 } | |
1465 if ( speakingNPC->evt_B ) | |
1466 { | |
1467 if ( num_menu_buttons < 4 ) | |
1468 { | |
1469 v16 = NPC_EventProcessor(speakingNPC->evt_B); | |
1470 if ( v16 == 1 || v16 == 2 ) | |
1471 pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x14u, 0, "", 0); | |
1472 } | |
1473 } | |
1474 if ( speakingNPC->evt_C ) | |
1475 { | |
1476 if ( num_menu_buttons < 4 ) | |
1477 { | |
1478 v18 = NPC_EventProcessor(speakingNPC->evt_C); | |
1479 if ( v18 == 1 || v18 == 2 ) | |
1480 pWindow->CreateButton( 0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x15u, 0, "", 0); | |
1481 } | |
1482 } | |
1483 if ( speakingNPC->evt_D ) | |
1484 { | |
1485 if ( num_menu_buttons < 4 ) | |
1486 { | |
1487 v20 = NPC_EventProcessor(speakingNPC->evt_D); | |
1488 if ( v20 == 1 || v20 == 2 ) | |
1489 pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x16u, 0, "", 0); | |
1490 } | |
1491 } | |
1492 if ( speakingNPC->evt_E ) | |
1493 { | |
1494 if ( num_menu_buttons < 4 ) | |
1495 { | |
1496 v22 = NPC_EventProcessor(speakingNPC->evt_E); | |
1497 if ( v22 == 1 || v22 == 2 ) | |
1498 pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x17u, 0, "", 0); | |
1499 } | |
1500 } | |
1501 if (speakingNPC->evt_F ) | |
1502 { | |
1503 if ( num_menu_buttons < 4 ) | |
1504 { | |
1505 v24 = NPC_EventProcessor(speakingNPC->evt_F); | |
1506 if ( v24 == 1 || v24 == 2 ) | |
1507 pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x18u, 0, "", 0); | |
1508 } | |
1509 } | |
1510 } | |
1511 else | |
1512 { | |
1513 if ( speakingNPC->joins ) | |
1514 { | |
1515 pWindow->CreateButton(0x1E0u, 0x82u, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x4Du, 0, pGlobalTXT_LocalizationStrings[407], 0);//Подробнее | |
1516 if (speakingNPC->Hired()) | |
1517 { | |
1518 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[408], speakingNPC->pName); //Отпустить | |
1519 pWindow->CreateButton(0x1E0u, v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x4Cu, 0, pTmpBuf.data(), 0); | |
1520 } | |
1521 else | |
1522 pWindow->CreateButton(0x1E0u, v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x4Cu, 0, pGlobalTXT_LocalizationStrings[406], 0);//Нанять | |
1523 num_menu_buttons = 2; | |
1524 } | |
1525 } | |
1526 pWindow->_41D08F_set_keyboard_control_group(num_menu_buttons, 1, 0, 1); | |
1527 } | |
1528 break; | |
1529 } | |
1530 case WINDOW_ChangeLocation: | |
1531 { | |
1532 prev_screen_type = current_screen_type; | |
1533 current_screen_type = SCREEN_CHANGE_LOCATION; | |
1534 pBtn_ExitCancel = pWindow->CreateButton( 566, 445, 75, 33, 1, 0, UIMSG_CHANGE_LOCATION_ClickCencelBtn, 0, 'N', pGlobalTXT_LocalizationStrings[156], pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);//Остаться в этой области | |
1535 pBtn_YES = pWindow->CreateButton( 486, 445, 75, 33, 1, 0, UIMSG_OnTravelByFoot, 0, 'Y', pWindow->Hint, pIcons_LOD->GetTexture(uTextureID_BUTTYES2), 0); | |
1536 pWindow->CreateButton(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 63, 73, 1, 0, UIMSG_OnTravelByFoot, 1, ' ', pWindow->Hint, 0, 0, 0); | |
1537 pWindow->CreateButton( 8, 8, 460, 344, 1, 0, UIMSG_OnTravelByFoot, 1, 0, pWindow->Hint, 0); | |
1538 break; | |
1539 } | |
1540 case WINDOW_SpellBook: {// окно книги заклов | |
1541 InitializeBookTextures(); | |
1542 pWindow->OpenSpellBook(); | |
1543 break; | |
1544 } | |
1545 case WINDOW_GreetingNPC: {// окно приветствия НПС | |
1546 prev_screen_type = current_screen_type; | |
1547 pKeyActionMap->EnterText(0, 15, pWindow); | |
1548 current_screen_type = SCREEN_BRANCHLESS_NPC_DIALOG; | |
1549 break; | |
1550 } | |
1551 | |
1552 } | |
1553 return pWindow; | |
1554 } | 1611 } |
1555 //LABEL_62: | 1612 |
1556 pWindow->CreateButton(61, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0); | 1613 //GUIWindow* pWindow = &pWindowList[uNextFreeWindowID]; |
1557 pWindow->CreateButton(177, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0); | 1614 pWindowList[uNextFreeWindowID] = this; |
1558 pWindow->CreateButton(292, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0); | 1615 this->uFrameWidth = uWidth; |
1559 pWindow->CreateButton(407, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0); | 1616 this->uFrameHeight = uHeight; |
1560 pWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_CycleCharacters, 0, 9, "", 0); | 1617 |
1561 return pWindow; | 1618 this->uFrameX = uX; |
1562 } | 1619 this->uFrameY = uY; |
1563 if (eWindowType == WINDOW_HouseInterior) | 1620 this->uFrameZ = uX + uWidth - 1; |
1564 { | 1621 this->uFrameW = uY + uHeight - 1; |
1565 current_screen_type = SCREEN_HOUSE; | 1622 |
1566 pBtn_ExitCancel = pWindow->CreateButton(471, 445, 169, 35, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[80],//Выйти из здания | 1623 this->ptr_1C = (void *)pButton; |
1567 pIcons_LOD->GetTexture(uExitCancelTextureId), 0); | 1624 this->Hint = hint; |
1568 for ( v26 = 0; v26 < uNumDialogueNPCPortraits; ++v26 ) | 1625 |
1569 { | 1626 //this->eWindowType = eWindowType; |
1570 if ( v26 + 1 == uNumDialogueNPCPortraits && uHouse_ExitPic ) | 1627 this->receives_keyboard_input = false; |
1571 { | 1628 ++uNumVisibleWindows; |
1572 v30 = pMapStats->pInfos[uHouse_ExitPic].pName; | 1629 this->numVisibleWindows = uNumVisibleWindows; |
1573 v29 = (char*)pGlobalTXT_LocalizationStrings[LOCSTR_ENTER_S]; | 1630 pVisibleWindowsIdxs[uNumVisibleWindows] = uNextFreeWindowID + 1; |
1574 } | 1631 } |
1575 else | 1632 |
1576 { | 1633 |
1577 if ( v26 || !dword_591080 ) | |
1578 v27 = HouseNPCData[v26 +1 - ((dword_591080 != 0)? 1:0)]->pName; | |
1579 else | |
1580 v27 = (char*)p2DEvents[pButton - 1].pProprieterName; | |
1581 v30 = v27; | |
1582 v29 = (char*)pGlobalTXT_LocalizationStrings[435]; | |
1583 } | |
1584 sprintfex(byte_591180[v26].data(), v29, v30); | |
1585 HouseNPCPortraitsButtonsList[v26] = pWindow->CreateButton(pNPCPortraits_x[uNumDialogueNPCPortraits - 1][v26], | |
1586 pNPCPortraits_y[uNumDialogueNPCPortraits - 1][v26], | |
1587 63, 73, 1, 0, UIMSG_ClickHouseNPCPortrait, v26, 0, byte_591180[v26].data(), 0, 0, 0); | |
1588 } | |
1589 if ( uNumDialogueNPCPortraits == 1 ) | |
1590 { | |
1591 window_SpeakInHouse = &pWindowList[uNextFreeWindowID]; | |
1592 _4B4224_UpdateNPCTopics(0); | |
1593 } | |
1594 } | |
1595 else | |
1596 { | |
1597 if (eWindowType == WINDOW_Transition) | |
1598 { | |
1599 prev_screen_type = current_screen_type; | |
1600 current_screen_type = SCREEN_INPUT_BLV; | |
1601 pBtn_ExitCancel = pWindow->CreateButton(0x236u, 0x1BDu, 0x4Bu, 0x21u, 1, 0, UIMSG_TransitionWindowCloseBtn, 0, 'N', pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);//Отмена | |
1602 pBtn_YES = pWindow->CreateButton(0x1E6u, 0x1BDu, 0x4Bu, 0x21u, 1, 0, UIMSG_TransitionUI_Confirm, 0, 'Y', pWindow->Hint, pIcons_LOD->GetTexture(uTextureID_BUTTYES2), 0); | |
1603 pWindow->CreateButton(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 0x3Fu, 0x49u, 1, 0, UIMSG_TransitionUI_Confirm, 1, 0x20u, pWindow->Hint, 0); | |
1604 pWindow->CreateButton(8, 8, 0x1CCu, 0x158u, 1, 0, UIMSG_TransitionUI_Confirm, 1u, 0, pWindow->Hint, 0); | |
1605 return pWindow; | |
1606 } | |
1607 if (eWindowType == WINDOW_CastSpell) | |
1608 { | |
1609 pEventTimer->Pause(); | |
1610 pAudioPlayer->StopChannels(-1, -1); | |
1611 pMouse->SetCursorBitmap("MICON2"); | |
1612 ShowStatusBarString(pGlobalTXT_LocalizationStrings[39], 2u);//Выберите цель | |
1613 return pWindow; | |
1614 } | |
1615 if (eWindowType == WINDOW_Scroll) | |
1616 { | |
1617 pWindow->CreateButton(61, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0); | |
1618 pWindow->CreateButton(177, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0); | |
1619 pWindow->CreateButton(292, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0); | |
1620 pWindow->CreateButton(407, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0); | |
1621 pWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_CycleCharacters, 0, '\t', "", 0); | |
1622 return pWindow; | |
1623 } | |
1624 if (eWindowType == WINDOW_CastSpell_InInventory) | |
1625 { | |
1626 pMouse->SetCursorBitmap("MICON2"); | |
1627 pBtn_ExitCancel = pWindow->CreateButton(392, 318, 75, 33, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[34],//Отмена | |
1628 pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0); | |
1629 ShowStatusBarString(pGlobalTXT_LocalizationStrings[39], 2);//Выбрать цель | |
1630 ++pIcons_LOD->uTexturePacksCount; | |
1631 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; | |
1632 current_screen_type = SCREEN_CASTING; | |
1633 if ( !pIcons_LOD->uNumPrevLoadedFiles ) | |
1634 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; | |
1635 } | |
1636 } | |
1637 return pWindow; | |
1638 } | |
1639 //----- (004B3EF0) -------------------------------------------------------- | 1634 //----- (004B3EF0) -------------------------------------------------------- |
1640 void DrawJoinGuildWindow( int pEventCode ) | 1635 void DrawJoinGuildWindow( int pEventCode ) |
1641 { | 1636 { |
1642 uDialogueType = 81;//enum JoinGuildDialog | 1637 uDialogueType = 81;//enum JoinGuildDialog |
1643 current_npc_text = (char *)pNPCTopics[pEventCode + 99].pText; | 1638 current_npc_text = (char *)pNPCTopics[pEventCode + 99].pText; |
1644 ContractSelectText(pEventCode); | 1639 ContractSelectText(pEventCode); |
1645 pDialogueWindow->Release(); | 1640 pDialogueWindow->Release(); |
1646 pDialogueWindow = GUIWindow::Create(0, 0, window->GetWidth(), 350, WINDOW_MainMenu, pEventCode, 0); | 1641 pDialogueWindow = new GUIWindow(0, 0, window->GetWidth(), 350, pEventCode, 0); |
1647 pBtn_ExitCancel = pDialogueWindow->CreateButton(471, 445, 169, 35, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uExitCancelTextureId), 0); // Cancel | 1642 pBtn_ExitCancel = pDialogueWindow->CreateButton(471, 445, 169, 35, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uExitCancelTextureId), 0); // Cancel |
1648 pDialogueWindow->CreateButton( 0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); | 1643 pDialogueWindow->CreateButton( 0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); |
1649 pDialogueWindow->CreateButton(480, 160, 140, 30, 1, 0, UIMSG_ClickNPCTopic, 0x52u, 0, pGlobalTXT_LocalizationStrings[122], 0); | 1644 pDialogueWindow->CreateButton(480, 160, 140, 30, 1, 0, UIMSG_ClickNPCTopic, 82, 0, pGlobalTXT_LocalizationStrings[122], 0); |
1650 pDialogueWindow->_41D08F_set_keyboard_control_group(1, 1, 0, 2); | 1645 pDialogueWindow->_41D08F_set_keyboard_control_group(1, 1, 0, 2); |
1651 dialog_menu_id = HOUSE_DIALOGUE_OTHER; | 1646 dialog_menu_id = HOUSE_DIALOGUE_OTHER; |
1652 } | 1647 } |
1653 //----- (0044603D) -------------------------------------------------------- | 1648 //----- (0044603D) -------------------------------------------------------- |
1654 void DialogueEnding() | 1649 void DialogueEnding() |
1655 { | 1650 { |
1656 sDialogue_SpeakingActorNPC_ID = 0; | 1651 sDialogue_SpeakingActorNPC_ID = 0; |
1657 pDialogueWindow->Release(); | 1652 pDialogueWindow->Release(); |
1658 pDialogueWindow = 0; | 1653 pDialogueWindow = 0; |
1659 pMiscTimer->Resume(); | 1654 pMiscTimer->Resume(); |
1660 pEventTimer->Resume(); | 1655 pEventTimer->Resume(); |
1661 } | 1656 } |
1657 | |
1658 | |
1659 | |
1660 void GUIWindow_GameMenu::Update() | |
1661 { | |
1662 pRenderer->DrawTextureIndexed( | |
1663 pViewport->uViewportTL_Y, | |
1664 pViewport->uViewportTL_X, | |
1665 pIcons_LOD->GetTexture(uTextureID_Options) | |
1666 ); | |
1667 viewparams->bRedrawGameUI = 1; | |
1668 } | |
1669 | |
1670 void GUIWindow_CharacterRecord::Update() | |
1671 { | |
1672 CharacterUI_CharacterScreen_Draw(pPlayers[uActiveCharacter]); | |
1673 } | |
1674 | |
1675 void GUIWindow_Options::Update() | |
1676 { | |
1677 GameMenuUI_Options_Draw(); | |
1678 } | |
1679 | |
1680 void GUIWindow_KeymappingOptions::Update() | |
1681 { | |
1682 GameMenuUI_DrawKeyBindings(); | |
1683 } | |
1684 | |
1685 void GUIWindow_VideoOptions::Update() | |
1686 { | |
1687 GameMenuUI_DrawVideoOptions(); | |
1688 } | |
1689 | |
1690 void GUIWindow_Book::Update() | |
1691 { | |
1692 BookUI_Draw((WindowType)(int)ptr_1C); | |
1693 } | |
1694 | |
1695 void GUIWindow_BooksWindow::Update() | |
1696 { | |
1697 auto pButton = (GUIButton *)ptr_1C; | |
1698 pRenderer->DrawTextureIndexed(uFrameY, uFrameX, pButton->pTextures[0]); | |
1699 viewparams->bRedrawGameUI = true; | |
1700 } | |
1701 | |
1702 void GUIWindow_QuickReference::Update() | |
1703 { | |
1704 GameUI_QuickRef_Draw(); | |
1705 } | |
1706 | |
1707 void GUIWindow_Rest::Update() | |
1708 { | |
1709 RestUI_Draw(); | |
1710 } | |
1711 | |
1712 void GUIWindow_Travel::Update() | |
1713 { | |
1714 TravelUI_Draw(); | |
1715 } | |
1716 | |
1717 void GUIWindow_Transition::Update() | |
1718 { | |
1719 TransitionUI_Draw(); | |
1720 } | |
1721 | |
1722 void GUIWindow_Dialogue::Update() | |
1723 { | |
1724 GameUI_DrawDialogue(); | |
1725 } | |
1726 | |
1727 void GUIWindow_GenericDialogue::Update() | |
1728 { | |
1729 GameUI_DrawBranchlessDialogue(); | |
1730 } | |
1731 | |
1732 void GUIWindow_Spellbook::Update() | |
1733 { | |
1734 DrawSpellBookContent(pPlayers[uActiveCharacter]); | |
1735 } | |
1736 | |
1737 void GUIWindow_Chest::Update() | |
1738 { | |
1739 if (current_screen_type == SCREEN_CHEST) | |
1740 { | |
1741 Chest::DrawChestUI(par1C); | |
1742 } | |
1743 else if (current_screen_type == SCREEN_CHEST_INVENTORY) | |
1744 { | |
1745 pRenderer->ClearZBuffer(0, 479); | |
1746 draw_leather(); | |
1747 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | |
1748 pRenderer->DrawTextureIndexed(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pIcons_LOD->GetTexture(uExitCancelTextureId)); | |
1749 } | |
1750 } | |
1751 | |
1752 void GUIWindow_Save::Update() | |
1753 { | |
1754 SaveUI_Draw(); | |
1755 } | |
1756 | |
1757 void GUIWindow_Load::Update() | |
1758 { | |
1759 LoadUI_Draw(); | |
1760 } | |
1761 | |
1762 void GUIWindow_House::Update() | |
1763 { | |
1764 HouseDialogManager(); | |
1765 if (!window_SpeakInHouse) | |
1766 return; | |
1767 if (window_SpeakInHouse->par1C >= 53) | |
1768 return; | |
1769 if (pParty->PartyTimes._shop_ban_times[window_SpeakInHouse->par1C] <= pParty->uTimePlayed) | |
1770 { | |
1771 if (window_SpeakInHouse->par1C < 53) | |
1772 pParty->PartyTimes._shop_ban_times[window_SpeakInHouse->par1C] = 0; | |
1773 return; | |
1774 } | |
1775 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); | |
1776 } | |
1777 | |
1778 void GUIWindow_Scroll::Update() | |
1779 { | |
1780 CreateScrollWindow(); | |
1781 } | |
1782 | |
1783 void GUIWindow_Inventory::Update() | |
1784 { | |
1785 DrawMessageBox(0); | |
1786 DrawText(pFontLucida, 10, 20, 0, "Making item number", 0, 0, 0); | |
1787 DrawText(pFontLucida, 10, 40, 0, pKeyActionMap->pPressedKeysBuffer, 0, 0, 0); | |
1788 if (!pKeyActionMap->field_204) | |
1789 { | |
1790 ItemGen ItemGen2; | |
1791 ItemGen2.Reset(); | |
1792 Release(); | |
1793 pEventTimer->Resume(); | |
1794 current_screen_type = SCREEN_GAME; | |
1795 viewparams->bRedrawGameUI = 1; | |
1796 int v39 = atoi(pKeyActionMap->pPressedKeysBuffer); | |
1797 if (v39 > 0 && v39 < 800) | |
1798 SpawnActor(v39); | |
1799 } | |
1800 } | |
1801 | |
1802 void GUIWindow_Inventory_CastSpell::Update() | |
1803 { | |
1804 pRenderer->ClearZBuffer(0, 479); | |
1805 draw_leather(); | |
1806 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | |
1807 CharacterUI_DrawPaperdoll(pPlayers[uActiveCharacter]); | |
1808 pRenderer->DrawTextureIndexedAlpha(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pIcons_LOD->GetTexture(uTextureID_x_x_u)); | |
1809 } | |
1810 | |
1811 void GUIWindow_Modal::Update() | |
1812 { | |
1813 ModalWindow_ShowHint(); | |
1814 } | |
1815 | |
1816 void GUIWindow_RestWindow::Update() | |
1817 { | |
1818 __debugbreak(); // doesnt seems to get here, check stack trace & conditions | |
1819 GUIButton GUIButton2; // [sp+28h] [bp-E0h]@133 | |
1820 memset(&GUIButton2, 0, sizeof(GUIButton2)); | |
1821 GUIButton2.uZ = 197; | |
1822 GUIButton2.uW = 197; | |
1823 GUIButton2.uX = 27; | |
1824 GUIButton2.uY = 161; | |
1825 GUIButton2.uWidth = 171; | |
1826 GUIButton2.uHeight = 37; | |
1827 GUIButton2.pParent = pButton_RestUI_WaitUntilDawn->pParent; | |
1828 pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0); | |
1829 pRenderer->DrawTextureIndexed(uFrameX, uFrameY, *((Texture **)ptr_1C + 15)); | |
1830 viewparams->bRedrawGameUI = 1; | |
1831 GUIButton2.DrawLabel(pGlobalTXT_LocalizationStrings[183], pFontCreate, 0, 0); // Rest & Heal 8 hrs / Отдых и лечение 8 часов | |
1832 GUIButton2.pParent = 0; | |
1833 Release(); | |
1834 } | |
1835 | |
1836 void OnButtonClick::Update() | |
1837 { | |
1838 if (Hint != (char *)1) | |
1839 pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0); | |
1840 GUIButton *pButton = (GUIButton *)ptr_1C; | |
1841 pRenderer->DrawTextureIndexedAlpha(uFrameX, uFrameY, pButton->pTextures[0]); | |
1842 viewparams->bRedrawGameUI = true; | |
1843 if (Hint && Hint != (char *)1) | |
1844 pButton->DrawLabel(Hint, pFontCreate, 0, 0); | |
1845 Release(); | |
1846 } | |
1847 | |
1848 void OnButtonClick2::Update() | |
1849 { | |
1850 if (Hint != (char *)1) | |
1851 pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0); | |
1852 GUIButton *pButton = (GUIButton *)ptr_1C; | |
1853 if (pButton->uX >= 0 && pButton->uX <= window->GetWidth()) | |
1854 { | |
1855 if (pButton->uY >= 0 && pButton->uY <= window->GetHeight()) | |
1856 { | |
1857 pRenderer->DrawTextureIndexed(uFrameX, uFrameY, pButton->pTextures[0]); | |
1858 viewparams->bRedrawGameUI = true; | |
1859 if (Hint && Hint != (char *)1) | |
1860 pButton->DrawLabel(Hint, pFontCreate, 0, 0); | |
1861 Release(); | |
1862 return; | |
1863 } | |
1864 } | |
1865 viewparams->bRedrawGameUI = true; | |
1866 if (Hint && Hint != (char *)1) | |
1867 pButton->DrawLabel(Hint, pFontCreate, 0, 0); | |
1868 Release(); | |
1869 } | |
1870 | |
1871 void OnButtonClick3::Update() | |
1872 { | |
1873 if (Hint != (char *)1) | |
1874 pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0); | |
1875 auto pButton = (GUIButton *)ptr_1C; | |
1876 pRenderer->DrawTextureIndexed(uFrameX, uFrameY, pButton->pTextures[1]); | |
1877 viewparams->bRedrawGameUI = 1; | |
1878 if (Hint && Hint != (char *)1) | |
1879 pButton->DrawLabel(Hint, pFontCreate, 0, 0); | |
1880 Release(); | |
1881 } | |
1882 | |
1883 void OnButtonClick4::Update() | |
1884 { | |
1885 if (Hint != (char *)1) | |
1886 pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0); | |
1887 auto pButton = (GUIButton *)ptr_1C; | |
1888 pRenderer->DrawTextureIndexedAlpha(uFrameX, uFrameY, pButton->pTextures[1]); | |
1889 viewparams->bRedrawGameUI = true; | |
1890 | |
1891 Release(); | |
1892 } | |
1893 | |
1894 void OnSaveLoad::Update() | |
1895 { | |
1896 if (Hint != (char *)1) | |
1897 pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0); | |
1898 auto pButton = (GUIButton *)ptr_1C; | |
1899 pRenderer->DrawTextureIndexed(uFrameX, uFrameY, pButton->pTextures[0]); | |
1900 viewparams->bRedrawGameUI = true; | |
1901 if (Hint && Hint != (char *)1) | |
1902 pButton->DrawLabel(Hint, pFontCreate, 0, 0); | |
1903 Release(); | |
1904 | |
1905 if (current_screen_type == SCREEN_SAVEGAME) | |
1906 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_SaveGame, 0, 0); | |
1907 else | |
1908 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_LoadGame, 0, 0); | |
1909 } | |
1910 | |
1911 void OnCancel::Update() | |
1912 { | |
1913 if (Hint != (char *)1) | |
1914 pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0); | |
1915 auto pGUIButton = (GUIButton *)ptr_1C; | |
1916 pRenderer->DrawTextureIndexed(uFrameX, uFrameY, pGUIButton->pTextures[0]); | |
1917 viewparams->bRedrawGameUI = true; | |
1918 if (Hint && Hint != (char *)1) | |
1919 pGUIButton->DrawLabel(Hint, pFontCreate, 0, 0); | |
1920 Release(); | |
1921 | |
1922 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); | |
1923 } | |
1924 | |
1925 void OnCancel2::Update() | |
1926 { | |
1927 if (Hint != (char *)1) | |
1928 pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0); | |
1929 auto pButton = (GUIButton *)ptr_1C; | |
1930 pRenderer->DrawTextureIndexed(uFrameX, uFrameY, pButton->pTextures[1]); | |
1931 viewparams->bRedrawGameUI = true; | |
1932 if (Hint && Hint != (char *)1) | |
1933 pButton->DrawLabel(Hint, pFontCreate, 0, 0); | |
1934 Release(); | |
1935 | |
1936 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); | |
1937 } | |
1938 | |
1939 void OnCancel3::Update() | |
1940 { | |
1941 if (Hint != (char *)1) | |
1942 pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0); | |
1943 auto pButton = (GUIButton *)ptr_1C; | |
1944 pRenderer->DrawTextureIndexedAlpha(uFrameX, uFrameY, pButton->pTextures[0]); | |
1945 viewparams->bRedrawGameUI = true; | |
1946 if (Hint && Hint != (char *)1) | |
1947 pButton->DrawLabel(Hint, pFontCreate, 0, 0); | |
1948 Release(); | |
1949 | |
1950 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); | |
1951 } | |
1952 | |
1662 //----- (004156F0) -------------------------------------------------------- | 1953 //----- (004156F0) -------------------------------------------------------- |
1663 void GUI_UpdateWindows() | 1954 void GUI_UpdateWindows() |
1664 { | 1955 { |
1665 GUIWindow *pWindow; // esi@4 | 1956 GUIWindow *pWindow; // esi@4 |
1666 //unsigned int pWindowType; // eax@4 | 1957 //unsigned int pWindowType; // eax@4 |
1672 GUIWindow *pGUIWindow2; // ecx@109 | 1963 GUIWindow *pGUIWindow2; // ecx@109 |
1673 // GUIFont *pGUIFont; // ST1C_4@115 | 1964 // GUIFont *pGUIFont; // ST1C_4@115 |
1674 int v31; // eax@115 | 1965 int v31; // eax@115 |
1675 GUIButton *pButton; // ebp@118 | 1966 GUIButton *pButton; // ebp@118 |
1676 int v39; // eax@129 | 1967 int v39; // eax@129 |
1677 unsigned int pNumMessages; // eax@142 | |
1678 GUIButton *pGUIButton; // ebp@146 | 1968 GUIButton *pGUIButton; // ebp@146 |
1679 //unsigned int pX; // [sp-1Ch] [bp-124h]@17 | 1969 //unsigned int pX; // [sp-1Ch] [bp-124h]@17 |
1680 //unsigned int pY; // [sp-18h] [bp-120h]@17 | 1970 //unsigned int pY; // [sp-18h] [bp-120h]@17 |
1681 //Texture *pTexture; // [sp-14h] [bp-11Ch]@17 | 1971 //Texture *pTexture; // [sp-14h] [bp-11Ch]@17 |
1682 //Texture *pTexture2; // [sp-14h] [bp-11Ch]@86 | 1972 //Texture *pTexture2; // [sp-14h] [bp-11Ch]@86 |
1688 if (GetCurrentMenuID() != MENU_CREATEPARTY) | 1978 if (GetCurrentMenuID() != MENU_CREATEPARTY) |
1689 Mouse::UI_OnKeyDown(VK_NEXT); | 1979 Mouse::UI_OnKeyDown(VK_NEXT); |
1690 | 1980 |
1691 for ( i = 1; i <= uNumVisibleWindows; ++i ) | 1981 for ( i = 1; i <= uNumVisibleWindows; ++i ) |
1692 { | 1982 { |
1693 pWindow = &pWindowList[pVisibleWindowsIdxs[i] - 1]; | 1983 pWindow = pWindowList[pVisibleWindowsIdxs[i] - 1]; |
1984 | |
1985 pWindow->Update(); | |
1694 switch (pWindow->eWindowType) | 1986 switch (pWindow->eWindowType) |
1695 { | 1987 { |
1696 case WINDOW_GameMenu: | |
1697 { | |
1698 pRenderer->DrawTextureIndexed(pViewport->uViewportTL_Y, | |
1699 pViewport->uViewportTL_X, pIcons_LOD->GetTexture(uTextureID_Options)); | |
1700 viewparams->bRedrawGameUI = 1; | |
1701 continue; | |
1702 } | |
1703 case WINDOW_CharacterRecord: | |
1704 { | |
1705 CharacterUI_CharacterScreen_Draw(pPlayers[uActiveCharacter]); | |
1706 continue; | |
1707 } | |
1708 case WINDOW_Options: | |
1709 { | |
1710 GameMenuUI_Options_Draw(); | |
1711 continue; | |
1712 } | |
1713 case WINDOW_Book: | |
1714 { | |
1715 BookUI_Draw((WindowType)(int)pWindow->ptr_1C); | |
1716 continue; | |
1717 } | |
1718 case WINDOW_Dialogue: | |
1719 { | |
1720 GameUI_DrawDialogue(); | |
1721 continue; | |
1722 } | |
1723 case WINDOW_QuickReference: | |
1724 { | |
1725 GameUI_QuickRef_Draw(); | |
1726 continue; | |
1727 } | |
1728 case WINDOW_Rest: | |
1729 { | |
1730 RestUI_Draw(); | |
1731 continue; | |
1732 } | |
1733 case WINDOW_ChangeLocation: | |
1734 { | |
1735 TravelUI_Draw(); | |
1736 continue; | |
1737 } | |
1738 case WINDOW_SpellBook: | |
1739 { | |
1740 DrawSpellBookContent(pPlayers[uActiveCharacter]); | |
1741 continue; | |
1742 } | |
1743 case WINDOW_GreetingNPC: | |
1744 { | |
1745 GameUI_DrawBranchlessDialogue(); | |
1746 continue; | |
1747 } | |
1748 case WINDOW_Chest: | |
1749 { | |
1750 if ( current_screen_type == SCREEN_CHEST ) | |
1751 { | |
1752 Chest::DrawChestUI(pWindow->par1C); | |
1753 } | |
1754 else if ( current_screen_type == SCREEN_CHEST_INVENTORY ) | |
1755 { | |
1756 pRenderer->ClearZBuffer(0, 479); | |
1757 draw_leather(); | |
1758 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | |
1759 pRenderer->DrawTextureIndexed(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pIcons_LOD->GetTexture(uExitCancelTextureId)); | |
1760 } | |
1761 continue; | |
1762 } | |
1763 case WINDOW_SaveLoadButtons: | |
1764 { | |
1765 SaveUI_Draw(); | |
1766 continue; | |
1767 } | |
1768 case WINDOW_MainMenu_Load: | |
1769 { | |
1770 LoadUI_Draw(); | |
1771 continue; | |
1772 } | |
1773 case WINDOW_HouseInterior: | |
1774 { | |
1775 pWindowList[pVisibleWindowsIdxs[i] - 1].HouseDialogManager(); | |
1776 if ( !window_SpeakInHouse ) | |
1777 continue; | |
1778 if ( window_SpeakInHouse->par1C >= 53 ) | |
1779 continue; | |
1780 if ( pParty->PartyTimes._shop_ban_times[window_SpeakInHouse->par1C] <=pParty->uTimePlayed ) | |
1781 { | |
1782 if ( window_SpeakInHouse->par1C < 53 ) | |
1783 pParty->PartyTimes._shop_ban_times[window_SpeakInHouse->par1C] = 0; | |
1784 continue; | |
1785 } | |
1786 pNumMessages = pMessageQueue_50CBD0->uNumMessages; | |
1787 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); | |
1788 continue; | |
1789 } | |
1790 case WINDOW_Transition: | |
1791 { | |
1792 TransitionUI_Draw(); | |
1793 continue; | |
1794 } | |
1795 case WINDOW_Scroll: | |
1796 { | |
1797 CreateScrollWindow(); | |
1798 continue; | |
1799 } | |
1800 case WINDOW_CastSpell_InInventory: | |
1801 { | |
1802 pRenderer->ClearZBuffer(0, 479); | |
1803 draw_leather(); | |
1804 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); | |
1805 CharacterUI_DrawPaperdoll(pPlayers[uActiveCharacter]); | |
1806 pRenderer->DrawTextureIndexedAlpha(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pIcons_LOD->GetTexture(uTextureID_x_x_u)); | |
1807 continue; | |
1808 } | |
1809 case WINDOW_ModalWindow: | |
1810 { | |
1811 ModalWindow_ShowHint(); | |
1812 continue; | |
1813 } | |
1814 case WINDOW_50: | 1988 case WINDOW_50: |
1815 { | 1989 { |
1990 __debugbreak(); // looks like debugging tools | |
1816 v27 = Color16(255, 255, 255); | 1991 v27 = Color16(255, 255, 255); |
1817 if ( ptr_507BD0->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) | 1992 if ( ptr_507BD0->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS) |
1818 { | 1993 { |
1819 ptr_507BD0->DrawMessageBox(0); | 1994 ptr_507BD0->DrawMessageBox(0); |
1820 ptr_507BD0->DrawText(pFontCreate, 30, 40, v27, pKeyActionMap->pPressedKeysBuffer, 0, 0, 0); | 1995 ptr_507BD0->DrawText(pFontCreate, 30, 40, v27, pKeyActionMap->pPressedKeysBuffer, 0, 0, 0); |
1837 pWindow->receives_keyboard_input_2 = WINDOW_INPUT_NONE; | 2012 pWindow->receives_keyboard_input_2 = WINDOW_INPUT_NONE; |
1838 pEventTimer->Resume(); | 2013 pEventTimer->Resume(); |
1839 ptr_507BD0->Release(); | 2014 ptr_507BD0->Release(); |
1840 continue; | 2015 continue; |
1841 } | 2016 } |
2017 | |
2018 __debugbreak(); // switch pass-through | |
1842 } | 2019 } |
1843 case WINDOW_59: | 2020 case WINDOW_59: |
1844 { | 2021 { |
2022 __debugbreak(); // looks like debugging tools | |
1845 pWindow->DrawMessageBox(0); | 2023 pWindow->DrawMessageBox(0); |
1846 pWindow->DrawText(pFontLucida, 10, 20, 0, "Making item number", 0, 0, 0); | 2024 pWindow->DrawText(pFontLucida, 10, 20, 0, "Making item number", 0, 0, 0); |
1847 pWindow->DrawText(pFontLucida, 10, 40, 0, pKeyActionMap->pPressedKeysBuffer, 0, 0, 0); | 2025 pWindow->DrawText(pFontLucida, 10, 40, 0, pKeyActionMap->pPressedKeysBuffer, 0, 0, 0); |
1848 if ( !pKeyActionMap->field_204 ) | 2026 if ( !pKeyActionMap->field_204 ) |
1849 { | 2027 { |
1874 } | 2052 } |
1875 } | 2053 } |
1876 } | 2054 } |
1877 continue; | 2055 continue; |
1878 } | 2056 } |
1879 case WINDOW_PressedButton2: | 2057 case WINDOW_MainMenu: |
1880 { | 2058 case WINDOW_null: |
1881 if ( pWindow->Hint != (char *)1 ) | 2059 continue; |
1882 pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0); | |
1883 pButton = (GUIButton *)pWindow->ptr_1C; | |
1884 if ( pButton->uX >= 0 && pButton->uX <= window->GetWidth() ) | |
1885 { | |
1886 if ( pButton->uY >= 0 && pButton->uY <= window->GetHeight() ) | |
1887 { | |
1888 pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[0]); | |
1889 viewparams->bRedrawGameUI = 1; | |
1890 if ( pWindow->Hint ) | |
1891 { | |
1892 if ( pWindow->Hint != (char *)1 ) | |
1893 pButton->DrawLabel(pWindow->Hint, pFontCreate, 0, 0); | |
1894 } | |
1895 pWindow->Release(); | |
1896 continue; | |
1897 } | |
1898 } | |
1899 viewparams->bRedrawGameUI = 1; | |
1900 if ( pWindow->Hint ) | |
1901 { | |
1902 if ( pWindow->Hint != (char *)1 ) | |
1903 pButton->DrawLabel(pWindow->Hint, pFontCreate, 0, 0); | |
1904 } | |
1905 pWindow->Release(); | |
1906 continue; | |
1907 } | |
1908 case WINDOW_CharactersPressedButton: | |
1909 { | |
1910 if ( pWindow->Hint != (char *)1 ) | |
1911 pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0); | |
1912 pButton = (GUIButton *)pWindow->ptr_1C; | |
1913 pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[1]); | |
1914 viewparams->bRedrawGameUI = 1; | |
1915 if ( pWindow->Hint ) | |
1916 { | |
1917 if ( pWindow->Hint != (char *)1 ) | |
1918 pButton->DrawLabel(pWindow->Hint, pFontCreate, 0, 0); | |
1919 } | |
1920 pWindow->Release(); | |
1921 continue; | |
1922 } | |
1923 case WINDOW_PressedButton: | |
1924 { | |
1925 if ( pWindow->Hint != (char *)1 ) | |
1926 pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0); | |
1927 pButton = (GUIButton *)pWindow->ptr_1C; | |
1928 pRenderer->DrawTextureIndexedAlpha(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[0]); | |
1929 viewparams->bRedrawGameUI = 1; | |
1930 if ( pWindow->Hint ) | |
1931 { | |
1932 if ( pWindow->Hint != (char *)1 ) | |
1933 pButton->DrawLabel(pWindow->Hint, pFontCreate, 0, 0); | |
1934 } | |
1935 pWindow->Release(); | |
1936 continue; | |
1937 } | |
1938 case WINDOW_5D: | |
1939 { | |
1940 if ( pWindow->Hint != (char *)1 ) | |
1941 pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0); | |
1942 pButton = (GUIButton *)pWindow->ptr_1C; | |
1943 pRenderer->DrawTextureIndexedAlpha(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[1]); | |
1944 viewparams->bRedrawGameUI = 1; | |
1945 pWindow->Release(); | |
1946 continue; | |
1947 } | |
1948 case WINDOW_SaveLoadBtn: | |
1949 { | |
1950 if (pWindow->Hint != (char *)1) | |
1951 pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0); | |
1952 pButton = (GUIButton *)pWindow->ptr_1C; | |
1953 pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[0]); | |
1954 pHint = pWindow->Hint; | |
1955 viewparams->bRedrawGameUI = 1; | |
1956 if ( pHint && pHint != (char *)1 ) | |
1957 pButton->DrawLabel(pHint, pFontCreate, 0, 0); | |
1958 pWindow->Release(); | |
1959 if (current_screen_type == SCREEN_SAVEGAME) | |
1960 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_SaveGame, 0, 0); | |
1961 else | |
1962 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_LoadGame, 0, 0); | |
1963 continue; | |
1964 } | |
1965 case WINDOW_LoadGame_CancelBtn: | |
1966 { | |
1967 if ( pWindow->Hint != (char *)1 ) | |
1968 pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0); | |
1969 pButton = (GUIButton *)pWindow->ptr_1C; | |
1970 pRenderer->DrawTextureIndexedAlpha(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[0]); | |
1971 viewparams->bRedrawGameUI = 1; | |
1972 if ( pWindow->Hint && pWindow->Hint != (char *)1 ) | |
1973 pButton->DrawLabel(pWindow->Hint, pFontCreate, 0, 0); | |
1974 pWindow->Release(); | |
1975 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); | |
1976 continue; | |
1977 } | |
1978 case WINDOW_CloseRestWindowBtn: | |
1979 { | |
1980 if ( pWindow->Hint != (char *)1 ) | |
1981 pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0); | |
1982 pGUIButton = (GUIButton *)pWindow->ptr_1C; | |
1983 pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pGUIButton->pTextures[0]); | |
1984 pHint = pWindow->Hint; | |
1985 viewparams->bRedrawGameUI = 1; | |
1986 if ( pHint && pHint != (char *)1 ) | |
1987 pGUIButton->DrawLabel(pHint, pFontCreate, 0, 0); | |
1988 pWindow->Release(); | |
1989 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); | |
1990 continue; | |
1991 } | |
1992 case WINDOW_ExitCharacterWindow: | |
1993 { | |
1994 if ( pWindow->Hint != (char *)1 ) | |
1995 pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0); | |
1996 pButton = (GUIButton *)pWindow->ptr_1C; | |
1997 pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[1]); | |
1998 pHint = pWindow->Hint; | |
1999 viewparams->bRedrawGameUI = 1; | |
2000 if ( pHint && pHint != (char *)1 ) | |
2001 pButton->DrawLabel(pHint, pFontCreate, 0, 0); | |
2002 pWindow->Release(); | |
2003 pNumMessages = pMessageQueue_50CBD0->uNumMessages; | |
2004 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_Escape, 0, 0); | |
2005 continue; | |
2006 } | |
2007 case WINDOW_RestWindow: | |
2008 { | |
2009 memset(&GUIButton2, 0, 0xBCu); | |
2010 GUIButton2.uZ = 197; | |
2011 GUIButton2.uW = 197; | |
2012 GUIButton2.uX = 27; | |
2013 GUIButton2.uY = 161; | |
2014 GUIButton2.uWidth = 171; | |
2015 GUIButton2.uHeight = 37; | |
2016 GUIButton2.pParent = pButton_RestUI_WaitUntilDawn->pParent; | |
2017 pAudioPlayer->PlaySound(SOUND_StartMainChoice02, 0, 0, -1, 0, 0, 0, 0); | |
2018 pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, *((Texture **)pWindow->ptr_1C + 15)); | |
2019 viewparams->bRedrawGameUI = 1; | |
2020 GUIButton2.DrawLabel(pGlobalTXT_LocalizationStrings[183], pFontCreate, 0, 0);//Отдых и лечение 8 часов | |
2021 GUIButton2.pParent = 0; | |
2022 pGUIWindow2 = pWindow; | |
2023 pGUIWindow2->Release(); | |
2024 continue; | |
2025 } | |
2026 case WINDOW_BooksWindow: | |
2027 { | |
2028 pButton = (GUIButton *)pWindow->ptr_1C; | |
2029 pRenderer->DrawTextureIndexed(pWindow->uFrameY, | |
2030 pWindow->uFrameX, pButton->pTextures[0]); | |
2031 viewparams->bRedrawGameUI = true; | |
2032 continue; | |
2033 } | |
2034 case WINDOW_CharacterWindow_Inventory: | |
2035 { | |
2036 pWindow->DrawMessageBox(0); | |
2037 pWindow->DrawText(pFontLucida, 10, 20, 0, "Making item number", 0, 0, 0); | |
2038 pWindow->DrawText(pFontLucida, 10, 40, 0, pKeyActionMap->pPressedKeysBuffer, 0, 0, 0); | |
2039 if ( !pKeyActionMap->field_204 ) | |
2040 { | |
2041 ItemGen2.Reset(); | |
2042 pWindow->Release(); | |
2043 pEventTimer->Resume(); | |
2044 current_screen_type = SCREEN_GAME; | |
2045 viewparams->bRedrawGameUI = 1; | |
2046 v39 = atoi(pKeyActionMap->pPressedKeysBuffer); | |
2047 if ( v39 > 0 ) | |
2048 { | |
2049 if ( v39 < 800 ) | |
2050 SpawnActor(v39); | |
2051 } | |
2052 } | |
2053 continue; | |
2054 } | |
2055 case WINDOW_KeyMappingOptions: | |
2056 { | |
2057 GameMenuUI_DrawKeyBindings(); | |
2058 continue; | |
2059 } | |
2060 case WINDOW_VideoOptions: | |
2061 { | |
2062 GameMenuUI_DrawVideoOptions(); | |
2063 continue; | |
2064 } | |
2065 default: | 2060 default: |
2061 __debugbreak(); | |
2066 continue; | 2062 continue; |
2067 } | 2063 } |
2068 } | 2064 } |
2069 if ( GetCurrentMenuID() == -1 ) | 2065 if ( GetCurrentMenuID() == -1 ) |
2070 GameUI_DrawFoodAndGold(); | 2066 GameUI_DrawFoodAndGold(); |
2071 if ( sub_4637E0_is_there_popup_onscreen() ) | 2067 if ( sub_4637E0_is_there_popup_onscreen() ) |
2072 UI_OnMouseRightClick(0); | 2068 UI_OnMouseRightClick(0); |
2073 } | 2069 } |
2074 //void LoadFonts_and_DrawCopyrightWindow() | 2070 |
2075 //{ | |
2076 //MainMenuUI_LoadFontsAndSomeStuff(); | |
2077 // DrawCopyrightWindow(); | |
2078 //} | |
2079 //----- (00415485) -------------------------------------------------------- | 2071 //----- (00415485) -------------------------------------------------------- |
2080 void DrawMM7CopyrightWindow() | 2072 void DrawMM7CopyrightWindow() |
2081 { | 2073 { |
2082 GUIWindow Dst; // [sp+8h] [bp-54h]@1 | 2074 GUIWindow Dst; // [sp+8h] [bp-54h]@1 |
2083 | 2075 |
2109 //----- (004141CA) -------------------------------------------------------- | 2101 //----- (004141CA) -------------------------------------------------------- |
2110 void ModalWindow(const char *pStrHint, UIMessageType OnRelease_message) | 2102 void ModalWindow(const char *pStrHint, UIMessageType OnRelease_message) |
2111 { | 2103 { |
2112 pEventTimer->Pause(); | 2104 pEventTimer->Pause(); |
2113 modal_window_prev_screen_type = current_screen_type; | 2105 modal_window_prev_screen_type = current_screen_type; |
2114 pModalWindow = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_ModalWindow, OnRelease_message, pStrHint); | 2106 pModalWindow = new GUIWindow_Modal(0, 0, window->GetWidth(), window->GetHeight(), OnRelease_message, pStrHint); |
2115 current_screen_type = SCREEN_MODAL_WINDOW; | 2107 current_screen_type = SCREEN_MODAL_WINDOW; |
2116 } | 2108 } |
2117 | 2109 |
2118 //----- (0041420D) -------------------------------------------------------- | 2110 //----- (0041420D) -------------------------------------------------------- |
2119 void ModalWindow_ShowHint() | 2111 void ModalWindow_ShowHint() |
2184 if ( !pGUIWindow_ScrollWindow && mscroll_id >= 700 ) | 2176 if ( !pGUIWindow_ScrollWindow && mscroll_id >= 700 ) |
2185 { | 2177 { |
2186 if ( mscroll_id <= 782 ) | 2178 if ( mscroll_id <= 782 ) |
2187 { | 2179 { |
2188 uTextureID_720980 = pIcons_LOD->LoadTexture("leather", TEXTURE_16BIT_PALETTE); | 2180 uTextureID_720980 = pIcons_LOD->LoadTexture("leather", TEXTURE_16BIT_PALETTE); |
2189 pGUIWindow_ScrollWindow = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_Scroll, mscroll_id - 700, 0); | 2181 pGUIWindow_ScrollWindow = new GUIWindow_Scroll(0, 0, window->GetWidth(), window->GetHeight(), mscroll_id - 700, 0); |
2190 } | 2182 } |
2191 } | 2183 } |
2192 } | 2184 } |
2193 //----- (00467F9F) -------------------------------------------------------- | 2185 //----- (00467F9F) -------------------------------------------------------- |
2194 void free_book_subwindow() | 2186 void free_book_subwindow() |
2796 pEngine->Draw(); | 2788 pEngine->Draw(); |
2797 dword_7241C8 = 0; | 2789 dword_7241C8 = 0; |
2798 } | 2790 } |
2799 | 2791 |
2800 //----- (004B3E1E) -------------------------------------------------------- | 2792 //----- (004B3E1E) -------------------------------------------------------- |
2801 void sub_4B3E1E() | 2793 void sub_4B3E1E() |
2802 { | 2794 { |
2803 NPCData *v0; // ST40_4@1 | 2795 NPCData *v0; // ST40_4@1 |
2804 signed int v1; // edi@1 | 2796 signed int v1; // edi@1 |
2805 //GUIWindow *v2; // ecx@1 | 2797 //GUIWindow *v2; // ecx@1 |
2806 | 2798 |
2807 __debugbreak(); | 2799 __debugbreak(); |
2808 v0 = GetNPCData(sDialogue_SpeakingActorNPC_ID); | 2800 v0 = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
2809 v1 = 0; | 2801 v1 = 0; |
2810 pDialogueWindow->eWindowType = WINDOW_MainMenu; | 2802 pDialogueWindow->eWindowType = WINDOW_MainMenu; |
2811 pDialogueWindow->Release(); | 2803 pDialogueWindow->Release(); |
2812 pDialogueWindow = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_Dialogue, 1, 0); | 2804 pDialogueWindow = new GUIWindow_Dialogue(0, 0, window->GetWidth(), window->GetHeight(), 1, 0); |
2813 if (pNPCStats->pProfessions[v0->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v0->uProfession) ) | 2805 if (pNPCStats->pProfessions[v0->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v0->uProfession) ) |
2814 { | 2806 { |
2815 pDialogueWindow->CreateButton(480, 160, 140, 28, 1, 0, UIMSG_SelectNPCDialogueOption, 77, 0, pGlobalTXT_LocalizationStrings[407], 0);//Подробнее | 2807 pDialogueWindow->CreateButton(480, 160, 140, 28, 1, 0, UIMSG_SelectNPCDialogueOption, 77, 0, pGlobalTXT_LocalizationStrings[407], 0);//Подробнее |
2816 v1 = 1; | 2808 v1 = 1; |
2817 } | 2809 } |
3120 //__debugbreak(); | 3112 //__debugbreak(); |
3121 uDialogueType = DIALOGUE_SKILL_TRAINER; | 3113 uDialogueType = DIALOGUE_SKILL_TRAINER; |
3122 current_npc_text = (char *)pNPCTopics[a4 + 168].pText; | 3114 current_npc_text = (char *)pNPCTopics[a4 + 168].pText; |
3123 _4B254D_SkillMasteryTeacher(a4); //might be needed because of contract_approved ? | 3115 _4B254D_SkillMasteryTeacher(a4); //might be needed because of contract_approved ? |
3124 pDialogueWindow->Release(); | 3116 pDialogueWindow->Release(); |
3125 pDialogueWindow = GUIWindow::Create(0, 0, window->GetWidth(), 350, WINDOW_MainMenu, a4, 0); | 3117 pDialogueWindow = new GUIWindow(0, 0, window->GetWidth(), 350, a4, 0); |
3126 pBtn_ExitCancel = pDialogueWindow->CreateButton(471, 445, 169, 35, 1, 0, UIMSG_Escape, 0, 0, | 3118 pBtn_ExitCancel = pDialogueWindow->CreateButton(471, 445, 169, 35, 1, 0, UIMSG_Escape, 0, 0, |
3127 pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uExitCancelTextureId), 0); | 3119 pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uExitCancelTextureId), 0); |
3128 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); | 3120 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); |
3129 v2 = ""; | 3121 v2 = ""; |
3130 if (contract_approved) | 3122 if (contract_approved) |
3232 int i; // eax@2 | 3224 int i; // eax@2 |
3233 int rand_monster_id; // edx@3 | 3225 int rand_monster_id; // edx@3 |
3234 | 3226 |
3235 uDialogueType = 83; | 3227 uDialogueType = 83; |
3236 pDialogueWindow->Release(); | 3228 pDialogueWindow->Release(); |
3237 pDialogueWindow = GUIWindow::Create(0, 0, window->GetWidth(), 350, WINDOW_MainMenu, 0, 0); | 3229 pDialogueWindow = new GUIWindow(0, 0, window->GetWidth(), 350, 0, 0); |
3238 pBtn_ExitCancel = pDialogueWindow->CreateButton(471, 445, 169, 35, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[34],// "Cancel" | 3230 pBtn_ExitCancel = pDialogueWindow->CreateButton(471, 445, 169, 35, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[34],// "Cancel" |
3239 pIcons_LOD->GetTexture(uExitCancelTextureId), 0); | 3231 pIcons_LOD->GetTexture(uExitCancelTextureId), 0); |
3240 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); | 3232 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); |
3241 pDialogueWindow->CreateButton(480, 160, 140, 30, 1, 0, UIMSG_0, 83, 0, "", 0); | 3233 pDialogueWindow->CreateButton(480, 160, 140, 30, 1, 0, UIMSG_0, 83, 0, "", 0); |
3242 pDialogueWindow->_41D08F_set_keyboard_control_group(1, 1, 0, 2); | 3234 pDialogueWindow->_41D08F_set_keyboard_control_group(1, 1, 0, 2); |