mirror of
https://github.com/YGGverse/hlsdk-portable.git
synced 2025-02-03 02:24:28 +00:00
Text print tweak
This commit is contained in:
parent
833bd215d7
commit
d9422fdb86
@ -201,13 +201,17 @@ int CHud :: DrawHudString(int xpos, int ypos, int iMaxX, char *szIt, int r, int
|
|||||||
gEngfuncs.pfnDrawSetTextColor( r/255.0, g/255.0, b/255.0 );
|
gEngfuncs.pfnDrawSetTextColor( r/255.0, g/255.0, b/255.0 );
|
||||||
return gEngfuncs.pfnDrawConsoleString( xpos, ypos, (char*) szIt );
|
return gEngfuncs.pfnDrawConsoleString( xpos, ypos, (char*) szIt );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// xash3d: reset unicode state
|
||||||
|
TextMessageDrawChar( 0, 0, 0, 0, 0, 0 );
|
||||||
|
|
||||||
// draw the string until we hit the null character or a newline character
|
// draw the string until we hit the null character or a newline character
|
||||||
for ( ; *szIt != 0 && *szIt != '\n'; szIt++ )
|
for ( ; *szIt != 0 && *szIt != '\n'; szIt++ )
|
||||||
{
|
{
|
||||||
int w = gHUD.m_scrinfo.charWidths[ 'M' ];
|
int w = gHUD.m_scrinfo.charWidths[ 'M' ];
|
||||||
if ( xpos + w > iMaxX )
|
if ( xpos + w > iMaxX )
|
||||||
return xpos;
|
return xpos;
|
||||||
if( *szIt == '^' && *(szIt + 1) >= '0' && *(szIt + 1) <= '7' )
|
if( (*szIt == '^') && (*(szIt + 1) >= '0') && (*(szIt + 1) <= '7') )
|
||||||
{
|
{
|
||||||
szIt++;
|
szIt++;
|
||||||
r = colors[ *szIt - '0' ][0];
|
r = colors[ *szIt - '0' ][0];
|
||||||
@ -216,8 +220,9 @@ int CHud :: DrawHudString(int xpos, int ypos, int iMaxX, char *szIt, int r, int
|
|||||||
if( !*(++szIt))
|
if( !*(++szIt))
|
||||||
return xpos;
|
return xpos;
|
||||||
}
|
}
|
||||||
|
int c = (unsigned int)(unsigned char)*szIt;
|
||||||
|
|
||||||
xpos += TextMessageDrawChar( xpos, ypos, *szIt, r, g, b );
|
xpos += TextMessageDrawChar( xpos, ypos, c, r, g, b );
|
||||||
}
|
}
|
||||||
|
|
||||||
return xpos;
|
return xpos;
|
||||||
@ -228,7 +233,7 @@ int CHud :: DrawHudStringLen( char *szIt )
|
|||||||
int l = 0;
|
int l = 0;
|
||||||
for ( ; *szIt != 0 && *szIt != '\n'; szIt++ )
|
for ( ; *szIt != 0 && *szIt != '\n'; szIt++ )
|
||||||
{
|
{
|
||||||
l += gHUD.m_scrinfo.charWidths[ (unsigned int)*szIt ];
|
l += gHUD.m_scrinfo.charWidths[ (unsigned char)*szIt ];
|
||||||
}
|
}
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user