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);
+#endif
+
#define ITEM_HANDLE(signal, ...) __Item_Send_##signal(__VA_ARGS__)
CLASS(GameItem, Object)
ATTRIB(GameItem, m_id, int, 0);
MODEL(Bullets_ITEM, Item_Model("a_bullets.mdl"));
#endif
+#ifdef SVQC
+PROPERTY(int, g_pickup_nails);
+void ammo_bullets_init(entity item)
+{
+ if(!item.ammo_nails)
+ item.ammo_nails = g_pickup_nails;
+}
+#endif
REGISTER_ITEM(Bullets, Ammo) {
#ifdef GAMEQC
this.m_model = MDL_Bullets_ITEM;
#ifdef SVQC
this.m_botvalue = 1500;
this.m_itemid = IT_NAILS;
+ this.m_iteminit = ammo_bullets_init;
#endif
}
MODEL(Cells_ITEM, Item_Model("a_cells.md3"));
#endif
+#ifdef SVQC
+PROPERTY(int, g_pickup_cells);
+void ammo_cells_init(entity item)
+{
+ if(!item.ammo_cells)
+ item.ammo_cells = g_pickup_cells;
+}
+#endif
REGISTER_ITEM(Cells, Ammo) {
#ifdef GAMEQC
this.m_model = MDL_Cells_ITEM;
#ifdef SVQC
this.m_botvalue = 1500;
this.m_itemid = IT_CELLS;
+ this.m_iteminit = ammo_cells_init;
#endif
}
MODEL(Plasma_ITEM, Item_Model("a_cells.md3"));
#endif
+#ifdef SVQC
+PROPERTY(int, g_pickup_plasma);
+void ammo_plasma_init(entity item)
+{
+ if(!item.ammo_plasma)
+ item.ammo_plasma = g_pickup_plasma;
+}
+#endif
REGISTER_ITEM(Plasma, Ammo) {
#ifdef GAMEQC
this.m_model = MDL_Plasma_ITEM;
#ifdef SVQC
this.m_botvalue = 1500;
this.m_itemid = IT_PLASMA;
+ this.m_iteminit = ammo_plasma_init;
#endif
}
MODEL(Rockets_ITEM, Item_Model("a_rockets.md3"));
#endif
+#ifdef SVQC
+PROPERTY(int, g_pickup_rockets);
+void ammo_rockets_init(entity item)
+{
+ if(!item.ammo_rockets)
+ item.ammo_rockets = g_pickup_rockets;
+}
+#endif
REGISTER_ITEM(Rockets, Ammo) {
#ifdef GAMEQC
this.m_model = MDL_Rockets_ITEM;
#ifdef SVQC
this.m_botvalue = 1500;
this.m_itemid = IT_ROCKETS;
+ this.m_iteminit = ammo_rockets_init;
#endif
}
MODEL(Shells_ITEM, Item_Model("a_shells.md3"));
#endif
+#ifdef SVQC
+PROPERTY(int, g_pickup_shells);
+void ammo_shells_init(entity item)
+{
+ if(!item.ammo_shells)
+ item.ammo_shells = g_pickup_shells;
+}
+#endif
REGISTER_ITEM(Shells, Ammo) {
#ifdef GAMEQC
this.m_model = MDL_Shells_ITEM;
#ifdef SVQC
this.m_botvalue = 1000;
this.m_itemid = IT_SHELLS;
+ this.m_iteminit = ammo_shells_init;
#endif
}
#endif
#ifdef SVQC
PROPERTY(float, g_pickup_armorsmall_anyway);
+PROPERTY(int, g_pickup_armorsmall);
+PROPERTY(int, g_pickup_armorsmall_max);
+void item_armorsmall_init(entity item)
+{
+ if(!item.max_armorvalue)
+ item.max_armorvalue = g_pickup_armorsmall_max;
+ if(!item.armorvalue)
+ item.armorvalue = g_pickup_armorsmall;
+}
#endif
REGISTER_ITEM(ArmorSmall, Armor) {
this.m_respawntime = GET(g_pickup_respawntime_short);
this.m_respawntimejitter = GET(g_pickup_respawntimejitter_short);
this.m_pickupanyway = GET(g_pickup_armorsmall_anyway);
+ this.m_iteminit = item_armorsmall_init;
#endif
}
#endif
#ifdef SVQC
PROPERTY(float, g_pickup_armormedium_anyway);
+PROPERTY(int, g_pickup_armormedium);
+PROPERTY(int, g_pickup_armormedium_max);
+void item_armormedium_init(entity item)
+{
+ if(!item.max_armorvalue)
+ item.max_armorvalue = g_pickup_armormedium_max;
+ if(!item.armorvalue)
+ item.armorvalue = g_pickup_armormedium;
+}
#endif
REGISTER_ITEM(ArmorMedium, Armor) {
this.m_respawntime = GET(g_pickup_respawntime_medium);
this.m_respawntimejitter = GET(g_pickup_respawntimejitter_medium);
this.m_pickupanyway = GET(g_pickup_armormedium_anyway);
+ this.m_iteminit = item_armormedium_init;
#endif
}
#endif
#ifdef SVQC
PROPERTY(float, g_pickup_armorbig_anyway);
+PROPERTY(int, g_pickup_armorbig);
+PROPERTY(int, g_pickup_armorbig_max);
+void item_armorbig_init(entity item)
+{
+ if(!item.max_armorvalue)
+ item.max_armorvalue = g_pickup_armorbig_max;
+ if(!item.armorvalue)
+ item.armorvalue = g_pickup_armorbig;
+}
#endif
REGISTER_ITEM(ArmorBig, Armor) {
this.m_respawntime = GET(g_pickup_respawntime_long);
this.m_respawntimejitter = GET(g_pickup_respawntimejitter_long);
this.m_pickupanyway = GET(g_pickup_armorbig_anyway);
+ this.m_iteminit = item_armorbig_init;
#endif
}
#endif
#ifdef SVQC
PROPERTY(float, g_pickup_armormega_anyway);
+PROPERTY(int, g_pickup_armormega);
+PROPERTY(int, g_pickup_armormega_max);
+void item_armormega_init(entity item)
+{
+ if(!item.max_armorvalue)
+ item.max_armorvalue = g_pickup_armormega_max;
+ if(!item.armorvalue)
+ item.armorvalue = g_pickup_armormega;
+}
#endif
REGISTER_ITEM(ArmorMega, Armor) {
this.m_respawntime = GET(g_pickup_respawntime_long);
this.m_respawntimejitter = GET(g_pickup_respawntimejitter_long);
this.m_pickupanyway = GET(g_pickup_armormega_anyway);
+ this.m_iteminit = item_armormega_init;
#endif
}
#endif
#ifdef SVQC
PROPERTY(float, g_pickup_healthsmall_anyway);
+PROPERTY(int, g_pickup_healthsmall);
+PROPERTY(int, g_pickup_healthsmall_max);
+void item_healthsmall_init(entity item)
+{
+ if(!item.max_health)
+ item.max_health = g_pickup_healthsmall_max;
+ if(!item.health)
+ item.health = g_pickup_healthsmall;
+}
#endif
REGISTER_ITEM(HealthSmall, Health) {
this.m_respawntime = GET(g_pickup_respawntime_short);
this.m_respawntimejitter = GET(g_pickup_respawntimejitter_short);
this.m_pickupanyway = GET(g_pickup_healthsmall_anyway);
+ this.m_iteminit = item_healthsmall_init;
#endif
}
#endif
#ifdef SVQC
PROPERTY(float, g_pickup_healthmedium_anyway);
+PROPERTY(int, g_pickup_healthmedium);
+PROPERTY(int, g_pickup_healthmedium_max);
+void item_healthmedium_init(entity item)
+{
+ if(!item.max_health)
+ item.max_health = g_pickup_healthmedium_max;
+ if(!item.health)
+ item.health = g_pickup_healthmedium;
+}
#endif
REGISTER_ITEM(HealthMedium, Health) {
this.m_respawntime = GET(g_pickup_respawntime_short);
this.m_respawntimejitter = GET(g_pickup_respawntimejitter_short);
this.m_pickupanyway = GET(g_pickup_healthmedium_anyway);
+ this.m_iteminit = item_healthmedium_init;
#endif
}
#endif
#ifdef SVQC
PROPERTY(float, g_pickup_healthbig_anyway);
+PROPERTY(int, g_pickup_healthbig);
+PROPERTY(int, g_pickup_healthbig_max);
+void item_healthbig_init(entity item)
+{
+ if(!item.max_health)
+ item.max_health = g_pickup_healthbig_max;
+ if(!item.health)
+ item.health = g_pickup_healthbig;
+}
#endif
REGISTER_ITEM(HealthBig, Health) {
this.m_respawntime = GET(g_pickup_respawntime_medium);
this.m_respawntimejitter = GET(g_pickup_respawntimejitter_medium);
this.m_pickupanyway = GET(g_pickup_healthbig_anyway);
+ this.m_iteminit = item_healthbig_init;
#endif
}
#endif
#ifdef SVQC
PROPERTY(float, g_pickup_healthmega_anyway);
+PROPERTY(int, g_pickup_healthmega);
+PROPERTY(int, g_pickup_healthmega_max);
+void item_healthmega_init(entity item)
+{
+ if(!item.max_health)
+ item.max_health = g_pickup_healthmega_max;
+ if(!item.health)
+ item.health = g_pickup_healthmega;
+}
#endif
REGISTER_ITEM(HealthMega, Health) {
this.m_respawntime = GET(g_pickup_respawntime_long);
this.m_respawntimejitter = GET(g_pickup_respawntimejitter_long);
this.m_pickupanyway = GET(g_pickup_healthmega_anyway);
+ this.m_iteminit = item_healthmega_init;
#endif
}
MODEL(Jetpack_ITEM, Item_Model("g_jetpack.md3"));
#endif
+#ifdef SVQC
+PROPERTY(int, g_pickup_fuel_jetpack);
+void powerup_jetpack_init(entity item)
+{
+ if(!item.ammo_fuel)
+ item.ammo_fuel = g_pickup_fuel_jetpack;
+}
+#endif
REGISTER_ITEM(Jetpack, Powerup) {
#ifdef GAMEQC
this.m_model = MDL_Jetpack_ITEM;
#ifdef SVQC
this.m_botvalue = 3000;
this.m_pickupevalfunc = ammo_pickupevalfunc;
+ this.m_iteminit = powerup_jetpack_init;
#endif
}
MODEL(JetpackFuel_ITEM, Item_Model("g_fuel.md3"));
#endif
+#ifdef SVQC
+PROPERTY(int, g_pickup_fuel);
+void ammo_fuel_init(entity item)
+{
+ if(!item.ammo_fuel)
+ item.ammo_fuel = g_pickup_fuel;
+}
+#endif
REGISTER_ITEM(JetpackFuel, Ammo) {
#ifdef GAMEQC
this.m_model = MDL_JetpackFuel_ITEM;
#ifdef SVQC
this.m_botvalue = 2000;
this.m_itemid = IT_FUEL;
+ this.m_iteminit = ammo_fuel_init;
#endif
}
ATTRIB(Pickup, m_respawntime, float());
ATTRIB(Pickup, m_respawntimejitter, float());
ATTRIB(Pickup, m_pickupanyway, float());
+ ATTRIB(Pickup, m_iteminit, void(entity item));
float Item_GiveTo(entity item, entity player);
METHOD(Pickup, giveTo, bool(Pickup this, entity item, entity player))
{
SOUND(Strength, Item_Sound("powerup"));
#endif
+#ifdef SVQC
+float autocvar_g_balance_powerup_strength_time;
+void powerup_strength_init(entity item)
+{
+ if(!item.strength_finished)
+ item.strength_finished = autocvar_g_balance_powerup_strength_time;
+}
+#endif
REGISTER_ITEM(Strength, Powerup) {
#ifdef GAMEQC
this.m_model = MDL_Strength_ITEM;
this.m_waypoint = _("Strength");
this.m_waypointblink = 2;
this.m_itemid = IT_STRENGTH;
+#ifdef SVQC
+ this.m_iteminit = powerup_strength_init;
+#endif
}
#ifdef GAMEQC
SOUND(Shield, Item_Sound("powerup_shield"));
#endif
+#ifdef SVQC
+float autocvar_g_balance_powerup_invincible_time;
+void powerup_shield_init(entity item)
+{
+ if(!item.invincible_finished)
+ item.invincible_finished = autocvar_g_balance_powerup_invincible_time;
+}
+#endif
REGISTER_ITEM(Shield, Powerup) {
#ifdef GAMEQC
this.m_model = MDL_Shield_ITEM;
this.m_waypoint = _("Shield");
this.m_waypointblink = 2;
this.m_itemid = IT_INVINCIBLE;
+#ifdef SVQC
+ this.m_iteminit = powerup_shield_init;
+#endif
}
SOUND(VaporizerCells, Item_Sound("itempickup"));
#endif
+#ifdef SVQC
+int autocvar_g_instagib_ammo_drop;
+void ammo_vaporizercells_init(entity item)
+{
+ if(!item.ammo_cells)
+ item.ammo_cells = autocvar_g_instagib_ammo_drop;
+}
+#endif
REGISTER_ITEM(VaporizerCells, Ammo) {
#ifdef GAMEQC
this.m_model = MDL_VaporizerCells_ITEM;
this.m_itemid = IT_CELLS;
this.m_respawntime = GET(instagib_respawntime_ammo);
this.m_respawntimejitter = GET(instagib_respawntimejitter_ammo);
+ this.m_iteminit = ammo_vaporizercells_init;
#endif
}
#include "sv_instagib.qh"
-int autocvar_g_instagib_ammo_drop;
+//int autocvar_g_instagib_ammo_drop;
bool autocvar_g_instagib_ammo_convert_cells;
bool autocvar_g_instagib_ammo_convert_rockets;
bool autocvar_g_instagib_ammo_convert_shells;
spawnfunc(item_minst_cells)
{
if (!g_instagib) { delete(this); return; }
- if (!this.ammo_cells) this.ammo_cells = autocvar_g_instagib_ammo_drop;
StartItem(this, ITEM_VaporizerCells);
}
this.item_model_ent = itemmodel;
this.item_pickupsound_ent = pickupsound;
+ if(def.m_iteminit)
+ def.m_iteminit(this);
+
if(!this.respawntime) // both need to be set
{
this.respawntime = defaultrespawntime;
spawnfunc(item_rockets)
{
- if(!this.ammo_rockets)
- this.ammo_rockets = g_pickup_rockets;
StartItem(this, ITEM_Rockets);
}
return;
}
- if(!this.ammo_nails)
- this.ammo_nails = g_pickup_nails;
StartItem(this, ITEM_Bullets);
}
spawnfunc(item_cells)
{
- if(!this.ammo_cells)
- this.ammo_cells = g_pickup_cells;
StartItem(this, ITEM_Cells);
}
spawnfunc(item_plasma)
{
- if(!this.ammo_plasma)
- this.ammo_plasma = g_pickup_plasma;
StartItem(this, ITEM_Plasma);
}
return;
}
- if(!this.ammo_shells)
- this.ammo_shells = g_pickup_shells;
StartItem(this, ITEM_Shells);
}
spawnfunc(item_armor_small)
{
- if(!this.armorvalue)
- this.armorvalue = g_pickup_armorsmall;
- if(!this.max_armorvalue)
- this.max_armorvalue = g_pickup_armorsmall_max;
StartItem(this, ITEM_ArmorSmall);
}
spawnfunc(item_armor_medium)
{
- if(!this.armorvalue)
- this.armorvalue = g_pickup_armormedium;
- if(!this.max_armorvalue)
- this.max_armorvalue = g_pickup_armormedium_max;
StartItem(this, ITEM_ArmorMedium);
}
spawnfunc(item_armor_big)
{
- if(!this.armorvalue)
- this.armorvalue = g_pickup_armorbig;
- if(!this.max_armorvalue)
- this.max_armorvalue = g_pickup_armorbig_max;
StartItem(this, ITEM_ArmorBig);
}
spawnfunc(item_armor_mega)
{
- if(!this.armorvalue)
- this.armorvalue = g_pickup_armormega;
- if(!this.max_armorvalue)
- this.max_armorvalue = g_pickup_armormega_max;
StartItem(this, ITEM_ArmorMega);
}
spawnfunc(item_health_small)
{
- if(!this.max_health)
- this.max_health = g_pickup_healthsmall_max;
- if(!this.health)
- this.health = g_pickup_healthsmall;
StartItem(this, ITEM_HealthSmall);
}
spawnfunc(item_health_medium)
{
- if(!this.max_health)
- this.max_health = g_pickup_healthmedium_max;
- if(!this.health)
- this.health = g_pickup_healthmedium;
StartItem(this, ITEM_HealthMedium);
}
spawnfunc(item_health_big)
{
- if(!this.max_health)
- this.max_health = g_pickup_healthbig_max;
- if(!this.health)
- this.health = g_pickup_healthbig;
StartItem(this, ITEM_HealthBig);
}
spawnfunc(item_health_mega)
{
- if(!this.max_health)
- this.max_health = g_pickup_healthmega_max;
- if(!this.health)
- this.health = g_pickup_healthmega;
StartItem(this, ITEM_HealthMega);
}
spawnfunc(item_strength)
{
- if(!this.strength_finished)
- this.strength_finished = autocvar_g_balance_powerup_strength_time;
- StartItem(this, ITEM_Strength);
+ StartItem(this, ITEM_Strength);
}
spawnfunc(item_invincible)
{
- if(!this.invincible_finished)
- this.invincible_finished = autocvar_g_balance_powerup_invincible_time;
- StartItem(this, ITEM_Shield);
+ StartItem(this, ITEM_Shield);
}
// compatibility:
spawnfunc(item_fuel)
{
- if(!this.ammo_fuel)
- this.ammo_fuel = g_pickup_fuel;
StartItem(this, ITEM_JetpackFuel);
}
spawnfunc(item_jetpack)
{
- if(!this.ammo_fuel)
- this.ammo_fuel = g_pickup_fuel_jetpack;
if(start_items & ITEM_Jetpack.m_itemid)
{
spawnfunc_item_fuel(this);
float autocvar_g_balance_portal_health;
float autocvar_g_balance_portal_lifetime;
float autocvar_g_balance_powerup_invincible_takedamage;
-float autocvar_g_balance_powerup_invincible_time;
+//float autocvar_g_balance_powerup_invincible_time;
float autocvar_g_balance_powerup_strength_damage;
float autocvar_g_balance_powerup_strength_force;
float autocvar_g_balance_powerup_strength_selfdamage;
float autocvar_g_balance_powerup_strength_selfforce;
-float autocvar_g_balance_powerup_strength_time;
+//float autocvar_g_balance_powerup_strength_time;
float autocvar_g_balance_superweapons_time;
float autocvar_g_balance_selfdamagepercent;
bool autocvar_g_balance_teams;
.float pain_frame; //"
.float crouch; // Crouching or not?
-.float strength_finished = _STAT(STRENGTH_FINISHED);
-.float invincible_finished = _STAT(INVINCIBLE_FINISHED);
.float superweapons_finished = _STAT(SUPERWEAPONS_FINISHED);
.float cnt; // used in too many places
//#NO AUTOCVARS START
-float g_pickup_shells;
float g_pickup_shells_max;
-float g_pickup_nails;
float g_pickup_nails_max;
-float g_pickup_rockets;
float g_pickup_rockets_max;
-float g_pickup_cells;
float g_pickup_cells_max;
-float g_pickup_plasma;
float g_pickup_plasma_max;
-float g_pickup_fuel;
-float g_pickup_fuel_jetpack;
float g_pickup_fuel_max;
-float g_pickup_armorsmall;
-float g_pickup_armorsmall_max;
-float g_pickup_armormedium;
-float g_pickup_armormedium_max;
-float g_pickup_armorbig;
-float g_pickup_armorbig_max;
-float g_pickup_armormega;
-float g_pickup_armormega_max;
-float g_pickup_healthsmall;
-float g_pickup_healthsmall_max;
-float g_pickup_healthmedium;
-float g_pickup_healthmedium_max;
-float g_pickup_healthbig;
-float g_pickup_healthbig_max;
-float g_pickup_healthmega;
-float g_pickup_healthmega_max;
float g_pickup_weapons_anyway;
float g_weaponarena;
WepSet g_weaponarena_weapons;