X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fitems%2Fitem.qh;h=b7fc933e8b5dbaf35dde8a37fca1762c51a4e08a;hb=b945d959784e5b249c66aea4f3326d8ae048f1cd;hp=ed33169fcdb2b7e97714fb8fe9b3737e08d88e47;hpb=6585b5a8ef2ce4ee66826df826a6c759bd815cb8;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/items/item.qh b/qcsrc/common/items/item.qh index ed33169fc..b7fc933e8 100644 --- a/qcsrc/common/items/item.qh +++ b/qcsrc/common/items/item.qh @@ -1,5 +1,12 @@ #pragma once +#ifdef GAMEQC +#include +#include +#include +#include +#endif + const int IT_UNLIMITED_WEAPON_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. @@ -33,18 +40,45 @@ const int IT_SUPERWEAPON = BIT(21); // suit const int IT_STRENGTH = BIT(22); // item masks -const int IT_AMMO = IT_FUEL | IT_SHELLS | IT_NAILS | IT_ROCKETS | IT_CELLS | IT_PLASMA; const int IT_UNLIMITED_AMMO = IT_UNLIMITED_WEAPON_AMMO | IT_UNLIMITED_SUPERWEAPONS; const int IT_PICKUPMASK = IT_UNLIMITED_AMMO | IT_JETPACK | IT_FUEL_REGEN; // strength and invincible are handled separately +#ifdef SVQC +.float strength_finished = _STAT(STRENGTH_FINISHED); +.float invincible_finished = _STAT(INVINCIBLE_FINISHED); + +#define SPAWNFUNC_ITEM(name, item) \ + spawnfunc(name) { StartItem(this, item); } + +#else + +#define SPAWNFUNC_ITEM(name, item) + +#endif + +enum +{ + ITEM_FLAG_NORMAL = BIT(0), ///< Item is usable during normal gameplay. + ITEM_FLAG_INSTAGIB = BIT(1), ///< Item is usable in instagib. + ITEM_FLAG_OVERKILL = BIT(2), ///< Item is usable in overkill. + ITEM_FLAG_MUTATORBLOCKED = BIT(3) +}; + #define ITEM_HANDLE(signal, ...) __Item_Send_##signal(__VA_ARGS__) 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) + 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); +#endif METHOD(GameItem, display, void(GameItem this, void(string name, string icon) returns)) { TC(GameItem, this); @@ -53,7 +87,7 @@ CLASS(GameItem, Object) METHOD(GameItem, show, void(GameItem this)) { TC(GameItem, this); - LOG_INFO("A game item\n"); + LOG_INFO("A game item"); } void ITEM_HANDLE(Show, GameItem this) { this.show(this); } ENDCLASS(GameItem)