Add P_SpawnItemLine, spawn a row of mapthings between two points

This commit is contained in:
James R 2022-11-21 16:23:32 -08:00
parent 290d3fd3e8
commit 49bb2a377e
2 changed files with 13 additions and 0 deletions

View file

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

View file

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