diff --git a/src/p_inter.c b/src/p_inter.c index f93a190af..46c7aeb7a 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -946,7 +946,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) // Yay! The thing's in reach! Pull it in! mo2->flags |= MF_NOCLIP|MF_NOCLIPHEIGHT; mo2->flags2 |= MF2_NIGHTSPULL; - mo2->movecount = 24*FRACUNIT; // initialize the NightsItemChase timer + mo2->movefactor = 32*FRACUNIT; // initialize the NightsItemChase timer P_SetTarget(&mo2->tracer, toucher); } } @@ -2127,7 +2127,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget if (target->flags2 & MF2_NIGHTSPULL) { P_SetTarget(&target->tracer, NULL); - target->movecount = 0; // reset NightsItemChase timer + target->movefactor = 0; // reset NightsItemChase timer } // dead target is no more shootable diff --git a/src/p_mobj.c b/src/p_mobj.c index d80d967a8..ac6091dc7 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6120,11 +6120,11 @@ void P_Attract(mobj_t *source, mobj_t *dest, boolean nightsgrab) // Home in on y if (dist < 1) dist = 1; - if (nightsgrab && dest->player->powers[pw_carry] == CR_NIGHTSMODE) + if (nightsgrab && source->movefactor) { - source->movecount += FRACUNIT/2; + source->movefactor += FRACUNIT/2; - if (dist < source->movecount) + if (dist < source->movefactor) { source->momx = source->momy = source->momz = 0; P_TeleportMove(source, tx, ty, tz); @@ -6133,9 +6133,9 @@ void P_Attract(mobj_t *source, mobj_t *dest, boolean nightsgrab) // Home in on y { vangle = R_PointToAngle2(source->z, 0, tz, xydist); - source->momx = FixedMul(FINESINE(vangle >> ANGLETOFINESHIFT), FixedMul(FINECOSINE(source->angle >> ANGLETOFINESHIFT), source->movecount)); - source->momy = FixedMul(FINESINE(vangle >> ANGLETOFINESHIFT), FixedMul(FINESINE(source->angle >> ANGLETOFINESHIFT), source->movecount)); - source->momz = FixedMul(FINECOSINE(vangle >> ANGLETOFINESHIFT), source->movecount); + source->momx = FixedMul(FINESINE(vangle >> ANGLETOFINESHIFT), FixedMul(FINECOSINE(source->angle >> ANGLETOFINESHIFT), source->movefactor)); + source->momy = FixedMul(FINESINE(vangle >> ANGLETOFINESHIFT), FixedMul(FINESINE(source->angle >> ANGLETOFINESHIFT), source->movefactor)); + source->momz = FixedMul(FINECOSINE(vangle >> ANGLETOFINESHIFT), source->movefactor); } } else @@ -6173,7 +6173,7 @@ static void P_NightsItemChase(mobj_t *thing) { P_SetTarget(&thing->tracer, NULL); thing->flags2 &= ~MF2_NIGHTSPULL; - //thing->movecount = 0; + thing->movefactor = 0; return; } diff --git a/src/p_user.c b/src/p_user.c index b363cb930..2962ca5ad 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -9770,13 +9770,16 @@ void P_PlayerThink(player_t *player) || mo2->type == MT_NIGHTSCHIP || mo2->type == MT_NIGHTSSTAR)) continue; + if (mo2->flags2 & MF2_NIGHTSPULL) + continue; + if (P_AproxDistance(P_AproxDistance(mo2->x - x, mo2->y - y), mo2->z - z) > FixedMul(128*FRACUNIT, player->mo->scale)) continue; // Yay! The thing's in reach! Pull it in! mo2->flags |= MF_NOCLIP|MF_NOCLIPHEIGHT; mo2->flags2 |= MF2_NIGHTSPULL; - mo2->movecount = 24*FRACUNIT; // initialize NightsItemChase timer + mo2->movefactor = 40*FRACUNIT; // initialize the NightsItemChase timer P_SetTarget(&mo2->tracer, player->mo); } }