From cf49a0df6ad40288ea9ee0bc43f7691cc353af7c Mon Sep 17 00:00:00 2001 From: toaster Date: Sat, 19 Nov 2022 00:32:52 +0000 Subject: [PATCH 1/4] Flung rings from grow/shrunk players are now at mapobjectscale rather than player scale This is a HUGE pet peeve of mine considering how ring scale is otherwise very, very consistent and uncoupled --- src/p_inter.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/p_inter.c b/src/p_inter.c index 8f439ff89..2f2f95d56 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -2256,6 +2256,9 @@ static void P_FlingBurst mo->fuse = objFuse; P_SetTarget(&mo->target, player->mo); + // We want everything from P_SpawnMobjFromMobj except scale. + objScale = FixedMul(objScale, FixedDiv(mapobjectscale, player->mo->scale)); + if (objScale != FRACUNIT) { P_SetScale(mo, FixedMul(objScale, mo->scale)); From 73cc93a76f222e005052ec02a994243c081a4587 Mon Sep 17 00:00:00 2001 From: toaster Date: Sat, 19 Nov 2022 00:36:27 +0000 Subject: [PATCH 2/4] WIP: Attempt to make shrink/grow tricks consistent with mapobjectscale tricks. Now the opposite problem - slightly too high momentum for shrink, slightly low momentum for grow. Some other factor I haven't considered..? Would VERY much appreciate an assist. --- src/k_kart.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 583639b9c..f64ce421b 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -6568,6 +6568,7 @@ void K_DoPogoSpring(mobj_t *mo, fixed_t vertispeed, UINT8 sound) mo->player->tricktime = 0; // Reset post-hitlag timer // Setup the boost for potential upwards trick, at worse, make it your regular max speed. (boost = curr speed*1.25) mo->player->trickboostpower = max(FixedDiv(mo->player->speed, K_GetKartSpeed(mo->player, false, false)) - FRACUNIT, 0)*125/100; + mo->player->trickboostpower = FixedMul(mo->player->trickboostpower, FixedDiv(mapobjectscale, mo->scale)); //CONS_Printf("Got boost: %d%\n", mo->player->trickboostpower*100 / FRACUNIT); } @@ -11361,9 +11362,10 @@ void K_MoveKartPlayer(player_t *player, boolean onground) { const angle_t lr = ANGLE_45; fixed_t momz = FixedDiv(player->mo->momz, mapobjectscale); // bring momz back to scale... + fixed_t invertscale = FixedDiv(mapobjectscale, player->mo->scale); fixed_t speedmult = max(0, FRACUNIT - abs(momz)/TRICKMOMZRAMP); // TRICKMOMZRAMP momz is minimum speed (Should be 20) - fixed_t basespeed = K_GetKartSpeed(player, false, false); // at WORSE, keep your normal speed when tricking. - fixed_t speed = FixedMul(speedmult, P_AproxDistance(player->mo->momx, player->mo->momy)); + fixed_t basespeed = FixedMul(invertscale, K_GetKartSpeed(player, false, false)); // at WORSE, keep your normal speed when tricking. + fixed_t speed = FixedMul(invertscale, FixedMul(speedmult, P_AproxDistance(player->mo->momx, player->mo->momy))); K_trickPanelTimingVisual(player, momz); @@ -11466,7 +11468,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) player->trickboostdecay = min(TICRATE*3/4, abs(momz/FRACUNIT)); //CONS_Printf("decay: %d\n", player->trickboostdecay); - P_SetObjectMomZ(player->mo, 48*FRACUNIT, relative); + P_SetObjectMomZ(player->mo, 48*invertscale, relative); player->trickpanel = 4; } } From ea74a219e51dda0bb46fa3296abc8807dc3c2894 Mon Sep 17 00:00:00 2001 From: toaster Date: Sat, 19 Nov 2022 00:48:50 +0000 Subject: [PATCH 3/4] Use K_GrowShrinkSpeedMul instead of custom-built scale inversion (THANKYOUSAL!!!!!!!!!!!) --- src/k_kart.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index f64ce421b..a2a114057 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -6568,7 +6568,7 @@ void K_DoPogoSpring(mobj_t *mo, fixed_t vertispeed, UINT8 sound) mo->player->tricktime = 0; // Reset post-hitlag timer // Setup the boost for potential upwards trick, at worse, make it your regular max speed. (boost = curr speed*1.25) mo->player->trickboostpower = max(FixedDiv(mo->player->speed, K_GetKartSpeed(mo->player, false, false)) - FRACUNIT, 0)*125/100; - mo->player->trickboostpower = FixedMul(mo->player->trickboostpower, FixedDiv(mapobjectscale, mo->scale)); + mo->player->trickboostpower = FixedDiv(mo->player->trickboostpower, K_GrowShrinkSpeedMul(mo->player)); //CONS_Printf("Got boost: %d%\n", mo->player->trickboostpower*100 / FRACUNIT); } @@ -11362,7 +11362,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) { const angle_t lr = ANGLE_45; fixed_t momz = FixedDiv(player->mo->momz, mapobjectscale); // bring momz back to scale... - fixed_t invertscale = FixedDiv(mapobjectscale, player->mo->scale); + fixed_t invertscale = FixedDiv(FRACUNIT, K_GrowShrinkSpeedMul(player)); fixed_t speedmult = max(0, FRACUNIT - abs(momz)/TRICKMOMZRAMP); // TRICKMOMZRAMP momz is minimum speed (Should be 20) fixed_t basespeed = FixedMul(invertscale, K_GetKartSpeed(player, false, false)); // at WORSE, keep your normal speed when tricking. fixed_t speed = FixedMul(invertscale, FixedMul(speedmult, P_AproxDistance(player->mo->momx, player->mo->momy))); From 1c8e5b3418d69c6ef7b78d8060ec22db224c4eab Mon Sep 17 00:00:00 2001 From: toaster Date: Sat, 19 Nov 2022 01:01:10 +0000 Subject: [PATCH 4/4] Make momz always base-scale handled, to match how gravity works --- src/k_kart.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index a2a114057..0fd3f723b 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -11452,14 +11452,12 @@ void K_MoveKartPlayer(player_t *player, boolean onground) } else if (cmd->throwdir < 0) { - boolean relative = true; - player->mo->momx /= 3; player->mo->momy /= 3; if (player->mo->momz * P_MobjFlip(player->mo) <= 0) { - relative = false; + player->mo->momz = 0; // relative = false; } // Calculate speed boost decay: @@ -11468,7 +11466,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) player->trickboostdecay = min(TICRATE*3/4, abs(momz/FRACUNIT)); //CONS_Printf("decay: %d\n", player->trickboostdecay); - P_SetObjectMomZ(player->mo, 48*invertscale, relative); + player->mo->momz += P_MobjFlip(player->mo)*48*mapobjectscale; player->trickpanel = 4; } }