mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-28 04:51:42 +00:00
Only spawn lavafall rocks if a player is nearby
This commit is contained in:
parent
5c1189ef4d
commit
6e575b2c1c
1 changed files with 17 additions and 6 deletions
|
|
@ -13751,17 +13751,28 @@ void A_ModuloToState(mobj_t *actor)
|
||||||
//
|
//
|
||||||
void A_LavafallRocks(mobj_t *actor)
|
void A_LavafallRocks(mobj_t *actor)
|
||||||
{
|
{
|
||||||
|
UINT8 i;
|
||||||
|
|
||||||
#ifdef HAVE_BLUA
|
#ifdef HAVE_BLUA
|
||||||
if (LUA_CallAction("A_LavafallRocks", actor))
|
if (LUA_CallAction("A_LavafallRocks", actor))
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
angle_t fa = (FixedAngle(P_RandomKey(360) << FRACBITS) >> ANGLETOFINESHIFT) & FINEMASK;
|
// Don't spawn rocks unless a player is relatively close by.
|
||||||
fixed_t offset = P_RandomRange(4, 12) << FRACBITS;
|
for (i = 0; i < MAXPLAYERS; ++i)
|
||||||
fixed_t xoffs = FixedMul(FINECOSINE(fa), actor->radius + offset);
|
if (playeringame[i] && players[i].mo
|
||||||
fixed_t yoffs = FixedMul(FINESINE(fa), actor->radius + offset);
|
&& P_AproxDistance(actor->x - players[i].mo->x, actor->y - players[i].mo->y) < (1600 << FRACBITS))
|
||||||
mobj_t *particle = P_SpawnMobjFromMobj(actor, xoffs, yoffs, 0, MT_LAVAFALLROCK);
|
break; // Stop looking.
|
||||||
P_SetMobjState(particle, S_LAVAFALLROCK1 + P_RandomRange(0, 3));
|
|
||||||
|
if (i < MAXPLAYERS)
|
||||||
|
{
|
||||||
|
angle_t fa = (FixedAngle(P_RandomKey(360) << FRACBITS) >> ANGLETOFINESHIFT) & FINEMASK;
|
||||||
|
fixed_t offset = P_RandomRange(4, 12) << FRACBITS;
|
||||||
|
fixed_t xoffs = FixedMul(FINECOSINE(fa), actor->radius + offset);
|
||||||
|
fixed_t yoffs = FixedMul(FINESINE(fa), actor->radius + offset);
|
||||||
|
mobj_t *particle = P_SpawnMobjFromMobj(actor, xoffs, yoffs, 0, MT_LAVAFALLROCK);
|
||||||
|
P_SetMobjState(particle, S_LAVAFALLROCK1 + P_RandomRange(0, 3));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function: A_LavafallLava
|
// Function: A_LavafallLava
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue