2
0
mirror of https://github.com/FWGS/hlsdk-xash3d synced 2024-11-22 09:57:21 +01:00

Allow hud messages or arbitrary length

This commit is contained in:
Roman Chistokhodov 2019-04-11 17:21:47 +03:00 committed by Alibek Omarov
parent ea6fa67c87
commit f2f83cd035

View File

@ -240,7 +240,7 @@ void CHudMessage::MessageDrawScan( client_textmessage_t *pMessage, float time )
{
int i, j, length, width;
const char *pText;
unsigned char line[80];
const char *pLineStart;
pText = pMessage->pMessage;
// Count lines
@ -278,25 +278,21 @@ void CHudMessage::MessageDrawScan( client_textmessage_t *pMessage, float time )
{
m_parms.lineLength = 0;
m_parms.width = 0;
pLineStart = pText;
while( *pText && *pText != '\n' )
{
unsigned char c = *pText;
if (m_parms.lineLength < sizeof(line)-1)
{
line[m_parms.lineLength] = c;
m_parms.width += gHUD.m_scrinfo.charWidths[c];
m_parms.lineLength++;
}
m_parms.width += gHUD.m_scrinfo.charWidths[c];
m_parms.lineLength++;
pText++;
}
pText++; // Skip LF
line[m_parms.lineLength] = 0;
m_parms.x = XPosition( pMessage->x, m_parms.width, m_parms.totalWidth );
for( j = 0; j < m_parms.lineLength; j++ )
{
m_parms.text = line[j];
m_parms.text = pLineStart[j];
int next = m_parms.x + gHUD.m_scrinfo.charWidths[m_parms.text];
MessageScanNextChar();