mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-19 07:01:09 +00:00
- Duke: Hook up InputPacket::uvel
to remainder of relevant code.
This commit is contained in:
parent
09ab66b8c9
commit
afcc65c332
5 changed files with 28 additions and 23 deletions
|
@ -335,8 +335,8 @@ void movetransports_d(void)
|
|||
else if (!(sectlotag == 1 && ps[p].on_ground == 1)) break;
|
||||
|
||||
if (onfloorz == 0 && abs(act->spr.pos.Z - ps[p].GetActor()->getOffsetZ()) < 24)
|
||||
if ((ps[p].jetpack_on == 0) || (ps[p].jetpack_on && (PlayerInput(p, SB_JUMP))) ||
|
||||
(ps[p].jetpack_on && PlayerInput(p, SB_CROUCH)))
|
||||
if ((ps[p].jetpack_on == 0) || (ps[p].jetpack_on && (PlayerInput(p, SB_JUMP) || ps[p].sync.uvel > 0)) ||
|
||||
(ps[p].jetpack_on && (PlayerInput(p, SB_CROUCH) || ps[p].sync.uvel < 0)))
|
||||
{
|
||||
ps[p].GetActor()->spr.pos.XY() += Owner->spr.pos.XY() - act->spr.pos.XY();
|
||||
ps[p].GetActor()->backupvec2();
|
||||
|
@ -376,7 +376,7 @@ void movetransports_d(void)
|
|||
}
|
||||
|
||||
|
||||
if (onfloorz && sectlotag == ST_1_ABOVE_WATER && ps[p].on_ground && ps[p].GetActor()->getOffsetZ() > (sectp->floorz - 16) && (PlayerInput(p, SB_CROUCH) || ps[p].vel.Z > 8))
|
||||
if (onfloorz && sectlotag == ST_1_ABOVE_WATER && ps[p].on_ground && ps[p].GetActor()->getOffsetZ() > (sectp->floorz - 16) && (PlayerInput(p, SB_CROUCH) || ps[p].sync.uvel < 0 || ps[p].vel.Z > 8))
|
||||
// if( onfloorz && sectlotag == 1 && ps[p].pos.z > (sectp->floorz-(6<<8)) )
|
||||
{
|
||||
k = 1;
|
||||
|
|
|
@ -310,8 +310,8 @@ void movetransports_r(void)
|
|||
else break;
|
||||
|
||||
if (onfloorz == 0 && fabs(act->spr.pos.Z - ps[p].GetActor()->getOffsetZ()) < 24)
|
||||
if ((ps[p].jetpack_on == 0) || (ps[p].jetpack_on && PlayerInput(p, SB_JUMP)) ||
|
||||
(ps[p].jetpack_on && PlayerInput(p, SB_CROUCH)))
|
||||
if ((ps[p].jetpack_on == 0) || (ps[p].jetpack_on && (PlayerInput(p, SB_JUMP) || ps[p].sync.uvel > 0)) ||
|
||||
(ps[p].jetpack_on && (PlayerInput(p, SB_CROUCH) || ps[p].sync.uvel < 0)))
|
||||
{
|
||||
ps[p].GetActor()->spr.pos.XY() += Owner->spr.pos.XY() - act->spr.pos.XY();
|
||||
ps[p].GetActor()->backupvec2();
|
||||
|
|
|
@ -663,13 +663,15 @@ int timedexit(int snum)
|
|||
|
||||
void playerCrouch(int snum)
|
||||
{
|
||||
auto p = &ps[snum];
|
||||
// crouching
|
||||
SetGameVarID(g_iReturnVarID, 0, p->GetActor(), snum);
|
||||
OnEvent(EVENT_CROUCH, snum, p->GetActor(), -1);
|
||||
if (GetGameVarID(g_iReturnVarID, p->GetActor(), snum).value() == 0)
|
||||
const auto p = &ps[snum];
|
||||
const auto pact = p->GetActor();
|
||||
const auto nVelMoveDown = abs(p->sync.uvel * (p->sync.uvel < 0));
|
||||
constexpr double vel = 8 + 3;
|
||||
SetGameVarID(g_iReturnVarID, 0, pact, snum);
|
||||
OnEvent(EVENT_CROUCH, snum, pact, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, pact, snum).value() == 0)
|
||||
{
|
||||
p->GetActor()->spr.pos.Z += 8 + 3;
|
||||
pact->spr.pos.Z += clamp(vel * !!(p->sync.actions & SB_CROUCH) + vel * nVelMoveDown, -vel, vel);
|
||||
p->crack_time = CRACK_TIME;
|
||||
}
|
||||
}
|
||||
|
@ -1570,6 +1572,9 @@ void underwater(int snum, ESyncBits actions, double floorz, double ceilingz)
|
|||
{
|
||||
const auto p = &ps[snum];
|
||||
const auto pact = p->GetActor();
|
||||
constexpr double dist = (348. / 256.);
|
||||
const auto kbdDir = ((actions & SB_JUMP) && !p->OnMotorcycle) - ((actions & SB_CROUCH) || p->OnMotorcycle);
|
||||
const auto velZ = clamp(dist * kbdDir + dist * p->sync.uvel, -dist, dist);
|
||||
|
||||
p->jumping_counter = 0;
|
||||
p->pycount += 32;
|
||||
|
@ -1579,16 +1584,16 @@ void underwater(int snum, ESyncBits actions, double floorz, double ceilingz)
|
|||
if (!S_CheckActorSoundPlaying(pact, DUKE_UNDERWATER))
|
||||
S_PlayActorSound(DUKE_UNDERWATER, pact);
|
||||
|
||||
if ((actions & SB_JUMP) && !p->OnMotorcycle)
|
||||
if (velZ > 0)
|
||||
{
|
||||
if (p->vel.Z > 0) p->vel.Z = 0;
|
||||
p->vel.Z -= (348 / 256.);
|
||||
p->vel.Z -= velZ;
|
||||
if (p->vel.Z < -6) p->vel.Z = -6;
|
||||
}
|
||||
else if ((actions & SB_CROUCH) || p->OnMotorcycle)
|
||||
else if (velZ < 0)
|
||||
{
|
||||
if (p->vel.Z < 0) p->vel.Z = 0;
|
||||
p->vel.Z += (348 / 256.);
|
||||
p->vel.Z -= velZ;
|
||||
if (p->vel.Z > 6) p->vel.Z = 6;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -580,7 +580,9 @@ static void operateJetpack(int snum, ESyncBits actions, int psectlotag, double f
|
|||
{
|
||||
const auto p = &ps[snum];
|
||||
const auto pact = p->GetActor();
|
||||
const auto kbdDir = !!(actions & SB_JUMP) - !!(actions & SB_CROUCH);
|
||||
const double dist = shrunk ? 2 : 8;
|
||||
const double velZ = clamp(dist * kbdDir + dist * p->sync.uvel, -dist, dist);
|
||||
|
||||
p->on_ground = 0;
|
||||
p->jumping_counter = 0;
|
||||
|
@ -600,28 +602,26 @@ static void operateJetpack(int snum, ESyncBits actions, int psectlotag, double f
|
|||
S_PlayActorSound(DUKE_JETPACK_IDLE, pact);
|
||||
}
|
||||
|
||||
if ((actions & SB_JUMP) || p->sync.uvel > 0) //A (soar high)
|
||||
if (velZ > 0) //A (soar high)
|
||||
{
|
||||
// jump
|
||||
SetGameVarID(g_iReturnVarID, 0, pact, snum);
|
||||
OnEvent(EVENT_SOARUP, snum, pact, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, pact, snum).value() == 0)
|
||||
{
|
||||
pact->spr.pos.Z -= dist * !!(actions & SB_JUMP);
|
||||
pact->spr.pos.Z -= dist * p->sync.uvel;
|
||||
pact->spr.pos.Z -= velZ;
|
||||
p->crack_time = CRACK_TIME;
|
||||
}
|
||||
}
|
||||
|
||||
if ((actions & SB_CROUCH) || p->sync.uvel < 0) //Z (soar low)
|
||||
if (velZ < 0) //Z (soar low)
|
||||
{
|
||||
// crouch
|
||||
SetGameVarID(g_iReturnVarID, 0, pact, snum);
|
||||
OnEvent(EVENT_SOARDOWN, snum, pact, -1);
|
||||
if (GetGameVarID(g_iReturnVarID, pact, snum).value() == 0)
|
||||
{
|
||||
pact->spr.pos.Z += dist * !!(actions & SB_CROUCH);
|
||||
pact->spr.pos.Z -= dist * p->sync.uvel;
|
||||
pact->spr.pos.Z -= velZ;
|
||||
p->crack_time = CRACK_TIME;
|
||||
}
|
||||
}
|
||||
|
@ -767,7 +767,7 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, double floo
|
|||
|
||||
p->on_warping_sector = 0;
|
||||
|
||||
if (actions & SB_CROUCH)
|
||||
if ((actions & SB_CROUCH) || p->sync.uvel < 0)
|
||||
{
|
||||
playerCrouch(snum);
|
||||
}
|
||||
|
|
|
@ -1269,7 +1269,7 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, double floo
|
|||
|
||||
p->on_warping_sector = 0;
|
||||
|
||||
if ((actions & SB_CROUCH) && !p->OnMotorcycle)
|
||||
if (((actions & SB_CROUCH) || p->sync.uvel < 0) && !p->OnMotorcycle)
|
||||
{
|
||||
playerCrouch(snum);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue