- search& replace of zero assignments and comparisons.

This commit is contained in:
Christoph Oelckers 2022-09-12 00:18:56 +02:00
parent 2266ae1cd6
commit cebecabe66
3 changed files with 30 additions and 30 deletions

View file

@ -2047,7 +2047,7 @@ int operateTripbomb(int snum)
if (delta.LengthSquared() < (18.125 * 18.125)) if (delta.LengthSquared() < (18.125 * 18.125))
{ {
p->pos.Z = p->opos.Z; p->pos.Z = p->opos.Z;
p->__vel.Z = 0; p->vel.Z = 0;
return 1; return 1;
} }
} }
@ -2584,7 +2584,7 @@ static void operateweapon(int snum, ESyncBits actions)
if (p->kickback_pic < 4) if (p->kickback_pic < 4)
{ {
p->pos.Z = p->opos.Z; p->pos.Z = p->opos.Z;
p->__vel.Z = 0; p->vel.Z = 0;
if (p->kickback_pic == 3) if (p->kickback_pic == 3)
fi.shoot(pact, HANDHOLDINGLASER); fi.shoot(pact, HANDHOLDINGLASER);
} }
@ -2846,7 +2846,7 @@ void processinput_d(int snum)
if (p->newOwner != nullptr) if (p->newOwner != nullptr)
{ {
p->__vel.X = p->__vel.Y = 0; p->vel.X = p->vel.Y = 0;
pact->vel.X = 0; pact->vel.X = 0;
fi.doincrements(p); fi.doincrements(p);
@ -2895,8 +2895,8 @@ void processinput_d(int snum)
if (movementBlocked(p)) if (movementBlocked(p))
{ {
doubvel = 0; doubvel = 0;
p->__vel.X = 0; p->vel.X = 0;
p->__vel.Y = 0; p->vel.Y = 0;
} }
else if (SyncInput()) else if (SyncInput())
{ {
@ -3013,11 +3013,11 @@ void processinput_d(int snum)
} }
if (abs(p->__vel.X) < 2048 && abs(p->__vel.Y) < 2048) if (abs(p->__vel.X) < 2048 && abs(p->__vel.Y) < 2048)
p->__vel.X = p->__vel.Y = 0; p->vel.X = p->vel.Y = 0;
if (shrunk) if (shrunk)
{ {
p->__vel.XY() *= gs.playerfriction * 0.75; p->vel.XY() *= gs.playerfriction * 0.75;
} }
} }

View file

@ -2216,7 +2216,7 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, int fz_, in
if (abs(k) < 1) k = 0; if (abs(k) < 1) k = 0;
p->pos.Z += k; p->pos.Z += k;
p->__vel.Z -= 768; p->__vel.Z -= 768;
if (p->__vel.Z < 0) p->__vel.Z = 0; if (p->vel.Z < 0) p->vel.Z = 0;
} }
else if (p->jumping_counter == 0) else if (p->jumping_counter == 0)
{ {
@ -2224,7 +2224,7 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, int fz_, in
if (p->on_warping_sector == 0 && p->pos.Z > floorz - 16) if (p->on_warping_sector == 0 && p->pos.Z > floorz - 16)
{ {
p->pos.Z = floorz - 16; p->pos.Z = floorz - 16;
p->__vel.Z *= 0.5; p->vel.Z *= 0.5;
} }
} }
@ -2266,7 +2266,7 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, int fz_, in
else else
{ {
p->jumping_counter = 0; p->jumping_counter = 0;
p->__vel.Z = 0; p->vel.Z = 0;
} }
} }
@ -2275,8 +2275,8 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, int fz_, in
if (p->pos.Z < ceilingz + 4) if (p->pos.Z < ceilingz + 4)
{ {
p->jumping_counter = 0; p->jumping_counter = 0;
if (p->__vel.Z < 0) if (p->vel.Z < 0)
p->__vel.X = p->__vel.Y = 0; p->vel.X = p->vel.Y = 0;
p->__vel.Z = 128; p->__vel.Z = 128;
p->pos.Z = ceilingz + 4; p->pos.Z = ceilingz + 4;
} }
@ -2306,34 +2306,34 @@ static void underwater(int snum, ESyncBits actions, int fz_, int cz_)
if ((actions & SB_JUMP) && !p->OnMotorcycle) if ((actions & SB_JUMP) && !p->OnMotorcycle)
{ {
if (p->__vel.Z > 0) p->__vel.Z = 0; if (p->vel.Z > 0) p->vel.Z = 0;
p->__vel.Z -= 348; p->__vel.Z -= 348;
if (p->__vel.Z < -(256 * 6)) p->__vel.Z = -(256 * 6); if (p->__vel.Z < -(256 * 6)) p->__vel.Z = -(256 * 6);
} }
else if ((actions & SB_CROUCH) || p->OnMotorcycle) else if ((actions & SB_CROUCH) || p->OnMotorcycle)
{ {
if (p->__vel.Z < 0) p->__vel.Z = 0; if (p->vel.Z < 0) p->vel.Z = 0;
p->__vel.Z += 348; p->__vel.Z += 348;
if (p->__vel.Z > (256 * 6)) p->__vel.Z = (256 * 6); if (p->__vel.Z > (256 * 6)) p->__vel.Z = (256 * 6);
} }
else else
{ {
if (p->__vel.Z < 0) if (p->vel.Z < 0)
{ {
p->__vel.Z += 256; p->__vel.Z += 256;
if (p->__vel.Z > 0) if (p->vel.Z > 0)
p->__vel.Z = 0; p->vel.Z = 0;
} }
if (p->__vel.Z > 0) if (p->vel.Z > 0)
{ {
p->__vel.Z -= 256; p->__vel.Z -= 256;
if (p->__vel.Z < 0) if (p->vel.Z < 0)
p->__vel.Z = 0; p->vel.Z = 0;
} }
} }
if (p->__vel.Z > 2048) if (p->__vel.Z > 2048)
p->__vel.Z *= 0.5; p->vel.Z *= 0.5;
p->pos.Z += p->__vel.Z * zinttoworld; p->pos.Z += p->__vel.Z * zinttoworld;
@ -2343,7 +2343,7 @@ static void underwater(int snum, ESyncBits actions, int fz_, int cz_)
if (p->pos.Z < ceilingz + 4) if (p->pos.Z < ceilingz + 4)
{ {
p->pos.Z = ceilingz + 4; p->pos.Z = ceilingz + 4;
p->__vel.Z = 0; p->vel.Z = 0;
} }
if (p->scuba_on && (krand() & 255) < 8) if (p->scuba_on && (krand() & 255) < 8)
@ -3558,7 +3558,7 @@ void processinput_r(int snum)
if (p->newOwner != nullptr) if (p->newOwner != nullptr)
{ {
p->__vel.X = p->__vel.Y = 0; p->__vel.X = p->vel.Y = 0;
pact->vel.X = 0; pact->vel.X = 0;
fi.doincrements(p); fi.doincrements(p);
@ -3623,8 +3623,8 @@ void processinput_r(int snum)
if (movementBlocked(p)) if (movementBlocked(p))
{ {
doubvel = 0; doubvel = 0;
p->__vel.X = 0; p->vel.X = 0;
p->__vel.Y = 0; p->vel.Y = 0;
} }
else if (SyncInput()) else if (SyncInput())
{ {
@ -4047,8 +4047,8 @@ void OnMotorcycle(player_struct *p, DDukeActor* motosprite)
p->last_full_weapon = p->curr_weapon; p->last_full_weapon = p->curr_weapon;
p->curr_weapon = MOTORCYCLE_WEAPON; p->curr_weapon = MOTORCYCLE_WEAPON;
p->gotweapon[MOTORCYCLE_WEAPON] = true; p->gotweapon[MOTORCYCLE_WEAPON] = true;
p->__vel.X = 0; p->vel.X = 0;
p->__vel.Y = 0; p->vel.Y = 0;
p->horizon.horiz = q16horiz(0); p->horizon.horiz = q16horiz(0);
} }
if (!S_CheckActorSoundPlaying(p->GetActor(),186)) if (!S_CheckActorSoundPlaying(p->GetActor(),186))
@ -4123,8 +4123,8 @@ void OnBoat(player_struct *p, DDukeActor* boat)
p->last_full_weapon = p->curr_weapon; p->last_full_weapon = p->curr_weapon;
p->curr_weapon = BOAT_WEAPON; p->curr_weapon = BOAT_WEAPON;
p->gotweapon[BOAT_WEAPON] = true; p->gotweapon[BOAT_WEAPON] = true;
p->__vel.X = 0; p->vel.X = 0;
p->__vel.Y = 0; p->vel.Y = 0;
p->horizon.horiz = q16horiz(0); p->horizon.horiz = q16horiz(0);
} }
} }

View file

@ -438,7 +438,7 @@ void operateweapon_ww(int snum, ESyncBits actions)
&& p->kickback_pic < (aplWeaponFireDelay(p->curr_weapon, snum) + 1)) && p->kickback_pic < (aplWeaponFireDelay(p->curr_weapon, snum) + 1))
{ {
p->pos.Z = p->opos.Z; p->pos.Z = p->opos.Z;
p->__vel.Z = 0; p->vel.Z = 0;
} }
if (p->kickback_pic == aplWeaponSound2Time(p->curr_weapon, snum)) if (p->kickback_pic == aplWeaponSound2Time(p->curr_weapon, snum))
{ {