int CHudDeathNotice :: Draw( float flTime ) { int x, y, r, g, b; for ( int i = 0; i < MAX_DEATHNOTICES; i++ ) { if ( rgDeathNoticeList[i].iId == 0 ) break; // we've gone through them all if ( rgDeathNoticeList[i].flDisplayTime < flTime ) { // display time has expired // remove the current item from the list memmove( &rgDeathNoticeList[i], &rgDeathNoticeList[i+1], sizeof(DeathNoticeItem) * (MAX_DEATHNOTICES - i) ); i--; // continue on the next item; stop the counter getting incremented continue; } rgDeathNoticeList[i].flDisplayTime = min( rgDeathNoticeList[i].flDisplayTime, gHUD.m_flTime + DEATHNOTICE_DISPLAY_TIME ); // Draw the death notice y = YRES(DEATHNOTICE_TOP) + 2 + (20 * i); //!!! int id = (rgDeathNoticeList[i].iId == -1) ? m_HUD_d_skull : rgDeathNoticeList[i].iId; x = ScreenWidth - ConsoleStringLen(rgDeathNoticeList[i].szVictim) - (gHUD.GetSpriteRect(id).right - gHUD.GetSpriteRect(id).left); if ( !rgDeathNoticeList[i].iSuicide ) { x -= (5 + ConsoleStringLen( rgDeathNoticeList[i].szKiller ) ); // Draw killers name if ( rgDeathNoticeList[i].KillerColor ) gEngfuncs.pfnDrawSetTextColor( rgDeathNoticeList[i].KillerColor[0], rgDeathNoticeList[i].KillerColor[1], rgDeathNoticeList[i].KillerColor[2] ); x = 5 + DrawConsoleString( x, y, rgDeathNoticeList[i].szKiller ); } r = 255; g = 80; b = 0; if ( rgDeathNoticeList[i].iTeamKill ) { r = 10; g = 240; b = 10; // display it in sickly green } // Draw death weapon SPR_Set( gHUD.GetSprite(id), r, g, b ); SPR_DrawAdditive( 0, x, y, &gHUD.GetSpriteRect(id) ); x += (gHUD.GetSpriteRect(id).right - gHUD.GetSpriteRect(id).left); // Draw victims name (if it was a player that was killed) if (rgDeathNoticeList[i].iNonPlayerKill == FALSE) { if ( rgDeathNoticeList[i].VictimColor ) gEngfuncs.pfnDrawSetTextColor( rgDeathNoticeList[i].VictimColor[0], rgDeathNoticeList[i].VictimColor[1], rgDeathNoticeList[i].VictimColor[2] ); x = DrawConsoleString( x, y, rgDeathNoticeList[i].szVictim ); } } return 1; }
int CHudSayText :: Draw( float flTime ) { int y = Y_START; if ( !m_HUD_saytext->value ) return 1; // make sure the scrolltime is within reasonable bounds, to guard against the clock being reset flScrollTime = min( flScrollTime, flTime + m_HUD_saytext_time->value ); // make sure the scrolltime is within reasonable bounds, to guard against the clock being reset flScrollTime = min( flScrollTime, flTime + m_HUD_saytext_time->value ); if ( flScrollTime <= flTime ) { if ( *g_szLineBuffer[0] ) { flScrollTime = flTime + m_HUD_saytext_time->value; // push the console up ScrollTextUp(); } else { // buffer is empty, just disable drawing of this section m_iFlags &= ~HUD_ACTIVE; } } for ( int i = 0; i < MAX_LINES; i++ ) { if ( *g_szLineBuffer[i] ) { if ( *g_szLineBuffer[i] == 2 && g_pflNameColors[i] ) { // it's a saytext string static char buf[MAX_PLAYER_NAME_LENGTH+32]; // draw the first x characters in the player color strncpy( buf, g_szLineBuffer[i], min(g_iNameLengths[i], MAX_PLAYER_NAME_LENGTH+32) ); buf[ min(g_iNameLengths[i], MAX_PLAYER_NAME_LENGTH+31) ] = 0; gEngfuncs.pfnDrawSetTextColor( g_pflNameColors[i][0], g_pflNameColors[i][1], g_pflNameColors[i][2] ); int x = DrawConsoleString( LINE_START, y, buf ); // color is reset after each string draw DrawConsoleString( x, y, g_szLineBuffer[i] + g_iNameLengths[i] ); } else { // normal draw DrawConsoleString( LINE_START, y, g_szLineBuffer[i] ); } } y += line_height; } return 1; }
int CHudStatusBar :: Draw( float fTime ) { this->ReparseStringIfNeeded(); // Draw the status bar lines for ( int i = 0; i < MAX_STATUSBAR_LINES; i++ ) { int TextHeight, TextWidth; GetConsoleStringSize( m_szStatusBar[i], &TextWidth, &TextHeight ); int Y_START; if ( ScreenHeight() >= 480 ) Y_START = ScreenHeight() - 55; else Y_START = ScreenHeight() - 45; int x = 5; int y = Y_START - ( TextHeight * i ); // draw along bottom of screen // let user set status ID bar centering if ( (i == STATUSBAR_ID_LINE) && CVAR_GET_FLOAT("hud_centerid") ) { x = max( 0, max(2, (ScreenWidth() - TextWidth)) / 2 ); y = (ScreenHeight() / 2) + (TextHeight*CVAR_GET_FLOAT("hud_centerid")); } if ( m_pflNameColors[i] ) DrawSetTextColor( m_pflNameColors[i][0], m_pflNameColors[i][1], m_pflNameColors[i][2] ); DrawConsoleString( x, y, m_szStatusBar[i] ); } return 1; }
int CHudStatusBar :: Draw( float fTime ) { if( m_bReparseString ) { for( int i = 0; i < MAX_STATUSBAR_LINES; i++ ) { m_pflNameColors[i] = g_ColorYellow; ParseStatusString( i ); } m_bReparseString = FALSE; } int Y_START = ScreenHeight - YRES( 32 + 4 ); // Draw the status bar lines for( int i = 0; i < MAX_STATUSBAR_LINES; i++ ) { int TextHeight, TextWidth; GetConsoleStringSize( m_szStatusBar[i], &TextWidth, &TextHeight ); int x = 4; int y = Y_START - ( 4 + TextHeight * i ); // draw along bottom of screen // let user set status ID bar centering if(( i == STATUSBAR_ID_LINE ) && CVAR_GET_FLOAT( "hud_centerid" )) { x = max( 0, max( 2, (ScreenWidth - TextWidth)) / 2 ); y = (ScreenHeight / 2) + (TextHeight * CVAR_GET_FLOAT( "hud_centerid" )); } if( m_pflNameColors[i] ) DrawSetTextColor( m_pflNameColors[i][0], m_pflNameColors[i][1], m_pflNameColors[i][2] ); DrawConsoleString( x, y, m_szStatusBar[i] ); } return 1; }
bool CHudSayText::Draw( float flTime ) { int y = m_iYStart; if ( ( gViewPort && !gViewPort->AllowedToPrintText() ) || !m_HUD_saytext->value ) return true; // make sure the scrolltime is within reasonable bounds, to guard against the clock being reset m_flScrollTime = min( m_flScrollTime, flTime + m_HUD_saytext_time->value ); // make sure the scrolltime is within reasonable bounds, to guard against the clock being reset m_flScrollTime = min( m_flScrollTime, flTime + m_HUD_saytext_time->value ); if ( m_flScrollTime <= flTime ) { if ( *m_szLineBuffer[0] ) { m_flScrollTime = flTime + m_HUD_saytext_time->value; // push the console up ScrollTextUp(); } else { // buffer is empty, just disable drawing of this section m_iFlags &= ~HUD_ACTIVE; } } //Must fit either an entire saytext line or an entire player name. - Solokiller char szBuffer[ MAX_CHARS_PER_LINE > MAX_PLAYER_NAME_LENGTH ? MAX_CHARS_PER_LINE : MAX_PLAYER_NAME_LENGTH ]; for ( int i = 0; i < MAX_LINES; i++ ) { if ( *m_szLineBuffer[i] ) { if ( *m_szLineBuffer[i] == 2 && m_pvecNameColors[i] ) { // it's a saytext string // draw the first x characters in the player color strncpy( szBuffer, m_szLineBuffer[i], min(m_iNameLengths[i], MAX_PLAYER_NAME_LENGTH+32) ); szBuffer[ min(m_iNameLengths[i], MAX_PLAYER_NAME_LENGTH+31) ] = '\0'; gEngfuncs.pfnDrawSetTextColor( *( m_pvecNameColors[ i ] )[0], *( m_pvecNameColors[ i ] )[1], *( m_pvecNameColors[ i ] )[2] ); int x = DrawConsoleString( LINE_START, y, szBuffer + 1 ); // don't draw the control code at the start strncpy( szBuffer, m_szLineBuffer[i] + m_iNameLengths[i], strlen( m_szLineBuffer[i] )); szBuffer[ strlen( m_szLineBuffer[i] + m_iNameLengths[i] ) - 1 ] = '\0'; // color is reset after each string draw gEngfuncs.pfnDrawSetTextColor( g_ColorYellow[ 0 ], g_ColorYellow[ 1 ], g_ColorYellow[ 2 ] ); DrawConsoleString( x, y, szBuffer ); } else { // normal draw gEngfuncs.pfnDrawSetTextColor( g_ColorYellow[ 0 ], g_ColorYellow[ 1 ], g_ColorYellow[ 2 ] ); DrawConsoleString( LINE_START, y, m_szLineBuffer[i] ); } } y += m_iLineHeight; } return true; }
/* ================= UI_DrawMenu ================= */ void UI_DrawMenu( menuFramework_s *menu ) { static long statusFadeTime; static menuCommon_s *lastItem; menuCommon_s *item; int i; // draw contents for( i = 0; i < menu->numItems; i++ ) { item = (menuCommon_s *)menu->items[i]; if( item->flags & QMF_HIDDEN ) continue; if( item->ownerdraw ) { // total subclassing, owner draws everything item->ownerdraw( item ); continue; } switch( item->type ) { case QMTYPE_SCROLLLIST: UI_ScrollList_Draw((menuScrollList_s *)item ); break; case QMTYPE_SPINCONTROL: UI_SpinControl_Draw((menuSpinControl_s *)item ); break; case QMTYPE_CHECKBOX: UI_CheckBox_Draw((menuCheckBox_s *)item ); break; case QMTYPE_SLIDER: UI_Slider_Draw((menuSlider_s *)item ); break; case QMTYPE_FIELD: UI_Field_Draw((menuField_s *)item ); break; case QMTYPE_ACTION: UI_Action_Draw((menuAction_s *)item ); break; case QMTYPE_BITMAP: UI_Bitmap_Draw((menuBitmap_s *)item ); break; case QMTYPE_BM_BUTTON: UI_PicButton_Draw((menuPicButton_s *)item ); break; } } // draw status bar item = (menuCommon_s *)UI_ItemAtCursor( menu ); if( item != lastItem ) { // flash on selected button (like in GoldSrc) if( item ) item->lastFocusTime = uiStatic.realTime; statusFadeTime = uiStatic.realTime; lastItem = item; } if( item && ( item->flags & QMF_HASMOUSEFOCUS && !( item->flags & QMF_NOTIFY )) && ( item->statusText != NULL )) { // fade it in, but wait a second int alpha = bound( 0, ((( uiStatic.realTime - statusFadeTime ) - 1000 ) * 0.001f ) * 255, 255 ); int r, g, b, x, len; GetConsoleStringSize( item->statusText, &len, NULL ); UnpackRGB( r, g, b, uiColorHelp ); TextMessageSetColor( r, g, b, alpha ); x = ( ScreenWidth - len ) * 0.5; // centering DrawConsoleString( x, 720 * uiStatic.scaleY, item->statusText ); } else statusFadeTime = uiStatic.realTime; }
int CHudRadar::Draw(float flTime) { if ( (gHUD.m_iHideHUDDisplay & HIDEHUD_HEALTH) || gEngfuncs.IsSpectateOnly() || !(gHUD.m_iWeaponBits & (1<<(WEAPON_SUIT)))) { return 1; } cl_entity_t *pLocal = gEngfuncs.GetLocalPlayer(); if(!pLocal) { return 1; } float flPlayerAngles, flLength, flAngle, flRadians, pos_x, pos_y; vec3_t vecViewAngles, v_right, vecPlayerOrigin, vecOtherOrigin, vecDifference, vecAngles; /* * Draw Background radar */ // Get origin for radar int x = ScreenWidth; int y = 0; int iRadarWidth = gHUD.GetSpriteRect(m_HUD_radar).right - gHUD.GetSpriteRect(m_HUD_radar).left; int iRadarHeight = gHUD.GetSpriteRect(m_HUD_radar).bottom - gHUD.GetSpriteRect(m_HUD_radar).top; int infox = ScreenWidth - INFO_WIDTH; int infoy = iRadarHeight; int infoheight = gHUD.GetSpriteRect(m_HUD_radar_info).bottom - gHUD.GetSpriteRect(m_HUD_radar_info).top; x -= iRadarWidth; // Slide radar + info bar in/out when we enable/disable if(m_blPrevRadar != m_blRadar && !m_blSliding) { m_blSliding = true; m_flSlideTime = flTime; } // We switched the radar on/off while in the middle of sliding else if(m_blPrevRadar == m_blRadar && m_blSliding) { m_blPrevRadar = !m_blPrevRadar; // Invert time float flSlideTime = flTime - m_flSlideTime; flSlideTime = SLIDETIME - flSlideTime; m_flSlideTime = flTime - flSlideTime; } if(m_blSliding) { // Sliding is done, disable if((m_flSlideTime + SLIDETIME) < flTime) { m_blSliding = false; m_flSlideTime = 0; m_blPrevRadar = m_blRadar; // Done sliding and radar is off, disable if(!m_blRadar) { return 1; } } // we're still sliding else { float flPercent; if(m_blRadar) flPercent = (SLIDETIME-(flTime - m_flSlideTime))/SLIDETIME; else flPercent = (flTime - m_flSlideTime)/SLIDETIME; // Slide Radar y = -iRadarHeight * flPercent; // Slide Infobox infox += INFO_WIDTH * flPercent; } } // Done sliding and radar is off, disable if(!m_blRadar && !m_blSliding) { return 1; } // Draw Radar SPR_Set(gHUD.GetSprite(m_HUD_radar), 255, 255, 255); SPR_DrawHoles(0, x,y, &gHUD.GetSpriteRect(m_HUD_radar)); // Draw info box SPR_Set(gHUD.GetSprite(m_HUD_radar_info), 255,255,255); SPR_DrawHoles(0, infox,infoy, &gHUD.GetSpriteRect(m_HUD_radar_info)); if(m_blSliding) m_iyBottomRadar = y + iRadarHeight; else m_iyBottomRadar = infoy + infoheight; // Sliding or radar is just off, dont display information if(m_blSliding || !m_blRadar) { return 1; } /* * Get Player Angles */ // Setting player angles gEngfuncs.GetViewAngles((float *)vecViewAngles); AngleVectors(vecViewAngles, NULL, v_right, NULL ); // Inverse vector VectorInverse(v_right); v_right.z = 0; // Get angles VectorAngles(v_right,vecAngles); flPlayerAngles = vecAngles.y; // strictly 0 to 360 if(flPlayerAngles < 0) flPlayerAngles += 360; // Move x and y to the middle of the radar x += OFFSET_RAD_WIDTH; y += OFFSET_RAD_HEIGHT; /* * Loop and draw dots */ for(int i=0; i<MAX_PLAYERS; i++) { int r=255,g=255,b=255; bool blDrawInfo = false; cl_entity_t *pPlayer = gEngfuncs.GetEntityByIndex(i); // Invalid if(!pPlayer) { continue; } // Not player if(!pPlayer->player) { continue; } // Render check, make sure player is being rendered if(!g_RenderCheck[i].blRendered) { continue; } // Draw yourself as a orange dot if(pPlayer == pLocal) { r=255; g=255; b=0; } // Get Origins vecPlayerOrigin = pLocal->origin; vecOtherOrigin = pPlayer->origin; vecPlayerOrigin.z = 0; vecOtherOrigin.z = 0; vecDifference = vecPlayerOrigin - vecOtherOrigin; flLength = vecDifference.Length(); // Player is too far away, dont draw if(flLength > MAX_RADAR_DIST) continue; vecDifference = vecDifference.Normalize(); // Set 0 to 360 VectorAngles(vecDifference, vecAngles); flAngle = vecAngles.y; if(flAngle < 0) flAngle += 360; // Subtract Angles flAngle = flPlayerAngles - flAngle; // Set length according to the size of the radar flLength = (flLength/(float)MAX_RADAR_DIST) * RAD_DIAM; // Angles to radians flRadians = flAngle * PI_180; pos_x = int(cos(flRadians)*flLength); pos_y = int(sin(flRadians)*flLength); // Set positions + draw radar pos_x += x; pos_y += y; // Shift dot over so it's drawn in the correct position int iDotWidth = (gHUD.GetSpriteRect(m_HUD_radardot).right - gHUD.GetSpriteRect(m_HUD_radardot).left)/2; int iDotHeight = (gHUD.GetSpriteRect(m_HUD_radardot).bottom - gHUD.GetSpriteRect(m_HUD_radardot).top)/2; pos_x -= iDotWidth; pos_y -= iDotHeight; // Person is targeted by our missles, color them red if( gHUD.m_Lockon.FindLock( pPlayer->index ) != -1 ) { r=255; g=0; b=0; } // Yellow if our crosshair is/was over the player if( gHUD.m_Crosshair.m_iMouseOverEnt == pPlayer->index && ((flTime - gHUD.m_Crosshair.m_flMouseOverTime) < 3) ) { UnpackRGB(r,g,b, RGB_YELLOWISH); blDrawInfo = true; } // Draw SPR_Set(gHUD.GetSprite(m_HUD_radardot), r,g,b); SPR_DrawAdditive(0, pos_x,pos_y, &gHUD.GetSpriteRect(m_HUD_radardot)); // Draw information if specified if(blDrawInfo) { int line_height=0,line_width=0; pos_x = ScreenWidth - INFO_WIDTH + INFO_OFFSET_WIDTH; pos_y = iRadarHeight + INFO_OFFSET_HEIGHT; hud_player_info_t *pl_info = &g_PlayerInfoList[i]; char szName[128]; // Get colors float flTeamR,flTeamG,flTeamB; if((g_PlayerExtraInfo[i].teamnumber == g_PlayerExtraInfo[pLocal->index].teamnumber) && gHUD.m_Teamplay) { flTeamR=0; flTeamG=0.9; flTeamB=0; } else { flTeamR=1.0; flTeamG=0.2; flTeamB=0.2; } // Draw player name strcpy(szName,"Name: "); int iNameX = DrawConsoleString( pos_x, pos_y, szName ); // Draw name in color, depending if player is on your team strcpy(szName, pl_info->name); // Set color gEngfuncs.pfnDrawSetTextColor(flTeamR,flTeamG,flTeamB); // Draw DrawConsoleString( iNameX, pos_y, szName ); // Adjust offset GetConsoleStringSize( szName, &line_width, &line_height ); pos_y += line_height + INFO_OFFSET_LINE; // Draw Label strcpy(szName,"Mech: "); iNameX = DrawConsoleString( pos_x, pos_y, szName ); // Get Mech Name int iClass = g_PlayerExtraInfo[i].playerclass; if(iClass < 0) iClass = 0; else if(iClass >= PC_LASTCLASS) iClass = PC_LASTCLASS-1; strcpy(szName, szClassNames[iClass] ); // Set Color gEngfuncs.pfnDrawSetTextColor(flTeamR,flTeamG,flTeamB); // Draw Mech Name DrawConsoleString( iNameX, pos_y, szName ); } } return 1; }
int CHudDeathNotice :: Draw( float flTime ) { int x, y, r, g, b; for ( int i = 0; i < MAX_DEATHNOTICES; i++ ) { if ( rgDeathNoticeList[i].iId == 0 ) break; // we've gone through them all if ( rgDeathNoticeList[i].flDisplayTime < flTime ) { // display time has expired // remove the current item from the list memmove( &rgDeathNoticeList[i], &rgDeathNoticeList[i+1], sizeof(DeathNoticeItem) * (MAX_DEATHNOTICES - i) ); i--; // continue on the next item; stop the counter getting incremented continue; } rgDeathNoticeList[i].flDisplayTime = min( rgDeathNoticeList[i].flDisplayTime, gHUD.m_flTime + DEATHNOTICE_DISPLAY_TIME ); // Only draw if the viewport will let me if ( gViewPort && gViewPort->AllowedToPrintText() ) { // Draw the death notice //y = DEATHNOTICE_TOP + (20 * i); //!!! int theBaseY = DEATHNOTICE_TOP; // Bring down death messages when in top down or when we're drawing letter box if(gHUD.m_Spectator.IsInOverviewMode()) { // No HUD elements to compensate for } else if(gHUD.GetInTopDownMode()) { theBaseY = .10*ScreenHeight(); } else if(gHUD.GetIsMarine()) { theBaseY = .26*ScreenHeight(); } else if(gHUD.GetIsAlien()) { theBaseY = kHiveNormScreenY*ScreenHeight() + (kMaxHives-1)*((kHiveNormScreenHeight + kHiveNormScreenVerticalSpacing)*ScreenHeight()); } // Lower death messages more when spectating so they don't overlap (due to letterbox) if(g_iUser1 != OBS_NONE) { theBaseY += .06*ScreenHeight(); } y = theBaseY + (20 * i); //!!! int id = (rgDeathNoticeList[i].iId == -1) ? m_HUD_d_skull : rgDeathNoticeList[i].iId; x = ScreenWidth() - ConsoleStringLen(rgDeathNoticeList[i].szVictim) - (gHUD.GetSpriteRect(id).right - gHUD.GetSpriteRect(id).left); if ( !rgDeathNoticeList[i].iSuicide ) { x -= (5 + ConsoleStringLen( rgDeathNoticeList[i].szKiller ) ); // Draw killers name if ( rgDeathNoticeList[i].KillerColor ) DrawSetTextColor( rgDeathNoticeList[i].KillerColor[0], rgDeathNoticeList[i].KillerColor[1], rgDeathNoticeList[i].KillerColor[2] ); x = 5 + DrawConsoleString( x, y, rgDeathNoticeList[i].szKiller ); } r = 255; g = 80; b = 0; if ( rgDeathNoticeList[i].iTeamKill ) { r = 10; g = 240; b = 10; // display it in sickly green } // Draw death weapon SPR_Set( gHUD.GetSprite(id), r, g, b ); SPR_DrawAdditive( 0, x, y, &gHUD.GetSpriteRect(id) ); x += (gHUD.GetSpriteRect(id).right - gHUD.GetSpriteRect(id).left); // Draw victims name (if it was a player that was killed) if (rgDeathNoticeList[i].iNonPlayerKill == FALSE) { if ( rgDeathNoticeList[i].VictimColor ) DrawSetTextColor( rgDeathNoticeList[i].VictimColor[0], rgDeathNoticeList[i].VictimColor[1], rgDeathNoticeList[i].VictimColor[2] ); x = DrawConsoleString( x, y, rgDeathNoticeList[i].szVictim ); } } } return 1; }
//----------------------------------------------------------------------------- // Purpose: // Input : flTime - // intermission - //----------------------------------------------------------------------------- int CHudOverview::Draw(float flTime) { #if 0 // only draw in overview mode if (!gEngfuncs.Overview_GetOverviewState()) return 1; // make sure we have player info // gViewPort->GetAllPlayersInfo(); gHUD.m_Scoreboard.GetAllPlayersInfo(); // calculate player size on the overview int x1, y1, x2, y2; float v0[3]={0,0,0}, v1[3]={64,64,0}; gEngfuncs.Overview_WorldToScreen(v0, &x1, &y1); gEngfuncs.Overview_WorldToScreen(v1, &x2, &y2); float scale = abs(x2 - x1); // loop through all the players and draw them on the map for (int i = 1; i < MAX_PLAYERS; i++) { cl_entity_t *pl = gEngfuncs.GetEntityByIndex(i); if (pl && pl->player && pl->curstate.health > 0 && pl->curstate.solid != SOLID_NOT) { int x, y, z = 0; float v[3]={pl->origin[0], pl->origin[1], 0}; gEngfuncs.Overview_WorldToScreen(v, &x, &y); // hack in some team colors float r, g, bc; if (g_PlayerExtraInfo[i].teamnumber == 1) { r = 0.0f; g = 0.0f; bc = 1.0f; } else if (g_PlayerExtraInfo[i].teamnumber == 2) { r = 1.0f; g = 0.0f; bc = 0.0f; } else { // just use the default orange color if the team isn't set r = 1.0f; g = 0.7f; bc = 0.0f; } // set the current texture gEngfuncs.pTriAPI->SpriteTexture((struct model_s *)gEngfuncs.GetSpritePointer(m_hsprPlayer), 0); // additive render mode gEngfuncs.pTriAPI->RenderMode(kRenderTransAdd); // no culling gEngfuncs.pTriAPI->CullFace(TRI_NONE); // draw a square gEngfuncs.pTriAPI->Begin(TRI_QUADS); // set the color to be that of the team gEngfuncs.pTriAPI->Color4f(r, g, bc, 1.0f); // calculate rotational matrix vec3_t a, b, angles; float rmatrix[3][4]; // transformation matrix VectorCopy(pl->angles, angles); angles[0] = 0.0f; angles[1] += 90.f; angles[1] = -angles[1]; angles[2] = 0.0f; AngleMatrix(angles, rmatrix); a[2] = 0; a[0] = -scale; a[1] = -scale; VectorTransform(a, rmatrix , b ); gEngfuncs.pTriAPI->TexCoord2f( 0, 0 ); gEngfuncs.pTriAPI->Vertex3f(x + b[0], y + b[1], z); a[0]=-scale; a[1] = scale; VectorTransform(a, rmatrix , b ); gEngfuncs.pTriAPI->TexCoord2f( 0, 1 ); gEngfuncs.pTriAPI->Vertex3f (x + b[0], y + b[1], z); a[0]=scale; a[1] = scale; VectorTransform(a, rmatrix , b ); gEngfuncs.pTriAPI->TexCoord2f( 1, 1 ); gEngfuncs.pTriAPI->Vertex3f (x + b[0], y + b[1], z); a[0]=scale; a[1] = -scale; VectorTransform(a, rmatrix , b ); gEngfuncs.pTriAPI->TexCoord2f( 1, 0 ); gEngfuncs.pTriAPI->Vertex3f (x + b[0], y + b[1], z); // finish up gEngfuncs.pTriAPI->End(); gEngfuncs.pTriAPI->RenderMode( kRenderNormal ); // draw the players name and health underneath char string[256]; sprintf(string, "%s (%i%%)", g_PlayerInfoList[i].name, pl->curstate.health); DrawConsoleString(x, y + (1.1 * scale), string); } } #endif return 1; }