Fix CenterPrint Wrong X Position

This commit is contained in:
xiaodoxd 2024-10-05 01:02:41 +08:00 committed by Alibek Omarov
parent 6c531c14e6
commit d1e118f07c

View file

@ -252,18 +252,18 @@ static int CL_AdjustXPos( float x, int width, int totalWidth )
if( x == -1 ) if( x == -1 )
{ {
xPos = ( refState.width - width ) * 0.5f; xPos = ( clgame.scrInfo.iWidth - width ) * 0.5f;
} }
else else
{ {
if ( x < 0 ) if ( x < 0 )
xPos = (1.0f + x) * refState.width - totalWidth; // Alight right xPos = (1.0f + x) * clgame.scrInfo.iWidth - totalWidth; // Alight right
else // align left else // align left
xPos = x * refState.width; xPos = x * clgame.scrInfo.iWidth;
} }
if( xPos + width > refState.width ) if( xPos + width > clgame.scrInfo.iWidth)
xPos = refState.width - width; xPos = clgame.scrInfo.iWidth - width;
else if( xPos < 0 ) else if( xPos < 0 )
xPos = 0; xPos = 0;