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