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