bit manip cleanup and fixes

This commit is contained in:
Bill Currie 2004-02-08 05:32:28 +00:00
parent c045f27f43
commit 66891f8e88
9 changed files with 72 additions and 78 deletions

View file

@ -430,16 +430,16 @@ void() CheckAdminCmd =
} else if (self.accessparm == 20) { // give rune
if (self.impulse == 1) {
self.player_flag = self.player_flag | ITEM_RUNE1_FLAG;
self.player_flag |= ITEM_RUNE1_FLAG;
sprint(self, "You now have the Earth Magic rune\n");
} else if (self.impulse == 2) {
self.player_flag = self.player_flag | ITEM_RUNE2_FLAG;
self.player_flag |= ITEM_RUNE2_FLAG;
sprint(self, "You now have the Black Magic rune\n");
} else if (self.impulse == 3) {
self.player_flag = self.player_flag | ITEM_RUNE3_FLAG;
self.player_flag |= ITEM_RUNE3_FLAG;
sprint(self, "You now have the Hell Magic rune\n");
} else if (self.impulse == 4) {
self.player_flag = self.player_flag | ITEM_RUNE4_FLAG;
self.player_flag |= ITEM_RUNE4_FLAG;
sprint(self, "You now have the Elder Magic rune\n");
}

View file

@ -59,9 +59,9 @@ void () CheckDimLight = {
// flag = 1;
if (flag)
self.effects = self.effects | EF_DIMLIGHT;
self.effects |= EF_DIMLIGHT;
else
self.effects = self.effects - (self.effects & EF_DIMLIGHT);
self.effects &= ~EF_DIMLIGHT;
};
/*
@ -97,8 +97,8 @@ void() SetChangeParms =
}
// remove items
self.items = self.items - (self.items &
(IT_KEY1 | IT_KEY2 | IT_INVISIBILITY | IT_INVULNERABILITY | IT_SUIT | IT_QUAD) );
self.items &= ~(IT_KEY1 | IT_KEY2 | IT_INVISIBILITY | IT_INVULNERABILITY
| IT_SUIT | IT_QUAD);
// cap super health
if (self.health > 100)
@ -148,9 +148,9 @@ void() SetNewParms =
void() DecodeLevelParms =
{
self.player_flag = self.player_flag | parm16;
self.player_flag = self.player_flag - (self.player_flag & ITEM_RUNE_MASK);
self.player_flag = self.player_flag - (self.player_flag & ITEM_ENEMY_FLAG);
self.player_flag |= parm16;
self.player_flag &= ~ITEM_RUNE_MASK;
self.player_flag &= ~ITEM_ENEMY_FLAG;
self.skin = (self.player_flag & 65280)/256;
self.accesslvl = parm15;
self.statstate = parm14;
@ -951,7 +951,7 @@ void() PlayerJump =
if ( !(self.flags & FL_JUMPRELEASED) )
return; // don't pogo stick
self.flags = self.flags - (self.flags & FL_JUMPRELEASED);
self.flags &= ~FL_JUMPRELEASED;
self.flags = self.flags - FL_ONGROUND; // don't stairwalk
@ -1071,9 +1071,9 @@ void() CheckWaterJump =
traceline (start, end, TRUE, self);
if (trace_fraction == 1)
{ // open at eye level
self.flags = self.flags | FL_WATERJUMP;
self.flags |= FL_WATERJUMP;
self.velocity_z = 225;
self.flags = self.flags - (self.flags & FL_JUMPRELEASED);
self.flags &= ~FL_JUMPRELEASED;
self.teleport_time = time + 2; // safety net
return;
}
@ -1143,7 +1143,7 @@ void() PlayerPreThink =
PlayerJump ();
}
else
self.flags = self.flags | FL_JUMPRELEASED;
self.flags |= FL_JUMPRELEASED;
// teleporters can force a non-moving pause time
if (time < self.pausetime)
@ -1264,9 +1264,9 @@ void() CheckPowerups =
// ZOID, next line isn't needed, EF_DIMLIGHT is handled by
// client.qc:CheckDimLight
// if (self.invincible_finished > time)
// self.effects = self.effects | EF_DIMLIGHT;
// self.effects |= EF_DIMLIGHT;
// else
// self.effects = self.effects - (self.effects & EF_DIMLIGHT);
// self.effects &= ~EF_DIMLIGHT);
}
// super damage
@ -1301,9 +1301,9 @@ void() CheckPowerups =
// ZOID, next line isn't needed, EF_DIMLIGHT is handled by
// client.qc:CheckDimLight
// if (self.super_damage_finished > time)
// self.effects = self.effects | EF_DIMLIGHT;
// self.effects |= EF_DIMLIGHT;
// else
// self.effects = self.effects - (self.effects & EF_DIMLIGHT);
// self.effects &= ~EF_DIMLIGHT);
}
// suit
@ -1423,7 +1423,7 @@ void() ClientConnect =
self.do_observer = 1;
else if (!self.do_observer) {
TeamCheckLock();
self.player_flag = self.player_flag | TEAM_STUFF_COLOR;
self.player_flag |= TEAM_STUFF_COLOR;
if ((teamplay & TEAM_CAPTURE_CUSTOM)) {
if (self.lastteam == TEAM_COLOR1)
self.skin = 1;
@ -1431,8 +1431,8 @@ void() ClientConnect =
self.skin = 3;
if (random() < 0.5)
self.skin = self.skin + 1; // visor dude
self.player_flag = self.player_flag - (self.player_flag & 65280);
self.player_flag = self.player_flag | (self.skin * 256);
self.player_flag &= ~65280;
self.player_flag |= (self.skin * 256);
}
}
}

View file

@ -180,7 +180,7 @@ void(entity targ, entity inflictor, entity attacker, float damage) T_Damage=
{
save = targ.armorvalue;
targ.armortype = 0; // lost all armor
targ.items = targ.items - (targ.items & (IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3));
targ.items &= ~(IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3);
}
targ.armorvalue = targ.armorvalue - save;

View file

@ -210,7 +210,7 @@ void() health_touch =
// Megahealth = rot down the player's super health
if (self.healtype == 2)
{
other.items = other.items | IT_SUPERHEALTH;
other.items |= IT_SUPERHEALTH;
self.nextthink = time + 5;
self.think = item_megahealth_rot;
self.owner = other;
@ -243,7 +243,7 @@ void() item_megahealth_rot =
// it is possible for a player to die and respawn between rots, so don't
// just blindly subtract the flag off
other.items = other.items - (other.items & IT_SUPERHEALTH);
other.items &= ~IT_SUPERHEALTH;
if (deathmatch == 1 || deathmatch == 3) // deathmatch 2 is silly old rules
{
@ -294,7 +294,8 @@ void() armor_touch =
other.armortype = type;
other.armorvalue = value;
other.items = other.items - (other.items & (IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3)) + bit;
other.items &= ~(IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3);
other.items |= bit;
self.solid = SOLID_NOT;
self.model = string_null;
@ -538,7 +539,7 @@ void() weapon_touch =
// change to the weapon
old = other.items;
other.items = other.items | new;
other.items |= new;
stemp = self;
self = other;
@ -955,7 +956,7 @@ void() key_touch =
sound (other, CHAN_ITEM, self.noise, 1, ATTN_NORM);
stuffcmd (other, "bf\n");
other.items = other.items | self.items;
other.items |= self.items;
if (!coop)
{
@ -1086,7 +1087,7 @@ void() sigil_touch =
stuffcmd (other, "bf\n");
self.solid = SOLID_NOT;
self.model = string_null;
serverflags = serverflags | (self.spawnflags & 15);
serverflags |= (self.spawnflags & 15);
self.classname = ""; // so rune doors won't find it
activator = other;
@ -1170,7 +1171,7 @@ void() powerup_touch =
sound (other, CHAN_VOICE, self.noise, 1, ATTN_NORM);
stuffcmd (other, "bf\n");
self.solid = SOLID_NOT;
other.items = other.items | self.items;
other.items |= self.items;
self.model = string_null;
// do the apropriate action
@ -1333,7 +1334,7 @@ void() BackpackTouch =
if (!new)
new = other.weapon;
old = other.items;
other.items = other.items | new;
other.items |= new;
bound_other_ammo ();
@ -1485,11 +1486,11 @@ void() RuneTouch =
return; // one per customer
}
other.player_flag = other.player_flag | self.player_flag;
other.player_flag |= self.player_flag;
// notification of rune, no nofity in team mode
if (self.player_flag & ITEM_RUNE1_FLAG) {
self.items = self.items | IT_SIGIL1;
self.items |= IT_SIGIL1;
if (teamplay == 0) {
bprint(other.netname);
bprint(" got the rune of Åáòôè Íáçéã!\n");
@ -1497,7 +1498,7 @@ void() RuneTouch =
TeamPlayerUpdate(other, "Åáòôè Íáçéã! Òåóéóôáîãå");
}
if (self.player_flag & ITEM_RUNE2_FLAG) {
self.items = self.items | IT_SIGIL2;
self.items |= IT_SIGIL2;
if (teamplay == 0) {
bprint(other.netname);
bprint(" got the rune of Âìáãë Íáçéã!\n");
@ -1505,7 +1506,7 @@ void() RuneTouch =
TeamPlayerUpdate(other, "Âìáãë Íáçéã! Óôòåîçôè");
}
if (self.player_flag & ITEM_RUNE3_FLAG) {
self.items = self.items | IT_SIGIL3;
self.items |= IT_SIGIL3;
if (teamplay == 0) {
bprint(other.netname);
bprint(" got the rune of Èåìì Íáçéã!\n");
@ -1513,7 +1514,7 @@ void() RuneTouch =
TeamPlayerUpdate(other, "Èåìì Íáçéã! Èáóôå");
}
if (self.player_flag & ITEM_RUNE4_FLAG) {
self.items = self.items | IT_SIGIL4;
self.items |= IT_SIGIL4;
if (teamplay == 0) {
bprint(other.netname);
bprint(" got the rune of Åìäåò Íáçéã!\n");
@ -1591,7 +1592,7 @@ void() DropRune =
Do_DropRune(ITEM_RUNE3_FLAG);
if (self.player_flag & ITEM_RUNE4_FLAG)
Do_DropRune(ITEM_RUNE4_FLAG);
self.player_flag = self.player_flag - (self.player_flag & ITEM_RUNE_MASK);
self.player_flag &= ~ITEM_RUNE_MASK;
};
/*

View file

@ -115,7 +115,7 @@ void(entity player,entity tele) ObserverTeleporter =
player.fixangle = TRUE; // turn this way immediately
player.teleport_time = time + 0.7;
player.velocity = v_forward * 300;
// player.flags = player.flags - player.flags & FL_ONGROUND;
// player.flags &= ~FL_ONGROUND;
};
float() DoObserverImpulse =
@ -146,7 +146,7 @@ float() DoObserverImpulse =
self.impulse = 0;
self.player_flag = self.player_flag | TEAM_STUFF_COLOR;
self.player_flag |= TEAM_STUFF_COLOR;
if (teamplay & TEAM_CAPTURE_CUSTOM) {
if (self.lastteam == TEAM_COLOR1)
self.skin = 1;
@ -154,8 +154,8 @@ float() DoObserverImpulse =
self.skin = 3;
if (random() < 0.5)
self.skin = self.skin + 1; // visor dude
self.player_flag = self.player_flag - (self.player_flag & 65280);
self.player_flag = self.player_flag | (self.skin * 256);
self.player_flag &= ~65280;
self.player_flag |= (self.skin * 256);
}
self.weapon = W_BestWeapon();
@ -172,7 +172,7 @@ void () ObserverThink =
self.weaponmodel = "";
self.weaponframe = 0;
self.flags = self.flags | FL_ONGROUND;
self.flags |= FL_ONGROUND;
{
local float invcos,nvp,nvpmax,sp,svz;

View file

@ -166,7 +166,7 @@ void() player_run =[ $rockrun1, player_run ]
void() player_shot1 = [$shotatt1, player_shot2 ] {self.weaponframe=1;
self.effects = self.effects | EF_MUZZLEFLASH;};
self.effects |= EF_MUZZLEFLASH;};
void() player_shot2 = [$shotatt2, player_shot3 ] {self.weaponframe=2;};
void() player_shot3 = [$shotatt3, player_shot4 ] {self.weaponframe=3;};
void() player_shot4 = [$shotatt4, player_shot5 ] {self.weaponframe=4;};
@ -233,7 +233,7 @@ void() player_chain5= [$axattd4, player_run ] {self.weaponframe=5;};
void() player_nail1 =[$nailatt1, player_nail2 ]
{
self.effects = self.effects | EF_MUZZLEFLASH;
self.effects |= EF_MUZZLEFLASH;
if (!self.button0)
{player_run ();return;}
@ -246,7 +246,7 @@ void() player_nail1 =[$nailatt1, player_nail2 ]
};
void() player_nail2 =[$nailatt2, player_nail1 ]
{
self.effects = self.effects | EF_MUZZLEFLASH;
self.effects |= EF_MUZZLEFLASH;
if (!self.button0)
{player_run ();return;}
@ -262,7 +262,7 @@ void() player_nail2 =[$nailatt2, player_nail1 ]
void() player_light1 =[$light1, player_light2 ]
{
self.effects = self.effects | EF_MUZZLEFLASH;
self.effects |= EF_MUZZLEFLASH;
if (!self.button0)
{player_run ();return;}
@ -275,7 +275,7 @@ void() player_light1 =[$light1, player_light2 ]
};
void() player_light2 =[$light2, player_light1 ]
{
self.effects = self.effects | EF_MUZZLEFLASH;
self.effects |= EF_MUZZLEFLASH;
if (!self.button0)
{player_run ();return;}
@ -291,7 +291,7 @@ void() player_light2 =[$light2, player_light1 ]
void() player_rocket1 =[$rockatt1, player_rocket2 ] {self.weaponframe=1;
self.effects = self.effects | EF_MUZZLEFLASH;};
self.effects |= EF_MUZZLEFLASH;};
void() player_rocket2 =[$rockatt2, player_rocket3 ] {self.weaponframe=2;};
void() player_rocket3 =[$rockatt3, player_rocket4 ] {self.weaponframe=3;};
void() player_rocket4 =[$rockatt4, player_rocket5 ] {self.weaponframe=4;};
@ -551,7 +551,7 @@ void(string gibname, float dm) ThrowHead =
setsize (self, '-16 -16 0', '16 16 56');
self.velocity = VelocityForDamage (dm);
self.origin_z = self.origin_z - 24;
self.flags = self.flags - (self.flags & FL_ONGROUND);
self.flags &= ~FL_ONGROUND;
self.avelocity = crandom() * '0 600 0';
};
@ -589,7 +589,7 @@ void() PlayerDie =
{
local float i;
self.items = self.items - (self.items & IT_INVISIBILITY);
self.items &= ~IT_INVISIBILITY;
self.invisible_finished = 0; // don't die as eyes
self.invincible_finished = 0;
self.super_damage_finished = 0;
@ -610,7 +610,7 @@ void() PlayerDie =
self.view_ofs = '0 0 -8';
self.deadflag = DEAD_DYING;
self.solid = SOLID_NOT;
self.flags = self.flags - (self.flags & FL_ONGROUND);
self.flags &= ~FL_ONGROUND;
self.movetype = MOVETYPE_TOSS;
if (self.velocity_z < 10)
self.velocity_z = self.velocity_z + random()*300;

View file

@ -771,7 +771,7 @@ void() Team_weapon_touch =
// change to the weapon
old = other.items;
other.items = other.items | new;
other.items |= new;
remove(self);
self = other;
@ -984,7 +984,7 @@ void() TeamCaptureFlagTouch =
else
bprint(" ãáðôõòåä the ÒÅÄ flag!\n"); // red
LogMsg(other, "FLAG-CAPTURE");
other.items = other.items - (other.items & (IT_KEY1 | IT_KEY2));
other.items &= ~(IT_KEY1 | IT_KEY2);
last_flag_capture = time;
last_capture_team = other.team;
@ -1026,7 +1026,7 @@ void() TeamCaptureFlagTouch =
self.frags = self.frags + TEAM_CAPTURE_FRAG_CARRIER_ASSIST_BONUS;
}
}
self.player_flag = self.player_flag - (self.player_flag & ITEM_ENEMY_FLAG);
self.player_flag &= ~ITEM_ENEMY_FLAG;
p = find(p, classname, "player");
}
@ -1077,7 +1077,7 @@ void() TeamCaptureFlagTouch =
sound (other, CHAN_ITEM, self.noise, 1, ATTN_NORM);
other.player_flag = other.player_flag + ITEM_ENEMY_FLAG;
other.items = other.items | self.items;
other.items |= self.items;
// *XXX* EXPERT CTF set the time at which the carrier picked up the flag
other.flag_since = time;
@ -1274,7 +1274,7 @@ void() place_flag = {
self.nextthink = time + 0.1;
self.cnt = FLAG_AT_BASE;
self.mangle = self.angles;
self.effects = self.effects | EF_DIMLIGHT;
self.effects |= EF_DIMLIGHT;
if (!droptofloor()) {
dprint ("Flag fell out of level at ");
dprint (vtos(self.origin));

View file

@ -438,7 +438,7 @@ local vector org;
other.flags = other.flags - FL_ONGROUND;
other.velocity = v_forward * 300;
}
other.flags = other.flags - other.flags & FL_ONGROUND;
other.flags &= ~FL_ONGROUND;
};
/*QUAKED info_teleport_destination (.5 .5 .5) (-8 -8 -8) (8 8 32)

View file

@ -807,7 +807,7 @@ void() W_SetCurrentAmmo =
{
player_run (); // get out of any weapon firing states
self.items = self.items - ( self.items & (IT_SHELLS | IT_NAILS | IT_ROCKETS | IT_CELLS) );
self.items &= ~(IT_SHELLS | IT_NAILS | IT_ROCKETS | IT_CELLS);
if (self.weapon == IT_AXE)
{
@ -829,49 +829,49 @@ void() W_SetCurrentAmmo =
self.currentammo = self.ammo_shells;
self.weaponmodel = "progs/v_shot.mdl";
self.weaponframe = 0;
self.items = self.items | IT_SHELLS;
self.items |= IT_SHELLS;
}
else if (self.weapon == IT_SUPER_SHOTGUN)
{
self.currentammo = self.ammo_shells;
self.weaponmodel = "progs/v_shot2.mdl";
self.weaponframe = 0;
self.items = self.items | IT_SHELLS;
self.items |= IT_SHELLS;
}
else if (self.weapon == IT_NAILGUN)
{
self.currentammo = self.ammo_nails;
self.weaponmodel = "progs/v_nail.mdl";
self.weaponframe = 0;
self.items = self.items | IT_NAILS;
self.items |= IT_NAILS;
}
else if (self.weapon == IT_SUPER_NAILGUN)
{
self.currentammo = self.ammo_nails;
self.weaponmodel = "progs/v_nail2.mdl";
self.weaponframe = 0;
self.items = self.items | IT_NAILS;
self.items |= IT_NAILS;
}
else if (self.weapon == IT_GRENADE_LAUNCHER)
{
self.currentammo = self.ammo_rockets;
self.weaponmodel = "progs/v_rock.mdl";
self.weaponframe = 0;
self.items = self.items | IT_ROCKETS;
self.items |= IT_ROCKETS;
}
else if (self.weapon == IT_ROCKET_LAUNCHER)
{
self.currentammo = self.ammo_rockets;
self.weaponmodel = "progs/v_rock2.mdl";
self.weaponframe = 0;
self.items = self.items | IT_ROCKETS;
self.items |= IT_ROCKETS;
}
else if (self.weapon == IT_LIGHTNING)
{
self.currentammo = self.ammo_cells;
self.weaponmodel = "progs/v_light.mdl";
self.weaponframe = 0;
self.items = self.items | IT_CELLS;
self.items |= IT_CELLS;
}
else
{
@ -1136,19 +1136,12 @@ void() CheatCommand =
self.ammo_rockets = 100;
self.ammo_nails = 200;
self.ammo_shells = 100;
self.items = self.items |
IT_AXE |
IT_HOOK |
IT_SHOTGUN |
IT_SUPER_SHOTGUN |
IT_NAILGUN |
IT_SUPER_NAILGUN |
IT_GRENADE_LAUNCHER |
IT_ROCKET_LAUNCHER |
IT_KEY1 | IT_KEY2;
self.items |= (IT_AXE | IT_HOOK | IT_SHOTGUN | IT_SUPER_SHOTGUN
| IT_NAILGUN | IT_SUPER_NAILGUN | IT_GRENADE_LAUNCHER
| IT_ROCKET_LAUNCHER | IT_KEY1 | IT_KEY2);
self.ammo_cells = 200;
self.items = self.items | IT_LIGHTNING;
self.items |= IT_LIGHTNING;
self.weapon = IT_ROCKET_LAUNCHER;
self.impulse = 0;
@ -1361,7 +1354,7 @@ void() ServerflagsCommand =
{
serverflags = serverflags * 2 + 1;
// ZOID: Bug fix
serverflags = (serverflags & 15);
serverflags &= 15;
};
void() QuadCheat =
@ -1370,7 +1363,7 @@ void() QuadCheat =
return;
self.super_time = 1;
self.super_damage_finished = time + 30;
self.items = self.items | IT_QUAD;
self.items |= IT_QUAD;
dprint ("quad cheat\n");
};