From 55d2da2201f43f1a1e64b7172d617c85dfcea6ff Mon Sep 17 00:00:00 2001 From: mazmazz Date: Wed, 15 Aug 2018 18:42:20 -0400 Subject: [PATCH 1/4] Fix NiGHTS Bumper player positioning --- src/p_inter.c | 8 +------- src/p_user.c | 9 +++++++++ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/p_inter.c b/src/p_inter.c index ce8bba6b6..21f580a99 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1005,13 +1005,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) player->flyangle = special->threshold; player->speed = FixedMul(special->info->speed, special->scale); - // Potentially causes axis transfer failures. - // Also rarely worked properly anyway. - //P_UnsetThingPosition(player->mo); - //player->mo->x = special->x; - //player->mo->y = special->y; - //P_SetThingPosition(player->mo); - toucher->z = special->z+(special->height/4); + P_SetTarget(&player->mo->hnext, special); // Reference bumper for position correction on next tic } else // More like a spring { diff --git a/src/p_user.c b/src/p_user.c index fd09b0847..595e9566e 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -6175,6 +6175,15 @@ static void P_NiGHTSMovement(player_t *player) S_ChangeMusicInternal((((maptol & TOL_NIGHTS) && !G_IsSpecialStage(gamemap)) ? "_ntime" : "_drown"), false); + if (player->bumpertime == TICRATE/2) + { + // Center player to bumper here because if you try to set player's position in P_TouchSpecialThing case MT_NIGHTSBUMPER, + // that position is fudged in the time between that routine in the previous tic + // and reaching here in the current tic + P_TeleportMove(player->mo, player->mo->hnext->x, player->mo->hnext->y, player->mo->hnext->z + (player->mo->hnext->height/4)); + P_SetTarget(&player->mo->hnext, NULL); + } + if (player->mo->z < player->mo->floorz) player->mo->z = player->mo->floorz; From 67da64a06456de84e435e5bf26cbe521e09f0e59 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Wed, 15 Aug 2018 18:50:28 -0400 Subject: [PATCH 2/4] Use more efficient position setting. For Z, also adjust for bumper mobj scale. --- src/p_user.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index 595e9566e..551b7c5f3 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -6180,7 +6180,11 @@ static void P_NiGHTSMovement(player_t *player) // Center player to bumper here because if you try to set player's position in P_TouchSpecialThing case MT_NIGHTSBUMPER, // that position is fudged in the time between that routine in the previous tic // and reaching here in the current tic - P_TeleportMove(player->mo, player->mo->hnext->x, player->mo->hnext->y, player->mo->hnext->z + (player->mo->hnext->height/4)); + P_UnsetThingPosition(player->mo); + player->mo->x = player->mo->hnext->x; + player->mo->y = player->mo->hnext->y; + player->mo->z = player->mo->hnext->z + FixedMul(player->mo->hnext->height/4, player->mo->hnext->scale); + P_SetThingPosition(player->mo); P_SetTarget(&player->mo->hnext, NULL); } From 432c1ab86284cbc86434354287aafe26bb6ae6be Mon Sep 17 00:00:00 2001 From: mazmazz Date: Wed, 15 Aug 2018 19:09:54 -0400 Subject: [PATCH 3/4] Also center non-NiGHTS players on NiGHTS bumpers --- src/p_user.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 551b7c5f3..a647bfba0 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -6174,20 +6174,6 @@ static void P_NiGHTSMovement(player_t *player) // S_StartSound(NULL, sfx_timeup); // that creepy "out of time" music from NiGHTS. Dummied out, as some on the dev team thought it wasn't Sonic-y enough (Mystic, notably). Uncomment to restore. -SH S_ChangeMusicInternal((((maptol & TOL_NIGHTS) && !G_IsSpecialStage(gamemap)) ? "_ntime" : "_drown"), false); - - if (player->bumpertime == TICRATE/2) - { - // Center player to bumper here because if you try to set player's position in P_TouchSpecialThing case MT_NIGHTSBUMPER, - // that position is fudged in the time between that routine in the previous tic - // and reaching here in the current tic - P_UnsetThingPosition(player->mo); - player->mo->x = player->mo->hnext->x; - player->mo->y = player->mo->hnext->y; - player->mo->z = player->mo->hnext->z + FixedMul(player->mo->hnext->height/4, player->mo->hnext->scale); - P_SetThingPosition(player->mo); - P_SetTarget(&player->mo->hnext, NULL); - } - if (player->mo->z < player->mo->floorz) player->mo->z = player->mo->floorz; @@ -9821,7 +9807,19 @@ void P_PlayerThink(player_t *player) P_ResetScore(player); } else + { + if (player->bumpertime == TICRATE/2 && player->mo->hnext) + { + // Center player to NiGHTS bumper here because if you try to set player's position in + // P_TouchSpecialThing case MT_NIGHTSBUMPER, that position is fudged in the time + // between that routine in the previous tic + // and reaching here in the current tic + P_TeleportMove(player->mo, player->mo->hnext->x, player->mo->hnext->y + , player->mo->hnext->z + FixedMul(player->mo->hnext->height/4, player->mo->hnext->scale)); + P_SetTarget(&player->mo->hnext, NULL); + } P_MovePlayer(player); + } if (!player->mo) return; // P_MovePlayer removed player->mo. From 08f35c0792e3081a1021a69a275c682fc4a01bfa Mon Sep 17 00:00:00 2001 From: mazmazz Date: Wed, 15 Aug 2018 23:40:42 -0400 Subject: [PATCH 4/4] Don't apply autobrake on NiGHTS bumpers --- src/p_user.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index a647bfba0..3a4906a67 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -9943,7 +9943,8 @@ void P_PlayerThink(player_t *player) || player->panim == PA_PAIN || !player->mo->health || player->climbing - || player->pflags & (PF_SPINNING|PF_SLIDING)) + || player->pflags & (PF_SPINNING|PF_SLIDING) + || player->bumpertime) player->pflags &= ~PF_APPLYAUTOBRAKE; else if (currentlyonground || player->powers[pw_tailsfly]) player->pflags |= PF_APPLYAUTOBRAKE;