mirror of
https://github.com/ZDoom/Raze.git
synced 2025-04-07 00:11:22 +00:00
- wrapped as much of _slide_vect as possible.
This commit is contained in:
parent
6c5010835c
commit
66474142a4
3 changed files with 16 additions and 14 deletions
|
@ -642,6 +642,8 @@ struct PLAYER
|
|||
void set_int_vect_y(int v) { _vect.Y = v; }
|
||||
void add_int_vect_x(int v) { _vect.X += v; }
|
||||
void add_int_vect_y(int v) { _vect.Y += v; }
|
||||
void set_int_slide_vect_x(int v) { _slide_vect.X = v; }
|
||||
void set_int_slide_vect_y(int v) { _slide_vect.Y = v; }
|
||||
|
||||
int friction;
|
||||
int16_t slide_ang; // todo: floatify
|
||||
|
|
|
@ -1845,17 +1845,17 @@ void DoPlayerSlide(PLAYER* pp)
|
|||
|
||||
int push_ret;
|
||||
|
||||
if ((pp->_slide_vect.X|pp->_slide_vect.Y) == 0)
|
||||
if ((pp->int_slide_vect().X|pp->int_slide_vect().Y) == 0)
|
||||
return;
|
||||
|
||||
if (pp->sop)
|
||||
return;
|
||||
|
||||
pp->_slide_vect.X = MulScale(pp->_slide_vect.X, PLAYER_SLIDE_FRICTION, 16);
|
||||
pp->_slide_vect.Y = MulScale(pp->_slide_vect.Y, PLAYER_SLIDE_FRICTION, 16);
|
||||
pp->set_int_slide_vect_x(MulScale(pp->int_slide_vect().X, PLAYER_SLIDE_FRICTION, 16));
|
||||
pp->set_int_slide_vect_y(MulScale(pp->int_slide_vect().Y, PLAYER_SLIDE_FRICTION, 16));
|
||||
|
||||
if (abs(pp->_slide_vect.X) < 12800 && abs(pp->_slide_vect.Y) < 12800)
|
||||
pp->_slide_vect.X = pp->_slide_vect.Y = 0;
|
||||
if (abs(pp->int_slide_vect().X) < 12800 && abs(pp->int_slide_vect().Y) < 12800)
|
||||
pp->_slide_vect = { 0, 0 };
|
||||
|
||||
push_ret = pushmove(pp->pos, &pp->cursector, ((int)actor->spr.clipdist<<2), pp->p_ceiling_dist, pp->p_floor_dist, CLIPMASK_PLAYER);
|
||||
if (push_ret < 0)
|
||||
|
@ -1871,7 +1871,7 @@ void DoPlayerSlide(PLAYER* pp)
|
|||
return;
|
||||
}
|
||||
Collision coll;
|
||||
clipmove(pp->pos, &pp->cursector, pp->_slide_vect.X, pp->_slide_vect.Y, ((int)actor->spr.clipdist<<2), pp->p_ceiling_dist, pp->p_floor_dist, CLIPMASK_PLAYER, coll);
|
||||
clipmove(pp->pos, &pp->cursector, pp->int_slide_vect().X, pp->int_slide_vect().Y, ((int)actor->spr.clipdist<<2), pp->p_ceiling_dist, pp->p_floor_dist, CLIPMASK_PLAYER, coll);
|
||||
|
||||
PlayerCheckValidMove(pp);
|
||||
push_ret = pushmove(pp->pos, &pp->cursector, ((int)actor->spr.clipdist<<2), pp->p_ceiling_dist, pp->p_floor_dist, CLIPMASK_PLAYER);
|
||||
|
@ -2618,8 +2618,8 @@ void DoPlayerMoveVehicle(PLAYER* pp)
|
|||
if (vel > 13000)
|
||||
{
|
||||
VehicleMoveHit(actor);
|
||||
pp->_slide_vect.X = -pp->int_vect().X<<1;
|
||||
pp->_slide_vect.Y = -pp->int_vect().Y<<1;
|
||||
pp->set_int_slide_vect_x(-pp->int_vect().X<<1);
|
||||
pp->set_int_slide_vect_y(-pp->int_vect().Y<<1);
|
||||
if (!(sop->flags & SOBJ_NO_QUAKE))
|
||||
SetPlayerQuake(pp);
|
||||
}
|
||||
|
|
|
@ -5250,23 +5250,23 @@ int PlayerDamageSlide(PLAYER* pp, int damage, short ang)
|
|||
else if (damage <= 10)
|
||||
{
|
||||
//nudge
|
||||
pp->_slide_vect.X = MOVEx(16, ang)<<15;
|
||||
pp->_slide_vect.Y = MOVEy(16, ang)<<15;
|
||||
pp->set_int_slide_vect_x(MOVEx(16, ang)<<15);
|
||||
pp->set_int_slide_vect_y(MOVEy(16, ang)<<15);
|
||||
return true;
|
||||
}
|
||||
else if (damage <= 20)
|
||||
{
|
||||
//bigger nudge
|
||||
pp->_slide_vect.X = MOVEx(64, ang)<<15;
|
||||
pp->_slide_vect.Y = MOVEy(64, ang)<<15;
|
||||
pp->set_int_slide_vect_x(MOVEx(64, ang)<<15);
|
||||
pp->set_int_slide_vect_y(MOVEy(64, ang)<<15);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
slide_vel = (damage * 6);
|
||||
|
||||
pp->_slide_vect.X = MOVEx(slide_vel, ang)<<15;
|
||||
pp->_slide_vect.Y = MOVEy(slide_vel, ang)<<15;
|
||||
pp->set_int_slide_vect_x(MOVEx(slide_vel, ang)<<15);
|
||||
pp->set_int_slide_vect_y(MOVEy(slide_vel, ang)<<15);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue