diff --git a/src/k_kart.c b/src/k_kart.c index d44036001..a5d64df60 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1978,10 +1978,11 @@ void K_SpawnMagicianParticles(mobj_t *mo, int spread) else ang += ANGLE_90; - dust = P_SpawnMobjFromMobj(mo, - FixedMul(mo->radius, FINECOSINE(ang >> ANGLETOFINESHIFT)), - FixedMul(mo->radius, FINESINE(ang >> ANGLETOFINESHIFT)), - target->height, (i%3 == 0) ? MT_SIGNSPARKLE : MT_SPINDASHDUST + // sprzoff for Garden Top!! + dust = P_SpawnMobjFromMobjUnscaled(mo, + FixedMul(mo->radius / 4, FINECOSINE(ang >> ANGLETOFINESHIFT)), + FixedMul(mo->radius / 4, FINESINE(ang >> ANGLETOFINESHIFT)), + (target->height / 4) + target->sprzoff, (i%3 == 0) ? MT_SIGNSPARKLE : MT_SPINDASHDUST ); flip = P_MobjFlip(dust); diff --git a/src/p_local.h b/src/p_local.h index 4824da84b..bf847fbca 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -330,6 +330,7 @@ boolean P_CheckDeathPitCollide(mobj_t *mo); boolean P_CheckSolidLava(mobj_t *mobj, ffloor_t *rover); void P_AdjustMobjFloorZ_FFloors(mobj_t *mo, sector_t *sector, UINT8 motype); +mobj_t *P_SpawnMobjFromMobjUnscaled(mobj_t *mobj, fixed_t xofs, fixed_t yofs, fixed_t zofs, mobjtype_t type); mobj_t *P_SpawnMobjFromMobj(mobj_t *mobj, fixed_t xofs, fixed_t yofs, fixed_t zofs, mobjtype_t type); mobj_t *P_SpawnMissile(mobj_t *source, mobj_t *dest, mobjtype_t type); diff --git a/src/p_mobj.c b/src/p_mobj.c index bd50a9a51..3ac878bb5 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -8091,6 +8091,9 @@ static boolean P_MobjRegularThink(mobj_t *mobj) zoff = mobj->radius*4; } + // Necessary to "ride" on Garden Top + zoff += mobj->target->sprzoff; + if (mobj->flags2 & MF2_AMBUSH) { P_SetOrigin(mobj, destx, desty, mobj->target->z + zoff); @@ -14161,18 +14164,14 @@ fixed_t P_ScaleFromMap(fixed_t n, fixed_t scale) } // -// P_SpawnMobjFromMobj +// P_SpawnMobjFromMobjUnscaled // Spawns an object with offsets relative to the position of another object. // Scale, gravity flip, etc. is taken into account automatically. // -mobj_t *P_SpawnMobjFromMobj(mobj_t *mobj, fixed_t xofs, fixed_t yofs, fixed_t zofs, mobjtype_t type) +mobj_t *P_SpawnMobjFromMobjUnscaled(mobj_t *mobj, fixed_t xofs, fixed_t yofs, fixed_t zofs, mobjtype_t type) { mobj_t *newmobj; - xofs = FixedMul(xofs, mobj->scale); - yofs = FixedMul(yofs, mobj->scale); - zofs = FixedMul(zofs, mobj->scale); - newmobj = P_SpawnMobj(mobj->x + xofs, mobj->y + yofs, mobj->z + zofs, type); if (!newmobj) return NULL; @@ -14225,6 +14224,21 @@ mobj_t *P_SpawnMobjFromMobj(mobj_t *mobj, fixed_t xofs, fixed_t yofs, fixed_t zo return newmobj; } +// +// P_SpawnMobjFromMobj +// Spawns an object with offsets relative to the position of another object. +// Scale, gravity flip, etc. is taken into account automatically. +// The offsets are automatically scaled by source object's scale. +// +mobj_t *P_SpawnMobjFromMobj(mobj_t *mobj, fixed_t xofs, fixed_t yofs, fixed_t zofs, mobjtype_t type) +{ + xofs = FixedMul(xofs, mobj->scale); + yofs = FixedMul(yofs, mobj->scale); + zofs = FixedMul(zofs, mobj->scale); + + return P_SpawnMobjFromMobjUnscaled(mobj, xofs, yofs, zofs, type); +} + // // P_GetMobjHead & P_GetMobjFeet // Returns the top and bottom of an object, follows appearance, not physics,