// Function: A_LookForBetter
// Function: A_LookForBetter
//
// Description: A_Look, except it finds a better target in multiplayer, and doesn't lose the target in singleplayer.
//
// var1 lower 16 bits = 0 - looks only in front, 1 - looks all around
// var1 upper 16 bits = distance limit
// var2 = unused
//
void A_LookForBetter(void *data)
{
mobj_t *actor = data;
INT32 locvar1 = var1;
if (LUA_CallAction(A_LOOKFORBETTER, actor))
return;
P_LookForPlayers(actor, (locvar1 & 65535), false, FixedMul((locvar1 >> 16)*FRACUNIT, actor->scale));
A_FaceTarget(actor);
}
/* * Spawns a dust ring.
* The dust ring behaves slightly randomly so it doesn't look too uniform.
*
* \param mobjtype Thing type to make a ring of.
* \param div Amount of things to spawn on the ring.
* \param x Center X coordinates.
* \param y Center Y coordinates.
* \param z Center Z coordinates.
* \param radius Radius.
* \param speed Additional thrust on particles.
* \param initscale Initial scale when spawning.
* \param scale "Default" scale.
*/
static void P_DustRing(mobjtype_t mobjtype, UINT32 div, fixed_t x, fixed_t y, fixed_t z, fixed_t radius, fixed_t speed, fixed_t initscale, fixed_t scale)
{
angle_t ang = FixedAngle(FixedDiv(360*FRACUNIT, div*FRACUNIT)); //(ANGLE_180/div)*2;
UINT32 i;
// it turned out the radius was effectively nullified thanks to errors in the original script
// BUT people preferred how it looked before I "fixed" it, so I got rid of the radius calculations altogether
// this was a bit of a mess to sort out, but at least it's probably somewhat fine now?
// -- Monster Iestyn (21/05/19)
(void)radius;
for (i = 0; i < div; i++)
{
mobj_t *dust = P_SpawnMobj(
x, //+ FixedMul(radius, FINECOSINE((ang*i) >> ANGLETOFINESHIFT)),
y, //+ FixedMul(radius, FINESINE((ang*i) >> ANGLETOFINESHIFT)),
z,
mobjtype
);
if (P_MobjWasRemoved(dust))
continue;
dust->angle = ang*i + ANGLE_90;
P_SetScale(dust, FixedMul(initscale, scale), true);
dust->destscale = FixedMul(4*FRACUNIT + P_RandomFixed(), scale);
dust->scalespeed = scale/24;
P_Thrust(dust, ang*i, speed + FixedMul(P_RandomFixed(), scale));
dust->momz = P_SignedRandom()*scale/64;
}
}
}