#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.
#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)
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) {
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
/** 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)
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