forked from 0ad/0ad
Fix to some of the rank icon rendering issues.
This was SVN commit r3767.
This commit is contained in:
parent
d5383db5fc
commit
8d7e2ff00a
@ -84,7 +84,7 @@ public:
|
||||
|
||||
//Rank properties
|
||||
float m_rankWidth;
|
||||
int m_rankHeight;
|
||||
float m_rankHeight;
|
||||
CStr m_rankName;
|
||||
|
||||
// Minimap properties
|
||||
|
@ -104,7 +104,7 @@ CEntity::CEntity( CBaseEntity* base, CVector3D position, float orientation, cons
|
||||
// FIXME: janwas: this was uninitialized, which leads to disaster if
|
||||
// its value happens to be positive.
|
||||
// setting to what seems to be a reasonable default.
|
||||
m_sectorDivs = 4;
|
||||
m_sectorDivs = 4;
|
||||
if ( m_sectorDivs >= 0 )
|
||||
{
|
||||
m_sectorAngles.resize(m_sectorDivs);
|
||||
@ -1151,8 +1151,11 @@ void CEntity::renderHealthBar()
|
||||
if( m_healthBarHeight < 0 )
|
||||
return; // negative bar height means don't display health bar
|
||||
|
||||
float fraction;
|
||||
if(m_healthMax == 0) fraction = 1.0f;
|
||||
else fraction = clamp(m_healthCurr / m_healthMax, 0.0f, 1.0f);
|
||||
|
||||
CVector2D pos = getScreenCoords( m_healthBarHeight );
|
||||
float fraction = clamp(m_healthCurr / m_healthMax, 0.0f, 1.0f);
|
||||
float x1 = pos.x - m_healthBarSize/2;
|
||||
float x2 = pos.x + m_healthBarSize/2;
|
||||
float y = g_yres - pos.y;
|
||||
@ -1185,8 +1188,11 @@ void CEntity::renderStaminaBar()
|
||||
if( m_staminaBarHeight < 0 )
|
||||
return; // negative bar height means don't display stamina bar
|
||||
|
||||
float fraction;
|
||||
if(m_staminaMax == 0) fraction = 1.0f;
|
||||
else fraction = clamp(m_staminaCurr / m_staminaMax, 0.0f, 1.0f);
|
||||
|
||||
CVector2D pos = getScreenCoords( m_staminaBarHeight );
|
||||
float fraction = clamp(m_staminaCurr / m_staminaMax, 0.0f, 1.0f);
|
||||
float x1 = pos.x - m_staminaBarSize/2;
|
||||
float x2 = pos.x + m_staminaBarSize/2;
|
||||
float y = g_yres - pos.y;
|
||||
@ -1214,7 +1220,7 @@ void CEntity::renderRank()
|
||||
if( !m_bounds )
|
||||
return;
|
||||
if( m_rankHeight < 0 )
|
||||
return; // negative height means don't display stamina bar
|
||||
return; // negative height means don't display rank
|
||||
//Check for valid texture
|
||||
if( g_Selection.m_unitUITextures.find( m_rankName ) == g_Selection.m_unitUITextures.end() )
|
||||
return;
|
||||
@ -1241,10 +1247,10 @@ void CEntity::renderRank()
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
|
||||
glTexCoord2f(1.0f, 0.0f); glVertex3f( x2, y2, 0 );
|
||||
glTexCoord2f(1.0f, 1.0f); glVertex3f( x2, y1, 0 );
|
||||
glTexCoord2f(0.0f, 1.0f); glVertex3f( x1, y1,0 );
|
||||
glTexCoord2f(0.0f, 0.0f); glVertex3f( x1, y2, 0 );
|
||||
glTexCoord2f(0.0f, 1.0f); glVertex3f( x1, y1, 0 );
|
||||
glTexCoord2f(1.0f, 1.0f); glVertex3f( x2, y1, 0 );
|
||||
glTexCoord2f(1.0f, 0.0f); glVertex3f( x2, y2, 0 );
|
||||
|
||||
glEnd();
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ public:
|
||||
|
||||
//Rank properties
|
||||
float m_rankHeight;
|
||||
int m_rankWidth;
|
||||
float m_rankWidth;
|
||||
CStr m_rankName;
|
||||
|
||||
bool m_healthDecay;
|
||||
|
Loading…
Reference in New Issue
Block a user