#include "item/armor.qc"
#include "item/buff.qc"
#include "item/health.qc"
+#include "item/powerup.qc"
#define AMMO_H
#include "pickup.qh"
CLASS(Ammo, Pickup)
+#ifdef SVQC
+ ATTRIB(Ammo, m_pickupevalfunc, float(entity player, entity item), commodity_pickupevalfunc)
+#endif
ENDCLASS(Ammo)
#endif
#define ARMOR_H
#include "pickup.qh"
CLASS(Armor, Pickup)
+#ifdef SVQC
+ ATTRIB(Armor, m_pickupevalfunc, float(entity player, entity item), commodity_pickupevalfunc)
+#endif
ENDCLASS(Armor)
#endif
#define HEALTH_H
#include "pickup.qh"
CLASS(Health, Pickup)
+#ifdef SVQC
+ ATTRIB(Health, m_pickupevalfunc, float(entity player, entity item), commodity_pickupevalfunc)
+#endif
ENDCLASS(Health)
#endif
ATTRIB(Pickup, m_itemid, int, 0)
#ifdef SVQC
ATTRIB(Pickup, m_botvalue, int, 0)
+ ATTRIB(Pickup, m_itemflags, int, 0)
+ ATTRIB(Pickup, m_pickupevalfunc, float(entity player, entity item), generic_pickupevalfunc)
ATTRIB(Pickup, m_respawntime, int, 0)
ATTRIB(Pickup, m_respawntimejitter, int, 0)
#endif
--- /dev/null
+#include "powerup.qh"
+#include "../../../server/t_items.qh"
+
+#define WITH(it) this.m_##it;
+#define CONFIGURE(...) MAP(WITH, __VA_ARGS__)
+#define DEFINE(id, ...) \
+ REGISTER_ITEM(id, Ammo, LAMBDA( \
+ IF(SV, CONFIGURE \
+ , botvalue = 100000 \
+ , itemflags = FL_POWERUP \
+ , respawntime = g_pickup_respawntime_powerup \
+ , respawntimejitter = g_pickup_respawntimejitter_powerup \
+ ) \
+ MAP(IDENTITY, __VA_ARGS__) \
+ ))
+
+DEFINE(Strength
+ ,IF(ALL, CONFIGURE
+ , model = "models/items/g_strength.md3"
+ , sound = "misc/powerup.wav"
+ , name = "Strength Powerup"
+ , itemid = IT_STRENGTH
+ )
+)
+DEFINE(Shield
+ ,IF(ALL, CONFIGURE
+ , model = "models/items/g_invincible.md3"
+ , sound = "misc/powerup_shield.wav"
+ , name = "Shield"
+ , itemid = IT_INVINCIBLE
+ )
+)
+
+#undef WITH
+#undef CONFIGURE
+#undef DEFINE
--- /dev/null
+#ifndef POWERUP_H
+#define POWERUP_H
+#include "pickup.qh"
+CLASS(Powerup, Pickup)
+ENDCLASS(Powerup)
+
+#ifdef SVQC
+// For FL_POWERUP
+#include "../../../server/constants.qh"
+#endif
+
+#endif
void StartItemA (entity a)
{
- StartItem(a.m_model, a.m_sound, a.m_respawntime, a.m_respawntimejitter, a.m_name, a.m_itemid, 0, 0, commodity_pickupevalfunc, a.m_botvalue);
+ StartItem(a.m_model, a.m_sound, a.m_respawntime, a.m_respawntimejitter, a.m_name, a.m_itemid, 0, a.m_itemflags, a.m_pickupevalfunc, a.m_botvalue);
}
void spawnfunc_item_rockets (void) {
precache_sound("weapons/strength_fire.wav");
if(!self.strength_finished)
self.strength_finished = autocvar_g_balance_powerup_strength_time;
- StartItem ("models/items/g_strength.md3", "misc/powerup.wav", g_pickup_respawntime_powerup, g_pickup_respawntimejitter_powerup, "Strength Powerup", IT_STRENGTH, 0, FL_POWERUP, generic_pickupevalfunc, 100000);
+ StartItemA (ITEM_Strength);
}
void spawnfunc_item_invincible (void) {
if(!self.invincible_finished)
self.invincible_finished = autocvar_g_balance_powerup_invincible_time;
- StartItem ("models/items/g_invincible.md3", "misc/powerup_shield.wav", g_pickup_respawntime_powerup, g_pickup_respawntimejitter_powerup, "Shield", IT_INVINCIBLE, 0, FL_POWERUP, generic_pickupevalfunc, 100000);
+ StartItemA (ITEM_Shield);
}
// compatibility: