]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into terencehill/itemstime
authorMario <zacjardine@y7mail.com>
Tue, 11 Aug 2015 16:28:36 +0000 (02:28 +1000)
committerMario <zacjardine@y7mail.com>
Tue, 11 Aug 2015 16:28:36 +0000 (02:28 +1000)
# Conflicts:
# qcsrc/client/hud.qc
# qcsrc/client/hud_config.qc
# qcsrc/common/stats.qh
# qcsrc/menu/xonotic/mainwindow.qc
# qcsrc/server/autocvars.qh

17 files changed:
1  2 
_hud_descriptions.cfg
hud_luma.cfg
hud_luminos.cfg
hud_luminos_minimal.cfg
hud_luminos_minimal_xhair.cfg
hud_luminos_old.cfg
hud_nexuiz.cfg
qcsrc/client/autocvars.qh
qcsrc/client/hud.qc
qcsrc/client/hud.qh
qcsrc/client/hud_config.qc
qcsrc/common/constants.qh
qcsrc/common/stats.qh
qcsrc/menu/classes.inc
qcsrc/menu/xonotic/mainwindow.qc
qcsrc/server/autocvars.qh
qcsrc/server/cl_client.qc

Simple merge
diff --cc hud_luma.cfg
Simple merge
diff --cc hud_luminos.cfg
Simple merge
Simple merge
Simple merge
Simple merge
diff --cc hud_nexuiz.cfg
Simple merge
Simple merge
index 55de7b7f5a467e5427a185564dd3dd3609fe31f6,9019afc18f37f7e3531c94c58962d212c789f113..c422892ea3cb0baea1593245a19eb9477f9a980b
@@@ -4582,311 -4604,6 +4604,252 @@@ void HUD_CenterPrint (void
        }
  }
  
- // Buffs (#18)
- //
- void HUD_Buffs(void)
- {
-       if(intermission == 2) return;
-       int buffs = getstati(STAT_BUFFS, 0, 24);
-       if(!autocvar__hud_configure)
-       {
-               if(!autocvar_hud_panel_buffs) return;
-               if(spectatee_status == -1) return;
-               if(getstati(STAT_HEALTH) <= 0) return;
-               if(!buffs) return;
-       }
-       else
-       {
-               buffs = Buff_Type_first.items; // force first buff
-       }
-       int b = 0; // counter to tell other functions that we have buffs
-       entity e;
-       string s = "";
-       for(e = Buff_Type_first; e; e = e.enemy) if(buffs & e.items)
-       {
-               ++b;
-               string o = strcat(rgb_to_hexcolor(Buff_Color(e.items)), Buff_PrettyName(e.items));
-               if(s == "")
-                       s = o;
-               else
-                       s = strcat(s, " ", o);
-       }
-       HUD_Panel_UpdateCvars();
-       draw_beginBoldFont();
-       vector pos, mySize;
-       pos = panel_pos;
-       mySize = panel_size;
-       HUD_Panel_DrawBg(bound(0, b, 1));
-       if(panel_bg_padding)
-       {
-               pos += '1 1 0' * panel_bg_padding;
-               mySize -= '2 2 0' * panel_bg_padding;
-       }
-       //float panel_ar = mySize_x/mySize_y;
-       //bool is_vertical = (panel_ar < 1);
-       //float buff_iconalign = autocvar_hud_panel_buffs_iconalign;
-       vector buff_offset = '0 0 0';
-       for(e = Buff_Type_first; e; e = e.enemy) if(buffs & e.items)
-       {
-               //DrawNumIcon(pos + buff_offset, mySize, shield, "shield", is_vertical, buff_iconalign, '1 1 1', 1);
-               drawcolorcodedstring_aspect(pos + buff_offset, s, mySize, panel_fg_alpha * 0.5, DRAWFLAG_NORMAL);
-       }
-       draw_endBoldFont();
- }
 +// ItemsTime (#XX)
 +//
 +const float ITEMSTIME_MAXITEMS = 10;
 +float ItemsTime_time[ITEMSTIME_MAXITEMS];
 +float ItemsTime_availableTime[ITEMSTIME_MAXITEMS];
 +string GetItemsTimePicture(float i)
 +{
 +      switch(i)
 +      {
 +              case 0: return "item_large_armor";
 +              case 1: return "item_mega_health";
 +              case 2: return "item_strength";
 +              case 3: return "item_shield";
 +              case 4: return "item_mega_health";
 +              case 5: return "item_strength";
 +              case 6: return "item_shield";
 +              case 7: return "fuelregen";
 +              case 8: return "jetpack";
 +              case 9: return "superweapons";
 +              default: return "";
 +      }
 +}
 +
 +void DrawItemsTimeItem(vector myPos, vector mySize, float ar, float itemcode, float item_time, bool item_available, float item_availableTime)
 +{
 +      float t = 0;
 +      vector color = '0 0 0';
 +      float picalpha;
 +
 +      if(autocvar_hud_panel_itemstime_hidespawned == 2)
 +              picalpha = 1;
 +      else if(item_available)
 +      {
 +              float BLINK_FACTOR = 0.15;
 +              float BLINK_BASE = 0.85;
 +              float BLINK_FREQ = 5;
 +              picalpha = BLINK_BASE + BLINK_FACTOR * cos(time * BLINK_FREQ);
 +      }
 +      else
 +              picalpha = 0.3;
 +      t = floor(item_time - time + 0.999);
 +      if(t < 5)
 +              color = '0.7 0 0';
 +      else if(t < 10)
 +              color = '0.7 0.7 0';
 +      else
 +              color = '1 1 1';
 +
 +      vector picpos, numpos;
 +      if(autocvar_hud_panel_itemstime_iconalign)
 +      {
 +              numpos = myPos;
 +              picpos = myPos + eX * (ar - 1) * mySize_y;
 +      }
 +      else
 +      {
 +              numpos = myPos + eX * mySize_y;
 +              picpos = myPos;
 +      }
 +
 +      if(t > 0 && autocvar_hud_panel_itemstime_progressbar)
 +      {
 +              vector p_pos, p_size;
 +              if(autocvar_hud_panel_itemstime_progressbar_reduced)
 +              {
 +                      p_pos = numpos;
 +                      p_size = eX * ((ar - 1)/ar) * mySize_x + eY * mySize_y;
 +              }
 +              else
 +              {
 +                      p_pos = myPos;
 +                      p_size = mySize;
 +              }
 +              HUD_Panel_DrawProgressBar(p_pos, p_size, autocvar_hud_panel_itemstime_progressbar_name, t/autocvar_hud_panel_itemstime_progressbar_maxtime, 0, autocvar_hud_panel_itemstime_iconalign, color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
 +      }
 +
 +      if(t > 0 && autocvar_hud_panel_itemstime_text)
 +              drawstring_aspect(numpos, ftos(t), eX * ((ar - 1)/ar) * mySize_x + eY * mySize_y, color, panel_fg_alpha, DRAWFLAG_NORMAL);
 +      else
 +              picpos.x = myPos.x + mySize.x / 2 - mySize.y / 2;
 +      if(item_availableTime)
 +              drawpic_aspect_skin_expanding(picpos, GetItemsTimePicture(itemcode), '1 1 0' * mySize_y, '1 1 1', panel_fg_alpha * picalpha, DRAWFLAG_NORMAL, item_availableTime);
 +      drawpic_aspect_skin(picpos, GetItemsTimePicture(itemcode), '1 1 0' * mySize_y, '1 1 1', panel_fg_alpha * picalpha, DRAWFLAG_NORMAL);
 +}
 +
 +void HUD_ItemsTime(void)
 +{
 +      if(!autocvar__hud_configure)
 +      {
 +              if(!(
 +                      (autocvar_hud_panel_itemstime == 1 && spectatee_status != 0)
 +              ||      (autocvar_hud_panel_itemstime == 2 && (spectatee_status != 0 || warmup_stage))
 +                      )) { return; }
 +
 +              ItemsTime_time[0] = getstatf(STAT_ARMOR_LARGE_TIME);
 +              ItemsTime_time[1] = getstatf(STAT_HEALTH_MEGA_TIME);
 +              ItemsTime_time[2] = getstatf(STAT_INVISIBLE_TIME);
 +              ItemsTime_time[3] = getstatf(STAT_SPEED_TIME);
 +              ItemsTime_time[4] = getstatf(STAT_EXTRALIFE_TIME);
 +              ItemsTime_time[5] = getstatf(STAT_STRENGTH_TIME);
 +              ItemsTime_time[6] = getstatf(STAT_SHIELD_TIME);
 +              ItemsTime_time[7] = getstatf(STAT_FUELREGEN_TIME);
 +              ItemsTime_time[8] = getstatf(STAT_JETPACK_TIME);
 +              ItemsTime_time[9] = getstatf(STAT_SUPERWEAPONS_TIME);
 +      }
 +      else
 +      {
 +              // do not show here mutator-dependent items
 +              ItemsTime_time[0] = time + 0;
 +              ItemsTime_time[1] = time + 8;
 +              ItemsTime_time[2] = -1; // mutator-dependent
 +              ItemsTime_time[3] = -1; // mutator-dependent
 +              ItemsTime_time[4] = -1; // mutator-dependent
 +              ItemsTime_time[5] = time + 0;
 +              ItemsTime_time[6] = time + 4;
 +              ItemsTime_time[7] = time + 49;
 +              ItemsTime_time[8] = -1;
 +              ItemsTime_time[9] = time + 28;
 +      }
 +
 +      float i;
 +      float count = 0;
 +      if(autocvar_hud_panel_itemstime_hidespawned == 1)
 +              for (i = 0; i < ITEMSTIME_MAXITEMS; ++i)
 +                      count += (ItemsTime_time[i] > time || -ItemsTime_time[i] > time);
 +      else if(autocvar_hud_panel_itemstime_hidespawned == 2)
 +              for (i = 0; i < ITEMSTIME_MAXITEMS; ++i)
 +                      count += (ItemsTime_time[i] > time);
 +      else
 +              for (i = 0; i < ITEMSTIME_MAXITEMS; ++i)
 +                      count += (ItemsTime_time[i] != -1);
 +      if (count == 0)
 +              return;
 +
 +      HUD_Panel_UpdateCvars();
 +
 +      vector pos, mySize;
 +      pos = panel_pos;
 +      mySize = panel_size;
 +
 +      if(panel_bg_padding)
 +      {
 +              pos += '1 1 0' * panel_bg_padding;
 +              mySize -= '2 2 0' * panel_bg_padding;
 +      }
 +
 +      float rows, columns;
 +      float ar = max(2, autocvar_hud_panel_itemstime_ratio) + 1;
 +      rows = HUD_GetRowCount(count, mySize, ar);
 +      columns = ceil(count/rows);
 +
 +      vector itemstime_size = eX * mySize.x*(1/columns) + eY * mySize.y*(1/rows);
 +
 +      vector offset = '0 0 0';
 +      float newSize;
 +      if(autocvar_hud_panel_itemstime_dynamicsize)
 +      {
 +              if(autocvar__hud_configure)
 +              if(menu_enabled != 2)
 +                      HUD_Panel_DrawBg(1); // also draw the bg of the entire panel
 +
 +              // reduce panel to avoid spacing items
 +              if(itemstime_size.x / itemstime_size.y < ar)
 +              {
 +                      newSize = rows * itemstime_size.x / ar;
 +                      pos.y += (mySize.y - newSize) / 2;
 +                      mySize.y = newSize;
 +                      itemstime_size.y = mySize.y / rows;
 +              }
 +              else
 +              {
 +                      newSize = columns * itemstime_size.y * ar;
 +                      pos.x += (mySize.x - newSize) / 2;
 +                      mySize.x = newSize;
 +                      itemstime_size.x = mySize.x / columns;
 +              }
 +              panel_pos = pos - '1 1 0' * panel_bg_padding;
 +              panel_size = mySize + '2 2 0' * panel_bg_padding;
 +      }
 +      else
 +      {
 +              if(itemstime_size.x/itemstime_size.y > ar)
 +              {
 +                      newSize = ar * itemstime_size.y;
 +                      offset.x = itemstime_size.x - newSize;
 +                      pos.x += offset.x/2;
 +                      itemstime_size.x = newSize;
 +              }
 +              else
 +              {
 +                      newSize = 1/ar * itemstime_size.x;
 +                      offset.y = itemstime_size.y - newSize;
 +                      pos.y += offset.y/2;
 +                      itemstime_size.y = newSize;
 +              }
 +      }
 +
 +      HUD_Panel_DrawBg(1);
 +
 +      float row = 0, column = 0;
 +      bool item_available;
 +      for (i = 0; i < ITEMSTIME_MAXITEMS; ++i) {
 +              if (ItemsTime_time[i] == -1)
 +                      continue;
 +
 +              float item_time = ItemsTime_time[i];
 +              if(item_time < -1)
 +              {
 +                      item_available = true;
 +                      item_time = -item_time;
 +              }
 +              else
 +                      item_available = (item_time <= time);
 +
 +              if(ItemsTime_time[i] >= 0)
 +              {
 +                      if(time <= ItemsTime_time[i])
 +                              ItemsTime_availableTime[i] = 0;
 +                      else if(ItemsTime_availableTime[i] == 0)
 +                              ItemsTime_availableTime[i] = time;
 +              }
 +              else if(ItemsTime_availableTime[i] == 0)
 +                      ItemsTime_availableTime[i] = time;
 +
 +              float f = (time - ItemsTime_availableTime[i]) * 2;
 +              f = (f > 1) ? 0 : bound(0, f, 1);
 +
 +              if(autocvar_hud_panel_itemstime_hidespawned == 1)
 +                      if(!(ItemsTime_time[i] > time || -ItemsTime_time[i] > time))
 +                              continue;
 +
 +              if(autocvar_hud_panel_itemstime_hidespawned == 2)
 +                      if(!(ItemsTime_time[i] > time))
 +                              continue;
 +
 +              DrawItemsTimeItem(pos + eX * column * (itemstime_size.x + offset.x) + eY * row * (itemstime_size.y + offset.y), itemstime_size, ar, i, item_time, item_available, f);
 +              ++row;
 +              if(row >= rows)
 +              {
 +                      row = 0;
 +                      column = column + 1;
 +              }
 +      }
 +}
 +
++
  /*
  ==================
  Main HUD system
index 0bd85defc4631be66347671053794e1307ad8522,894066028f624dfe06b4c49dd2b7c259f3700a12..72e3326429eb7662feca88680ec696d5287494d4
@@@ -142,27 -142,25 +142,26 @@@ float old_p_healthtime, old_p_armortime
  int prev_p_health, prev_p_armor;
  
  
- #define HUD_PANELS(HUD_PANEL)                                                                                                                                                                                 \
-       HUD_PANEL(WEAPONS      , HUD_Weapons      , weapons)                                                                                                                    \
-       HUD_PANEL(AMMO         , HUD_Ammo         , ammo)                                                                                                                               \
-       HUD_PANEL(POWERUPS     , HUD_Powerups     , powerups)                                                                                                                   \
-       HUD_PANEL(HEALTHARMOR  , HUD_HealthArmor  , healtharmor)                                                                                                                \
-       HUD_PANEL(NOTIFY       , HUD_Notify       , notify)                                                                                                                     \
-       HUD_PANEL(TIMER        , HUD_Timer        , timer)                                                                                                                              \
-       HUD_PANEL(RADAR        , HUD_Radar        , radar)                                                                                                                              \
-       HUD_PANEL(SCORE        , HUD_Score        , score)                                                                                                                              \
-       HUD_PANEL(RACETIMER    , HUD_RaceTimer    , racetimer)                                                                                                                  \
-       HUD_PANEL(VOTE         , HUD_Vote         , vote)                                                                                                                               \
-       HUD_PANEL(MODICONS     , HUD_ModIcons     , modicons)                                                                                                                   \
-       HUD_PANEL(PRESSEDKEYS  , HUD_PressedKeys  , pressedkeys)                                                                                                                \
-       HUD_PANEL(CHAT         , HUD_Chat         , chat)                                                                                                                               \
-       HUD_PANEL(ENGINEINFO   , HUD_EngineInfo   , engineinfo)                                                                                                                 \
-       HUD_PANEL(INFOMESSAGES , HUD_InfoMessages , infomessages)                                                                                                               \
-       HUD_PANEL(PHYSICS      , HUD_Physics      , physics)                                                                                                                    \
-       HUD_PANEL(CENTERPRINT  , HUD_CenterPrint  , centerprint)                                                                                                                \
-       HUD_PANEL(BUFFS        , HUD_Buffs        , buffs) \
+ #define HUD_PANELS(HUD_PANEL) \
+       HUD_PANEL(WEAPONS      , HUD_Weapons      , weapons) \
+       HUD_PANEL(AMMO         , HUD_Ammo         , ammo) \
+       HUD_PANEL(POWERUPS     , HUD_Powerups     , powerups) \
+       HUD_PANEL(HEALTHARMOR  , HUD_HealthArmor  , healtharmor) \
+       HUD_PANEL(NOTIFY       , HUD_Notify       , notify) \
+       HUD_PANEL(TIMER        , HUD_Timer        , timer) \
+       HUD_PANEL(RADAR        , HUD_Radar        , radar) \
+       HUD_PANEL(SCORE        , HUD_Score        , score) \
+       HUD_PANEL(RACETIMER    , HUD_RaceTimer    , racetimer) \
+       HUD_PANEL(VOTE         , HUD_Vote         , vote) \
+       HUD_PANEL(MODICONS     , HUD_ModIcons     , modicons) \
+       HUD_PANEL(PRESSEDKEYS  , HUD_PressedKeys  , pressedkeys) \
+       HUD_PANEL(CHAT         , HUD_Chat         , chat) \
+       HUD_PANEL(ENGINEINFO   , HUD_EngineInfo   , engineinfo) \
+       HUD_PANEL(INFOMESSAGES , HUD_InfoMessages , infomessages) \
+       HUD_PANEL(PHYSICS      , HUD_Physics      , physics) \
+       HUD_PANEL(CENTERPRINT  , HUD_CenterPrint  , centerprint) \
        HUD_PANEL(MAPVOTE      , MapVote_Draw     , mapvote) \
 +      HUD_PANEL(ITEMSTIME    , HUD_ItemsTime    , itemstime) \
        // always add new panels to the end of list
  
  #define HUD_PANEL(NAME, draw_func, name)                                                                                                                                                      \
Simple merge
Simple merge
index 7c915696d7f098a829cad61a803b8badfe5d6b3f,f6faf634dbee88605a24d69c51059a90b61cedd1..eb6b0ea9704c67fadbe0c65fccf0901e903b9c04
@@@ -170,11 -170,11 +170,11 @@@ const int STAT_PL_CROUCH_MAX3         
  const int STAT_PL_CROUCH_VIEW_OFS1    = 117;
  const int STAT_PL_CROUCH_VIEW_OFS2    = 118;
  const int STAT_PL_CROUCH_VIEW_OFS3    = 119;
 -// 120 empty?
 -// 121 empty?
 -// 122 empty?
 -// 123 empty?
 -// 124 empty?
 +const int STAT_WEAPONSINMAP           = 120;
 +const int STAT_WEAPONSINMAP2          = 121;
 +const int STAT_WEAPONSINMAP3          = 122;
- const int STAT_CTF_FLAGSTATUS         = 123;
- // 124 empty?
++const int STAT_BUFF_TIME              = 123;
++const int STAT_CTF_FLAGSTATUS         = 124;
  // 125 empty?
  // 126 empty?
  // 127 empty?
Simple merge
index 2a4635a4089533f0819f372fee73f75095f4ce78,a3e0727fba82705658d4ef62caf2d91c6cef5eaf..4ca94c9b0236bd3f2ad6b71fa715eb9f717e01d1
@@@ -128,15 -128,7 +128,10 @@@ void MainWindow_configureMainWindow(ent
        i.configureDialog(i);
        me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
  
-       i = NEW(XonoticHUDBuffsDialog);
-       i.configureDialog(i);
-       me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
 +      i = NEW(XonoticHUDItemsTimeDialog);
 +      i.configureDialog(i);
 +      me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
  
        // dialogs used by settings
        me.userbindEditDialog = i = NEW(XonoticUserbindEditDialog);
        i.configureDialog(i);
index 758fbe1d2956439c9cd7d56270a84451e715f54e,5e1c01a11b9b1f6239bb67c233e44efdc0817a8f..0b6d044753c6cc2e8004ef157287837daf21c16e
@@@ -625,10 -625,9 +625,10 @@@ float autocvar_sv_gameplayfix_q2airacce
  int autocvar_sv_gentle;
  #define autocvar_sv_gravity cvar("sv_gravity")
  string autocvar_sv_intermission_cdtrack;
- float autocvar_sv_jumpspeedcap_max;
 +float autocvar_sv_itemstime;
+ string autocvar_sv_jumpspeedcap_max;
  float autocvar_sv_jumpspeedcap_max_disable_on_ramps;
float autocvar_sv_jumpspeedcap_min;
string autocvar_sv_jumpspeedcap_min;
  float autocvar_sv_jumpvelocity;
  bool autocvar_sv_logscores_bots;
  bool autocvar_sv_logscores_console;
Simple merge