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