Apply 4253 update

This commit is contained in:
mittorn
2018-10-04 13:08:48 +07:00
parent 1e7f9d00c3
commit 5c738b3402
105 changed files with 1562 additions and 1977 deletions

View File

@@ -75,6 +75,7 @@ void CEngineSurface :: SetupPaintState( const PaintStack *paintState )
_translateX = paintState->iTranslateX;
_translateY = paintState->iTranslateY;
SetScissorRect( paintState->iScissorLeft, paintState->iScissorTop, paintState->iScissorRight, paintState->iScissorBottom );
currentPanel = paintState->m_pPanel;
}
void CEngineSurface :: InitVertex( vpoint_t &vertex, int x, int y, float u, float v )
@@ -196,11 +197,7 @@ void CEngineSurface :: drawSetTextFont( Font *font )
if( y + tall + 1 > FONT_SIZE )
{
if( !staticFontInfo->bindIndex[currentPage] )
{
int bindIndex = createNewTextureID();
staticFontInfo->bindIndex[currentPage] = bindIndex;
}
staticFontInfo->bindIndex[currentPage] = createNewTextureID();
drawSetTextureRGBA( staticFontInfo->bindIndex[currentPage], staticRGBA, FONT_SIZE, FONT_SIZE );
currentPage++;
@@ -223,11 +220,7 @@ void CEngineSurface :: drawSetTextFont( Font *font )
if( currentPage != FONT_PAGES )
{
if( !staticFontInfo->bindIndex[currentPage] )
{
int bindIndex = createNewTextureID();
staticFontInfo->bindIndex[currentPage] = bindIndex;
}
staticFontInfo->bindIndex[currentPage] = createNewTextureID();
drawSetTextureRGBA( staticFontInfo->bindIndex[currentPage], staticRGBA, FONT_SIZE, FONT_SIZE );
}
staticFontInfo->pageCount = currentPage + 1;
@@ -327,13 +320,14 @@ void CEngineSurface :: drawPrintText( const char *text, int textLen )
static bool hasColor = 0;
static int numColor = 7;
if( !text || !staticFont || !staticFontInfo )
if( !COM_CheckString( text ) || !staticFont || !staticFontInfo )
return;
int x = _drawTextPos[0] + _translateX;
int y = _drawTextPos[1] + _translateY;
int tall = staticFont->getTall();
int curTextColor[4];
int iTotalWidth = 0;
// HACKHACK: allow color strings in VGUI
if( numColor != 7 && vgui_colorstrings->value )
@@ -377,12 +371,13 @@ void CEngineSurface :: drawPrintText( const char *text, int textLen )
float t1 = staticFontInfo->texCoord[curCh][3];
int wide = abcB;
iTotalWidth += abcA;
drawSetTexture( staticFontInfo->bindIndex[staticFontInfo->pageForChar[curCh]] );
drawPrintChar( x, y, wide, tall, s0, t0, s1, t1, curTextColor );
x += abcA + abcB + abcC;
drawPrintChar( x + iTotalWidth, y, wide, tall, s0, t0, s1, t1, curTextColor );
iTotalWidth += wide + abcC;
}
_drawTextPos[0] += x;
_drawTextPos[0] += iTotalWidth;
}
void CEngineSurface :: drawSetTextureRGBA( int id, const char* rgba, int wide, int tall )
@@ -406,6 +401,7 @@ void CEngineSurface :: drawTexturedRect( int x0, int y0, int x1, int y1 )
vpoint_t rect[2];
vpoint_t clippedRect[2];
// it's not a vertex, just fill rectangle
InitVertex( rect[0], x0, y0, 0, 0 );
InitVertex( rect[1], x1, y1, 1, 1 );