]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into Mario/sound_model_paths
authorMario <zacjardine@y7mail.com>
Mon, 24 Aug 2015 06:20:09 +0000 (16:20 +1000)
committerMario <zacjardine@y7mail.com>
Mon, 24 Aug 2015 06:20:09 +0000 (16:20 +1000)
# Conflicts:
# qcsrc/common/items/item/powerup.qc

25 files changed:
qcsrc/client/hud.qc
qcsrc/client/hud.qh
qcsrc/client/main.qc
qcsrc/client/mutators/events.qh
qcsrc/client/waypointsprites.qc
qcsrc/common/constants.qh
qcsrc/common/items/item.qh
qcsrc/common/items/item/armor.qc
qcsrc/common/items/item/health.qc
qcsrc/common/items/item/jetpack.qc
qcsrc/common/items/item/powerup.qc
qcsrc/common/mutators/all.inc
qcsrc/common/mutators/mutator/itemstime.qc [new file with mode: 0644]
qcsrc/common/mutators/mutator/waypointsprites.qc [new file with mode: 0644]
qcsrc/common/stats.qh
qcsrc/dpdefs/csprogsdefs.qh
qcsrc/dpdefs/progsdefs.qh
qcsrc/server/cl_client.qc
qcsrc/server/command/vote.qc
qcsrc/server/defs.qh
qcsrc/server/g_world.qc
qcsrc/server/mutators/mutator_superspec.qc
qcsrc/server/t_items.qc
qcsrc/server/t_items.qh
qcsrc/server/waypointsprites.qc

index cfa00a1affafcc0184ee11ff20f5aebaa4b7e400..3482a62bf06faf9cb266cccb9efcd55046463198 100644 (file)
@@ -4813,251 +4813,6 @@ void HUD_CenterPrint (void)
        }
 }
 
-// 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 "strength";
-               case 3: return "shield";
-               case 4: return "item_mega_health";
-               case 5: return "strength";
-               case 6: return "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.5;
-       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;
-               }
-       }
-}
-
 
 /*
 ==================
index 8a2f76ded479e0cc2427e32d690b844235f8d1a7..ee8ca1c687a9377e931be117f4aae7679bbaf56d 100644 (file)
@@ -146,6 +146,7 @@ float old_p_healthtime, old_p_armortime;
 // set to -1 to forcedly stop effects when we switch spectated player (e.g. from playerX: 70h to playerY: 50h)
 int prev_p_health, prev_p_armor;
 
+void HUD_ItemsTime();
 
 #define HUD_PANELS(HUD_PANEL) \
        HUD_PANEL(WEAPONS      , HUD_Weapons      , weapons) \
index 9e7b8bd6859d51680edd513216a03eddf6e677dc..e39b3346a354ec5fc5b7f1d80a6c3cc9286f1670 100644 (file)
@@ -845,6 +845,12 @@ void CSQC_Ent_Update(float bIsNewEntity)
        self.enttype = t;
        switch(t)
        {
+               case ENT_CLIENT_MUTATOR: {
+                       int mutID = ReadMutator();
+                       if (!MUTATOR_CALLHOOK(CSQC_Ent_Update, mutID, bIsNewEntity))
+                       error(sprintf("Unknown mutator type in CSQC_Ent_Update (mutID: %d, edict: %d, classname: %s)\n", mutID, num_for_edict(self), self.classname));
+                       break;
+               }
                case ENT_CLIENT_ENTCS: Ent_ReadEntCS(); break;
                case ENT_CLIENT_SCORES: Ent_ReadPlayerScore(); break;
                case ENT_CLIENT_TEAMSCORES: Ent_ReadTeamScore(); break;
@@ -853,7 +859,6 @@ void CSQC_Ent_Update(float bIsNewEntity)
                case ENT_CLIENT_LASER: Ent_Laser(); break;
                case ENT_CLIENT_NAGGER: Ent_Nagger(); break;
                case ENT_CLIENT_ELIMINATEDPLAYERS: Ent_EliminatedPlayers(); break;
-               case ENT_CLIENT_WAYPOINT: Ent_WaypointSprite(); break;
                case ENT_CLIENT_RADARLINK: Ent_RadarLink(); break;
                case ENT_CLIENT_PROJECTILE: Ent_Projectile(); break;
                case ENT_CLIENT_GIBSPLASH: Ent_GibSplash(bIsNewEntity); break;
index 893765a7e1f85e322e768c73055183079b68d102..16ae922f220ba774fb3dfdc892eb411de9b89da1 100644 (file)
@@ -45,10 +45,22 @@ MUTATOR_HOOKABLE(UpdateCrosshair, EV_NO_ARGS);
  * NOTE: return true if you handled the command, return false to continue handling
  */
 #define EV_CSQC_Parse_TempEntity(i, o) \
-    /** entity id */ i(int, mutator_argv_int_0) \
+    /** mutator id */ i(int, mutator_argv_int_0) \
     /**/
 MUTATOR_HOOKABLE(CSQC_Parse_TempEntity, EV_CSQC_Parse_TempEntity);
 
+/**
+ * Called when a shared entity is updated
+ * NOTE: hooks MUST start with `if (MUTATOR_RETURNVALUE) return false;`
+ * NOTE: hooks MUST start with `if (!ReadMutatorEquals(mutator_argv_int_0, name_of_mutator)) return false;`
+ * NOTE: return true if you handled the command, return false to continue handling
+ */
+#define EV_CSQC_Ent_Update(i, o) \
+    /** mutator id */ i(int, mutator_argv_int_0) \
+    /** bIsNewEntity */ i(bool, mutator_argv_bool_0) \
+    /**/
+MUTATOR_HOOKABLE(CSQC_Ent_Update, EV_CSQC_Ent_Update);
+
 /** Called when a projectile is linked with CSQC */
 #define EV_Ent_Projectile(i, o) \
     /** entity id */ i(entity, self) \
index 40fc56a413d49d2417638b4a9a7c20f431ff698e..aa5ec5fae0aed7a8c0dada8264ab6a305a1ff207 100644 (file)
@@ -170,19 +170,17 @@ float spritelookupblinkvalue(string s)
        if(get_weaponinfo(stof(substring(s, 4, strlen(s)))).spawnflags & WEP_FLAG_SUPERWEAPON)
                return 2;
 
+       FOREACH(ITEMS, it.m_waypoint == s, LAMBDA(
+               return it.m_waypointblink;
+       ));
+
        switch(s)
        {
                case "ons-cp-atck":      return 2;
                case "ons-cp-dfnd":      return 0.5;
-               case "item_health_mega": return 2;
-               case "item_armor_large": return 2;
                case "item-invis":       return 2;
                case "item-extralife":   return 2;
                case "item-speed":       return 2;
-               case "item-strength":    return 2;
-               case "item-shield":      return 2;
-               case "item-fuelregen":   return 2;
-               case "item-jetpack":     return 2;
                case "tagged-target":    return 2;
                default:                 return 1;
        }
@@ -253,15 +251,9 @@ string spritelookuptext(string s)
                case "dom-blue": return _("Control point");
                case "dom-yellow": return _("Control point");
                case "dom-pink": return _("Control point");
-               case "item_health_mega": return _("Mega health");
-               case "item_armor_large": return _("Large armor");
                case "item-invis": return _("Invisibility");
                case "item-extralife": return _("Extra life");
                case "item-speed": return _("Speed");
-               case "item-strength": return _("Strength");
-               case "item-shield": return _("Shield");
-               case "item-fuelregen": return _("Fuel regen");
-               case "item-jetpack": return _("Jet Pack");
                case "frozen": return _("Frozen!");
                case "tagged-target": return _("Tagged");
                case "vehicle": return _("Vehicle");
@@ -599,6 +591,7 @@ void Ent_RemoveWaypointSprite()
                strunzone(self.netname3);
 }
 
+/** flags origin [team displayrule] [spritename] [spritename2] [spritename3] [lifetime maxdistance hideable] */
 void Ent_WaypointSprite()
 {
        int sendflags, f, t;
index 1e77197f6f62cd731fd6438924c1c91ed3d3dcfa..7de2a888322d72b6ac3eb693b7852ef0d5138607 100644 (file)
@@ -79,7 +79,6 @@ const int ENT_CLIENT_POINTPARTICLES = 6;
 const int ENT_CLIENT_RAINSNOW = 7;
 const int ENT_CLIENT_LASER = 8;
 const int ENT_CLIENT_NAGGER = 9; // flags [votecalledvote]
-const int ENT_CLIENT_WAYPOINT = 10; // flags origin [team displayrule] [spritename] [spritename2] [spritename3] [lifetime maxdistance hideable]
 const int ENT_CLIENT_RADARLINK = 11; // flags [startorigin] [endorigin] [startcolor+16*endcolor]
 const int ENT_CLIENT_PROJECTILE = 12;
 const int ENT_CLIENT_GIBSPLASH = 13;
@@ -131,6 +130,8 @@ const int ENT_CLIENT_VIEWLOC_TRIGGER = 79;
 
 const int ENT_CLIENT_HEALING_ORB = 80;
 
+const int ENT_CLIENT_MUTATOR = TE_CSQC_MUTATOR; // 99
+
 const int SPRITERULE_DEFAULT = 0;
 const int SPRITERULE_TEAMPLAY = 1;
 const int SPRITERULE_SPECTATOR = 2;
index 16db39728561035115b66942a4620ae25b51458a..6e566f6cc106b5e369427705d67e164d581a8312 100644 (file)
@@ -7,6 +7,9 @@ CLASS(GameItem, Object)
     ATTRIB(GameItem, m_id, int, 0)
     ATTRIB(GameItem, m_name, string, string_null)
     ATTRIB(GameItem, m_icon, string, string_null)
+    ATTRIB(GameItem, m_color, vector, '1 1 1')
+    ATTRIB(GameItem, m_waypoint, string, string_null)
+    ATTRIB(GameItem, m_waypointblink, int, 1)
     METHOD(GameItem, display, void(entity this, void(string name, string icon) returns)) {
         returns(this.m_name, this.m_icon ? sprintf("/gfx/hud/%s/%s", cvar_string("menu_skin"), this.m_icon) : string_null);
     }
index 4b6b75a6615472c2308f4f2cf2db7961123f2aab..e7965803e2115e1e2f7f631fae6680a878d2eeaa 100644 (file)
@@ -34,6 +34,8 @@ REGISTER_ITEM(ArmorLarge, Armor) {
     this.m_sound                =   "misc/armor17_5.wav";
     this.m_name                 =   "50 Armor";
     this.m_icon                 =   "armor";
+    this.m_color                =   '0 1 0';
+    this.m_waypoint             =   _("Large armor");
 #ifdef SVQC
     this.m_botvalue             =   20000; // FIXME: higher than BOT_PICKUP_RATING_HIGH?
     this.m_itemid               =   IT_ARMOR;
@@ -47,6 +49,9 @@ REGISTER_ITEM(ArmorMega, Armor) {
     this.m_sound                =   "misc/armor25.wav";
     this.m_name                 =   "100 Armor";
     this.m_icon                 =   "item_large_armor";
+    this.m_color                =   '0 1 0';
+    this.m_waypoint             =   _("Mega armor");
+    this.m_waypointblink        =   2;
 #ifdef SVQC
     this.m_botvalue             =   BOT_PICKUP_RATING_HIGH;
     this.m_itemid               =   IT_ARMOR;
index 9d06b6c2fec8730fe67d4400f5d8d0ae960acb47..bb9d90eb44cdb9c2af8fc1d62cb54ec8665318a8 100644 (file)
@@ -34,6 +34,8 @@ REGISTER_ITEM(HealthLarge, Health) {
     this.m_sound                =   "misc/mediumhealth.wav";
     this.m_name                 =   "50 Health";
     this.m_icon                 =   "health";
+    this.m_color                =   '1 0 0';
+    this.m_waypoint             =   _("Large health");
 #ifdef SVQC
     this.m_botvalue             =   BOT_PICKUP_RATING_MID;
     this.m_itemid               =   IT_25HP;
@@ -47,6 +49,9 @@ REGISTER_ITEM(HealthMega, Health) {
     this.m_sound                =   "misc/megahealth.wav";
     this.m_name                 =   "100 Health";
     this.m_icon                 =   "item_mega_health";
+    this.m_color                =   '1 0 0';
+    this.m_waypoint             =   _("Mega health");
+    this.m_waypointblink        =   2;
 #ifdef SVQC
     this.m_botvalue             =   BOT_PICKUP_RATING_HIGH;
     this.m_itemid               =   IT_HEALTH;
index b45e1c18e18a08bf13759964bdebf68922da9018..3b4cfbc141c9a6b1798612f7b8ef7238162f20eb 100644 (file)
@@ -10,6 +10,9 @@ REGISTER_ITEM(Jetpack, Powerup) {
     this.m_model                =   "g_jetpack.md3";
     this.m_name                 =   "Jet pack";
     this.m_icon                 =   "jetpack";
+    this.m_color                =   '0.5 0.5 0.5';
+    this.m_waypoint             =   _("Jet Pack");
+    this.m_waypointblink        =   2;
 #ifdef SVQC
     this.m_botvalue             =   BOT_PICKUP_RATING_LOW;
     this.m_itemid               =   IT_JETPACK;
@@ -31,6 +34,9 @@ REGISTER_ITEM(JetpackRegen, Pickup) {
     this.m_model                =   "g_fuelregen.md3";
     this.m_name                 =   "Fuel regenerator";
     this.m_icon                 =   "fuelregen";
+    this.m_color                =   '1 0.5 0';
+    this.m_waypoint             =   _("Fuel regen");
+    this.m_waypointblink        =   2;
 #ifdef SVQC
     this.m_botvalue             =   BOT_PICKUP_RATING_LOW;
     this.m_itemflags            =   FL_POWERUP;
index bc4ff8ddd859878ca5e8ad9cd244d9082009dd26..fcfe2afb93a5a7c4b44183dfd6c654595f9c1c77 100644 (file)
@@ -5,16 +5,22 @@
 .int m_itemid;
 #endif
 REGISTER_ITEM(Strength, Powerup) {
-    this.m_model    =   "g_strength.md3";
-    this.m_sound    =   "misc/powerup.wav";
-    this.m_name     =   "Strength Powerup";
-    this.m_icon     =   "strength";
-    this.m_itemid   =   IT_STRENGTH;
+    this.m_model            =   "g_strength.md3";
+    this.m_sound            =   "misc/powerup.wav";
+    this.m_name             =   "Strength Powerup";
+    this.m_icon             =   "strength";
+    this.m_color            =   '0 0 1';
+    this.m_waypoint         =   _("Strength");
+    this.m_waypointblink    =   2;
+    this.m_itemid           =   IT_STRENGTH;
 }
 REGISTER_ITEM(Shield, Powerup) {
-    this.m_model    =   "g_invincible.md3";
-    this.m_sound    =   "misc/powerup_shield.wav";
-    this.m_name     =   "Shield";
-    this.m_icon     =   "shield";
-    this.m_itemid   =   IT_INVINCIBLE;
+    this.m_model            =   "g_invincible.md3";
+    this.m_sound            =   "misc/powerup_shield.wav";
+    this.m_name             =   "Shield";
+    this.m_icon             =   "shield";
+    this.m_color            =   '1 0 1';
+    this.m_waypoint         =   _("Shield");
+    this.m_waypointblink    =   2;
+    this.m_itemid           =   IT_INVINCIBLE;
 }
index 4cb1a6ceaa33c7ecbabec2b6d9a01c27681cda28..0471dff7cd700623d9c28941e4495791643e7216 100644 (file)
@@ -1 +1,3 @@
 #include "mutator/damagetext.qc"
+#include "mutator/itemstime.qc"
+#include "mutator/waypointsprites.qc"
diff --git a/qcsrc/common/mutators/mutator/itemstime.qc b/qcsrc/common/mutators/mutator/itemstime.qc
new file mode 100644 (file)
index 0000000..f0db281
--- /dev/null
@@ -0,0 +1,347 @@
+REGISTER_MUTATOR(itemstime, true);
+
+#ifdef SVQC
+void IT_Write(entity e, int i, float f) {
+    if (!IS_REAL_CLIENT(e)) return;
+    msg_entity = e;
+    WriteByte(MSG_ONE, SVC_TEMPENTITY);
+    WriteMutator(MSG_ONE, itemstime);
+    WriteByte(MSG_ONE, i);
+    WriteFloat(MSG_ONE, f);
+}
+#endif
+
+#ifdef CSQC
+float ItemsTime_time[MAX_ITEMS];
+float ItemsTime_availableTime[MAX_ITEMS];
+MUTATOR_HOOKFUNCTION(itemstime, CSQC_Parse_TempEntity) {
+    if (MUTATOR_RETURNVALUE) return false;
+    if (!ReadMutatorEquals(mutator_argv_int_0, itemstime)) return false;
+    int i = ReadByte();
+    float f = ReadFloat();
+    ItemsTime_time[i] = f;
+    return true;
+}
+#endif
+
+#ifdef SVQC
+
+bool Item_ItemsTime_Allow(entity e)
+{
+    GameItem it = e.itemdef;
+       return (false
+       || it.instanceOfPowerup
+       || it == ITEM_ArmorMega     || it == ITEM_ArmorLarge
+       || it == ITEM_HealthMega    || it == ITEM_HealthLarge
+       || (e.weapons & WEPSET_SUPERWEAPONS)
+       );
+}
+
+float it_times[MAX_ITEMS];
+
+void Item_ItemsTime_Init()
+{
+    FOREACH(ITEMS, true, LAMBDA(
+        it_times[it.m_id] = -1;
+    ));
+}
+
+STATIC_INIT(ItemsTime_Init) {
+    // items time
+    Item_ItemsTime_Init();
+}
+
+void Item_ItemsTime_ResetTimes()
+{
+    FOREACH(ITEMS, true, LAMBDA(
+        it_times[it.m_id] = (it_times[it.m_id] == -1) ? -1 : 0;
+    ));
+}
+
+void Item_ItemsTime_ResetTimesForPlayer(entity e)
+{
+    FOREACH(ITEMS, true, LAMBDA(
+        IT_Write(e, it.m_id, (it_times[it.m_id] == -1) ? -1 : 0);
+    ));
+}
+
+void Item_ItemsTime_SetTimesForPlayer(entity e)
+{
+    FOREACH(ITEMS, true, LAMBDA(
+        IT_Write(e, it.m_id, it_times[it.m_id]);
+    ));
+}
+
+void Item_ItemsTime_SetTime(entity e, float t)
+{
+    if (!autocvar_sv_itemstime)
+        return;
+
+    GameItem item = e.itemdef;
+    it_times[item.m_id] = t;
+}
+
+void Item_ItemsTime_SetTimesForAllPlayers()
+{
+    entity e;
+    FOR_EACH_REALCLIENT(e) if (warmup_stage || !IS_PLAYER(e))
+        Item_ItemsTime_SetTimesForPlayer(e);
+}
+
+float Item_ItemsTime_UpdateTime(entity e, float t)
+{
+    bool isavailable = (t == 0);
+    if (e.weapons & WEPSET_SUPERWEAPONS)
+    {
+        for (entity head = world; (head = nextent(head)); )
+        {
+            if (clienttype(head) != CLIENTTYPE_NOTACLIENT || !(head.weapons & WEPSET_SUPERWEAPONS) || head.classname == "weapon_info")
+                continue;
+            if (e == head)
+                continue;
+
+            if (head.scheduledrespawntime <= time)
+                isavailable = true;
+            else if (t == 0 || head.scheduledrespawntime < t)
+                t = head.scheduledrespawntime;
+        }
+    }
+    else
+    {
+        for (entity head = world; (head = nextent(head)); )
+        {
+            if (head.itemdef != e.itemdef)
+                continue;
+            if (e == head)
+                continue;
+
+            if (head.scheduledrespawntime <= time)
+                isavailable = true;
+            else if (t == 0 || head.scheduledrespawntime < t)
+                t = head.scheduledrespawntime;
+        }
+    }
+    if (isavailable)
+        t = -t; // let know the client there's another available item
+    return t;
+}
+
+MUTATOR_HOOKFUNCTION(itemstime, reset_map_global) {
+    Item_ItemsTime_ResetTimes();
+}
+
+MUTATOR_HOOKFUNCTION(itemstime, MakePlayerObserver) {
+    Item_ItemsTime_SetTimesForPlayer(self);
+}
+
+MUTATOR_HOOKFUNCTION(itemstime, PlayerSpawn) {
+    if (warmup_stage) return;
+    Item_ItemsTime_ResetTimesForPlayer(self);
+}
+
+#endif
+
+#ifdef CSQC
+
+void DrawItemsTimeItem(vector myPos, vector mySize, float ar, entity item, 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.5;
+    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, item.m_icon, '1 1 0' * mySize_y, '1 1 1', panel_fg_alpha * picalpha, DRAWFLAG_NORMAL, item_availableTime);
+    drawpic_aspect_skin(picpos, item.m_icon, '1 1 0' * mySize_y, '1 1 1', panel_fg_alpha * picalpha, DRAWFLAG_NORMAL);
+}
+
+void HUD_ItemsTime()
+{
+    if (!autocvar__hud_configure)
+    {
+        if (!(
+            (autocvar_hud_panel_itemstime == 1 && spectatee_status != 0)
+        ||     (autocvar_hud_panel_itemstime == 2 && (spectatee_status != 0 || warmup_stage))
+            )) { return; }
+    }
+    else
+    {
+        ItemsTime_time[ITEM_ArmorMega.m_id] = time + 0;
+        ItemsTime_time[ITEM_HealthMega.m_id] = time + 8;
+        ItemsTime_time[ITEM_Strength.m_id] = time + 0;
+        ItemsTime_time[ITEM_Shield.m_id] = time + 4;
+    }
+
+    float i;
+    float count = 0;
+    if (autocvar_hud_panel_itemstime_hidespawned == 1)
+        for (i = 0; i < MAX_ITEMS; ++i)
+            count += (ItemsTime_time[i] > time || -ItemsTime_time[i] > time);
+    else if (autocvar_hud_panel_itemstime_hidespawned == 2)
+        for (i = 0; i < MAX_ITEMS; ++i)
+            count += (ItemsTime_time[i] > time);
+    else
+        for (i = 0; i < MAX_ITEMS; ++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;
+    FOREACH(ITEMS, ItemsTime_time[i] != -1, LAMBDA(
+        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, it, item_time, item_available, f);
+        ++row;
+        if (row >= rows)
+        {
+            row = 0;
+            column = column + 1;
+        }
+    ));
+}
+
+#endif
diff --git a/qcsrc/common/mutators/mutator/waypointsprites.qc b/qcsrc/common/mutators/mutator/waypointsprites.qc
new file mode 100644 (file)
index 0000000..f8055ad
--- /dev/null
@@ -0,0 +1,11 @@
+REGISTER_MUTATOR(waypointsprites, true);
+
+#ifdef CSQC
+void Ent_WaypointSprite();
+MUTATOR_HOOKFUNCTION(waypointsprites, CSQC_Ent_Update) {
+    if (MUTATOR_RETURNVALUE) return false;
+    if (!ReadMutatorEquals(mutator_argv_int_0, waypointsprites)) return false;
+    Ent_WaypointSprite();
+    return true;
+}
+#endif
index 83afc1890be65daac0af553778941b2c7749c0b7..74aa0e75fad498f4cb543430af2e119212fa93cd 100644 (file)
@@ -109,16 +109,16 @@ const int STAT_OK_AMMO_CHARGE         = 85;
 const int STAT_OK_AMMO_CHARGEPOOL     = 86;
 const int STAT_FROZEN                 = 87;
 const int STAT_REVIVE_PROGRESS        = 88;
-const int STAT_ARMOR_LARGE_TIME       = 89;
-const int STAT_HEALTH_MEGA_TIME       = 90;
-const int STAT_INVISIBLE_TIME         = 91;
-const int STAT_SPEED_TIME             = 92;
-const int STAT_EXTRALIFE_TIME         = 93;
-const int STAT_STRENGTH_TIME          = 94;
-const int STAT_SHIELD_TIME            = 95;
-const int STAT_FUELREGEN_TIME         = 96;
-const int STAT_JETPACK_TIME           = 97;
-const int STAT_SUPERWEAPONS_TIME      = 98;
+// 89 empty?
+// 90 empty?
+// 91 empty?
+// 92 empty?
+// 93 empty?
+// 94 empty?
+// 95 empty?
+// 96 empty?
+// 97 empty?
+// 98 empty?
 const int STAT_ROUNDLOST              = 99;
 
 /* The following stats change depending on the gamemode, so can share the same ID */
index b10ef09baf75fadba2367fb6f5225c8bcec58b90..b42292c8523812c82b44a2c7df68e8b4e490ebc8 100644 (file)
@@ -21,4 +21,6 @@
 
 #pragma noref 0
 
+#define ReadFloat() ReadCoord()
+
 #endif
index c2440d3dabffba98aaf3a1324d321267a224dd46..3592c7015b53dc37726e7f6e86a35a3c6cb123be 100644 (file)
@@ -21,4 +21,6 @@
 
 #pragma noref 0
 
+#define WriteFloat(to, f) WriteCoord(to, f)
+
 #endif
index 81ea03e0eb4bf7556b3a01899947b8c788dfef3f..9a832efd4d67449fdb99f533603e427adf0356ac 100644 (file)
@@ -197,7 +197,6 @@ void PutObserverInServer (void)
 
        if(IS_REAL_CLIENT(self))
        {
-               Item_ItemsTime_SetTimesForPlayer(self);
                msg_entity = self;
                WriteByte(MSG_ONE, SVC_SETVIEW);
                WriteEntity(MSG_ONE, self);
@@ -507,9 +506,6 @@ void PutClientInServer (void)
                else
                        self.superweapons_finished = 0;
 
-               if(!warmup_stage)
-                       Item_ItemsTime_ResetTimesForPlayer(self);
-
                if(g_weaponarena_random) // WEAPONTODO: more stuff that should be in a mutator. also: rename those cvars
                {
                        if(g_weaponarena_random_with_blaster)
index 6ea03dd43fdaad2c88dca9ee34ce0b0171a73adc..4be48e124e82b98d38fb26c41c5df7dfe18efc29 100644 (file)
@@ -462,8 +462,6 @@ void ReadyRestart_force()
        // disable the warmup global for the server
        warmup_stage = 0; // once the game is restarted the game is in match stage
 
-       Item_ItemsTime_ResetTimes();
-
        // reset the .ready status of all players (also spectators)
        FOR_EACH_REALCLIENT(tmp_player) { tmp_player.ready = 0; }
        readycount = 0;
index cab4d569fc6061a4628873cbb5f5358be128352a..5072e49002be11ab6a1dd845cbfacce27a75ed58 100644 (file)
@@ -513,17 +513,6 @@ const float ACTIVE_TOGGLE  = 3;
 .void (float act_state) setactive;
 .entity realowner;
 
-.float item_armor_large_time;
-.float item_health_mega_time;
-.float item_invisible_time;
-.float item_speed_time;
-.float item_extralife_time;
-.float item_strength_time;
-.float item_shield_time;
-.float item_fuelregen_time;
-.float item_jetpack_time;
-.float item_superweapons_time;
-
 //float serverflags;
 
 .float team_forced; // can be a team number to force a team, or 0 for default action, or -1 for forced spectator
index 98147bfa3da099ebb5a621454734f1b562dc7c2d..0fc713f69ab2d4e7f92a43b4c648d487bf4dd5b9 100644 (file)
@@ -572,7 +572,6 @@ void spawnfunc___init_dedicated_server(void)
 void Map_MarkAsRecent(string m);
 float world_already_spawned;
 void Nagger_Init();
-void Item_ItemsTime_Init();
 void ClientInit_Spawn();
 void WeaponStats_Init();
 void WeaponStats_Shutdown();
@@ -812,19 +811,6 @@ void spawnfunc_worldspawn (void)
 
        addstat(STAT_ARC_HEAT, AS_FLOAT, arc_heat_percent);
 
-       // items time
-       addstat(STAT_ARMOR_LARGE_TIME, AS_FLOAT, item_armor_large_time);
-       addstat(STAT_HEALTH_MEGA_TIME, AS_FLOAT, item_health_mega_time);
-       addstat(STAT_INVISIBLE_TIME, AS_FLOAT, item_invisible_time);
-       addstat(STAT_SPEED_TIME, AS_FLOAT, item_speed_time);
-       addstat(STAT_EXTRALIFE_TIME, AS_FLOAT, item_extralife_time);
-       addstat(STAT_STRENGTH_TIME, AS_FLOAT, item_strength_time);
-       addstat(STAT_SHIELD_TIME, AS_FLOAT, item_shield_time);
-       addstat(STAT_FUELREGEN_TIME, AS_FLOAT, item_fuelregen_time);
-       addstat(STAT_JETPACK_TIME, AS_FLOAT, item_jetpack_time);
-       addstat(STAT_SUPERWEAPONS_TIME, AS_FLOAT, item_superweapons_time);
-       Item_ItemsTime_Init();
-
        // freeze attacks
        addstat(STAT_FROZEN, AS_INT, frozen);
        addstat(STAT_REVIVE_PROGRESS, AS_FLOAT, revive_progress);
index 267a0f71da0fa390f543015f7b5305754b8ee5e0..bc8600fb49ff34798af910ed25a9134768a6f69f 100644 (file)
@@ -123,7 +123,7 @@ MUTATOR_HOOKFUNCTION(superspec_ItemTouch)
 
                if((self.autospec_flags & ASF_SHIELD && _item.invincible_finished) ||
                        (self.autospec_flags & ASF_STRENGTH && _item.strength_finished) ||
-                       (self.autospec_flags & ASF_MEGA_AR && _item.itemdef == ITEM_ArmorLarge) ||
+                       (self.autospec_flags & ASF_MEGA_AR && _item.itemdef == ITEM_ArmorMega) ||
                        (self.autospec_flags & ASF_MEGA_HP && _item.itemdef == ITEM_HealthMega) ||
                        (self.autospec_flags & ASF_FLAG_GRAB && _item.classname == "item_flag_team"))
                {
index 4ee0add84ff89953f4e392e34e705062a8a0fdde..0985e4bfe46e2c07dccc62c10115d4217f796878 100644 (file)
@@ -412,179 +412,10 @@ void Item_Think()
        }
 }
 
-float it_armor_large_time;
-float it_health_mega_time;
-float it_invisible_time;
-float it_speed_time;
-float it_extralife_time;
-float it_strength_time;
-float it_shield_time;
-float it_fuelregen_time;
-float it_jetpack_time;
-float it_superweapons_time;
-
-void Item_ItemsTime_Init()
-{
-       it_armor_large_time = -1;
-       it_health_mega_time = -1;
-       it_invisible_time = -1;
-       it_speed_time = -1;
-       it_extralife_time = -1;
-       it_strength_time = -1;
-       it_shield_time = -1;
-       it_fuelregen_time = -1;
-       it_jetpack_time = -1;
-       it_superweapons_time = -1;
-}
-void Item_ItemsTime_ResetTimes()
-{
-       it_armor_large_time = (it_armor_large_time == -1) ? -1 : 0;
-       it_health_mega_time = (it_health_mega_time == -1) ? -1 : 0;
-       it_invisible_time   = (it_invisible_time   == -1) ? -1 : 0;
-       it_speed_time       = (it_speed_time       == -1) ? -1 : 0;
-       it_extralife_time   = (it_extralife_time   == -1) ? -1 : 0;
-       it_strength_time    = (it_strength_time    == -1) ? -1 : 0;
-       it_shield_time      = (it_shield_time      == -1) ? -1 : 0;
-       it_fuelregen_time   = (it_fuelregen_time   == -1) ? -1 : 0;
-       it_jetpack_time     = (it_jetpack_time     == -1) ? -1 : 0;
-       it_superweapons_time= (it_superweapons_time== -1) ? -1 : 0;
-}
-void Item_ItemsTime_ResetTimesForPlayer(entity e)
-{
-       e.item_armor_large_time = (it_armor_large_time == -1) ? -1 : 0;
-       e.item_health_mega_time = (it_health_mega_time == -1) ? -1 : 0;
-       e.item_invisible_time   = (it_invisible_time   == -1) ? -1 : 0;
-       e.item_speed_time       = (it_speed_time       == -1) ? -1 : 0;
-       e.item_extralife_time   = (it_extralife_time   == -1) ? -1 : 0;
-       e.item_strength_time    = (it_strength_time    == -1) ? -1 : 0;
-       e.item_shield_time      = (it_shield_time      == -1) ? -1 : 0;
-       e.item_fuelregen_time   = (it_fuelregen_time   == -1) ? -1 : 0;
-       e.item_jetpack_time     = (it_jetpack_time     == -1) ? -1 : 0;
-       e.item_superweapons_time= (it_superweapons_time== -1) ? -1 : 0;
-}
-void Item_ItemsTime_SetTimesForPlayer(entity e)
-{
-       e.item_armor_large_time = it_armor_large_time;
-       e.item_health_mega_time = it_health_mega_time;
-       e.item_invisible_time = it_invisible_time;
-       e.item_speed_time = it_speed_time;
-       e.item_extralife_time = it_extralife_time;
-       e.item_strength_time = it_strength_time;
-       e.item_shield_time = it_shield_time;
-       e.item_fuelregen_time = it_fuelregen_time;
-       e.item_jetpack_time = it_jetpack_time;
-       e.item_superweapons_time = it_superweapons_time;
-}
-
-void Item_ItemsTime_SetTime(entity e, float t)
-{
-       if(!autocvar_sv_itemstime)
-               return;
-
-       if(g_instagib)
-       {
-               switch(e.items)
-               {
-                       case IT_STRENGTH://"item-invis"
-                               it_invisible_time = t;
-                               break;
-                       case IT_NAILS://"item-extralife"
-                               it_extralife_time = t;
-                               break;
-                       case IT_INVINCIBLE://"item-speed"
-                               it_speed_time = t;
-                               break;
-               }
-       }
-       else
-       {
-               switch(e.items)
-               {
-                       case IT_HEALTH:
-                               // if(e.itemdef == ITEM_MegaHealth) // e.items == IT_HEALTH unequivocally identifies it
-                                       it_health_mega_time = t;
-                               break;
-                       case IT_ARMOR:
-                               if(e.itemdef == ITEM_ArmorLarge) // e.items == IT_ARMOR doesn't unequivocally identifies it
-                                       it_armor_large_time = t;
-                               break;
-                       case IT_STRENGTH://"item-strength"
-                               it_strength_time = t;
-                               break;
-                       case IT_INVINCIBLE://"item-shield"
-                               it_shield_time = t;
-                               break;
-                       default:
-                               if(e.weapons & WEPSET_SUPERWEAPONS)
-                                       it_superweapons_time = t;
-               }
-       }
-       switch(e.items)
-       {
-               case IT_FUEL_REGEN://"item-fuelregen"
-                       it_fuelregen_time = t;
-                       break;
-               case IT_JETPACK://"item-jetpack"
-                       it_jetpack_time = t;
-                       break;
-       }
-}
-void Item_ItemsTime_SetTimesForAllPlayers()
-{
-       entity e;
-       if(warmup_stage)
-       {
-               FOR_EACH_REALCLIENT(e)
-                       Item_ItemsTime_SetTimesForPlayer(e);
-       }
-       else
-       {
-               FOR_EACH_REALCLIENT(e)
-               {
-                       if(!IS_PLAYER(e))
-                               Item_ItemsTime_SetTimesForPlayer(e);
-               }
-       }
-}
-
-float Item_ItemsTime_UpdateTime(entity e, float t)
-{
-       entity head;
-       bool isavailable = (t == 0);
-       if(e.weapons & WEPSET_SUPERWEAPONS)
-       {
-               for(head = world; (head = nextent(head)); )
-               {
-                       if(clienttype(head) != CLIENTTYPE_NOTACLIENT || !(head.weapons & WEPSET_SUPERWEAPONS) || head.classname == "weapon_info")
-                               continue;
-                       if(e == head)
-                               continue;
-
-                       if(head.scheduledrespawntime <= time)
-                               isavailable = true;
-                       else if(t == 0 || head.scheduledrespawntime < t)
-                               t = head.scheduledrespawntime;
-               }
-       }
-       else
-       {
-               for(head = world; (head = nextent(head)); )
-               {
-                       if(head.itemdef != e.itemdef)
-                               continue;
-                       if(e == head)
-                               continue;
-
-                       if(head.scheduledrespawntime <= time)
-                               isavailable = true;
-                       else if(t == 0 || head.scheduledrespawntime < t)
-                               t = head.scheduledrespawntime;
-               }
-       }
-       if(isavailable)
-               t = -t; // let know the client there's another available item
-       return t;
-}
+bool Item_ItemsTime_Allow(entity e);
+float Item_ItemsTime_UpdateTime(entity e, float t);
+void Item_ItemsTime_SetTime(entity e, float t);
+void Item_ItemsTime_SetTimesForAllPlayers();
 
 void Item_Respawn (void)
 {
@@ -598,7 +429,7 @@ void Item_Respawn (void)
                sound (self, CH_TRIGGER, "misc/itemrespawn.wav", VOL_BASE, ATTEN_NORM); // play respawn sound
        setorigin (self, self.origin);
 
-       if(self.flags & FL_POWERUP || self.itemdef == ITEM_ArmorLarge || self.items == IT_HEALTH || (self.weapons & WEPSET_SUPERWEAPONS))
+    if (Item_ItemsTime_Allow(self))
        {
                float t = Item_ItemsTime_UpdateTime(self, 0);
                Item_ItemsTime_SetTime(self, t);
@@ -626,24 +457,13 @@ void Item_RespawnCountdown (void)
                self.count += 1;
                if(self.count == 1)
                {
-                       string name;
+                       string name = string_null;
                        vector rgb = '1 0 1';
-                       name = string_null;
-                       switch (self.items)
-                       {
-                               case ITEM_JetpackRegen.m_itemid: name = "item-fuelregen"; rgb = '1 0.5 0'; break;
-                               case ITEM_Jetpack.m_itemid:    name = "item-jetpack"; rgb = '0.5 0.5 0.5'; break;
-                               case ITEM_Strength.m_itemid:   name = "item-strength"; rgb = '0 0 1'; break;
-                               case ITEM_Shield.m_itemid: name = "item-shield"; rgb = '1 0 1'; break;
-                               case ITEM_HealthMega.m_itemid:
-                                       //if (self.classname == "item_health_mega")
-                                               {name = "item_health_mega"; rgb = '1 0 0';}
-                                       break;
-                               case ITEM_ArmorMega.m_itemid:
-                                       if (self.itemdef == ITEM_ArmorLarge)
-                                               {name = "item_armor_large"; rgb = '0 1 0';}
-                                       break;
-                       }
+            entity e = self.itemdef;
+            if (e) {
+                name = e.m_waypoint;
+                rgb = e.m_color;
+            }
                        MUTATOR_CALLHOOK(Item_RespawnCountdown, name, rgb);
                        name = item_name;
                        rgb = item_color;
@@ -709,7 +529,7 @@ void Item_RespawnThink()
 
 void Item_ScheduleRespawnIn(entity e, float t)
 {
-       if((e.flags & FL_POWERUP) || (e.weapons & WEPSET_SUPERWEAPONS) || e.itemdef == ITEM_ArmorLarge || e.items == IT_HEALTH)
+       if (Item_ItemsTime_Allow(e))
        {
                e.think = Item_RespawnCountdown;
                e.nextthink = time + max(0, t - ITEM_RESPAWN_TICKS);
index 364f4c188dc9da5297766d4394736314d9d15988..35cce6178d8a3ec4ca3078c72f5c4e74251a91de 100644 (file)
@@ -113,10 +113,6 @@ const float ITEM_RESPAWN_TICKS = 10;
 .float max_armorvalue;
 .float pickup_anyway;
 
-void Item_ItemsTime_SetTimesForPlayer(entity e);
-
-void Item_ItemsTime_ResetTimesForPlayer(entity e);
-
 void Item_Show (entity e, float mode);
 
 void Item_Respawn (void);
index 136beddb96829c21be5adcbf2cf7384df49d054b..8c47014f7e5e3b691a9c97cb6a64dd8d3d48998c 100644 (file)
@@ -260,7 +260,7 @@ float WaypointSprite_SendEntity(entity to, float sendflags)
 {
        float dt;
 
-       WriteByte(MSG_ENTITY, ENT_CLIENT_WAYPOINT);
+       WriteMutator(MSG_ENTITY, waypointsprites);
 
        sendflags = sendflags & 0x7F;