comparison GUI/UI/UIPopup.cpp @ 2524:c7264ab7132f

Main menu rendered using d3d11
author a.parshin
date Fri, 10 Oct 2014 17:42:05 +0300
parents 9b96a51011fb
children 1bcadc6dd203
comparison
equal deleted inserted replaced
2523:c532d5242055 2524:c7264ab7132f
65 { 65 {
66 unsigned int uNumTiles; // [sp+2Ch] [bp-Ch]@6 66 unsigned int uNumTiles; // [sp+2Ch] [bp-Ch]@6
67 unsigned int coord_x; // [sp+2Ch] [bp-Ch]@3 67 unsigned int coord_x; // [sp+2Ch] [bp-Ch]@3
68 unsigned int coord_y; // [sp+34h] [bp-4h]@5 68 unsigned int coord_y; // [sp+34h] [bp-4h]@5
69 69
70 pRenderer->SetTextureClipRect(uX, uY, uX + uWidth, uY + uHeight); 70 auto parchment = pIcons_LOD->GetTexture(uTextureID_Parchment);
71 if ( pIcons_LOD->GetTexture(uTextureID_Parchment)->uTextureWidth && pIcons_LOD->GetTexture(uTextureID_Parchment)->uTextureHeight) 71
72 { 72 if ( parchment->uTextureWidth && parchment->uTextureHeight)
73 uNumTiles = uWidth / pIcons_LOD->GetTexture(uTextureID_Parchment)->uTextureWidth; 73 {
74 if ( uWidth % pIcons_LOD->GetTexture(uTextureID_Parchment)->uTextureWidth ) 74 pRenderer->SetUIClipRect(uX, uY, uX + uWidth, uY + uHeight);
75
76 uNumTiles = uWidth / parchment->uTextureWidth;
77 if ( uWidth % parchment->uTextureWidth )
75 ++uNumTiles; 78 ++uNumTiles;
76 coord_y = uY; 79 coord_y = uY;
77 for ( uint j = 0; j <= uHeight / pIcons_LOD->GetTexture(uTextureID_Parchment)->uTextureHeight; j++ ) 80 for ( uint j = 0; j <= uHeight / parchment->uTextureHeight; j++ )
78 { 81 {
79 coord_x = uX - pIcons_LOD->GetTexture(uTextureID_Parchment)->uTextureWidth; 82 coord_x = uX - parchment->uTextureWidth;
80 for ( uint i = uNumTiles + 1; i; --i ) 83 for ( uint i = uNumTiles + 1; i; --i )
81 { 84 {
82 coord_x += pIcons_LOD->GetTexture(uTextureID_Parchment)->uTextureWidth; 85 coord_x += parchment->uTextureWidth;
83 pRenderer->DrawTextureIndexed(coord_x, coord_y, pIcons_LOD->GetTexture(uTextureID_Parchment)); 86 pRenderer->DrawTextureIndexed(coord_x, coord_y, parchment);
84 } 87 }
85 coord_y += pIcons_LOD->GetTexture(uTextureID_Parchment)->uTextureHeight; 88 coord_y += parchment->uTextureHeight;
86 } 89 }
87 pRenderer->DrawTextureTransparent(uX, uY, pIcons_LOD->GetTexture(uTextureID_5076AC)); 90 pRenderer->DrawTextureIndexedAlpha(uX, uY, pIcons_LOD->GetTexture(uTextureID_5076AC));
88 pRenderer->DrawTextureTransparent(uX, uY + uHeight - 32, pIcons_LOD->GetTexture(uTextureID_5076B4)); 91 pRenderer->DrawTextureIndexedAlpha(uX, uY + uHeight - 32, pIcons_LOD->GetTexture(uTextureID_5076B4));
89 pRenderer->DrawTextureTransparent(uX + uWidth - 32, uY, pIcons_LOD->GetTexture(uTextureID_5076A8)); 92 pRenderer->DrawTextureIndexedAlpha(uX + uWidth - 32, uY, pIcons_LOD->GetTexture(uTextureID_5076A8));
90 pRenderer->DrawTextureTransparent(uX + uWidth - 32, uY + uHeight - 32, pIcons_LOD->GetTexture(uTextureID_5076B0)); 93 pRenderer->DrawTextureIndexedAlpha(uX + uWidth - 32, uY + uHeight - 32, pIcons_LOD->GetTexture(uTextureID_5076B0));
91 if ( uWidth > 64 ) 94 if ( uWidth > 64 )
92 { 95 {
93 pRenderer->SetTextureClipRect(uX + 32, uY, uX + uWidth - 32, uY + uHeight); 96 pRenderer->SetUIClipRect(uX + 32, uY, uX + uWidth - 32, uY + uHeight);
94 pRenderer->DrawTextureTransparent(uX + 32, uY, pIcons_LOD->GetTexture(uTextureID_507698)); 97 pRenderer->DrawTextureIndexedAlpha(uX + 32, uY, pIcons_LOD->GetTexture(uTextureID_507698));
95 pRenderer->DrawTextureTransparent(uX + 32, uY + uHeight - 10, pIcons_LOD->GetTexture(uTextureID_5076A4)); 98 pRenderer->DrawTextureIndexedAlpha(uX + 32, uY + uHeight - 10, pIcons_LOD->GetTexture(uTextureID_5076A4));
96 if ( uWidth > 512 ) 99 if ( uWidth > 512 )
97 { 100 {
98 pRenderer->DrawTextureTransparent(uX + 544, uY, pIcons_LOD->GetTexture(uTextureID_507698)); 101 pRenderer->DrawTextureIndexedAlpha(uX + 544, uY, pIcons_LOD->GetTexture(uTextureID_507698));
99 pRenderer->DrawTextureTransparent(uX + 544, uY + uHeight - 10, pIcons_LOD->GetTexture(uTextureID_5076A4)); 102 pRenderer->DrawTextureIndexedAlpha(uX + 544, uY + uHeight - 10, pIcons_LOD->GetTexture(uTextureID_5076A4));
100 } 103 }
101 } 104 }
102 if ( uHeight > 64 ) 105 if ( uHeight > 64 )
103 { 106 {
104 pRenderer->SetTextureClipRect(uX, uY + 32, uX + uWidth, uY + uHeight - 32); 107 pRenderer->SetUIClipRect(uX, uY + 32, uX + uWidth, uY + uHeight - 32);
105 pRenderer->DrawTextureTransparent(uX, uY + 32, pIcons_LOD->GetTexture(uTextureID_5076A0)); 108 pRenderer->DrawTextureIndexedAlpha(uX, uY + 32, pIcons_LOD->GetTexture(uTextureID_5076A0));
106 pRenderer->DrawTextureTransparent(uX + uWidth - 10, uY + 32, pIcons_LOD->GetTexture(uTextureID_50769C)); 109 pRenderer->DrawTextureIndexedAlpha(uX + uWidth - 10, uY + 32, pIcons_LOD->GetTexture(uTextureID_50769C));
107 } 110 }
108 pRenderer->ResetTextureClipRect(); 111 pRenderer->ResetUIClipRect();
109 } 112 }
110 } 113 }
111 114
112 //----- (0041D895) -------------------------------------------------------- 115 //----- (0041D895) --------------------------------------------------------
113 void GameUI_DrawItemInfo( struct ItemGen* inspect_item ) 116 void GameUI_DrawItemInfo( struct ItemGen* inspect_item )
197 } 200 }
198 } 201 }
199 if (inspect_item->IsBroken()) 202 if (inspect_item->IsBroken())
200 { 203 {
201 iteminfo_window.DrawMessageBox(0); 204 iteminfo_window.DrawMessageBox(0);
202 pRenderer->SetTextureClipRect(iteminfo_window.uFrameX + 12, iteminfo_window.uFrameY + 12, 205 pRenderer->SetUIClipRect(iteminfo_window.uFrameX + 12, iteminfo_window.uFrameY + 12,
203 iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 12, 206 iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 12,
204 iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 12); 207 iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 12);
205 iteminfo_window.uFrameWidth -= 24; 208 iteminfo_window.uFrameWidth -= 24;
206 iteminfo_window.uFrameHeight -= 12; 209 iteminfo_window.uFrameHeight -= 12;
207 iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1; 210 iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1;
212 else 215 else
213 pText = pItemsTable->pItems[inspect_item->uItemID].pUnidentifiedName; 216 pText = pItemsTable->pItems[inspect_item->uItemID].pUnidentifiedName;
214 iteminfo_window.DrawTitleText(pFontArrus, 0, 0xCu, Color16(0xFFu, 0xFFu, 0x9Bu), pText, 3); 217 iteminfo_window.DrawTitleText(pFontArrus, 0, 0xCu, Color16(0xFFu, 0xFFu, 0x9Bu), pText, 3);
215 iteminfo_window.DrawTitleText(pFontArrus, 0x64u, ((signed int)iteminfo_window.uFrameHeight >> 1) - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[32], &iteminfo_window, 0, 0) / 2, 218 iteminfo_window.DrawTitleText(pFontArrus, 0x64u, ((signed int)iteminfo_window.uFrameHeight >> 1) - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[32], &iteminfo_window, 0, 0) / 2,
216 Color16(0xFFu, 0x19u, 0x19u), pGlobalTXT_LocalizationStrings[32], 3); //"Broken Item" 219 Color16(0xFFu, 0x19u, 0x19u), pGlobalTXT_LocalizationStrings[32], 3); //"Broken Item"
217 pRenderer->ResetTextureClipRect(); 220 pRenderer->ResetUIClipRect();
218 if ( !areWeLoadingTexture ) 221 if ( !areWeLoadingTexture )
219 { 222 {
220 pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->Release(); 223 pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->Release();
221 pIcons_LOD->SyncLoadedFilesCount(); 224 pIcons_LOD->SyncLoadedFilesCount();
222 } 225 }
223 return; 226 return;
224 } 227 }
225 if (!inspect_item->IsIdentified()) 228 if (!inspect_item->IsIdentified())
226 { 229 {
227 iteminfo_window.DrawMessageBox(0); 230 iteminfo_window.DrawMessageBox(0);
228 pRenderer->SetTextureClipRect(iteminfo_window.uFrameX + 12, iteminfo_window.uFrameY + 12, 231 pRenderer->SetUIClipRect(iteminfo_window.uFrameX + 12, iteminfo_window.uFrameY + 12,
229 iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 12, iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 12); 232 iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 12, iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 12);
230 iteminfo_window.uFrameWidth -= 24; 233 iteminfo_window.uFrameWidth -= 24;
231 iteminfo_window.uFrameHeight -= 12; 234 iteminfo_window.uFrameHeight -= 12;
232 iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1; 235 iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1;
233 iteminfo_window.uFrameW = iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 1; 236 iteminfo_window.uFrameW = iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 1;
234 pRenderer->DrawTextureTransparent(iteminfo_window.uFrameX + v78, v81 + iteminfo_window.uFrameY + 30, pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)); 237 pRenderer->DrawTextureIndexedAlpha(iteminfo_window.uFrameX + v78, v81 + iteminfo_window.uFrameY + 30, pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE));
235 iteminfo_window.DrawTitleText(pFontArrus, 0, 0xCu, Color16(0xFFu, 0xFFu, 0x9Bu), pItemsTable->pItems[inspect_item->uItemID].pUnidentifiedName, 3); 238 iteminfo_window.DrawTitleText(pFontArrus, 0, 0xCu, Color16(0xFFu, 0xFFu, 0x9Bu), pItemsTable->pItems[inspect_item->uItemID].pUnidentifiedName, 3);
236 iteminfo_window.DrawTitleText(pFontArrus, 0x64u, ((signed int)iteminfo_window.uFrameHeight >> 1) - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[232], &iteminfo_window, 0, 0) / 2, 239 iteminfo_window.DrawTitleText(pFontArrus, 0x64u, ((signed int)iteminfo_window.uFrameHeight >> 1) - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[232], &iteminfo_window, 0, 0) / 2,
237 Color16(0xFFu, 0x19u, 0x19u), pGlobalTXT_LocalizationStrings[232], 3);//"Not Identified" 240 Color16(0xFFu, 0x19u, 0x19u), pGlobalTXT_LocalizationStrings[232], 3);//"Not Identified"
238 pRenderer->ResetTextureClipRect(); 241 pRenderer->ResetUIClipRect();
239 if ( !areWeLoadingTexture ) 242 if ( !areWeLoadingTexture )
240 { 243 {
241 pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->Release(); 244 pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->Release();
242 pIcons_LOD->SyncLoadedFilesCount(); 245 pIcons_LOD->SyncLoadedFilesCount();
243 } 246 }
335 iteminfo_window.uFrameWidth += 12; 338 iteminfo_window.uFrameWidth += 12;
336 iteminfo_window.uFrameHeight += (unsigned int)v85; 339 iteminfo_window.uFrameHeight += (unsigned int)v85;
337 iteminfo_window.uFrameW = iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 1; 340 iteminfo_window.uFrameW = iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 1;
338 iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1; 341 iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1;
339 iteminfo_window.DrawMessageBox(0); 342 iteminfo_window.DrawMessageBox(0);
340 pRenderer->SetTextureClipRect(iteminfo_window.uFrameX + 12, iteminfo_window.uFrameY + 12, 343 pRenderer->SetUIClipRect(iteminfo_window.uFrameX + 12, iteminfo_window.uFrameY + 12,
341 iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 12, iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 12); 344 iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 12, iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 12);
342 iteminfo_window.uFrameWidth -= 12; 345 iteminfo_window.uFrameWidth -= 12;
343 iteminfo_window.uFrameHeight -= 12; 346 iteminfo_window.uFrameHeight -= 12;
344 iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1; 347 iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1;
345 iteminfo_window.uFrameW = iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 1; 348 iteminfo_window.uFrameW = iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 1;
346 pRenderer->DrawTextureTransparent(iteminfo_window.uFrameX + v78, 349 pRenderer->DrawTextureIndexedAlpha(iteminfo_window.uFrameX + v78,
347 iteminfo_window.uFrameY + (signed int)(iteminfo_window.uFrameHeight - pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->uTextureHeight) / 2, 350 iteminfo_window.uFrameY + (signed int)(iteminfo_window.uFrameHeight - pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->uTextureHeight) / 2,
348 pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)); 351 pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE));
349 352
350 v34 = (int)(v85 + 35); 353 v34 = (int)(v85 + 35);
351 Str = out_text; 354 Str = out_text;
368 iteminfo_window.uFrameX -= 12; 371 iteminfo_window.uFrameX -= 12;
369 if ( v77 ) 372 if ( v77 )
370 { 373 {
371 sprintf(pTmpBuf.data(), "%s: %lu", pGlobalTXT_LocalizationStrings[465], v77);//"Value" 374 sprintf(pTmpBuf.data(), "%s: %lu", pGlobalTXT_LocalizationStrings[465], v77);//"Value"
372 iteminfo_window.DrawText(pFontComic, 100, iteminfo_window.uFrameHeight - LOBYTE(pFontComic->uFontHeight), 0, pTmpBuf.data(), 0, 0, 0); 375 iteminfo_window.DrawText(pFontComic, 100, iteminfo_window.uFrameHeight - LOBYTE(pFontComic->uFontHeight), 0, pTmpBuf.data(), 0, 0, 0);
373 pRenderer->ResetTextureClipRect(); 376 pRenderer->ResetUIClipRect();
374 } 377 }
375 else 378 else
376 { 379 {
377 if ( (inspect_item->uAttributes & ITEM_TEMP_BONUS) && (inspect_item->uSpecEnchantmentType || inspect_item->uEnchantmentType) ) 380 if ( (inspect_item->uAttributes & ITEM_TEMP_BONUS) && (inspect_item->uSpecEnchantmentType || inspect_item->uEnchantmentType) )
378 { 381 {
405 pText = pGlobalTXT_LocalizationStrings[187]; //"Stolen" 408 pText = pGlobalTXT_LocalizationStrings[187]; //"Stolen"
406 else 409 else
407 { 410 {
408 if ( !(inspect_item->uAttributes & ITEM_HARDENED) ) 411 if ( !(inspect_item->uAttributes & ITEM_HARDENED) )
409 { 412 {
410 pRenderer->ResetTextureClipRect(); 413 pRenderer->ResetUIClipRect();
411 if ( !areWeLoadingTexture ) 414 if ( !areWeLoadingTexture )
412 { 415 {
413 pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->Release(); 416 pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->Release();
414 pIcons_LOD->SyncLoadedFilesCount(); 417 pIcons_LOD->SyncLoadedFilesCount();
415 } 418 }
418 pText = pGlobalTXT_LocalizationStrings[651]; //"Hardened" 421 pText = pGlobalTXT_LocalizationStrings[651]; //"Hardened"
419 } 422 }
420 LOWORD(inspect_item->uAttributes) = r_mask; 423 LOWORD(inspect_item->uAttributes) = r_mask;
421 iteminfo_window.DrawText(pFontComic, pFontComic->GetLineWidth(pTmpBuf.data()) + 132, 424 iteminfo_window.DrawText(pFontComic, pFontComic->GetLineWidth(pTmpBuf.data()) + 132,
422 iteminfo_window.uFrameHeight - LOBYTE(pFontComic->uFontHeight), inspect_item->uAttributes, pText, 0, 0, 0); 425 iteminfo_window.uFrameHeight - LOBYTE(pFontComic->uFontHeight), inspect_item->uAttributes, pText, 0, 0, 0);
423 pRenderer->ResetTextureClipRect(); 426 pRenderer->ResetUIClipRect();
424 } 427 }
425 if ( !areWeLoadingTexture ) 428 if ( !areWeLoadingTexture )
426 { 429 {
427 pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->Release(); 430 pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->Release();
428 pIcons_LOD->SyncLoadedFilesCount(); 431 pIcons_LOD->SyncLoadedFilesCount();