mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 17:01:51 +00:00
- DoPlayerClimb unwrapped
This commit is contained in:
parent
8efe6f638b
commit
a3dd506171
1 changed files with 8 additions and 11 deletions
|
@ -95,7 +95,7 @@ constexpr double INPUT_SCALE = 1. / (1 << 12); // Old code used << 6 to get a Q1
|
||||||
#define PLAYER_DIVE_FRICTION (49152L)
|
#define PLAYER_DIVE_FRICTION (49152L)
|
||||||
|
|
||||||
// only for z direction climbing
|
// only for z direction climbing
|
||||||
#define PLAYER_CLIMB_FRICTION (45056L)
|
constexpr double PLAYER_CLIMB_FRICTION = FixedToFloat(45056);
|
||||||
constexpr double TANK_FRICTION = FixedToFloat(53248);
|
constexpr double TANK_FRICTION = FixedToFloat(53248);
|
||||||
constexpr double PLAYER_SLIDE_FRICTION = FixedToFloat(53248);
|
constexpr double PLAYER_SLIDE_FRICTION = FixedToFloat(53248);
|
||||||
|
|
||||||
|
@ -3059,23 +3059,20 @@ void DoPlayerBeginClimb(PLAYER* pp)
|
||||||
void DoPlayerClimb(PLAYER* pp)
|
void DoPlayerClimb(PLAYER* pp)
|
||||||
{
|
{
|
||||||
DSWActor* plActor = pp->actor;
|
DSWActor* plActor = pp->actor;
|
||||||
double climbVel;
|
|
||||||
int i;
|
int i;
|
||||||
int dot;
|
|
||||||
bool LadderUpdate = false;
|
bool LadderUpdate = false;
|
||||||
|
|
||||||
if (Prediction)
|
if (Prediction)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
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->set_int_vect_x(MulScale(pp->int_vect().X, PLAYER_CLIMB_FRICTION, 16));
|
pp->vect *= PLAYER_CLIMB_FRICTION;
|
||||||
pp->set_int_vect_y(MulScale(pp->int_vect().Y, PLAYER_CLIMB_FRICTION, 16));
|
if (abs(pp->vect.X) < 0.05 && abs(pp->vect.Y) < 0.05)
|
||||||
if (abs(pp->int_vect().X) < 12800 && abs(pp->int_vect().Y) < 12800)
|
pp->vect.X = pp->vect.Y = 0;
|
||||||
pp->vect.Zero();
|
|
||||||
|
|
||||||
climbVel = DVector2(pp->int_vect().X, pp->int_vect().Y).Length() * (1. / 512) * zinttoworld;
|
double climbVel = pp->vect.Length() * 2;
|
||||||
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)
|
||||||
climbVel = -climbVel;
|
climbVel = -climbVel;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue