Mercurial > mm7
diff UI/UIPopup.cpp @ 1678:6faacde46271
DrawPopupWindow
author | Ritor1 |
---|---|
date | Fri, 20 Sep 2013 17:31:37 +0600 |
parents | 96a1f5e0b6cd |
children | 33c7cc2d48d5 |
line wrap: on
line diff
--- a/UI/UIPopup.cpp Fri Sep 20 14:31:42 2013 +0600 +++ b/UI/UIPopup.cpp Fri Sep 20 17:31:37 2013 +0600 @@ -29,151 +29,96 @@ //----- (004179BC) -------------------------------------------------------- -void CharacterUI_DrawTooltip(const char *a1, const char *a2) +void CharacterUI_DrawTooltip(const char *Title, const char *content) { - //const char *v2; // ebx@1 - //const char *v3; // edi@1 - //unsigned int v4; // eax@1 - GUIWindow Dst; // [sp+Ch] [bp-5Ch]@1 + GUIWindow popup_window; // [sp+Ch] [bp-5Ch]@1 POINT v6; // [sp+60h] [bp-8h]@1 - //v2 = a2; - //v3 = a1; - memset(&Dst, 0, 0x54u); - Dst.uFrameWidth = 384; - Dst.uFrameHeight = 256; - Dst.uFrameX = 128; - Dst.uFrameY = pMouse->GetCursorPos(&v6)->y + 30; - Dst.uFrameHeight = pFontSmallnum->CalcTextHeight(a2, &Dst, 24, 0) + 2 * LOBYTE(pFontLucida->uFontHeight) + 24; - Dst.uFrameZ = Dst.uFrameX + Dst.uFrameWidth - 1; - Dst.uFrameW = Dst.uFrameY + Dst.uFrameHeight - 1; - Dst.DrawMessageBox(0); - Dst.uFrameX += 12; - Dst.uFrameWidth -= 24; - Dst.uFrameY += 12; - Dst.uFrameHeight -= 12; - Dst.uFrameZ = Dst.uFrameX + Dst.uFrameWidth - 1; - Dst.uFrameW = Dst.uFrameY + Dst.uFrameHeight - 1; - sprintf(pTmpBuf.data(), "\f%05d%s\f00000\n", ui_character_tooltip_header_default_color, a1); - Dst.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf.data(), 3u); - Dst.DrawText(pFontSmallnum, 1, LOBYTE(pFontLucida->uFontHeight), 0, a2, 0, 0, 0); + memset(&popup_window, 0, 0x54u); + popup_window.uFrameWidth = 384; + popup_window.uFrameHeight = 256; + popup_window.uFrameX = 128; + popup_window.uFrameY = pMouse->GetCursorPos(&v6)->y + 30; + popup_window.uFrameHeight = pFontSmallnum->CalcTextHeight(content, &popup_window, 24, 0) + 2 * LOBYTE(pFontLucida->uFontHeight) + 24; + popup_window.uFrameZ = popup_window.uFrameX + popup_window.uFrameWidth - 1; + popup_window.uFrameW = popup_window.uFrameY + popup_window.uFrameHeight - 1; + popup_window.DrawMessageBox(0); + + popup_window.uFrameX += 12; + popup_window.uFrameWidth -= 24; + popup_window.uFrameY += 12; + popup_window.uFrameHeight -= 12; + popup_window.uFrameZ = popup_window.uFrameX + popup_window.uFrameWidth - 1; + popup_window.uFrameW = popup_window.uFrameY + popup_window.uFrameHeight - 1; + sprintf(pTmpBuf.data(), "\f%05d%s\f00000\n", ui_character_tooltip_header_default_color, Title); + popup_window.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf.data(), 3); + popup_window.DrawText(pFontSmallnum, 1, LOBYTE(pFontLucida->uFontHeight), 0, content, 0, 0, 0); } //----- (004151D9) -------------------------------------------------------- void __fastcall DrawPopupWindow(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight) - { - unsigned int v4; // ebx@1 - Texture *v5; // edi@1 - signed int uTileWidth; // ecx@1 - int v7; // eax@5 - int v8; // ecx@10 - unsigned int v9; // ebx@14 - int v10; // [sp+10h] [bp-28h]@5 - signed int uTileHeight; // [sp+18h] [bp-20h]@1 - int v12; // [sp+1Ch] [bp-1Ch]@7 - int v13; // [sp+20h] [bp-18h]@1 - int a5; // [sp+24h] [bp-14h]@5 - unsigned int a5a; // [sp+24h] [bp-14h]@11 - unsigned int a4; // [sp+28h] [bp-10h]@1 - int uNumXTiles; // [sp+2Ch] [bp-Ch]@3 - unsigned int uNumXTilesa; // [sp+2Ch] [bp-Ch]@6 - unsigned int uNumXTilesb; // [sp+2Ch] [bp-Ch]@11 - unsigned int a2a; // [sp+30h] [bp-8h]@1 - unsigned int v21; // [sp+34h] [bp-4h]@5 - unsigned int v22; // [sp+34h] [bp-4h]@11 +{ + unsigned int uNumTiles; // [sp+2Ch] [bp-Ch]@6 + unsigned int coord_x; // [sp+2Ch] [bp-Ch]@3 + unsigned int coord_y; // [sp+34h] [bp-4h]@5 - v4 = uY; - a2a = uX; - a4 = uX + uWidth; - pRenderer->SetTextureClipRect(uX, v4, uX + uWidth, v4 + uHeight); - v5 = pIcons_LOD->GetTexture(uTextureID_Parchment); - uTileWidth = v5->uTextureWidth; - v13 = v5->uTextureWidth; - uTileHeight = v5->uTextureHeight; - if ( v5->uTextureWidth && v5->uTextureHeight) + pRenderer->SetTextureClipRect(uX, uY, uX + uWidth, uY + uHeight); + if ( pIcons_LOD->GetTexture(uTextureID_Parchment)->uTextureWidth && pIcons_LOD->GetTexture(uTextureID_Parchment)->uTextureHeight) + { + uNumTiles = uWidth / pIcons_LOD->GetTexture(uTextureID_Parchment)->uTextureWidth; + if ( uWidth % pIcons_LOD->GetTexture(uTextureID_Parchment)->uTextureWidth ) + ++uNumTiles; + coord_y = uY; + for ( uint j = 0; j <= uHeight / pIcons_LOD->GetTexture(uTextureID_Parchment)->uTextureHeight; j++ ) { - uNumXTiles = (signed int)uWidth / uTileWidth; - if ( (signed int)uWidth % uTileWidth ) - ++uNumXTiles; - a5 = 0; - v21 = v4; - v7 = uNumXTiles + 1; - v10 = uNumXTiles + 1; - do - { - uNumXTilesa = a2a - v13; - if ( v7 > 0 ) - { - v12 = v7; - do - { - uNumXTilesa += v13; - pRenderer->DrawTextureIndexed(uNumXTilesa, v21, v5); - --v12; - } - while ( v12 ); - v7 = v10; - } - v21 += uTileHeight; - v8 = a5++; - } - while ( v8 < (signed int)uHeight / uTileHeight ); - a5a = v4 + uHeight - 32; - pRenderer->DrawTextureTransparent(a2a, v4, pIcons_LOD->GetTexture(uTextureID_5076AC)); - pRenderer->DrawTextureTransparent(a2a, a5a, pIcons_LOD->GetTexture(uTextureID_5076B4)); - pRenderer->DrawTextureTransparent(a4 - 32, v4, pIcons_LOD->GetTexture(uTextureID_5076A8)); - pRenderer->DrawTextureTransparent(a4 - 32, a5a, pIcons_LOD->GetTexture(uTextureID_5076B0)); - uNumXTilesb = a2a + 32; - v22 = v4 + uHeight - 10; - if ( (signed int)uWidth > 64 ) - { - pRenderer->SetTextureClipRect(a2a + 32, v4, a4 - 32, v4 + uHeight); - pRenderer->DrawTextureTransparent(uNumXTilesb, v4, pIcons_LOD->GetTexture(uTextureID_507698)); - pRenderer->DrawTextureTransparent(uNumXTilesb, v22, pIcons_LOD->GetTexture(uTextureID_5076A4)); - if ( (signed int)uWidth > 512 ) - { - pRenderer->DrawTextureTransparent(a2a + 544, v4, pIcons_LOD->GetTexture(uTextureID_507698)); - pRenderer->DrawTextureTransparent(a2a + 544, v22, pIcons_LOD->GetTexture(uTextureID_5076A4)); - } - } - v9 = v4 + 32; - if ( (signed int)uHeight > 64 ) - { - pRenderer->SetTextureClipRect(a2a, v9, a4, a5a); - pRenderer->DrawTextureTransparent(a2a, v9, pIcons_LOD->GetTexture(uTextureID_5076A0)); - pRenderer->DrawTextureTransparent(a4 - 10, v9, pIcons_LOD->GetTexture(uTextureID_50769C)); - } - pRenderer->ResetTextureClipRect(); - } + coord_x = uX - pIcons_LOD->GetTexture(uTextureID_Parchment)->uTextureWidth; + for ( uint i = uNumTiles + 1; i; --i ) + { + coord_x += pIcons_LOD->GetTexture(uTextureID_Parchment)->uTextureWidth; + pRenderer->DrawTextureIndexed(coord_x, coord_y, pIcons_LOD->GetTexture(uTextureID_Parchment)); + } + coord_y += pIcons_LOD->GetTexture(uTextureID_Parchment)->uTextureHeight; } - - + pRenderer->DrawTextureTransparent(uX, uY, pIcons_LOD->GetTexture(uTextureID_5076AC)); + pRenderer->DrawTextureTransparent(uX, uY + uHeight - 32, pIcons_LOD->GetTexture(uTextureID_5076B4)); + pRenderer->DrawTextureTransparent(uX + uWidth - 32, uY, pIcons_LOD->GetTexture(uTextureID_5076A8)); + pRenderer->DrawTextureTransparent(uX + uWidth - 32, uY + uHeight - 32, pIcons_LOD->GetTexture(uTextureID_5076B0)); + if ( uWidth > 64 ) + { + pRenderer->SetTextureClipRect(uX + 32, uY, uX + uWidth - 32, uY + uHeight); + pRenderer->DrawTextureTransparent(uX + 32, uY, pIcons_LOD->GetTexture(uTextureID_507698)); + pRenderer->DrawTextureTransparent(uX + 32, uY + uHeight - 10, pIcons_LOD->GetTexture(uTextureID_5076A4)); + if ( uWidth > 512 ) + { + pRenderer->DrawTextureTransparent(uX + 544, uY, pIcons_LOD->GetTexture(uTextureID_507698)); + pRenderer->DrawTextureTransparent(uX + 544, uY + uHeight - 10, pIcons_LOD->GetTexture(uTextureID_5076A4)); + } + } + if ( uHeight > 64 ) + { + pRenderer->SetTextureClipRect(uX, uY + 32, uX + uWidth, uY + uHeight - 32); + pRenderer->DrawTextureTransparent(uX, uY + 32, pIcons_LOD->GetTexture(uTextureID_5076A0)); + pRenderer->DrawTextureTransparent(uX + uWidth - 10, uY + 32, pIcons_LOD->GetTexture(uTextureID_50769C)); + } + pRenderer->ResetTextureClipRect(); + } +} //----- (0041D895) -------------------------------------------------------- void GameUI_DrawItemInfo( struct ItemGen* inspect_item ) { ItemGen *v1; // esi@1 unsigned int v2; // eax@3 - //char *v3; // edi@5 - //unsigned int v4; // eax@5 - //unsigned int v5; // esi@5 signed int v6; // eax@5 int v7; // edx@5 - //unsigned int v9; // eax@12 char v10; // zf@16 ItemGen *v11; // eax@16 ItemGen *v12; // eax@25 - //unsigned int v13; // ecx@32 - //unsigned int v14; // eax@32 - //Render *v15; // edi@33 const char *v16; // eax@34 int v17; // eax@36 int v18; // esi@37 unsigned __int16 v19; // ax@37 - //char v20; // al@40 char v21; // al@44 - //char v22; // al@48 - //char v23; // al@51 int v24; // eax@52 int v25; // eax@57 int v26; // eax@60 @@ -193,47 +138,31 @@ GUIFont *v40; // edx@113 signed int v41; // [sp-20h] [bp-298h]@113 int v42; // [sp-1Ch] [bp-294h]@113 - //char *v43; // [sp-18h] [bp-290h]@46 unsigned int v44; // [sp-18h] [bp-290h]@113 - //int v45; // [sp-14h] [bp-28Ch]@46 const char *v46; // [sp-14h] [bp-28Ch]@58 char *v47; // [sp-14h] [bp-28Ch]@110 - //char *v48; // [sp-10h] [bp-288h]@46 const char *v49; // [sp-10h] [bp-288h]@56 char *v50; // [sp-10h] [bp-288h]@58 int v51; // [sp-10h] [bp-288h]@110 const char *v52; // [sp-Ch] [bp-284h]@36 - //int v53; // [sp-Ch] [bp-284h]@46 char *v54; // [sp-Ch] [bp-284h]@56 int v55; // [sp-Ch] [bp-284h]@58 int v56; // [sp-Ch] [bp-284h]@110 unsigned int v57; // [sp-8h] [bp-280h]@36 - //int v58; // [sp-8h] [bp-280h]@46 int v59; // [sp-8h] [bp-280h]@56 int v60; // [sp-8h] [bp-280h]@58 unsigned int v61; // [sp-8h] [bp-280h]@110 char out_text[300]; // [sp+8h] [bp-270h]@40 - //char Dest[100]; // [sp+6Ch] [bp-20Ch]@40 - //char v64[100]; // [sp+D0h] [bp-1A8h]@40 char v65[120]; // [sp+134h] [bp-144h]@92 char Source[40]; // [sp+1ACh] [bp-CCh]@49 stru351_summoned_item v67; - //int v67; // [sp+1D4h] [bp-A4h]@91 - //int v68; // [sp+1D8h] [bp-A0h]@106 - //int v69; // [sp+1DCh] [bp-9Ch]@101 - //int v70; // [sp+1E0h] [bp-98h]@97 - //int v71; // [sp+1E8h] [bp-90h]@93 - //int v72; // [sp+1ECh] [bp-8Ch]@91 int var88; // [sp+1F0h] [bp-88h]@1 Texture *v73; // [sp+1F4h] [bp-84h]@5 - //unsigned int v75; // [sp+1F8h] [bp-80h]@5 - //char *v76; // [sp+1FCh] [bp-7Ch]@5 int v77; // [sp+200h] [bp-78h]@12 int v78; // [sp+204h] [bp-74h]@5 GUIWindow wHintWindow; // [sp+208h] [bp-70h]@2 POINT a2; // [sp+25Ch] [bp-1Ch]@2 int v81; // [sp+264h] [bp-14h]@5 - // GUIFont *pFontComic; // [sp+268h] [bp-10h]@1 PlayerSpeech v83; // [sp+26Ch] [bp-Ch]@18 char* v84; int v85; @@ -1748,10 +1677,8 @@ break; case 26: // Class description { - auto v24 = pClassNames[pPlayers[uActiveCharacter]->classType]; - auto v7 = pClassDescriptions[pPlayers[uActiveCharacter]->classType]; - if (v7 && v24) - CharacterUI_DrawTooltip(v24, v7); + if (pClassDescriptions[pPlayers[uActiveCharacter]->classType] && pClassNames[pPlayers[uActiveCharacter]->classType]) + CharacterUI_DrawTooltip(pClassNames[pPlayers[uActiveCharacter]->classType], pClassDescriptions[pPlayers[uActiveCharacter]->classType]); } break;