Guest User

Untitled

a guest
Jan 22nd, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.96 KB | None | 0 0
  1. void SCR_HUD_DrawGunByNum (hud_t *hud, int num, float scale, int style, int wide)
  2. {
  3.     extern mpic_t *sb_weapons[7][8];  // sbar.c
  4.     int i = num - 2;
  5.     int width, height;
  6.     int x, y;
  7.     char *tmp;
  8.  
  9.     scale = max(scale, 0.01);
  10.  
  11.     switch (style)
  12.     {
  13.  
  14.         if (!HUD_PrepareDraw(hud, width, height, &x, &y))
  15.             return;
  16.         if ( HUD_Stats(STAT_ITEMS) & (IT_SHOTGUN<<i) )
  17.         {
  18.  
  19.         case 3:
  20.         case 1:     // text
  21.             width = 16 * scale;
  22.             height = 8 * scale;
  23.        
  24.             switch (num)
  25.              {
  26.              case 2: tmp = "sg"; break;
  27.              case 3: tmp = "bs"; break;
  28.              case 4: tmp = "ng"; break;
  29.              case 5: tmp = "sn"; break;
  30.              case 6: tmp = "gl"; break;
  31.              case 7: tmp = "rl"; break;
  32.              case 8: tmp = "lg"; break;
  33.              default: tmp = "";
  34.              }
  35.  
  36.                 if ( ((HUD_Stats(STAT_ACTIVEWEAPON) == (IT_SHOTGUN<<i)) && (style==1)) ||
  37.                      ((HUD_Stats(STAT_ACTIVEWEAPON) != (IT_SHOTGUN<<i)) && (style==3))
  38.                    )
  39.                     Draw_SString(x, y, tmp, scale);
  40.                 else
  41.                     Draw_SAlt_String(x, y, tmp, scale);
  42.         break;
  43.         case 4:
  44.         case 2:     // numbers
  45.             width = 8 * scale;
  46.             height = 8 * scale;
  47.        
  48.             if ( HUD_Stats(STAT_ACTIVEWEAPON) == (IT_SHOTGUN<<i) )
  49.                 num += '0' + (style == 4 ? 128 : 0);
  50.             else
  51.                 num += '0' + (style == 4 ? 0 : 128);
  52.                 Draw_SCharacter(x, y, num, scale);
  53.             break;
  54.         default:    // classic - pictures
  55.             width  = scale * (wide ? 48 : 24);
  56.             height = scale * 16;
  57.  
  58.             float   time;
  59.             int     flashon;
  60.  
  61.             time = cl.item_gettime[i];
  62.             flashon = (int)((cl.time - time)*10);
  63.             if (flashon < 0)
  64.                 flashon = 0;
  65.             if (flashon >= 10)
  66.             {
  67.                 if ( HUD_Stats(STAT_ACTIVEWEAPON) == (IT_SHOTGUN<<i) )
  68.                     flashon = 1;
  69.                 else
  70.                     flashon = 0;
  71.             }
  72.             else
  73.                 flashon = (flashon%5) + 2;
  74.  
  75.             if (wide  ||  num != 8)
  76.                 Draw_SPic (x, y, sb_weapons[flashon][i], scale);
  77.             else
  78.                 Draw_SSubPic (x, y, sb_weapons[flashon][i], 0, 0, 24, 16, scale);
  79.  
  80.             break;
  81.     }
  82. }
Add Comment
Please, Sign In to add comment