- Duke/RR: Clean up some disassembly variable names in vehicle so it's easier to understand what's going on.

This commit is contained in:
Mitchell Richters 2020-11-05 08:22:01 +11:00
parent 94341e8582
commit c46ad10bb1

View file

@ -1573,25 +1573,25 @@ static void onMotorcycle(int snum, ESyncBits &actions)
auto pact = p->GetActor(); auto pact = p->GetActor();
auto s = &pact->s; auto s = &pact->s;
int var64, var68, var6c, var70, var74, var78, var7c, var80; int braking, moveForward, moveBackward, turnLeft, turnRight;
short var84; short rng;
if (p->MotoSpeed < 0) if (p->MotoSpeed < 0)
p->MotoSpeed = 0; p->MotoSpeed = 0;
if (actions & SB_CROUCH) if (actions & SB_CROUCH)
{ {
var64 = 1; braking = 1;
actions &= ~SB_CROUCH; actions &= ~SB_CROUCH;
} }
else else
var64 = 0; braking = 0;
if (actions & SB_JUMP) if (actions & SB_JUMP)
{ {
var68 = 1; moveForward = 1;
actions &= ~SB_JUMP; actions &= ~SB_JUMP;
if (p->on_ground) if (p->on_ground)
{ {
if (p->MotoSpeed == 0 && var64) if (p->MotoSpeed == 0 && braking)
{ {
if (!S_CheckActorSoundPlaying(pact, 187)) if (!S_CheckActorSoundPlaying(pact, 187))
S_PlayActorSound(187, pact); S_PlayActorSound(187, pact);
@ -1614,7 +1614,7 @@ static void onMotorcycle(int snum, ESyncBits &actions)
} }
else else
{ {
var68 = 0; moveForward = 0;
if (S_CheckActorSoundPlaying(pact, 214)) if (S_CheckActorSoundPlaying(pact, 214))
{ {
S_StopSound(214, pact); S_StopSound(214, pact);
@ -1632,53 +1632,48 @@ static void onMotorcycle(int snum, ESyncBits &actions)
} }
if (p->vehicle_backwards) if (p->vehicle_backwards)
{ {
var6c = 1; moveBackward = 1;
p->vehicle_backwards = false; p->vehicle_backwards = false;
} }
else else
var6c = 0; moveBackward = 0;
if (p->vehicle_turnl) if (p->vehicle_turnl)
{ {
var70 = 1; turnLeft = 1;
var74 = 1;
p->vehicle_turnl = false; p->vehicle_turnl = false;
} }
else else
{ {
var70 = 0; turnLeft = 0;
var74 = 0;
} }
if (p->vehicle_turnr) if (p->vehicle_turnr)
{ {
var78 = 1; turnRight = 1;
var7c = 1;
p->vehicle_turnr = false; p->vehicle_turnr = false;
} }
else else
{ {
var78 = 0; turnRight = 0;
var7c = 0;
} }
var80 = 0;
if (p->drink_amt > 88 && p->moto_drink == 0) if (p->drink_amt > 88 && p->moto_drink == 0)
{ {
var84 = krand() & 63; rng = krand() & 63;
if (var84 == 1) if (rng == 1)
p->moto_drink = -10; p->moto_drink = -10;
else if (var84 == 2) else if (rng == 2)
p->moto_drink = 10; p->moto_drink = 10;
} }
else if (p->drink_amt > 99 && p->moto_drink == 0) else if (p->drink_amt > 99 && p->moto_drink == 0)
{ {
var84 = krand() & 31; rng = krand() & 31;
if (var84 == 1) if (rng == 1)
p->moto_drink = -20; p->moto_drink = -20;
else if (var84 == 2) else if (rng == 2)
p->moto_drink = 20; p->moto_drink = 20;
} }
if (p->on_ground == 1) if (p->on_ground == 1)
{ {
if (var64 && p->MotoSpeed > 0) if (braking && p->MotoSpeed > 0)
{ {
if (p->moto_on_oil) if (p->moto_on_oil)
p->MotoSpeed -= 2; p->MotoSpeed -= 2;
@ -1689,7 +1684,7 @@ static void onMotorcycle(int snum, ESyncBits &actions)
p->VBumpTarget = -30; p->VBumpTarget = -30;
p->moto_do_bump = 1; p->moto_do_bump = 1;
} }
else if (var68 && !var64) else if (moveForward && !braking)
{ {
if (p->MotoSpeed < 40) if (p->MotoSpeed < 40)
{ {
@ -1705,19 +1700,18 @@ static void onMotorcycle(int snum, ESyncBits &actions)
} }
else if (p->MotoSpeed > 0) else if (p->MotoSpeed > 0)
p->MotoSpeed--; p->MotoSpeed--;
if (p->moto_do_bump && (!var64 || p->MotoSpeed == 0)) if (p->moto_do_bump && (!braking || p->MotoSpeed == 0))
{ {
p->VBumpTarget = 0; p->VBumpTarget = 0;
p->moto_do_bump = 0; p->moto_do_bump = 0;
} }
if (var6c && p->MotoSpeed <= 0 && !var64) if (moveBackward && p->MotoSpeed <= 0 && !braking)
{ {
int var88; int temp;
p->MotoSpeed = -15; p->MotoSpeed = -15;
var88 = var7c; temp = turnRight;
var7c = var74; turnRight = turnLeft;
var74 = var88; turnLeft = temp;
var80 = 1;
} }
} }
if (p->MotoSpeed != 0 && p->on_ground == 1) if (p->MotoSpeed != 0 && p->on_ground == 1)
@ -1725,12 +1719,12 @@ static void onMotorcycle(int snum, ESyncBits &actions)
if (!p->VBumpNow) if (!p->VBumpNow)
if ((krand() & 3) == 2) if ((krand() & 3) == 2)
p->VBumpTarget = (p->MotoSpeed >> 4) * ((krand() & 7) - 4); p->VBumpTarget = (p->MotoSpeed >> 4) * ((krand() & 7) - 4);
if (var74 || p->moto_drink < 0) if (turnLeft || p->moto_drink < 0)
{ {
if (p->moto_drink < 0) if (p->moto_drink < 0)
p->moto_drink++; p->moto_drink++;
} }
else if (var7c || p->moto_drink > 0) else if (turnRight || p->moto_drink > 0)
{ {
if (p->moto_drink > 0) if (p->moto_drink > 0)
p->moto_drink--; p->moto_drink--;
@ -1784,37 +1778,37 @@ static void onMotorcycle(int snum, ESyncBits &actions)
p->horizon.addadjustment(horiz - FixedToFloat(p->horizon.horiz.asq16())); p->horizon.addadjustment(horiz - FixedToFloat(p->horizon.horiz.asq16()));
} }
if (p->MotoSpeed >= 20 && p->on_ground == 1 && (var74 || var7c)) short currSpeed, currAngle, velAdjustment, angAdjustment;
if (p->MotoSpeed >= 20 && p->on_ground == 1 && (turnLeft || turnRight))
{ {
short var8c, var90, var94, var98; currSpeed = p->MotoSpeed;
var8c = p->MotoSpeed; currAngle = p->angle.ang.asbuild();
var90 = p->angle.ang.asbuild(); if (turnLeft)
if (var74) velAdjustment = -10;
var94 = -10;
else else
var94 = 10; velAdjustment = 10;
if (var94 < 0) if (velAdjustment < 0)
var98 = 350; angAdjustment = 350;
else else
var98 = -350; angAdjustment = -350;
int ang;
if (p->moto_on_mud || p->moto_on_oil || !p->NotOnWater) if (p->moto_on_mud || p->moto_on_oil || !p->NotOnWater)
{ {
if (p->moto_on_oil) if (p->moto_on_oil)
var8c <<= 3; currSpeed <<= 3;
else else
var8c <<= 2; currSpeed <<= 2;
if (p->moto_do_bump) if (p->moto_do_bump)
{ {
p->posxv += (var8c >> 5) * (sintable[(var94 * -51 + var90 + 512) & 2047] << 4); p->posxv += (currSpeed >> 5) * (sintable[(velAdjustment * -51 + currAngle + 512) & 2047] << 4);
p->posyv += (var8c >> 5) * (sintable[(var94 * -51 + var90) & 2047] << 4); p->posyv += (currSpeed >> 5) * (sintable[(velAdjustment * -51 + currAngle) & 2047] << 4);
ang = var98 >> 2; angAdjustment >>= 2;
} }
else else
{ {
p->posxv += (var8c >> 7) * (sintable[(var94 * -51 + var90 + 512) & 2047] << 4); p->posxv += (currSpeed >> 7) * (sintable[(velAdjustment * -51 + currAngle + 512) & 2047] << 4);
p->posyv += (var8c >> 7) * (sintable[(var94 * -51 + var90) & 2047] << 4); p->posyv += (currSpeed >> 7) * (sintable[(velAdjustment * -51 + currAngle) & 2047] << 4);
ang = var98 >> 6; angAdjustment >>= 6;
} }
p->moto_on_mud = 0; p->moto_on_mud = 0;
p->moto_on_oil = 0; p->moto_on_oil = 0;
@ -1823,37 +1817,36 @@ static void onMotorcycle(int snum, ESyncBits &actions)
{ {
if (p->moto_do_bump) if (p->moto_do_bump)
{ {
p->posxv += (var8c >> 5) * (sintable[(var94 * -51 + var90 + 512) & 2047] << 4); p->posxv += (currSpeed >> 5) * (sintable[(velAdjustment * -51 + currAngle + 512) & 2047] << 4);
p->posyv += (var8c >> 5) * (sintable[(var94 * -51 + var90) & 2047] << 4); p->posyv += (currSpeed >> 5) * (sintable[(velAdjustment * -51 + currAngle) & 2047] << 4);
ang = var98 >> 4; angAdjustment >>= 4;
if (!S_CheckActorSoundPlaying(pact, 220)) if (!S_CheckActorSoundPlaying(pact, 220))
S_PlayActorSound(220, pact); S_PlayActorSound(220, pact);
} }
else else
{ {
p->posxv += (var8c >> 7) * (sintable[(var94 * -51 + var90 + 512) & 2047] << 4); p->posxv += (currSpeed >> 7) * (sintable[(velAdjustment * -51 + currAngle + 512) & 2047] << 4);
p->posyv += (var8c >> 7) * (sintable[(var94 * -51 + var90) & 2047] << 4); p->posyv += (currSpeed >> 7) * (sintable[(velAdjustment * -51 + currAngle) & 2047] << 4);
ang = var98 >> 7; angAdjustment >>= 7;
} }
} }
p->angle.addadjustment(FixedToFloat(getincangleq16(p->angle.ang.asq16(), IntToFixed(var90 - ang)))); p->angle.addadjustment(FixedToFloat(getincangleq16(p->angle.ang.asq16(), IntToFixed(currAngle - angAdjustment))));
} }
else if (p->MotoSpeed >= 20 && p->on_ground == 1 && (p->moto_on_mud || p->moto_on_oil)) else if (p->MotoSpeed >= 20 && p->on_ground == 1 && (p->moto_on_mud || p->moto_on_oil))
{ {
short var9c, vara0, vara4=0; currSpeed = p->MotoSpeed;
var9c = p->MotoSpeed; currAngle = p->angle.ang.asbuild();
vara0 = p->angle.ang.asbuild(); rng = krand() & 1;
var84 = krand() & 1; if (rng == 0)
if (var84 == 0) velAdjustment = -10;
vara4 = -10; else if (rng == 1)
else if (var84 == 1) velAdjustment = 10;
vara4 = 10;
if (p->moto_on_oil) if (p->moto_on_oil)
var9c *= 10; currSpeed *= 10;
else else
var9c *= 5; currSpeed *= 5;
p->posxv += (var9c >> 7) * (sintable[(vara4 * -51 + vara0 + 512) & 2047] << 4); p->posxv += (currSpeed >> 7) * (sintable[(velAdjustment * -51 + currAngle + 512) & 2047] << 4);
p->posyv += (var9c >> 7) * (sintable[(vara4 * -51 + vara0) & 2047] << 4); p->posyv += (currSpeed >> 7) * (sintable[(velAdjustment * -51 + currAngle) & 2047] << 4);
} }
p->moto_on_mud = 0; p->moto_on_mud = 0;
p->moto_on_oil = 0; p->moto_on_oil = 0;
@ -1871,8 +1864,8 @@ static void onBoat(int snum, ESyncBits &actions)
auto pact = p->GetActor(); auto pact = p->GetActor();
auto s = &pact->s; auto s = &pact->s;
int vara8, varac, varb0, varb4, varb8, varbc, varc0, varc4, varc8; int heeltoe, braking, moveForward, moveBackward, turnLeft, turnRight;
short varcc; short rng;
if (p->NotOnWater) if (p->NotOnWater)
{ {
if (p->MotoSpeed > 0) if (p->MotoSpeed > 0)
@ -1890,16 +1883,16 @@ static void onBoat(int snum, ESyncBits &actions)
p->MotoSpeed = 0; p->MotoSpeed = 0;
if ((actions & SB_CROUCH) && (actions & SB_JUMP)) if ((actions & SB_CROUCH) && (actions & SB_JUMP))
{ {
vara8 = 1; heeltoe = 1;
varac = 0; moveForward = 0;
varb0 = 0; braking = 0;
actions &= ~(SB_JUMP|SB_CROUCH); actions &= ~(SB_JUMP|SB_CROUCH);
} }
else else
vara8 = 0; heeltoe = 0;
if (actions & SB_JUMP) if (actions & SB_JUMP)
{ {
varac = 1; moveForward = 1;
actions &= ~SB_JUMP; actions &= ~SB_JUMP;
if (p->MotoSpeed == 0 && !S_CheckActorSoundPlaying(pact, 89)) if (p->MotoSpeed == 0 && !S_CheckActorSoundPlaying(pact, 89))
{ {
@ -1914,7 +1907,7 @@ static void onBoat(int snum, ESyncBits &actions)
} }
else else
{ {
varac = 0; moveForward = 0;
if (S_CheckActorSoundPlaying(pact, 89)) if (S_CheckActorSoundPlaying(pact, 89))
{ {
S_StopSound(89, pact); S_StopSound(89, pact);
@ -1933,66 +1926,61 @@ static void onBoat(int snum, ESyncBits &actions)
if (actions & SB_CROUCH) if (actions & SB_CROUCH)
{ {
varb0 = 1; braking = 1;
actions &= ~SB_CROUCH; actions &= ~SB_CROUCH;
} }
else else
varb0 = 0; braking = 0;
if (p->vehicle_backwards) if (p->vehicle_backwards)
{ {
varb4 = 1; moveBackward = 1;
p->vehicle_backwards = false; p->vehicle_backwards = false;
} }
else varb4 = 0; else moveBackward = 0;
if (p->vehicle_turnl) if (p->vehicle_turnl)
{ {
varb8 = 1; turnLeft = 1;
varbc = 1;
p->vehicle_turnl = false; p->vehicle_turnl = false;
if (!S_CheckActorSoundPlaying(pact, 91) && p->MotoSpeed > 30 && !p->NotOnWater) if (!S_CheckActorSoundPlaying(pact, 91) && p->MotoSpeed > 30 && !p->NotOnWater)
S_PlayActorSound(91, pact); S_PlayActorSound(91, pact);
} }
else else
{ {
varb8 = 0; turnLeft = 0;
varbc = 0;
} }
if (p->vehicle_turnr) if (p->vehicle_turnr)
{ {
varc0 = 1; turnRight = 1;
varc4 = 1;
p->vehicle_turnr = false; p->vehicle_turnr = false;
if (!S_CheckActorSoundPlaying(pact, 91) && p->MotoSpeed > 30 && !p->NotOnWater) if (!S_CheckActorSoundPlaying(pact, 91) && p->MotoSpeed > 30 && !p->NotOnWater)
S_PlayActorSound(91, pact); S_PlayActorSound(91, pact);
} }
else else
{ {
varc0 = 0; turnRight = 0;
varc4 = 0;
} }
varc8 = 0;
if (!p->NotOnWater) if (!p->NotOnWater)
{ {
if (p->drink_amt > 88 && p->moto_drink == 0) if (p->drink_amt > 88 && p->moto_drink == 0)
{ {
varcc = krand() & 63; rng = krand() & 63;
if (varcc == 1) if (rng == 1)
p->moto_drink = -10; p->moto_drink = -10;
else if (varcc == 2) else if (rng == 2)
p->moto_drink = 10; p->moto_drink = 10;
} }
else if (p->drink_amt > 99 && p->moto_drink == 0) else if (p->drink_amt > 99 && p->moto_drink == 0)
{ {
varcc = krand() & 31; rng = krand() & 31;
if (varcc == 1) if (rng == 1)
p->moto_drink = -20; p->moto_drink = -20;
else if (varcc == 2) else if (rng == 2)
p->moto_drink = 20; p->moto_drink = 20;
} }
} }
if (p->on_ground == 1) if (p->on_ground == 1)
{ {
if (vara8) if (heeltoe)
{ {
if (p->MotoSpeed <= 25) if (p->MotoSpeed <= 25)
{ {
@ -2009,7 +1997,7 @@ static void onBoat(int snum, ESyncBits &actions)
p->moto_do_bump = 1; p->moto_do_bump = 1;
} }
} }
else if (varb0 && p->MotoSpeed > 0) else if (braking && p->MotoSpeed > 0)
{ {
p->MotoSpeed -= 2; p->MotoSpeed -= 2;
if (p->MotoSpeed < 0) if (p->MotoSpeed < 0)
@ -2017,7 +2005,7 @@ static void onBoat(int snum, ESyncBits &actions)
p->VBumpTarget = 30; p->VBumpTarget = 30;
p->moto_do_bump = 1; p->moto_do_bump = 1;
} }
else if (varac) else if (moveForward)
{ {
if (p->MotoSpeed < 40) if (p->MotoSpeed < 40)
if (!p->NotOnWater) if (!p->NotOnWater)
@ -2031,22 +2019,21 @@ static void onBoat(int snum, ESyncBits &actions)
} }
else if (p->MotoSpeed > 0) else if (p->MotoSpeed > 0)
p->MotoSpeed--; p->MotoSpeed--;
if (p->moto_do_bump && (!varb0 || p->MotoSpeed == 0)) if (p->moto_do_bump && (!braking || p->MotoSpeed == 0))
{ {
p->VBumpTarget = 0; p->VBumpTarget = 0;
p->moto_do_bump = 0; p->moto_do_bump = 0;
} }
if (varb4 && p->MotoSpeed == 0 && !varb0) if (moveBackward && p->MotoSpeed == 0 && !braking)
{ {
int vard0; int temp;
if (!p->NotOnWater) if (!p->NotOnWater)
p->MotoSpeed = -25; p->MotoSpeed = -25;
else else
p->MotoSpeed = -20; p->MotoSpeed = -20;
vard0 = varc4; temp = turnRight;
varc4 = varbc; turnRight = turnLeft;
varbc = vard0; turnLeft = temp;
varc8 = 1;
} }
} }
if (p->MotoSpeed != 0 && p->on_ground == 1) if (p->MotoSpeed != 0 && p->on_ground == 1)
@ -2054,12 +2041,12 @@ static void onBoat(int snum, ESyncBits &actions)
if (!p->VBumpNow) if (!p->VBumpNow)
if ((krand() & 15) == 14) if ((krand() & 15) == 14)
p->VBumpTarget = (p->MotoSpeed >> 4) * ((krand() & 3) - 2); p->VBumpTarget = (p->MotoSpeed >> 4) * ((krand() & 3) - 2);
if (varbc || p->moto_drink < 0) if (turnLeft || p->moto_drink < 0)
{ {
if (p->moto_drink < 0) if (p->moto_drink < 0)
p->moto_drink++; p->moto_drink++;
} }
else if (varc4 || p->moto_drink > 0) else if (turnRight || p->moto_drink > 0)
{ {
if (p->moto_drink > 0) if (p->moto_drink > 0)
p->moto_drink--; p->moto_drink--;
@ -2113,34 +2100,34 @@ static void onBoat(int snum, ESyncBits &actions)
p->horizon.addadjustment(horiz - FixedToFloat(p->horizon.horiz.asq16())); p->horizon.addadjustment(horiz - FixedToFloat(p->horizon.horiz.asq16()));
} }
if (p->MotoSpeed > 0 && p->on_ground == 1 && (varbc || varc4)) if (p->MotoSpeed > 0 && p->on_ground == 1 && (turnLeft || turnRight))
{ {
short vard4, vard8, vardc, vare0; short currSpeed, currAngle, velAdjustment, angAdjustment;
vard4 = p->MotoSpeed; currSpeed = p->MotoSpeed;
vard8 = p->angle.ang.asbuild(); currAngle = p->angle.ang.asbuild();
if (varbc) if (turnLeft)
vardc = -10; velAdjustment = -10;
else else
vardc = 10; velAdjustment = 10;
if (vardc < 0) if (velAdjustment < 0)
vare0 = 350; angAdjustment = 350;
else else
vare0 = -350; angAdjustment = -350;
vard4 <<= 2; currSpeed <<= 2;
int ang;
if (p->moto_do_bump) if (p->moto_do_bump)
{ {
p->posxv += (vard4 >> 6) * (sintable[(vardc * -51 + vard8 + 512) & 2047] << 4); p->posxv += (currSpeed >> 6) * (sintable[(velAdjustment * -51 + currAngle + 512) & 2047] << 4);
p->posyv += (vard4 >> 6) * (sintable[(vardc * -51 + vard8) & 2047] << 4); p->posyv += (currSpeed >> 6) * (sintable[(velAdjustment * -51 + currAngle) & 2047] << 4);
ang = vare0 >> 5; angAdjustment >>= 5;
} }
else else
{ {
p->posxv += (vard4 >> 7) * (sintable[(vardc * -51 + vard8 + 512) & 2047] << 4); p->posxv += (currSpeed >> 7) * (sintable[(velAdjustment * -51 + currAngle + 512) & 2047] << 4);
p->posyv += (vard4 >> 7) * (sintable[(vardc * -51 + vard8) & 2047] << 4); p->posyv += (currSpeed >> 7) * (sintable[(velAdjustment * -51 + currAngle) & 2047] << 4);
ang = vare0 >> 6; angAdjustment >>= 6;
} }
p->angle.addadjustment(FixedToFloat(getincangleq16(p->angle.ang.asq16(), IntToFixed(vard8 - ang)))); p->angle.addadjustment(FixedToFloat(getincangleq16(p->angle.ang.asq16(), IntToFixed(currAngle - angAdjustment))));
} }
if (p->NotOnWater) if (p->NotOnWater)
if (p->MotoSpeed > 50) if (p->MotoSpeed > 50)
@ -2465,10 +2452,10 @@ void onMotorcycleMove(int snum, int psect, int j)
auto s = &pact->s; auto s = &pact->s;
int psectlotag = sector[psect].lotag; int psectlotag = sector[psect].lotag;
short var104, var108, var10c; short damageAmount, wallAngle, angleDelta;
var104 = 0; damageAmount = 0;
var108 = getangle(wall[wall[j].point2].x - wall[j].x, wall[wall[j].point2].y - wall[j].y); wallAngle = getangle(wall[wall[j].point2].x - wall[j].x, wall[wall[j].point2].y - wall[j].y);
var10c = abs(p->angle.ang.asbuild() - var108); angleDelta = abs(p->angle.ang.asbuild() - wallAngle);
int ang; int ang;
switch (krand() & 1) switch (krand() & 1)
{ {
@ -2480,41 +2467,41 @@ void onMotorcycleMove(int snum, int psect, int j)
break; break;
} }
p->angle.addadjustment(ang); p->angle.addadjustment(ang);
if (var10c >= 441 && var10c <= 581) if (angleDelta >= 441 && angleDelta <= 581)
{ {
var104 = (p->MotoSpeed * p->MotoSpeed) >> 8; damageAmount = (p->MotoSpeed * p->MotoSpeed) >> 8;
p->MotoSpeed = 0; p->MotoSpeed = 0;
if (S_CheckActorSoundPlaying(pact, 238) == 0) if (S_CheckActorSoundPlaying(pact, 238) == 0)
S_PlayActorSound(238, pact); S_PlayActorSound(238, pact);
} }
else if (var10c >= 311 && var10c <= 711) else if (angleDelta >= 311 && angleDelta <= 711)
{ {
var104 = (p->MotoSpeed * p->MotoSpeed) >> 11; damageAmount = (p->MotoSpeed * p->MotoSpeed) >> 11;
p->MotoSpeed -= (p->MotoSpeed >> 1) + (p->MotoSpeed >> 2); p->MotoSpeed -= (p->MotoSpeed >> 1) + (p->MotoSpeed >> 2);
if (S_CheckActorSoundPlaying(pact, 238) == 0) if (S_CheckActorSoundPlaying(pact, 238) == 0)
S_PlayActorSound(238, pact); S_PlayActorSound(238, pact);
} }
else if (var10c >= 111 && var10c <= 911) else if (angleDelta >= 111 && angleDelta <= 911)
{ {
var104 = (p->MotoSpeed * p->MotoSpeed) >> 14; damageAmount = (p->MotoSpeed * p->MotoSpeed) >> 14;
p->MotoSpeed -= (p->MotoSpeed >> 1); p->MotoSpeed -= (p->MotoSpeed >> 1);
if (S_CheckActorSoundPlaying(pact, 239) == 0) if (S_CheckActorSoundPlaying(pact, 239) == 0)
S_PlayActorSound(239, pact); S_PlayActorSound(239, pact);
} }
else else
{ {
var104 = (p->MotoSpeed * p->MotoSpeed) >> 15; damageAmount = (p->MotoSpeed * p->MotoSpeed) >> 15;
p->MotoSpeed -= (p->MotoSpeed >> 3); p->MotoSpeed -= (p->MotoSpeed >> 3);
if (S_CheckActorSoundPlaying(pact, 240) == 0) if (S_CheckActorSoundPlaying(pact, 240) == 0)
S_PlayActorSound(240, pact); S_PlayActorSound(240, pact);
} }
s->extra -= var104; s->extra -= damageAmount;
if (s->extra <= 0) if (s->extra <= 0)
{ {
S_PlayActorSound(SQUISHED, pact); S_PlayActorSound(SQUISHED, pact);
SetPlayerPal(p, PalEntry(63, 63, 0, 0)); SetPlayerPal(p, PalEntry(63, 63, 0, 0));
} }
else if (var104) else if (damageAmount)
S_PlayActorSound(DUKE_LAND_HURT, pact); S_PlayActorSound(DUKE_LAND_HURT, pact);
} }
@ -2532,9 +2519,9 @@ void onBoatMove(int snum, int psect, int j)
auto s = &pact->s; auto s = &pact->s;
int psectlotag = sector[psect].lotag; int psectlotag = sector[psect].lotag;
short var114, var118; short wallAngle, angleDelta;
var114 = getangle(wall[wall[j].point2].x - wall[j].x, wall[wall[j].point2].y - wall[j].y); wallAngle = getangle(wall[wall[j].point2].x - wall[j].x, wall[wall[j].point2].y - wall[j].y);
var118 = abs(p->angle.ang.asbuild() - var114); angleDelta = abs(p->angle.ang.asbuild() - wallAngle);
int ang; int ang;
switch (krand() & 1) switch (krand() & 1)
{ {
@ -2546,21 +2533,21 @@ void onBoatMove(int snum, int psect, int j)
break; break;
} }
p->angle.addadjustment(ang); p->angle.addadjustment(ang);
if (var118 >= 441 && var118 <= 581) if (angleDelta >= 441 && angleDelta <= 581)
{ {
p->MotoSpeed = ((p->MotoSpeed >> 1) + (p->MotoSpeed >> 2)) >> 2; p->MotoSpeed = ((p->MotoSpeed >> 1) + (p->MotoSpeed >> 2)) >> 2;
if (psectlotag == 1) if (psectlotag == 1)
if (S_CheckActorSoundPlaying(pact, 178) == 0) if (S_CheckActorSoundPlaying(pact, 178) == 0)
S_PlayActorSound(178, pact); S_PlayActorSound(178, pact);
} }
else if (var118 >= 311 && var118 <= 711) else if (angleDelta >= 311 && angleDelta <= 711)
{ {
p->MotoSpeed -= ((p->MotoSpeed >> 1) + (p->MotoSpeed >> 2)) >> 3; p->MotoSpeed -= ((p->MotoSpeed >> 1) + (p->MotoSpeed >> 2)) >> 3;
if (psectlotag == 1) if (psectlotag == 1)
if (S_CheckActorSoundPlaying(pact, 179) == 0) if (S_CheckActorSoundPlaying(pact, 179) == 0)
S_PlayActorSound(179, pact); S_PlayActorSound(179, pact);
} }
else if (var118 >= 111 && var118 <= 911) else if (angleDelta >= 111 && angleDelta <= 911)
{ {
p->MotoSpeed -= (p->MotoSpeed >> 4); p->MotoSpeed -= (p->MotoSpeed >> 4);
if (psectlotag == 1) if (psectlotag == 1)