enum
{
ITEM_FLAG_INSTAGIB = BIT(0), ///< Item is usable in instagib.
- ITEM_FLAG_MUTATORBLOCKED = BIT(1)
+ ITEM_FLAG_OVERKILL = BIT(1), ///< Item is usable in overkill.
+ ITEM_FLAG_MUTATORBLOCKED = BIT(2)
};
#define ITEM_HANDLE(signal, ...) __Item_Send_##signal(__VA_ARGS__)
REGISTER_ITEM(ArmorSmall, Armor) {
this.m_canonical_spawnfunc = "item_armor_small";
#ifdef GAMEQC
+ this.spawnflags = ITEM_FLAG_OVERKILL;
this.m_model = MDL_ArmorSmall_ITEM;
this.m_sound = SND_ArmorSmall;
#endif
REGISTER_ITEM(ArmorMedium, Armor) {
this.m_canonical_spawnfunc = "item_armor_medium";
#ifdef GAMEQC
+ this.spawnflags = ITEM_FLAG_OVERKILL;
this.m_model = MDL_ArmorMedium_ITEM;
this.m_sound = SND_ArmorMedium;
#endif
REGISTER_ITEM(ArmorBig, Armor) {
this.m_canonical_spawnfunc = "item_armor_big";
#ifdef GAMEQC
+ this.spawnflags = ITEM_FLAG_OVERKILL;
this.m_model = MDL_ArmorBig_ITEM;
this.m_sound = SND_ArmorBig;
#endif
REGISTER_ITEM(ArmorMega, Armor) {
this.m_canonical_spawnfunc = "item_armor_mega";
#ifdef GAMEQC
+ this.spawnflags = ITEM_FLAG_OVERKILL;
this.m_model = MDL_ArmorMega_ITEM;
this.m_sound = SND_ArmorMega;
#endif
REGISTER_ITEM(HealthMega, Health) {
this.m_canonical_spawnfunc = "item_health_mega";
#ifdef GAMEQC
+ this.spawnflags = ITEM_FLAG_OVERKILL;
this.m_model = MDL_HealthMega_ITEM;
this.m_sound = SND_HealthMega;
#endif
#endif
REGISTER_ITEM(VaporizerCells, Ammo) {
this.m_canonical_spawnfunc = "item_vaporizer_cells";
- this.spawnflags = ITEM_FLAG_INSTAGIB | ITEM_FLAG_MUTATORBLOCKED;
#ifdef GAMEQC
+ this.spawnflags = ITEM_FLAG_INSTAGIB | ITEM_FLAG_MUTATORBLOCKED;
this.m_model = MDL_VaporizerCells_ITEM;
this.m_sound = SND_VaporizerCells;
#endif
REGISTER_ITEM(ExtraLife, Powerup) {
this.m_canonical_spawnfunc = "item_extralife";
- this.spawnflags = ITEM_FLAG_INSTAGIB;
#ifdef GAMEQC
+ this.spawnflags = ITEM_FLAG_INSTAGIB;
this.m_model = MDL_ExtraLife_ITEM;
this.m_sound = SND_ExtraLife;
#endif
REGISTER_ITEM(Invisibility, Powerup) {
this.m_canonical_spawnfunc = "item_invisibility";
- this.spawnflags = ITEM_FLAG_INSTAGIB;
#ifdef GAMEQC
+ this.spawnflags = ITEM_FLAG_INSTAGIB;
this.m_model = MDL_Invisibility_ITEM;
this.m_sound = SND_Invisibility;
this.m_glow = true;
REGISTER_ITEM(Speed, Powerup) {
this.m_canonical_spawnfunc = "item_speed";
- this.spawnflags = ITEM_FLAG_INSTAGIB;
#ifdef GAMEQC
+ this.spawnflags = ITEM_FLAG_INSTAGIB;
this.m_model = MDL_Speed_ITEM;
this.m_sound = SND_Speed;
this.m_glow = true;
{
precache_all_playermodels("models/ok_player/*.dpm");
+ if (autocvar_g_overkill_filter_healthmega)
+ {
+ ITEM_HealthMega.spawnflags |= ITEM_FLAG_MUTATORBLOCKED;
+ }
+ if (autocvar_g_overkill_filter_armormedium)
+ {
+ ITEM_ArmorMedium.spawnflags |= ITEM_FLAG_MUTATORBLOCKED;
+ }
+ if (autocvar_g_overkill_filter_armorbig)
+ {
+ ITEM_ArmorBig.spawnflags |= ITEM_FLAG_MUTATORBLOCKED;
+ }
+ if (autocvar_g_overkill_filter_armormega)
+ {
+ ITEM_ArmorMega.spawnflags |= ITEM_FLAG_MUTATORBLOCKED;
+ }
+
WEP_RPC.spawnflags &= ~WEP_FLAG_MUTATORBLOCKED;
WEP_HMG.spawnflags &= ~WEP_FLAG_MUTATORBLOCKED;
MUTATOR_ONREMOVE
{
+ ITEM_HealthMega.spawnflags &= ~ITEM_FLAG_MUTATORBLOCKED;
+ ITEM_ArmorMedium.spawnflags &= ~ITEM_FLAG_MUTATORBLOCKED;
+ ITEM_ArmorBig.spawnflags &= ~ITEM_FLAG_MUTATORBLOCKED;
+ ITEM_ArmorMega.spawnflags &= ~ITEM_FLAG_MUTATORBLOCKED;
+
WEP_RPC.spawnflags |= WEP_FLAG_MUTATORBLOCKED;
WEP_HMG.spawnflags |= WEP_FLAG_MUTATORBLOCKED;
}
if(item.ok_item)
return false;
- switch(item.itemdef)
- {
- case ITEM_HealthMega: return autocvar_g_overkill_filter_healthmega;
- case ITEM_ArmorMedium: return autocvar_g_overkill_filter_armormedium;
- case ITEM_ArmorBig: return autocvar_g_overkill_filter_armorbig;
- case ITEM_ArmorMega: return autocvar_g_overkill_filter_armormega;
- }
-
return true;
}
string RandomItems_GetRandomItemClassNameWithProperty(string prefix,
.bool item_property);
-string RandomItems_GetItemVarName(string class_name);
-
//=========================== Public API ======================================
string RandomItems_GetRandomItemClassName(string prefix)
string RandomItems_GetRandomOverkillItemClassName(string prefix)
{
RandomSelection_Init();
- string varname;
- #define X(classname) MACRO_BEGIN \
- if ((varname = RandomItems_GetItemVarName(classname))) \
- { \
- RandomSelection_AddString( \
- classname, \
- cvar(sprintf("g_%s_overkill_%s_probability", prefix, varname)), \
- 1 \
- ); \
- } \
- MACRO_END
- X("item_health_mega");
- X("item_armor_small");
- X("item_armor_medium");
- X("item_armor_big");
- X("item_armor_mega");
- X("weapon_hmg");
- X("weapon_rpc");
- #undef X
+ FOREACH(Items, (it.spawnflags & ITEM_FLAG_OVERKILL) &&
+ !(it.spawnflags & ITEM_FLAG_MUTATORBLOCKED),
+ {
+ RandomSelection_AddString(it.m_canonical_spawnfunc,
+ cvar(sprintf("g_%s_overkill_%s_probability", prefix,
+ it.m_canonical_spawnfunc)), 1);
+ });
+ RandomSelection_AddString("weapon_hmg",
+ cvar(sprintf("g_%s_overkill_weapon_hmg_probability", prefix)), 1);
+ RandomSelection_AddString("weapon_rpc",
+ cvar(sprintf("g_%s_overkill_weapon_rpc_probability", prefix)), 1);
return RandomSelection_chosen_string;
}
//========================= Free functions ====================================
-string RandomItems_GetItemVarName(string class_name)
-{
- if (startsWith(class_name, "weapon_"))
- {
- FOREACH(Weapons, it.m_canonical_spawnfunc == class_name, {
- if (it.spawnflags & WEP_FLAG_MUTATORBLOCKED)
- {
- return "";
- }
- return class_name;
- });
- }
- switch (class_name)
- {
- #define XCOND(classname, expr) case #classname: if (expr) return #classname; else break
- XCOND(item_health_mega, !autocvar_g_overkill_filter_healthmega);
- case "item_armor_small": return "item_armor_small";
- XCOND(item_armor_medium, !autocvar_g_overkill_filter_armormedium);
- XCOND(item_armor_big, !autocvar_g_overkill_filter_armorbig);
- XCOND(item_armor_mega, !autocvar_g_overkill_filter_armormega);
- #undef XCOND
- }
- return "";
-}
-
/// \brief Returns list of classnames to replace a map item with.
/// \param[in] item Item to inspect.
/// \return List of classnames to replace a map item with.