Merge branch 'normalize-magician-box-offsets' into 'master'

Normalize magician box offsets

See merge request KartKrew/Kart!941
This commit is contained in:
Oni 2023-02-18 23:47:33 +00:00
commit a096f10236
3 changed files with 26 additions and 10 deletions

View file

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

View file

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

View file

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