Improve glide bounces

This commit is contained in:
lachwright 2019-09-30 16:35:05 +08:00
parent 7d57d53d45
commit 5bbd56b6fa

View file

@ -471,10 +471,13 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
toucher->momy = -toucher->momy; toucher->momy = -toucher->momy;
if (player->charability == CA_FLY && player->panim == PA_ABILITY) if (player->charability == CA_FLY && player->panim == PA_ABILITY)
toucher->momz = -toucher->momz/2; toucher->momz = -toucher->momz/2;
else if (player->charability == CA_GLIDEANDCLIMB && player->pflags & PF_GLIDING && !P_IsObjectOnGround(player->mo)) else if (player->pflags & PF_GLIDING && !P_IsObjectOnGround(toucher))
{ {
player->pflags &= ~(PF_GLIDING|PF_JUMPED|PF_NOJUMPDAMAGE); player->pflags &= ~(PF_GLIDING|PF_JUMPED|PF_NOJUMPDAMAGE);
P_SetPlayerMobjState(player->mo, S_PLAY_FALL); P_SetPlayerMobjState(toucher, S_PLAY_FALL);
toucher->momz += P_MobjFlip(toucher) * (player->speed >> 3);
toucher->momx = 7*toucher->momx>>3;
toucher->momy = 7*toucher->momy>>3;
} }
} }
P_DamageMobj(special, toucher, toucher, 1, 0); P_DamageMobj(special, toucher, toucher, 1, 0);
@ -1514,10 +1517,13 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
toucher->momx = P_ReturnThrustX(special, angle, touchspeed); toucher->momx = P_ReturnThrustX(special, angle, touchspeed);
toucher->momy = P_ReturnThrustY(special, angle, touchspeed); toucher->momy = P_ReturnThrustY(special, angle, touchspeed);
toucher->momz = -toucher->momz; toucher->momz = -toucher->momz;
if (player->pflags & PF_GLIDING) if (player->pflags & PF_GLIDING && !P_IsObjectOnGround(toucher))
{ {
player->pflags &= ~(PF_GLIDING|PF_JUMPED|PF_NOJUMPDAMAGE); player->pflags &= ~(PF_GLIDING|PF_JUMPED|PF_NOJUMPDAMAGE);
P_SetPlayerMobjState(toucher, S_PLAY_FALL); P_SetPlayerMobjState(toucher, S_PLAY_FALL);
toucher->momz += P_MobjFlip(toucher) * (player->speed >> 3);
toucher->momx = 7*toucher->momx>>3;
toucher->momy = 7*toucher->momy>>3;
} }
player->homing = 0; player->homing = 0;
@ -1562,10 +1568,13 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
toucher->momx = P_ReturnThrustX(special, special->angle, touchspeed); toucher->momx = P_ReturnThrustX(special, special->angle, touchspeed);
toucher->momy = P_ReturnThrustY(special, special->angle, touchspeed); toucher->momy = P_ReturnThrustY(special, special->angle, touchspeed);
toucher->momz = -toucher->momz; toucher->momz = -toucher->momz;
if (player->pflags & PF_GLIDING) if (player->pflags & PF_GLIDING && !P_IsObjectOnGround(toucher))
{ {
player->pflags &= ~(PF_GLIDING|PF_JUMPED|PF_NOJUMPDAMAGE); player->pflags &= ~(PF_GLIDING|PF_JUMPED|PF_NOJUMPDAMAGE);
P_SetPlayerMobjState(toucher, S_PLAY_FALL); P_SetPlayerMobjState(toucher, S_PLAY_FALL);
toucher->momz += P_MobjFlip(toucher) * (player->speed >> 3);
toucher->momx = 7*toucher->momx>>3;
toucher->momy = 7*toucher->momy>>3;
} }
player->homing = 0; player->homing = 0;