From 79f445401683ddf42d855e4a5e2f2f15c6f529dd Mon Sep 17 00:00:00 2001 From: James R Date: Fri, 23 Sep 2022 21:06:33 -0700 Subject: [PATCH] Let jawz wall transfer; don't thrust in air --- src/p_enemy.c | 38 +++++++++++++++++------------------ src/p_mobj.c | 55 +++++++++++++++++++++++---------------------------- 2 files changed, 43 insertions(+), 50 deletions(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index 527dcf0b6..90ab62e29 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -13210,7 +13210,6 @@ void A_ItemPop(mobj_t *actor) void A_JawzChase(mobj_t *actor) { - const fixed_t currentspeed = R_PointToDist2(0, 0, actor->momx, actor->momy); player_t *player; fixed_t thrustamount = 0; fixed_t frictionsafety = (actor->friction == 0) ? 1 : actor->friction; @@ -13295,30 +13294,29 @@ void A_JawzChase(mobj_t *actor) P_SetTarget(&actor->tracer, NULL); } - if (!P_IsObjectOnGround(actor)) - { - // No friction in the air - frictionsafety = FRACUNIT; - } - - if (currentspeed >= topspeed) - { - // Thrust as if you were at top speed, slow down naturally - thrustamount = FixedDiv(topspeed, frictionsafety) - topspeed; - } - else - { - const fixed_t beatfriction = FixedDiv(currentspeed, frictionsafety) - currentspeed; - // Thrust to immediately get to top speed - thrustamount = beatfriction + FixedDiv(topspeed - currentspeed, frictionsafety); - } - if (!actor->tracer) { actor->angle = K_MomentumAngle(actor); } - P_Thrust(actor, actor->angle, thrustamount); + if (P_IsObjectOnGround(actor)) + { + const fixed_t currentspeed = R_PointToDist2(0, 0, actor->momx, actor->momy); + + if (currentspeed >= topspeed) + { + // Thrust as if you were at top speed, slow down naturally + thrustamount = FixedDiv(topspeed, frictionsafety) - topspeed; + } + else + { + const fixed_t beatfriction = FixedDiv(currentspeed, frictionsafety) - currentspeed; + // Thrust to immediately get to top speed + thrustamount = beatfriction + FixedDiv(topspeed - currentspeed, frictionsafety); + } + + P_Thrust(actor, actor->angle, thrustamount); + } if ((actor->tracer != NULL) && (actor->tracer->health > 0)) return; diff --git a/src/p_mobj.c b/src/p_mobj.c index b9dfed581..16d07dfa1 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1594,21 +1594,7 @@ void P_XYMovement(mobj_t *mo) else if (P_MobjWasRemoved(mo)) return; - //{ SRB2kart - Jawz - if (mo->type == MT_JAWZ || mo->type == MT_JAWZ_DUD) - { - if (mo->health == 1) - { - // This Item Damage - S_StartSound(mo, mo->info->deathsound); - P_KillMobj(mo, NULL, NULL, DMG_NORMAL); - - P_SetObjectMomZ(mo, 8*FRACUNIT, false); - P_InstaThrust(mo, R_PointToAngle2(mo->x, mo->y, mo->x + xmove, mo->y + ymove)+ANGLE_90, 16*FRACUNIT); - } - } - //} - else if (mo->flags & MF_MISSILE) + if (mo->flags & MF_MISSILE) { // explode a missile if (P_CheckSkyHit(mo)) @@ -1745,23 +1731,32 @@ void P_XYMovement(mobj_t *mo) fx->scale = mo->scale; } - if (mo->type == MT_ORBINAUT) // Orbinaut speed decreasing + switch (mo->type) { - if (mo->health > 1) - { - S_StartSound(mo, mo->info->attacksound); - mo->health--; - mo->threshold = 0; - } - else if (mo->health == 1) - { - // This Item Damage - S_StartSound(mo, mo->info->deathsound); - P_KillMobj(mo, NULL, NULL, DMG_NORMAL); + case MT_ORBINAUT: // Orbinaut speed decreasing + if (mo->health > 1) + { + S_StartSound(mo, mo->info->attacksound); + mo->health--; + mo->threshold = 0; + } + /*FALLTHRU*/ - P_SetObjectMomZ(mo, 8*FRACUNIT, false); - P_InstaThrust(mo, R_PointToAngle2(mo->x, mo->y, mo->x + xmove, mo->y + ymove)+ANGLE_90, 16*FRACUNIT); - } + case MT_JAWZ: + case MT_JAWZ_DUD: + if (mo->health == 1) + { + // This Item Damage + S_StartSound(mo, mo->info->deathsound); + P_KillMobj(mo, NULL, NULL, DMG_NORMAL); + + P_SetObjectMomZ(mo, 8*FRACUNIT, false); + P_InstaThrust(mo, R_PointToAngle2(mo->x, mo->y, mo->x + xmove, mo->y + ymove)+ANGLE_90, 16*FRACUNIT); + } + break; + + default: + break; } // Bubble bounce