Skip to content

Menu refactor, automatic handling of additional CVar bitfields

Refactor the MENUDEF and partial refactor of the item replacement code. Added automatic handling of additional bitfields, with 32 items per bitfield (eg pepper_weaponspawns_1, pepper_weaponspawns_2, etc).

This should simplify adding weapons and ammo types in the future.

MENUDEF entries for new weapons are now formatted like: PepperWeapon "Zip50AE", 32 instead of: PepperSpawnOption "Zip50AE", "pepper_weaponspawns_1", "YesNo", 32

Similar changes for ammo menu entries. It is unnecessary to refer to different CVars for more weapon entries, and values over 31 are automatically rolled into the next CVar.

Enable All and Disable All commands in the menu no longer require manually updating WeaponCount and AmmoCount in eventhandler.zsc to accurately set all the weapon and ammo bits.

WSF_* and ASF_* are no longer bitmasks, now just referring to the bit index to be shifted later. This allows adding entries to the enum without worrying about setting a value, and having the last entry, WSF_MAX and ASF_MAX indicate the number of total entries. This makes WeaponCount and AmmoCount un-needed.

Additional minor fixes that happened as a result of the refactor:

  • Fixed pepper_weaponspawns_1 CVar description being set to "Otis-5" just because it was the first menu entry set.
  • Fixed Killer7 .500 Magnum Magazines not being enabled and disabled with "Enable All" and "Disable All" in the menu.

Merge request reports