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