From: otta8634 Date: Sat, 1 Mar 2025 17:31:37 +0000 (+0800) Subject: Merge branch 'master' into TimePath/guide X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=e24a0dd048bae507e2822ca5f9866d9a768df3c5;p=xonotic%2Fxonotic-data.pk3dir.git Merge branch 'master' into TimePath/guide --- e24a0dd048bae507e2822ca5f9866d9a768df3c5 diff --cc qcsrc/common/items/item.qh index 6843c182b1,43a66dc381..6b0861b53f --- a/qcsrc/common/items/item.qh +++ b/qcsrc/common/items/item.qh @@@ -11,6 -11,6 +11,10 @@@ #include #endif ++#ifdef MENUQC ++#include ++#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 +#ifdef MENUQC - METHOD(GameItem, describe, string(GameItem this)) - { - TC(GameItem, this); - return SUPER(GameItem).describe(this); - } ++ METHOD(GameItem, describe, string(GameItem this)) ++ { ++ TC(GameItem, this); ++ return SUPER(GameItem).describe(this); ++ } +#endif - 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); } + #ifndef SVQC - METHOD(GameItem, display, void(entity this, void(string name, string icon) returns)) ++ 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) diff --cc qcsrc/common/mutators/mutator/buffs/buffs.qh index f18e688fbe,7e59976ee7..ea8f8a195d --- a/qcsrc/common/mutators/mutator/buffs/buffs.qh +++ b/qcsrc/common/mutators/mutator/buffs/buffs.qh @@@ -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) { diff --cc qcsrc/common/mutators/mutator/nades/nades.qh index ad27f8b0cf,b92da50f4a..71ddb8b7c0 --- a/qcsrc/common/mutators/mutator/nades/nades.qh +++ b/qcsrc/common/mutators/mutator/nades/nades.qh @@@ -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 diff --cc qcsrc/common/mutators/mutator/status_effects/all.qh index 7267330364,87f7f4992c..e4565e643c --- a/qcsrc/common/mutators/mutator/status_effects/all.qh +++ b/qcsrc/common/mutators/mutator/status_effects/all.qh @@@ -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 + #ifndef SVQC - METHOD(StatusEffect, display, void(entity this, void(string name, string icon) returns)) + 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) diff --cc qcsrc/common/weapons/weapon.qh index c24bfb96ae,095cdff571..f796ab5b59 --- a/qcsrc/common/weapons/weapon.qh +++ b/qcsrc/common/weapons/weapon.qh @@@ -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