Mercurial > mm7
annotate GUIWindow.cpp @ 1108:a1fd8045ffb1
probably erroneous semicolons removed, mace and staff stun chance work as they should
author | Grumpy7 |
---|---|
date | Mon, 27 May 2013 22:25:27 +0200 |
parents | 39f42990698f |
children | cf6cd674c398 |
rev | line source |
---|---|
0 | 1 #include "GUIWindow.h" |
2 #include "GUIFont.h" | |
3 #include "Party.h" | |
4 #include "LOD.h" | |
5 #include "Keyboard.h" | |
6 #include "IndoorCamera.h" | |
7 #include "Math.h" | |
8 #include "VideoPlayer.h" | |
9 #include "Allocator.h" | |
10 #include "MapInfo.h" | |
11 #include "Time.h" | |
12 #include "AudioPlayer.h" | |
13 #include "Mouse.h" | |
14 #include "Viewport.h" | |
15 #include "Render.h" | |
16 #include "PlayerFrameTable.h" | |
17 #include "SaveLoad.h" | |
18 #include "StorylineTextTable.h" | |
19 #include "Events2D.h" | |
629 | 20 #include "UIHouses.h" |
189 | 21 #include "texts.h" |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
74
diff
changeset
|
22 #include "Autonotes.h" |
949 | 23 #include "Awards.h" |
0 | 24 |
25 | |
26 #include "mm7_data.h" | |
27 | |
28 | |
29 | |
30 | |
31 int pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[1]; // idb | |
32 struct GUIWindow *pWindow_MainMenu; | |
33 struct GUIWindow pWindowList[20]; | |
34 | |
35 struct GUIMessageQueue *pMessageQueue_50CBD0 = new GUIMessageQueue; | |
1012 | 36 struct GUIMessageQueue *pMessageQueue_50C9E8 = new GUIMessageQueue; |
0 | 37 |
1038 | 38 |
39 | |
40 | |
41 | |
42 | |
43 | |
44 //----- (004141CA) -------------------------------------------------------- | |
45 void ModalWindow(const char *pStr, int a4) | |
46 { | |
47 pEventTimer->Pause(); | |
48 dword_506F0C[0] = pCurrentScreen; | |
49 ptr_507BDC = GUIWindow::Create(0, 0, 640, 480, WINDOW_FinalWindow, a4, (int)pStr); | |
50 pCurrentScreen = SCREEN_PRESS_ESCAPE_MESSAGE; | |
51 } | |
52 // 4E28F8: using guessed type int pCurrentScreen; | |
53 | |
783 | 54 // inlined |
55 //----- (mm6c::00420520) -------------------------------------------------- | |
56 void GUIMessageQueue::Flush() | |
57 { | |
58 if (uNumMessages) | |
59 uNumMessages = pMessages[0].field_8 != 0; | |
60 } | |
61 | |
62 | |
0 | 63 //----- (004356B9) -------------------------------------------------------- |
64 void GUIMessageQueue::PopMessage(enum UIMessageType *pType, int *pParam, int *a4) | |
65 { | |
66 signed int v4; // edx@1 | |
67 GUIMessage *v5; // eax@2 | |
68 | |
69 v4 = 0; | |
70 if ( this->uNumMessages ) | |
71 { | |
72 v5 = this->pMessages; | |
73 *pType = this->pMessages[0].eType; | |
74 *pParam = this->pMessages[0].param; | |
75 *a4 = this->pMessages[0].field_8; | |
76 if ( (signed int)(this->uNumMessages - 1) > 0 ) | |
77 { | |
78 do | |
79 { | |
80 v5->eType = v5[1].eType; | |
81 v5->param = v5[1].param; | |
82 v5->field_8 = v5[1].field_8; | |
83 ++v4; | |
84 ++v5; | |
85 } | |
86 while ( v4 < (signed int)(this->uNumMessages - 1) ); | |
87 } | |
88 --this->uNumMessages; | |
89 } | |
90 } | |
91 | |
92 | |
93 | |
994 | 94 |
95 | |
96 | |
97 //----- (0041B4E1) -------------------------------------------------------- | |
98 int __fastcall GUI_ReplaceHotkey(unsigned __int8 uOldHotkey, unsigned __int8 uNewHotkey, char bFirstCall) | |
99 { | |
100 unsigned __int8 v3; // bl@1 | |
101 int result; // eax@1 | |
102 int i; // edx@2 | |
103 GUIButton *j; // ecx@3 | |
104 int k; // edx@7 | |
105 GUIButton *l; // ecx@8 | |
106 unsigned __int8 v9; // [sp+4h] [bp-8h]@1 | |
107 char v10; // [sp+8h] [bp-4h]@1 | |
108 | |
109 v3 = uNewHotkey; | |
110 v10 = toupper(uOldHotkey); | |
111 result = toupper(v3); | |
112 v9 = result; | |
113 if ( bFirstCall ) | |
114 { | |
115 for ( i = uNumVisibleWindows; i >= 0; --i ) | |
116 { | |
117 result = 84 * pVisibleWindowsIdxs[i]; | |
118 for ( j = pWindowList[pVisibleWindowsIdxs[i] - 1].pControlsHead; j; j = j->pNext ) | |
119 j->field_28 = 0; | |
120 } | |
121 } | |
122 for ( k = uNumVisibleWindows; k >= 0; --k ) | |
123 { | |
124 result = 84 * pVisibleWindowsIdxs[k]; | |
125 for ( l = pWindowList[pVisibleWindowsIdxs[k] - 1].pControlsHead; l; l = l->pNext ) | |
126 { | |
127 LOBYTE(result) = v10; | |
128 if ( l->uHotkey == v10 ) | |
129 { | |
130 if ( !l->field_28 ) | |
131 { | |
132 LOBYTE(result) = v9; | |
133 l->field_28 = 1; | |
134 l->uHotkey = v9; | |
135 } | |
136 } | |
137 } | |
138 } | |
139 return result; | |
140 } | |
141 | |
142 | |
143 | |
144 | |
145 //----- (0041B438) -------------------------------------------------------- | |
146 GUIButton *__fastcall GUI_HandleHotkey(unsigned __int8 uHotkey) | |
147 { | |
148 char v1; // al@1 | |
149 int v2; // esi@1 | |
150 char v3; // dl@1 | |
151 GUIWindow *v4; // ecx@2 | |
152 GUIButton *result; // eax@2 | |
153 //int v6; // edx@12 | |
154 | |
155 v1 = toupper(uHotkey); | |
156 v2 = uNumVisibleWindows; | |
157 v3 = v1; | |
158 if ( uNumVisibleWindows >= 0 ) | |
159 { | |
160 while ( 2 ) | |
161 { | |
162 v4 = &pWindowList[pVisibleWindowsIdxs[v2] - 1]; | |
163 for ( result = v4->pControlsHead; result; result = result->pNext ) | |
164 { | |
165 if ( result->uHotkey == v3 ) | |
166 { | |
167 pMessageQueue_50CBD0->AddMessage(result->msg, result->msg_param, 0); | |
168 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
169 { | |
170 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)result->uControlID; | |
171 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v6; | |
172 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
173 ++pMessageQueue_50CBD0->uNumMessages; | |
174 }*/ | |
175 return result; | |
176 } | |
177 } | |
178 if ( v4->uFrameX || v4->uFrameY || !(v4->uFrameWidth == 640 & v4->uFrameHeight == 480) ) | |
179 { | |
180 --v2; | |
181 if ( v2 >= 0 ) | |
182 continue; | |
183 } | |
184 break; | |
185 } | |
186 } | |
187 return 0; | |
188 } | |
189 // 5075E0: using guessed type int pVisibleWindowsIdxs[20]; | |
190 | |
0 | 191 //----- (0041D73D) -------------------------------------------------------- |
1006 | 192 void GUIWindow::_41D73D_draw_buff_tooltip() |
193 { | |
0 | 194 GUIFont *v1; // esi@1 |
195 GUIWindow *v2; // edi@1 | |
196 SpellBuff *v3; // eax@1 | |
197 unsigned int v4; // eax@5 | |
198 int v5; // ecx@5 | |
199 unsigned int v6; // eax@5 | |
200 unsigned int v7; // ecx@5 | |
201 char *v8; // ebx@7 | |
202 unsigned int v9; // eax@8 | |
203 unsigned int v10; // ecx@8 | |
204 __int64 v11; // ST28_8@11 | |
205 int v12; // esi@11 | |
206 const char *v13; // ST0C_4@11 | |
207 unsigned int v14; // eax@11 | |
208 char **v16; // [sp+14h] [bp-10h]@7 | |
209 GUIFont *a2; // [sp+18h] [bp-Ch]@1 | |
210 SpellBuff *v18; // [sp+1Ch] [bp-8h]@7 | |
211 int v19; // [sp+20h] [bp-4h]@1 | |
212 int v20; // [sp+20h] [bp-4h]@7 | |
213 | |
214 v1 = pFontComic; | |
215 v2 = this; | |
216 a2 = pFontComic; | |
217 v19 = 0; | |
218 v3 = pParty->pPartyBuffs; | |
219 do | |
220 { | |
221 if ( (signed __int64)v3->uExpireTime > 0 ) | |
222 ++v19; | |
223 ++v3; | |
224 } | |
225 while ( (signed int)v3 < (signed int)pParty->pPlayers ); | |
226 v4 = LOBYTE(pFontArrus->uFontHeight) + 72; | |
227 this->uFrameHeight = v4; | |
228 v5 = v4 + (v19 - 1) * LOBYTE(pFontArrus->uFontHeight); | |
229 v6 = v2->uFrameWidth; | |
230 v2->uFrameHeight = v5; | |
231 v7 = v2->uFrameHeight; | |
232 v2->uFrameZ = v6 + v2->uFrameX - 1; | |
233 v2->uFrameW = v2->uFrameY + v7 - 1; | |
234 v2->DrawMessageBox(0); | |
235 v2->DrawTitleText(pFontArrus, 0, 0xCu, 0, pGlobalTXT_LocalizationStrings[451], 3u); | |
236 if ( !v19 ) | |
237 v2->DrawTitleText(v1, 0, 0x28u, 0, pGlobalTXT_LocalizationStrings[153], 3u); | |
238 v20 = 0; | |
239 GetTickCount(); | |
240 v8 = &_4E2B21_buff_spell_tooltip_colors[1]; | |
241 v16 = aSpellNames; | |
242 v18 = pParty->pPartyBuffs; | |
243 do | |
244 { | |
245 v9 = LODWORD(v18->uExpireTime); | |
246 v10 = HIDWORD(v18->uExpireTime); | |
17 | 247 if ( (v10 & 0x80000000u) == 0 && ((signed int)v10 > 0 || v9) )//!!! |
0 | 248 { |
17 | 249 v11 = __PAIR__(v10, v9) - pParty->uTimePlayed;//!!! |
0 | 250 v12 = v20 * LOBYTE(v1->uFontHeight) + 40; |
251 v13 = *v16; | |
252 ++v20; | |
949 | 253 v14 = TargetColor( |
0 | 254 (unsigned __int8)*(v8 - 1), |
255 (unsigned __int8)*v8, | |
256 (unsigned __int8)v8[1]); | |
257 v2->DrawText(a2, 52, v12, v14, v13, 0, 0, 0); | |
1006 | 258 sub_41D20D_buff_remaining_time_string(v12, v2, v11, a2); |
0 | 259 v1 = a2; |
260 } | |
261 ++v18; | |
262 ++v16; | |
263 v8 += 3; | |
264 } | |
265 while ( (signed int)v18 < (signed int)pParty->pPlayers ); | |
1006 | 266 |
0 | 267 } |
268 | |
269 | |
270 //----- (0041D08F) -------------------------------------------------------- | |
972 | 271 void GUIWindow::_41D08F_set_keyboard_control_group(int a2, int a3, int a4, int a5) |
0 | 272 { |
273 if ( a2 ) | |
274 { | |
275 this->pNumPresenceButton = a2; | |
276 this->field_30 = a3; | |
277 this->field_34 = a4; | |
278 this->pCurrentPosActiveItem = a5; | |
279 this->pStartingPosActiveItem = a5; | |
972 | 280 this->receives_keyboard_input = true; |
0 | 281 } |
282 else | |
283 { | |
284 this->pNumPresenceButton = 0; | |
285 this->field_30 = a3; | |
286 this->field_34 = a4; | |
287 this->pCurrentPosActiveItem = 0; | |
288 this->pStartingPosActiveItem = 0; | |
972 | 289 this->receives_keyboard_input = false; |
0 | 290 } |
291 } | |
292 | |
293 | |
294 //----- (0041C26A) -------------------------------------------------------- | |
295 void GUIWindow::Release() | |
296 { | |
961 | 297 //GUIWindow *v1; // esi@1 |
0 | 298 int i; // edi@20 |
961 | 299 //GUIButton *v8; // eax@26 |
300 GUIButton *pNextBtn; // edi@27 | |
301 //int v10; // esi@28 | |
302 //int v11; // ecx@28 | |
0 | 303 int v12; // edx@29 |
304 | |
961 | 305 //v1 = this; |
0 | 306 if ( !this ) |
307 return; | |
696 | 308 |
309 switch( this->eWindowType ) | |
0 | 310 { |
696 | 311 case WINDOW_GreetingNPC: |
312 { | |
1006 | 313 pIcons_LOD->SyncLoadedFilesCount(); |
696 | 314 pCurrentScreen = pMainScreenNum; |
1038 | 315 pKeyActionMap->SetWindowInputStatus(3); |
696 | 316 break; |
317 } | |
318 case WINDOW_HouseInterior: | |
319 { | |
320 for ( i = 0; i < uNumDialogueNPCPortraits; ++i ) | |
321 pDialogueNPCPortraits[i]->Release(); | |
322 uNumDialogueNPCPortraits = 0; | |
323 pTexture_Dialogue_Background->Release(); | |
0 | 324 |
1006 | 325 pIcons_LOD->SyncLoadedFilesCount(); |
696 | 326 pIcons_LOD->_4114F2(); |
327 dword_5C35D4 = 0; | |
328 if ( bFlipOnExit ) | |
329 { | |
330 pIndoorCamera->sRotationY = (stru_5C6E00->uIntegerDoublePi - 1) & (stru_5C6E00->uIntegerPi | |
331 + pIndoorCamera->sRotationY); | |
332 pParty->sRotationY = pIndoorCamera->sRotationY; | |
333 } | |
334 pParty->uFlags |= 2u; | |
335 break; | |
336 } | |
337 case WINDOW_Transition: | |
338 { | |
339 pVideoPlayer->Unload(); | |
340 pTexture_outside->Release(); | |
341 pTexture_Dialogue_Background->Release(); | |
1006 | 342 pIcons_LOD->SyncLoadedFilesCount(); |
696 | 343 pCurrentScreen = pMainScreenNum; |
344 break; | |
345 } | |
346 case WINDOW_SpellBook: | |
347 { | |
348 sub_41140B(); | |
349 sub_411473(); | |
350 break; | |
351 } | |
352 case WINDOW_Book: | |
353 { | |
960 | 354 OnCloseSpellBook(); |
696 | 355 break; |
356 } | |
357 case WINDOW_ChangeLocation: | |
358 { | |
0 | 359 pTexture_outside->Release(); |
360 pTexture_Dialogue_Background->Release(); | |
1006 | 361 pIcons_LOD->SyncLoadedFilesCount(); |
11 | 362 pCurrentScreen = pMainScreenNum; |
696 | 363 break; |
364 } | |
365 case WINDOW_Dialogue: | |
366 { | |
367 if ( !dword_591084 ) | |
368 pDialogueNPCPortraits[0]->Release(); | |
369 uNumDialogueNPCPortraits = 0; | |
370 pTexture_Dialogue_Background->Release(); | |
371 | |
1006 | 372 pIcons_LOD->SyncLoadedFilesCount(); |
696 | 373 pCurrentScreen = pMainScreenNum; |
374 } | |
375 default: | |
376 { | |
377 break; | |
378 } | |
0 | 379 } |
961 | 380 //v8 = this->pControlsHead; |
381 if ( this->pControlsHead ) | |
0 | 382 { |
383 do | |
384 { | |
961 | 385 pNextBtn = this->pControlsHead->pNext; |
386 pAllocator->FreeChunk(this->pControlsHead); | |
387 this->pControlsHead = pNextBtn; | |
0 | 388 } |
961 | 389 while ( pNextBtn ); |
0 | 390 } |
961 | 391 this->pControlsHead = 0; |
392 this->pControlsTail = 0; | |
393 this->uNumControls = 0; | |
394 this->eWindowType = WINDOW_null; | |
395 while ( this->numVisibleWindows < uNumVisibleWindows ) | |
0 | 396 { |
961 | 397 v12 = pVisibleWindowsIdxs[this->numVisibleWindows + 1]; |
398 pVisibleWindowsIdxs[this->numVisibleWindows] = v12; | |
962 | 399 --pWindowList[v12 - 1].numVisibleWindows; |
961 | 400 ++this->numVisibleWindows; |
0 | 401 } |
961 | 402 pVisibleWindowsIdxs[uNumVisibleWindows] = 0; |
403 uNumVisibleWindows = uNumVisibleWindows - 1; | |
0 | 404 } |
405 | |
406 | |
407 | |
408 | |
409 | |
410 | |
411 //----- (0041CD3B) -------------------------------------------------------- | |
412 GUIButton *GUIWindow::GetControl(unsigned int uID) | |
413 { | |
414 GUIButton *result; // eax@1 | |
415 unsigned int v3; // ecx@1 | |
416 | |
417 result = this->pControlsHead; | |
418 v3 = uID; | |
419 if ( (signed int)uID > 0 ) | |
420 { | |
421 do | |
422 { | |
423 result = result->pNext; | |
424 --v3; | |
425 } | |
426 while ( v3 ); | |
427 } | |
428 return result; | |
429 } | |
430 | |
431 //----- (00411BFC) -------------------------------------------------------- | |
432 void GUIWindow::InitializeBookView() | |
433 { | |
434 GUIWindow *v1; // ebp@1 | |
435 signed int v2; // ecx@8 | |
436 __int64 *v3; // ebp@9 | |
437 char *v4; // ecx@10 | |
438 char *v5; // eax@12 | |
439 int v6; // eax@12 | |
440 __int64 v7; // qax@12 | |
441 unsigned int v8; // esi@12 | |
442 GUIButton *v9; // eax@19 | |
443 signed int v10; // esi@19 | |
444 int v11; // eax@24 | |
445 int v12; // eax@27 | |
446 int i; // esi@28 | |
447 char *v14; // ebp@29 | |
448 int v15; // eax@31 | |
710 | 449 //unsigned int v16; // esi@35 |
0 | 450 Player *v17; // esi@38 |
451 unsigned __int16 v18; // ax@38 | |
452 unsigned int v19; // edi@43 | |
453 unsigned int v20; // edi@45 | |
454 void *v21; // esi@45 | |
455 signed int v23; // [sp+10h] [bp-5Ch]@38 | |
456 char *v25; // [sp+14h] [bp-58h]@21 | |
457 GUIWindow v26; // [sp+18h] [bp-54h]@8 | |
458 | |
459 v1 = this; | |
460 pAudioPlayer->StopChannels(-1, -1); | |
461 InitializeBookFonts(); | |
832 | 462 v1->CreateButton(0x1DBu, 0x1BDu, 0x9Eu, 0x22u, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], 0); // Close |
151 | 463 pCurrentScreen = SCREEN_BOOKS; |
949 | 464 num_achieved_awards_2 = 0; |
0 | 465 dword_506528 = 0; |
466 dword_50651C = 0; | |
949 | 467 num_achieved_awards = 0; |
688 | 468 switch (v1->par1C) |
469 { | |
961 | 470 case WINDOW_LloydsBeacon:{ |
688 | 471 byte_506360 = 0; |
948 | 472 pTexture_CurrentBook = pIcons_LOD->LoadTexturePtr("lb_bordr", TEXTURE_16BIT_PALETTE); |
473 pTexture_LloydBeacons[0] = pIcons_LOD->LoadTexturePtr("sbmap", TEXTURE_16BIT_PALETTE); | |
474 pTexture_50635C = pIcons_LOD->LoadTexturePtr("sbmap", TEXTURE_16BIT_PALETTE); | |
475 pTex_tab_an_6b__zoom_on = pIcons_LOD->LoadTexturePtr("tab-an-6b", TEXTURE_16BIT_PALETTE); | |
476 pTex_tab_an_6a__zoom_off = pIcons_LOD->LoadTexturePtr("tab-an-6a", TEXTURE_16BIT_PALETTE); | |
477 | |
961 | 478 pBtn_Book_1 = v1->CreateButton(415, 13, 39, 36, 1, 0, UIMSG_LloydsBeacon_FlippingBtn, 0, 0, pGlobalTXT_LocalizationStrings[375], 0); // Set Beacon |
479 pBtn_Book_2 = v1->CreateButton(415, 48, 39, 36, 1, 0, UIMSG_LloydsBeacon_FlippingBtn, 1, 0, pGlobalTXT_LocalizationStrings[523], 0); // Recall Beacon | |
948 | 480 |
688 | 481 v17 = &pParty->pPlayers[_506348_current_lloyd_playerid]; |
482 v23 = 1; | |
483 v18 = v17->pActiveSkills[14]; | |
484 if ( HIBYTE(v18) & 1 || (v18 & 0x80u) != 0 ) | |
485 { | |
486 v23 = 5; | |
487 } | |
488 else | |
489 { | |
490 if ( v18 & 0x40 ) | |
491 v23 = 3; | |
492 } | |
493 v19 = 0; | |
494 if ( v23 > 0 ) | |
495 { | |
496 do | |
497 { | |
961 | 498 v1->CreateButton(pLloydsBeaconsPreviewXs[v19], pLloydsBeaconsPreviewYs[v19], 0x5Cu, 0x44u, 1, 180, UIMSG_InstallBeacon, v19, 0, "", 0); |
688 | 499 ++v19; |
500 } | |
501 while ( (signed int)v19 < v23 ); | |
502 } | |
503 v20 = 0; | |
504 v21 = v17->pInstalledBeacons; | |
0 | 505 do |
688 | 506 { |
507 if ( *(_QWORD *)v21 >= (signed __int64)pParty->uTimePlayed ) | |
508 LoadThumbnailLloydTexture(v20, _506348_current_lloyd_playerid + 1); | |
509 else | |
510 memset(v21, 0, 0x1Cu); | |
511 ++v20; | |
512 v21 = (char *)v21 + 28; | |
513 } | |
514 while ( (signed int)v20 < 5 ); | |
0 | 515 } |
688 | 516 break; |
710 | 517 |
518 case WINDOW_TownPortal: | |
519 { | |
948 | 520 pTexture_CurrentBook = pIcons_LOD->LoadTexturePtr("townport", TEXTURE_16BIT_PALETTE); |
710 | 521 pTexture_TownPortalIcons[0] = pIcons_LOD->LoadTexturePtr("tpharmndy", TEXTURE_16BIT_PALETTE); |
522 pTexture_TownPortalIcons[1] = pIcons_LOD->LoadTexturePtr("tpelf", TEXTURE_16BIT_PALETTE); | |
523 pTexture_TownPortalIcons[2] = pIcons_LOD->LoadTexturePtr("tpwarlock", TEXTURE_16BIT_PALETTE); | |
524 pTexture_TownPortalIcons[3] = pIcons_LOD->LoadTexturePtr("tpisland", TEXTURE_16BIT_PALETTE); | |
525 pTexture_TownPortalIcons[4] = pIcons_LOD->LoadTexturePtr("tpheaven", TEXTURE_16BIT_PALETTE); | |
730 | 526 pTexture_TownPortalIcons[5] = pIcons_LOD->LoadTexturePtr("tphell", TEXTURE_16BIT_PALETTE); |
710 | 527 |
528 for (uint i = 0; i < 6; ++i) | |
961 | 529 v1->CreateButton(pTownPortalBook_xs[i], pTownPortalBook_ys[i], pTownPortalBook_ws[i], pTownPortalBook_hs[i], 1, 182, UIMSG_ClickTownInTP, i, 0, "", nullptr); |
710 | 530 /*v16 = 0; |
0 | 531 do |
688 | 532 { |
533 v1->CreateButton(pTownPortalBook_xs[v16], pTownPortalBook_ys[v16], pTownPortalBook_ws[v16], pTownPortalBook_hs[v16], 1, 182, 0xB7u, v16, 0, "", 0); | |
534 ++v16; | |
535 } | |
710 | 536 while ( (signed int)v16 < 6 );*/ |
537 } | |
538 break; | |
539 | |
540 case WINDOW_QuestBook: | |
948 | 541 { |
542 pTexture_CurrentBook = pIcons_LOD->LoadTexturePtr("sbquiknot", TEXTURE_16BIT_PALETTE); | |
543 pSpellBookPagesTextr_10 = pIcons_LOD->LoadTexturePtr( "divbar", TEXTURE_16BIT_PALETTE); | |
544 pTex_tab_an_6b__zoom_on = pIcons_LOD->LoadTexturePtr("tab-an-6b", TEXTURE_16BIT_PALETTE); | |
545 pTex_tab_an_7b__zoot_on = pIcons_LOD->LoadTexturePtr("tab-an-7b", TEXTURE_16BIT_PALETTE); | |
546 pTex_tab_an_6a__zoom_off = pIcons_LOD->LoadTexturePtr("tab-an-6a", TEXTURE_16BIT_PALETTE); | |
547 pTex_tab_an_7a__zoot_off = pIcons_LOD->LoadTexturePtr("tab-an-7a", TEXTURE_16BIT_PALETTE); | |
548 pBtn_Book_1 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, | |
549 pTex_tab_an_6b__zoom_on->uTextureWidth, pTex_tab_an_6b__zoom_on->uTextureHeight, | |
996 | 550 1, 0, UIMSG_ClickBooksBtn, 0xBu, 0, pGlobalTXT_LocalizationStrings[192],// "Scroll Up" |
948 | 551 pTex_tab_an_6b__zoom_on, 0); |
552 pBtn_Book_2 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, | |
553 pTex_tab_an_7b__zoot_on->uTextureHeight, pTex_tab_an_7b__zoot_on->uTextureHeight, | |
996 | 554 1, 0, UIMSG_ClickBooksBtn, 0xAu, 0, pGlobalTXT_LocalizationStrings[193],// "Scroll Down" |
948 | 555 pTex_tab_an_7b__zoot_on, 0); |
949 | 556 num_achieved_awards = 0; |
557 memset(achieved_awards, 0, 4000); | |
688 | 558 for ( i = dword_506528; i < 512; ++i ) |
559 { | |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
74
diff
changeset
|
560 v14 = (char *)pQuestTable[i-1];//(&dword_722F10)[4 * i]; |
521 | 561 if ( _449B57_test_bit(pParty->_quest_bits, i) && v14 ) |
0 | 562 { |
949 | 563 v15 = num_achieved_awards++; |
564 achieved_awards[v15] = (AwardType)i; | |
0 | 565 } |
566 } | |
949 | 567 v12 = num_achieved_awards; |
568 num_achieved_awards = 0; | |
569 num_achieved_awards_2 = v12; | |
688 | 570 } |
571 break; | |
981 | 572 |
573 | |
710 | 574 case WINDOW_AutonotesBook: |
688 | 575 { |
948 | 576 pTexture_AutonotesBook = pIcons_LOD->LoadTexturePtr("sbautnot", TEXTURE_16BIT_PALETTE); |
577 pSpellBookPagesTextr_10 = pIcons_LOD->LoadTexturePtr("divbar", TEXTURE_16BIT_PALETTE); | |
578 pTex_tab_an_6b__zoom_on = pIcons_LOD->LoadTexturePtr("tab-an-6b", TEXTURE_16BIT_PALETTE); | |
579 pTex_tab_an_7b__zoot_on = pIcons_LOD->LoadTexturePtr("tab-an-7b", TEXTURE_16BIT_PALETTE); | |
580 pTex_tab_an_6a__zoom_off = pIcons_LOD->LoadTexturePtr("tab-an-6a", TEXTURE_16BIT_PALETTE); | |
581 pTex_tab_an_7a__zoot_off = pIcons_LOD->LoadTexturePtr("tab-an-7a", TEXTURE_16BIT_PALETTE); | |
582 pTexture_506394 = pIcons_LOD->LoadTexturePtr("tab-an-1b", TEXTURE_16BIT_PALETTE); | |
583 pTexture_506390 = pIcons_LOD->LoadTexturePtr("tab-an-1a", TEXTURE_16BIT_PALETTE); | |
584 pTexture_50638C = pIcons_LOD->LoadTexturePtr("tab-an-2b", TEXTURE_16BIT_PALETTE); | |
585 pTexture_506388 = pIcons_LOD->LoadTexturePtr("tab-an-2a", TEXTURE_16BIT_PALETTE); | |
586 pTexture_506384 = pIcons_LOD->LoadTexturePtr("tab-an-3b", TEXTURE_16BIT_PALETTE); | |
587 pTexture_506380 = pIcons_LOD->LoadTexturePtr("tab-an-3a", TEXTURE_16BIT_PALETTE); | |
588 pTexture_50637C = pIcons_LOD->LoadTexturePtr("tab-an-5b", TEXTURE_16BIT_PALETTE); | |
589 pTexture_506378 = pIcons_LOD->LoadTexturePtr("tab-an-5a", TEXTURE_16BIT_PALETTE); | |
590 pTexture_506374 = pIcons_LOD->LoadTexturePtr("tab-an-4b", TEXTURE_16BIT_PALETTE); | |
591 pTexture_506370 = pIcons_LOD->LoadTexturePtr("tab-an-4a", TEXTURE_16BIT_PALETTE); | |
592 pTexture_50636C = pIcons_LOD->LoadTexturePtr("tab-an-8b", TEXTURE_16BIT_PALETTE); | |
593 pTexture_506368 = pIcons_LOD->LoadTexturePtr("tab-an-8a", TEXTURE_16BIT_PALETTE); | |
594 | |
996 | 595 pBtn_Book_1 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, 50, 34, 1, 0, UIMSG_ClickBooksBtn, 11, 0, pGlobalTXT_LocalizationStrings[193], pTex_tab_an_6b__zoom_on, 0); |
596 pBtn_Book_2 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, 50, 34, 1, 0, UIMSG_ClickBooksBtn, 10, 0, pGlobalTXT_LocalizationStrings[192], pTex_tab_an_7b__zoot_on, 0); | |
597 pBtn_Book_3 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, 50, 34, 1, 0, UIMSG_ClickBooksBtn, 2, 0, pGlobalTXT_LocalizationStrings[85], pTexture_506394, 0); // "Potion Notes" | |
598 pBtn_Book_4 = v1->CreateButton(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, 50, 34, 1, 0, UIMSG_ClickBooksBtn, 3, 0, pGlobalTXT_LocalizationStrings[137], pTexture_50638C, 0); // "Fountain Notes" | |
599 pBtn_Book_5 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, 50, 34, 1, 0, UIMSG_ClickBooksBtn, 4, 0, pGlobalTXT_LocalizationStrings[8], pTexture_506384, 0); // "Obelisk Notes" | |
600 pBtn_Book_6 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, 50, 34, 1, 0, UIMSG_ClickBooksBtn, 5, 0, pGlobalTXT_LocalizationStrings[141], pTexture_50637C, 0); // "Seer Notes" | |
601 pBtn_Autonotes_Misc = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 264, 50, 34, 1, 0, UIMSG_ClickBooksBtn, 6, 0, pGlobalTXT_LocalizationStrings[123], pTexture_506374, 0); // "Miscellaneous Notes" | |
602 pBtn_Autonotes_Instructors = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 302, 50, 34, 1, 0, UIMSG_ClickBooksBtn, 7, 0, pGlobalTXT_LocalizationStrings[662], pTexture_50636C, 0); // "Instructors" | |
948 | 603 |
604 v9 = pBtn_Autonotes_Instructors; | |
688 | 605 v10 = dword_506528; |
949 | 606 num_achieved_awards = 0; |
688 | 607 while ( v10 < 196 ) |
608 { | |
981 | 609 if ( _506568_autonote_type == pAutonoteTxt[v10-1].eType)//dword_72371C[2 * v10] ) |
688 | 610 { |
611 //v25 = (&dword_723718_autonote_related)[8 * (signed __int16)v10]; | |
612 v25 = (char *)pAutonoteTxt[v10-1].pText; | |
613 if ( (short)v10 ) | |
614 { | |
615 if ( _449B57_test_bit(pParty->_autonote_bits, v10) && v25 ) | |
616 { | |
949 | 617 v11 = num_achieved_awards++; |
618 achieved_awards[v11] = (AwardType)v10; | |
688 | 619 } |
620 } | |
621 } | |
622 ++v10; | |
623 } | |
624 } | |
625 break; | |
948 | 626 |
710 | 627 case WINDOW_MapsBook: |
948 | 628 { |
688 | 629 dword_506364 = 1; |
948 | 630 pSpellBookPagesTextr_12 = pIcons_LOD->LoadTexturePtr("sbmap", TEXTURE_16BIT_PALETTE); |
631 pTex_tab_an_6b__zoom_on = pIcons_LOD->LoadTexturePtr("zoom-on", TEXTURE_16BIT_PALETTE); | |
632 pTex_tab_an_7b__zoot_on = pIcons_LOD->LoadTexturePtr("zoot-on", TEXTURE_16BIT_PALETTE); | |
633 pTex_tab_an_6a__zoom_off = pIcons_LOD->LoadTexturePtr("zoom-off", TEXTURE_16BIT_PALETTE); | |
634 pTex_tab_an_7a__zoot_off = pIcons_LOD->LoadTexturePtr("zoot-off", TEXTURE_16BIT_PALETTE); | |
635 pTexture_506394 = pIcons_LOD->LoadTexturePtr("tabNon", TEXTURE_16BIT_PALETTE); | |
636 pTexture_506390 = pIcons_LOD->LoadTexturePtr("tabNoff", TEXTURE_16BIT_PALETTE); | |
637 pTexture_50638C = pIcons_LOD->LoadTexturePtr("tabSon", TEXTURE_16BIT_PALETTE); | |
638 pTexture_506388 = pIcons_LOD->LoadTexturePtr("tabSoff", TEXTURE_16BIT_PALETTE); | |
639 pTexture_506384 = pIcons_LOD->LoadTexturePtr("tabEon", TEXTURE_16BIT_PALETTE); | |
640 pTexture_506380 = pIcons_LOD->LoadTexturePtr("tabEoff", TEXTURE_16BIT_PALETTE); | |
641 pTexture_50637C = pIcons_LOD->LoadTexturePtr("tabWon", TEXTURE_16BIT_PALETTE); | |
642 pTexture_506378 = pIcons_LOD->LoadTexturePtr("tabWoff", TEXTURE_16BIT_PALETTE); | |
643 | |
996 | 644 pBtn_Book_1 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, 50, 34, 1, 0, UIMSG_ClickBooksBtn, 0, 0, pGlobalTXT_LocalizationStrings[251], pTex_tab_an_6b__zoom_on, 0);// "Zoom In" |
645 pBtn_Book_2 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, 50, 34, 1, 0, UIMSG_ClickBooksBtn, 1, 0, pGlobalTXT_LocalizationStrings[252], pTex_tab_an_7b__zoot_on, 0);// "Zoom Out" | |
646 pBtn_Book_3 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 113, 50, 34, 1, 0, UIMSG_ClickBooksBtn, 2, 0, pGlobalTXT_LocalizationStrings[192], (Texture *)"", 0);// Scroll Up | |
647 pBtn_Book_4 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 150, 50, 34, 1, 0, UIMSG_ClickBooksBtn, 3, 0, pGlobalTXT_LocalizationStrings[193], (Texture *)"", 0);// Scroll Down | |
648 pBtn_Book_5 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, 50, 34, 1, 0, UIMSG_ClickBooksBtn, 4, 0, pGlobalTXT_LocalizationStrings[573], (Texture *)"", 0);// "Scroll Right" | |
649 pBtn_Book_6 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, 50, 34, 1, 0, UIMSG_ClickBooksBtn, 5, 0, pGlobalTXT_LocalizationStrings[572], (Texture *)"", 0);// "Scroll Left" | |
688 | 650 } |
651 break; | |
948 | 652 |
653 case WINDOW_CalendarBook: | |
654 { | |
655 pSpellBookPagesTextr_13 = pIcons_LOD->LoadTexturePtr("sbdate-time", TEXTURE_16BIT_PALETTE); | |
656 pTex_moon_new = pIcons_LOD->LoadTexturePtr("moon_new", TEXTURE_16BIT_PALETTE); | |
657 pTex_moon_4 = pIcons_LOD->LoadTexturePtr("moon_4", TEXTURE_16BIT_PALETTE); | |
658 pTex_moon_2 = pIcons_LOD->LoadTexturePtr("moon_2", TEXTURE_16BIT_PALETTE); | |
659 pTex_moon_2_2 = pIcons_LOD->LoadTexturePtr("moon_2", TEXTURE_16BIT_PALETTE); | |
660 pTex_moon_ful = pIcons_LOD->LoadTexturePtr("moon_ful", TEXTURE_16BIT_PALETTE); | |
688 | 661 } |
662 break; | |
948 | 663 |
1004 | 664 case WINDOW_JournalBook: |
948 | 665 { |
666 pSpellBookPagesTextr_11 = pIcons_LOD->LoadTexturePtr("sbplayrnot", TEXTURE_16BIT_PALETTE); | |
667 pTex_tab_an_6b__zoom_on = pIcons_LOD->LoadTexturePtr("tab-an-6b", TEXTURE_16BIT_PALETTE); | |
668 pTex_tab_an_7b__zoot_on = pIcons_LOD->LoadTexturePtr("tab-an-7b", TEXTURE_16BIT_PALETTE); | |
669 pTex_tab_an_6a__zoom_off = pIcons_LOD->LoadTexturePtr("tab-an-6a", TEXTURE_16BIT_PALETTE); | |
670 pTex_tab_an_7a__zoot_off = pIcons_LOD->LoadTexturePtr("tab-an-7a", TEXTURE_16BIT_PALETTE); | |
671 | |
996 | 672 pBtn_Book_1 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, pTex_tab_an_6b__zoom_on->uTextureWidth, pTex_tab_an_6b__zoom_on->uTextureHeight, 1, 0, UIMSG_ClickBooksBtn, 11, 0, pGlobalTXT_LocalizationStrings[192], pTex_tab_an_6b__zoom_on, 0); |
673 pBtn_Book_2 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_tab_an_7b__zoot_on->uTextureHeight, pTex_tab_an_7b__zoot_on->uTextureHeight, 1, 0, UIMSG_ClickBooksBtn, 10, 0, pGlobalTXT_LocalizationStrings[193], pTex_tab_an_7b__zoot_on, 0); | |
948 | 674 |
949 | 675 num_achieved_awards = 0; |
688 | 676 v26.uFrameX = 48; |
677 v26.uFrameY = 70; | |
678 v26.uFrameWidth = 360; | |
679 v26.uFrameHeight = 264; | |
680 v2 = LOBYTE(pAutonoteFont->uFontHeight) - 3; | |
681 v26.uFrameZ = 407; | |
682 v26.uFrameHeight = v2 * 264 / v2; | |
683 v26.uFrameW = v26.uFrameHeight + 69; | |
949 | 684 memset(&achieved_awards, 0, 4000); |
688 | 685 memset(byte_5C6D50, 0, 0x64u); |
686 if ( dword_506528 < 29 ) | |
687 { | |
688 v3 = (__int64 *)&pParty->field_3C.field_4F0[2 * dword_506528]; | |
689 for(int i=dword_506528+1;i<dword_506528+31;i++) | |
690 { | |
691 v4 = pStorylineText->StoreLine[i].pText; | |
692 if ( *v3 ) | |
693 { | |
694 if ( v4 ) | |
695 { | |
696 v5 = BuilDialogueString(v4, uActiveCharacter - 1, 0, 0, 0, v3); | |
697 v6 = pAutonoteFont->CalcTextHeight(v5, &v26, 1, 0); | |
698 v7 = (v6 - 3) / (signed int)v26.uFrameHeight; | |
699 v8 = v7 + 1; | |
700 if ( (signed int)v7 + 1 > 0 ) | |
701 { | |
949 | 702 memset32((char *)&achieved_awards + 4 * num_achieved_awards , i, v8); |
688 | 703 do |
704 { | |
949 | 705 LODWORD(v7) = num_achieved_awards++; |
688 | 706 byte_5C6D50[(int)v7] = BYTE4(v7); |
707 ++HIDWORD(v7); | |
708 } | |
709 while ( SHIDWORD(v7) < (signed int)v8 ); | |
710 } | |
711 } | |
712 } | |
713 ++i; | |
714 ++v3; | |
715 } | |
716 } | |
717 | |
718 } | |
719 break; | |
720 } | |
721 | |
0 | 722 } |
723 | |
724 | |
725 | |
726 | |
727 //----- (00415551) -------------------------------------------------------- | |
728 void GUIWindow::DrawMessageBox(int arg0) | |
729 { | |
730 unsigned int v2; // edi@1 | |
731 GUIWindow *v3; // ebx@1 | |
732 signed int v4; // esi@2 | |
733 unsigned int v5; // eax@2 | |
734 unsigned int v6; // edx@4 | |
735 unsigned int v7; // ecx@6 | |
736 unsigned int v8; // eax@9 | |
737 __int32 v9; // eax@10 | |
738 unsigned int v10; // eax@18 | |
739 LONG v11; // ecx@18 | |
740 unsigned int v12; // edx@18 | |
741 unsigned int v13; // eax@18 | |
742 const char *v14; // ecx@18 | |
743 int v15; // eax@19 | |
744 unsigned int v16; // esi@19 | |
745 const char *v17; // ebx@25 | |
746 int v18; // eax@26 | |
747 GUIWindow v19; // [sp+Ch] [bp-60h]@18 | |
748 POINT a2; // [sp+60h] [bp-Ch]@8 | |
749 unsigned int v21; // [sp+68h] [bp-4h]@18 | |
750 unsigned int v22; // [sp+74h] [bp+8h]@2 | |
751 unsigned int v23; // [sp+74h] [bp+8h]@18 | |
752 | |
753 v2 = 0; | |
754 v3 = this; | |
755 if ( arg0 ) | |
756 { | |
693 | 757 v4 = pViewport->uViewportTL_X; |
758 v5 = pViewport->uViewportBR_X; | |
759 v2 = pViewport->uViewportTL_Y; | |
760 v22 = pViewport->uViewportBR_Y; | |
0 | 761 } |
762 else | |
763 { | |
764 v4 = 0; | |
765 v5 = 640; | |
766 v22 = 480; | |
767 } | |
768 v6 = this->uFrameX; | |
769 if ( (signed int)this->uFrameX >= v4 ) | |
770 { | |
771 v7 = this->uFrameWidth; | |
772 if ( (signed int)(v7 + v6) <= (signed int)v5 ) | |
773 goto LABEL_9; | |
774 v3->uFrameX = v5 - v7; | |
775 } | |
776 else | |
777 { | |
778 this->uFrameX = v4; | |
779 } | |
780 v3->uFrameY = pMouse->GetCursorPos(&a2)->y + 30; | |
781 LABEL_9: | |
782 v8 = v3->uFrameY; | |
783 if ( (signed int)v8 >= (signed int)v2 ) | |
784 { | |
785 if ( (signed int)(v8 + v3->uFrameHeight) <= (signed int)v22 ) | |
786 goto LABEL_14; | |
787 v9 = pMouse->GetCursorPos(&a2)->y - v3->uFrameHeight - 30; | |
788 } | |
789 else | |
790 { | |
791 v9 = pMouse->GetCursorPos(&a2)->y + 30; | |
792 } | |
793 v3->uFrameY = v9; | |
794 LABEL_14: | |
795 if ( (signed int)v3->uFrameY < (signed int)v2 ) | |
796 v3->uFrameY = v2; | |
797 if ( (signed int)v3->uFrameX < v4 ) | |
798 v3->uFrameX = v4; | |
799 v10 = v3->uFrameWidth; | |
800 v11 = v3->uFrameX; | |
801 v12 = v3->uFrameY; | |
802 v21 = v10; | |
803 a2.y = v11; | |
804 v3->uFrameZ = v10 + v11 - 1; | |
805 v13 = v3->uFrameHeight; | |
806 v3->uFrameW = v13 + v12 - 1; | |
807 memcpy(&v19, v3, sizeof(v19)); | |
808 v19.uFrameX += 12; | |
809 v19.uFrameWidth -= 24; | |
810 v19.uFrameY += 12; | |
811 v19.uFrameHeight -= 12; | |
812 v19.uFrameZ = v19.uFrameWidth + v19.uFrameX - 1; | |
813 v23 = v12; | |
814 v19.uFrameW = v19.uFrameHeight + v19.uFrameY - 1; | |
815 v14 = v3->Hint; | |
816 if ( v14 ) | |
817 { | |
818 v15 = pFontLucida->CalcTextHeight(v14, &v19, 0, 0); | |
819 v12 = v23; | |
820 v16 = v15 + 24; | |
821 } | |
822 else | |
823 { | |
824 v16 = v13; | |
825 } | |
826 if ( (signed int)v16 < 64 ) | |
827 v16 = 64; | |
828 if ( (signed int)(v16 + v12) > 479 ) | |
829 v16 = 479 - v12; | |
830 DrawPopupWindow(a2.y, v12, v21, v16); | |
831 v17 = v3->Hint; | |
832 if ( v17 ) | |
833 { | |
834 v18 = pFontLucida->CalcTextHeight(v17, &v19, 0, 0); | |
1004 | 835 v19.DrawTitleText(pFontLucida, 0, (signed int)(v16 - v18) / 2 - 14, 0, v17, 3); |
0 | 836 } |
837 } | |
838 | |
839 | |
840 | |
841 | |
842 //----- (00411B59) -------------------------------------------------------- | |
843 void __fastcall LoadThumbnailLloydTexture(unsigned int uSlot, unsigned int uPlayer) | |
844 { | |
845 unsigned int v2; // esi@1 | |
846 unsigned int v3; // edi@1 | |
847 FILE *v4; // ebx@1 | |
848 FILE *v5; // eax@2 | |
849 char pContainerName[64]; // [sp+Ch] [bp-44h]@1 | |
850 unsigned int v7; // [sp+4Ch] [bp-4h]@1 | |
851 | |
852 v2 = uSlot; | |
853 v7 = uPlayer; | |
854 v3 = uSlot + 1; | |
855 sprintf(pContainerName, "data\\lloyd%d%d.pcx", uPlayer, uSlot + 1); | |
856 v4 = fopen(pContainerName, "rb"); | |
857 if ( v4 ) | |
858 { | |
859 pSavegameThumbnails[v2].LoadFromFILE(v4, 0, 1u); | |
860 fclose(v4); | |
861 } | |
862 else | |
863 { | |
864 sprintf(pContainerName, "lloyd%d%d.pcx", v7, v3); | |
865 v5 = pNew_LOD->FindContainer(pContainerName, 1); | |
866 if ( v5 ) | |
867 pSavegameThumbnails[v2].LoadFromFILE(v5, 0, 0); | |
868 else | |
869 *((int *)&pSavegameThumbnails->pPixels + 10 * v2) = 0; | |
870 } | |
871 } | |
872 | |
873 | |
874 //----- (00411621) -------------------------------------------------------- | |
198 | 875 void GUIWindow::OpenSpellBook() |
0 | 876 { |
11 | 877 Player *pPlayer; // edi@1 |
198 | 878 //GUIWindow *pWindow; // esi@1 |
879 //unsigned int v3; // ebp@1 | |
0 | 880 int v4; // eax@3 |
198 | 881 ///GUIButton *result; // eax@25 |
0 | 882 int a2; // [sp+10h] [bp-8h]@1 |
198 | 883 //int v7; // [sp+14h] [bp-4h]@1 |
0 | 884 |
11 | 885 pPlayer = pPlayers[uActiveCharacter]; |
198 | 886 //pWindow = this; |
887 LoadSpellbook(pPlayer->lastOpenedSpellbookPage); | |
888 //v3 = 0; | |
0 | 889 a2 = 0; |
198 | 890 |
891 auto chapter = &pPlayer->spellbook.pChapters[pPlayer->lastOpenedSpellbookPage]; | |
892 for (uint i = 0; i < 11; ++i) | |
0 | 893 { |
198 | 894 if (!chapter->bIsSpellAvailable[i]) |
895 continue; | |
363 | 896 v4= pPlayer->lastOpenedSpellbookPage; |
897 //v4 = (12 * pPlayer->lastOpenedSpellbookPage + pSpellbookSpellIndices[pPlayer->lastOpenedSpellbookPage][i + 1]); | |
693 | 898 CreateButton(pViewport->uViewportTL_X + pIconPos[v4][pSpellbookSpellIndices[v4][i+1]].Xpos, |
899 pViewport->uViewportTL_Y + pIconPos[v4][pSpellbookSpellIndices[v4][i+1]].Ypos, //dword_4E20D0 | |
198 | 900 dword_506408[i + 1]->uTextureWidth, |
901 dword_506408[i + 1]->uTextureHeight, | |
832 | 902 1, 79, UIMSG_SelectSpell, i, 0, "", 0); |
0 | 903 ++a2; |
198 | 904 //++v3; |
0 | 905 } |
198 | 906 //while ( (signed int)v3 < 11 ); |
907 | |
948 | 908 CreateButton(0, 0, 0, 0, 1, 0, UIMSG_33, 0, '\t', "", 0); |
0 | 909 if ( a2 ) |
972 | 910 _41D08F_set_keyboard_control_group(a2, 0, 0, 0); |
948 | 911 |
912 if (pPlayer->pActiveSkills[PLAYER_SKILL_FIRE]) CreateButton(399, 10, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 0, 0, aSpellSchoolNames[0], 0); | |
913 if (pPlayer->pActiveSkills[PLAYER_SKILL_AIR]) CreateButton(399, 46, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 1, 0, aSpellSchoolNames[1], 0); | |
914 if (pPlayer->pActiveSkills[PLAYER_SKILL_WATER]) CreateButton(399, 83, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 2, 0, aSpellSchoolNames[2], 0); | |
915 if (pPlayer->pActiveSkills[PLAYER_SKILL_EARTH]) CreateButton(399, 121, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 3, 0, aSpellSchoolNames[3], 0); | |
916 if (pPlayer->pActiveSkills[PLAYER_SKILL_SPIRIT]) CreateButton(399, 158, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 4, 0, aSpellSchoolNames[4], 0); | |
917 if (pPlayer->pActiveSkills[PLAYER_SKILL_MIND]) CreateButton(400, 196, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 5, 0, aSpellSchoolNames[5], 0); | |
918 if (pPlayer->pActiveSkills[PLAYER_SKILL_BODY]) CreateButton(400, 234, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 6, 0, aSpellSchoolNames[6], 0); | |
919 if (pPlayer->pActiveSkills[PLAYER_SKILL_LIGHT]) CreateButton(400, 271, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 7, 0, aSpellSchoolNames[7], 0); | |
920 if (pPlayer->pActiveSkills[PLAYER_SKILL_DARK]) CreateButton(400, 307, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 8, 0, aSpellSchoolNames[8], 0); | |
921 | |
960 | 922 CreateButton(476, 450, pTexture_506444->uTextureWidth, pTexture_506444->uTextureHeight, 1, 78, UIMSG_ClickInstallRemoveQuickSpellBtn, 0, 0, "", 0); |
923 pBtn_InstallRemoveSpell = CreateButton(476, 450, 48, 32, 1, 78, UIMSG_ClickInstallRemoveQuickSpellBtn, 0, 0, "", pTexture_506444, 0); | |
948 | 924 CreateButton(561, 450, ptr_506440->uTextureWidth, ptr_506440->uTextureHeight, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], 0); |
925 pBtn_CloseBook = CreateButton(561, 450, 48, 32, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], ptr_506440, 0); | |
0 | 926 } |
927 // 50640C: using guessed type int dword_50640C[]; | |
928 | |
929 //----- (004B3157) -------------------------------------------------------- | |
405 | 930 void GUIWindow::HouseDialogManager() |
0 | 931 { |
854 | 932 unsigned __int16 pWhiteColor; // di@2 |
933 const char *pHouseName; // edx@4 | |
0 | 934 signed int v3; // edx@5 |
935 char *v4; // edi@9 | |
854 | 936 int pTextHeight; // eax@45 |
0 | 937 int v6; // edi@45 |
938 char *v7; // eax@45 | |
939 int v8; // edi@46 | |
940 int v9; // eax@50 | |
941 unsigned int v10; // [sp-10h] [bp-C8h]@53 | |
873 | 942 char *pTitleText; // [sp-8h] [bp-C0h]@50 |
854 | 943 GUIWindow pDialogWindow; // [sp+Ch] [bp-ACh]@4 |
944 GUIWindow pWindow; // [sp+60h] [bp-58h]@2 | |
945 int pColor2; // [sp+B4h] [bp-4h]@2 | |
0 | 946 |
336 | 947 if ( !window_SpeakInHouse ) |
0 | 948 return; |
854 | 949 memcpy(&pWindow, this, sizeof(pWindow)); |
950 pWindow.uFrameWidth -= 18; | |
951 pWindow.uFrameZ -= 18; | |
949 | 952 pWhiteColor = TargetColor(0xFFu, 0xFFu, 0xFFu); |
953 pColor2 = TargetColor(0x15u, 0x99u, 0xE9u); | |
0 | 954 pRenderer->DrawTextureIndexed(0x1DDu, 0, pTexture_Dialogue_Background); |
910 | 955 pRenderer->DrawTextureTransparent(0x1D4u, 0, &pIcons_LOD->pTextures[uTextureID_right_panel_loop]); |
457 | 956 if ( pDialogueNPCCount != uNumDialogueNPCPortraits || !uHouse_ExitPic ) |
0 | 957 { |
854 | 958 pDialogWindow.uFrameWidth = 130; |
959 pDialogWindow.uFrameHeight = 2 * LOBYTE(pFontCreate->uFontHeight); | |
960 pHouseName = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pName; | |
961 if ( pHouseName ) | |
0 | 962 { |
854 | 963 v3 = 2 * LOBYTE(pFontCreate->uFontHeight) - 6 - pFontCreate->CalcTextHeight(pHouseName, &pDialogWindow, 0, 0); |
0 | 964 if ( v3 < 0 ) |
965 v3 = 0; | |
854 | 966 pWindow.DrawTitleText(pFontCreate, 0x1EAu, v3 / 2 + 4, pWhiteColor, |
0 | 967 //(const char *)p2DEvents_minus1_::04[13 * (unsigned int)ptr_507BC0->ptr_1C], |
336 | 968 p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pName, 3); |
0 | 969 } |
970 } | |
854 | 971 pWindow.uFrameWidth += 8; |
972 pWindow.uFrameZ += 8; | |
457 | 973 if ( !pDialogueNPCCount ) |
0 | 974 { |
484 | 975 if ( in_current_building_type == BildingType_Jail ) |
0 | 976 { |
480 | 977 JailDialog(); |
854 | 978 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic ) |
979 { | |
980 pRenderer->DrawTextureIndexed(556, 451, &pIcons_LOD->pTextures[uTextureID_x_x_u]); | |
981 pRenderer->DrawTextureIndexed(476, 451, &pIcons_LOD->pTextures[uTextureID_x_ok_u]); | |
982 } | |
983 else | |
984 { | |
985 pRenderer->DrawTextureIndexed(471, 445, &pIcons_LOD->pTextures[uExitCancelTextureId]); | |
986 } | |
987 return; | |
0 | 988 } |
827 | 989 if ( current_npc_text ) |
0 | 990 { |
854 | 991 pDialogWindow.uFrameWidth = 458; |
992 pDialogWindow.uFrameZ = 457; | |
993 pTextHeight = pFontArrus->CalcTextHeight(current_npc_text, &pDialogWindow, 13, 0); | |
994 v6 = pTextHeight + 7; | |
995 pRenderer->_4A6A68(8, 352 - (pTextHeight + 7), &pIcons_LOD->pTextures[uTextureID_Leather], | |
996 pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight - (pTextHeight + 7)); | |
997 pRenderer->DrawTextureIndexed(8, 347 - v6, pTexture_591428); | |
998 v7 = FitTextInAWindow(current_npc_text, pFontArrus, &pDialogWindow, 0xDu, 0); | |
336 | 999 window_SpeakInHouse->DrawText(pFontArrus, 13, 354 - v6, 0, v7, 0, 0, 0); |
0 | 1000 } |
1001 if ( uNumDialogueNPCPortraits <= 0 ) | |
854 | 1002 { |
1003 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic ) | |
1004 { | |
1005 pRenderer->DrawTextureIndexed(556, 451, &pIcons_LOD->pTextures[uTextureID_x_x_u]); | |
1006 pRenderer->DrawTextureIndexed(476, 451, &pIcons_LOD->pTextures[uTextureID_x_ok_u]); | |
1007 } | |
1008 else | |
1009 { | |
1010 pRenderer->DrawTextureIndexed(471, 445, &pIcons_LOD->pTextures[uExitCancelTextureId]); | |
1011 } | |
1012 return; | |
1013 } | |
873 | 1014 for ( v8 = 0; v8 < uNumDialogueNPCPortraits; ++v8 ) |
0 | 1015 { |
419 | 1016 pRenderer->DrawTextureIndexed(pNPCPortraits_x[uNumDialogueNPCPortraits - 1][v8] - 4, |
874 | 1017 pNPCPortraits_y[uNumDialogueNPCPortraits - 1][v8] - 4, &pIcons_LOD->pTextures[uTextureID_50795C]); |
419 | 1018 pRenderer->DrawTextureIndexed(pNPCPortraits_x[uNumDialogueNPCPortraits - 1][v8], |
1019 pNPCPortraits_y[uNumDialogueNPCPortraits - 1][v8], pDialogueNPCPortraits[v8]); | |
0 | 1020 if ( uNumDialogueNPCPortraits < 4 ) |
854 | 1021 { |
873 | 1022 if ( v8 + 1 == uNumDialogueNPCPortraits && uHouse_ExitPic ) |
854 | 1023 { |
873 | 1024 pTitleText = pMapStats->pInfos[uHouse_ExitPic].pName; |
1025 v9 = 94 * v8 + 113; | |
854 | 1026 } |
1027 else | |
1028 { | |
873 | 1029 if ( !v8 && dword_591080 ) |
1030 { | |
1031 pTitleText = (char *)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pProprieterTitle; | |
1032 pWindow.DrawTitleText(pFontCreate, 0x1E3u, 113, pColor2, pTitleText, 3); | |
1033 continue; | |
1034 } | |
1035 pTitleText = HouseNPCData[v8 - (dword_591080 != 0)]->pName; | |
1036 v9 = pNPCPortraits_x[6 + (uNumDialogueNPCPortraits - 1)][v8] + pDialogueNPCPortraits[v8]->uTextureHeight + 2; | |
854 | 1037 } |
873 | 1038 v10 = v9; |
1039 pWindow.DrawTitleText(pFontCreate, 0x1E3u, v10, pColor2, pTitleText, 3); | |
854 | 1040 } |
874 | 1041 } |
873 | 1042 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic ) |
0 | 1043 { |
873 | 1044 pRenderer->DrawTextureIndexed(556, 451, &pIcons_LOD->pTextures[uTextureID_x_x_u]); |
1045 pRenderer->DrawTextureIndexed(476, 451, &pIcons_LOD->pTextures[uTextureID_x_ok_u]); | |
0 | 1046 } |
873 | 1047 else |
1048 { | |
1049 pRenderer->DrawTextureIndexed(471, 445, &pIcons_LOD->pTextures[uExitCancelTextureId]); | |
1050 } | |
1051 return; | |
0 | 1052 } |
457 | 1053 v4 = (char *)pDialogueNPCCount - 1; |
419 | 1054 pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0] - 4, pNPCPortraits_y[0][0] - 4, &pIcons_LOD->pTextures[uTextureID_50795C]); |
1055 pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], pDialogueNPCPortraits[(signed int)v4]); | |
151 | 1056 if ( pCurrentScreen == SCREEN_E ) |
0 | 1057 { |
984 | 1058 CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); |
854 | 1059 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic ) |
1060 { | |
1061 pRenderer->DrawTextureIndexed(556, 451, &pIcons_LOD->pTextures[uTextureID_x_x_u]); | |
1062 pRenderer->DrawTextureIndexed(476, 451, &pIcons_LOD->pTextures[uTextureID_x_ok_u]); | |
1063 } | |
1064 else | |
1065 { | |
1066 pRenderer->DrawTextureIndexed(471, 445, &pIcons_LOD->pTextures[uExitCancelTextureId]); | |
1067 } | |
1068 return; | |
0 | 1069 } |
1070 if ( v4 || !dword_591080 ) | |
1071 { | |
445 | 1072 SimpleHouseAndBoatsDialog(); |
0 | 1073 } |
1074 else | |
1075 { | |
264 | 1076 sprintfex( pTmpBuf, pGlobalTXT_LocalizationStrings[429], |
336 | 1077 p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pProprieterName, |
1078 p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pProprieterTitle); | |
854 | 1079 pWindow.DrawTitleText(pFontCreate, 0x1E3u, 0x71u, pColor2, pTmpBuf, 3); |
484 | 1080 switch ( in_current_building_type ) |
0 | 1081 { |
480 | 1082 case BildingType_WeaponShop: |
405 | 1083 WeaponShopDialog(); |
0 | 1084 break; |
480 | 1085 case BildingType_ArmorShop: |
405 | 1086 ArmorShopDialog(); |
0 | 1087 break; |
480 | 1088 case BildingType_MagicShop: |
405 | 1089 MagicShopDialog(); |
0 | 1090 break; |
480 | 1091 case BildingType_AlchemistShop: |
405 | 1092 AlchemistDialog(); |
0 | 1093 break; |
480 | 1094 case BildingType_FireGuild: |
1095 case BildingType_AirGuild: | |
1096 case BildingType_WaterGuild: | |
1097 case BildingType_EarthGuild: | |
1098 case BildingType_SpiritGuild: | |
1099 case BildingType_MindGuild: | |
1100 case BildingType_BodyGuild: | |
1101 case BildingType_LightGuild: | |
495 | 1102 case BildingType_DarkGuild: |
480 | 1103 GuildDialog(); |
1104 break; | |
1105 case BildingType_18: | |
987 | 1106 __debugbreak(); //What over the dialog? |
480 | 1107 sub_4B6478(); |
1108 break; | |
1109 case BildingType_TownHall: | |
1110 TownHallDialog(); | |
1111 break; | |
1112 case BildingType_Tavern: | |
1113 TavernDialog(); | |
1114 break; | |
1115 case BildingType_Bank: | |
1116 BankDialog(); | |
1117 break; | |
481 | 1118 case BildingType_Temple: |
495 | 1119 TempleDialog(); |
480 | 1120 break; |
1121 case BildingType_Stables: | |
1122 TravelByTransport(); | |
1123 break; | |
1124 case BildingType_Training: | |
1125 TrainingDialog(); | |
1126 break; | |
1127 case BildingType_Jail: | |
1128 JailDialog(); | |
1129 break; | |
0 | 1130 default: |
987 | 1131 __debugbreak();//New BildingType |
0 | 1132 break; |
1133 } | |
1134 } | |
457 | 1135 if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic ) |
0 | 1136 { |
370 | 1137 pRenderer->DrawTextureIndexed(556, 451, &pIcons_LOD->pTextures[uTextureID_x_x_u]); |
1138 pRenderer->DrawTextureIndexed(476, 451, &pIcons_LOD->pTextures[uTextureID_x_ok_u]); | |
0 | 1139 } |
1140 else | |
1141 { | |
526 | 1142 pRenderer->DrawTextureIndexed(471, 445, &pIcons_LOD->pTextures[uExitCancelTextureId]); |
0 | 1143 } |
1144 } | |
1145 | |
1146 //----- (004B1854) -------------------------------------------------------- | |
471
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
457
diff
changeset
|
1147 void GUIWindow::DrawCurrentTime( __int64 a2 ) |
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
457
diff
changeset
|
1148 { |
0 | 1149 unsigned int v2; // edi@1 |
1150 unsigned int v3; // esi@1 | |
1151 unsigned int v4; // ebp@1 | |
1152 unsigned int v5; // ebx@1 | |
1153 signed __int64 v6; // ST2C_8@1 | |
1154 signed __int64 v7; // kr00_8@1 | |
1155 char *v8; // eax@2 | |
1156 char *v9; // eax@7 | |
1157 char *v10; // eax@13 | |
1158 char *v11; // eax@19 | |
1159 unsigned __int16 v12; // ST0C_2@22 | |
1160 int v13; // eax@22 | |
1161 GUIWindow *v15; // [sp+0h] [bp-1Ch]@1 | |
1162 signed __int64 v16; // [sp+Ch] [bp-10h]@1 | |
1163 signed __int64 v17; // [sp+14h] [bp-8h]@1 | |
1164 unsigned int v18; // [sp+20h] [bp+4h]@1 | |
1165 | |
1166 v15 = this; | |
1167 v2 = (unsigned __int64)(signed __int64)((double)a2 * 0.234375) >> 32; | |
1168 v3 = (signed __int64)((double)a2 * 0.234375); | |
1169 v4 = (unsigned __int64)((signed __int64)((double)a2 * 0.234375) / 60) >> 32; | |
1170 v5 = (signed __int64)((double)a2 * 0.234375) / 60; | |
1171 v6 = (signed __int64)((double)a2 * 0.234375) / 60 / 60; | |
1172 v18 = (unsigned int)v6 / 0x18; | |
1173 v17 = (signed __int64)__PAIR__(v2, v3) % 60; | |
1174 v16 = (signed __int64)__PAIR__(v4, v5) % 60; | |
1175 v7 = v6 % 24; | |
1176 strcpy(pTmpBuf, pGlobalTXT_LocalizationStrings[532]); | |
471
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
457
diff
changeset
|
1177 if ( (unsigned int)v6 /24 ) |
0 | 1178 { |
1179 v8 = pGlobalTXT_LocalizationStrings[57]; | |
1180 if ( v18 <= 1 ) | |
1181 v8 = pGlobalTXT_LocalizationStrings[56]; | |
1182 sprintf(pTmpBuf2, "%d %s ", v18, v8); | |
1183 strcat(pTmpBuf, pTmpBuf2); | |
1184 } | |
1185 if ( v7 ) | |
1186 { | |
1187 if ( v7 <= 1 ) | |
1188 v9 = pGlobalTXT_LocalizationStrings[109]; | |
1189 else | |
1190 v9 = pGlobalTXT_LocalizationStrings[110]; | |
1191 sprintf(pTmpBuf2, "%d %s ", v7, v9); | |
1192 strcat(pTmpBuf, pTmpBuf2); | |
1193 } | |
1194 if ( v16 && !v18 ) | |
1195 { | |
1196 if ( v16 <= 1 ) | |
471
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
457
diff
changeset
|
1197 v10 = pGlobalTXT_LocalizationStrings[437];//"Minute" |
0 | 1198 else |
471
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
457
diff
changeset
|
1199 v10 = pGlobalTXT_LocalizationStrings[436]; //"Minutes" |
0 | 1200 sprintf(pTmpBuf2, "%d %s ", v16, v10); |
1201 strcat(pTmpBuf, pTmpBuf2); | |
1202 } | |
1203 if ( v17 && !v7 ) | |
1204 { | |
1205 if ( v17 <= 1 ) | |
471
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
457
diff
changeset
|
1206 v11 = pGlobalTXT_LocalizationStrings[439]; //"Second" |
0 | 1207 else |
471
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
457
diff
changeset
|
1208 v11 = pGlobalTXT_LocalizationStrings[438]; //"Seconds" |
0 | 1209 sprintf(pTmpBuf2, "%d %s ", v17, v11); |
1210 strcat(pTmpBuf, pTmpBuf2); | |
1211 } | |
949 | 1212 v12 = TargetColor(0xFFu, 0xFFu, 0x9Bu); |
0 | 1213 v13 = pFontArrus->CalcTextHeight(pTmpBuf, v15, 0, 0); |
471
c43f156a95c9
ArmorShopDialog crash fixed. All shops show its items
Gloval
parents:
457
diff
changeset
|
1214 v15->DrawTitleText(pFontArrus, 0, (212 - v13) / 2 + 101, v12, pTmpBuf, 3u); |
0 | 1215 } |
1216 | |
1217 | |
1218 | |
1219 //----- (0044D406) -------------------------------------------------------- | |
762 | 1220 void GUIWindow::DrawTitleText( GUIFont *a2, signed int uHorizontalMargin, unsigned int uVerticalMargin, unsigned __int16 uDefaultColor, const char *pInString, unsigned int uLineSpacing ) |
1221 { | |
0 | 1222 GUIWindow *pWindow; // esi@1 |
1223 unsigned int v8; // ebx@1 | |
1224 char *v9; // eax@1 | |
1225 unsigned int v11; // edi@1 | |
1226 signed int v12; // esi@1 | |
1227 int v13; // eax@2 | |
1228 GUIFont *pFont; // [sp+Ch] [bp-4h]@1 | |
1229 const char *Stra; // [sp+24h] [bp+14h]@5 | |
1230 | |
1231 pWindow = this; | |
1232 pFont = a2; | |
1233 v8 = this->uFrameWidth - uHorizontalMargin; | |
1234 ui_current_text_color = uDefaultColor; | |
1235 v9 = FitTextInAWindow(pInString, a2, this, uHorizontalMargin, 0); | |
762 | 1236 Stra = strtok(v9, "\n"); |
0 | 1237 v11 = uHorizontalMargin + pWindow->uFrameX; |
1238 v12 = uVerticalMargin + pWindow->uFrameY; | |
1239 while ( 1 ) | |
1240 { | |
762 | 1241 if ( !Stra ) |
0 | 1242 break; |
762 | 1243 v13 = (signed int)(v8 - pFont->GetLineWidth(Stra)) >> 1; |
0 | 1244 if ( v13 < 0 ) |
1245 v13 = 0; | |
1246 pFont->DrawTextLine(uDefaultColor, v11 + v13, v12, Stra, 640); | |
49 | 1247 v12 += pFont->uFontHeight - uLineSpacing; |
762 | 1248 Stra = strtok(0, "\n"); |
0 | 1249 } |
1250 } | |
1251 // 5C6DB4: using guessed type int ui_current_text_color; | |
1252 | |
1253 | |
1254 | |
1255 //----- (0044CE08) -------------------------------------------------------- | |
1006 | 1256 void GUIWindow::DrawText( GUIFont *a2, signed int uX, int uY, unsigned int uFontColor, const char *Str, int a7, int a8, unsigned int uFontShadowColor ) |
1257 { | |
0 | 1258 GUIWindow *v9; // edi@1 |
1259 GUIFont *v10; // ebx@1 | |
1260 int v11; // eax@2 | |
1261 signed int v12; // esi@9 | |
1262 signed int v13; // edi@9 | |
1263 int v14; // edx@9 | |
1264 int v15; // eax@25 | |
1265 unsigned int v16; // ecx@25 | |
1266 int v17; // eax@27 | |
1267 int v18; // edi@32 | |
1268 int v19; // esi@38 | |
1269 std::string v21; // [sp-18h] [bp-50h]@2 | |
1270 const char *v22; // [sp-8h] [bp-40h]@2 | |
1271 int v23; // [sp-4h] [bp-3Ch]@2 | |
1272 char Dest[6]; // [sp+Ch] [bp-2Ch]@32 | |
1273 //char v25; // [sp+Fh] [bp-29h]@32 | |
1274 //char v26; // [sp+11h] [bp-27h]@34 | |
1275 const char *v27; // [sp+20h] [bp-18h]@25 | |
1276 int v28; // [sp+24h] [bp-14h]@25 | |
1277 int v29; // [sp+28h] [bp-10h]@1 | |
1278 size_t v30; // [sp+2Ch] [bp-Ch]@4 | |
1279 GUIWindow *v31; // [sp+30h] [bp-8h]@1 | |
1280 const char *v32; // [sp+34h] [bp-4h]@7 | |
1281 size_t pInString; // [sp+4Ch] [bp+14h]@11 | |
1282 | |
1283 auto a1 = this; | |
1284 v29 = 0; | |
1285 v9 = a1; | |
1286 v10 = a2; | |
1287 v31 = a1; | |
1288 if ( !Str ) | |
1289 { | |
1290 MessageBoxW(nullptr, L"Invalid string passed!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Font.cpp:859", 0); | |
1006 | 1291 return; |
0 | 1292 } |
1293 v11 = strcmp(Str, "null"); | |
1294 if ( v11 ) | |
1295 { | |
1296 v30 = strlen(Str); | |
1297 LOBYTE(v11) = 0; | |
1298 if ( !uX ) | |
1299 uX = 12; | |
1300 if ( a8 ) | |
1301 { | |
1302 v32 = Str; | |
1303 } | |
1304 else | |
1305 { | |
1306 v11 = (int)FitTextInAWindow(Str, v10, v9, uX, 0); | |
1307 v32 = (const char *)v11; | |
1308 } | |
1309 v12 = uX + v9->uFrameX; | |
1310 v13 = uY + v9->uFrameY; | |
1311 v14 = 0; | |
1312 if ( !a8 || (v11 = v13 + LOBYTE(v10->uFontHeight), v11 <= a8) ) | |
1313 { | |
1314 pInString = 0; | |
1315 if ( (signed int)v30 > 0 ) | |
1316 { | |
1317 do | |
1318 { | |
1319 LOBYTE(v11) = v32[v14]; | |
1320 if ( (unsigned __int8)v11 >= v10->cFirstChar && (unsigned __int8)v11 <= v10->cLastChar | |
1321 || (char)v11 == 12 | |
1322 || (char)v11 == 13 | |
1323 || (char)v11 == 9 | |
1324 || (char)v11 == 10 ) | |
1325 { | |
1326 switch ( (unsigned __int8)v11 ) | |
1327 { | |
1328 case 9u: | |
1329 strncpy(Dest, &v32[v14 + 1], 3u); | |
1330 Dest[3] = 0; | |
1331 pInString += 3; | |
1332 v29 = atoi(Dest); | |
1333 v19 = atoi(Dest); | |
1334 LOBYTE(v11) = (char)v31; | |
1335 v12 = uX + v31->uFrameX + v19; | |
1336 break; | |
1337 case 0xAu: | |
1338 v11 = LOBYTE(v10->uFontHeight); | |
1339 uY = uY + v11 - 3; | |
1340 v13 = uY + v31->uFrameY; | |
1341 v12 = uX + v29 + v31->uFrameX; | |
1342 if ( a8 ) | |
1343 goto LABEL_36; | |
1344 break; | |
1345 case 0xCu: | |
1346 strncpy(Dest, &v32[v14 + 1], 5u); | |
1347 Dest[5] = 0; | |
1348 v11 = atoi(Dest); | |
1349 pInString += 5; | |
1350 uFontColor = v11; | |
1351 break; | |
1352 case 0xDu: | |
1353 strncpy(Dest, &v32[v14 + 1], 3u); | |
1354 Dest[3] = 0; | |
1355 pInString += 3; | |
1356 v18 = atoi(Dest); | |
1357 v11 = v10->GetLineWidth(&v32[pInString]); | |
1358 v12 = v31->uFrameZ - v11 - v18; | |
1359 v13 = uY + v31->uFrameY; | |
1360 if ( a8 ) | |
1361 { | |
1362 v11 = LOBYTE(v10->uFontHeight); | |
1363 LABEL_36: | |
1364 v11 = v11 + v13 - 3; | |
1365 if ( v11 > a8 ) | |
1006 | 1366 return; |
0 | 1367 break; |
1368 } | |
1369 break; | |
1370 default: | |
1371 if ( (char)v11 == 34 && v32[v14 + 1] == 34 ) | |
1372 { | |
1373 ++v14; | |
1374 pInString = v14; | |
1375 } | |
1376 v27 = &v32[v14]; | |
1377 v15 = (unsigned __int8)v32[v14]; | |
1378 v16 = *((int *)&v10->cFirstChar + 3 * v15 + 9); | |
1379 v28 = *((int *)&v10->cFirstChar + 3 * v15 + 9); | |
1380 if ( v14 > 0 ) | |
1381 v12 += v10->pMetrics[v15].uLeftSpacing; | |
1382 v17 = (int)((char *)&v10[1] + v10->field_C20[v15]); | |
1383 if ( (short)uFontColor ) | |
1384 pRenderer->DrawText( | |
1385 v12, | |
1386 v13, | |
1387 (unsigned __int8 *)v17, | |
1388 v16, | |
1389 LOBYTE(v10->uFontHeight), | |
1390 v10->pFontPalettes[0], | |
1391 uFontColor, | |
1392 uFontShadowColor); | |
1393 else | |
1394 pRenderer->DrawTextPalette( | |
1395 v12, | |
1396 v13, | |
1397 v17, | |
1398 v16, | |
1399 LOBYTE(v10->uFontHeight), | |
1400 v10->pFontPalettes[0], | |
1401 a7); | |
1402 LOBYTE(v11) = v30; | |
1403 v12 += v28; | |
1404 if ( (signed int)pInString < (signed int)v30 ) | |
1405 { | |
1406 LOBYTE(v11) = 3 * *v27; | |
1407 v12 += v10->pMetrics[(unsigned __int8)*v27].uRightSpacing; | |
1408 } | |
1409 break; | |
1410 } | |
1411 } | |
1412 v14 = pInString++ + 1; | |
1413 } | |
1414 while ( (signed int)pInString < (signed int)v30 ); | |
1415 } | |
1416 } | |
1417 } | |
1006 | 1418 return; |
0 | 1419 } |
1420 | |
1421 | |
1422 //----- (0044CB4F) -------------------------------------------------------- | |
1423 int GUIWindow::DrawTextInRect(GUIFont *a2, unsigned int uX, unsigned int uY, unsigned int uColor, const char *Str1, int Source, int a8) | |
1424 { | |
24 | 1425 GUIFont *pFont; // edi@1 |
1426 int pLineWidth; // ebx@1 | |
0 | 1427 int v11; // esi@3 |
1428 unsigned __int8 v12; // cl@7 | |
1429 signed int v13; // esi@19 | |
1430 signed int v14; // ebx@19 | |
1431 unsigned __int8 v15; // cl@21 | |
1432 int v16; // eax@22 | |
1433 int v17; // ecx@22 | |
1434 int v18; // ecx@23 | |
1435 int v19; // ecx@24 | |
1436 unsigned int v20; // ecx@26 | |
1437 int v21; // eax@28 | |
1438 int v22; // ebx@34 | |
1439 int v23; // eax@34 | |
1440 int v24; // ebx@36 | |
1441 char Str; // [sp+Ch] [bp-20h]@34 | |
1442 char v26; // [sp+Fh] [bp-1Dh]@34 | |
1443 char v27; // [sp+11h] [bp-1Bh]@35 | |
1444 int v28; // [sp+20h] [bp-Ch]@17 | |
1445 GUIWindow *pWindow; // [sp+24h] [bp-8h]@1 | |
24 | 1446 size_t pNumLen; // [sp+28h] [bp-4h]@1 |
0 | 1447 size_t Str1a; // [sp+40h] [bp+14h]@5 |
1448 size_t Str1b; // [sp+40h] [bp+14h]@19 | |
1449 const char *Sourcea; // [sp+44h] [bp+18h]@20 | |
1450 int v34; // [sp+48h] [bp+1Ch]@26 | |
1451 | |
24 | 1452 pFont = a2; |
0 | 1453 pWindow = this; |
24 | 1454 pNumLen = strlen(Str1); |
1455 pLineWidth = pFont->GetLineWidth(Str1); | |
1456 if ( pLineWidth < Source ) | |
0 | 1457 { |
24 | 1458 pWindow->DrawText(pFont, uX, uY, uColor, Str1, 0, 0, 0); |
1459 return pLineWidth; | |
0 | 1460 } |
1461 strcpy(pTmpBuf2, Str1); | |
1462 v11 = 0; | |
1463 if ( a8 ) | |
1464 _strrev(pTmpBuf2); | |
1465 Str1a = 0; | |
24 | 1466 if ( (signed int)pNumLen > 0 ) |
0 | 1467 { |
1468 do | |
1469 { | |
1470 if ( v11 >= Source ) | |
1471 break; | |
24 | 1472 if ( pFont->IsCharValid(v12 = pTmpBuf2[Str1a]) ) |
0 | 1473 { |
1474 if ( v12 < 9u ) | |
24 | 1475 { |
1476 if ( (signed int)Str1a > 0 ) | |
1477 v11 += pFont->pMetrics[v12].uLeftSpacing; | |
1478 v11 += *((int *)&pFont->cFirstChar + 3 * v12 + 9); | |
1479 if ( (signed int)Str1a < (signed int)pNumLen ) | |
1480 v11 += pFont->pMetrics[v12].uRightSpacing; | |
1481 goto LABEL_16; | |
1482 } | |
1483 if ( v12 > 0xAu )//10 | |
0 | 1484 { |
1485 if ( v12 == 12 ) | |
1486 { | |
1487 Str1a += 5; | |
1488 } | |
1489 else | |
1490 { | |
1491 if ( v12 != 13 ) | |
1492 { | |
1493 if ( (signed int)Str1a > 0 ) | |
24 | 1494 v11 += pFont->pMetrics[v12].uLeftSpacing; |
1495 v11 += *((int *)&pFont->cFirstChar + 3 * v12 + 9); | |
1496 if ( (signed int)Str1a < (signed int)pNumLen ) | |
1497 v11 += pFont->pMetrics[v12].uRightSpacing; | |
0 | 1498 } |
1499 } | |
1500 } | |
1501 } | |
1502 LABEL_16: | |
1503 ++Str1a; | |
1504 } | |
24 | 1505 while ( (signed int)Str1a < (signed int)pNumLen ); |
0 | 1506 } |
566 | 1507 pTmpBuf2[Str1a - 1] = 0; |
24 | 1508 pNumLen = strlen(pTmpBuf2); |
1509 v28 = pFont->GetLineWidth(pTmpBuf2); | |
0 | 1510 if ( a8 ) |
1511 _strrev(pTmpBuf2); | |
1512 Str1b = 0; | |
1513 v13 = uX + pWindow->uFrameX; | |
1514 v14 = uY + pWindow->uFrameY; | |
24 | 1515 if ( (signed int)pNumLen > 0 ) |
0 | 1516 { |
1517 Sourcea = &pTmpBuf2[1]; | |
1518 do | |
1519 { | |
24 | 1520 if ( pFont->IsCharValid(v15 = pTmpBuf2[Str1b]) ) |
0 | 1521 { |
1522 v16 = v15; | |
1523 v17 = v15 - 9; | |
24 | 1524 if ( v17 )//>0 |
0 | 1525 { |
1526 v18 = v17 - 1; | |
24 | 1527 if ( v18 )//>0 |
0 | 1528 { |
1529 v19 = v18 - 2; | |
24 | 1530 if ( v19 )//>0 |
0 | 1531 { |
24 | 1532 if ( v19 == 1 )//v15 == 13 |
0 | 1533 { |
1534 strncpy(&Str, Sourcea, 3u); | |
1535 v26 = 0; | |
1536 Str1b += 3; | |
1537 Sourcea += 3; | |
1538 v22 = atoi(&Str); | |
24 | 1539 v23 = pFont->GetLineWidth(&pTmpBuf2[Str1b]); |
0 | 1540 v13 = pWindow->uFrameZ - v23 - v22; |
1541 v14 = uY; | |
1542 } | |
24 | 1543 else//v15 > 13 |
0 | 1544 { |
24 | 1545 v20 = *((int *)&pFont->cFirstChar + 3 * v16 + 9); |
1546 v34 = *((int *)&pFont->cFirstChar + 3 * v16 + 9); | |
0 | 1547 if ( (signed int)Str1b > 0 ) |
24 | 1548 v13 += pFont->pMetrics[v16].uLeftSpacing; |
1549 v21 = (int)((char *)&pFont[1] + pFont->field_C20[v16]); | |
0 | 1550 if ( (short)uColor ) |
24 | 1551 pRenderer->DrawText(v13, v14, (unsigned __int8 *)v21, v20, LOBYTE(pFont->uFontHeight), pFont->pFontPalettes[0], uColor, 0); |
0 | 1552 else |
24 | 1553 pRenderer->DrawTextPalette(v13, v14, v21, v20, LOBYTE(pFont->uFontHeight), pFont->pFontPalettes[0], 0); |
0 | 1554 v13 += v34; |
24 | 1555 if ( (signed int)Str1b < (signed int)pNumLen ) |
1556 v13 += pFont->pMetrics[(unsigned __int8)pTmpBuf2[Str1b]].uRightSpacing; | |
0 | 1557 } |
1558 } | |
24 | 1559 else//v15 == 12 |
0 | 1560 { |
1561 strncpy(&Str, Sourcea, 5u); | |
1562 v27 = 0; | |
1563 Str1b += 5; | |
1564 Sourcea += 5; | |
1565 uColor = atoi(&Str); | |
1566 } | |
1567 } | |
24 | 1568 else//v15 == 10 |
0 | 1569 { |
24 | 1570 v24 = LOBYTE(pFont->uFontHeight); |
0 | 1571 v13 = uX; |
1572 uY = uY + v24 - 3; | |
1573 v14 = v24 + uY - 3; | |
1574 } | |
1575 } | |
24 | 1576 else//v15 == 9 |
0 | 1577 { |
1578 strncpy(&Str, Sourcea, 3u); | |
1579 v26 = 0; | |
1580 atoi(&Str); | |
1581 Str1b += 3; | |
1582 Sourcea += 3; | |
1583 } | |
1584 } | |
1585 ++Str1b; | |
1586 ++Sourcea; | |
1587 } | |
24 | 1588 while ( (signed int)Str1b < (signed int)pNumLen ); |
0 | 1589 } |
1590 return v28; | |
1591 } | |
1592 | |
1593 //----- (0041D12F) -------------------------------------------------------- | |
189 | 1594 GUIButton *GUIWindow::CreateButton(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, |
832 | 1595 int a6, int a7, UIMessageType msg, unsigned int msg_param, unsigned __int8 uHotkey, const char *pName, Texture *pTextures, ...) |
0 | 1596 { |
17 | 1597 GUIButton *pButton; // esi@1 |
0 | 1598 unsigned int v13; // eax@1 |
1599 unsigned int v14; // ebx@4 | |
1600 unsigned int v15; // eax@4 | |
189 | 1601 unsigned int TextureNum=0; // ebx@4 |
0 | 1602 unsigned int v17; // eax@4 |
1603 Texture *v18; // eax@4 | |
1604 Texture **v19; // ecx@5 | |
1605 Texture **v20; // edx@5 | |
1606 GUIButton *v21; // eax@7 | |
189 | 1607 va_list texturs_ptr; |
0 | 1608 |
17 | 1609 pButton = (GUIButton *)pAllocator->AllocNamedChunk(0, 0xBCu, "BUTTON"); |
1610 pButton->pParent = this; | |
1611 pButton->uX = uX + this->uFrameX; | |
0 | 1612 v13 = uY + this->uFrameY; |
17 | 1613 pButton->uHeight = uHeight; |
1614 pButton->uY = v13; | |
1615 pButton->uWidth = uWidth; | |
0 | 1616 if ( a6 == 2 && !uHeight ) |
17 | 1617 pButton->uHeight = uWidth; |
1618 v14 = pButton->uX; | |
1619 pButton->uButtonType = a6; | |
0 | 1620 v15 = v14 + uWidth - 1; |
17 | 1621 pButton->uZ = v15; |
1622 v17 = pButton->uY; | |
271 | 1623 pButton->field_2C_is_pushed = 0; |
17 | 1624 pButton->uW = v17 + uHeight - 1; |
1625 pButton->field_1C = a7; | |
832 | 1626 pButton->msg = msg; |
1627 pButton->msg_param = msg_param; | |
17 | 1628 pButton->uHotkey = uHotkey; |
0 | 1629 strlen(pName); |
17 | 1630 strcpy(pButton->pButtonName, pName); |
189 | 1631 va_start(texturs_ptr, pName); |
1632 while (NULL!=(pTextures=va_arg(texturs_ptr, Texture *))) | |
0 | 1633 { |
189 | 1634 pButton->pTextures[TextureNum]=pTextures; |
1635 ++TextureNum; | |
0 | 1636 } |
189 | 1637 va_end(texturs_ptr); |
1638 pButton->uNumTextures = TextureNum; | |
1639 if ( this->pControlsTail ) | |
1640 this->pControlsTail->pNext = pButton; | |
0 | 1641 else |
17 | 1642 this->pControlsHead = pButton; |
1643 pButton->pPrev = this->pControlsTail; | |
1644 this->pControlsTail = pButton; | |
1645 pButton->pNext = 0; | |
0 | 1646 ++this->uNumControls; |
17 | 1647 return pButton; |
0 | 1648 } |
1649 | |
1650 //----- (00459C2B) -------------------------------------------------------- | |
1651 void GUIWindow::DrawFlashingInputCursor(signed int a3, int a4, GUIFont *a2) | |
1652 { | |
1653 signed int v4; // esi@1 | |
1654 GUIWindow *v5; // edi@1 | |
1655 | |
1656 v4 = a3; | |
1657 v5 = this; | |
1658 if ( GetTickCount() % 1000 > 500 ) | |
1659 DrawText(a2, v4, a4, 0, "_", 0, 0, 0); | |
1660 } | |
1661 | |
1662 //----- (0041C432) -------------------------------------------------------- | |
11 | 1663 GUIWindow *GUIWindow::Create(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, WindowType eWindowType, int pButton, int a5) |
0 | 1664 { |
1665 unsigned int uNextFreeWindowID; // ebp@1 | |
1666 //int *v8; // eax@1 | |
1667 //GUIWindow *pWindow; // esi@4 | |
962 | 1668 //int v10; // eax@4 |
0 | 1669 unsigned int v11; // ebx@15 |
423 | 1670 NPCData *speakingNPC; // ebp@15 |
1671 int v14; // eax@20 | |
1672 int v16; // eax@25 | |
1673 int v18; // eax@30 | |
1674 int v20; // eax@35 | |
1675 int v22; // eax@40 | |
1676 int v24; // eax@45 | |
0 | 1677 int v25; // eax@65 |
1678 unsigned int v26; // ebx@65 | |
1679 char *v27; // eax@71 | |
1680 const char *v29; // [sp-8h] [bp-18h]@68 | |
1681 char *v30; // [sp-4h] [bp-14h]@68 | |
1682 int uWidtha; // [sp+14h] [bp+4h]@66 | |
423 | 1683 int num_menu_buttons; // [sp+20h] [bp+10h]@15 |
0 | 1684 |
1685 for (uNextFreeWindowID = 0; uNextFreeWindowID < 20; ++uNextFreeWindowID) | |
1686 { | |
1687 if (pWindowList[uNextFreeWindowID].eWindowType == WINDOW_null) | |
1688 break; | |
1689 } | |
1690 | |
1691 auto pWindow = &pWindowList[uNextFreeWindowID]; | |
1692 pWindow->uFrameWidth = uWidth; | |
1693 pWindow->uFrameZ = uX + uWidth - 1; | |
1694 pWindow->uFrameW = uY + uHeight - 1; | |
11 | 1695 pWindow->ptr_1C = (void *)pButton; |
0 | 1696 pWindow->Hint = (char *)a5; |
962 | 1697 //v10 = uNumVisibleWindows; |
0 | 1698 pWindow->uFrameX = uX; |
962 | 1699 //++v10; |
0 | 1700 pWindow->uFrameY = uY; |
1701 pWindow->uFrameHeight = uHeight; | |
1702 pWindow->eWindowType = eWindowType; | |
972 | 1703 pWindow->receives_keyboard_input = false; |
496 | 1704 ++uNumVisibleWindows; |
1705 pWindow->numVisibleWindows = uNumVisibleWindows; | |
1706 pVisibleWindowsIdxs[uNumVisibleWindows] = uNextFreeWindowID + 1; | |
0 | 1707 if ( (signed int)eWindowType <= 20 ) |
1708 { | |
1709 if (eWindowType != WINDOW_Chest) | |
1710 { | |
1711 switch (eWindowType) | |
1712 { | |
1713 case WINDOW_Book: | |
1714 pWindow->InitializeBookView(); | |
1715 break; | |
165 | 1716 case WINDOW_Dialogue: |
11 | 1717 pMainScreenNum = pCurrentScreen; |
151 | 1718 pCurrentScreen = SCREEN_NPC_DIALOGUE; |
832 | 1719 pBtn_ExitCancel = pWindow->CreateButton(0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], //"Exit" |
735 | 1720 pIcons_LOD->GetTexture(uExitCancelTextureId), 0); |
496 | 1721 if ( pWindow->par1C != 1 ) |
0 | 1722 { |
423 | 1723 num_menu_buttons = 0; |
0 | 1724 v11 = LOBYTE(pFontArrus->uFontHeight) - 3; |
602 | 1725 speakingNPC = GetNPCData(sDialogue_SpeakingActorNPC_ID); |
827 | 1726 if ( GetGreetType(sDialogue_SpeakingActorNPC_ID) == 1 )//QuestsNPC_greet |
0 | 1727 { |
423 | 1728 if ( speakingNPC->joins ) |
0 | 1729 { |
832 | 1730 pWindow->CreateButton(480, 130, 140, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0xDu, 0, "", 0); |
423 | 1731 num_menu_buttons = 1; |
0 | 1732 } |
423 | 1733 if ( speakingNPC->evt_A ) |
0 | 1734 { |
423 | 1735 if ( num_menu_buttons < 4 ) |
0 | 1736 { |
423 | 1737 v14 = NPC_EventProcessor(speakingNPC->evt_A); |
0 | 1738 if ( v14 == 1 || v14 == 2 ) |
832 | 1739 pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x13u, 0, "", 0); |
0 | 1740 } |
1741 } | |
423 | 1742 if ( speakingNPC->evt_B ) |
0 | 1743 { |
423 | 1744 if ( num_menu_buttons < 4 ) |
0 | 1745 { |
423 | 1746 v16 = NPC_EventProcessor(speakingNPC->evt_B); |
0 | 1747 if ( v16 == 1 || v16 == 2 ) |
832 | 1748 pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x14u, 0, "", 0); |
0 | 1749 } |
1750 } | |
423 | 1751 if ( speakingNPC->evt_C ) |
0 | 1752 { |
423 | 1753 if ( num_menu_buttons < 4 ) |
0 | 1754 { |
423 | 1755 v18 = NPC_EventProcessor(speakingNPC->evt_C); |
0 | 1756 if ( v18 == 1 || v18 == 2 ) |
832 | 1757 pWindow->CreateButton( 0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x15u, 0, "", 0); |
0 | 1758 } |
1759 } | |
423 | 1760 if ( speakingNPC->evt_D ) |
0 | 1761 { |
423 | 1762 if ( num_menu_buttons < 4 ) |
0 | 1763 { |
423 | 1764 v20 = NPC_EventProcessor(speakingNPC->evt_D); |
0 | 1765 if ( v20 == 1 || v20 == 2 ) |
832 | 1766 pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x16u, 0, "", 0); |
0 | 1767 } |
1768 } | |
423 | 1769 if ( speakingNPC->evt_E ) |
0 | 1770 { |
423 | 1771 if ( num_menu_buttons < 4 ) |
0 | 1772 { |
423 | 1773 v22 = NPC_EventProcessor(speakingNPC->evt_E); |
0 | 1774 if ( v22 == 1 || v22 == 2 ) |
832 | 1775 pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x17u, 0, "", 0); |
0 | 1776 } |
1777 } | |
423 | 1778 if (speakingNPC->evt_F ) |
0 | 1779 { |
423 | 1780 if ( num_menu_buttons < 4 ) |
0 | 1781 { |
423 | 1782 v24 = NPC_EventProcessor(speakingNPC->evt_F); |
0 | 1783 if ( v24 == 1 || v24 == 2 ) |
832 | 1784 pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x18u, 0, "", 0); |
0 | 1785 } |
1786 } | |
1787 } | |
1788 else | |
1789 { | |
423 | 1790 if ( speakingNPC->joins ) |
0 | 1791 { |
832 | 1792 pWindow->CreateButton(0x1E0u, 0x82u, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x4Du, 0, pGlobalTXT_LocalizationStrings[407], 0);//Подробнее |
423 | 1793 if (speakingNPC->Hired()) |
0 | 1794 { |
423 | 1795 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[408], speakingNPC->pName); //Отпустить |
832 | 1796 pWindow->CreateButton(0x1E0u, v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x4Cu, 0, pTmpBuf, 0); |
0 | 1797 } |
1798 else | |
1799 { | |
832 | 1800 pWindow->CreateButton(0x1E0u, v11 + 130, 0x8Cu, v11, 1, 0, UIMSG_SelectNPCDialogueOption, 0x4Cu, 0, pGlobalTXT_LocalizationStrings[406], 0);//Нанять |
0 | 1801 } |
423 | 1802 num_menu_buttons = 2; |
0 | 1803 } |
1804 } | |
972 | 1805 pWindow->_41D08F_set_keyboard_control_group(num_menu_buttons, 1, 0, 1); |
0 | 1806 } |
1807 break; | |
948 | 1808 |
11 | 1809 case WINDOW_ChangeLocation: |
1810 pMainScreenNum = pCurrentScreen; | |
151 | 1811 pCurrentScreen = SCREEN_CHANGE_LOCATION; |
987 | 1812 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);//Остаться в этой области |
948 | 1813 pBtn_YES = pWindow->CreateButton( 486, 445, 75, 33, 1, 0, UIMSG_OnTravelByFoot, 0, 'Y', pWindow->Hint, pIcons_LOD->GetTexture(uTextureID_BUTTYES2), 0); |
1814 pWindow->CreateButton(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 63, 73, 1, 0, UIMSG_OnTravelByFoot, 1, ' ', pWindow->Hint, 0, 0, 0); | |
1815 pWindow->CreateButton( 8, 8, 460, 344, 1, 0, UIMSG_OnTravelByFoot, 1, 0, pWindow->Hint, 0); | |
0 | 1816 break; |
948 | 1817 |
11 | 1818 case WINDOW_SpellBook: // окно книги заклов |
0 | 1819 InitializeBookTextures(); |
11 | 1820 pWindow->OpenSpellBook(); |
0 | 1821 break; |
11 | 1822 case WINDOW_GreetingNPC: // окно приветствия НПС |
1823 pMainScreenNum = pCurrentScreen; | |
3 | 1824 pKeyActionMap->EnterText(0, 15, pWindow); |
151 | 1825 pCurrentScreen = SCREEN_BRANCHLESS_NPC_DIALOG; |
0 | 1826 break; |
1827 } | |
1828 return pWindow; | |
1829 } | |
11 | 1830 //LABEL_62: |
948 | 1831 pWindow->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 1u, '1', "", 0); |
1832 pWindow->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 2u, '2', "", 0); | |
1833 pWindow->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 3u, '3', "", 0); | |
1834 pWindow->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 4u, '4', "", 0); | |
832 | 1835 pWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_CycleCharacters, 0, 9u, "", 0); |
0 | 1836 return pWindow; |
1837 } | |
1838 if (eWindowType == WINDOW_HouseInterior) | |
1839 { | |
151 | 1840 pCurrentScreen = SCREEN_HOUSE; |
832 | 1841 pBtn_ExitCancel = pWindow->CreateButton(0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[80],//Выйти из здания |
735 | 1842 pIcons_LOD->GetTexture(uExitCancelTextureId), 0); |
0 | 1843 v25 = uNumDialogueNPCPortraits; |
1844 v26 = 0; | |
1845 if ( uNumDialogueNPCPortraits > 0 ) | |
1846 { | |
873 | 1847 for ( v26 = 0; v26 < uNumDialogueNPCPortraits; ++v26 ) |
0 | 1848 { |
1849 if ( v26 + 1 == v25 && uHouse_ExitPic ) | |
1850 { | |
1851 v30 = pMapStats->pInfos[uHouse_ExitPic].pName; | |
874 | 1852 v29 = (char*)pGlobalTXT_LocalizationStrings[LOCSTR_ENTER_S]; |
0 | 1853 } |
1854 else | |
1855 { | |
1856 if ( v26 || !dword_591080 ) | |
874 | 1857 v27 = HouseNPCData[v26 - (dword_591080 != 0)]->pName; |
0 | 1858 else |
1859 //v27 = (char *)p2DEvents_minus1_::08[13 * a4]; | |
11 | 1860 v27 = (char *)p2DEvents[pButton - 1].pProprieterName; |
0 | 1861 v30 = v27; |
874 | 1862 v29 = (char*)pGlobalTXT_LocalizationStrings[435]; |
0 | 1863 } |
735 | 1864 sprintfex(byte_591180[v26], v29, v30); |
457 | 1865 HouseNPCData[v26 + 7] = (NPCData *)pWindow->CreateButton(pNPCPortraits_x[uNumDialogueNPCPortraits - 1][v26], |
419 | 1866 pNPCPortraits_y[uNumDialogueNPCPortraits - 1][v26], |
961 | 1867 0x3Fu, 0x49u, 1, 0, UIMSG_ClickHouseNPCPortrait, v26, 0, byte_591180[v26], 0, 0, 0); |
0 | 1868 v25 = uNumDialogueNPCPortraits; |
1869 } | |
1870 } | |
1871 if ( v25 == 1 ) | |
1872 { | |
336 | 1873 window_SpeakInHouse = &pWindowList[uNextFreeWindowID]; |
0 | 1874 _4B4224_UpdateNPCTopics(0); |
1875 } | |
1876 } | |
1877 else | |
1878 { | |
158 | 1879 if (eWindowType == WINDOW_Transition) |
0 | 1880 { |
11 | 1881 pMainScreenNum = pCurrentScreen; |
151 | 1882 pCurrentScreen = SCREEN_INPUT_BLV; |
960 | 1883 pBtn_ExitCancel = pWindow->CreateButton(0x236u, 0x1BDu, 0x4Bu, 0x21u, 1, 0, UIMSG_TransitionWindowCloseBtn, 0, 'N', pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);//Отмена |
948 | 1884 pBtn_YES = pWindow->CreateButton(0x1E6u, 0x1BDu, 0x4Bu, 0x21u, 1, 0, UIMSG_TransitionUI_Confirm, 0, 'Y', pWindow->Hint, pIcons_LOD->GetTexture(uTextureID_BUTTYES2), 0); |
1885 pWindow->CreateButton(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 0x3Fu, 0x49u, 1, 0, UIMSG_TransitionUI_Confirm, 1, 0x20u, pWindow->Hint, 0); | |
1886 pWindow->CreateButton(8, 8, 0x1CCu, 0x158u, 1, 0, UIMSG_TransitionUI_Confirm, 1u, 0, pWindow->Hint, 0); | |
0 | 1887 return pWindow; |
1888 } | |
961 | 1889 if (eWindowType == WINDOW_CastSpell) |
0 | 1890 { |
1891 pEventTimer->Pause(); | |
1892 pAudioPlayer->StopChannels(-1, -1); | |
1893 pMouse->SetCursorBitmap("MICON2"); | |
11 | 1894 ShowStatusBarString(pGlobalTXT_LocalizationStrings[39], 2u);//Выберите цель |
0 | 1895 return pWindow; |
1896 } | |
158 | 1897 if (eWindowType == WINDOW_Scroll) |
11 | 1898 //goto LABEL_62; |
1899 { | |
948 | 1900 pWindow->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 1u, '1', "", 0); |
1901 pWindow->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 2u, '2', "", 0); | |
1902 pWindow->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 3u, '3', "", 0); | |
1903 pWindow->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 4u, '4', "", 0); | |
1904 pWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_CycleCharacters, 0, '\t', "", 0); | |
11 | 1905 return pWindow; |
1906 } | |
898 | 1907 if (eWindowType == WINDOW_CastSpell_InInventory) |
0 | 1908 { |
1909 pMouse->SetCursorBitmap("MICON2"); | |
832 | 1910 pBtn_ExitCancel = pWindow->CreateButton(0x188u, 0x13Eu, 0x4Bu, 0x21u, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[34],//Отмена |
945 | 1911 pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0); |
11 | 1912 ShowStatusBarString(pGlobalTXT_LocalizationStrings[39], 2);//Выбрать цель |
0 | 1913 ++pIcons_LOD->uTexturePacksCount; |
1914 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; | |
151 | 1915 pCurrentScreen = SCREEN_CASTING; |
0 | 1916 if ( !pIcons_LOD->uNumPrevLoadedFiles ) |
1917 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; | |
1918 } | |
1919 } | |
1920 return pWindow; | |
1921 } |