mirror of
https://git.code.sf.net/p/quake/game-source
synced 2024-11-10 06:31:52 +00:00
bit manipulations fixes
This commit is contained in:
parent
9b44735884
commit
0dcd9a9515
8 changed files with 38 additions and 42 deletions
|
@ -980,7 +980,7 @@ PlayerPreThink =
|
|||
if (self.button2)
|
||||
PlayerJump ();
|
||||
else
|
||||
self.flags = self.flags | FL_JUMPRELEASED;
|
||||
self.flags |= FL_JUMPRELEASED;
|
||||
|
||||
// teleporters can force a non-moving pause time
|
||||
if (time < self.pausetime)
|
||||
|
|
|
@ -124,7 +124,7 @@ void(entity targ, entity inflictor, entity attacker, float damage) T_Damage=
|
|||
if (save >= targ.armorvalue) {
|
||||
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;
|
||||
|
|
30
nqw/items.qc
30
nqw/items.qc
|
@ -37,7 +37,7 @@ void() q_touch =
|
|||
sound (other, CHAN_VOICE, self.noise, 1, ATTN_NORM);
|
||||
stuffcmd (other, "bf\n");
|
||||
self.solid = SOLID_NOT;
|
||||
other.items = other.items | IT_QUAD;
|
||||
other.items |= IT_QUAD;
|
||||
self.model = string_null;
|
||||
if (deathmatch == 4) {
|
||||
other.armortype = 0;
|
||||
|
@ -102,7 +102,7 @@ void() r_touch =
|
|||
sound (other, CHAN_VOICE, self.noise, 1, ATTN_NORM);
|
||||
stuffcmd (other, "bf\n");
|
||||
self.solid = SOLID_NOT;
|
||||
other.items = other.items | IT_INVISIBILITY;
|
||||
other.items |= IT_INVISIBILITY;
|
||||
self.model = string_null;
|
||||
|
||||
// do the apropriate action
|
||||
|
@ -282,7 +282,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;
|
||||
if (deathmatch != 4)
|
||||
{
|
||||
self.nextthink = time + 5;
|
||||
|
@ -312,7 +312,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 && deathmatch != 2) { // deathmatch 2 is silly old rules
|
||||
self.nextthink = time + 20;
|
||||
|
@ -357,8 +357,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;
|
||||
if (deathmatch && deathmatch != 2) {
|
||||
|
@ -581,7 +581,7 @@ void() weapon_touch =
|
|||
|
||||
// change to the weapon
|
||||
old = other.items;
|
||||
other.items = other.items | new;
|
||||
other.items |= new;
|
||||
|
||||
stemp = self;
|
||||
self = other;
|
||||
|
@ -963,7 +963,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) {
|
||||
self.solid = SOLID_NOT;
|
||||
|
@ -1079,7 +1079,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;
|
||||
|
@ -1147,7 +1147,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
|
||||
|
@ -1192,7 +1192,7 @@ void() item_artifact_invulnerability =
|
|||
setmodel (self, "progs/invulner.mdl");
|
||||
self.netname = "Pentagram of Protection";
|
||||
if (deathmatch) // Tonik
|
||||
self.effects = self.effects | EF_RED;
|
||||
self.effects |= EF_RED;
|
||||
self.items = IT_INVULNERABILITY;
|
||||
setsize (self, '-16 -16 -24', '16 16 32');
|
||||
StartItem ();
|
||||
|
@ -1254,7 +1254,7 @@ void() item_artifact_super_damage =
|
|||
self.netname = "Quad Damage";
|
||||
self.items = IT_QUAD;
|
||||
if (deathmatch) // Tonik
|
||||
self.effects = self.effects | EF_BLUE;
|
||||
self.effects |= EF_BLUE;
|
||||
setsize (self, '-16 -16 -24', '16 16 32');
|
||||
StartItem ();
|
||||
};
|
||||
|
@ -1298,11 +1298,11 @@ void() BackpackTouch =
|
|||
if (other.invincible_time != 1) {
|
||||
other.invincible_time = 1;
|
||||
other.invincible_finished = time + 30;
|
||||
other.items = other.items | IT_INVULNERABILITY;
|
||||
other.items |= IT_INVULNERABILITY;
|
||||
|
||||
other.super_time = 1;
|
||||
other.super_damage_finished = time + 30;
|
||||
other.items = other.items | IT_QUAD;
|
||||
other.items |= IT_QUAD;
|
||||
|
||||
other.ammo_cells = 0;
|
||||
|
||||
|
@ -1338,7 +1338,7 @@ void() BackpackTouch =
|
|||
if (!new)
|
||||
new = other.weapon;
|
||||
old = other.items;
|
||||
other.items = other.items | self.items;
|
||||
other.items |= self.items;
|
||||
|
||||
bound_other_ammo ();
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ void() walkmonster_start_go =
|
|||
self.view_ofs = '0 0 25';
|
||||
self.use = monster_use;
|
||||
|
||||
self.flags = self.flags | FL_MONSTER;
|
||||
self.flags |= FL_MONSTER;
|
||||
|
||||
if (self.target) {
|
||||
self.goalentity = self.movetarget = find (world, targetname,
|
||||
|
@ -125,8 +125,8 @@ void() flymonster_start_go =
|
|||
self.view_ofs = '0 0 25';
|
||||
self.use = monster_use;
|
||||
|
||||
self.flags = self.flags | FL_FLY;
|
||||
self.flags = self.flags | FL_MONSTER;
|
||||
self.flags |= FL_FLY;
|
||||
self.flags |= FL_MONSTER;
|
||||
|
||||
if (!walkmove (0, 0)) {
|
||||
dprint ("flymonster in wall at: ");
|
||||
|
@ -178,8 +178,8 @@ void() swimmonster_start_go =
|
|||
self.view_ofs = '0 0 10';
|
||||
self.use = monster_use;
|
||||
|
||||
self.flags = self.flags | FL_SWIM;
|
||||
self.flags = self.flags | FL_MONSTER;
|
||||
self.flags |= FL_SWIM;
|
||||
self.flags |= FL_MONSTER;
|
||||
|
||||
if (self.target) {
|
||||
self.goalentity = self.movetarget = find (world, targetname,
|
||||
|
|
|
@ -493,7 +493,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 = (random () - 0.5) * '0 1200 0';
|
||||
};
|
||||
|
||||
|
@ -526,7 +526,7 @@ void() PlayerDie =
|
|||
{
|
||||
local float i;
|
||||
local string s;
|
||||
self.items = self.items - (self.items & IT_INVISIBILITY);
|
||||
self.items &= ~IT_INVISIBILITY;
|
||||
|
||||
if ((stof (infokey (world, "dq"))) != 0) {
|
||||
if (self.super_damage_finished > 0) {
|
||||
|
@ -565,7 +565,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;
|
||||
|
|
|
@ -429,7 +429,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)
|
||||
|
|
|
@ -699,7 +699,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);
|
||||
|
||||
switch (self.weapon) {
|
||||
case IT_AXE:
|
||||
|
@ -711,43 +711,43 @@ 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;
|
||||
break;
|
||||
case 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;
|
||||
break;
|
||||
case 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;
|
||||
break;
|
||||
case 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;
|
||||
break;
|
||||
case 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;
|
||||
break;
|
||||
case 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;
|
||||
break;
|
||||
case 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;
|
||||
break;
|
||||
default:
|
||||
self.currentammo = 0;
|
||||
|
@ -880,13 +880,9 @@ void() CheatCommand =
|
|||
self.ammo_rockets = 100;
|
||||
self.ammo_nails = 200;
|
||||
self.ammo_shells = 100;
|
||||
self.items = self.items |
|
||||
IT_AXE |
|
||||
IT_SHOTGUN | IT_SUPER_SHOTGUN |
|
||||
IT_NAILGUN | IT_SUPER_NAILGUN |
|
||||
IT_GRENADE_LAUNCHER | IT_ROCKET_LAUNCHER |
|
||||
IT_LIGHTNING |
|
||||
IT_KEY1 | IT_KEY2;
|
||||
self.items |= (IT_AXE | IT_SHOTGUN | IT_SUPER_SHOTGUN | IT_NAILGUN
|
||||
| IT_SUPER_NAILGUN | IT_GRENADE_LAUNCHER
|
||||
| IT_ROCKET_LAUNCHER | IT_LIGHTNING | IT_KEY1 | IT_KEY2);
|
||||
|
||||
self.weapon = IT_ROCKET_LAUNCHER;
|
||||
self.impulse = 0;
|
||||
|
|
|
@ -308,7 +308,7 @@ void() wiz_death1 =[ $death1, wiz_death2 ] {
|
|||
self.velocity_x = -200 + 400 * random ();
|
||||
self.velocity_y = -200 + 400 * random ();
|
||||
self.velocity_z = 100 + 100 * random ();
|
||||
self.flags = self.flags - (self.flags & FL_ONGROUND);
|
||||
self.flags &= ~FL_ONGROUND;
|
||||
sound (self, CHAN_VOICE, "wizard/wdeath.wav", 1, ATTN_NORM);
|
||||
};
|
||||
void() wiz_death2 =[ $death2, wiz_death3 ] {};
|
||||
|
|
Loading…
Reference in a new issue