]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into TimePath/guide
authorotta8634 <k9wolf@pm.me>
Sat, 1 Mar 2025 17:31:37 +0000 (01:31 +0800)
committerotta8634 <k9wolf@pm.me>
Sat, 1 Mar 2025 17:51:09 +0000 (01:51 +0800)
1  2 
qcsrc/common/items/item.qh
qcsrc/common/mutators/mutator/buffs/buffs.qh
qcsrc/common/mutators/mutator/nades/nades.qh
qcsrc/common/mutators/mutator/status_effects/all.qh
qcsrc/common/weapons/weapon.qh

index 6843c182b1cfaf4d942b1038f7bc5666c70f826b,43a66dc38184654765b65727e41bcc2c1450cb60..6b0861b53fd0d12122e27758b996a3c8ce508981
  #include <server/items/spawning.qh>
  #endif
  
++#ifdef MENUQC
++#include <menu/draw.qh>
++#endif
++
  #ifdef GAMEQC
  const int IT_UNLIMITED_AMMO                   =  BIT(0); // when this bit is set, using a weapon does not reduce ammo. Checkpoints can give this powerup.
  const int IT_UNLIMITED_SUPERWEAPONS           =  BIT(1); // when this bit is set, superweapons don't expire. Checkpoints can give this powerup.
@@@ -119,35 -119,41 +123,49 @@@ enu
  
  #define ITEM_HANDLE(signal, ...) __Item_Send_##signal(__VA_ARGS__)
  CLASS(GameItem, Object)
-     ATTRIB(GameItem, m_id, int, 0);
-     /** the canonical spawnfunc name */
-     ATTRIB(GameItem, m_canonical_spawnfunc, string);
-     METHOD(GameItem, m_spawnfunc_hookreplace, GameItem(GameItem this, entity e)) { return this; }
-     ATTRIB(GameItem, m_name, string);
-     ATTRIB(GameItem, m_icon, string);
-     ATTRIB(GameItem, m_color, vector, '1 1 1');
-     ATTRIB(GameItem, m_waypoint, string);
-     ATTRIB(GameItem, m_waypointblink, int, 1);
+       ATTRIB(GameItem, m_id, int, 0);
+       /** the canonical spawnfunc name */
+       ATTRIB(GameItem, m_canonical_spawnfunc, string);
+       METHOD(GameItem, m_spawnfunc_hookreplace, GameItem(GameItem this, entity e)) { return this; }
+       ATTRIB(GameItem, m_name, string);
+       ATTRIB(GameItem, m_icon, string);
+       ATTRIB(GameItem, m_color, vector, '1 1 1');
+       ATTRIB(GameItem, m_waypoint, string);
+       ATTRIB(GameItem, m_waypointblink, int, 1);
  #ifdef GAMEQC
-     ATTRIB(GameItem, m_glow, bool, false);
-     ATTRIB(GameItem, m_respawnsound, Sound, SND_ITEMRESPAWN);
+       ATTRIB(GameItem, m_glow, bool, false);
+       ATTRIB(GameItem, m_respawnsound, Sound, SND_ITEMRESPAWN);
  #endif
-     METHOD(GameItem, describe, string(GameItem this))
-     {
-         TC(GameItem, this);
-         return SUPER(GameItem).describe(this);
-     }
 +#ifdef MENUQC
-     METHOD(GameItem, display, void(GameItem this, void(string name, string icon) returns))
-     {
-         TC(GameItem, this);
-         returns(this.m_name, (this.m_icon != "") ? sprintf("/gfx/hud/%s/%s", cvar_string("hud_skin"), this.m_icon) : string_null);
-     }
-     METHOD(GameItem, show, void(GameItem this))
-     {
-         TC(GameItem, this);
-         LOG_INFO("A game item");
-     }
-     void ITEM_HANDLE(Show, GameItem this) { this.show(this); }
++      METHOD(GameItem, describe, string(GameItem this))
++      {
++              TC(GameItem, this);
++              return SUPER(GameItem).describe(this);
++      }
 +#endif
 -      METHOD(GameItem, display, void(entity this, void(string name, string icon) returns))
+ #ifndef SVQC
++      METHOD(GameItem, display, void(GameItem this, void(string name, string icon) returns))
+       {
++              TC(GameItem, this);
+               string img = this.m_icon;
+               if (img != "")
+               {
+                       img = sprintf("/gfx/hud/%s/%s", cvar_string("hud_skin"), this.m_icon);
+       #ifdef CSQC
+                       if (precache_pic(img) == "")
+       #endif
+       #ifdef MENUQC
+                       if (draw_PreloadPicture(img) == "")
+       #endif
+                               img = sprintf("/gfx/hud/default/%s", this.m_icon);
+               }
+               returns(this.m_name, img);
+       }
+ #endif
+       METHOD(GameItem, show, void(GameItem this))
+       {
+               TC(GameItem, this);
+               LOG_INFO("A game item");
+       }
+       void ITEM_HANDLE(Show, GameItem this) { this.show(this); }
  ENDCLASS(GameItem)
index f18e688fbec33a7391e325d48164a81aec3c9929,7e59976ee7d97bbff7b98a8772e6dce15d2743ff..ea8f8a195dad85a18f72fb39f25030234f259ed1
@@@ -22,21 -22,24 +22,32 @@@ CLASS(Buff, StatusEffect
        ATTRIB(Buff, m_skin, int, 0);
        ATTRIB(Buff, m_lifetime, float, 60);
        ATTRIB(Buff, m_sprite, string, "");
-       METHOD(Buff, display, void(Buff this, void(string name, string icon) returns)) {
++#ifdef MENUQC
++      METHOD(Buff, describe, string(Buff this)) {
 +              TC(Buff, this);
-               returns(this.m_name, this.m_icon ? sprintf("/gfx/hud/%s/%s", cvar_string("hud_skin"), this.m_icon) : string_null);
++              return SUPER(Buff).describe(this);
 +      }
++#endif
+ #ifndef SVQC
 -      METHOD(Buff, display, void(entity this, void(string name, string icon) returns))
++      METHOD(Buff, display, void(Buff this, void(string name, string icon) returns))
+       {
++              TC(Buff, this);
+               string img = sprintf("/gfx/hud/%s/%s", cvar_string("hud_skin"), this.m_icon);
+       #ifdef CSQC
+               if (precache_pic(img) == "")
+       #endif
+       #ifdef MENUQC
+               if (draw_PreloadPicture(img) == "")
+       #endif
+                       img = sprintf("/gfx/hud/default/%s", this.m_icon);
+               returns(this.m_name, img);
+       }
+ #endif
  #ifdef SVQC
 -      METHOD(Buff, m_time, float(Buff this))
 -      { return cvar(strcat("g_buffs_", this.netname, "_time")); }
 +      METHOD(Buff, m_time, float(Buff this)) {
 +              return cvar(strcat("g_buffs_", this.netname, "_time"));
 +      }
  #endif
- #ifdef MENUQC
-       METHOD(Buff, describe, string(Buff this)) {
-               TC(Buff, this);
-               return SUPER(Buff).describe(this);
-       }
- #endif
  ENDCLASS(Buff)
  
  STATIC_INIT(REGISTER_BUFFS) {
index ad27f8b0cf7d169966ee342d2eb9550f697c3a42,b92da50f4abb5270b076ca3d73349f80a9ee2f9a..71ddb8b7c06f00c0ffc711b4050b12879fd7666d
@@@ -18,22 -18,23 +18,32 @@@ CLASS(Nade, Object
      ATTRIB(Nade, impulse, int, 0); // legacy number for selection, do not add to new nade types
      ATTRIBARRAY(Nade, m_projectile, int, 2);
      ATTRIBARRAY(Nade, m_trail, entity, 2);
-     METHOD(Nade, display, void(Nade this, void(string name, string icon) returns)) {
-         TC(Nade, this);
-         returns(this.m_name, this.m_icon ? sprintf("/gfx/hud/%s/%s", cvar_string("hud_skin"), this.m_icon) : string_null);
-     }
 +#ifdef MENUQC
 +    METHOD(Nade, describe, string(Nade this)) {
 +        TC(Nade, this);
 +        return SUPER(Nade).describe(this);
 +    }
 +#endif
+ #ifndef SVQC
 -    METHOD(Nade, display, void(entity this, void(string name, string icon) returns))
++    METHOD(Nade, display, void(Nade this, void(string name, string icon) returns))
+     {
+         string img = sprintf("/gfx/hud/%s/%s", cvar_string("hud_skin"), this.m_icon);
+     #ifdef CSQC
+         if (precache_pic(img) == "")
+     #endif
+     #ifdef MENUQC
+         if (draw_PreloadPicture(img) == "")
+     #endif
+             img = sprintf("/gfx/hud/default/%s", this.m_icon);
+         returns(this.m_name, img);
+     }
+ #endif
  ENDCLASS(Nade)
  
 -REGISTER_NADE(Null, NEW(Nade));
 +CLASS(NullNade, Nade)
 +    ATTRIB(NullNade, m_hidden, bool, true);
 +ENDCLASS(NullNade)
 +REGISTER(Nades, NADE_TYPE, Null, m_id, NEW(NullNade));
  REGISTRY_DEFINE_GET(Nades, NADE_TYPE_Null)
  
  // use slots 70-100
index 7267330364ccf3f568eb0621ef46673a5ebb1d25,87f7f4992ccd8eca8998f2c9bba520d60882ed81..e4565e643cd776e22c57884a806aeaa1f20fecea
@@@ -51,9 -51,23 +51,23 @@@ CLASS(StatusEffect, Object
        /** Sets the persistent flag and updates client side if returning true */
        METHOD(StatusEffect, m_persistent, bool(StatusEffect this, entity actor)) { return false; };
  #endif
 -      METHOD(StatusEffect, display, void(entity this, void(string name, string icon) returns))
+ #ifndef SVQC
 +      METHOD(StatusEffect, display, void(StatusEffect this, void(string name, string icon) returns))
        {
                TC(StatusEffect, this);
-               returns(this.m_name, (this.m_icon != "") ? sprintf("/gfx/hud/%s/%s", cvar_string("hud_skin"), this.m_icon) : string_null);
+               string img = this.m_icon;
+               if (img != "")
+               {
+                       img = sprintf("/gfx/hud/%s/%s", cvar_string("hud_skin"), this.m_icon);
+       #ifdef CSQC
+                       if (precache_pic(img) == "")
+       #endif
+       #ifdef MENUQC
+                       if (draw_PreloadPicture(img) == "")
+       #endif
+                               img = sprintf("/gfx/hud/default/%s", this.m_icon);
+               }
+               returns(this.m_name, img);
        }
+ #endif
  ENDCLASS(StatusEffect)
index c24bfb96ae336f5d423fa7c1a9433977802ce18d,095cdff5717e9c33a0431709c0519847809c3a00..f796ab5b5960b670e3865f492f36dcc154da3f19
@@@ -126,16 -126,25 +126,30 @@@ CLASS(Weapon, Object
        METHOD(Weapon, wr_pickup, void(Weapon this, entity actor, .entity weaponentity)) {}
        /** (SERVER) update cvar based properties */
        METHOD(Weapon, wr_update, void(Weapon this)) {}
-       METHOD(Weapon, display, void(Weapon this, void(string name, string icon) returns)) {
-               TC(Weapon, this);
-               returns(this.m_name, (this.model2 != "") ? sprintf("/gfx/hud/%s/%s", cvar_string("hud_skin"), this.model2) : string_null);
-       }
 -
 +#ifdef MENUQC
 +      METHOD(Weapon, describe, string(Weapon this)) {
 +              TC(Weapon, this);
 +              return SUPER(Weapon).describe(this);
 +      }
 +#endif
+ #ifndef SVQC
 -      METHOD(Weapon, display, void(entity this, void(string name, string icon) returns))
++      METHOD(Weapon, display, void(Weapon this, void(string name, string icon) returns))
+       {
+               string img = this.model2;
+               if (img != "")
+               {
+                       img = sprintf("/gfx/hud/%s/%s", cvar_string("hud_skin"), this.model2);
+       #ifdef CSQC
+                       if (precache_pic(img) == "")
+       #endif
+       #ifdef MENUQC
+                       if (draw_PreloadPicture(img) == "")
+       #endif
+                               img = sprintf("/gfx/hud/default/%s", this.model2);
+               }
+               returns(this.m_name, img);
+       }
+ #endif
  ENDCLASS(Weapon)
  
  #ifdef SVQC