Browse Source

Allow hud messages or arbitrary length

hltopdown
Roman Chistokhodov 6 years ago committed by Alibek Omarov
parent
commit
f2f83cd035
  1. 10
      cl_dll/message.cpp

10
cl_dll/message.cpp

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

Loading…
Cancel
Save