mirror of
https://github.com/DrBeef/Raze.git
synced 2025-01-19 07:31:03 +00:00
- made player.vel and gs.playerfriction floating point.
No change in value range yet, but having them as floats now allows easier refactoring.
This commit is contained in:
parent
8171927c2a
commit
477120923f
6 changed files with 37 additions and 37 deletions
|
@ -3642,8 +3642,8 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
|
|||
}
|
||||
else
|
||||
{
|
||||
ps[playernum].__vel.X = MulScale(ps[playernum].__vel.X, gs.playerfriction - 0x2000, 16);
|
||||
ps[playernum].__vel.Y = MulScale(ps[playernum].__vel.Y, gs.playerfriction - 0x2000, 16);
|
||||
ps[playernum].__vel.X = MulScaleF(ps[playernum].__vel.X, gs.playerfriction - 0x2000, 16);
|
||||
ps[playernum].__vel.Y = MulScaleF(ps[playernum].__vel.Y, gs.playerfriction - 0x2000, 16);
|
||||
}
|
||||
}
|
||||
else if (actor->spr.picnum != DRONE && actor->spr.picnum != SHARK && actor->spr.picnum != COMMANDER)
|
||||
|
|
|
@ -3674,8 +3674,8 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
|
|||
}
|
||||
else
|
||||
{
|
||||
ps[pnum].__vel.X = MulScale(ps[pnum].__vel.X, gs.playerfriction - 0x2000, 16);
|
||||
ps[pnum].__vel.Y = MulScale(ps[pnum].__vel.Y, gs.playerfriction - 0x2000, 16);
|
||||
ps[pnum].__vel.X = MulScaleF(ps[pnum].__vel.X, gs.playerfriction - 0x2000, 16);
|
||||
ps[pnum].__vel.Y = MulScaleF(ps[pnum].__vel.Y, gs.playerfriction - 0x2000, 16);
|
||||
}
|
||||
}
|
||||
else if ((isRRRA() && actor->spr.picnum != DRONE && actor->spr.picnum != SHARK && actor->spr.picnum != UFO1_RRRA) ||
|
||||
|
|
|
@ -22,7 +22,7 @@ struct DukeGameInfo
|
|||
int morterblastradius;
|
||||
int numfreezebounces;
|
||||
int pipebombblastradius;
|
||||
int playerfriction;
|
||||
double playerfriction;
|
||||
int rpgblastradius;
|
||||
int seenineblastradius;
|
||||
int shrinkerblastradius;
|
||||
|
|
|
@ -1842,7 +1842,7 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, int fz_, in
|
|||
S_StopSound(-1, pact, CHAN_VOICE);
|
||||
|
||||
if (psectlotag != ST_1_ABOVE_WATER && psectlotag != ST_2_UNDERWATER && p->on_ground == 0 && p->__vel.Z > (6144 >> 1))
|
||||
p->hard_landing = p->__vel.Z >> 10;
|
||||
p->hard_landing = p->__vel.Z / 1024.;
|
||||
|
||||
p->on_ground = 1;
|
||||
|
||||
|
@ -1862,7 +1862,7 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, int fz_, in
|
|||
if (p->on_warping_sector == 0 && p->pos.Z > floorz - 16)
|
||||
{
|
||||
p->pos.Z = floorz - 16;
|
||||
p->__vel.Z >>= 1;
|
||||
p->__vel.Z *= 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1979,7 +1979,7 @@ static void underwater(int snum, ESyncBits actions, int fz_, int cz_)
|
|||
}
|
||||
|
||||
if (p->__vel.Z > 2048)
|
||||
p->__vel.Z >>= 1;
|
||||
p->__vel.Z *= 0.5;
|
||||
|
||||
p->pos.Z += p->__vel.Z * zinttoworld;
|
||||
|
||||
|
@ -2998,20 +2998,20 @@ void processinput_d(int snum)
|
|||
else check = ((aplWeaponWorksLike(p->curr_weapon, snum) == KNEE_WEAPON && p->kickback_pic > 10 && p->on_ground) || (p->on_ground && (actions & SB_CROUCH)));
|
||||
if (check)
|
||||
{
|
||||
p->__vel.X = MulScale(p->__vel.X, gs.playerfriction - 0x2000, 16);
|
||||
p->__vel.Y = MulScale(p->__vel.Y, gs.playerfriction - 0x2000, 16);
|
||||
p->__vel.X = MulScaleF(p->__vel.X, gs.playerfriction - 0x2000, 16);
|
||||
p->__vel.Y = MulScaleF(p->__vel.Y, gs.playerfriction - 0x2000, 16);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (psectlotag == 2)
|
||||
{
|
||||
p->__vel.X = MulScale(p->__vel.X, gs.playerfriction - 0x1400, 16);
|
||||
p->__vel.Y = MulScale(p->__vel.Y, gs.playerfriction - 0x1400, 16);
|
||||
p->__vel.X = MulScaleF(p->__vel.X, gs.playerfriction - 0x1400, 16);
|
||||
p->__vel.Y = MulScaleF(p->__vel.Y, gs.playerfriction - 0x1400, 16);
|
||||
}
|
||||
else
|
||||
{
|
||||
p->__vel.X = MulScale(p->__vel.X, gs.playerfriction, 16);
|
||||
p->__vel.Y = MulScale(p->__vel.Y, gs.playerfriction, 16);
|
||||
p->__vel.X = MulScaleF(p->__vel.X, gs.playerfriction, 16);
|
||||
p->__vel.Y = MulScaleF(p->__vel.Y, gs.playerfriction, 16);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3021,9 +3021,9 @@ void processinput_d(int snum)
|
|||
if (shrunk)
|
||||
{
|
||||
p->__vel.X =
|
||||
MulScale(p->__vel.X, gs.playerfriction - (gs.playerfriction >> 1) + (gs.playerfriction >> 2), 16);
|
||||
MulScaleF(p->__vel.X, gs.playerfriction * 0.75, 16);
|
||||
p->__vel.Y =
|
||||
MulScale(p->__vel.Y, gs.playerfriction - (gs.playerfriction >> 1) + (gs.playerfriction >> 2), 16);
|
||||
MulScaleF(p->__vel.Y, gs.playerfriction * 0.75, 16);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3038,7 +3038,7 @@ HORIZONLY:
|
|||
Collision clip{};
|
||||
if (ud.clipping)
|
||||
{
|
||||
p->player_add_int_xy({ p->__vel.X >> 14, p->__vel.Y >> 14 });
|
||||
p->player_add_int_xy({ int(p->__vel.X / 16384), int(p->__vel.Y / 16384) });
|
||||
updatesector(p->pos, &p->cursector);
|
||||
ChangeActorSect(pact, p->cursector);
|
||||
}
|
||||
|
|
|
@ -2205,7 +2205,7 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, int fz_, in
|
|||
S_StopSound(-1, pact, CHAN_VOICE);
|
||||
|
||||
if (psectlotag != ST_1_ABOVE_WATER && psectlotag != ST_2_UNDERWATER && p->on_ground == 0 && p->__vel.Z > (6144 >> 1))
|
||||
p->hard_landing = p->__vel.Z >> 10;
|
||||
p->hard_landing = p->__vel.Z /= 1024.;
|
||||
|
||||
p->on_ground = 1;
|
||||
|
||||
|
@ -2225,7 +2225,7 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, int fz_, in
|
|||
if (p->on_warping_sector == 0 && p->pos.Z > floorz - 16)
|
||||
{
|
||||
p->pos.Z = floorz - 16;
|
||||
p->__vel.Z >>= 1;
|
||||
p->__vel.Z *= 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2334,7 +2334,7 @@ static void underwater(int snum, ESyncBits actions, int fz_, int cz_)
|
|||
}
|
||||
|
||||
if (p->__vel.Z > 2048)
|
||||
p->__vel.Z >>= 1;
|
||||
p->__vel.Z *= 0.5;
|
||||
|
||||
p->pos.Z += p->__vel.Z * zinttoworld;
|
||||
|
||||
|
@ -3712,20 +3712,20 @@ void processinput_r(int snum)
|
|||
|
||||
if (!isRRRA() && ((p->curr_weapon == KNEE_WEAPON && p->kickback_pic > 10 && p->on_ground) || (p->on_ground && (actions & SB_CROUCH))))
|
||||
{
|
||||
p->__vel.X = MulScale(p->__vel.X, gs.playerfriction - 0x2000, 16);
|
||||
p->__vel.Y = MulScale(p->__vel.Y, gs.playerfriction - 0x2000, 16);
|
||||
p->__vel.X = MulScaleF(p->__vel.X, gs.playerfriction - 0x2000, 16);
|
||||
p->__vel.Y = MulScaleF(p->__vel.Y, gs.playerfriction - 0x2000, 16);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (psectlotag == 2)
|
||||
{
|
||||
p->__vel.X = MulScale(p->__vel.X, gs.playerfriction - 0x1400, 16);
|
||||
p->__vel.Y = MulScale(p->__vel.Y, gs.playerfriction - 0x1400, 16);
|
||||
p->__vel.X = MulScaleF(p->__vel.X, gs.playerfriction - 0x1400, 16);
|
||||
p->__vel.Y = MulScaleF(p->__vel.Y, gs.playerfriction - 0x1400, 16);
|
||||
}
|
||||
else
|
||||
{
|
||||
p->__vel.X = MulScale(p->__vel.X, gs.playerfriction, 16);
|
||||
p->__vel.Y = MulScale(p->__vel.Y, gs.playerfriction, 16);
|
||||
p->__vel.X = MulScaleF(p->__vel.X, gs.playerfriction, 16);
|
||||
p->__vel.Y = MulScaleF(p->__vel.Y, gs.playerfriction, 16);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3746,8 +3746,8 @@ void processinput_r(int snum)
|
|||
p->boot_amount--;
|
||||
else
|
||||
{
|
||||
p->__vel.X = MulScale(p->__vel.X, gs.playerfriction, 16);
|
||||
p->__vel.Y = MulScale(p->__vel.Y, gs.playerfriction, 16);
|
||||
p->__vel.X = MulScaleF(p->__vel.X, gs.playerfriction, 16);
|
||||
p->__vel.Y = MulScaleF(p->__vel.Y, gs.playerfriction, 16);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -3758,8 +3758,8 @@ void processinput_r(int snum)
|
|||
{
|
||||
if (p->on_ground)
|
||||
{
|
||||
p->__vel.X = MulScale(p->__vel.X, gs.playerfriction - 0x1800, 16);
|
||||
p->__vel.Y = MulScale(p->__vel.Y, gs.playerfriction - 0x1800, 16);
|
||||
p->__vel.X = MulScaleF(p->__vel.X, gs.playerfriction - 0x1800, 16);
|
||||
p->__vel.Y = MulScaleF(p->__vel.Y, gs.playerfriction - 0x1800, 16);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -3767,8 +3767,8 @@ void processinput_r(int snum)
|
|||
p->boot_amount--;
|
||||
else
|
||||
{
|
||||
p->__vel.X = MulScale(p->__vel.X, gs.playerfriction - 0x1800, 16);
|
||||
p->__vel.Y = MulScale(p->__vel.Y, gs.playerfriction - 0x1800, 16);
|
||||
p->__vel.X = MulScaleF(p->__vel.X, gs.playerfriction - 0x1800, 16);
|
||||
p->__vel.Y = MulScaleF(p->__vel.Y, gs.playerfriction - 0x1800, 16);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3778,9 +3778,9 @@ void processinput_r(int snum)
|
|||
if (shrunk)
|
||||
{
|
||||
p->__vel.X =
|
||||
MulScale(p->__vel.X, gs.playerfriction - (gs.playerfriction >> 1) + (gs.playerfriction >> 2), 16);
|
||||
MulScaleF(p->__vel.X, gs.playerfriction * 0.75, 16);
|
||||
p->__vel.Y =
|
||||
MulScale(p->__vel.Y, gs.playerfriction - (gs.playerfriction >> 1) + (gs.playerfriction >> 2), 16);
|
||||
MulScaleF(p->__vel.Y, gs.playerfriction * 0.75, 16);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3795,8 +3795,8 @@ HORIZONLY:
|
|||
Collision clip{};
|
||||
if (ud.clipping)
|
||||
{
|
||||
p->player_add_int_xy({ p->__vel.X >> 14, p->__vel.Y >> 14 });
|
||||
updatesector(p->player_int_pos().X, p->player_int_pos().Y, &p->cursector);
|
||||
p->player_add_int_xy({ int(p->__vel.X / 16384), int(p->__vel.Y / 16384) });
|
||||
updatesector(p->pos, &p->cursector);
|
||||
ChangeActorSect(pact, p->cursector);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -201,7 +201,7 @@ struct CraneDef
|
|||
|
||||
struct player_struct
|
||||
{
|
||||
vec3_t __vel;
|
||||
DVector3 __vel;
|
||||
DVector3 pos, opos;
|
||||
DVector2 bobpos;
|
||||
|
||||
|
|
Loading…
Reference in a new issue