Prevent laser sprites clipping into walls/off ledges
This commit is contained in:
parent
36b400387e
commit
9d21d790a4
|
@ -5696,7 +5696,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
||||||
DMG_FIRE, // mass
|
DMG_FIRE, // mass
|
||||||
1, // damage
|
1, // damage
|
||||||
sfx_None, // activesound
|
sfx_None, // activesound
|
||||||
MF_NOBLOCKMAP|MF_MISSILE|MF_NOGRAVITY|MF_FIRE, // flags
|
MF_NOGRAVITY|MF_FIRE|MF_PAIN, // flags
|
||||||
S_NULL // raisestate
|
S_NULL // raisestate
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -3117,7 +3117,7 @@ void A_Boss1Laser(mobj_t *actor)
|
||||||
floorz = P_FloorzAtPos(x, y, z, mobjinfo[MT_EGGMOBILE_FIRE].height);
|
floorz = P_FloorzAtPos(x, y, z, mobjinfo[MT_EGGMOBILE_FIRE].height);
|
||||||
if (z - floorz < mobjinfo[MT_EGGMOBILE_FIRE].height>>1 && dur & 1)
|
if (z - floorz < mobjinfo[MT_EGGMOBILE_FIRE].height>>1 && dur & 1)
|
||||||
{
|
{
|
||||||
point = P_SpawnMobj(x, y, floorz+1, MT_EGGMOBILE_FIRE);
|
point = P_SpawnMobj(x, y, floorz, MT_EGGMOBILE_FIRE);
|
||||||
point->angle = actor->angle;
|
point->angle = actor->angle;
|
||||||
point->destscale = actor->scale;
|
point->destscale = actor->scale;
|
||||||
P_SetScale(point, point->destscale);
|
P_SetScale(point, point->destscale);
|
||||||
|
@ -3136,8 +3136,20 @@ void A_Boss1Laser(mobj_t *actor)
|
||||||
S_StartSound(steam, point->info->painsound);
|
S_StartSound(steam, point->info->painsound);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (point->info->seesound)
|
else
|
||||||
S_StartSound(point, point->info->seesound);
|
{
|
||||||
|
fixed_t distx = P_ReturnThrustX(point, point->angle, point->radius);
|
||||||
|
fixed_t disty = P_ReturnThrustY(point, point->angle, point->radius);
|
||||||
|
if (P_TryMove(point, point->x + distx, point->y + disty, false) // prevents the sprite from clipping into the wall or dangling off ledges
|
||||||
|
&& P_TryMove(point, point->x - 2*distx, point->y - 2*disty, false)
|
||||||
|
&& P_TryMove(point, point->x + distx, point->y + disty, false))
|
||||||
|
{
|
||||||
|
if (point->info->seesound)
|
||||||
|
S_StartSound(point, point->info->seesound);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
P_RemoveMobj(point);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dur > 1)
|
if (dur > 1)
|
||||||
|
|
Loading…
Reference in New Issue