]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/items/item/health.qh
Revert "Remove legacy Quake bbox expansion: map entities"
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / items / item / health.qh
index 14e942a085a1f01e9cfd1e54d05d09daf227d49b..ca94651aa328a5e7d314e66c2d0b7906332c1129 100644 (file)
@@ -11,7 +11,7 @@ CLASS(Health, Pickup)
 ENDCLASS(Health)
 
 #ifdef SVQC
-    #include <common/t_items.qh>
+    #include <server/items/items.qh>
 #endif
 
 #ifdef GAMEQC
@@ -27,7 +27,7 @@ void item_healthsmall_init(Pickup this, entity item)
     if(!item.max_health)
         item.max_health = g_pickup_healthsmall_max;
     if(!GetResource(item, RES_HEALTH))
-        SetResourceExplicit(item, RES_HEALTH, g_pickup_healthsmall);
+        SetResourceExplicit(item, RES_HEALTH, q3compat && item.count ? item.count : g_pickup_healthsmall);
 }
 #endif
 
@@ -40,9 +40,13 @@ REGISTER_ITEM(HealthSmall, Health) {
 #endif
     this.netname                =   "health_small";
     this.m_name                 =   _("Small health");
-    this.m_icon                 =   "health";
+    this.m_icon                 =   "health_small";
+#ifdef CSQC
+    if(precache_pic(strcat("gfx/hud/luma/", this.m_icon)) == "")
+       this.m_icon             =   "health"; // compatible with Xonotic v0.8.2 or lower
+#endif
 #ifdef SVQC
-    this.m_itemid               =   IT_5HP;
+    this.m_itemid               =   IT_RESOURCE;
     this.m_respawntime          =   GET(g_pickup_respawntime_short);
     this.m_respawntimejitter    =   GET(g_pickup_respawntimejitter_short);
     this.m_pickupanyway         =   GET(g_pickup_healthsmall_anyway);
@@ -65,7 +69,7 @@ void item_healthmedium_init(Pickup this, entity item)
     if(!item.max_health)
         item.max_health = g_pickup_healthmedium_max;
     if(!GetResource(item, RES_HEALTH))
-        SetResourceExplicit(item, RES_HEALTH, g_pickup_healthmedium);
+        SetResourceExplicit(item, RES_HEALTH, q3compat && item.count ? item.count : g_pickup_healthmedium);
 }
 #endif
 
@@ -78,9 +82,13 @@ REGISTER_ITEM(HealthMedium, Health) {
 #endif
     this.netname                =   "health_medium";
     this.m_name                 =   _("Medium health");
-    this.m_icon                 =   "health";
+    this.m_icon                 =   "health_medium";
+#ifdef CSQC
+    if(precache_pic(strcat("gfx/hud/luma/", this.m_icon)) == "")
+       this.m_icon             =   "health"; // compatible with Xonotic v0.8.2 or lower
+#endif
 #ifdef SVQC
-    this.m_itemid               =   IT_25HP;
+    this.m_itemid               =   IT_RESOURCE;
     this.m_respawntime          =   GET(g_pickup_respawntime_short);
     this.m_respawntimejitter    =   GET(g_pickup_respawntimejitter_short);
     this.m_pickupanyway         =   GET(g_pickup_healthmedium_anyway);
@@ -103,7 +111,7 @@ void item_healthbig_init(Pickup this, entity item)
     if(!item.max_health)
         item.max_health = g_pickup_healthbig_max;
     if(!GetResource(item, RES_HEALTH))
-        SetResourceExplicit(item, RES_HEALTH, g_pickup_healthbig);
+        SetResourceExplicit(item, RES_HEALTH, q3compat && item.count ? item.count : g_pickup_healthbig);
 }
 #endif
 
@@ -116,11 +124,15 @@ REGISTER_ITEM(HealthBig, Health) {
 #endif
     this.netname                =   "health_big";
     this.m_name                 =   _("Big health");
-    this.m_icon                 =   "health";
+    this.m_icon                 =   "health_big";
     this.m_color                =   '1 0 0';
     this.m_waypoint             =   _("Big health");
+#ifdef CSQC
+    if(precache_pic(strcat("gfx/hud/luma/", this.m_icon)) == "")
+       this.m_icon             =   "health"; // compatible with Xonotic v0.8.2 or lower
+#endif
 #ifdef SVQC
-    this.m_itemid               =   IT_25HP;
+    this.m_itemid               =   IT_RESOURCE;
     this.m_respawntime          =   GET(g_pickup_respawntime_medium);
     this.m_respawntimejitter    =   GET(g_pickup_respawntimejitter_medium);
     this.m_pickupanyway         =   GET(g_pickup_healthbig_anyway);
@@ -143,7 +155,7 @@ void item_healthmega_init(Pickup this, entity item)
     if(!item.max_health)
         item.max_health = g_pickup_healthmega_max;
     if(!GetResource(item, RES_HEALTH))
-        SetResourceExplicit(item, RES_HEALTH, g_pickup_healthmega);
+        SetResourceExplicit(item, RES_HEALTH, q3compat && item.count ? item.count : g_pickup_healthmega);
 }
 #endif
 
@@ -156,13 +168,17 @@ REGISTER_ITEM(HealthMega, Health) {
 #endif
     this.netname                =   "health_mega";
     this.m_name                 =   _("Mega health");
-    this.m_icon                 =   "item_mega_health";
+    this.m_icon                 =   "health_mega";
+#ifdef CSQC
+    if(precache_pic(strcat("gfx/hud/luma/", this.m_icon)) == "")
+       this.m_icon             =   "item_mega_health"; // compatible with Xonotic v0.8.2 or lower
+#endif
     this.m_color                =   '1 0 0';
     this.m_waypoint             =   _("Mega health");
     this.m_waypointblink        =   2;
 #ifdef SVQC
     this.m_maxs                 =   '16 16 70';
-    this.m_itemid               =   IT_HEALTH;
+    this.m_itemid               =   IT_RESOURCE;
     this.m_respawntime          =   GET(g_pickup_respawntime_long);
     this.m_respawntimejitter    =   GET(g_pickup_respawntimejitter_long);
     this.m_pickupanyway         =   GET(g_pickup_healthmega_anyway);