Advertisement
Guest User

Untitled

a guest
Nov 5th, 2011
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.77 KB | None | 0 0
  1. static void CG_DrawPlayerEvoFraction( rectDef_t *rect )
  2. {
  3.  float evos;
  4.  int index;
  5.  vec4_t color = {0.0f,0.0f,0.0f,1.0f};
  6.  
  7.  evos = cg.snap->ps.persistant[PERS_CREDIT]/EVOPOINT_VALUE;  
  8.  index = (int)floor( (evos-floor(evos))*9.0 ) - 1;
  9.  if (index==-1)
  10.   return; //no fraction
  11.  
  12.  if( index > 7 )
  13.   index = 7;
  14.  else if( index < 0 )
  15.   index = 0;
  16.  
  17.  color[0]=(evos-floor(evos))/2.0f+0.5f;
  18.  trap_R_SetColor( color );
  19.  CG_DrawPic( rect->x, rect->y, rect->w, rect->h, cgs.media.buildWeaponTimerPie[ index ] );
  20.  trap_R_SetColor( NULL );
  21. }
  22.  
  23.  
  24. static void CG_DrawPlayerCreditsValue( rectDef_t *rect, vec4_t color, qboolean padding )
  25. {
  26.   int           value;
  27.   playerState_t *ps;
  28.   centity_t     *cent;
  29.   float         woffs, hoffs;
  30.   rectDef_t     rect2;
  31.  
  32.   cent = &cg_entities[ cg.snap->ps.clientNum ];
  33.   ps = &cg.snap->ps;
  34.  
  35.   //if the build timer pie is showing don't show this
  36.   if( ( cent->currentState.weapon == WP_ABUILD ||
  37.       cent->currentState.weapon == WP_ABUILD2 ) && ps->stats[ STAT_MISC ] )
  38.     return;
  39.  
  40.   value = ps->persistant[ PERS_CREDIT ];
  41.  
  42.   if( value > -1 )
  43.   {
  44.     if( cg.predictedPlayerState.stats[ STAT_PTEAM ] == PTE_ALIENS &&
  45.         !CG_AtHighestClass( ) )
  46.     {
  47.       if( cg.time - cg.lastEvolveAttempt <= NO_CREDITS_TIME )
  48.       {
  49.         if( ( ( cg.time - cg.lastEvolveAttempt ) / 300 ) % 2 )
  50.           color[ 3 ] = 0.0f;
  51.       }
  52.     }
  53.    
  54.    if ( cg.predictedPlayerState.stats[ STAT_PTEAM ] == PTE_ALIENS)
  55.    {
  56.     value /= EVOPOINT_VALUE;
  57.     CG_DrawPlayerEvoFraction(rect);
  58.    }
  59.  
  60.     trap_R_SetColor( color );
  61.  
  62.     if( padding )
  63.       CG_DrawFieldPadded( rect->x, rect->y, 4, rect->w / 4, rect->h, value );
  64.     else
  65.       CG_DrawField( rect->x, rect->y, 1, rect->w, rect->h, value );
  66.  
  67.     trap_R_SetColor( NULL );
  68.   }
  69. }
  70.  
  71.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement