void register_weapons_done();
#if 1
-# define WEPBITS_CLEAR_E(e) ((e).weapons = 0)
-# define WEPBITS_CLEAR_A(a) ((a) = 0)
-
-# define WEPBITS_COPY_EE(e,e2) ((e).weapons = (e2).weapons)
-# define WEPBITS_EQ_EE(e,e2) ((e).weapons == (e2).weapons)
-# define WEPBITS_OR_EE(e,e2) ((e).weapons |= (e2).weapons)
-# define WEPBITS_AND_EE(e,e2) ((e).weapons &= (e2).weapons)
-# define WEPBITS_ANDNOT_EE(e,e2) ((e).weapons &~= (e2).weapons)
-# define WEPBITS_TEST_EE(e,e2) ((e).weapons & (e2).weapons)
-
-# define WEPBITS_COPY_EA(e,a) ((e).weapons = (a))
-# define WEPBITS_EQ_EA(e,a) ((e).weapons == (a))
-# define WEPBITS_OR_EA(e,a) ((e).weapons |= (a))
-# define WEPBITS_AND_EA(e,a) ((e).weapons &= (a))
-# define WEPBITS_ANDNOT_EA(e,a) ((e).weapons &~= (a))
-# define WEPBITS_TEST_EA(e,a) ((e).weapons & (a))
-
-# define WEPBITS_COPY_AA(a,a2) ((a) = (a2))
-# define WEPBITS_EQ_AA(a,a2) ((a) == (a2))
-# define WEPBITS_OR_AA(a,a2) ((a) |= (a2))
-# define WEPBITS_AND_AA(a,a2) ((a) &= (a2))
-# define WEPBITS_ANDNOT_AA(a,a2) ((a) &~= (a2))
-# define WEPBITS_TEST_AA(a,a2) ((a) & (a2))
-
-# define WEPBITS_COPY_EW(e,w) ((e).weapons = power2of((w) - WEP_FIRST))
-# define WEPBITS_EQ_EW(e,w) ((e).weapons == power2of((w) - WEP_FIRST))
-# define WEPBITS_OR_EW(e,w) ((e).weapons |= power2of((w) - WEP_FIRST))
-# define WEPBITS_AND_EW(e,w) ((e).weapons &= power2of((w) - WEP_FIRST))
-# define WEPBITS_ANDNOT_EW(e,w) ((e).weapons &~= power2of((w) - WEP_FIRST))
-# define WEPBITS_TEST_EW(e,w) ((e).weapons & power2of((w) - WEP_FIRST))
-
-# define WEPBITS_COPY_AW(a,w) ((a) = power2of((w) - WEP_FIRST))
-# define WEPBITS_EQ_AW(a,w) ((a) == power2of((w) - WEP_FIRST))
-# define WEPBITS_OR_AW(a,w) ((a) |= power2of((w) - WEP_FIRST))
-# define WEPBITS_AND_AW(a,w) ((a) &= power2of((w) - WEP_FIRST))
-# define WEPBITS_ANDNOT_AW(a,w) ((a) &~= power2of((w) - WEP_FIRST))
-# define WEPBITS_TEST_AW(a,w) ((a) & power2of((w) - WEP_FIRST))
+# define WEPSET_CLEAR_E(e) ((e).weapons = 0)
+# define WEPSET_CLEAR_A(a) ((a) = 0)
+
+# define WEPSET_EMPTY_E(e) ((e).weapons == 0)
+# define WEPSET_EMPTY_A(a) ((a) == 0)
+
+# define WEPSET_COPY_EE(e,o) ((e).weapons = (o).weapons)
+# define WEPSET_EQ_EE(e,o) ((e).weapons == (o).weapons)
+# define WEPSET_OR_EE(e,o) ((e).weapons |= (o).weapons)
+# define WEPSET_AND_EE(e,o) ((e).weapons &= (o).weapons)
+# define WEPSET_ANDNOT_EE(e,o) ((e).weapons &~= (o).weapons)
+# define WEPSET_TEST_EE(e,o) ((e).weapons & (o).weapons)
+# define WEPSET_CONTAINS_EE(e,o) (((e).weapons & (o).weapons) == (e).weapons)
+
+# define WEPSET_COPY_EA(e,a) ((e).weapons = (a))
+# define WEPSET_EQ_EA(e,a) ((e).weapons == (a))
+# define WEPSET_OR_EA(e,a) ((e).weapons |= (a))
+# define WEPSET_AND_EA(e,a) ((e).weapons &= (a))
+# define WEPSET_ANDNOT_EA(e,a) ((e).weapons &~= (a))
+# define WEPSET_TEST_EA(e,a) ((e).weapons & (a))
+# define WEPSET_CONTAINS_EA(e,a) (((e).weapons & (a)) == (a))
+
+# define WEPSET_COPY_EW(e,w) ((e).weapons = power2of((w) - WEP_FIRST))
+# define WEPSET_EQ_EW(e,w) ((e).weapons == power2of((w) - WEP_FIRST))
+# define WEPSET_OR_EW(e,w) ((e).weapons |= power2of((w) - WEP_FIRST))
+# define WEPSET_AND_EW(e,w) ((e).weapons &= power2of((w) - WEP_FIRST))
+# define WEPSET_ANDNOT_EW(e,w) ((e).weapons &~= power2of((w) - WEP_FIRST))
+// no TEST necessary here, CONTAINS does the same
+# define WEPSET_TEST_EW(e,w) ((e).weapons & power2of((w) - WEP_FIRST))
+
+# define WEPSET_COPY_AE(a,e) ((a) = (e).weapons)
+# define WEPSET_EQ_AE(a,e) ((a) == (e).weapons)
+# define WEPSET_OR_AE(a,e) ((a) |= (e).weapons)
+# define WEPSET_AND_AE(a,e) ((a) &= (e).weapons)
+# define WEPSET_ANDNOT_AE(a,e) ((a) &~= (e).weapons)
+# define WEPSET_TEST_AE(a,e) ((a) & (e).weapons)
+# define WEPSET_CONTAINS_AE(a,e) (((a) & (e).weapons) == (e))
+
+# define WEPSET_COPY_AA(a,b) ((a) = (b))
+# define WEPSET_EQ_AA(a,b) ((a) == (b))
+# define WEPSET_OR_AA(a,b) ((a) |= (b))
+# define WEPSET_AND_AA(a,b) ((a) &= (b))
+# define WEPSET_ANDNOT_AA(a,b) ((a) &~= (b))
+# define WEPSET_TEST_AA(a,b) ((a) & (b))
+# define WEPSET_CONTAINS_AA(a,b) (((a) & (b)) == (b))
+
+# define WEPSET_COPY_AW(a,w) ((a) = power2of((w) - WEP_FIRST))
+# define WEPSET_EQ_AW(a,w) ((a) == power2of((w) - WEP_FIRST))
+# define WEPSET_OR_AW(a,w) ((a) |= power2of((w) - WEP_FIRST))
+# define WEPSET_AND_AW(a,w) ((a) &= power2of((w) - WEP_FIRST))
+# define WEPSET_ANDNOT_AW(a,w) ((a) &~= power2of((w) - WEP_FIRST))
+// no TEST necessary here, CONTAINS does the same
+# define WEPSET_CONTAINS_AW(a,w) ((a) & power2of((w) - WEP_FIRST))
+
+# ifdef CSQC
+# define WEPSET_COPY_AS(a) ((a) = getstatf(STAT_WEAPONS))
+# endif
#endif
float WEP_COUNT;
void RegisterWeapons_##id() \
{ \
WEP_LAST = (id = WEP_FIRST + WEP_COUNT); \
- WEPBITS_OR_AW(WEPBIT_ALL, id); \
+ WEPSET_OR_AW(WEPBIT_ALL, id); \
if(fabs(weapontype & WEP_FLAG_SUPERWEAPON)) \
- WEPBITS_OR_AW(WEPBIT_SUPERWEAPONS, id); \
+ WEPSET_OR_AW(WEPBIT_SUPERWEAPONS, id); \
++WEP_COUNT; \
register_weapon(id,func,ammotype,i,weapontype,pickupbasevalue,modelname,shortname,wname); \
} \
self.personal.ammo_fuel = self.ammo_fuel;
self.personal.health = self.health;
self.personal.armorvalue = self.armorvalue;
- self.personal.weapons = self.weapons;
+ WEPSET_COPY_EE(self.personal, self);
self.personal.items = self.items;
self.personal.pauserotarmor_finished = self.pauserotarmor_finished;
self.personal.pauserothealth_finished = self.pauserothealth_finished;
self.ammo_fuel = 999;
self.health = start_health;
self.armorvalue = start_armorvalue;
- self.weapons |= weaponsInMap;
+ WEPSET_OR_EA(self.personal, weaponsInMap);
self.pauserotarmor_finished = time + autocvar_g_balance_pause_armor_rot_spawn;
self.pauserothealth_finished = time + autocvar_g_balance_pause_health_rot_spawn;
self.pauserotfuel_finished = time + autocvar_g_balance_pause_fuel_rot_spawn;
self.ammo_fuel = self.personal.ammo_fuel;
self.health = self.personal.health;
self.armorvalue = self.personal.armorvalue;
- self.weapons = self.personal.weapons;
+ WEPSET_COPY_EE(self, self.personal);
self.items = self.personal.items;
self.pauserotarmor_finished = time + self.personal.pauserotarmor_finished - self.personal.teleport_time;
self.pauserothealth_finished = time + self.personal.pauserothealth_finished - self.personal.teleport_time;
setorigin (self, (spot.origin + PL_VIEW_OFS)); // offset it so that the spectator spawns higher off the ground, looks better this way
self.prevorigin = self.origin;
self.items = 0;
- self.weapons = 0;
+ WEPSET_CLEAR_E(self);
self.model = "";
FixPlayermodel();
setmodel(self, "null");
self.ammo_fuel = warmup_start_ammo_fuel;
self.health = warmup_start_health;
self.armorvalue = warmup_start_armorvalue;
- self.weapons = warmup_start_weapons;
+ WEPSET_COPY_EA(self, warmup_start_weapons);
}
else
{
self.ammo_fuel = start_ammo_fuel;
self.health = start_health;
self.armorvalue = start_armorvalue;
- self.weapons = start_weapons;
+ WEPSET_COPY_EA(self, start_weapons);
}
- if(WEPBITS_TEST_EA(self, WEPBIT_SUPERWEAPONS)) // exception for minstagib, as minstanex is a superweapon
+ if(WEPSET_TEST_EA(self, WEPBIT_SUPERWEAPONS)) // exception for minstagib, as minstanex is a superweapon
self.superweapons_finished = time + autocvar_g_balance_superweapons_time;
else
self.superweapons_finished = 0;
if(g_weaponarena_random)
{
if(g_weaponarena_random_with_laser)
- WEPBITS_ANDNOT_EW(self, WEPBIT_LASER);
+ WEPSET_ANDNOT_EW(self, WEPBIT_LASER);
self.weapons = randombits(self.weapons, g_weaponarena_random, FALSE);
if(g_weaponarena_random_with_laser)
- WEPBITS_OR_EW(self, WEPBIT_LASER);
+ WEPSET_OR_EW(self, WEPBIT_LASER);
}
self.items = start_items;
if(clienttype(self) == CLIENTTYPE_REAL)
{
- if(autocvar_g_bugrigs || g_weaponarena == WEPBIT_TUBA)
+ if(autocvar_g_bugrigs || WEPSET_EQ_AW(g_weaponarena, WEP_TUBA))
stuffcmd(self, "cl_cmd settemp chase_active 1\n");
}
}
if (self.items & IT_SUPERWEAPON)
{
- //if(W_WeaponBit(self.weapon) & WEPBIT_SUPERWEAPONS)
- // self.effects = self.effects | EF_RED;
- if (!(self.weapons & WEPBIT_SUPERWEAPONS))
+ if (!WEPSET_TEST_EA(self, WEPBIT_SUPERWEAPONS))
{
self.superweapons_finished = 0;
self.items = self.items - (self.items & IT_SUPERWEAPON);
if (time > self.superweapons_finished)
{
self.items = self.items - (self.items & IT_SUPERWEAPON);
- self.weapons &~= WEPBIT_SUPERWEAPONS;
+ WEPSET_ANDNOT_EA(self, WEPBIT_SUPERWEAPONS);
sprint(self, "^3Superweapons have broken down\n");
}
}
}
- else if(self.weapons & WEPBIT_SUPERWEAPONS)
+ else if(WEPSET_TEST_EA(self, WEPBIT_SUPERWEAPONS))
{
if (time < self.superweapons_finished || (self.items & IT_UNLIMITED_SUPERWEAPONS))
{
else
{
self.superweapons_finished = 0;
- self.weapons &~= WEPBIT_SUPERWEAPONS; // just in case
+ WEPSET_ANDNOT_EA(self, WEPBIT_SUPERWEAPONS);
}
}
else
self.strength_finished = spectatee.strength_finished;
self.invincible_finished = spectatee.invincible_finished;
self.pressedkeys = spectatee.pressedkeys;
- self.weapons = spectatee.weapons;
+ WEPSET_COPY_EE(self, spectatee);
self.switchweapon = spectatee.switchweapon;
self.switchingweapon = spectatee.switchingweapon;
self.weapon = spectatee.weapon;