diff --git a/src/p_mobj.c b/src/p_mobj.c index 5c2a8f724..b9fa47a36 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -13726,6 +13726,18 @@ void P_SpawnItemPattern(mapthing_t *mthing) } } +void P_SpawnItemLine(mapthing_t *mt1, mapthing_t *mt2) +{ + const mobjtype_t type = P_GetMobjtype(mt1->type); + const fixed_t diameter = 2 * FixedMul(mobjinfo[type].radius, mapobjectscale); + const fixed_t dx = (mt2->x - mt1->x) * FRACUNIT; + const fixed_t dy = (mt2->y - mt1->y) * FRACUNIT; + const fixed_t dist = FixedHypot(dx, dy); + const angle_t angle = R_PointToAngle2(0, 0, dx, dy); + + P_SpawnSingularItemRow(mt1, type, (dist / diameter) + 1, diameter, 0, AngleFixed(angle) / FRACUNIT); +} + // // P_CheckMissileSpawn // Moves the missile forward a bit and possibly explodes it right there. diff --git a/src/p_mobj.h b/src/p_mobj.h index dd448841e..d5dc67a3e 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -530,6 +530,7 @@ fixed_t P_GetMapThingSpawnHeight(const mobjtype_t mobjtype, const mapthing_t* mt mobj_t *P_SpawnMapThing(mapthing_t *mthing); void P_SpawnHoop(mapthing_t *mthing); void P_SpawnItemPattern(mapthing_t *mthing); +void P_SpawnItemLine(mapthing_t *mt1, mapthing_t *mt2); void P_SpawnHoopOfSomething(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT32 number, mobjtype_t type, angle_t rotangle); void P_SpawnPrecipitation(void); void P_SpawnParaloop(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT32 number, mobjtype_t type, statenum_t nstate, angle_t rotangle, boolean spawncenter);