#define PICKUP_H
#include "../item.qh"
CLASS(Pickup, GameItem)
- METHOD(Pickup, respondTo, bool(entity, int))
ATTRIB(Pickup, m_model, string, string_null)
- ATTRIB(Pickup, m_sound, string, string_null)
+ ATTRIB(Pickup, m_sound, string, "misc/itempickup.wav")
ATTRIB(Pickup, m_name, string, string_null)
- ATTRIB(Pickup, m_itemid, int, 0)
+ METHOD(Pickup, show, void(entity this))
+ void Pickup_show(entity this) { printf("%s: %s\n", etos(this), this.m_name); }
#ifdef SVQC
ATTRIB(Pickup, m_botvalue, int, 0)
- ATTRIB(Pickup, m_respawntime, int, 0)
- ATTRIB(Pickup, m_respawntimejitter, int, 0)
+ ATTRIB(Pickup, m_itemflags, int, 0)
+ ATTRIB(Pickup, m_itemid, int, 0)
+ ATTRIB(Pickup, m_pickupevalfunc, float(entity player, entity item), generic_pickupevalfunc)
+ ATTRIB(Pickup, m_respawntime, float(), func_null)
+ ATTRIB(Pickup, m_respawntimejitter, float(), func_null)
+ METHOD(Pickup, giveTo, bool(entity this, entity item, entity player))
+ bool Pickup_giveTo(entity this, entity item, entity player) { return Item_GiveTo(item, player); }
+ bool ITEM_HANDLE(Pickup, entity this, entity item, entity player);
#endif
ENDCLASS(Pickup)
-#define SPAWNTIMES(_) \
- _(WEAPON, weapon) \
- _(AMMO, ammo) \
- _(SHORT, short) \
- _(MEDIUM, medium) \
- _(LONG, long) \
- /**/
-
-#define SPAWNTIMES_ENUM(id, idlc) SPAWNTIME_##id ,
-enum { SPAWNTIMES(SPAWNTIMES_ENUM) };
-#undef SPAWNTIMES_ENUM
-
#ifdef SVQC
+// For g_pickup_respawntime
#include "../../../server/defs.qh"
+// Getters to dynamically retrieve the values of g_pickup_respawntime*
+GETTER(float, g_pickup_respawntime_weapon)
+GETTER(float, g_pickup_respawntime_superweapon)
+GETTER(float, g_pickup_respawntime_ammo)
+GETTER(float, g_pickup_respawntime_short)
+GETTER(float, g_pickup_respawntime_medium)
+GETTER(float, g_pickup_respawntime_long)
+GETTER(float, g_pickup_respawntime_powerup)
+GETTER(float, g_pickup_respawntimejitter_weapon)
+GETTER(float, g_pickup_respawntimejitter_superweapon)
+GETTER(float, g_pickup_respawntimejitter_ammo)
+GETTER(float, g_pickup_respawntimejitter_short)
+GETTER(float, g_pickup_respawntimejitter_medium)
+GETTER(float, g_pickup_respawntimejitter_long)
+GETTER(float, g_pickup_respawntimejitter_powerup)
-#define SPAWNTIMES_MAP(id, idlc) i == SPAWNTIME_##id ? g_pickup_respawntime_##idlc :
-[[inline]] int spawntime(int i) { return SPAWNTIMES(SPAWNTIMES_MAP) 0; }
-#undef SPAWNTIMES_MAP
-
-#define SPAWNTIMES_MAP(id, idlc) i == SPAWNTIME_##id ? g_pickup_respawntimejitter_##idlc :
-[[inline]] int spawntimejitter(int i) { return SPAWNTIMES(SPAWNTIMES_MAP) 0; }
-#undef SPAWNTIMES_MAP
#endif
-bool Pickup_respondTo(entity this, int request)
-{
- switch (request) {
- default: return false;
- case ITEM_SIGNAL(Default):
- print(strcat(this.m_name, " responding\n"));
- return true;
- }
-}
-
#endif