From 1ba39672d4644acb760dd1682d6fa17ea0a46eb9 Mon Sep 17 00:00:00 2001 From: wolfy852 Date: Sun, 10 Feb 2019 22:55:27 -0600 Subject: [PATCH 01/15] Fix drift sparks not generating on offroad with Hyudoro, Invincibility, or sneaker boosts --- src/k_kart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/k_kart.c b/src/k_kart.c index 49fd54e6..3c9b082b 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -4708,7 +4708,7 @@ static void K_KartDrift(player_t *player, boolean onground) } // Disable drift-sparks until you're going fast enough - if (player->kartstuff[k_getsparks] == 0 || player->kartstuff[k_offroad]) + if (player->kartstuff[k_getsparks] == 0 || (player->kartstuff[k_offroad] && !player->kartstuff[k_invincibilitytimer] && !player->kartstuff[k_hyudorotimer] && !player->kartstuff[k_sneakertimer])) driftadditive = 0; if (player->speed > minspeed*2) player->kartstuff[k_getsparks] = 1; From 7e77e0c4293af4f2be55757f84664f51dc14f02f Mon Sep 17 00:00:00 2001 From: james Date: Sat, 16 Feb 2019 14:20:55 -0800 Subject: [PATCH 02/15] Support libpng without the apng patch and fix mingw (?) compiler errors --- src/apng.c | 23 +++++++++++++++++++++-- src/apng.h | 16 ++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/src/apng.c b/src/apng.c index 2109c0a0..da8140e0 100644 --- a/src/apng.c +++ b/src/apng.c @@ -25,6 +25,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "apng.h" +#define APNG_INFO_acTL 0x20000U + #define APNG_WROTE_acTL 0x10000U struct apng_info_def @@ -59,6 +61,10 @@ size_t apng_default_tell (png_structp); #endif/* PNG_STDIO_SUPPORTED */ void apng_write_IEND (png_structp); void apng_write_acTL (png_structp, png_uint_32, png_uint_32); +#ifndef PNG_WRITE_APNG_SUPPORTED +void apng_set_acTL_dummy (png_structp, png_infop, apng_infop, + png_uint_32, png_uint_32); +#endif/* PNG_WRITE_APNG_SUPPORTED */ apng_infop apng_create_info_struct (png_structp pngp) @@ -204,7 +210,7 @@ apng_set_acTL (png_structp pngp, png_infop infop, apng_infop ainfop, ainfop->num_frames = frames; ainfop->num_plays = plays; - ainfop->valid |= PNG_INFO_acTL; + ainfop->valid |= APNG_INFO_acTL; return 1; } @@ -218,7 +224,7 @@ apng_write_info_before_PLTE (png_structp pngp, png_infop infop, png_write_info_before_PLTE(pngp, infop); - if (( ainfop->valid & PNG_INFO_acTL ) &&!( ainfop->mode & APNG_WROTE_acTL )) + if (( ainfop->valid & APNG_INFO_acTL )&&!( ainfop->mode & APNG_WROTE_acTL )) { ainfop->start_acTL = apng_tell(pngp, ainfop); @@ -253,6 +259,19 @@ apng_write_end (png_structp pngp, png_infop infop, apng_infop ainfop) #endif/* PNG_WRITE_FLUSH_AFTER_IEND_SUPPORTED */ } +#ifndef PNG_WRITE_APNG_SUPPORTED +void +apng_set_acTL_dummy (png_structp pngp, png_infop infop, apng_infop ainfop, + png_uint_32 frames, png_uint_32 plays) +{ + (void)pngp; + (void)infop; + (void)ainfop; + (void)frames; + (void)plays; +} +#endif/* PNG_WRITE_APNG_SUPPORTED */ + /* Dynamic runtime linking capable! (Hopefully.) */ void apng_set_set_acTL_fn (png_structp pngp, apng_infop ainfop, diff --git a/src/apng.h b/src/apng.h index eefd6aaa..aa7fac3d 100644 --- a/src/apng.h +++ b/src/apng.h @@ -23,6 +23,22 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef APNG_H #define APNG_H +#ifndef _MSC_VER +#ifndef _WII +#ifndef _LARGEFILE64_SOURCE +#define _LARGEFILE64_SOURCE +#endif +#endif +#endif + +#ifndef _LFS64_LARGEFILE +#define _LFS64_LARGEFILE +#endif + +#ifndef _FILE_OFFSET_BITS +#define _FILE_OFFSET_BITS 0 +#endif + #include typedef struct apng_info_def apng_info; From 9d85c2e064c354d01819921f0d553c818eb86b52 Mon Sep 17 00:00:00 2001 From: james Date: Sat, 16 Feb 2019 14:39:33 -0800 Subject: [PATCH 03/15] Actually support no apng patch --- src/apng.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/apng.c b/src/apng.c index da8140e0..89cd300a 100644 --- a/src/apng.c +++ b/src/apng.c @@ -279,7 +279,11 @@ apng_set_set_acTL_fn (png_structp pngp, apng_infop ainfop, { (void)pngp; if (!ainfop->set_acTL_fn) +#ifndef PNG_WRITE_APNG_SUPPORTED + ainfop->set_acTL_fn = &apng_set_acTL_dummy; +#else ainfop->set_acTL_fn = &png_set_acTL; +#endif/* PNG_WRITE_APNG_SUPPORTED */ else ainfop->set_acTL_fn = set_acTL_f; } From 46edc1e33013e641c015d5eb9781800fba4cc48a Mon Sep 17 00:00:00 2001 From: james Date: Sun, 17 Feb 2019 15:50:42 -0800 Subject: [PATCH 04/15] Create the correct dummy function --- src/apng.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/apng.c b/src/apng.c index 89cd300a..bcfccd33 100644 --- a/src/apng.c +++ b/src/apng.c @@ -62,7 +62,7 @@ size_t apng_default_tell (png_structp); void apng_write_IEND (png_structp); void apng_write_acTL (png_structp, png_uint_32, png_uint_32); #ifndef PNG_WRITE_APNG_SUPPORTED -void apng_set_acTL_dummy (png_structp, png_infop, apng_infop, +png_uint_32 apng_set_acTL_dummy (png_structp, png_infop, png_uint_32, png_uint_32); #endif/* PNG_WRITE_APNG_SUPPORTED */ @@ -260,15 +260,15 @@ apng_write_end (png_structp pngp, png_infop infop, apng_infop ainfop) } #ifndef PNG_WRITE_APNG_SUPPORTED -void -apng_set_acTL_dummy (png_structp pngp, png_infop infop, apng_infop ainfop, +png_uint_32 +apng_set_acTL_dummy (png_structp pngp, png_infop infop, png_uint_32 frames, png_uint_32 plays) { (void)pngp; (void)infop; - (void)ainfop; (void)frames; (void)plays; + return 0; } #endif/* PNG_WRITE_APNG_SUPPORTED */ From 6f3b10313fae85b0b40914c0a1c85df231866c47 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Sun, 17 Feb 2019 22:09:37 -0600 Subject: [PATCH 05/15] Add some P_MobjWasRemoved checks around code that shrink touches It's the only place in the vanilla game where K_DropItems is called that isn't from a direct collision with the player it's being called on. It's also a syncfail that doesn't happen anywhere else, and I saw my sync state appear to get slightly corrupted when it happened. Let's see if this fixes anything... --- src/k_kart.c | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index b006ae3b..2c913e10 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1978,12 +1978,16 @@ void K_SpinPlayer(player_t *player, mobj_t *source, INT32 type, mobj_t *inflicto static void K_RemoveGrowShrink(player_t *player) { player->kartstuff[k_growshrinktimer] = 0; - if (player->kartstuff[k_invincibilitytimer] == 0) - player->mo->color = player->skincolor; - player->mo->scalespeed = mapobjectscale/TICRATE; - player->mo->destscale = mapobjectscale; - if (cv_kartdebugshrink.value && !modeattacking && !player->bot) - player->mo->destscale = (6*player->mo->destscale)/8; + + if (!P_MobjWasRemoved(player->mo)) + { + if (player->kartstuff[k_invincibilitytimer] == 0) + player->mo->color = player->skincolor; + player->mo->scalespeed = mapobjectscale/TICRATE; + player->mo->destscale = mapobjectscale; + if (cv_kartdebugshrink.value && !modeattacking && !player->bot) + player->mo->destscale = (6*player->mo->destscale)/8; + } P_RestoreMusic(player); } @@ -3290,11 +3294,15 @@ static void K_DoShrink(player_t *user) { // Start shrinking! K_DropItems(&players[i]); - players[i].mo->scalespeed = mapobjectscale/TICRATE; - players[i].mo->destscale = (6*mapobjectscale)/8; - if (cv_kartdebugshrink.value && !modeattacking && !players[i].bot) - players[i].mo->destscale = (6*players[i].mo->destscale)/8; - players[i].kartstuff[k_growshrinktimer] = -(200+(40*(MAXPLAYERS-players[i].kartstuff[k_position]))); + + if (!P_MobjWasRemoved(players[i].mo)) + { + players[i].mo->scalespeed = mapobjectscale/TICRATE; + players[i].mo->destscale = (6*mapobjectscale)/8; + if (cv_kartdebugshrink.value && !modeattacking && !players[i].bot) + players[i].mo->destscale = (6*players[i].mo->destscale)/8; + players[i].kartstuff[k_growshrinktimer] = -(200+(40*(MAXPLAYERS-players[i].kartstuff[k_position]))); + } } // Grow should get taken away. @@ -3419,7 +3427,7 @@ void K_DropHnextList(player_t *player) mobjtype_t type; boolean orbit, ponground, dropall = true; - if (!work) + if (!work || P_MobjWasRemoved(work)) return; flip = P_MobjFlip(player->mo); @@ -3556,7 +3564,7 @@ void K_DropItems(player_t *player) K_DropHnextList(player); - if (player->mo && player->kartstuff[k_itemamount]) + if (player->mo && !P_MobjWasRemoved(player->mo) && player->kartstuff[k_itemamount]) { mobj_t *drop = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z + player->mo->height/2, MT_FLOATINGITEM); P_SetScale(drop, drop->scale>>4); From c74b05eadc81d9a96fc5b96fbe4a560366aafe89 Mon Sep 17 00:00:00 2001 From: james Date: Sun, 17 Feb 2019 23:09:52 -0800 Subject: [PATCH 06/15] Remove extra whitespace --- src/apng.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/apng.c b/src/apng.c index bcfccd33..694b3d1e 100644 --- a/src/apng.c +++ b/src/apng.c @@ -151,7 +151,7 @@ apng_default_tell (png_structp pngp) void apng_set_write_fn (png_structp pngp, apng_infop ainfop, png_voidp iop, - png_rw_ptr write_f, png_flush_ptr flush_f, + png_rw_ptr write_f, png_flush_ptr flush_f, apng_seek_ptr seek_f, apng_tell_ptr tell_f) { if (!( pngp && ainfop )) From 86a9168e86ceeaad711eb57880f9f518f684835c Mon Sep 17 00:00:00 2001 From: Latapostrophe Date: Mon, 18 Feb 2019 22:19:28 +0100 Subject: [PATCH 07/15] Fix dedicated server extra lua variables not being synched for joiners --- src/lua_script.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lua_script.c b/src/lua_script.c index 1f87d33e..28f02ca3 100644 --- a/src/lua_script.c +++ b/src/lua_script.c @@ -1020,7 +1020,7 @@ void LUA_Archive(void) for (i = 0; i < MAXPLAYERS; i++) { - if (!playeringame[i]) + if (!playeringame[i] && i > 0) // NEVER skip player 0, this is for dedi servs. continue; // all players in game will be archived, even if they just add a 0. ArchiveExtVars(&players[i], "player"); @@ -1056,7 +1056,7 @@ void LUA_UnArchive(void) for (i = 0; i < MAXPLAYERS; i++) { - if (!playeringame[i]) + if (!playeringame[i] && i > 0) // same here, this is to synch dediservs properly. continue; UnArchiveExtVars(&players[i]); } From a4c8388f3b000ec706e4df79fa008e411a1062e2 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Mon, 18 Feb 2019 22:36:26 -0600 Subject: [PATCH 08/15] Fix bumps sometimes shooting off stupidly fast --- src/k_kart.c | 69 ++++++++++++++++++++++++++-------------------------- 1 file changed, 35 insertions(+), 34 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index b006ae3b..f8efff2b 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1056,7 +1056,7 @@ void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce, boolean solid) mobj_t *fx; fixed_t momdifx, momdify; fixed_t distx, disty; - fixed_t dot, p; + fixed_t dot, force; fixed_t mass1, mass2; if (!mobj1 || !mobj2) @@ -1114,6 +1114,35 @@ void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce, boolean solid) momdifx = mobj1->momx - mobj2->momx; momdify = mobj1->momy - mobj2->momy; + // Adds the OTHER player's momentum, so that it reduces the chance of you being "inside" the other object + distx = (mobj1->x + mobj2->momx) - (mobj2->x + mobj1->momx); + disty = (mobj1->y + mobj2->momy) - (mobj2->y + mobj1->momy); + + if (distx == 0 && disty == 0) + // if there's no distance between the 2, they're directly on top of each other, don't run this + return; + + { // Normalize distance to the sum of the two objects' radii, since in a perfect world that would be the distance at the point of collision... + fixed_t dist = P_AproxDistance(distx, disty) ?: 1; + fixed_t nx = FixedDiv(distx, dist); + fixed_t ny = FixedDiv(disty, dist); + + distx = FixedMul(mobj1->radius+mobj2->radius, nx); + disty = FixedMul(mobj1->radius+mobj2->radius, ny); + + CONS_Printf("dist %f %f %d %d %d %d\n", + FIXED_TO_FLOAT(P_AproxDistance(distx, disty)), + FIXED_TO_FLOAT(P_AproxDistance(momdifx, momdify)), + mobj1->momx, mobj1->momy, mobj2->momx, mobj2->momy); + + if (momdifx == 0 && momdify == 0) + { + // If there's no momentum difference, they're moving at exactly the same rate. Pretend they moved into each other. + momdifx = -nx; + momdify = -ny; + } + } + // if the speed difference is less than this let's assume they're going proportionately faster from each other if (P_AproxDistance(momdifx, momdify) < (25*mapobjectscale)) { @@ -1124,34 +1153,6 @@ void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce, boolean solid) momdify = FixedMul((25*mapobjectscale), normalisedy); } - // Adds the OTHER player's momentum, so that it reduces the chance of you being "inside" the other object - distx = (mobj1->x + mobj2->momx) - (mobj2->x + mobj1->momx); - disty = (mobj1->y + mobj2->momy) - (mobj2->y + mobj1->momy); - - { // Don't allow dist to get WAY too low, that it pushes you stupidly huge amounts, or backwards... - fixed_t dist = P_AproxDistance(distx, disty); - fixed_t nx = FixedDiv(distx, dist); - fixed_t ny = FixedDiv(disty, dist); - - if (P_AproxDistance(distx, disty) < (3*mobj1->radius)/4) - { - distx = FixedMul((3*mobj1->radius)/4, nx); - disty = FixedMul((3*mobj1->radius)/4, ny); - } - - if (P_AproxDistance(distx, disty) < (3*mobj2->radius)/4) - { - distx = FixedMul((3*mobj2->radius)/4, nx); - disty = FixedMul((3*mobj2->radius)/4, ny); - } - } - - if (distx == 0 && disty == 0) - { - // if there's no distance between the 2, they're directly on top of each other, don't run this - return; - } - dot = FixedMul(momdifx, distx) + FixedMul(momdify, disty); if (dot >= 0) @@ -1160,7 +1161,7 @@ void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce, boolean solid) return; } - p = FixedDiv(dot, FixedMul(distx, distx)+FixedMul(disty, disty)); + force = FixedDiv(dot, FixedMul(distx, distx)+FixedMul(disty, disty)); if (bounce == true && mass2 > 0) // Perform a Goomba Bounce. mobj1->momz = -mobj1->momz; @@ -1175,14 +1176,14 @@ void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce, boolean solid) if (mass2 > 0) { - mobj1->momx = mobj1->momx - FixedMul(FixedMul(FixedDiv(2*mass2, mass1 + mass2), p), distx); - mobj1->momy = mobj1->momy - FixedMul(FixedMul(FixedDiv(2*mass2, mass1 + mass2), p), disty); + mobj1->momx = mobj1->momx - FixedMul(FixedMul(FixedDiv(2*mass2, mass1 + mass2), force), distx); + mobj1->momy = mobj1->momy - FixedMul(FixedMul(FixedDiv(2*mass2, mass1 + mass2), force), disty); } if (mass1 > 0 && solid == false) { - mobj2->momx = mobj2->momx - FixedMul(FixedMul(FixedDiv(2*mass1, mass1 + mass2), p), -distx); - mobj2->momy = mobj2->momy - FixedMul(FixedMul(FixedDiv(2*mass1, mass1 + mass2), p), -disty); + mobj2->momx = mobj2->momx - FixedMul(FixedMul(FixedDiv(2*mass1, mass1 + mass2), force), -distx); + mobj2->momy = mobj2->momy - FixedMul(FixedMul(FixedDiv(2*mass1, mass1 + mass2), force), -disty); } // Do the bump fx when we've CONFIRMED we can bump. From 9c1749d26982fd36fc05d531e26182314b7f10b8 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Mon, 18 Feb 2019 23:35:01 -0600 Subject: [PATCH 09/15] Make extra sure we launch in the correct direction --- src/k_kart.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index f8efff2b..807c9ce7 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1114,9 +1114,9 @@ void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce, boolean solid) momdifx = mobj1->momx - mobj2->momx; momdify = mobj1->momy - mobj2->momy; - // Adds the OTHER player's momentum, so that it reduces the chance of you being "inside" the other object - distx = (mobj1->x + mobj2->momx) - (mobj2->x + mobj1->momx); - disty = (mobj1->y + mobj2->momy) - (mobj2->y + mobj1->momy); + // Adds the OTHER player's momentum times a bunch, for the best chance of getting the correct direction + distx = (mobj1->x + mobj2->momx*3) - (mobj2->x + mobj1->momx*3); + disty = (mobj1->y + mobj2->momy*3) - (mobj2->y + mobj1->momy*3); if (distx == 0 && disty == 0) // if there's no distance between the 2, they're directly on top of each other, don't run this From caf7888eed70c9778875adacddb83b1dbad3b9d9 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Mon, 18 Feb 2019 23:35:24 -0600 Subject: [PATCH 10/15] Fix players sometimes snapping backwards on landing after spikeball hits --- src/k_kart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/k_kart.c b/src/k_kart.c index 807c9ce7..9887318a 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -5476,7 +5476,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) } // Wipeout slowdown - if (player->kartstuff[k_spinouttimer] && player->kartstuff[k_wipeoutslow]) + if (player->kartstuff[k_spinouttimer] && player->kartstuff[k_wipeoutslow] && player->mo->friction > FRACUNIT/2) { if (player->kartstuff[k_offroad]) player->mo->friction -= 4912; From 838ed005d217344326c602744f9d960384259c0a Mon Sep 17 00:00:00 2001 From: fickleheart Date: Mon, 18 Feb 2019 23:39:08 -0600 Subject: [PATCH 11/15] Remove debugging print --- src/k_kart.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 9887318a..fded8b1c 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1130,11 +1130,6 @@ void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce, boolean solid) distx = FixedMul(mobj1->radius+mobj2->radius, nx); disty = FixedMul(mobj1->radius+mobj2->radius, ny); - CONS_Printf("dist %f %f %d %d %d %d\n", - FIXED_TO_FLOAT(P_AproxDistance(distx, disty)), - FIXED_TO_FLOAT(P_AproxDistance(momdifx, momdify)), - mobj1->momx, mobj1->momy, mobj2->momx, mobj2->momy); - if (momdifx == 0 && momdify == 0) { // If there's no momentum difference, they're moving at exactly the same rate. Pretend they moved into each other. From 9c5ae02755d01e002c1943de1d091e4b5d06a0b0 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Tue, 19 Feb 2019 08:05:35 -0600 Subject: [PATCH 12/15] Fix cmd latency occasionally jumping to max --- src/g_game.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/g_game.c b/src/g_game.c index f0d221ff..3944c02a 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2162,7 +2162,7 @@ void G_Ticker(boolean run) G_CopyTiccmd(cmd, &netcmds[buf][i], 1); // Use the leveltime sent in the player's ticcmd to determine control lag - cmd->latency = modeattacking ? 0 : min((leveltime & 0xFF) - cmd->latency, MAXPREDICTTICS-1); //@TODO add a cvar to allow setting this max + cmd->latency = modeattacking ? 0 : min(((leveltime & 0xFF) - cmd->latency) & 0xFF, MAXPREDICTTICS-1); //@TODO add a cvar to allow setting this max } } From 580e12a32af9763eee3d71053e0ed53e505983ff Mon Sep 17 00:00:00 2001 From: fickleheart Date: Tue, 19 Feb 2019 16:04:23 -0600 Subject: [PATCH 13/15] Add null check too --- src/k_kart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/k_kart.c b/src/k_kart.c index 2c913e10..e67de72b 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1979,7 +1979,7 @@ static void K_RemoveGrowShrink(player_t *player) { player->kartstuff[k_growshrinktimer] = 0; - if (!P_MobjWasRemoved(player->mo)) + if (player->mo && !P_MobjWasRemoved(player->mo)) { if (player->kartstuff[k_invincibilitytimer] == 0) player->mo->color = player->skincolor; From 8988927d160957d4bad569ff0ec214ac7f5c7329 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Tue, 19 Feb 2019 16:46:48 -0600 Subject: [PATCH 14/15] Only apply friction changes on the ground --- src/k_kart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/k_kart.c b/src/k_kart.c index fded8b1c..d63591e7 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -5471,7 +5471,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) } // Wipeout slowdown - if (player->kartstuff[k_spinouttimer] && player->kartstuff[k_wipeoutslow] && player->mo->friction > FRACUNIT/2) + if (player->kartstuff[k_spinouttimer] && player->kartstuff[k_wipeoutslow] && P_IsObjectOnGround(player->mo)) { if (player->kartstuff[k_offroad]) player->mo->friction -= 4912; From a59a1c53b0d2f11888d788e8936d22a45f2824b4 Mon Sep 17 00:00:00 2001 From: fickleheart Date: Tue, 19 Feb 2019 17:05:04 -0600 Subject: [PATCH 15/15] Add check to all of the friction stuff --- src/k_kart.c | 63 +++++++++++++++++++++++++++------------------------- 1 file changed, 33 insertions(+), 30 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index d63591e7..39f2a714 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -5440,43 +5440,46 @@ void K_MoveKartPlayer(player_t *player, boolean onground) } } - // Friction - if (!player->kartstuff[k_offroad]) + if (onground) { - if (player->speed > 0 && cmd->forwardmove == 0 && player->mo->friction == 59392) - player->mo->friction += 4608; - if (player->speed > 0 && cmd->forwardmove < 0 && player->mo->friction == 59392) - player->mo->friction += 1608; - } + // Friction + if (!player->kartstuff[k_offroad]) + { + if (player->speed > 0 && cmd->forwardmove == 0 && player->mo->friction == 59392) + player->mo->friction += 4608; + if (player->speed > 0 && cmd->forwardmove < 0 && player->mo->friction == 59392) + player->mo->friction += 1608; + } - // Karma ice physics - if (G_BattleGametype() && player->kartstuff[k_bumper] <= 0) - { - player->mo->friction += 1228; + // Karma ice physics + if (G_BattleGametype() && player->kartstuff[k_bumper] <= 0) + { + player->mo->friction += 1228; - if (player->mo->friction > FRACUNIT) - player->mo->friction = FRACUNIT; - if (player->mo->friction < 0) - player->mo->friction = 0; + if (player->mo->friction > FRACUNIT) + player->mo->friction = FRACUNIT; + if (player->mo->friction < 0) + player->mo->friction = 0; - player->mo->movefactor = FixedDiv(ORIG_FRICTION, player->mo->friction); + player->mo->movefactor = FixedDiv(ORIG_FRICTION, player->mo->friction); - if (player->mo->movefactor < FRACUNIT) - player->mo->movefactor = 19*player->mo->movefactor - 18*FRACUNIT; - else - player->mo->movefactor = FRACUNIT; //player->mo->movefactor = ((player->mo->friction - 0xDB34)*(0xA))/0x80; + if (player->mo->movefactor < FRACUNIT) + player->mo->movefactor = 19*player->mo->movefactor - 18*FRACUNIT; + else + player->mo->movefactor = FRACUNIT; //player->mo->movefactor = ((player->mo->friction - 0xDB34)*(0xA))/0x80; - if (player->mo->movefactor < 32) - player->mo->movefactor = 32; - } + if (player->mo->movefactor < 32) + player->mo->movefactor = 32; + } - // Wipeout slowdown - if (player->kartstuff[k_spinouttimer] && player->kartstuff[k_wipeoutslow] && P_IsObjectOnGround(player->mo)) - { - if (player->kartstuff[k_offroad]) - player->mo->friction -= 4912; - if (player->kartstuff[k_wipeoutslow] == 1) - player->mo->friction -= 9824; + // Wipeout slowdown + if (player->kartstuff[k_spinouttimer] && player->kartstuff[k_wipeoutslow]) + { + if (player->kartstuff[k_offroad]) + player->mo->friction -= 4912; + if (player->kartstuff[k_wipeoutslow] == 1) + player->mo->friction -= 9824; + } } K_KartDrift(player, onground);