From 8af130f79254b37ed2a689f9c022b80e9ba781bc Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 24 Sep 2022 03:05:30 -0700 Subject: [PATCH 1/8] Let Drop Targets collide with other players immediately after being thrown --- src/k_collide.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/k_collide.c b/src/k_collide.c index 33834e88f..ab0824eb2 100644 --- a/src/k_collide.c +++ b/src/k_collide.c @@ -474,7 +474,7 @@ boolean K_DropTargetCollide(mobj_t *t1, mobj_t *t2) { mobj_t *draggeddroptarget = (t1->type == MT_DROPTARGET_SHIELD) ? t1->target : NULL; - if ((t1->threshold > 0 && (t2->hitlag > 0 || !draggeddroptarget)) || (t2->threshold > 0 && t1->hitlag > 0)) + if ((t1->threshold > 0 && t2->hitlag > 0) || (t2->threshold > 0 && t1->hitlag > 0)) return true; if (((t1->target == t2) || (t1->target == t2->target)) && (t1->threshold > 0 || (t2->type != MT_PLAYER && t2->threshold > 0))) From de74808eaacbfd48d60d6db745cb1afa3b2a7f67 Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 24 Sep 2022 03:05:52 -0700 Subject: [PATCH 2/8] Let Drop Targets collide with other items immediately after being thrown see efc415e5 --- src/k_collide.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/k_collide.c b/src/k_collide.c index ab0824eb2..f2fc379ae 100644 --- a/src/k_collide.c +++ b/src/k_collide.c @@ -477,7 +477,7 @@ boolean K_DropTargetCollide(mobj_t *t1, mobj_t *t2) if ((t1->threshold > 0 && t2->hitlag > 0) || (t2->threshold > 0 && t1->hitlag > 0)) return true; - if (((t1->target == t2) || (t1->target == t2->target)) && (t1->threshold > 0 || (t2->type != MT_PLAYER && t2->threshold > 0))) + if (((t1->target == t2) || (t1->target == t2->target)) && ((t1->threshold > 0 && t2->type == MT_PLAYER) || (t2->type != MT_PLAYER && t2->threshold > 0))) return true; if (t1->health <= 0 || t2->health <= 0) From b2913b9a190ea7817effe472dc16fbf0bf299b47 Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 24 Sep 2022 03:46:41 -0700 Subject: [PATCH 3/8] Let Drop Targets hit the thrower immediately after bouncing off a wall --- src/p_mobj.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/p_mobj.c b/src/p_mobj.c index d9920a928..90b31b1bc 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1791,6 +1791,8 @@ void P_XYMovement(mobj_t *mo) { S_StartSound(mo, mo->info->attacksound); mo->health--; + // This prevents an item thrown at a wall from + // phasing through you on its return. mo->threshold = 0; } /*FALLTHRU*/ @@ -1811,6 +1813,12 @@ void P_XYMovement(mobj_t *mo) S_StartSound(mo, sfx_s3k44); // Bubble bounce break; + case MT_DROPTARGET: + // This prevents an item thrown at a wall from + // phasing through you on its return. + mo->threshold = 0; + break; + default: break; } From b2268157fda15b6e948d1777bc78004f0024b90b Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 24 Sep 2022 04:22:30 -0700 Subject: [PATCH 4/8] Fix type check for Land Mines vs Drop Target/Bubble Shield expand Fixes Drop Targets not pushing Land Mines. --- src/p_map.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 1f7051c10..72d96885b 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -931,7 +931,7 @@ static BlockItReturn_t PIT_CheckThing(mobj_t *thing) || (tm.thing->player && tm.thing->player->bubbleblowup)) && (thing->type == MT_ORBINAUT || thing->type == MT_JAWZ || thing->type == MT_GACHABOM || thing->type == MT_BANANA || thing->type == MT_EGGMANITEM || thing->type == MT_BALLHOG - || thing->type == MT_SSMINE || tm.thing->type == MT_LANDMINE || thing->type == MT_SINK + || thing->type == MT_SSMINE || thing->type == MT_LANDMINE || thing->type == MT_SINK || thing->type == MT_GARDENTOP || (thing->type == MT_PLAYER && tm.thing->target != thing))) { @@ -967,7 +967,7 @@ static BlockItReturn_t PIT_CheckThing(mobj_t *thing) else if ((tm.thing->type == MT_DROPTARGET || tm.thing->type == MT_DROPTARGET_SHIELD) && (thing->type == MT_ORBINAUT || thing->type == MT_JAWZ || thing->type == MT_GACHABOM || thing->type == MT_BANANA || thing->type == MT_EGGMANITEM || thing->type == MT_BALLHOG - || thing->type == MT_SSMINE || tm.thing->type == MT_LANDMINE || thing->type == MT_SINK + || thing->type == MT_SSMINE || thing->type == MT_LANDMINE || thing->type == MT_SINK || thing->type == MT_GARDENTOP || (thing->type == MT_PLAYER))) { From 7a8a377d930b88b667d493ea8c8e6a56725ef662 Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 24 Sep 2022 05:04:24 -0700 Subject: [PATCH 5/8] Bubble reflect Drop Targets --- src/k_collide.c | 2 +- src/p_map.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/k_collide.c b/src/k_collide.c index f2fc379ae..ee773dfa3 100644 --- a/src/k_collide.c +++ b/src/k_collide.c @@ -711,7 +711,7 @@ boolean K_BubbleShieldCollide(mobj_t *t1, mobj_t *t2) } else { - if (!t2->threshold) + if (!t2->threshold || t2->type == MT_DROPTARGET) { if (!t2->momx && !t2->momy) { diff --git a/src/p_map.c b/src/p_map.c index 72d96885b..bb1953414 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -917,6 +917,7 @@ static BlockItReturn_t PIT_CheckThing(mobj_t *thing) || tm.thing->type == MT_BANANA || tm.thing->type == MT_EGGMANITEM || tm.thing->type == MT_BALLHOG || tm.thing->type == MT_SSMINE || tm.thing->type == MT_LANDMINE || tm.thing->type == MT_SINK || tm.thing->type == MT_GARDENTOP + || tm.thing->type == MT_DROPTARGET || (tm.thing->type == MT_PLAYER && thing->target != tm.thing))) { // see if it went over / under @@ -933,6 +934,7 @@ static BlockItReturn_t PIT_CheckThing(mobj_t *thing) || thing->type == MT_BANANA || thing->type == MT_EGGMANITEM || thing->type == MT_BALLHOG || thing->type == MT_SSMINE || thing->type == MT_LANDMINE || thing->type == MT_SINK || thing->type == MT_GARDENTOP + || thing->type == MT_DROPTARGET || (thing->type == MT_PLAYER && tm.thing->target != thing))) { // see if it went over / under From 4e9d2295c9da30888fea77825c276bac831aecb3 Mon Sep 17 00:00:00 2001 From: toaster Date: Wed, 1 Mar 2023 19:02:54 +0000 Subject: [PATCH 6/8] Obj_OrbinautJawzMoveHeld: Make loop iteration less fragile MF_NOCLIPTHING is no longer enough to prevent the object from being removed. All calls which can delete the object should now be handled more thoroughly. --- src/objects/orbinaut.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/objects/orbinaut.c b/src/objects/orbinaut.c index 27e3fe742..6f9ba3788 100644 --- a/src/objects/orbinaut.c +++ b/src/objects/orbinaut.c @@ -335,23 +335,24 @@ void Obj_OrbinautJawzMoveHeld(player_t *player) { fixed_t finalscale = K_ItemScaleForPlayer(player); fixed_t speed = 0; - mobj_t *cur = NULL; + mobj_t *cur = NULL, *next = player->mo->hnext; player->bananadrag = 0; // Just to make sure - cur = player->mo->hnext; - speed = ((8 - min(4, player->itemamount)) * cur->info->speed) / 7; + if (next == NULL) + return; - while (cur != NULL && P_MobjWasRemoved(cur) == false) + speed = ((8 - min(4, player->itemamount)) * next->info->speed) / 7; + + while ((cur = next) != NULL && P_MobjWasRemoved(cur) == false) { const fixed_t radius = FixedHypot(player->mo->radius, player->mo->radius) + FixedHypot(cur->radius, cur->radius); // mobj's distance from its Target, or Radius. fixed_t z; + next = cur->hnext; + if (!cur->health) - { - cur = cur->hnext; continue; - } cur->color = player->skincolor; @@ -391,15 +392,17 @@ void Obj_OrbinautJawzMoveHeld(player_t *player) z = player->mo->z + player->mo->height - cur->height; } - cur->flags |= MF_NOCLIPTHING; // temporarily make them noclip other objects so they can't hit anyone while in the player + cur->flags |= (MF_NOCLIP|MF_NOCLIPTHING); // temporarily make them noclip other objects so they can't hit anyone while in the player P_MoveOrigin(cur, player->mo->x, player->mo->y, z); cur->momx = FixedMul(FINECOSINE(cur->angle >> ANGLETOFINESHIFT), orbinaut_shield_dist(cur)); cur->momy = FixedMul(FINESINE(cur->angle >> ANGLETOFINESHIFT), orbinaut_shield_dist(cur)); - cur->flags &= ~MF_NOCLIPTHING; + cur->flags &= ~(MF_NOCLIP|MF_NOCLIPTHING); if (!P_TryMove(cur, player->mo->x + cur->momx, player->mo->y + cur->momy, true, NULL)) { P_SlideMove(cur, NULL); + if (P_MobjWasRemoved(cur)) + continue; } if (P_IsObjectOnGround(player->mo)) @@ -426,8 +429,6 @@ void Obj_OrbinautJawzMoveHeld(player_t *player) cur->z = z; cur->momx = cur->momy = 0; cur->angle += ANGLE_90; - - cur = cur->hnext; } } From ac086fe09a2288ccdd6e494f537014157d526c76 Mon Sep 17 00:00:00 2001 From: toaster Date: Wed, 1 Mar 2023 19:03:51 +0000 Subject: [PATCH 7/8] K_PuntMine: Same MF_NOCLIP change regression fix --- src/k_kart.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 813c0f441..60a3ea2e8 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -5625,7 +5625,7 @@ void K_PuntMine(mobj_t *origMine, mobj_t *punter) spd = FixedMul(82 * punter->scale, K_GetKartGameSpeedScalar(gamespeed)); // Avg Speed is 41 in Normal - mine->flags |= MF_NOCLIPTHING; + mine->flags |= (MF_NOCLIP|MF_NOCLIPTHING); P_SetMobjState(mine, S_SSMINE_AIR1); mine->threshold = 10; @@ -5637,7 +5637,7 @@ void K_PuntMine(mobj_t *origMine, mobj_t *punter) //K_SetHitLagForObjects(punter, mine, 5); - mine->flags &= ~MF_NOCLIPTHING; + mine->flags &= ~(MF_NOCLIP|MF_NOCLIPTHING); } #define THUNDERRADIUS 320 @@ -6150,11 +6150,11 @@ void K_DropHnextList(player_t *player, boolean keepshields) { fixed_t radius = FixedMul(work->info->radius, dropwork->destscale); radius = FixedHypot(player->mo->radius, player->mo->radius) + FixedHypot(radius, radius); // mobj's distance from its Target, or Radius. - dropwork->flags |= MF_NOCLIPTHING; + dropwork->flags |= (MF_NOCLIP|MF_NOCLIPTHING); work->momx = FixedMul(FINECOSINE(work->angle>>ANGLETOFINESHIFT), radius); work->momy = FixedMul(FINESINE(work->angle>>ANGLETOFINESHIFT), radius); P_MoveOrigin(dropwork, player->mo->x + work->momx, player->mo->y + work->momy, player->mo->z); - dropwork->flags &= ~MF_NOCLIPTHING; + dropwork->flags &= ~(MF_NOCLIP|MF_NOCLIPTHING); } dropwork->flags2 |= MF2_AMBUSH; From 746171a8ad8144c3170ae2ee96ecf28a18b4d8e6 Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Thu, 2 Mar 2023 02:47:29 -0700 Subject: [PATCH 8/8] Fix powerup music inconsistencies --- src/k_kart.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 813c0f441..ff5b0b64d 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -5930,9 +5930,7 @@ void K_DoInvincibility(player_t *player, tic_t time) P_SetScale(overlay, player->mo->scale); } - player->invincibilitytimer += time; - - if (P_IsLocalPlayer(player) == true) + if (P_IsLocalPlayer(player) == true && player->invincibilitytimer == 0) { S_ChangeMusicSpecial("kinvnc"); } @@ -5941,6 +5939,8 @@ void K_DoInvincibility(player_t *player, tic_t time) S_StartSound(player->mo, sfx_alarmi); } + player->invincibilitytimer += time; + P_RestoreMusic(player); } @@ -10540,11 +10540,11 @@ void K_MoveKartPlayer(player_t *player, boolean onground) S_StartSound(player->mo, sfx_alarmg); } - P_RestoreMusic(player); - player->growshrinktimer = max(0, player->growshrinktimer); player->growshrinktimer += ((gametyperules & GTR_CLOSERPLAYERS) ? 8 : 12) * TICRATE; + P_RestoreMusic(player); + S_StartSound(player->mo, sfx_kc5a); player->itemamount--;