Jump to content

Уровень у ника персонажа


Grim4ik

Recommended Posts

image.png.745542f254250645f816e8d1ede6772b.png

Открываем UIHeadSay.cpp

Находим:

			for (int i(0); i<NAME_PART_NUM; i++)
			{
				if( s_dwNamePartsColors[i][1] )
				{
					CGuiFont::s_Font.BRender(s_sNamePart[i], x + iStartPosX, y - iNameHeightStep, s_dwNamePartsColors[i][0], s_dwNamePartsColors[i][1] );
				}
				else
				{
					CGuiFont::s_Font.Render(s_sNamePart[i], x + iStartPosX, y - iNameHeightStep, s_dwNamePartsColors[i][0] );
				}
				iStartPosX += CGuiFont::s_Font.GetWidth(s_sNamePart[i]);
			}

Заменяем на:

const bool drawLevelLeft = _pOwn->IsPlayer();   
const int  gap = 6;                              

char lvl[32] = {0};
int  lvlW = 0;
if (drawLevelLeft)
{
    SGameAttr* ga = _pOwn->getGameAttr(); 
#ifdef _MSC_VER
    _snprintf(lvl, sizeof(lvl), "[Lv.%d]", ga ? ga->get(ATTR_LV) : 0);
#else
    snprintf(lvl, sizeof(lvl), "[Lv.%d]",  ga ? ga->get(ATTR_LV) : 0);
#endif
    lvlW = CGuiFont::s_Font.GetWidth(lvl);
}

const int nameW = CGuiFont::s_Font.GetWidth(s_szName);

const int leftCombined = x - ((drawLevelLeft ? (lvlW + gap) : 0) + nameW) / 2;

if (drawLevelLeft)
{
    const int lvlX = leftCombined;
    const int lvlY = y - iNameHeightStep;

    CGuiFont::s_Font.Render(lvl, lvlX,     lvlY,     COLOR_BLACK);   
    CGuiFont::s_Font.Render(lvl, lvlX - 1, lvlY - 1, 0xFF00FFFF);    
}

iStartPosX = (leftCombined + (drawLevelLeft ? (lvlW + gap) : 0)) - x;

for (int i = 0; i < NAME_PART_NUM; ++i)
{
    if (s_dwNamePartsColors[i][1])
    {
        CGuiFont::s_Font.BRender(
            s_sNamePart[i],
            x + iStartPosX,
            y - iNameHeightStep,
            s_dwNamePartsColors[i][0],
            s_dwNamePartsColors[i][1]
        );
    }
    else
    {
        CGuiFont::s_Font.Render(
            s_sNamePart[i],
            x + iStartPosX,
            y - iNameHeightStep,
            s_dwNamePartsColors[i][0]
        );
    }

    iStartPosX += CGuiFont::s_Font.GetWidth(s_sNamePart[i]);
}

 

Edited by Grim4ik
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Chat

Chat

Please enter your display name

×
×
  • Create New...