- replaced AActor::vel and player_t::Vel with a floating point version.
- Converted P_MovePlayer and all associated variables to floating point because this wasn't working well with a mixture between float and fixed. Like the angle commit this has just been patched up to compile, the bulk of work is yet to be done.
This commit is contained in:
parent
51a98d0e5d
commit
51b05d331d
140 changed files with 2406 additions and 2403 deletions
221
src/p_user.cpp
221
src/p_user.cpp
|
|
@ -238,7 +238,7 @@ CCMD (playerclasses)
|
|||
//
|
||||
|
||||
// 16 pixels of bob
|
||||
#define MAXBOB 0x100000
|
||||
#define MAXBOB 16.
|
||||
|
||||
FArchive &operator<< (FArchive &arc, player_t *&p)
|
||||
{
|
||||
|
|
@ -257,7 +257,7 @@ player_t::player_t()
|
|||
viewheight(0),
|
||||
deltaviewheight(0),
|
||||
bob(0),
|
||||
vel({ 0,0 }),
|
||||
Vel(0, 0),
|
||||
centering(0),
|
||||
turnticks(0),
|
||||
attackdown(0),
|
||||
|
|
@ -336,8 +336,7 @@ player_t &player_t::operator=(const player_t &p)
|
|||
viewheight = p.viewheight;
|
||||
deltaviewheight = p.deltaviewheight;
|
||||
bob = p.bob;
|
||||
vel.x = p.vel.x;
|
||||
vel.y = p.vel.y;
|
||||
Vel = p.Vel;
|
||||
centering = p.centering;
|
||||
turnticks = p.turnticks;
|
||||
attackdown = p.attackdown;
|
||||
|
|
@ -745,7 +744,7 @@ void APlayerPawn::Tick()
|
|||
{
|
||||
if (player != NULL && player->mo == this && player->CanCrouch() && player->playerstate != PST_DEAD)
|
||||
{
|
||||
height = FixedMul(GetDefault()->height, player->crouchfactor);
|
||||
height = fixed_t(GetDefault()->height * player->crouchfactor);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -769,7 +768,7 @@ void APlayerPawn::PostBeginPlay()
|
|||
if (player == NULL || player->mo != this)
|
||||
{
|
||||
P_FindFloorCeiling(this, FFCF_ONLYSPAWNPOS|FFCF_NOPORTALS);
|
||||
SetZ(floorz);
|
||||
_f_SetZ(floorz);
|
||||
P_FindFloorCeiling(this, FFCF_ONLYSPAWNPOS);
|
||||
}
|
||||
else
|
||||
|
|
@ -1512,38 +1511,40 @@ void APlayerPawn::Die (AActor *source, AActor *inflictor, int dmgflags)
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
void APlayerPawn::TweakSpeeds (int &forward, int &side)
|
||||
void APlayerPawn::TweakSpeeds (double &forward, double &side)
|
||||
{
|
||||
// Strife's player can't run when its healh is below 10
|
||||
// Strife's player can't run when its health is below 10
|
||||
if (health <= RunHealth)
|
||||
{
|
||||
forward = clamp(forward, -0x1900, 0x1900);
|
||||
side = clamp(side, -0x1800, 0x1800);
|
||||
forward = clamp<double>(forward, -0x1900, 0x1900);
|
||||
side = clamp<double>(side, -0x1800, 0x1800);
|
||||
}
|
||||
|
||||
// [GRB]
|
||||
if ((unsigned int)(forward + 0x31ff) < 0x63ff)
|
||||
if (fabs(forward) < 0x3200)
|
||||
{
|
||||
forward = FixedMul (forward, ForwardMove1);
|
||||
forward *= ForwardMove1;
|
||||
}
|
||||
else
|
||||
{
|
||||
forward = FixedMul (forward, ForwardMove2);
|
||||
forward *= ForwardMove2;
|
||||
}
|
||||
|
||||
if (fabs(side) < 0x2800)
|
||||
if ((unsigned int)(side + 0x27ff) < 0x4fff)
|
||||
{
|
||||
side = FixedMul (side, SideMove1);
|
||||
side *= SideMove1;
|
||||
}
|
||||
else
|
||||
{
|
||||
side = FixedMul (side, SideMove2);
|
||||
side *= SideMove2;
|
||||
}
|
||||
|
||||
if (!player->morphTics && Inventory != NULL)
|
||||
{
|
||||
fixed_t factor = Inventory->GetSpeedFactor ();
|
||||
forward = FixedMul(forward, factor);
|
||||
side = FixedMul(side, factor);
|
||||
double factor = Inventory->GetSpeedFactor ();
|
||||
forward *= factor;
|
||||
side *= factor;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1579,7 +1580,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_PlayerScream)
|
|||
// Handle the different player death screams
|
||||
if ((((level.flags >> 15) | (dmflags)) &
|
||||
(DF_FORCE_FALLINGZD | DF_FORCE_FALLINGHX)) &&
|
||||
self->vel.z <= -39*FRACUNIT)
|
||||
self->Vel.Z <= -39)
|
||||
{
|
||||
sound = S_FindSkinnedSound (self, "*splat");
|
||||
chan = CHAN_BODY;
|
||||
|
|
@ -1651,9 +1652,9 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SkullPop)
|
|||
self->flags &= ~MF_SOLID;
|
||||
mo = (APlayerPawn *)Spawn (spawntype, self->PosPlusZ(48*FRACUNIT), NO_REPLACE);
|
||||
//mo->target = self;
|
||||
mo->vel.x = pr_skullpop.Random2() << 9;
|
||||
mo->vel.y = pr_skullpop.Random2() << 9;
|
||||
mo->vel.z = 2*FRACUNIT + (pr_skullpop() << 6);
|
||||
mo->Vel.X = pr_skullpop.Random2() / 128.;
|
||||
mo->Vel.Y = pr_skullpop.Random2() / 128.;
|
||||
mo->Vel.Z = 2. + (pr_skullpop() / 1024.);
|
||||
// Attach player mobj to bloody skull
|
||||
player = self->player;
|
||||
self->player = NULL;
|
||||
|
|
@ -1717,7 +1718,7 @@ void P_CheckPlayerSprite(AActor *actor, int &spritenum, fixed_t &scalex, fixed_t
|
|||
}
|
||||
|
||||
// Set the crouch sprite?
|
||||
if (player->crouchfactor < FRACUNIT*3/4)
|
||||
if (player->crouchfactor < 0.75)
|
||||
{
|
||||
if (spritenum == actor->SpawnState->sprite || spritenum == player->mo->crouchsprite)
|
||||
{
|
||||
|
|
@ -1738,7 +1739,7 @@ void P_CheckPlayerSprite(AActor *actor, int &spritenum, fixed_t &scalex, fixed_t
|
|||
{
|
||||
spritenum = crouchspriteno;
|
||||
}
|
||||
else if (player->playerstate != PST_DEAD && player->crouchfactor < FRACUNIT*3/4)
|
||||
else if (player->playerstate != PST_DEAD && player->crouchfactor < 0.75)
|
||||
{
|
||||
scaley /= 2;
|
||||
}
|
||||
|
|
@ -1755,30 +1756,23 @@ void P_CheckPlayerSprite(AActor *actor, int &spritenum, fixed_t &scalex, fixed_t
|
|||
==================
|
||||
*/
|
||||
|
||||
void P_SideThrust (player_t *player, angle_t angle, fixed_t move)
|
||||
void P_SideThrust (player_t *player, DAngle angle, double move)
|
||||
{
|
||||
angle = (angle - ANGLE_90) >> ANGLETOFINESHIFT;
|
||||
|
||||
player->mo->vel.x += FixedMul (move, finecosine[angle]);
|
||||
player->mo->vel.y += FixedMul (move, finesine[angle]);
|
||||
player->mo->Thrust(angle-90, move);
|
||||
}
|
||||
|
||||
void P_ForwardThrust (player_t *player, angle_t angle, fixed_t move)
|
||||
void P_ForwardThrust (player_t *player, DAngle angle, double move)
|
||||
{
|
||||
angle >>= ANGLETOFINESHIFT;
|
||||
|
||||
if ((player->mo->waterlevel || (player->mo->flags & MF_NOGRAVITY))
|
||||
&& player->mo->_f_pitch() != 0)
|
||||
&& player->mo->Angles.Pitch != 0)
|
||||
{
|
||||
angle_t pitch = (angle_t)player->mo->_f_pitch() >> ANGLETOFINESHIFT;
|
||||
fixed_t zpush = FixedMul (move, finesine[pitch]);
|
||||
double zpush = move * player->mo->Angles.Pitch.Sin();
|
||||
if (player->mo->waterlevel && player->mo->waterlevel < 2 && zpush < 0)
|
||||
zpush = 0;
|
||||
player->mo->vel.z -= zpush;
|
||||
move = FixedMul (move, finecosine[pitch]);
|
||||
player->mo->Vel.Z -= zpush;
|
||||
move *= player->mo->Angles.Pitch.Cos();
|
||||
}
|
||||
player->mo->vel.x += FixedMul (move, finecosine[angle]);
|
||||
player->mo->vel.y += FixedMul (move, finesine[angle]);
|
||||
player->mo->Thrust(angle, move);
|
||||
}
|
||||
|
||||
//
|
||||
|
|
@ -1792,20 +1786,15 @@ void P_ForwardThrust (player_t *player, angle_t angle, fixed_t move)
|
|||
// reduced at a regular rate, even on ice (where the player coasts).
|
||||
//
|
||||
|
||||
void P_Bob (player_t *player, angle_t angle, fixed_t move, bool forward)
|
||||
void P_Bob (player_t *player, DAngle angle, double move, bool forward)
|
||||
{
|
||||
if (forward
|
||||
&& (player->mo->waterlevel || (player->mo->flags & MF_NOGRAVITY))
|
||||
&& player->mo->_f_pitch() != 0)
|
||||
&& player->mo->Angles.Pitch != 0)
|
||||
{
|
||||
angle_t pitch = (angle_t)player->mo->_f_pitch() >> ANGLETOFINESHIFT;
|
||||
move = FixedMul (move, finecosine[pitch]);
|
||||
move *= player->mo->Angles.Pitch.Cos();
|
||||
}
|
||||
|
||||
angle >>= ANGLETOFINESHIFT;
|
||||
|
||||
player->vel.x += FixedMul(move, finecosine[angle]);
|
||||
player->vel.y += FixedMul(move, finesine[angle]);
|
||||
player->Vel += angle.ToVector(move);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -1821,8 +1810,8 @@ Calculate the walking / running height adjustment
|
|||
|
||||
void P_CalcHeight (player_t *player)
|
||||
{
|
||||
int angle;
|
||||
fixed_t bob;
|
||||
DAngle angle;
|
||||
double bob;
|
||||
bool still = false;
|
||||
|
||||
// Regular movement bobbing
|
||||
|
|
@ -1840,18 +1829,18 @@ void P_CalcHeight (player_t *player)
|
|||
}
|
||||
else if ((player->mo->flags & MF_NOGRAVITY) && !player->onground)
|
||||
{
|
||||
player->bob = FRACUNIT / 2;
|
||||
player->bob = 0.5;
|
||||
}
|
||||
else
|
||||
{
|
||||
player->bob = DMulScale16 (player->vel.x, player->vel.x, player->vel.y, player->vel.y);
|
||||
player->bob = player->Vel.LengthSquared();
|
||||
if (player->bob == 0)
|
||||
{
|
||||
still = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
player->bob = FixedMul (player->bob, player->userinfo.GetMoveBob());
|
||||
player->bob *= player->userinfo.GetMoveBob();
|
||||
|
||||
if (player->bob > MAXBOB)
|
||||
player->bob = MAXBOB;
|
||||
|
|
@ -1862,7 +1851,7 @@ void P_CalcHeight (player_t *player)
|
|||
|
||||
if (player->cheats & CF_NOVELOCITY)
|
||||
{
|
||||
player->viewz = player->mo->Z() + defaultviewheight;
|
||||
player->viewz = player->mo->_f_Z() + defaultviewheight;
|
||||
|
||||
if (player->viewz > player->mo->ceilingz-4*FRACUNIT)
|
||||
player->viewz = player->mo->ceilingz-4*FRACUNIT;
|
||||
|
|
@ -1874,8 +1863,8 @@ void P_CalcHeight (player_t *player)
|
|||
{
|
||||
if (player->health > 0)
|
||||
{
|
||||
angle = DivScale13 (level.time, 120*TICRATE/35) & FINEMASK;
|
||||
bob = FixedMul (player->userinfo.GetStillBob(), finesine[angle]);
|
||||
angle = level.time / (120 * TICRATE / 35.) * 360.;
|
||||
bob = player->userinfo.GetStillBob() * angle.Sin();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1884,9 +1873,8 @@ void P_CalcHeight (player_t *player)
|
|||
}
|
||||
else
|
||||
{
|
||||
// DivScale 13 because FINEANGLES == (1<<13)
|
||||
angle = DivScale13 (level.time, 20*TICRATE/35) & FINEMASK;
|
||||
bob = FixedMul (player->bob>>(player->mo->waterlevel > 1 ? 2 : 1), finesine[angle]);
|
||||
angle = level.time / (20 * TICRATE / 35.) * 360.;
|
||||
bob = player->bob * angle.Sin() * (player->mo->waterlevel > 1 ? 0.25f : 0.5f);
|
||||
}
|
||||
|
||||
// move viewheight
|
||||
|
|
@ -1918,9 +1906,9 @@ void P_CalcHeight (player_t *player)
|
|||
{
|
||||
bob = 0;
|
||||
}
|
||||
player->viewz = player->mo->Z() + player->viewheight + bob;
|
||||
player->viewz = player->mo->_f_Z() + player->viewheight + FLOAT2FIXED(bob);
|
||||
if (player->mo->floorclip && player->playerstate != PST_DEAD
|
||||
&& player->mo->Z() <= player->mo->floorz)
|
||||
&& player->mo->_f_Z() <= player->mo->floorz)
|
||||
{
|
||||
player->viewz -= player->mo->floorclip;
|
||||
}
|
||||
|
|
@ -1943,7 +1931,7 @@ void P_CalcHeight (player_t *player)
|
|||
*/
|
||||
CUSTOM_CVAR (Float, sv_aircontrol, 0.00390625f, CVAR_SERVERINFO|CVAR_NOSAVE)
|
||||
{
|
||||
level.aircontrol = (fixed_t)(self * 65536.f);
|
||||
level.aircontrol = self;
|
||||
G_AirControlChanged ();
|
||||
}
|
||||
|
||||
|
|
@ -1963,7 +1951,7 @@ void P_MovePlayer (player_t *player)
|
|||
mo->Angles.Yaw += cmd->ucmd.yaw * (360./65536.);
|
||||
}
|
||||
|
||||
player->onground = (mo->Z() <= mo->floorz) || (mo->flags2 & MF2_ONMOBJ) || (mo->BounceFlags & BOUNCE_MBF) || (player->cheats & CF_NOCLIP2);
|
||||
player->onground = (mo->_f_Z() <= mo->floorz) || (mo->flags2 & MF2_ONMOBJ) || (mo->BounceFlags & BOUNCE_MBF) || (player->cheats & CF_NOCLIP2);
|
||||
|
||||
// killough 10/98:
|
||||
//
|
||||
|
|
@ -1974,51 +1962,51 @@ void P_MovePlayer (player_t *player)
|
|||
|
||||
if (cmd->ucmd.forwardmove | cmd->ucmd.sidemove)
|
||||
{
|
||||
fixed_t forwardmove, sidemove;
|
||||
int bobfactor;
|
||||
int friction, movefactor;
|
||||
int fm, sm;
|
||||
double forwardmove, sidemove;
|
||||
double bobfactor;
|
||||
double friction, movefactor;
|
||||
double fm, sm;
|
||||
|
||||
movefactor = P_GetMoveFactor (mo, &friction);
|
||||
bobfactor = friction < ORIG_FRICTION ? movefactor : ORIG_FRICTION_FACTOR;
|
||||
bobfactor = friction < ORIG_FRICTION ? movefactor : fORIG_FRICTION_FACTOR;
|
||||
if (!player->onground && !(player->mo->flags & MF_NOGRAVITY) && !player->mo->waterlevel)
|
||||
{
|
||||
// [RH] allow very limited movement if not on ground.
|
||||
movefactor = FixedMul (movefactor, level.aircontrol);
|
||||
bobfactor = FixedMul (bobfactor, level.aircontrol);
|
||||
movefactor *= level.aircontrol;
|
||||
bobfactor*= level.aircontrol;
|
||||
}
|
||||
|
||||
fm = cmd->ucmd.forwardmove;
|
||||
sm = cmd->ucmd.sidemove;
|
||||
mo->TweakSpeeds (fm, sm);
|
||||
fm = FixedMul (fm, player->mo->Speed);
|
||||
sm = FixedMul (sm, player->mo->Speed);
|
||||
fm *= player->mo->Speed / 256;
|
||||
sm *= player->mo->Speed / 256;
|
||||
|
||||
// When crouching, speed and bobbing have to be reduced
|
||||
if (player->CanCrouch() && player->crouchfactor != FRACUNIT)
|
||||
if (player->CanCrouch() && player->crouchfactor != 1)
|
||||
{
|
||||
fm = FixedMul(fm, player->crouchfactor);
|
||||
sm = FixedMul(sm, player->crouchfactor);
|
||||
bobfactor = FixedMul(bobfactor, player->crouchfactor);
|
||||
fm *= player->crouchfactor;
|
||||
sm *= player->crouchfactor;
|
||||
bobfactor *= player->crouchfactor;
|
||||
}
|
||||
|
||||
forwardmove = Scale (fm, movefactor * 35, TICRATE << 8);
|
||||
sidemove = Scale (sm, movefactor * 35, TICRATE << 8);
|
||||
forwardmove = fm * movefactor * (35 / TICRATE);
|
||||
sidemove = sm * movefactor * (35 / TICRATE);
|
||||
|
||||
if (forwardmove)
|
||||
{
|
||||
P_Bob (player, mo->_f_angle(), (cmd->ucmd.forwardmove * bobfactor) >> 8, true);
|
||||
P_ForwardThrust (player, mo->_f_angle(), forwardmove);
|
||||
P_Bob(player, mo->Angles.Yaw, cmd->ucmd.forwardmove * bobfactor / 256., true);
|
||||
P_ForwardThrust(player, mo->Angles.Yaw, forwardmove);
|
||||
}
|
||||
if (sidemove)
|
||||
{
|
||||
P_Bob (player, mo->_f_angle()-ANG90, (cmd->ucmd.sidemove * bobfactor) >> 8, false);
|
||||
P_SideThrust (player, mo->_f_angle(), sidemove);
|
||||
P_Bob(player, mo->Angles.Yaw - 90, cmd->ucmd.sidemove * bobfactor / 256., false);
|
||||
P_SideThrust(player, mo->Angles.Yaw, sidemove);
|
||||
}
|
||||
|
||||
if (debugfile)
|
||||
{
|
||||
fprintf (debugfile, "move player for pl %d%c: (%d,%d,%d) (%d,%d) %d %d w%d [", int(player-players),
|
||||
fprintf (debugfile, "move player for pl %d%c: (%f,%f,%f) (%f,%f) %f %f w%d [", int(player-players),
|
||||
player->cheats&CF_PREDICTING?'p':' ',
|
||||
player->mo->X(), player->mo->Y(), player->mo->Z(),forwardmove, sidemove, movefactor, friction, player->mo->waterlevel);
|
||||
msecnode_t *n = player->mo->touching_sectorlist;
|
||||
|
|
@ -2030,7 +2018,7 @@ void P_MovePlayer (player_t *player)
|
|||
fprintf (debugfile, "]\n");
|
||||
}
|
||||
|
||||
if (!(player->cheats & CF_PREDICTING) && (forwardmove|sidemove))
|
||||
if (!(player->cheats & CF_PREDICTING) && (forwardmove != 0 || sidemove != 0))
|
||||
{
|
||||
player->mo->PlayRunning ();
|
||||
}
|
||||
|
|
@ -2064,7 +2052,7 @@ void P_FallingDamage (AActor *actor)
|
|||
if (actor->floorsector->Flags & SECF_NOFALLINGDAMAGE)
|
||||
return;
|
||||
|
||||
vel = abs(actor->vel.z);
|
||||
vel = abs(actor->_f_velz());
|
||||
|
||||
// Since Hexen falling damage is stronger than ZDoom's, it takes
|
||||
// precedence. ZDoom falling damage may not be as strong, but it
|
||||
|
|
@ -2085,7 +2073,7 @@ void P_FallingDamage (AActor *actor)
|
|||
{
|
||||
vel = FixedMul (vel, 16*FRACUNIT/23);
|
||||
damage = ((FixedMul (vel, vel) / 10) >> FRACBITS) - 24;
|
||||
if (actor->vel.z > -39*FRACUNIT && damage > actor->health
|
||||
if (actor->_f_velz() > -39*FRACUNIT && damage > actor->health
|
||||
&& actor->health != 1)
|
||||
{ // No-death threshold
|
||||
damage = actor->health-1;
|
||||
|
|
@ -2151,7 +2139,7 @@ void P_DeathThink (player_t *player)
|
|||
|
||||
P_MovePsprites (player);
|
||||
|
||||
player->onground = (player->mo->Z() <= player->mo->floorz);
|
||||
player->onground = (player->mo->_f_Z() <= player->mo->floorz);
|
||||
if (player->mo->IsKindOf (RUNTIME_CLASS(APlayerChunk)))
|
||||
{ // Flying bloody skull or flying ice chunk
|
||||
player->viewheight = 6 * FRACUNIT;
|
||||
|
|
@ -2256,15 +2244,15 @@ void P_CrouchMove(player_t * player, int direction)
|
|||
{
|
||||
fixed_t defaultheight = player->mo->GetDefault()->height;
|
||||
fixed_t savedheight = player->mo->height;
|
||||
fixed_t crouchspeed = direction * CROUCHSPEED;
|
||||
double crouchspeed = direction * CROUCHSPEED;
|
||||
fixed_t oldheight = player->viewheight;
|
||||
|
||||
player->crouchdir = (signed char) direction;
|
||||
player->crouchfactor += crouchspeed;
|
||||
|
||||
// check whether the move is ok
|
||||
player->mo->height = FixedMul(defaultheight, player->crouchfactor);
|
||||
if (!P_TryMove(player->mo, player->mo->X(), player->mo->Y(), false, NULL))
|
||||
player->mo->height = fixed_t(defaultheight * player->crouchfactor);
|
||||
if (!P_TryMove(player->mo, player->mo->_f_X(), player->mo->_f_Y(), false, NULL))
|
||||
{
|
||||
player->mo->height = savedheight;
|
||||
if (direction > 0)
|
||||
|
|
@ -2276,12 +2264,12 @@ void P_CrouchMove(player_t * player, int direction)
|
|||
}
|
||||
player->mo->height = savedheight;
|
||||
|
||||
player->crouchfactor = clamp<fixed_t>(player->crouchfactor, FRACUNIT/2, FRACUNIT);
|
||||
player->viewheight = FixedMul(player->mo->ViewHeight, player->crouchfactor);
|
||||
player->crouchfactor = clamp(player->crouchfactor, 0.5, 1.);
|
||||
player->viewheight = fixed_t(player->mo->ViewHeight * player->crouchfactor);
|
||||
player->crouchviewdelta = player->viewheight - player->mo->ViewHeight;
|
||||
|
||||
// Check for eyes going above/below fake floor due to crouching motion.
|
||||
P_CheckFakeFloorTriggers(player->mo, player->mo->Z() + oldheight, true);
|
||||
P_CheckFakeFloorTriggers(player->mo, player->mo->_f_Z() + oldheight, true);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
|
@ -2302,7 +2290,7 @@ void P_PlayerThink (player_t *player)
|
|||
if (debugfile && !(player->cheats & CF_PREDICTING))
|
||||
{
|
||||
fprintf (debugfile, "tic %d for pl %d: (%d, %d, %d, %u) b:%02x p:%d y:%d f:%d s:%d u:%d\n",
|
||||
gametic, (int)(player-players), player->mo->X(), player->mo->Y(), player->mo->Z(),
|
||||
gametic, (int)(player-players), player->mo->_f_X(), player->mo->_f_Y(), player->mo->_f_Z(),
|
||||
player->mo->_f_angle()>>ANGLETOFINESHIFT, player->cmd.ucmd.buttons,
|
||||
player->cmd.ucmd.pitch, player->cmd.ucmd.yaw, player->cmd.ucmd.forwardmove,
|
||||
player->cmd.ucmd.sidemove, player->cmd.ucmd.upmove);
|
||||
|
|
@ -2427,12 +2415,12 @@ void P_PlayerThink (player_t *player)
|
|||
{
|
||||
player->crouching = 0;
|
||||
}
|
||||
if (crouchdir == 1 && player->crouchfactor < FRACUNIT &&
|
||||
player->mo->Top() < player->mo->ceilingz)
|
||||
if (crouchdir == 1 && player->crouchfactor < 1 &&
|
||||
player->mo->_f_Top() < player->mo->ceilingz)
|
||||
{
|
||||
P_CrouchMove(player, 1);
|
||||
}
|
||||
else if (crouchdir == -1 && player->crouchfactor > FRACUNIT/2)
|
||||
else if (crouchdir == -1 && player->crouchfactor > 0.5)
|
||||
{
|
||||
P_CrouchMove(player, -1);
|
||||
}
|
||||
|
|
@ -2443,7 +2431,7 @@ void P_PlayerThink (player_t *player)
|
|||
player->Uncrouch();
|
||||
}
|
||||
|
||||
player->crouchoffset = -FixedMul(player->mo->ViewHeight, (FRACUNIT - player->crouchfactor));
|
||||
player->crouchoffset = -fixed_t(player->mo->ViewHeight * (1 - player->crouchfactor));
|
||||
|
||||
// MUSINFO stuff
|
||||
if (player->MUSINFOtics >= 0 && player->MUSINFOactor != NULL)
|
||||
|
|
@ -2557,20 +2545,20 @@ void P_PlayerThink (player_t *player)
|
|||
}
|
||||
else if (player->mo->waterlevel >= 2)
|
||||
{
|
||||
player->mo->vel.z = FixedMul(4*FRACUNIT, player->mo->Speed);
|
||||
player->mo->Vel.Z = 4 * player->mo->Speed;
|
||||
}
|
||||
else if (player->mo->flags & MF_NOGRAVITY)
|
||||
{
|
||||
player->mo->vel.z = 3*FRACUNIT;
|
||||
player->mo->Vel.Z = 3.;
|
||||
}
|
||||
else if (level.IsJumpingAllowed() && player->onground && player->jumpTics == 0)
|
||||
{
|
||||
fixed_t jumpvelz = player->mo->JumpZ * 35 / TICRATE;
|
||||
double jumpvelz = player->mo->JumpZ * 35 / TICRATE;
|
||||
|
||||
// [BC] If the player has the high jump power, double his jump velocity.
|
||||
if ( player->cheats & CF_HIGHJUMP ) jumpvelz *= 2;
|
||||
|
||||
player->mo->vel.z += jumpvelz;
|
||||
player->mo->Vel.Z += jumpvelz;
|
||||
player->mo->flags2 &= ~MF2_ONMOBJ;
|
||||
player->jumpTics = -1;
|
||||
if (!(player->cheats & CF_PREDICTING))
|
||||
|
|
@ -2596,12 +2584,12 @@ void P_PlayerThink (player_t *player)
|
|||
}
|
||||
if (player->mo->waterlevel >= 2 || (player->mo->flags2 & MF2_FLY) || (player->cheats & CF_NOCLIP2))
|
||||
{
|
||||
player->mo->vel.z = FixedMul(player->mo->Speed, cmd->ucmd.upmove << 9);
|
||||
player->mo->Vel.Z = player->mo->Speed * cmd->ucmd.upmove / 128.;
|
||||
if (player->mo->waterlevel < 2 && !(player->mo->flags & MF_NOGRAVITY))
|
||||
{
|
||||
player->mo->flags2 |= MF2_FLY;
|
||||
player->mo->flags |= MF_NOGRAVITY;
|
||||
if ((player->mo->vel.z <= -39 * FRACUNIT) && !(player->cheats & CF_PREDICTING))
|
||||
if ((player->mo->Vel.Z <= -39) && !(player->cheats & CF_PREDICTING))
|
||||
{ // Stop falling scream
|
||||
S_StopSound (player->mo, CHAN_VOICE);
|
||||
}
|
||||
|
|
@ -2625,14 +2613,14 @@ void P_PlayerThink (player_t *player)
|
|||
P_PlayerOnSpecial3DFloor (player);
|
||||
P_PlayerInSpecialSector (player);
|
||||
|
||||
if (player->mo->Z() <= player->mo->Sector->floorplane.ZatPoint(player->mo) ||
|
||||
if (player->mo->_f_Z() <= player->mo->Sector->floorplane.ZatPoint(player->mo) ||
|
||||
player->mo->waterlevel)
|
||||
{
|
||||
// Player must be touching the floor
|
||||
P_PlayerOnSpecialFlat(player, P_GetThingFloorType(player->mo));
|
||||
}
|
||||
if (player->mo->vel.z <= -player->mo->FallingScreamMinSpeed &&
|
||||
player->mo->vel.z >= -player->mo->FallingScreamMaxSpeed && !player->morphTics &&
|
||||
if (player->mo->_f_velz() <= -player->mo->FallingScreamMinSpeed &&
|
||||
player->mo->_f_velz() >= -player->mo->FallingScreamMaxSpeed && !player->morphTics &&
|
||||
player->mo->waterlevel == 0)
|
||||
{
|
||||
int id = S_FindSkinnedSound (player->mo, "*falling");
|
||||
|
|
@ -2851,16 +2839,16 @@ void P_PredictPlayer (player_t *player)
|
|||
{
|
||||
// Z is not compared as lifts will alter this with no apparent change
|
||||
// Make lerping less picky by only testing whole units
|
||||
DoLerp = ((PredictionLast.x >> 16) != (player->mo->X() >> 16) ||
|
||||
(PredictionLast.y >> 16) != (player->mo->Y() >> 16));
|
||||
DoLerp = ((PredictionLast.x >> 16) != (player->mo->_f_X() >> 16) ||
|
||||
(PredictionLast.y >> 16) != (player->mo->_f_Y() >> 16));
|
||||
|
||||
// Aditional Debug information
|
||||
if (developer && DoLerp)
|
||||
{
|
||||
DPrintf("Lerp! Ltic (%d) && Ptic (%d) | Lx (%d) && Px (%d) | Ly (%d) && Py (%d)\n",
|
||||
PredictionLast.gametic, i,
|
||||
(PredictionLast.x >> 16), (player->mo->X() >> 16),
|
||||
(PredictionLast.y >> 16), (player->mo->Y() >> 16));
|
||||
(PredictionLast.x >> 16), (player->mo->_f_X() >> 16),
|
||||
(PredictionLast.y >> 16), (player->mo->_f_Y() >> 16));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2878,9 +2866,9 @@ void P_PredictPlayer (player_t *player)
|
|||
}
|
||||
|
||||
PredictionLast.gametic = maxtic - 1;
|
||||
PredictionLast.x = player->mo->X();
|
||||
PredictionLast.y = player->mo->Y();
|
||||
PredictionLast.z = player->mo->Z();
|
||||
PredictionLast.x = player->mo->_f_X();
|
||||
PredictionLast.y = player->mo->_f_Y();
|
||||
PredictionLast.z = player->mo->_f_Z();
|
||||
|
||||
if (PredictionLerptics > 0)
|
||||
{
|
||||
|
|
@ -3054,8 +3042,7 @@ void player_t::Serialize (FArchive &arc)
|
|||
<< viewheight
|
||||
<< deltaviewheight
|
||||
<< bob
|
||||
<< vel.x
|
||||
<< vel.y
|
||||
<< Vel
|
||||
<< centering
|
||||
<< health
|
||||
<< inventorytics;
|
||||
|
|
@ -3194,7 +3181,7 @@ void player_t::Serialize (FArchive &arc)
|
|||
}
|
||||
else
|
||||
{
|
||||
onground = (mo->Z() <= mo->floorz) || (mo->flags2 & MF2_ONMOBJ) || (mo->BounceFlags & BOUNCE_MBF) || (cheats & CF_NOCLIP2);
|
||||
onground = (mo->_f_Z() <= mo->floorz) || (mo->flags2 & MF2_ONMOBJ) || (mo->BounceFlags & BOUNCE_MBF) || (cheats & CF_NOCLIP2);
|
||||
}
|
||||
|
||||
if (SaveVersion < 4514 && IsBot)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue