mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-26 05:51:00 +00:00
- DoTankTreads and DoPlayerMoveVehicle unwrapped
This commit is contained in:
parent
a5f0788f15
commit
8efe6f638b
1 changed files with 11 additions and 17 deletions
|
@ -2179,17 +2179,15 @@ void StopSOsound(sectortype* sect)
|
||||||
void DoTankTreads(PLAYER* pp)
|
void DoTankTreads(PLAYER* pp)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int vel;
|
|
||||||
sectortype* *sectp;
|
sectortype* *sectp;
|
||||||
int j;
|
int j;
|
||||||
int dot;
|
|
||||||
bool reverse = false;
|
bool reverse = false;
|
||||||
|
|
||||||
if (Prediction)
|
if (Prediction)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
vel = FindDistance2D(pp->int_vect().X>>8, pp->int_vect().Y>>8);
|
int vel = int(pp->vect.Length() * 1024);
|
||||||
dot = DOT_PRODUCT_2D(pp->int_vect().X, pp->int_vect().Y, pp->angle.ang.Cos() * (1 << 14), pp->angle.ang.Sin() * (1 << 14));
|
double dot = pp->vect.dot(pp->angle.ang.ToVector());
|
||||||
if (dot < 0)
|
if (dot < 0)
|
||||||
reverse = true;
|
reverse = true;
|
||||||
|
|
||||||
|
@ -2470,27 +2468,23 @@ void DoPlayerMoveVehicle(PLAYER* pp)
|
||||||
|
|
||||||
if (sop->drive_speed)
|
if (sop->drive_speed)
|
||||||
{
|
{
|
||||||
pp->set_int_vect_x(MulScale(pp->input.fvel, sop->drive_speed, 6));
|
pp->vect.X = MulScaleF(pp->input.fvel, sop->drive_speed, 24);
|
||||||
pp->set_int_vect_y(MulScale(pp->input.svel, sop->drive_speed, 6));
|
pp->vect.Y = MulScaleF(pp->input.svel, sop->drive_speed, 24);
|
||||||
|
|
||||||
// does sliding/momentum
|
// does sliding/momentum
|
||||||
pp->set_int_vect_x((pp->int_vect().X + (pp->int_ovect().X*(sop->drive_slide-1)))/sop->drive_slide);
|
pp->vect = (pp->vect + (pp->ovect * (sop->drive_slide-1)))/sop->drive_slide;
|
||||||
pp->set_int_vect_y((pp->int_vect().Y + (pp->int_ovect().Y*(sop->drive_slide-1)))/sop->drive_slide);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pp->add_int_vect_x(((pp->input.fvel*synctics*2)<<6));
|
pp->vect.X += (pp->input.fvel*synctics*2) * INPUT_SCALE;
|
||||||
pp->add_int_vect_y(((pp->input.svel*synctics*2)<<6));
|
pp->vect.Y += (pp->input.svel*synctics*2) * INPUT_SCALE;
|
||||||
|
pp->vect *= TANK_FRICTION;
|
||||||
|
|
||||||
pp->set_int_vect_x(MulScale(pp->int_vect().X, TANK_FRICTION, 16));
|
pp->vect = (pp->vect + (pp->ovect*1))/2;
|
||||||
pp->set_int_vect_y(MulScale(pp->int_vect().Y, TANK_FRICTION, 16));
|
|
||||||
|
|
||||||
pp->set_int_vect_x((pp->int_vect().X + (pp->int_ovect().X*1))/2);
|
|
||||||
pp->set_int_vect_y((pp->int_vect().Y + (pp->int_ovect().Y*1))/2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (abs(pp->int_vect().X) < 12800 && abs(pp->int_vect().Y) < 12800)
|
if (abs(pp->vect.X) < 0.5 && abs(pp->vect.Y) < 0.5)
|
||||||
pp->vect.Zero();
|
pp->vect.X = pp->vect.Y = 0;
|
||||||
|
|
||||||
pp->lastcursector = pp->cursector;
|
pp->lastcursector = pp->cursector;
|
||||||
z = pp->int_ppos().Z + Z(10);
|
z = pp->int_ppos().Z + Z(10);
|
||||||
|
|
Loading…
Reference in a new issue