Fix attraction bug on non-NiGHTS and Nightopian Helper

* Switch from mo->movecount to mo->movefactor for type compat
* Adjust timings for regular and paraloop attraction
This commit is contained in:
mazmazz 2018-08-12 23:03:12 -04:00
parent d405bdfd9b
commit c3e0267029
3 changed files with 13 additions and 10 deletions

View File

@ -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

View File

@ -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;
}

View File

@ -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);
}
}