comparison GUI/UI/UIPopup.cpp @ 2575:a76d408c5132 tip

DrawTranslucent -> DrawTextureGrayShade Removed old texture drawing stuff
author a.parshin
date Wed, 09 Mar 2016 01:39:52 +0200
parents dd36326a9994
children
comparison
equal deleted inserted replaced
2574:dd36326a9994 2575:a76d408c5132
206 int g_mask = 0x7E0; 206 int g_mask = 0x7E0;
207 int b_mask = 0x1F; 207 int b_mask = 0x1F;
208 208
209 if (!inspect_item->uItemID) 209 if (!inspect_item->uItemID)
210 return; 210 return;
211
212 auto inspect_item_image = assets->GetImage_16BitColorKey(inspect_item->GetIconName(), 0x7FF);
213
211 iteminfo_window.Hint = nullptr; 214 iteminfo_window.Hint = nullptr;
212 iteminfo_window.uFrameWidth = 384; 215 iteminfo_window.uFrameWidth = 384;
213 iteminfo_window.uFrameHeight = 180; 216 iteminfo_window.uFrameHeight = 180;
214 iteminfo_window.uFrameY = 40; 217 iteminfo_window.uFrameY = 40;
215 if ( pMouse->GetCursorPos(&a2)->x <= 320 ) 218 if ( pMouse->GetCursorPos(&a2)->x <= 320 )
216 v2 = pMouse->GetCursorPos(&a2)->x + 30; 219 v2 = pMouse->GetCursorPos(&a2)->x + 30;
217 else 220 else
218 v2 = pMouse->GetCursorPos(&a2)->x - iteminfo_window.uFrameWidth - 30; 221 v2 = pMouse->GetCursorPos(&a2)->x - iteminfo_window.uFrameWidth - 30;
219 iteminfo_window.uFrameX = v2; 222 iteminfo_window.uFrameX = v2;
220 v78 = 100 - pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->uTextureWidth; 223 v78 = 100 - inspect_item_image->GetWidth();
221 v81 = 144 - pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->uTextureHeight; 224 v81 = 144 - inspect_item_image->GetHeight();
222 if ( v78 > 0 ) 225 if ( v78 > 0 )
223 v78 = v78 / 2; 226 v78 = v78 / 2;
224 if ( v81 <= 0 ) 227 if ( v81 <= 0 )
225 v81 = 0; 228 v81 = 0;
226 else 229 else
282 285
283 pRenderer->DrawTransparentRedShade( 286 pRenderer->DrawTransparentRedShade(
284 (iteminfo_window.uFrameX + v78) / 640.0f, 287 (iteminfo_window.uFrameX + v78) / 640.0f,
285 (v81 + iteminfo_window.uFrameY + 30) / 480.0f, 288 (v81 + iteminfo_window.uFrameY + 30) / 480.0f,
286 //pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)); 289 //pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE));
287 assets->GetImage_16BitAlpha(inspect_item->GetIconName())); 290 inspect_item_image);
288 if ( inspect_item->IsIdentified()) 291 if ( inspect_item->IsIdentified())
289 pText = (char *)inspect_item->GetIdentifiedName(); 292 pText = (char *)inspect_item->GetIdentifiedName();
290 else 293 else
291 pText = pItemsTable->pItems[inspect_item->uItemID].pUnidentifiedName; 294 pText = pItemsTable->pItems[inspect_item->uItemID].pUnidentifiedName;
292 iteminfo_window.DrawTitleText(pFontArrus, 0, 0xCu, Color16(0xFFu, 0xFFu, 0x9Bu), pText, 3); 295 iteminfo_window.DrawTitleText(pFontArrus, 0, 0xCu, Color16(0xFFu, 0xFFu, 0x9Bu), pText, 3);
293 iteminfo_window.DrawTitleText(pFontArrus, 0x64u, ((signed int)iteminfo_window.uFrameHeight >> 1) - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[32], &iteminfo_window, 0, 0) / 2, 296 iteminfo_window.DrawTitleText(pFontArrus, 0x64u, ((signed int)iteminfo_window.uFrameHeight >> 1) - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[32], &iteminfo_window, 0, 0) / 2,
294 Color16(0xFFu, 0x19u, 0x19u), pGlobalTXT_LocalizationStrings[32], 3); //"Broken Item" 297 Color16(0xFFu, 0x19u, 0x19u), pGlobalTXT_LocalizationStrings[32], 3); //"Broken Item"
295 pRenderer->ResetUIClipRect(); 298 pRenderer->ResetUIClipRect();
296 if ( !areWeLoadingTexture ) 299
297 { 300 if (inspect_item_image)
298 pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->Release(); 301 {
299 pIcons_LOD->SyncLoadedFilesCount(); 302 inspect_item_image->Release();
300 } 303 inspect_item_image = nullptr;
304 }
305
301 return; 306 return;
302 } 307 }
303 if (!inspect_item->IsIdentified()) 308 if (!inspect_item->IsIdentified())
304 { 309 {
305 iteminfo_window.DrawMessageBox(0); 310 iteminfo_window.DrawMessageBox(0);
307 iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 12, iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 12); 312 iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 12, iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 12);
308 iteminfo_window.uFrameWidth -= 24; 313 iteminfo_window.uFrameWidth -= 24;
309 iteminfo_window.uFrameHeight -= 12; 314 iteminfo_window.uFrameHeight -= 12;
310 iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1; 315 iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1;
311 iteminfo_window.uFrameW = iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 1; 316 iteminfo_window.uFrameW = iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 1;
312 pRenderer->DrawTextureIndexedAlpha(iteminfo_window.uFrameX + v78, v81 + iteminfo_window.uFrameY + 30, pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)); 317 pRenderer->DrawTextureAlphaNew(
318 (iteminfo_window.uFrameX + v78)/640.0f,
319 (v81 + iteminfo_window.uFrameY + 30)/480.0f,
320 inspect_item_image);
313 iteminfo_window.DrawTitleText(pFontArrus, 0, 0xCu, Color16(0xFFu, 0xFFu, 0x9Bu), pItemsTable->pItems[inspect_item->uItemID].pUnidentifiedName, 3); 321 iteminfo_window.DrawTitleText(pFontArrus, 0, 0xCu, Color16(0xFFu, 0xFFu, 0x9Bu), pItemsTable->pItems[inspect_item->uItemID].pUnidentifiedName, 3);
314 iteminfo_window.DrawTitleText(pFontArrus, 0x64u, ((signed int)iteminfo_window.uFrameHeight >> 1) - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[232], &iteminfo_window, 0, 0) / 2, 322 iteminfo_window.DrawTitleText(pFontArrus, 0x64u, ((signed int)iteminfo_window.uFrameHeight >> 1) - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[232], &iteminfo_window, 0, 0) / 2,
315 Color16(0xFFu, 0x19u, 0x19u), pGlobalTXT_LocalizationStrings[232], 3);//"Not Identified" 323 Color16(0xFFu, 0x19u, 0x19u), pGlobalTXT_LocalizationStrings[232], 3);//"Not Identified"
316 pRenderer->ResetUIClipRect(); 324 pRenderer->ResetUIClipRect();
317 if ( !areWeLoadingTexture ) 325
318 { 326 if (inspect_item_image)
319 pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->Release(); 327 {
320 pIcons_LOD->SyncLoadedFilesCount(); 328 inspect_item_image->Release();
329 inspect_item_image = nullptr;
321 } 330 }
322 return; 331 return;
323 } 332 }
324 sprintfex(out_text, pGlobalTXT_LocalizationStrings[463], pItemsTable->pItems[inspect_item->uItemID].pUnidentifiedName); //"Type: %s" 333 sprintfex(out_text, pGlobalTXT_LocalizationStrings[463], pItemsTable->pItems[inspect_item->uItemID].pUnidentifiedName); //"Type: %s"
325 out_text[100] = 0; 334 out_text[100] = 0;
419 iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 12, iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 12); 428 iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 12, iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 12);
420 iteminfo_window.uFrameWidth -= 12; 429 iteminfo_window.uFrameWidth -= 12;
421 iteminfo_window.uFrameHeight -= 12; 430 iteminfo_window.uFrameHeight -= 12;
422 iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1; 431 iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1;
423 iteminfo_window.uFrameW = iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 1; 432 iteminfo_window.uFrameW = iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 1;
424 pRenderer->DrawTextureIndexedAlpha(iteminfo_window.uFrameX + v78, 433 pRenderer->DrawTextureAlphaNew(
425 iteminfo_window.uFrameY + (signed int)(iteminfo_window.uFrameHeight - pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->uTextureHeight) / 2, 434 (iteminfo_window.uFrameX + v78)/640.0f,
426 pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)); 435 (iteminfo_window.uFrameY + (signed int)(iteminfo_window.uFrameHeight - inspect_item_image->GetHeight()) / 2)/480.0f,
436 inspect_item_image
437 );
427 438
428 v34 = (int)(v85 + 35); 439 v34 = (int)(v85 + 35);
429 Str = out_text; 440 Str = out_text;
430 for ( uint i = 1; i <= 3; i++ ) 441 for ( uint i = 1; i <= 3; i++ )
431 { 442 {
505 pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->Release(); 516 pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->Release();
506 pIcons_LOD->SyncLoadedFilesCount(); 517 pIcons_LOD->SyncLoadedFilesCount();
507 } 518 }
508 return; 519 return;
509 } 520 }
510 // 4E455C: using guessed type int dword_4E455C;
511 // 506128: using guessed type int areWeLoadingTexture;
512 521
513 //----- (0041E360) -------------------------------------------------------- 522 //----- (0041E360) --------------------------------------------------------
514 void MonsterPopup_Draw(unsigned int uActorID, GUIWindow *pWindow) 523 void MonsterPopup_Draw(unsigned int uActorID, GUIWindow *pWindow)
515 { 524 {
516 unsigned __int16 v9; // dx@4 525 unsigned __int16 v9; // dx@4