weapon_info[id - 1] = e = spawn();
e.classname = "weapon_info";
e.weapon = id;
- e.weapons = power2of(id - WEP_FIRST);
+ WEPSET_COPY_EW(e, id);
e.netname = shortname;
e.message = wname;
e.items = ammotype;
dummy_weapon_info = spawn();
dummy_weapon_info.classname = "weapon_info";
dummy_weapon_info.weapon = 0; // you can recognize dummies by this
- dummy_weapon_info.weapons = 0; // you can recognize dummies by this too
+ WEPSET_CLEAR_E(dummy_weapon_info);
dummy_weapon_info.netname = "";
dummy_weapon_info.message = "@!#%'n Tuba";
dummy_weapon_info.items = 0;
return W_FixWeaponOrder(order, 1);
}
+void W_RandomWeapons(entity e, float n)
+{
+ float i, j;
+ WEPSET_DECLARE_A(remaining);
+ WEPSET_DECLARE_A(result);
+ WEPSET_COPY_AE(remaining, e);
+ WEPSET_CLEAR_A(result);
+ for(i = 0; i < n; ++i)
+ {
+ RandomSelection_Init();
+ for(j = WEP_FIRST; j <= WEP_LAST; ++j)
+ if(WEPSET_CONTAINS_AW(remaining, j))
+ RandomSelection_Add(world, j, string_null, 1, 1);
+ WEPSET_OR_AW(result, RandomSelection_chosen_float);
+ WEPSET_ANDNOT_AW(remaining, RandomSelection_chosen_float);
+ }
+ WEPSET_COPY_EA(e, result);
+}