Hotfix for platform movement being dropped on players.

Now players will apply platform movement when jumping,
but only if the platform is moving the same direction
as their jump is, and all other objects will have an
appropriate pmomz in reverse gravity FOF situations.
This commit is contained in:
Yukita Mayako 2015-05-29 04:34:53 -04:00
parent d7b3795a82
commit 3bc56a91b2
3 changed files with 24 additions and 43 deletions

View file

@ -2047,6 +2047,7 @@ boolean P_SceneryTryMove(mobj_t *thing, fixed_t x, fixed_t y)
// //
static boolean P_ThingHeightClip(mobj_t *thing) static boolean P_ThingHeightClip(mobj_t *thing)
{ {
boolean floormoved;
fixed_t oldfloorz = thing->floorz; fixed_t oldfloorz = thing->floorz;
boolean onfloor = P_IsObjectOnGround(thing);//(thing->z <= thing->floorz); boolean onfloor = P_IsObjectOnGround(thing);//(thing->z <= thing->floorz);
@ -2058,6 +2059,9 @@ static boolean P_ThingHeightClip(mobj_t *thing)
if (P_MobjWasRemoved(thing)) if (P_MobjWasRemoved(thing))
return true; return true;
floormoved = (thing->eflags & MFE_VERTICALFLIP && tmceilingz != thing->ceilingz)
|| (!(thing->eflags & MFE_VERTICALFLIP) && tmfloorz != thing->floorz);
thing->floorz = tmfloorz; thing->floorz = tmfloorz;
thing->ceilingz = tmceilingz; thing->ceilingz = tmceilingz;
@ -2066,7 +2070,7 @@ static boolean P_ThingHeightClip(mobj_t *thing)
if (tmfloorz > oldfloorz+thing->height) if (tmfloorz > oldfloorz+thing->height)
return true; return true;
if (/*!tmfloorthing && */onfloor && !(thing->flags & MF_NOGRAVITY)) if (onfloor && !(thing->flags & MF_NOGRAVITY) && floormoved)
{ {
if (thing->eflags & MFE_VERTICALFLIP) if (thing->eflags & MFE_VERTICALFLIP)
thing->pmomz = thing->ceilingz - (thing->z + thing->height); thing->pmomz = thing->ceilingz - (thing->z + thing->height);

View file

@ -1986,12 +1986,8 @@ static void P_PlayerZMovement(mobj_t *mo)
(FixedMul(cv_viewheight.value<<FRACBITS, mo->scale) - mo->player->viewheight)>>3; (FixedMul(cv_viewheight.value<<FRACBITS, mo->scale) - mo->player->viewheight)>>3;
} }
// adjust height if (mo->pmomz && mo->z > mo->floorz)
/* if (mo->pmomz && mo->z > mo->floorz && !(mo->player->pflags & PF_JUMPED))
{
mo->momz += mo->pmomz;
mo->pmomz = 0; mo->pmomz = 0;
}*/
mo->z += mo->momz; mo->z += mo->momz;
@ -2899,6 +2895,7 @@ static void P_PlayerMobjThinker(mobj_t *mobj)
msecnode_t *node; msecnode_t *node;
I_Assert(mobj != NULL); I_Assert(mobj != NULL);
I_Assert(mobj->player != NULL);
I_Assert(!P_MobjWasRemoved(mobj)); I_Assert(!P_MobjWasRemoved(mobj));
P_MobjCheckWater(mobj); P_MobjCheckWater(mobj);
@ -2917,7 +2914,7 @@ static void P_PlayerMobjThinker(mobj_t *mobj)
P_CheckPosition(mobj, mobj->x, mobj->y); P_CheckPosition(mobj, mobj->x, mobj->y);
goto animonly; goto animonly;
} }
else if (mobj->player && (mobj->player->pflags & PF_MACESPIN) && mobj->tracer) else if (mobj->player->pflags & PF_MACESPIN && mobj->tracer)
{ {
P_CheckPosition(mobj, mobj->x, mobj->y); P_CheckPosition(mobj, mobj->x, mobj->y);
goto animonly; goto animonly;
@ -2936,7 +2933,7 @@ static void P_PlayerMobjThinker(mobj_t *mobj)
else else
P_TryMove(mobj, mobj->x, mobj->y, true); P_TryMove(mobj, mobj->x, mobj->y, true);
if (!(netgame && mobj->player && mobj->player->spectator)) if (!(netgame && mobj->player->spectator))
{ {
// Crumbling platforms // Crumbling platforms
for (node = mobj->touching_sectorlist; node; node = node->m_snext) for (node = mobj->touching_sectorlist; node; node = node->m_snext)
@ -3019,18 +3016,14 @@ static void P_PlayerMobjThinker(mobj_t *mobj)
} }
else else
{ {
if (mobj->player) mobj->player->jumping = 0;
mobj->player->pflags &= ~PF_JUMPED;
if (mobj->player->secondjump || mobj->player->powers[pw_tailsfly])
{ {
mobj->player->jumping = 0; mobj->player->secondjump = 0;
mobj->player->pflags &= ~PF_JUMPED; mobj->player->powers[pw_tailsfly] = 0;
if (mobj->player->secondjump || mobj->player->powers[pw_tailsfly]) P_SetPlayerMobjState(mobj, S_PLAY_RUN1);
{
mobj->player->secondjump = 0;
mobj->player->powers[pw_tailsfly] = 0;
P_SetPlayerMobjState(mobj, S_PLAY_RUN1);
}
} }
mobj->pmomz = 0;
mobj->eflags &= ~MFE_JUSTHITFLOOR; mobj->eflags &= ~MFE_JUSTHITFLOOR;
} }
@ -6643,17 +6636,6 @@ for (i = ((mobj->flags2 & MF2_STRONGBOX) ? strongboxamt : weakboxamt); i; --i) s
} }
else else
{ {
if (mobj->player)
{
mobj->player->jumping = 0;
mobj->player->pflags &= ~PF_JUMPED;
if (mobj->player->secondjump || mobj->player->powers[pw_tailsfly])
{
mobj->player->secondjump = 0;
mobj->player->powers[pw_tailsfly] = 0;
P_SetPlayerMobjState(mobj, S_PLAY_RUN1);
}
}
mobj->pmomz = 0; // to prevent that weird rocketing gargoyle bug mobj->pmomz = 0; // to prevent that weird rocketing gargoyle bug
mobj->eflags &= ~MFE_JUSTHITFLOOR; mobj->eflags &= ~MFE_JUSTHITFLOOR;
} }
@ -6854,17 +6836,6 @@ void P_SceneryThinker(mobj_t *mobj)
} }
else else
{ {
if (mobj->player)
{
mobj->player->jumping = 0;
mobj->player->pflags &= ~PF_JUMPED;
if (mobj->player->secondjump || mobj->player->powers[pw_tailsfly])
{
mobj->player->secondjump = 0;
mobj->player->powers[pw_tailsfly] = 0;
P_SetPlayerMobjState(mobj, S_PLAY_RUN1);
}
}
mobj->pmomz = 0; // to prevent that weird rocketing gargoyle bug mobj->pmomz = 0; // to prevent that weird rocketing gargoyle bug
mobj->eflags &= ~MFE_JUSTHITFLOOR; mobj->eflags &= ~MFE_JUSTHITFLOOR;
} }

View file

@ -3619,11 +3619,18 @@ void P_DoJump(player_t *player, boolean soundandstate)
// set just an eensy above the ground // set just an eensy above the ground
if (player->mo->eflags & MFE_VERTICALFLIP) if (player->mo->eflags & MFE_VERTICALFLIP)
{
player->mo->z--; player->mo->z--;
if (player->mo->pmomz < 0)
player->mo->momz += player->mo->pmomz; // Add the platform's momentum to your jump.
}
else else
{
player->mo->z++; player->mo->z++;
if (player->mo->pmomz > 0)
player->mo->z += player->mo->pmomz; // Solves problem of 'hitting around again after jumping on a moving platform'. player->mo->momz += player->mo->pmomz; // Add the platform's momentum to your jump.
}
player->mo->pmomz = 0;
player->pflags |= PF_JUMPED; player->pflags |= PF_JUMPED;
@ -9028,7 +9035,6 @@ void P_PlayerThink(player_t *player)
player->mo->tracer->flags2 &= ~MF2_DONTDRAW; player->mo->tracer->flags2 &= ~MF2_DONTDRAW;
} }
player->mo->pmomz = 0;
player->pflags &= ~PF_SLIDING; player->pflags &= ~PF_SLIDING;
/* /*