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